@dcloudio/uni-app-x 0.6.7 → 0.7.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 (37) hide show
  1. package/package.json +1 -1
  2. package/types/native/CustomEvent.d.ts +2 -1
  3. package/types/native/Event.d.ts +8 -3
  4. package/types/native/IUniElement.d.ts +748 -0
  5. package/types/native/InputFocusEvent.d.ts +30 -17
  6. package/types/native/SourceError.d.ts +10 -0
  7. package/types/native/StartNestedScrollEvent.d.ts +2 -2
  8. package/types/native/UniApp.d.ts +66 -0
  9. package/types/native/UniCallbackWrapper.d.ts +7 -0
  10. package/types/native/UniDocument.d.ts +33 -0
  11. package/types/native/UniElement.d.ts +24 -108
  12. package/types/native/UniPage.d.ts +96 -0
  13. package/types/native/UniPageManager.d.ts +17 -0
  14. package/types/native/UniTabsElement.d.ts +20 -81
  15. package/types/native/UniTextElement.d.ts +3 -11
  16. package/types/native/UniVideoElement.d.ts +2 -2
  17. package/types/native/UniWebViewElement.d.ts +3 -24
  18. package/types/native/ViewToTempFilePathOptions.d.ts +38 -0
  19. package/types/native/global.d.ts +92 -76
  20. package/types/native/index.d.ts +7 -8
  21. package/types/uni/core/lib/ui/tab-bar/interface.d.ts +1 -0
  22. package/types/uni/uts-plugin-api/index.d.ts +1 -1
  23. package/types/uni/uts-plugin-api/lib/uni-fileSystemManager/utssdk/interface.d.ts +1 -1
  24. package/types/uni/uts-plugin-api/lib/uni-network/utssdk/interface.d.ts +2 -2
  25. package/types/uni/uts-plugin-api/lib/uni-websocket/utssdk/interface.d.ts +2 -2
  26. package/types/uni/uts-plugin-biz/index.d.ts +1 -0
  27. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/index.d.ts +34 -0
  28. package/types/uni/uts-plugin-biz/lib/uni-ad/utssdk/interface.d.ts +128 -0
  29. package/types/vue/UniCanvasElement.d.ts +270 -0
  30. package/types/native/Element.d.ts +0 -288
  31. package/types/native/IApp.d.ts +0 -28
  32. package/types/native/IComment.d.ts +0 -5
  33. package/types/native/IDocument.d.ts +0 -42
  34. package/types/native/IPage.d.ts +0 -135
  35. package/types/native/IPageManager.d.ts +0 -15
  36. package/types/native/ITextNode.d.ts +0 -6
  37. package/types/native/UniAppManager.d.ts +0 -15
@@ -1,17 +1,30 @@
1
- import { Event } from "./Event";
2
-
3
- /**
4
- * @package io.dcloud.uniapp.runtime
5
- */
6
- export class InputFocusEvent extends Event {
7
- detail: {
8
- /**
9
- * 键盘高度
10
- */
11
- height: number,
12
- /**
13
- * 输入框内容
14
- */
15
- value: string
16
- }
17
- }
1
+ import { Event } from "./Event";
2
+
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ */
6
+ export class InputFocusEvent extends Event {
7
+ detail: {
8
+ /**
9
+ * 键盘高度
10
+ * @uniPlatform {
11
+ * "app": {
12
+ * "android": {
13
+ * "osVer": "5.0",
14
+ * "uniVer": "√",
15
+ * "unixVer": "√"
16
+ * }
17
+ * },
18
+ * "web": {
19
+ * "uniVer": "x",
20
+ * "unixVer": "x"
21
+ * }
22
+ * }
23
+ */
24
+ height: number,
25
+ /**
26
+ * 输入框内容
27
+ */
28
+ value: string
29
+ }
30
+ }
@@ -29,8 +29,18 @@ export class SourceError extends Error {
29
29
  */
30
30
  constructor (message: string, options: UTSJSONObject);
31
31
 
32
+ /**
33
+ * 源错误模块名称
34
+ */
35
+ subject?: string | null;
36
+
32
37
  /**
33
38
  * 源错误描述信息
34
39
  */
35
40
  message: string;
41
+
42
+ /**
43
+ * 源错误的错误码
44
+ */
45
+ code: number;
36
46
  }
