@dcloudio/uni-app-x 0.5.8 → 0.5.10

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.
Files changed (27) hide show
  1. package/README.md +0 -38
  2. package/package.json +2 -2
  3. package/types/native/Element.d.ts +5 -0
  4. package/types/uni/core/index.d.ts +1 -0
  5. package/types/uni/core/lib/base/interceptor/index.d.ts +6 -0
  6. package/types/uni/core/lib/base/interceptor/interface.d.ts +19 -4
  7. package/types/uni/core/lib/interface.d.ts +15 -0
  8. package/types/uni/core/lib/route/interface.d.ts +11 -9
  9. package/types/uni/core/lib/ui/load-font-face/index.d.ts +2 -2
  10. package/types/uni/core/lib/ui/load-font-face/interface.d.ts +28 -6
  11. package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +3 -1
  12. package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +3 -1
  13. package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +14 -12
  14. package/types/uni/core/lib/ui/set-navigation-bar-title/index.d.ts +23 -0
  15. package/types/uni/core/lib/ui/set-navigation-bar-title/interface.d.ts +359 -0
  16. package/types/uni/core/lib/ui/tab-bar/interface.d.ts +24 -8
  17. package/types/uni/uts-plugin-api/index.d.ts +1 -1
  18. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/index.d.ts +6 -0
  19. package/types/uni/uts-plugin-api/lib/uni-exit/utssdk/interface.d.ts +16 -1
  20. package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +60 -0
  21. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/index.d.ts +6 -0
  22. package/types/uni/uts-plugin-api/lib/uni-getLocation-system/utssdk/interface.d.ts +19 -1
  23. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +1 -3
  24. package/types/uni/uts-plugin-api/lib/uni-push/utssdk/interface.d.ts +80 -22
  25. package/types/vue/UniCloudDBElement.d.ts +39 -37
  26. package/types/vue/UniFormElement.d.ts +37 -0
  27. package/types/vue/index.d.ts +1 -0
package/README.md CHANGED
@@ -1,39 +1 @@
1
1
  # uni-app x 类型
