@dcloudio/uni-app-x 0.5.16 → 0.6.0

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 (84) hide show
  1. package/options.d.ts +9 -0
  2. package/package.json +4 -3
  3. package/types/app.d.ts +59 -166
  4. package/types/index.d.ts +1 -2
  5. package/types/native/AsyncApiResult.d.ts +1 -1
  6. package/types/native/CSSStyleDeclaration.d.ts +15 -12
  7. package/types/native/CustomEvent.d.ts +3 -3
  8. package/types/native/DOMRect.d.ts +2 -2
  9. package/types/native/DrawableContext.d.ts +149 -149
  10. package/types/native/Element.d.ts +7 -5
  11. package/types/native/Event.d.ts +38 -38
  12. package/types/native/IApp.d.ts +2 -2
  13. package/types/native/IDocument.d.ts +3 -3
  14. package/types/native/INavigationBar.d.ts +1 -1
  15. package/types/native/IPage.d.ts +15 -10
  16. package/types/native/IPageManager.d.ts +2 -2
  17. package/types/native/IUniError.d.ts +18 -18
  18. package/types/native/ImageErrorEvent.d.ts +2 -2
  19. package/types/native/ImageLoadEvent.d.ts +2 -2
  20. package/types/native/InputBlurEvent.d.ts +8 -8
  21. package/types/native/InputConfirmEvent.d.ts +8 -8
  22. package/types/native/InputEvent.d.ts +20 -20
  23. package/types/native/InputFocusEvent.d.ts +13 -13
  24. package/types/native/InputKeyboardHeightChangeEvent.d.ts +12 -12
  25. package/types/native/MouseEvent.d.ts +58 -58
  26. package/types/native/NestedPreScrollEvent.d.ts +22 -22
  27. package/types/native/NodeData.d.ts +2 -2
  28. package/types/native/PageEvent.d.ts +2 -2
  29. package/types/native/PageScrollEvent.d.ts +5 -5
  30. package/types/native/RefresherEvent.d.ts +2 -2
  31. package/types/native/ResizeEvent.d.ts +27 -27
  32. package/types/native/RichTextItemClickEvent.d.ts +2 -2
  33. package/types/native/ScrollEvent.d.ts +28 -28
  34. package/types/native/ScrollToLowerEvent.d.ts +6 -6
  35. package/types/native/ScrollToUpperEvent.d.ts +6 -6
  36. package/types/native/SnapshotOptions.d.ts +8 -8
  37. package/types/native/SourceError.d.ts +1 -1
  38. package/types/native/StartNestedScrollEvent.d.ts +7 -7
  39. package/types/native/SwiperAnimationFinishEvent.d.ts +6 -6
  40. package/types/native/SwiperChangeEvent.d.ts +6 -6
  41. package/types/native/SwiperTransitionEvent.d.ts +6 -6
  42. package/types/native/TabTapEvent.d.ts +11 -9
  43. package/types/native/TextareaBlurEvent.d.ts +12 -12
  44. package/types/native/TextareaFocusEvent.d.ts +12 -12
  45. package/types/native/TextareaLineChangeEvent.d.ts +16 -16
  46. package/types/native/TouchEvent.d.ts +43 -43
  47. package/types/native/UTSAndroidHookProxy.d.ts +6 -6
  48. package/types/native/UniAggregateError.d.ts +4 -2
  49. package/types/native/UniAppManager.d.ts +3 -3
  50. package/types/native/UniElement.d.ts +30 -15
  51. package/types/native/UniError.d.ts +7 -7
  52. package/types/native/UniTabsElement.d.ts +4 -3
  53. package/types/native/UniTextElement.d.ts +3 -3
  54. package/types/native/UniVideoElement.d.ts +4 -4
  55. package/types/native/UniWebViewElement.d.ts +3 -3
  56. package/types/native/WebViewDownloadEvent.d.ts +3 -3
  57. package/types/native/WebViewErrorEvent.d.ts +3 -3
  58. package/types/native/WebViewLoadedEvent.d.ts +3 -3
  59. package/types/native/WebViewLoadingEvent.d.ts +4 -3
  60. package/types/native/WebViewMessageEvent.d.ts +3 -3
  61. package/types/native/WebViewStyles.d.ts +3 -3
  62. package/types/native/global.d.ts +254 -0
  63. package/types/native/index.d.ts +57 -58
  64. package/types/native-global/index.d.ts +1 -0
  65. package/types/page.d.ts +26 -8
  66. package/types/uni/core/lib/route/index.d.ts +12 -0
  67. package/types/uni/core/lib/route/interface.d.ts +31 -5
  68. package/types/uni/core/lib/ui/get-element-by-id/interface.d.ts +1 -1
  69. package/types/uni/core/lib/ui/page-scroll-to/index.d.ts +4 -0
  70. package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +10 -1
  71. package/types/uni/core/lib/ui/set-navigation-bar-color/index.d.ts +4 -0
  72. package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +9 -1
  73. package/types/uni/core/lib/ui/set-navigation-bar-title/index.d.ts +4 -0
  74. package/types/uni/core/lib/ui/set-navigation-bar-title/interface.d.ts +10 -1
  75. package/types/uni/uts-plugin-api/lib/uni-createWebviewContext/utssdk/interface.d.ts +4 -4
  76. package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +27 -6
  77. package/types/uni/uts-plugin-api/lib/uni-push/utssdk/interface.d.ts +10 -10
  78. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +4 -4
  79. package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +21 -11
  80. package/types/uni/uts-plugin-modules/lib/uni-facialRecognitionVerify/utssdk/index.d.ts +10 -0
  81. package/types/uni/uts-plugin-modules/lib/uni-facialRecognitionVerify/utssdk/interface.d.ts +63 -12
  82. package/types/vue/UniCloudDBElement.d.ts +1 -1
  83. package/uts-plugin.d.ts +1 -0
  84. package/types/shims-vue.d.ts +0 -14