@@ -1,5 +1,5 @@
1
1
  import { Event } from "./Event";
2
- import { Element } from "./Element";
2
+ import { UniElement } from "./IUniElement";
3
3
 
4
4
  /**
5
5
  * @package io.dcloud.uniapp.runtime
@@ -8,7 +8,7 @@ export class StartNestedScrollEvent extends Event {
8
8
  /**
9
9
  * 开始滚动子节点对象
10
10
  */
11
- node: Element
11
+ node: UniElement
12
12
 
13
13
  /**
14
14
  * 是否由触摸行为发生的Event
@@ -0,0 +1,66 @@
1
+ import { UniPageManager } from "./UniPageManager"
2
+ import { UniCallbackWrapper } from "./UniCallbackWrapper";
3
+ import { NativeLoadFontFaceOptions } from "./NativeLoadFontFaceOptions"
4
+ import { KeyEvent } from "./Event"
5
+
6
+ /**
7
+ * @package io.dcloud.uniapp.runtime
8
+ * @autodoc false
9
+ */
10
+ export interface UniApp {
11
+ /**
12
+ * 应用id
13
+ */
14
+ readonly appid: string
15
+
16
+ /**
17
+ * 页面管理
18
+ */
19
+ readonly pageManager: UniPageManager
20
+
21
+ /**
22
+ * 接收框架触发的event
23
+ * @autodoc false
24
+ */
25
+ onEvent(event: string): void
26
+
27
+
28
+ /**
29
+ * 监听app事件
30
+ */
31
+ addEventListener<T>(event: 'onShow' | 'onHide' | 'onExit', callback: (event: T) => void): UniCallbackWrapper
32
+
33
+ /**
34
+ * 注销app监听
35
+ */
36
+ removeEventListener(event: string, callbackWrapper: UniCallbackWrapper): void
37
+
38
+ /**
39
+ * 监听app按键监听
40
+ */
41
+ addKeyEventListener(event: 'onBackButton', callback: (event: KeyEvent) => boolean): void
42
+
43
+ /**
44
+ * 退出app
45
+ */
46
+ quit(): void
47
+
48
+ /**
49
+ * 获取原生app启动耗时,不包含uniapp启动时间
50
+ * @autodoc false
51
+ */
52
+ getAppStartDuration(): number
53
+
54
+ /**
55
+ * 加载自定义字体
56
+ */
57
+ loadFontFace(options: NativeLoadFontFaceOptions): void
58
+
59
+ /**
60
+ * 获取直达相关信息
61
+ * @autodoc false
62
+ */
63
+ getRedirectInfo(): Map<string, any | null>
64
+ }
65
+
66
+ export type IApp = UniApp
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 事件回调封装类,用于注销监听函数的形参
3
+ * @package io.dcloud.uts
4
+ */
5
+ export class UniCallbackWrapper {
6
+
7
+ }
@@ -0,0 +1,33 @@
1
+ import { INodeData } from "./NodeData";
2
+ import { UniElement, UniCommentElement } from "./IUniElement";
3
+
4
+ /**
5
+ * @package io.dcloud.uniapp.runtime
6
+ * @autodoc false
7
+ */
8
+ export interface UniDocument extends UniElement {
9
+ readonly body: UniElement
10
+
11
+ getRealDomNodeById<T>(tag: string): T | null
12
+
13
+ startRender(): void
14
+
15
+ startRender(callback: (()=>void) | null): void
16
+
17
+ createElement(tagName: string): UniElement
18
+
19
+ createElement(data: INodeData): UniElement
20
+
21
+ createComment(data: string): UniCommentElement
22
+
23
+ notifyLayout(): void
24
+
25
+ runAsyncDomTask(fn: () => (any | null), callback: (value: any | null) => void): void
26
+
27
+ /**
28
+ * 页面排版完毕回调callback
29
+ */
30
+ waitNativeRender(callback: () => void): void
31
+ }
32
+
33
+ export type IDocument = UniDocument
@@ -1,30 +1,31 @@
1
1
  import { CSSStyleDeclaration } from "./CSSStyleDeclaration";
