@mptool/all 0.10.5 → 0.10.7
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 +15 -3
- package/lib/index.d.ts +15 -3
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +6 -6
- package/lib/index.mjs.map +1 -1
- package/package.json +5 -5
package/lib/index.d.mts
CHANGED
|
@@ -462,7 +462,11 @@ interface ExtendedComponentMethods extends InstanceEmitterMethods {
|
|
|
462
462
|
type ComponentInstance<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends Partial<WechatMiniprogram.Component.MethodOption>, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = WechatMiniprogram.Component.InstanceProperties & WechatMiniprogram.Component.InstanceMethods<Data> & ExtendedComponentMethods & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>) & InstanceProps & ExtendedComponentProperty & ExtendedPageMethods<Data & InferPropTypes<Props>, InstanceProps & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>)> & {
|
|
463
463
|
/** 组件数据,**包括内部数据和属性值** */
|
|
464
464
|
data: Data & InferPropTypes<Props>;
|
|
465
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* @deprecated 优先使用 `data`
|
|
467
|
+
*
|
|
468
|
+
* 组件数据,**包括内部数据和属性值**(与 `data` 一致)
|
|
469
|
+
*/
|
|
466
470
|
properties: Data & InferPropTypes<Props>;
|
|
467
471
|
};
|
|
468
472
|
type ComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends WechatMiniprogram.Component.MethodOption, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = Partial<WechatMiniprogram.Component.Data<Data>> & Partial<{
|
|
@@ -486,6 +490,10 @@ declare const getRef: (id: number) => TrivialComponentInstance;
|
|
|
486
490
|
declare const setRef: (id: number, value: TrivialComponentInstance) => void;
|
|
487
491
|
declare const removeRef: (id: number) => void;
|
|
488
492
|
|
|
493
|
+
declare const go: (pageName: string) => Promise<WechatMiniprogram.NavigateToSuccessCallbackResult>;
|
|
494
|
+
declare const redirect: (pageName: string) => Promise<WechatMiniprogram.GeneralCallbackResult>;
|
|
495
|
+
declare const switchTab: (pageName: string) => Promise<WechatMiniprogram.GeneralCallbackResult>;
|
|
496
|
+
declare const reLaunch: (pageName: string) => Promise<WechatMiniprogram.GeneralCallbackResult>;
|
|
489
497
|
declare function bind(this: TrivialComponentInstance, touchEvent: WechatMiniprogram.Touch<{
|
|
490
498
|
id: number;
|
|
491
499
|
event: string;
|
|
@@ -1002,6 +1010,10 @@ declare const isDir: (path: string) => boolean;
|
|
|
1002
1010
|
declare const rm: (path: string, type?: "dir" | "file") => void;
|
|
1003
1011
|
/** 列出目录下内容 */
|
|
1004
1012
|
declare const ls: (path: string) => string[];
|
|
1013
|
+
interface ReadFile {
|
|
1014
|
+
(path: string): string | undefined;
|
|
1015
|
+
<T extends FileEncoding>(path: string, encoding: T): (T extends "binary" ? ArrayBuffer : string) | undefined;
|
|
1016
|
+
}
|
|
1005
1017
|
/**
|
|
1006
1018
|
* 文件管理器读取文件包装
|
|
1007
1019
|
*
|
|
@@ -1009,7 +1021,7 @@ declare const ls: (path: string) => string[];
|
|
|
1009
1021
|
* @param encoding 文件的编码格式,默认 `utf-8`
|
|
1010
1022
|
* @returns 文件内容
|
|
1011
1023
|
*/
|
|
1012
|
-
declare const readFile:
|
|
1024
|
+
declare const readFile: ReadFile;
|
|
1013
1025
|
/**
|
|
1014
1026
|
* 读取并解析 JSON 文件
|
|
1015
1027
|
*
|
|
@@ -1885,4 +1897,4 @@ declare const getRichTextNodes: (content: string | AnyNode[], { appendClass, tra
|
|
|
1885
1897
|
|
|
1886
1898
|
declare const getText: (content: string | AnyNode[]) => string;
|
|
1887
1899
|
|
|
1888
|
-
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 Env, 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, env, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getCurrentPage, getCurrentRoute, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, getWindowInfo, handleProperties, isDir, isFile, isFunction, 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 };
|
|
1900
|
+
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 Env, 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, env, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getCurrentPage, getCurrentRoute, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, getWindowInfo, go, handleProperties, isDir, isFile, isFunction, lock, logger, ls, mkdir, normalizeDomain, once, openDocument, parseCookieHeader, parseHTML, parseUrl, put, query, reLaunch, readFile, readJSON, redirect, remove, removeAsync, removeRef, reportNetworkStatus, request, requestCookieStore, retry, rm, saveDocument, saveFile, saveOnlineFile, savePhoto, set, setAsync, setRef, showModal, showToast, storage, switchTab, take, type, unzip, updateApp, wrapFunction, writeClipboard, writeFile, writeJSON };
|
package/lib/index.d.ts
CHANGED
|
@@ -462,7 +462,11 @@ interface ExtendedComponentMethods extends InstanceEmitterMethods {
|
|
|
462
462
|
type ComponentInstance<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends Partial<WechatMiniprogram.Component.MethodOption>, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = WechatMiniprogram.Component.InstanceProperties & WechatMiniprogram.Component.InstanceMethods<Data> & ExtendedComponentMethods & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>) & InstanceProps & ExtendedComponentProperty & ExtendedPageMethods<Data & InferPropTypes<Props>, InstanceProps & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>)> & {
|
|
463
463
|
/** 组件数据,**包括内部数据和属性值** */
|
|
464
464
|
data: Data & InferPropTypes<Props>;
|
|
465
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* @deprecated 优先使用 `data`
|
|
467
|
+
*
|
|
468
|
+
* 组件数据,**包括内部数据和属性值**(与 `data` 一致)
|
|
469
|
+
*/
|
|
466
470
|
properties: Data & InferPropTypes<Props>;
|
|
467
471
|
};
|
|
468
472
|
type ComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends WechatMiniprogram.Component.MethodOption, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = Partial<WechatMiniprogram.Component.Data<Data>> & Partial<{
|
|
@@ -486,6 +490,10 @@ declare const getRef: (id: number) => TrivialComponentInstance;
|
|
|
486
490
|
declare const setRef: (id: number, value: TrivialComponentInstance) => void;
|
|
487
491
|
declare const removeRef: (id: number) => void;
|
|
488
492
|
|
|
493
|
+
declare const go: (pageName: string) => Promise<WechatMiniprogram.NavigateToSuccessCallbackResult>;
|
|
494
|
+
declare const redirect: (pageName: string) => Promise<WechatMiniprogram.GeneralCallbackResult>;
|
|
495
|
+
declare const switchTab: (pageName: string) => Promise<WechatMiniprogram.GeneralCallbackResult>;
|
|
496
|
+
declare const reLaunch: (pageName: string) => Promise<WechatMiniprogram.GeneralCallbackResult>;
|
|
489
497
|
declare function bind(this: TrivialComponentInstance, touchEvent: WechatMiniprogram.Touch<{
|
|
490
498
|
id: number;
|
|
491
499
|
event: string;
|
|
@@ -1002,6 +1010,10 @@ declare const isDir: (path: string) => boolean;
|
|
|
1002
1010
|
declare const rm: (path: string, type?: "dir" | "file") => void;
|
|
1003
1011
|
/** 列出目录下内容 */
|
|
1004
1012
|
declare const ls: (path: string) => string[];
|
|
1013
|
+
interface ReadFile {
|
|
1014
|
+
(path: string): string | undefined;
|
|
1015
|
+
<T extends FileEncoding>(path: string, encoding: T): (T extends "binary" ? ArrayBuffer : string) | undefined;
|
|
1016
|
+
}
|
|
1005
1017
|
/**
|
|
1006
1018
|
* 文件管理器读取文件包装
|
|
1007
1019
|
*
|
|
@@ -1009,7 +1021,7 @@ declare const ls: (path: string) => string[];
|
|
|
1009
1021
|
* @param encoding 文件的编码格式,默认 `utf-8`
|
|
1010
1022
|
* @returns 文件内容
|
|
1011
1023
|
*/
|
|
1012
|
-
declare const readFile:
|
|
1024
|
+
declare const readFile: ReadFile;
|
|
1013
1025
|
/**
|
|
1014
1026
|
* 读取并解析 JSON 文件
|
|
1015
1027
|
*
|
|
@@ -1885,4 +1897,4 @@ declare const getRichTextNodes: (content: string | AnyNode[], { appendClass, tra
|
|
|
1885
1897
|
|
|
1886
1898
|
declare const getText: (content: string | AnyNode[]) => string;
|
|
1887
1899
|
|
|
1888
|
-
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 Env, 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, env, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getCurrentPage, getCurrentRoute, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, getWindowInfo, handleProperties, isDir, isFile, isFunction, 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 };
|
|
1900
|
+
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 Env, 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, env, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getCurrentPage, getCurrentRoute, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, getWindowInfo, go, handleProperties, isDir, isFile, isFunction, lock, logger, ls, mkdir, normalizeDomain, once, openDocument, parseCookieHeader, parseHTML, parseUrl, put, query, reLaunch, readFile, readJSON, redirect, remove, removeAsync, removeRef, reportNetworkStatus, request, requestCookieStore, retry, rm, saveDocument, saveFile, saveOnlineFile, savePhoto, set, setAsync, setRef, showModal, showToast, storage, switchTab, take, type, unzip, updateApp, wrapFunction, writeClipboard, writeFile, writeJSON };
|