2
-
3
- ## 初始化依赖
4
-
5
- ```shell
6
- pnpm i
7
- ```
8
-
9
- ## 配置环境
10
-
11
- 当前目录建立 .env 文件
12
-
13
- ```
14
- UNI_CORE_DIR = "%vuejs-core 仓库路径%/packages/uni-ext-api/src"
15
- UNI_UTS_PLUGIN_API_DIR = "%新 uni-app 仓库路径%/api"
16
- UNI_UTS_PLUGIN_COMPONENT_DIR = "%新 uni-app 仓库路径%/component"
17
- UNI_COMPLIER_META_DIR = "%旧 uni-app 仓库路径%/packages/uni-uts-v1/lib/ext-api"
18
-
19
- ```
20
-
21
- ## 构建
22
-
23
- 构建框架内置 Uni Api
24
-
25
- ```shell
26
- pnpm build:types:core
27
- ```
28
-
29
- 构建 Ext Api
30
-
31
- ```shell
32
- pnpm build:types:ext
33
- ```
34
-
35
- 生成默认参数数据到编译器
36
-
37
- ```shell
38
- pnpm build:types:meta
39
- ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-app-x",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "uni-app x types",
5
5
  "typings": "index.d.ts",
6
6
  "author": "DCloud",
@@ -22,4 +22,4 @@
22
22
  "minimist": "^1.2.8",
23
23
  "ts-morph": "^19.0.0"
24
24
  }
25
- }
25
+ }
@@ -6,6 +6,11 @@
6
6
  * @package io.dcloud.uniapp.runtime
7
7
  */
8
8
  declare interface Element {
9
+ /**
10
+ * 只读属性 获取当前元素的的 class 属性的动态集合。
11
+ */
12
+ classList: string[]
13
+
9
14
  /**
10
15
  * 只读属性 获取当前元素的的第一个子元素,如果元素是无子元素,则返回 null。
11
16
  */
@@ -2,6 +2,7 @@
2
2
  /// <reference path='./lib/performance/index.d.ts' />
3
3
  /// <reference path='./lib/lifecycle/index.d.ts' />
4
4
  /// <reference path='./lib/ui/tab-bar/index.d.ts' />
5
+ /// <reference path='./lib/ui/set-navigation-bar-title/index.d.ts' />
5
6
  /// <reference path='./lib/ui/set-navigation-bar-color/index.d.ts' />
6
7
  /// <reference path='./lib/ui/pull-down-refresh/index.d.ts' />
7
8
  /// <reference path='./lib/ui/page-scroll-to/index.d.ts' />
@@ -1,10 +1,16 @@
1
1
  import {
2
+ Interceptor as InterceptorOrigin,
3
+ AddInterceptorOptions as AddInterceptorOptionsOrigin,
4
+ RemoveInterceptorOptions as RemoveInterceptorOptionsOrigin,
2
5
  AddInterceptor as AddInterceptorOrigin,
3
6
  RemoveInterceptor as RemoveInterceptorOrigin,
4
7
  Uni as UniOrigin
5
8
  } from './interface'
6
9
 
7
10
  declare global {
11
+ type Interceptor = InterceptorOrigin
12
+ type AddInterceptorOptions = AddInterceptorOptionsOrigin
13
+ type RemoveInterceptorOptions = RemoveInterceptorOptionsOrigin
8
14
  type AddInterceptor = AddInterceptorOrigin
9
15
  type RemoveInterceptor = RemoveInterceptorOrigin
10
16
  interface Uni extends UniOrigin { }
@@ -1,6 +1,8 @@
1
- import { Interceptor } from '../../interface'
1
+ import { Interceptor as InterceptorOrigin } from '../../interface'
2
2
 
3
- export type { Interceptor }
3
+ export type Interceptor = InterceptorOrigin
4
+ export type AddInterceptorOptions = Interceptor
5
+ export type RemoveInterceptorOptions = Interceptor
4
6
 
5
7
  export type AddInterceptor = (name: string, interceptor: Interceptor) => void
6
8
 
@@ -10,6 +12,19 @@ export type RemoveInterceptor = (
10
12
  ) => void
11
13
 
12
14
  export interface Uni {
13
- addInterceptor: AddInterceptor
14
- removeInterceptor: RemoveInterceptor
15
+ /**
16
+ * 添加拦截器
17
+ * @param name 需要拦截的 API 名称
18
+ * @param interceptor 拦截器
19
+ */
20
+ addInterceptor(name: string, interceptor: AddInterceptorOptions): void
21
+ /**
22
+ * 删除拦截器
23
+ * @param name 需要删除拦截器的 API 名称
24
+ * @param interceptor 拦截器
25
+ */
26
+ removeInterceptor(
27
+ name: string,
28
+ interceptor?: RemoveInterceptorOptions | null
29
+ ): void
15
30
  }
@@ -5,9 +5,24 @@ export type OnLaunchOptions = {
5
5
  }
6
6
 
7
7
  export type Interceptor = {
8
+ /**
9
+ * 拦截前触发
10
+ */
8
11
  invoke?: Function | null
12
+ /**
13
+ * 方法调用后触发,处理返回值
14
+ */
9
15
  returnValue?: Function | null
16
+ /**
17
+ * 成功回调拦截
18
+ */
10
19
  success?: Function | null
20
+ /**
21
+ * 失败回调拦截
22
+ */
11
23
  fail?: Function | null
24
+ /**
25
+ * 完成回调拦截
26
+ */
12
27
  complete?: Function | null
13
28
  }
@@ -76,7 +76,7 @@ export type NavigateToOptions = {
76
76
  * }
77
77
  * }
78
78
  */
79
- url: string
79
+ url: string | string.PageURIString
80
80
  /**
81
81
  * 窗口显示的动画类型
82
82
  * - auto: 自动选择动画效果
@@ -543,7 +543,7 @@ export type RedirectToOptions = {
543
543
  * }
544
544
  * }
545
545
  */
546
- url: string
546
+ url: string | string.PageURIString
547
547
  /**
548
548
  * 接口调用成功的回调函数
549
549
  * @uniPlatform {
@@ -807,7 +807,7 @@ export type ReLaunchOptions = {
807
807
  * }
808
808
  * }
809
809
  */
810
- url: string
810
+ url: string | string.PageURIString
811
811
  /**
812
812
  * 接口调用成功的回调函数
813
813
  * @uniPlatform {
@@ -1071,7 +1071,7 @@ export type SwitchTabOptions = {
1071
1071
  * }
1072
1072
  * }
1073
1073
  */
1074
- url: string
1074
+ url: string | string.PageURIString
1075
1075
  /**
1076
1076
  * 接口调用成功的回调函数
1077
1077
  * @uniPlatform {
@@ -1735,7 +1735,7 @@ export interface Uni {
1735
1735
  * }
1736
1736
  * }
1737
1737
  */
1738
- navigateTo(options: NavigateToOptions): void
1738
+ navigateTo(options: NavigateToOptions): Promise<NavigateToSuccess> | null
1739
1739
  /**
1740
1740
  * 关闭当前页面,跳转到应用内的某个页面
1741
1741
  *
@@ -1801,7 +1801,7 @@ export interface Uni {
1801
1801
  * }
1802
1802
  * }
1803
1803
  */
1804
- redirectTo(options: RedirectToOptions): void
1804
+ redirectTo(options: RedirectToOptions): Promise<RedirectToSuccess> | null
1805
1805
  /**
1806
1806
  * 关闭所有页面,打开到应用内的某个页面
1807
1807
  *
@@ -1867,7 +1867,7 @@ export interface Uni {
1867
1867
  * }
1868
1868
  * }
1869
1869
  */
1870
- reLaunch(options: ReLaunchOptions): void
1870
+ reLaunch(options: ReLaunchOptions): Promise<ReLaunchSuccess> | null
1871
1871
  /**
1872
1872
  * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
1873
1873
  *
@@ -1933,7 +1933,7 @@ export interface Uni {
1933
1933
  * }
1934
1934
  * }
1935
1935
  */
1936
- switchTab(options: SwitchTabOptions): void
1936
+ switchTab(options: SwitchTabOptions): Promise<SwitchTabSuccess> | null
1937
1937
  /**
1938
1938
  * 关闭当前页面,返回上一页面或多级页面
1939
1939
  *
@@ -1999,5 +1999,7 @@ export interface Uni {
1999
1999
  * }
2000
2000
  * }
2001
2001
  */
2002
- navigateBack(options?: NavigateBackOptions | null): void
2002
+ navigateBack(
2003
+ options?: NavigateBackOptions | null
2004
+ ): Promise<NavigateBackSuccess> | null
2003
2005
  }
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  LoadFontFaceOptionDesc as LoadFontFaceOptionDescOrigin,
3
+ LoadFontFaceErrCode as LoadFontFaceErrCodeOrigin,
3
4
  LoadFontFaceOptions as LoadFontFaceOptionsOrigin,
4
5
  LoadFontFaceSuccess as LoadFontFaceSuccessOrigin,
5
6
  LoadFontFaceSuccessCallback as LoadFontFaceSuccessCallbackOrigin,
@@ -7,12 +8,12 @@ import {
7
8
  LoadFontFaceFailCallback as LoadFontFaceFailCallbackOrigin,
8
9
  LoadFontFaceComplete as LoadFontFaceCompleteOrigin,
9
10
  LoadFontFaceCompleteCallback as LoadFontFaceCompleteCallbackOrigin,
10
- LoadFontFace as LoadFontFaceOrigin,
11
11
  Uni as UniOrigin
12
12
  } from './interface'
13
13
 
14
14
  declare global {
15
15
  type LoadFontFaceOptionDesc = LoadFontFaceOptionDescOrigin
16
+ type LoadFontFaceErrCode = LoadFontFaceErrCodeOrigin
16
17
  type LoadFontFaceOptions = LoadFontFaceOptionsOrigin
17
18
  type LoadFontFaceSuccess = LoadFontFaceSuccessOrigin
18
19
  type LoadFontFaceSuccessCallback = LoadFontFaceSuccessCallbackOrigin
@@ -20,6 +21,5 @@ declare global {
20
21
  type LoadFontFaceFailCallback = LoadFontFaceFailCallbackOrigin
21
22
  type LoadFontFaceComplete = LoadFontFaceCompleteOrigin
22
23
  type LoadFontFaceCompleteCallback = LoadFontFaceCompleteCallbackOrigin
23
- type LoadFontFace = LoadFontFaceOrigin
24
24
  interface Uni extends UniOrigin { }
25
25
  }
@@ -5,7 +5,29 @@ export type LoadFontFaceOptionDesc = {
5
5
  weight: string | null
6
6
  variant: string | null
7
7
  }
8
-
8
+ /**
9
+ * 错误码
10
+ * - 4: 框架内部异常
11
+ * - 99: page is not ready
12
+ * - 101: 参数错误
13
+ * - 100001: family is null
14
+ * - 100002: source is null
15
+ * - 200001: local font not found
16
+ * - 300001: same source task is loading
17
+ * - 300002: download fail
18
+ */
19
+ export type LoadFontFaceErrCode =
20
+ | 4
21
+ | 99
22
+ | 101
23
+ | 100001
24
+ | 100002
25
+ | 200001
26
+ | 300001
27
+ | 300002
28
+ export abstract class LoadFontFaceError extends UniError {
29
+ abstract override errCode: LoadFontFaceErrCode
30
+ }
9
31
  export type LoadFontFaceOptions = {
10
32
  /**
11
33
  * 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
@@ -460,14 +482,12 @@ export type LoadFontFaceOptions = {
460
482
  export type LoadFontFaceSuccess = AsyncApiSuccessResult
461
483
  export type LoadFontFaceSuccessCallback = (result: LoadFontFaceSuccess) => void
462
484
 
463
- export type LoadFontFaceFail = UniError
464
- export type LoadFontFaceFailCallback = (error: LoadFontFaceFail) => void
485
+ export type LoadFontFaceFail = LoadFontFaceError
486
+ export type LoadFontFaceFailCallback = (error: LoadFontFaceError) => void
465
487
 
466
488
  export type LoadFontFaceComplete = AsyncApiResult
467
489
  export type LoadFontFaceCompleteCallback = (res: LoadFontFaceComplete) => void
468
490
 
469
- export type LoadFontFace = (options: LoadFontFaceOptions) => void
470
-
471
491
  export interface Uni {
472
492
  /**
473
493
  * 动态加载网络字体
@@ -534,5 +554,7 @@ export interface Uni {
534
554
  * }
535
555
  * }
536
556
  */
537
- loadFontFace(options: LoadFontFaceOptions): void
557
+ loadFontFace(
558
+ options: LoadFontFaceOptions
559
+ ): Promise<LoadFontFaceSuccess> | null
538
560
  }
@@ -130,5 +130,7 @@ export interface Uni {
130
130
  * }
131
131
  * }
132
132
  */
133
- pageScrollTo(options: PageScrollToOptions): void
133
+ pageScrollTo(
134
+ options: PageScrollToOptions
135
+ ): Promise<PageScrollToSuccess> | null
134
136
  }
@@ -44,7 +44,9 @@ export interface Uni {
44
44
  *
45
45
  * @tutorial http://uniapp.dcloud.io/api/ui/pulldown?id=startpulldownrefresh
46
46
  */
47
- startPullDownRefresh(options?: StartPullDownRefreshOptions | null): void
47
+ startPullDownRefresh(
48
+ options?: StartPullDownRefreshOptions | null
49
+ ): Promise<StartPullDownRefreshSuccess> | null
48
50
  /**
49
51
  * 停止当前页面下拉刷新
50
52
  *
@@ -96,8 +96,8 @@ export type SetNavigationBarColorOptions = {
96
96
  * "unixVer": "x"
97
97
  * },
98
98
  * "alipay": {
99
- * "hostVer": "",
100
- * "uniVer": "",
99
+ * "hostVer": "x",
100
+ * "uniVer": "x",
101
101
  * "unixVer": "x"
102
102
  * },
103
103
  * "baidu": {
@@ -160,8 +160,8 @@ export type SetNavigationBarColorOptions = {
160
160
  * "unixVer": "x"
161
161
  * },
162
162
  * "alipay": {
163
- * "hostVer": "",
164
- * "uniVer": "",
163
+ * "hostVer": "x",
164
+ * "uniVer": "x",
165
165
  * "unixVer": "x"
166
166
  * },
167
167
  * "baidu": {
@@ -224,8 +224,8 @@ export type SetNavigationBarColorOptions = {
224
224
  * "unixVer": "x"
225
225
  * },
226
226
  * "alipay": {
227
- * "hostVer": "",
228
- * "uniVer": "",
227
+ * "hostVer": "x",
228
+ * "uniVer": "x",
229
229
  * "unixVer": "x"
230
230
  * },
231
231
  * "baidu": {
@@ -288,8 +288,8 @@ export type SetNavigationBarColorOptions = {
288
288
  * "unixVer": "x"
289
289
  * },
290
290
  * "alipay": {
291
- * "hostVer": "",
292
- * "uniVer": "",
291
+ * "hostVer": "x",
292
+ * "uniVer": "x",
293
293
  * "unixVer": "x"
294
294
  * },
295
295
  * "baidu": {
@@ -355,7 +355,7 @@ export interface Uni {
355
355
  /**
356
356
  * 设置导航条、状态栏颜色
357
357
  *
358
- * @tutorial http://uniapp.dcloud.io/api/ui/navigationbar?id=setnavigationbarcolor
358
+ * @tutorial https://uniapp.dcloud.net.cn/uni-app-x/api/set-navigation-bar-color.html
359
359
  * @uniPlatform {
360
360
  * "app": {
361
361
  * "android": {
@@ -376,8 +376,8 @@ export interface Uni {
376
376
  * "unixVer": "x"
377
377
  * },
378
378
  * "alipay": {
379
- * "hostVer": "",
380
- * "uniVer": "",
379
+ * "hostVer": "x",
380
+ * "uniVer": "x",
381
381
  * "unixVer": "x"
382
382
  * },
383
383
  * "baidu": {
@@ -417,5 +417,7 @@ export interface Uni {
417
417
  * }
418
418
  * }
419
419
  */
420
- setNavigationBarColor(options: SetNavigationBarColorOptions): void
420
+ setNavigationBarColor(
421
+ options: SetNavigationBarColorOptions
422
+ ): Promise<SetNavigationBarColorSuccess> | null
421
423
  }
@@ -0,0 +1,23 @@
1
+ import {
2
+ SetNavigationBarTitleOptions as SetNavigationBarTitleOptionsOrigin,
3
+ SetNavigationBarTitleSuccess as SetNavigationBarTitleSuccessOrigin,
4
+ SetNavigationBarTitleSuccessCallback as SetNavigationBarTitleSuccessCallbackOrigin,
5
+ SetNavigationBarTitleFail as SetNavigationBarTitleFailOrigin,
6
+ SetNavigationBarTitleFailCallback as SetNavigationBarTitleFailCallbackOrigin,
7
+ SetNavigationBarTitleComplete as SetNavigationBarTitleCompleteOrigin,
8
+ SetNavigationBarTitleCompleteCallback as SetNavigationBarTitleCompleteCallbackOrigin,
9
+ SetNavigationBarTitle as SetNavigationBarTitleOrigin,
10
+ Uni as UniOrigin
11
+ } from './interface'
12
+
13
+ declare global {
14
+ type SetNavigationBarTitleOptions = SetNavigationBarTitleOptionsOrigin
15
+ type SetNavigationBarTitleSuccess = SetNavigationBarTitleSuccessOrigin
16
+ type SetNavigationBarTitleSuccessCallback = SetNavigationBarTitleSuccessCallbackOrigin
17
+ type SetNavigationBarTitleFail = SetNavigationBarTitleFailOrigin
18
+ type SetNavigationBarTitleFailCallback = SetNavigationBarTitleFailCallbackOrigin
19
+ type SetNavigationBarTitleComplete = SetNavigationBarTitleCompleteOrigin
20
+ type SetNavigationBarTitleCompleteCallback = SetNavigationBarTitleCompleteCallbackOrigin
21
+ type SetNavigationBarTitle = SetNavigationBarTitleOrigin
22
+ interface Uni extends UniOrigin { }
23
+ }