2
2
  import { DOMRect } from "./DOMRect";
3
3
  import { DrawableContext } from "./DrawableContext";
4
- import { Element } from "./Element";
4
+ import { UniElement, UniViewElement } from "./IUniElement";
5
5
  import { Event } from './Event'
6
6
  import { TakeSnapshotOptions } from "./SnapshotOptions";
7
+ import { UniCallbackWrapper } from "./UniCallbackWrapper";
7
8
 
8
9
  /**
9
10
  * view元素对象
10
11
  * @package io.dcloud.uniapp.runtime
11
12
  * @autodoc false
12
13
  */
13
- export class UniElement implements Element {
14
+ export class UniElementImpl implements UniElement {
14
15
  classList: string[];
15
- firstChild: Element;
16
- lastChild: Element;
17
- parentNode: Element;
18
- parentElement: Element;
19
- previousSibling: Element;
20
- nextSibling: Element;
21
- nextElementSibling: Element;
22
- children: Element[];
23
- childNodes: Element[];
16
+ firstChild: UniElement;
17
+ lastChild: UniElement;
18
+ parentNode: UniElement;
19
+ parentElement: UniElement;
20
+ previousSibling: UniElement;
21
+ nextSibling: UniElement;
22
+ nextElementSibling: UniElement;
23
+ children: UniElement[];
24
+ childNodes: UniElement[];
24
25
  tagName: string;
25
26
  nodeName: string;
26
- dataset: Map<string, any | null>;
27
- attributes: Map<string, any | null>;
27
+ dataset: Map<string, any>;
28
+ attributes: Map<string, any>;
28
29
  style: CSSStyleDeclaration;
29
30
  scrollWidth: number;
30
31
  scrollHeight: number;
@@ -37,22 +38,26 @@ export class UniElement implements Element {
37
38
  ext: Map<string, any>;
38
39
  getNodeId(): string;
39
40
  takeSnapshot(options: TakeSnapshotOptions): void;
40
- appendChild(aChild: Element): void;
41
- insertBefore(newChild: Element, refChild?: Element): void;
41
+ appendChild(aChild: UniElement): void;
42
+ insertBefore(newChild: UniElement, refChild?: UniElement | null): UniElement | null;
42
43
  setAttribute(key: string, value: string): void;
43
44
  getAttribute(key: string): string;
45
+ setAnyAttribute(key: string, value: any): void;
46
+ getAnyAttribute(key: string): any | null;
44
47
  hasAttribute(key: string): boolean;
45
48
  removeAttribute(key: string): void;
46
49
  updateStyle(map: Map<string, any>): void;
47
50
  getBoundingClientRect(): DOMRect;
48
51
  getDrawableContext(): DrawableContext;
49
- addEventListener<T extends Event, R>(type: string, callback: (event: T) => R): void;
50
- removeEventListener<T extends Event, R>(type: string, callback?: (event: T) => R): void;
51
- removeChild(aChild: Element): Element;
52
+ addEventListener<T extends Event, R>(type: string, callback: (event: T) => R): UniCallbackWrapper;
53
+ removeEventListener(type: string, callbackWrapper: UniCallbackWrapper): void;
54
+ removeChild(aChild: UniElement): UniElement | null;
52
55
  remove(): void;
53
56
  dispatchEvent(type: string, value: Event): void;
54
57
  scrollTo(x: number, y: number): void;
55
58
  scrollBy(x: number, y: number): void;
59
+ querySelector(selector: string.cssSelectorString): UniElement;
60
+ querySelectorAll(selector: string.cssSelectorString): UniElement[];
56
61
  focus(): void;
57
62
  blur(): void;
58
63
  }
@@ -62,94 +67,5 @@ export class UniElement implements Element {
62
67
  * @package io.dcloud.uniapp.runtime
63
68
  * @autodoc false
64
69
  */
65
- export interface UniViewElement extends UniElement {
66
- }
67
-
68
- /**
69
- * scroll-view元素对象
70
- * @package io.dcloud.uniapp.runtime
71
- * @autodoc false
72
- */
73
- export interface UniScrollViewElement extends UniElement {
74
- }
75
-
76
- /**
77
- * list-view元素对象
78
- * @package io.dcloud.uniapp.runtime
79
- * @autodoc false
80
- */
81
- export interface UniListViewElement extends UniScrollViewElement {
82
- }
83
-
84
- /**
85
- * list-item元素对象
86
- * @package io.dcloud.uniapp.runtime
87
- * @autodoc false
88
- */
89
- export interface UniListItemElement extends UniElement {
90
- }
91
-
92
- /**
93
- * swiper元素对象
94
- * @package io.dcloud.uniapp.runtime
95
- * @autodoc false
96
- */
97
- export interface UniSwiperElement extends UniElement {
98
- }
99
-
100
- /**
101
- * swiper-item元素对象
102
- * @package io.dcloud.uniapp.runtime
103
- * @autodoc false
104
- */
105
- export interface UniSwiperItemElement extends UniElement {
106
- }
107
-
108
- /**
109
- * image元素对象
110
- * @package io.dcloud.uniapp.runtime
111
- * @autodoc false
112
- */
113
- export interface UniImageElement extends UniElement {
114
- }
115
-
116
- /**
117
- * input元素对象
118
- * @package io.dcloud.uniapp.runtime
119
- * @autodoc false
120
- */
121
- export interface UniInputElement extends UniElement {
122
- }
123
-
124
- /**
125
- * textarea元素对象
126
- * @package io.dcloud.uniapp.runtime
127
- * @autodoc false
128
- */
129
- export interface UniTextareaElement extends UniElement {
130
- }
131
-
132
- /**
133
- * rich-text元素对象
134
- * @package io.dcloud.uniapp.runtime
135
- * @autodoc false
136
- */
137
- export interface UniRichTextElement extends UniElement {
138
- }
139
-
140
- /**
141
- * sticky-header元素对象
142
- * @package io.dcloud.uniapp.runtime
143
- * @autodoc false
144
- */
145
- export interface UniStickyHeaderElement extends UniElement {
146
- }
147
-
148
-
149
- /**
150
- * sticky-section元素对象
151
- * @package io.dcloud.uniapp.runtime
152
- * @autodoc false
153
- */
154
- export interface UniStickySectionElement extends UniElement {
70
+ export class UniViewElementImpl extends UniElementImpl implements UniViewElement {
155
71
  }
@@ -0,0 +1,96 @@
1
+ import { UniDocument } from "./UniDocument";
2
+ import { INodeData } from "./NodeData";
3
+ import { PageEvent } from "./PageEvent";
4
+ import { PageScrollEvent } from "./PageScrollEvent";
5
+ import { NativeLoadFontFaceOptions } from './NativeLoadFontFaceOptions'
6
+ import { UniCallbackWrapper } from "./UniCallbackWrapper";
7
+ import { ViewToTempFilePathOptions } from "./ViewToTempFilePathOptions"
8
+
9
+
10
+ /**
11
+ * @package io.dcloud.uniapp.runtime
12
+ * @autodoc false
13
+ */
14
+ export interface UniPage {
15
+ readonly pageUrl: string;
16
+ /**
17
+ * 页面id
18
+ */
19
+ readonly pageId: string
20
+ readonly document: UniDocument
21
+ /**
22
+ * 开启排版渲染
23
+ */
24
+ startRender(): void
25
+ /**
26
+ * 开启排版渲染
27
+ * @param callback 首次排版回调监听器
28
+ */
29
+ startRender(callback?: (() => void) | null): void
30
+ /**
31
+ * 显示页面
32
+ * @param options 显示配置项
33
+ * @param callback 显示完毕监听器
34
+ */
35
+ show(options?: Map<String, any | null> | null, callback?: (() => void) | null): void
36
+ show(options?: Map<String, any | null> | null): void
37
+
38
+ /**
39
+ * 关闭页面
40
+ * @param options 关闭配置项
41
+ * @param callback 关闭完毕监听器
42
+ */
43
+ close(options?: Map<String, any | null> | null, callback?: (() => void) | null): void
44
+ close(options?: Map<String, any | null> | null): void
45
+
46
+ updateStyle(style: Map<string, any | null>): void
47
+ /**
48
+ * 创建Document 已废弃
49
+ */
50
+ createDocument(documentData: INodeData): UniDocument
51
+ /**
52
+ * 监听页面相应事件
53
+ */
54
+ addPageEventListener(
55
+ type:
56
+ | 'onReady'
57
+ | 'onShow'
58
+ | 'onHide'
59
+ | 'onTabItemTap'
60
+ | 'onUnload'
61
+ | 'onReachBottom'
62
+ | 'onPullDownRefresh'
63
+ | 'onPageScroll'
64
+ | 'onResize'
65
+ | 'onWebViewServiceMessage'
66
+ | 'onPopGesture',
67
+ callback: (event: PageEvent) => void
68
+ ): UniCallbackWrapper
69
+ /**
70
+ * 监听页面onPageScroll事件
71
+ */
72
+ addPageScrollEventListener(callback: (event: PageScrollEvent) => void): UniCallbackWrapper
73
+ viewToTempFilePath(options: ViewToTempFilePathOptions): void
74
+ /**
75
+ * 加载自定义字体
76
+ */
77
+ loadFontFace(options: NativeLoadFontFaceOptions): void
78
+ /**
79
+ * 开始页面下拉刷新
80
+ */
81
+ startPullDownRefresh(): void
82
+ /**
83
+ * 停止当前页面下拉刷新
84
+ */
85
+ stopPullDownRefresh(): void
86
+ getPageRenderDuration(): number
87
+ getPageLayoutDuration(): number
88
+ getPageRenderCount(): number
89
+ getPageLayoutCount(): number
90
+ getFirstRenderStartTime(): number
91
+ getFirstLayoutStartTime(): number
92
+ getFirstPageRenderDuration(): number
93
+ getFirstPageLayoutDuration(): number
94
+ }
95
+
96
+ export type IPage = UniPage
@@ -0,0 +1,17 @@
1
+ import { UniPage } from "./UniPage";
2
+
3
+ /**
4
+ * @package io.dcloud.uniapp.runtime
5
+ * @autodoc false
6
+ */
7
+ export interface UniPageManager {
8
+ createPage(
9
+ pageUrl: string,
10
+ pageId: string,
11
+ pageStyle: Map<string, any | null>
12
+ ): UniPage
13
+
14
+ findPageById(pageId: string): UniPage | null
15
+ }
16
+
17
+ export type IPageManager = UniPageManager
@@ -1,90 +1,29 @@
1
- import { Element } from "./Element";
2
- import { UniElement } from "./UniElement";
1
+ import { UniElement, UniTabsElement } from "./IUniElement";
2
+ import { UniElementImpl } from "./UniElement";
3
3
 
4
4
  /**
5
5
  * tabs元素对象
6
6
  * @package io.dcloud.uniapp.runtime
7
7
  * @autodoc false
8
8
  */
9
- export interface UniTabsElement extends UniElement {
10
- /**
11
- * 添加item
12
- * @param pageId 页面id
13
- */
14
- appendItem(pageId: string): void
9
+ export class UniTabsElementImpl extends UniElementImpl implements UniTabsElement{
10
+ getTabBarHeight(): number;
11
+ appendCustomTabBar(tabBar: UniElement, direction: string): void;
12
+ hideTabBar(op: Map<string, any>): void;
13
+ switchSelect(pageId: string, index: number): void;
14
+ appendItem(itemElement: UniElement): void;
15
+ initTabBar(style: Map<string, any>): void;
16
+ appendItem(pageId: string): void;
17
+ currentItemId: string;
18
+ setTabBarBadge(op: Map<string, any>): void;
19
+ setTabBarStyle(op: Map<string, any>): void;
20
+ isTabBarVisible: boolean;
21
+ setTabBarItem(op: Map<string, any>): void;
22
+ hideTabBarRedDot(op: Map<string, any>): void;
23
+ showTabBar(op: Map<string, any>): void;
24
+ showTabBarRedDot(op: Map<string, any>): void;
25
+ removeTabBarBadge(op: Map<string, any>): void;
15
26
 
16
- /**
17
- * 添加item
18
- * @param itemElement item的元素对象
19
- */
20
- appendItem(itemElement: Element): void
21
-
22
- /**
23
- * 初始化tabBar
24
- */
25
- initTabBar(style: Map<string, any | null>): void
26
-
27
- /**
28
- * 添加自定义tabBar
29
- * @param tabBar tabBar元素
30
- * @param direction 排列方向
31
- */
32
- appendCustomTabBar(tabBar: Element, direction: string): void
33
-
34
- /**
35
- * item选中高亮
36
- * @param 被选中页面id
37
- * @index item下标
38
- */
39
- switchSelect(pageId: string, index: number): void
40
-
41
- /**
42
- * 隐藏TabBar
43
- */
44
- hideTabBar(op: Map<string, any | null>): void
45
-
46
- /**
47
- * 显示tabBar
48
- */
49
- showTabBar(op: Map<string, any | null>): void
50
-
51
- /**
52
- * 为 tabBar 某一项的右上角添加文本
53
- */
54
- setTabBarBadge(op: Map<string, any | null>): void
55
-
56
- /**
57
- * 移除 tabBar 某一项右上角的文本
58
- */
59
- removeTabBarBadge(op: Map<string, any | null>): void
60
-
61
- /**
62
- * 显示 tabBar 某一项的右上角的红点
63
- */
64
- showTabBarRedDot(op: Map<string, any | null>): void
65
-
66
- /**
67
- * 隐藏 tabBar 某一项的右上角的红点
68
- */
69
- hideTabBarRedDot(op: Map<string, any | null>): void
70
-
71
- /**
72
- * 动态设置 tabBar 的整体样式
73
- */
74
- setTabBarStyle(op: Map<string, any | null>): void
75
-
76
- /**
77
- * 动态设置 tabBar 某一项的内容
78
- */
79
- setTabBarItem(op: Map<string, any | null>): void
80
- /**
81
- * 只读属性 tabBar是否隐藏
82
- */
83
- isTabBarVisible: boolean
84
- /**
85
- * 只读属性 当前显示itemId
86
- */
87
- currentItemId: string | null
88
27
  }
89
28
 
90
- export type ITabsNode = UniTabsElement
29
+
@@ -1,19 +1,11 @@
1
- import { UniElement } from "./UniElement"
2
-
3
- export interface TextElement {
4
- /**
5
- * 只读属性 text元素的文案内容
6
- */
7
- value: string
8
- getTextExtra(): any | null
9
- }
10
-
1
+ import { UniElementImpl } from "./UniElement"
2
+ import { UniTextElement } from "./IUniElement"
11
3
  /**
12
4
  * text元素对象
13
5
  * @package io.dcloud.uniapp.runtime
14
6
  * @autodoc false
15
7
  */
16
- export class UniTextElement extends UniElement implements TextElement {
8
+ export class UniTextElementImpl extends UniElementImpl implements UniTextElement {
17
9
  /**
18
10
  * 只读属性 text元素的文案内容
19
11
  */
@@ -1,11 +1,11 @@
1
- import { Element } from "./Element"
1
+ import { UniElement } from "./IUniElement"
2
2
 
3
3
  /**
4
4
  * video元素对象
5
5
  * @package io.dcloud.uniapp.runtime
6
6
  * @autodoc false
7
7
  */
8
- export interface UniVideoElement extends Element {
8
+ export interface UniVideoElement extends UniElement {
9
9
  /**
10
10
  * 播放
11
11
  */
@@ -1,31 +1,10 @@
1
- import { UniElement } from "./UniElement"
1
+ import { UniWebViewElement } from "./IUniElement"
2
+ import { UniElementImpl } from "./UniElement"
2
3
 
3
- /**
4
- * web-view元素对象
5
- * @package io.dcloud.uniapp.runtime
6
- * @autodoc false
7
- */
8
- export interface UniWebViewElement extends UniElement {
9
- /**
10
- * 后退
11
- */
4
+ export class UniWebViewElementImpl extends UniElementImpl implements UniWebViewElement {
12
5
  back(): void
13
- /**
14
- * 前进
15
- */
16
6
  forward(): void
17
- /**
18
- * 重新加载
19
- */
20
7
  reload(): void
21
- /**
22
- * 停止加载
23
- */
24
8
  stop(): void
25
- /**
26
- * 原生和WebView通信(执行JS脚本)
27
- */
28
9
  evalJS(js: string): void
29
10
  }
30
-
31
- export type IWebViewNode = UniWebViewElement