@hylid/types 0.0.2-dev.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/README.md +17 -0
- package/lib/common.d.ts +27 -0
- package/lib/common.js +1 -0
- package/lib/custom/appLink.d.ts +32 -0
- package/lib/custom/appLink.js +1 -0
- package/lib/custom/index.d.ts +5 -0
- package/lib/custom/index.js +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +4 -0
- package/lib/jsapi.d.ts +250 -0
- package/lib/jsapi.js +1 -0
- package/lib/mp.d.ts +310 -0
- package/lib/mp.js +1 -0
- package/package.json +18 -0
package/README.md
ADDED
package/lib/common.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare type PickAttr<Attr extends keyof T, T = any> = {
|
|
2
|
+
[P in keyof T]: T[Attr];
|
|
3
|
+
}[keyof T];
|
|
4
|
+
export declare type Common = Record<string, any>;
|
|
5
|
+
export declare type Callback<T> = (result?: T) => void;
|
|
6
|
+
/**
|
|
7
|
+
* jsapi 类型
|
|
8
|
+
* @enum {string}
|
|
9
|
+
* @memberof JsApiType
|
|
10
|
+
* @property {string} async 参数有回调函数的异步 JSAPI(如: my.getSystemInfo)
|
|
11
|
+
* @property {string} sync 参数无回调函数的不同 JSAPI(如: my.getSystemInfoSync)
|
|
12
|
+
* @property {string} callback 参数是回调函数的 JSAPI(如: my.onAppShow)
|
|
13
|
+
* @property {string} attribute 访问 my 对象上的属性(如: my.SDKVersion)套壳 H5 only
|
|
14
|
+
*/
|
|
15
|
+
export declare type JsApiType = 'async' | 'sync' | 'callback' | 'attribute';
|
|
16
|
+
export interface GetGeneralAppInfo {
|
|
17
|
+
(): {
|
|
18
|
+
walletLogo: string;
|
|
19
|
+
walletName: string;
|
|
20
|
+
appIcon?: string;
|
|
21
|
+
iosDownloadLink: string;
|
|
22
|
+
androidDownloadLink: string;
|
|
23
|
+
iOSAppId: string;
|
|
24
|
+
androidAppId: string;
|
|
25
|
+
pspId: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
package/lib/common.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare type AppLinkParams = {
|
|
2
|
+
/** 小程序id / 应用id */
|
|
3
|
+
appId: string;
|
|
4
|
+
/** 唤端的 h5 页面
|
|
5
|
+
* - 如果为字符串,则直接使用该字符串作为 url,会拼接为 `${page}?url=${url}`
|
|
6
|
+
* - 如果为对象,则根据对象中的 mode 和 key 来拼接 url
|
|
7
|
+
* - 如果为 false,则不拼接 url
|
|
8
|
+
*/
|
|
9
|
+
url: string | {
|
|
10
|
+
/** 固定为 pageQuery, 表示自动拼接到 pageQuery 中,如:
|
|
11
|
+
* page = '/pages/index/index' 时,会拼接为 `/pages/index/index?${key}=${value}`
|
|
12
|
+
*/
|
|
13
|
+
mode: 'pageQuery';
|
|
14
|
+
/** 配置 url 拼接参数的 key 值, mode 为 pageQuery 时,
|
|
15
|
+
* 若 page = '/pages/index/index',会拼接为 `/pages/index/index?${key}=${value}`
|
|
16
|
+
*/
|
|
17
|
+
key: string;
|
|
18
|
+
/** 配置 url 拼接参数的 value 值, mode 为 pageQuery 时,
|
|
19
|
+
* 若 page = '/pages/index/index',会拼接为 `/pages/index/index?${key}=${value}`
|
|
20
|
+
*/
|
|
21
|
+
value: string;
|
|
22
|
+
} | false;
|
|
23
|
+
/** 小程序 page, 不传默认为 /pages/index/index */
|
|
24
|
+
page?: string;
|
|
25
|
+
/** 应用的 query 信息 **注意不是pageQuery** */
|
|
26
|
+
query?: Record<string, any>;
|
|
27
|
+
/** 小程序的 debug 版本信息 */
|
|
28
|
+
debugConfig?: {
|
|
29
|
+
version: string;
|
|
30
|
+
token?: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
package/lib/jsapi.d.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { Common, PickAttr } from './common';
|
|
2
|
+
export declare namespace AliJsApi {
|
|
3
|
+
type AlertArgs = {
|
|
4
|
+
title?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
align?: string;
|
|
7
|
+
button?: string;
|
|
8
|
+
};
|
|
9
|
+
type ConfirmArgs = {
|
|
10
|
+
title?: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
align?: string;
|
|
13
|
+
okButton?: string;
|
|
14
|
+
cancelButton?: string;
|
|
15
|
+
};
|
|
16
|
+
type GetAuthCodeArgs = {
|
|
17
|
+
scopes?: string | string[];
|
|
18
|
+
appId: string;
|
|
19
|
+
showErrorTip?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type GetCurrentLocationArgs = {
|
|
22
|
+
bizType: string;
|
|
23
|
+
requestType?: number;
|
|
24
|
+
cacheTimeout?: number;
|
|
25
|
+
timeout?: number;
|
|
26
|
+
};
|
|
27
|
+
type GetCurrentLocationReturns = {
|
|
28
|
+
error: number;
|
|
29
|
+
errorMessage: string;
|
|
30
|
+
latitude: number;
|
|
31
|
+
longitude: number;
|
|
32
|
+
accuracy: number;
|
|
33
|
+
country: string;
|
|
34
|
+
countryCode: string;
|
|
35
|
+
province: string;
|
|
36
|
+
city: string;
|
|
37
|
+
cityAdcode: string;
|
|
38
|
+
district: string;
|
|
39
|
+
districtAdcode: string;
|
|
40
|
+
streetNumber: {
|
|
41
|
+
street: string;
|
|
42
|
+
number: number;
|
|
43
|
+
};
|
|
44
|
+
pois: {
|
|
45
|
+
name: string;
|
|
46
|
+
address: string;
|
|
47
|
+
}[];
|
|
48
|
+
highAccuracyClosed: boolean;
|
|
49
|
+
};
|
|
50
|
+
type GetAPDataStorageArgs = {
|
|
51
|
+
key: string;
|
|
52
|
+
business?: string;
|
|
53
|
+
type?: 'user' | 'common';
|
|
54
|
+
};
|
|
55
|
+
type GetAPDataStorageReturns = {
|
|
56
|
+
data: string;
|
|
57
|
+
errorMessage: string;
|
|
58
|
+
};
|
|
59
|
+
type GetSystemInfoReturns = {
|
|
60
|
+
model: string;
|
|
61
|
+
pixelRatio: number;
|
|
62
|
+
windowWidth: number;
|
|
63
|
+
windowHeight: number;
|
|
64
|
+
language: string;
|
|
65
|
+
version: string;
|
|
66
|
+
};
|
|
67
|
+
type PopToArgs = {
|
|
68
|
+
url?: string;
|
|
69
|
+
urlPattern?: string;
|
|
70
|
+
index?: number;
|
|
71
|
+
data?: Common;
|
|
72
|
+
};
|
|
73
|
+
type PushWindowArgs = {
|
|
74
|
+
url: string;
|
|
75
|
+
data?: Common;
|
|
76
|
+
params?: Common;
|
|
77
|
+
};
|
|
78
|
+
type HttpRequestArgs = {
|
|
79
|
+
url: string;
|
|
80
|
+
headers?: Common;
|
|
81
|
+
method?: 'GET' | 'POST';
|
|
82
|
+
data?: Common | string;
|
|
83
|
+
timeout?: number;
|
|
84
|
+
dataType?: 'json' | 'text' | 'base64' | ({} & string);
|
|
85
|
+
};
|
|
86
|
+
type HttpRequestReturns = {
|
|
87
|
+
data: string;
|
|
88
|
+
status: number;
|
|
89
|
+
headers: Common;
|
|
90
|
+
};
|
|
91
|
+
type SetTitleArgs = {
|
|
92
|
+
title?: string;
|
|
93
|
+
subtitle?: string;
|
|
94
|
+
image?: string;
|
|
95
|
+
};
|
|
96
|
+
type SetBarBottomLineColorArgs = {
|
|
97
|
+
color: number;
|
|
98
|
+
};
|
|
99
|
+
type SetTitleColorArgs = {
|
|
100
|
+
color: number;
|
|
101
|
+
reset?: boolean;
|
|
102
|
+
resetTransparent?: boolean;
|
|
103
|
+
};
|
|
104
|
+
type SetAPDataStorageArgs = GetAPDataStorageArgs & {
|
|
105
|
+
value: string;
|
|
106
|
+
};
|
|
107
|
+
type ShowAuthGuideArgs = {
|
|
108
|
+
bizType: string;
|
|
109
|
+
authType: string;
|
|
110
|
+
issue?: string;
|
|
111
|
+
source?: string;
|
|
112
|
+
option?: string;
|
|
113
|
+
};
|
|
114
|
+
type ShowLoadingArgs = {
|
|
115
|
+
content?: string;
|
|
116
|
+
delay?: number;
|
|
117
|
+
};
|
|
118
|
+
type ToastArgs = {
|
|
119
|
+
content: string;
|
|
120
|
+
type?: 'none' | 'success' | 'fail' | 'exception' | ({} & string);
|
|
121
|
+
duration?: number;
|
|
122
|
+
xOffset?: number;
|
|
123
|
+
yOffset?: number;
|
|
124
|
+
};
|
|
125
|
+
type TradePayArgs = {
|
|
126
|
+
tradeNO?: string;
|
|
127
|
+
partnerID?: string;
|
|
128
|
+
bizType?: string;
|
|
129
|
+
bizSubType?: string;
|
|
130
|
+
bizContext?: string;
|
|
131
|
+
orderStr?: string;
|
|
132
|
+
paymentUrl?: string;
|
|
133
|
+
flowType?: 'a+' | 'local' | '';
|
|
134
|
+
};
|
|
135
|
+
type ActionSheetArgs = {
|
|
136
|
+
title?: string;
|
|
137
|
+
btns: string[];
|
|
138
|
+
cancelBtn?: string;
|
|
139
|
+
destructiveBtnIndex?: number;
|
|
140
|
+
fn?: (v: any) => void;
|
|
141
|
+
};
|
|
142
|
+
type SetTabBarArgs = {
|
|
143
|
+
actionType: string;
|
|
144
|
+
};
|
|
145
|
+
interface Api {
|
|
146
|
+
alert(args?: AlertArgs): any;
|
|
147
|
+
clearTinyLocalStorage(args?: Common): any;
|
|
148
|
+
confirm(args?: ConfirmArgs): any;
|
|
149
|
+
getAuthCode(args?: GetAuthCodeArgs): {
|
|
150
|
+
authCode: string;
|
|
151
|
+
};
|
|
152
|
+
getClipboard(args?: Common): any;
|
|
153
|
+
getCurrentLocation(args?: GetCurrentLocationArgs): GetCurrentLocationReturns;
|
|
154
|
+
getNetworkType(): {
|
|
155
|
+
networkInfo: string;
|
|
156
|
+
};
|
|
157
|
+
getAPDataStorage(args: GetAPDataStorageArgs): GetAPDataStorageReturns;
|
|
158
|
+
getSystemInfo(): GetSystemInfoReturns;
|
|
159
|
+
hideKeyboard(): void;
|
|
160
|
+
hideLoading(args?: {
|
|
161
|
+
page: number;
|
|
162
|
+
}): void;
|
|
163
|
+
hideTitleLoading(): void;
|
|
164
|
+
hideToast(args?: Common): any;
|
|
165
|
+
popTo(args?: PopToArgs): any;
|
|
166
|
+
pushWindow(args?: PushWindowArgs): any;
|
|
167
|
+
removeTinyLocalStorage(args?: {
|
|
168
|
+
key: string;
|
|
169
|
+
}): any;
|
|
170
|
+
httpRequest(args: HttpRequestArgs): HttpRequestReturns;
|
|
171
|
+
setClipboard(args: {
|
|
172
|
+
text: string;
|
|
173
|
+
}): any;
|
|
174
|
+
setTitle(args?: SetTitleArgs): any;
|
|
175
|
+
setBarBottomLineColor(args?: SetBarBottomLineColorArgs): any;
|
|
176
|
+
setTitleColor(args?: SetTitleColorArgs): any;
|
|
177
|
+
setAPDataStorage(args?: SetAPDataStorageArgs): any;
|
|
178
|
+
showAuthGuide(args?: ShowAuthGuideArgs): {
|
|
179
|
+
shown: boolean;
|
|
180
|
+
};
|
|
181
|
+
showLoading(args?: ShowLoadingArgs): any;
|
|
182
|
+
showTitleLoading(): void;
|
|
183
|
+
toast(args: ToastArgs): void;
|
|
184
|
+
tradePay(args: TradePayArgs): {
|
|
185
|
+
resultCode: string;
|
|
186
|
+
};
|
|
187
|
+
getImageInfo(args?: Common): void;
|
|
188
|
+
multiLevelSelect(args?: Common): void;
|
|
189
|
+
navigateBackMiniProgram(args?: Common): void;
|
|
190
|
+
navigateToMiniProgram(args?: Common): void;
|
|
191
|
+
previewImage(args?: Common): void;
|
|
192
|
+
saveImage(args?: Common): void;
|
|
193
|
+
setOptionMenu(args?: Common): void;
|
|
194
|
+
chooseImage(args?: Common): void;
|
|
195
|
+
actionSheet(args?: ActionSheetArgs): void;
|
|
196
|
+
setTabBar(args?: SetTabBarArgs): void;
|
|
197
|
+
switchTab(args?: {
|
|
198
|
+
url: string;
|
|
199
|
+
}): void;
|
|
200
|
+
firePullToRefresh(): void;
|
|
201
|
+
restorePullToRefresh(): void;
|
|
202
|
+
datePicker(args: any): void;
|
|
203
|
+
saveFile(args?: any): void;
|
|
204
|
+
uploadFile(args?: any): void;
|
|
205
|
+
downloadFile(args?: any): void;
|
|
206
|
+
watchShake(args?: any): void;
|
|
207
|
+
connectSocket(args?: any): void;
|
|
208
|
+
onSocketOpen(args?: any): void;
|
|
209
|
+
offSocketOpen(args?: any): void;
|
|
210
|
+
onSocketError(args?: any): void;
|
|
211
|
+
offSocketError(args?: any): void;
|
|
212
|
+
sendSocketMessage(args?: any): void;
|
|
213
|
+
onSocketMessage(args?: any): void;
|
|
214
|
+
offSocketMessage(args?: any): void;
|
|
215
|
+
closeSocket(args?: any): void;
|
|
216
|
+
onSocketClose(args?: any): void;
|
|
217
|
+
offSocketClose(args?: any): void;
|
|
218
|
+
onAccelerometerChange(args?: any): void;
|
|
219
|
+
offAccelerometerChange(args?: any): void;
|
|
220
|
+
onCompassChange(args?: any): void;
|
|
221
|
+
offCompassChange(args?: any): void;
|
|
222
|
+
connectBLEDevice(args?: Common): void;
|
|
223
|
+
disconnectBLEDevice(args?: Common): void;
|
|
224
|
+
getBLEDeviceCharacteristics(args?: Common): void;
|
|
225
|
+
getBLEDeviceServices(args?: Common): void;
|
|
226
|
+
notifyBLECharacteristicValueChange(args?: Common): void;
|
|
227
|
+
offBLECharacteristicValueChange(args?: Common): void;
|
|
228
|
+
offBLEConnectionStateChanged(args?: Common): void;
|
|
229
|
+
onBLECharacteristicValueChange(args?: Common): void;
|
|
230
|
+
onBLEConnectionStateChanged(args?: Common): void;
|
|
231
|
+
readBLECharacteristicValue(args?: Common): void;
|
|
232
|
+
writeBLECharacteristicValue(args?: Common): void;
|
|
233
|
+
openBluetoothAdapter(args?: Common): void;
|
|
234
|
+
closeBluetoothAdapter(args?: Common): void;
|
|
235
|
+
getBluetoothAdapterState(args?: Common): void;
|
|
236
|
+
startBluetoothDevicesDiscovery(args?: Common): void;
|
|
237
|
+
stopBluetoothDevicesDiscovery(args?: Common): void;
|
|
238
|
+
getBluetoothDevices(args?: Common): void;
|
|
239
|
+
getConnectedBluetoothDevices(args?: Common): void;
|
|
240
|
+
onBluetoothDeviceFound(args?: Common): void;
|
|
241
|
+
offBluetoothDeviceFound(args?: Common): void;
|
|
242
|
+
onBluetoothAdapterStateChange(args?: Common): void;
|
|
243
|
+
offBluetoothAdapterStateChange(args?: Common): void;
|
|
244
|
+
getFileInfo(args?: Common): void;
|
|
245
|
+
openDocument(args?: Common): void;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
export declare type PickJSAttr<Attr extends keyof AliJsApi.Api> = PickAttr<Attr, AliJsApi.Api>;
|
|
249
|
+
export declare type PickJSArgs<Attr extends keyof AliJsApi.Api = any> = Parameters<PickJSAttr<Attr>>[0];
|
|
250
|
+
export declare type PickJSReturns<Attr extends keyof AliJsApi.Api> = ReturnType<PickJSAttr<Attr>>;
|
package/lib/jsapi.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/mp.d.ts
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/// <reference types="miniprogram" />
|
|
2
|
+
import { PickAttr, Common } from './common';
|
|
3
|
+
export interface AddFatigueActionArgs extends AsyncCallback<any> {
|
|
4
|
+
deliverId?: string;
|
|
5
|
+
spaceCode?: string;
|
|
6
|
+
action?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IRPCArgs {
|
|
9
|
+
operationType: string;
|
|
10
|
+
requestData: string | unknown[];
|
|
11
|
+
headers?: Record<string, any>;
|
|
12
|
+
gateway?: string;
|
|
13
|
+
compress?: boolean;
|
|
14
|
+
disableLimitView?: boolean;
|
|
15
|
+
timeout?: number;
|
|
16
|
+
getResponse?: boolean;
|
|
17
|
+
workspaceId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface getCurrentPagesOptions {
|
|
20
|
+
payload?: Record<string, any>;
|
|
21
|
+
success: (res: {
|
|
22
|
+
route: string;
|
|
23
|
+
}[]) => void;
|
|
24
|
+
fail: (err: any) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface AsyncCallback<T = any> {
|
|
27
|
+
success?: ((res: T) => void) | undefined;
|
|
28
|
+
fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
|
|
29
|
+
complete?: ((res?: any) => any) | undefined;
|
|
30
|
+
}
|
|
31
|
+
export interface MPApi extends Omit<MiniprogramApi, 'request'> {
|
|
32
|
+
authorize: (opt: any) => void;
|
|
33
|
+
getAuthUserInfo: (opt: any) => void;
|
|
34
|
+
crossPay(args?: TradePayArgs): void;
|
|
35
|
+
addFatigueAction(args?: AddFatigueActionArgs): void;
|
|
36
|
+
appxrpc(args?: {
|
|
37
|
+
reqeustData: any;
|
|
38
|
+
}): void;
|
|
39
|
+
batchQueryCdpSpaceInfo(args?: any): void;
|
|
40
|
+
exitApp(args?: any): void;
|
|
41
|
+
getAppToken(args?: any): void;
|
|
42
|
+
getComponentAuth(args?: any): void;
|
|
43
|
+
getPaymentCode(args?: any): void;
|
|
44
|
+
getPhoneNumber(args?: any): void;
|
|
45
|
+
inquireQuote(args?: any): void;
|
|
46
|
+
isInstalledApp(args?: any): void;
|
|
47
|
+
navigateToBizScene(args: {
|
|
48
|
+
sceneCode: string;
|
|
49
|
+
param?: {
|
|
50
|
+
scheme?: string;
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
};
|
|
53
|
+
} & AsyncCallback<void>): void;
|
|
54
|
+
paySignCenter(args?: any): void;
|
|
55
|
+
rpc(args: IRPCArgs & AsyncCallback<{
|
|
56
|
+
headers: Record<string, string>;
|
|
57
|
+
resData: object;
|
|
58
|
+
}>): void;
|
|
59
|
+
APRegionRPC(args?: any): void;
|
|
60
|
+
startApp(args?: any): void;
|
|
61
|
+
startBizService(args?: any): void;
|
|
62
|
+
thirdPartyAuthForAc(args?: any): void;
|
|
63
|
+
openSchemeWithBacking(args?: any): void;
|
|
64
|
+
uploadApdidToken(args?: any): void;
|
|
65
|
+
apDisableJSAPI(args?: any): void;
|
|
66
|
+
regionFetchAllApps(args?: any): void;
|
|
67
|
+
regionSearchAppsByKeywords(args?: any): void;
|
|
68
|
+
setOptionMenu(args?: Common & AsyncCallback<any>): void;
|
|
69
|
+
getLaunchOptionsSync(): any;
|
|
70
|
+
getStorageInfo(args?: any): void;
|
|
71
|
+
getStorageInfoSync(args?: any): void;
|
|
72
|
+
showSharePanel(args?: any): void;
|
|
73
|
+
postMessage(args?: any): void;
|
|
74
|
+
onMessage(args?: any): void;
|
|
75
|
+
canIUse(args: string): boolean;
|
|
76
|
+
SDKVersion: any;
|
|
77
|
+
hideOptionButton(args?: any): void;
|
|
78
|
+
getCurrentLanguage(): string;
|
|
79
|
+
openURL(args?: Common): Promise<void>;
|
|
80
|
+
getAppId(args: AsyncCallback<{
|
|
81
|
+
appId: string;
|
|
82
|
+
}>): void;
|
|
83
|
+
getCurrentPages(args: getCurrentPagesOptions): void;
|
|
84
|
+
getSDKVersion(args: AsyncCallback<string>): void;
|
|
85
|
+
request: (args: {
|
|
86
|
+
url: string;
|
|
87
|
+
headers?: {
|
|
88
|
+
[key: string]: string;
|
|
89
|
+
} | undefined;
|
|
90
|
+
method?: 'GET' | 'POST' | undefined;
|
|
91
|
+
data?: any;
|
|
92
|
+
timeout?: number | undefined;
|
|
93
|
+
dataType?: 'json' | 'text' | 'base64' | 'arraybuffer' | undefined;
|
|
94
|
+
} & AsyncCallback<{
|
|
95
|
+
data: any;
|
|
96
|
+
status: number;
|
|
97
|
+
headers: any;
|
|
98
|
+
}>) => void;
|
|
99
|
+
createWithoutAuthRpc: (args: {
|
|
100
|
+
appId?: string;
|
|
101
|
+
workspaceId?: string;
|
|
102
|
+
defaultGateway: string;
|
|
103
|
+
defaultHeaders?: Record<string, string>;
|
|
104
|
+
request: PickMPAttr<'request'>;
|
|
105
|
+
}) => PickPromiseAttr<PickMPAttr<'rpc'>>;
|
|
106
|
+
rpcWithAuth: PickMPAttr<'rpc'>;
|
|
107
|
+
rpcWithAuthAPlus: PickMPAttr<'rpc'>;
|
|
108
|
+
defineRuntimeConfig: (args: Record<string, any>) => Record<string, any>;
|
|
109
|
+
getAuthCode: (args: {
|
|
110
|
+
scopes: string | string[];
|
|
111
|
+
appId?: string;
|
|
112
|
+
} & AsyncCallback<GetAuthCodeCallbackValue>) => void;
|
|
113
|
+
easyShare: (args: {
|
|
114
|
+
bizType: string;
|
|
115
|
+
title: string;
|
|
116
|
+
desc: string;
|
|
117
|
+
searchTips?: string;
|
|
118
|
+
iconUrl?: string;
|
|
119
|
+
icon?: string;
|
|
120
|
+
imageUrl?: string;
|
|
121
|
+
image?: string;
|
|
122
|
+
url: string;
|
|
123
|
+
} & AsyncCallback<{
|
|
124
|
+
succeed: boolean;
|
|
125
|
+
channelName: string;
|
|
126
|
+
}>) => void;
|
|
127
|
+
homeAddAppToMyApps: (args: {
|
|
128
|
+
appId: string;
|
|
129
|
+
}) => void;
|
|
130
|
+
homeCanAddAppToMyApps: (args: {
|
|
131
|
+
appId: string;
|
|
132
|
+
} & AsyncCallback<{
|
|
133
|
+
canAddAppToMyApps: boolean;
|
|
134
|
+
}>) => void;
|
|
135
|
+
removeNotifyListener: (args: {
|
|
136
|
+
name: string;
|
|
137
|
+
} & AsyncCallback<void>) => void;
|
|
138
|
+
addNotifyListener: (args: {
|
|
139
|
+
name: string;
|
|
140
|
+
keep?: boolean;
|
|
141
|
+
callback?: (res: any) => void;
|
|
142
|
+
} & AsyncCallback<any>) => void;
|
|
143
|
+
postNotification: (args: {
|
|
144
|
+
name: string;
|
|
145
|
+
data: object;
|
|
146
|
+
} & AsyncCallback<void>) => void;
|
|
147
|
+
openWebURL: (args: {
|
|
148
|
+
url: string;
|
|
149
|
+
path?: string;
|
|
150
|
+
}) => Promise<void>;
|
|
151
|
+
openInApp: (args: {
|
|
152
|
+
url: string;
|
|
153
|
+
path?: string;
|
|
154
|
+
}) => Promise<void>;
|
|
155
|
+
openOtherApp: (args: {
|
|
156
|
+
appId: string;
|
|
157
|
+
path?: string;
|
|
158
|
+
launchParams?: Record<string, any>;
|
|
159
|
+
}) => Promise<void>;
|
|
160
|
+
openInBrowser: (args: {
|
|
161
|
+
url: string;
|
|
162
|
+
path?: string;
|
|
163
|
+
}) => Promise<void>;
|
|
164
|
+
openPayCodePage: () => Promise<void>;
|
|
165
|
+
openApPayCodePage: () => Promise<void>;
|
|
166
|
+
openScanPage: () => Promise<void>;
|
|
167
|
+
getMainSelectedCity: (args: AsyncCallback<{
|
|
168
|
+
fullName: string;
|
|
169
|
+
enName: string;
|
|
170
|
+
name: string;
|
|
171
|
+
code: string;
|
|
172
|
+
chineseMainLand: boolean;
|
|
173
|
+
isManualSelected: boolean;
|
|
174
|
+
settingTime: number;
|
|
175
|
+
}>) => void;
|
|
176
|
+
chooseDistrict: (args: {
|
|
177
|
+
mode?: 0 | 1 | 2;
|
|
178
|
+
src?: string;
|
|
179
|
+
mainTitle?: string;
|
|
180
|
+
mainHeadList?: Array<HeadModel>;
|
|
181
|
+
mainNormalList?: Array<ItemModel>;
|
|
182
|
+
mainMergeOptions?: Record<string, string>;
|
|
183
|
+
seniorTitle?: string;
|
|
184
|
+
seniorPageList?: Array<{
|
|
185
|
+
title: string;
|
|
186
|
+
headList?: Array<HeadModel>;
|
|
187
|
+
normalList?: Array<ItemModel>;
|
|
188
|
+
}>;
|
|
189
|
+
} & AsyncCallback<{
|
|
190
|
+
name: string;
|
|
191
|
+
adCode: string;
|
|
192
|
+
ext: string;
|
|
193
|
+
}>) => void;
|
|
194
|
+
popWindow: () => void;
|
|
195
|
+
setTransparentTitle: (args: {
|
|
196
|
+
transparentTitle: 'none' | 'auto' | 'always' | 'custom';
|
|
197
|
+
} & AsyncCallback<{
|
|
198
|
+
success: boolean;
|
|
199
|
+
}>) => void;
|
|
200
|
+
getLocation: (args: {
|
|
201
|
+
bizType?: string;
|
|
202
|
+
requestType?: number;
|
|
203
|
+
timeout?: number;
|
|
204
|
+
horizontalAccuracy?: number;
|
|
205
|
+
} & GetLocationArgs) => void;
|
|
206
|
+
showAuthGuide: (args: AsyncCallback<{
|
|
207
|
+
/**
|
|
208
|
+
* When shown is true, it indicates the permission guide
|
|
209
|
+
* pop-up will be shown; when it is false, it indicates
|
|
210
|
+
* the user has allowed the permission.
|
|
211
|
+
*/
|
|
212
|
+
shown: boolean;
|
|
213
|
+
}> & {
|
|
214
|
+
authType: string;
|
|
215
|
+
bizType?: string;
|
|
216
|
+
}) => void;
|
|
217
|
+
getRunScene: (args: AsyncCallback<{
|
|
218
|
+
envVersion: 'develop' | 'trial' | 'release';
|
|
219
|
+
}>) => void;
|
|
220
|
+
setCanPullDown: (args: {
|
|
221
|
+
canPullDown: boolean;
|
|
222
|
+
} & AsyncCallback<void>) => void;
|
|
223
|
+
chooseFileFromDisk: (args: AsyncCallback<{
|
|
224
|
+
success: boolean;
|
|
225
|
+
apFilePath: string;
|
|
226
|
+
}> & {
|
|
227
|
+
appId?: string;
|
|
228
|
+
}) => void;
|
|
229
|
+
chooseVideo: (args: AsyncCallback<{
|
|
230
|
+
filePath: string;
|
|
231
|
+
duration: number;
|
|
232
|
+
size: number;
|
|
233
|
+
height: number;
|
|
234
|
+
width: number;
|
|
235
|
+
tempFilePath: string;
|
|
236
|
+
}> & {
|
|
237
|
+
sourceType?: string[];
|
|
238
|
+
compressed?: boolean;
|
|
239
|
+
maxDuration?: number;
|
|
240
|
+
camera?: string;
|
|
241
|
+
}) => void;
|
|
242
|
+
compressImage: (args: AsyncCallback<{
|
|
243
|
+
apFilePaths: string[];
|
|
244
|
+
}> & {
|
|
245
|
+
apFilePaths: string[];
|
|
246
|
+
compressLevel?: number;
|
|
247
|
+
compressedWidth?: number;
|
|
248
|
+
compressedHeight?: number;
|
|
249
|
+
maxWidth?: number;
|
|
250
|
+
maxHeight?: number;
|
|
251
|
+
}) => void;
|
|
252
|
+
setTabBarItem: (args: {
|
|
253
|
+
index?: number;
|
|
254
|
+
text: string;
|
|
255
|
+
iconPath: string;
|
|
256
|
+
selectedIconPath: string;
|
|
257
|
+
} & AsyncCallback<void>) => void;
|
|
258
|
+
showTabBar: (args: {
|
|
259
|
+
animation?: boolean;
|
|
260
|
+
} & AsyncCallback<void>) => void;
|
|
261
|
+
hideBackHome: () => void;
|
|
262
|
+
}
|
|
263
|
+
export declare type HeadModel = {
|
|
264
|
+
/**
|
|
265
|
+
* 区块名,如“热门城市”。
|
|
266
|
+
*/
|
|
267
|
+
title?: string;
|
|
268
|
+
/**
|
|
269
|
+
* 模块类型。
|
|
270
|
+
* 0: 常规城市。
|
|
271
|
+
* 1: 定位模块。
|
|
272
|
+
* 2: 展示支付宝提供的热门城市模块。
|
|
273
|
+
*/
|
|
274
|
+
type?: 0 | 1 | 2;
|
|
275
|
+
/**
|
|
276
|
+
* 区块城市列表。不支持嵌套。
|
|
277
|
+
*/
|
|
278
|
+
list?: Array<ItemModel>;
|
|
279
|
+
};
|
|
280
|
+
export declare type ItemModel = {
|
|
281
|
+
/**
|
|
282
|
+
* 城市名。
|
|
283
|
+
*/
|
|
284
|
+
name: string;
|
|
285
|
+
/**
|
|
286
|
+
* 行政区划代码。不同行政区域对应的代码可查看 https://www.mca.gov.cn/mzsj/xzqh/1980/2019/202002281436.html
|
|
287
|
+
*/
|
|
288
|
+
adCode: string;
|
|
289
|
+
/**
|
|
290
|
+
* 城市名对应拼音拼写,方便用户检索。
|
|
291
|
+
*/
|
|
292
|
+
spell?: string;
|
|
293
|
+
/**
|
|
294
|
+
* 子标题。
|
|
295
|
+
*/
|
|
296
|
+
appendName?: string;
|
|
297
|
+
/**
|
|
298
|
+
* 额外信息。
|
|
299
|
+
*/
|
|
300
|
+
ext?: string;
|
|
301
|
+
/**
|
|
302
|
+
* 支持级联,自定义次级城市列表。
|
|
303
|
+
*/
|
|
304
|
+
subList?: Array<ItemModel>;
|
|
305
|
+
};
|
|
306
|
+
export declare type PickMPAttr<Attr extends keyof MPApi> = PickAttr<Attr, MPApi>;
|
|
307
|
+
export declare type PickMPArgs<Attr extends keyof MPApi> = Parameters<PickMPAttr<Attr>>[0];
|
|
308
|
+
export declare type PickMpReturns<Attr extends keyof MPApi> = ReturnType<PickMPAttr<Attr>>;
|
|
309
|
+
export declare type ReturnTypePromise<T> = T extends AsyncCallback<infer S> ? (args?: T | undefined) => Promise<S> : never;
|
|
310
|
+
export declare type PickPromiseAttr<T> = T extends (args: infer S) => void ? ReturnTypePromise<S> : never;
|
package/lib/mp.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hylid/types",
|
|
3
|
+
"version": "0.0.2-dev.1",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"files": [
|
|
6
|
+
"lib",
|
|
7
|
+
"global.d.ts"
|
|
8
|
+
],
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@types/miniprogram": "^1.0.3"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"registry": "https://registry.npmjs.org/"
|
|
18
|
+
}
|