package/options.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import app from '@/App.uvue'
2
+
3
+ type App = typeof app
4
+ declare global {
5
+
6
+ export interface AppCreateVueAppComponentDefault extends App {
7
+
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-app-x",
3
- "version": "0.5.16",
3
+ "version": "0.6.0",
4
4
  "description": "uni-app x types",
5
5
  "typings": "index.d.ts",
6
6
  "author": "DCloud",
@@ -11,9 +11,10 @@
11
11
  "build:types:plugin:api": "node ./scripts/build-types.js -t uts-plugin-api",
12
12
  "build:types:plugin:component": "node ./scripts/build-types.js -t uts-plugin-component",
13
13
  "build:types:plugin:modules": "node ./scripts/build-types.js -t uts-plugin-modules",
14
- "build:types:plugin": "npm run build:types:plugin:api && npm run build:types:plugin:component",
14
+ "build:types:plugin": "npm run build:types:plugin:api && npm run build:types:plugin:component && npm run build:types:plugin:modules",
15
15
  "build:types:meta": "node ./scripts/build-meta.js",
16
- "build:types": "npm run build:types:core && npm run build:types:plugin"
16
+ "build:types:native": "node ./scripts/build-native.js",
17
+ "build:types": "build:types:native && npm run build:types:core && npm run build:types:plugin"
17
18
  },
18
19
  "devDependencies": {
19
20
  "delete": "^1.1.0",
package/types/app.d.ts CHANGED
@@ -1,4 +1,26 @@
1
1
  /// <reference path='./common.d.ts' />
2
+ import { ComputedOptions, EditorCreateVueAppComponent, MethodOptions, OptionsData, ComponentInternalInstance, EditorVueAppComponent, EditorComponentPublicInstance, DefineApp } from '@vue/runtime-core'
3
+
4
+ /**
5
+ * Construct a type with a set of properties K of type T
6
+ */
7
+ type Record<K extends keyof any, T> = {
8
+ [P in K]: T;
9
+ };
10
+ /**
11
+ * From T, pick a set of properties whose keys are in the union K
12
+ */
13
+ type Pick<T, K extends keyof T> = {
14
+ [P in K]: T[P];
15
+ };
16
+ /**
17
+ * Exclude from T those types that are assignable to U
18
+ */
19
+ type Exclude<T, U> = T extends U ? never : T;
20
+ /**
21
+ * Construct a type with the properties of T except for those in type K.
22
+ */
23
+ type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
2
24
 
3
25
  interface ReferrerInfo {
4
26
  /**
@@ -132,8 +154,8 @@ interface PageNotFoundOption {
132
154
  */
133
155
  isEntryPage: boolean;
134
156
  }
135
-
136
- interface AppInstance<T extends AnyObject = {}> {
157
+ type GlobalData = Record<string, any | null>
158
+ interface UniAppOptions<G extends GlobalData = GlobalData> {
137
159
  /**
138
160
  * 全局对象
139
161
  * 文档:[https://uniapp.dcloud.io/collocation/App?id=globaldata](https://uniapp.dcloud.io/collocation/App?id=globaldata)
@@ -199,7 +221,7 @@ interface AppInstance<T extends AnyObject = {}> {
199
221
  * }
200
222
  *}
201
223
  */
202
- globalData?: AnyObject;
224
+ globalData?: G;
203
225
  /**
204
226
  * 生命周期回调 监听应用初始化
205
227
  *
@@ -549,160 +571,6 @@ interface AppInstance<T extends AnyObject = {}> {
549
571
  *}
550
572
  */
551
573
  onPageNotFound?(options: PageNotFoundOption): void;
552
- /**
553
- * 未处理的 Promise 拒绝事件监听函数
554
- *
555
- * @tutorial [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
556
- * @uniPlatform {
557
- * "app": {
558
- * "android": {
559
- * "osVer": "5.0",
560
- * "uniVer": "√",
561
- * "unixVer": "x"
562
- * },
563
- * "ios": {
564
- * "osVer": "10.0",
565
- * "uniVer": "√",
566
- * "unixVer": "x"
567
- * }
568
- * },
569
- * "mp": {
570
- * "weixin": {
571
- * "hostVer": "√",
572
- * "uniVer": "√",
573
- * "unixVer": "x"
574
- * },
575
- * "alipay": {
576
- * "hostVer": "√",
577
- * "uniVer": "√",
578
- * "unixVer": "x"
579
- * },
580
- * "baidu": {
581
- * "hostVer": "√",
582
- * "uniVer": "√",
583
- * "unixVer": "x"
584
- * },
585
- * "toutiao": {
586
- * "hostVer": "√",
587
- * "uniVer": "√",
588
- * "unixVer": "x"
589
- * },
590
- * "lark": {
591
- * "hostVer": "√",
592
- * "uniVer": "√",
593
- * "unixVer": "x"
594
- * },
595
- * "qq": {
596
- * "hostVer": "√",
597
- * "uniVer": "√",
598
- * "unixVer": "x"
599
- * },
600
- * "kuaishou": {
601
- * "hostVer": "√",
602
- * "uniVer": "√",
603
- * "unixVer": "x"
604
- * },
605
- * "jd": {
606
- * "hostVer": "√",
607
- * "uniVer": "√",
608
- * "unixVer": "x"
609
- * },
610
- * "360": {
611
- * "hostVer": "√",
612
- * "uniVer": "√",
613
- * "unixVer": "x"
614
- * }
615
- * },
616
- * "quickapp": {
617
- * "uniVer": "√",
618
- * "unixVer": "x"
619
- * },
620
- * "web": {
621
- * "uniVer": "√",
622
- * "unixVer": "x"
623
- * }
624
- *}
625
- */
626
-
627
- // onUnhandledRejection?(options: UniNamespace.OnUnhandledRejectionCallbackResult): void;
628
-
629
- /**
630
- * 监听系统主题变化
631
- *
632
- * @tutorial [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
633
- * @uniPlatform {
634
- * "app": {
635
- * "android": {
636
- * "osVer": "5.0",
637
- * "uniVer": "√",
638
- * "unixVer": "x"
639
- * },
640
- * "ios": {
641
- * "osVer": "10.0",
642
- * "uniVer": "√",
643
- * "unixVer": "x"
644
- * }
645
- * },
646
- * "mp": {
647
- * "weixin": {
648
- * "hostVer": "√",
649
- * "uniVer": "√",
650
- * "unixVer": "x"
651
- * },
652
- * "alipay": {
653
- * "hostVer": "√",
654
- * "uniVer": "√",
655
- * "unixVer": "x"
656
- * },
657
- * "baidu": {
658
- * "hostVer": "√",
659
- * "uniVer": "√",
660
- * "unixVer": "x"
661
- * },
662
- * "toutiao": {
663
- * "hostVer": "√",
664
- * "uniVer": "√",
665
- * "unixVer": "x"
666
- * },
667
- * "lark": {
668
- * "hostVer": "√",
669
- * "uniVer": "√",
670
- * "unixVer": "x"
671
- * },
672
- * "qq": {
673
- * "hostVer": "√",
674
- * "uniVer": "√",
675
- * "unixVer": "x"
676
- * },
677
- * "kuaishou": {
678
- * "hostVer": "√",
679
- * "uniVer": "√",
680
- * "unixVer": "x"
681
- * },
682
- * "jd": {
683
- * "hostVer": "√",
684
- * "uniVer": "√",
685
- * "unixVer": "x"
686
- * },
687
- * "360": {
688
- * "hostVer": "√",
689
- * "uniVer": "√",
690
- * "unixVer": "x"
691
- * }
692
- * },
693
- * "quickapp": {
694
- * "uniVer": "√",
695
- * "unixVer": "x"
696
- * },
697
- * "web": {
698
- * "uniVer": "√",
699
- * "unixVer": "x"
700
- * }
701
- *}
702
- */
703
-
704
- // onThemeChange?(options: UniNamespace.OnThemeChangeCallbackResult): void;
705
-
706
574
  /**
707
575
  * 监听 nvue 页面消息
708
576
  *
@@ -935,15 +803,40 @@ interface AppInstance<T extends AnyObject = {}> {
935
803
  onLastPageBackPress?(): void;
936
804
  }
937
805
 
938
- type AppConstructor = <T extends AnyObject & AppInstance>(
939
- options: AppInstance<T> & T,
940
- ) => void;
941
-
942
-
943
806
  /**
944
- * `getApp()` 函数用于获取当前应用实例,可通过应用实例调用 App.uvue methods 中定义的方法。
945
- * @tutorial https://uniapp.dcloud.net.cn/tutorial/page.html#getapp
807
+ * Obtain the return type of a function type
946
808
  */
947
- type GetApp = () => AppInstance;
809
+ type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
810
+
811
+ type EditorComponentPublicInstanceX<D extends OptionsData, C extends ComputedOptions, M extends MethodOptions, G extends GlobalData> = EditorComponentPublicInstance<D, C, M> & {
812
+ globalData: G
813
+ }
814
+
815
+ type EditorVueAppComponentX<D extends OptionsData, C extends ComputedOptions, M extends MethodOptions, G extends GlobalData> = EditorVueAppComponent<D, C, M> & {
816
+ $: EditorComponentPublicInstanceX<D, C, M, G>
817
+ }
818
+
819
+ type EditorCreateVueAppComponentX<D extends OptionsData = OptionsData, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, G extends GlobalData = GlobalData> = Omit<EditorCreateVueAppComponent, 'create'> & {
820
+ // 仅用于编辑器提示,TODO 重写 create 方法实现
821
+ create: (instance: ComponentInternalInstance) => EditorVueAppComponentX<D, C, M, G>;
822
+ }
948
823
 
949
- declare const getApp: GetApp;
824
+ type AppInstance<T extends EditorCreateVueAppComponentX> = ReturnType<T['create']>['$']
825
+
826
+ declare global {
827
+ export interface AppCreateVueAppComponentDefault { }
828
+ /**
829
+ * `getApp()` 函数用于获取当前应用实例,可通过应用实例调用 App.uvue methods 中定义的方法。
830
+ * @tutorial https://uniapp.dcloud.net.cn/tutorial/page.html#getapp
831
+ */
832
+ function getApp<T extends EditorCreateVueAppComponentX = AppCreateVueAppComponentDefault>(): AppInstance<T>
833
+ }
834
+
835
+ type DefineAppX<D extends OptionsData, C extends ComputedOptions, M extends MethodOptions, G extends GlobalData> = DefineApp<D, C, M> & UniAppOptions<G>
836
+
837
+ declare module '@vue/runtime-core' {
838
+ interface AppCustomOptions extends UniAppOptions {
839
+
840
+ }
841
+ export function defineApp<D extends OptionsData = OptionsData, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, G extends GlobalData = GlobalData>(options: DefineAppX<D, C, M, G>): EditorCreateVueAppComponentX<D, C, M, G>
842
+ }
package/types/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- /// <reference path='./native/index.d.ts' />
1
+ /// <reference path='./native/global.d.ts' />
2
2
  /// <reference path='./vue/index.d.ts' />
3
3
  /// <reference path='./uni/index.d.ts' />
4
4
  /// <reference path='./uni-cloud/index.d.ts' />
5
5
  /// <reference path='./app.d.ts' />
6
6
  /// <reference path='./page.d.ts' />
7
- /// <reference path='./shims-vue.d.ts' />
@@ -2,6 +2,6 @@
2
2
  * @package io.dcloud.uniapp
3
3
  * @autodoc false
4
4
  */
5
- declare interface AsyncApiResult {
5
+ export interface AsyncApiResult {
6
6
  errMsg: string
7
7
  }
@@ -2,19 +2,22 @@
2
2
  * CSSStyleDeclaration表示一个CSS 声明块对象,它是一个 CSS 属性键值对的集合,暴露样式信息和各种与样式相关的方法和属性。
3
3
  * @package io.dcloud.uniapp.runtime
4
4
  */
5
- declare class CSSStyleDeclaration {
5
+ export class CSSStyleDeclaration {
6
6
 
7
- /**
8
- * 对CSS指定样式设置一个新值,如有此样式已存在则更新。
9
- * @param name CSS样式名称
10
- * @param value 要设置的新CSS样式值
11
- */
12
- setProperty(name: string|string.cssPropertyString, value: any|null): void
7
+ /**
8
+ * 对CSS指定样式设置一个新值,如有此样式已存在则更新。
9
+ * @param name CSS样式名称
10
+ * @param value 要设置的新CSS样式值
11
+ */
12
+ setProperty(name: string | string.cssPropertyString, value: any | null): void
13
13
 
14
- /**
15
- * 获取CSS指定的样式值,如果指定的样式不存在则返回null。
16
- * @param property 要获取的CSS样式名称
17
- */
18
- getPropertyValue(property: string|string.cssPropertyString): any|null
14
+ /**
15
+ * 获取CSS指定的样式值,如果指定的样式不存在则返回null。
16
+ * @param property 要获取的CSS样式名称
17
+ */
18
+ getPropertyValue(property: string | string.cssPropertyString): any | null
19
+
20
+ removeProperty(property: string | string.cssPropertyString): any | null
19
21
 
22
+ getStyleMap(): Map<String, any | null>
20
23
  }
@@ -1,9 +1,9 @@
1
- /// <reference path="./Event.d.ts" />
1
+ import { Event } from "./Event";
2
2
 
3
3
  /**
4
4
  * @package io.dcloud.uniapp.runtime
5
5
  */
6
- declare class CustomEventOptions<T>{
6
+ export class CustomEventOptions<T>{
7
7
  detail: T
8
8
  constructor (detail: T)
9
9
  }
@@ -11,7 +11,7 @@ declare class CustomEventOptions<T>{
11
11
  /**
12
12
  * @package io.dcloud.uniapp.runtime
13
13
  */
14
- declare class CustomEvent<T> extends Event {
14
+ export class CustomEvent<T> extends Event {
15
15
  get detail(): T
16
16
  constructor (type: string, options: CustomEventOptions<T>)
17
17
  }
@@ -2,7 +2,7 @@
2
2
  * 一个 DOMRect 代表一个矩形。
3
3
  * @package io.dcloud.uniapp.runtime
4
4
  */
5
- declare class DOMRect {
5
+ export class DOMRect {
6
6
 
7
7
  /**
8
8
  * 创建一个新的 DOMRect 对象
@@ -11,7 +11,7 @@ declare class DOMRect {
11
11
  * @param {number} [width=0] 矩形的宽
12
12
  * @param {number} [height=0] 矩形的高
13
13
  */
14
- constructor(x?: number, y?: number, width?: number, height?: number);
14
+ constructor (x?: number, y?: number, width?: number, height?: number);
15
15
 
16
16
  /**
17
17
  * 矩形的宽