@dcloudio/uni-app-x 0.5.0 → 0.5.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 +39 -0
- package/package.json +5 -3
- package/types/app.d.ts +26 -72
- package/types/native/CSSStyleDeclaration.d.ts +2 -2
- package/types/native/DOMRect.d.ts +4 -4
- package/types/native/DomNode.d.ts +48 -0
- package/types/native/DrawableContext.d.ts +42 -16
- package/types/native/Element.d.ts +234 -0
- package/types/native/Event.d.ts +14 -3
- package/types/native/IDocument.d.ts +6 -6
- package/types/native/IPage.d.ts +27 -11
- package/types/native/IPageManager.d.ts +2 -2
- package/types/native/ITabsNode.d.ts +4 -4
- package/types/native/IUniError.d.ts +20 -0
- package/types/native/IWebViewNode.d.ts +2 -2
- package/types/native/InputBlurEvent.d.ts +13 -0
- package/types/native/InputConfirmEvent.d.ts +13 -0
- package/types/native/InputEvent.d.ts +21 -0
- package/types/native/InputFocusEvent.d.ts +17 -0
- package/types/native/InputKeyboardHeightChangeEvent.d.ts +17 -0
- package/types/native/MouseEvent.d.ts +13 -1
- package/types/native/NestedPreScrollEvent.d.ts +23 -0
- package/types/native/ScrollToLowerEvent.d.ts +4 -1
- package/types/native/ScrollToUpperEvent.d.ts +5 -2
- package/types/native/StartNestedScrollEvent.d.ts +12 -0
- package/types/native/SwiperAnimationFinishEvent.d.ts +11 -0
- package/types/native/SwiperChangeEvent.d.ts +11 -0
- package/types/native/SwiperTransitionEvent.d.ts +11 -0
- package/types/native/TextareaBlurEvent.d.ts +17 -0
- package/types/native/TextareaFocusEvent.d.ts +17 -0
- package/types/native/TextareaLineChangeEvent.d.ts +21 -0
- package/types/native/UniError.d.ts +7 -2
- package/types/native/index.d.ts +18 -1
- package/types/page.d.ts +38 -193
- package/types/uni/core/index.d.ts +9 -8
- package/types/uni/core/lib/base/event/interface.d.ts +4 -4
- package/types/uni/core/lib/lifecycle/interface.d.ts +1 -1
- package/types/uni/core/lib/route/index.d.ts +0 -10
- package/types/uni/core/lib/route/interface.d.ts +1805 -10
- package/types/uni/core/lib/ui/create-selector-query/interface.d.ts +242 -2
- package/types/uni/core/lib/ui/get-element-by-id/index.d.ts +9 -0
- package/types/uni/core/lib/ui/get-element-by-id/interface.d.ts +72 -0
- package/types/uni/core/lib/ui/load-font-face/interface.d.ts +486 -3
- package/types/uni/core/lib/ui/page-scroll-to/index.d.ts +0 -2
- package/types/uni/core/lib/ui/page-scroll-to/interface.d.ts +93 -9
- package/types/uni/core/lib/ui/pull-down-refresh/index.d.ts +0 -2
- package/types/uni/core/lib/ui/pull-down-refresh/interface.d.ts +2 -5
- package/types/uni/core/lib/ui/set-navigation-bar-color/interface.d.ts +373 -4
- package/types/uni/core/lib/ui/tab-bar/index.d.ts +2 -18
- package/types/uni/core/lib/ui/tab-bar/interface.d.ts +32 -35
- package/types/uni/index.d.ts +2 -1
- package/types/uni/{ext → uts-plugin-api}/index.d.ts +18 -17
- package/types/uni/{ext → uts-plugin-api}/lib/uni-audio/utssdk/interface.d.ts +2 -2
- package/types/uni/{ext → uts-plugin-api}/lib/uni-createWebviewContext/utssdk/interface.d.ts +9 -9
- package/types/uni/{ext → uts-plugin-api}/lib/uni-exit/utssdk/interface.d.ts +1 -1
- package/types/uni/{ext → uts-plugin-api}/lib/uni-file-manager/utssdk/interface.d.ts +2 -2
- package/types/uni/{ext → uts-plugin-api}/lib/uni-getAccessibilityInfo/utssdk/interface.d.ts +1 -1
- package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppAuthorizeSetting/utssdk/interface.d.ts +108 -10
- package/types/uni/uts-plugin-api/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +233 -0
- package/types/uni/{ext → uts-plugin-api}/lib/uni-getDeviceInfo/utssdk/interface.d.ts +58 -46
- package/types/uni/{ext → uts-plugin-api}/lib/uni-getLocation-system/utssdk/interface.d.ts +13 -1
- package/types/uni/{ext → uts-plugin-api}/lib/uni-getNetworkType/utssdk/interface.d.ts +8 -5
- package/types/uni/uts-plugin-api/lib/uni-getRecorderManager/utssdk/interface.d.ts +213 -0
- package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemInfo/utssdk/interface.d.ts +108 -36
- package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemSetting/utssdk/interface.d.ts +3 -3
- package/types/uni/uts-plugin-api/lib/uni-media/utssdk/interface.d.ts +794 -0
- package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/app-ios/interface.d.ts +60 -19
- package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/index.d.ts +4 -0
- package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/interface.d.ts +138 -49
- package/types/uni/{ext → uts-plugin-api}/lib/uni-openAppAuthorizeSetting/utssdk/interface.d.ts +8 -5
- package/types/uni/{ext → uts-plugin-api}/lib/uni-prompt/utssdk/interface.d.ts +6 -6
- package/types/uni/{ext → uts-plugin-api}/lib/uni-storage/utssdk/interface.d.ts +27 -27
- package/types/uni/{ext → uts-plugin-api}/lib/uni-websocket/utssdk/index.d.ts +2 -0
- package/types/uni/{ext → uts-plugin-api}/lib/uni-websocket/utssdk/interface.d.ts +60 -35
- package/types/uni/uts-plugin-component/index.d.ts +1 -0
- package/types/uni/uts-plugin-component/lib/uni-video/utssdk/index.d.ts +15 -0
- package/types/uni/uts-plugin-component/lib/uni-video/utssdk/interface.d.ts +171 -0
- package/types/uni-cloud/index.d.ts +59 -330
- package/types/uni-cloud/interface.d.ts +786 -0
- package/types/vue/CheckboxGroupChangeEvent.d.ts +1 -1
- package/types/vue/PickerViewChangeEvent.d.ts +1 -1
- package/types/vue/ProgressActiveendEvent.d.ts +1 -1
- package/types/vue/RadioGroupChangeEvent.d.ts +1 -1
- package/types/vue/SliderChangeEvent.d.ts +10 -1
- package/types/vue/SwitchChangeEvent.d.ts +1 -1
- package/uts-plugin.d.ts +10 -0
- package/types/native/INode.d.ts +0 -181
- package/types/uni/ext/lib/uni-file-manager/utssdk/index.d.ts +0 -31
- package/types/uni/ext/lib/uni-getAppBaseInfo/utssdk/interface.d.ts +0 -120
- package/types/uni/ext/lib/uni-getRecorderManager/utssdk/interface.d.ts +0 -213
- package/types/uni/ext/lib/uni-media/utssdk/interface.d.ts +0 -795
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-audio/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-createWebviewContext/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-exit/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAccessibilityInfo/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppAuthorizeSetting/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getAppBaseInfo/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getDeviceInfo/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getLocation-system/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getNetworkType/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getRecorderManager/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemInfo/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-getSystemSetting/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-media/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-network/utssdk/app-ios/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-openAppAuthorizeSetting/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-prompt/utssdk/index.d.ts +0 -0
- /package/types/uni/{ext → uts-plugin-api}/lib/uni-storage/utssdk/index.d.ts +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "uni-app x types",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"author": "DCloud",
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build:types:core": "node ./scripts/build-types.js -t core",
|
|
11
|
-
"build:types:
|
|
11
|
+
"build:types:plugin:api": "node ./scripts/build-types.js -t uts-plugin-api",
|
|
12
|
+
"build:types:plugin:component": "node ./scripts/build-types.js -t uts-plugin-component",
|
|
13
|
+
"build:types:plugin": "npm run build:types:plugin:api && npm run build:types:plugin:component",
|
|
12
14
|
"build:types:meta": "node ./scripts/build-meta.js",
|
|
13
|
-
"build:types": "npm run build:types:core && npm run build:types:
|
|
15
|
+
"build:types": "npm run build:types:core && npm run build:types:plugin"
|
|
14
16
|
},
|
|
15
17
|
"devDependencies": {
|
|
16
18
|
"delete": "^1.1.0",
|
package/types/app.d.ts
CHANGED
|
@@ -19,15 +19,15 @@ interface ReferrerInfo {
|
|
|
19
19
|
extraData?: any;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface
|
|
22
|
+
interface OnLaunchOptions {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* 应用启动页面路径
|
|
25
25
|
*/
|
|
26
26
|
path: string;
|
|
27
27
|
/**
|
|
28
28
|
* 打开小程序的query
|
|
29
29
|
*/
|
|
30
|
-
query: AnyObject;
|
|
30
|
+
// query: AnyObject;
|
|
31
31
|
/**
|
|
32
32
|
* 打开小程序的场景值
|
|
33
33
|
* - 1001: 发现栏小程序主入口,「最近使用」列表(基础库2.2.4版本起包含「我的小程序」列表)
|
|
@@ -100,15 +100,22 @@ interface LaunchShowOption {
|
|
|
100
100
|
* - 1103: 发现栏小程序主入口,「我的小程序」列表(基础库2.2.4版本起废弃)
|
|
101
101
|
* - 1104: 微信聊天主界面下拉,「我的小程序」栏(基础库2.2.4版本起废弃)
|
|
102
102
|
*/
|
|
103
|
-
scene: number;
|
|
103
|
+
// scene: number;
|
|
104
104
|
/**
|
|
105
105
|
* 打开小程序的场景值
|
|
106
106
|
*/
|
|
107
|
-
shareTicket: string;
|
|
107
|
+
// shareTicket: string;
|
|
108
108
|
/**
|
|
109
109
|
* 当场景为由从另一个小程序或公众号或App打开时,返回此字段
|
|
110
110
|
*/
|
|
111
|
-
referrerInfo?: ReferrerInfo;
|
|
111
|
+
// referrerInfo?: ReferrerInfo;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface OnShowOptions {
|
|
115
|
+
/**
|
|
116
|
+
* 应用启动页面路径
|
|
117
|
+
*/
|
|
118
|
+
path: string
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
interface PageNotFoundOption {
|
|
@@ -183,17 +190,8 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
183
190
|
* "hostVer": "√",
|
|
184
191
|
* "uniVer": "√",
|
|
185
192
|
* "unixVer": "x"
|
|
186
|
-
* },
|
|
187
|
-
* "360": {
|
|
188
|
-
* "hostVer": "√",
|
|
189
|
-
* "uniVer": "√",
|
|
190
|
-
* "unixVer": "x"
|
|
191
193
|
* }
|
|
192
194
|
* },
|
|
193
|
-
* "quickapp": {
|
|
194
|
-
* "uniVer": "√",
|
|
195
|
-
* "unixVer": "x"
|
|
196
|
-
* },
|
|
197
195
|
* "web": {
|
|
198
196
|
* "uniVer": "√",
|
|
199
197
|
* "unixVer": "x"
|
|
@@ -260,24 +258,15 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
260
258
|
* "hostVer": "√",
|
|
261
259
|
* "uniVer": "√",
|
|
262
260
|
* "unixVer": "x"
|
|
263
|
-
* },
|
|
264
|
-
* "360": {
|
|
265
|
-
* "hostVer": "√",
|
|
266
|
-
* "uniVer": "√",
|
|
267
|
-
* "unixVer": "x"
|
|
268
261
|
* }
|
|
269
262
|
* },
|
|
270
|
-
* "quickapp": {
|
|
271
|
-
* "uniVer": "√",
|
|
272
|
-
* "unixVer": "x"
|
|
273
|
-
* },
|
|
274
263
|
* "web": {
|
|
275
264
|
* "uniVer": "√",
|
|
276
265
|
* "unixVer": "x"
|
|
277
266
|
* }
|
|
278
267
|
*}
|
|
279
268
|
*/
|
|
280
|
-
onLaunch?(options?:
|
|
269
|
+
onLaunch?(options?: OnLaunchOptions): void;
|
|
281
270
|
/**
|
|
282
271
|
* 生命周期回调 监听应用显示
|
|
283
272
|
*
|
|
@@ -337,24 +326,15 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
337
326
|
* "hostVer": "√",
|
|
338
327
|
* "uniVer": "√",
|
|
339
328
|
* "unixVer": "x"
|
|
340
|
-
* },
|
|
341
|
-
* "360": {
|
|
342
|
-
* "hostVer": "√",
|
|
343
|
-
* "uniVer": "√",
|
|
344
|
-
* "unixVer": "x"
|
|
345
329
|
* }
|
|
346
330
|
* },
|
|
347
|
-
* "quickapp": {
|
|
348
|
-
* "uniVer": "√",
|
|
349
|
-
* "unixVer": "x"
|
|
350
|
-
* },
|
|
351
331
|
* "web": {
|
|
352
332
|
* "uniVer": "√",
|
|
353
333
|
* "unixVer": "x"
|
|
354
334
|
* }
|
|
355
335
|
*}
|
|
356
336
|
*/
|
|
357
|
-
onShow?(options?:
|
|
337
|
+
onShow?(options?: OnShowOptions): void;
|
|
358
338
|
/**
|
|
359
339
|
* 生命周期回调 监听应用隐藏
|
|
360
340
|
*
|
|
@@ -414,17 +394,8 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
414
394
|
* "hostVer": "√",
|
|
415
395
|
* "uniVer": "√",
|
|
416
396
|
* "unixVer": "x"
|
|
417
|
-
* },
|
|
418
|
-
* "360": {
|
|
419
|
-
* "hostVer": "√",
|
|
420
|
-
* "uniVer": "√",
|
|
421
|
-
* "unixVer": "x"
|
|
422
397
|
* }
|
|
423
398
|
* },
|
|
424
|
-
* "quickapp": {
|
|
425
|
-
* "uniVer": "√",
|
|
426
|
-
* "unixVer": "x"
|
|
427
|
-
* },
|
|
428
399
|
* "web": {
|
|
429
400
|
* "uniVer": "√",
|
|
430
401
|
* "unixVer": "x"
|
|
@@ -491,17 +462,8 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
491
462
|
* "hostVer": "√",
|
|
492
463
|
* "uniVer": "√",
|
|
493
464
|
* "unixVer": "x"
|
|
494
|
-
* },
|
|
495
|
-
* "360": {
|
|
496
|
-
* "hostVer": "√",
|
|
497
|
-
* "uniVer": "√",
|
|
498
|
-
* "unixVer": "x"
|
|
499
465
|
* }
|
|
500
466
|
* },
|
|
501
|
-
* "quickapp": {
|
|
502
|
-
* "uniVer": "√",
|
|
503
|
-
* "unixVer": "x"
|
|
504
|
-
* },
|
|
505
467
|
* "web": {
|
|
506
468
|
* "uniVer": "√",
|
|
507
469
|
* "unixVer": "x"
|
|
@@ -572,17 +534,8 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
572
534
|
* "hostVer": "√",
|
|
573
535
|
* "uniVer": "√",
|
|
574
536
|
* "unixVer": "x"
|
|
575
|
-
* },
|
|
576
|
-
* "360": {
|
|
577
|
-
* "hostVer": "√",
|
|
578
|
-
* "uniVer": "√",
|
|
579
|
-
* "unixVer": "x"
|
|
580
537
|
* }
|
|
581
538
|
* },
|
|
582
|
-
* "quickapp": {
|
|
583
|
-
* "uniVer": "√",
|
|
584
|
-
* "unixVer": "x"
|
|
585
|
-
* },
|
|
586
539
|
* "web": {
|
|
587
540
|
* "uniVer": "√",
|
|
588
541
|
* "unixVer": "x"
|
|
@@ -664,7 +617,9 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
664
617
|
* }
|
|
665
618
|
*}
|
|
666
619
|
*/
|
|
667
|
-
|
|
620
|
+
|
|
621
|
+
// onUnhandledRejection?(options: UniNamespace.OnUnhandledRejectionCallbackResult): void;
|
|
622
|
+
|
|
668
623
|
/**
|
|
669
624
|
* 监听系统主题变化
|
|
670
625
|
*
|
|
@@ -739,7 +694,9 @@ interface AppInstance<T extends AnyObject = {}> {
|
|
|
739
694
|
* }
|
|
740
695
|
*}
|
|
741
696
|
*/
|
|
742
|
-
|
|
697
|
+
|
|
698
|
+
// onThemeChange?(options: UniNamespace.OnThemeChangeCallbackResult): void;
|
|
699
|
+
|
|
743
700
|
/**
|
|
744
701
|
* 监听 nvue 页面消息
|
|
745
702
|
*
|
|
@@ -973,14 +930,11 @@ type AppConstructor = <T extends AnyObject & AppInstance>(
|
|
|
973
930
|
options: AppInstance<T> & T,
|
|
974
931
|
) => void;
|
|
975
932
|
|
|
976
|
-
interface GetAppOption {
|
|
977
|
-
/**
|
|
978
|
-
* 在 `App` 未定义时返回默认实现。当App被调用时,默认实现中定义的属性会被覆盖合并到App中。一般用于独立分包
|
|
979
|
-
*/
|
|
980
|
-
allowDefault: boolean;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
type GetApp = <T extends AnyObject>(opts?: GetAppOption) => AppInstance<T> & T;
|
|
984
933
|
|
|
934
|
+
/**
|
|
935
|
+
* `getApp()` 函数用于获取当前应用实例。
|
|
936
|
+
* @tutorial https://uniapp.dcloud.net.cn/uni-app-x/api/getapp.html#getapp
|
|
937
|
+
*/
|
|
938
|
+
type GetApp = <T extends AnyObject>() => AppInstance<T> & T;
|
|
985
939
|
|
|
986
940
|
declare const getApp: GetApp;
|
|
@@ -9,12 +9,12 @@ declare class CSSStyleDeclaration {
|
|
|
9
9
|
* @param name CSS样式名称
|
|
10
10
|
* @param value 要设置的新CSS样式值
|
|
11
11
|
*/
|
|
12
|
-
setProperty(name: string, value: any|null): void
|
|
12
|
+
setProperty(name: string|HBuilderX.cssPropertyString, value: any|null): void
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* 获取CSS指定的样式值,如果指定的样式不存在则返回null。
|
|
16
16
|
* @param property 要获取的CSS样式名称
|
|
17
17
|
*/
|
|
18
|
-
getPropertyValue(property: string): any|null
|
|
18
|
+
getPropertyValue(property: string|HBuilderX.cssPropertyString): any|null
|
|
19
19
|
|
|
20
20
|
}
|
|
@@ -6,10 +6,10 @@ declare class DOMRect {
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 创建一个新的 DOMRect 对象
|
|
9
|
-
* @param x 矩形原点的x坐标
|
|
10
|
-
* @param y 矩形原点的y坐标
|
|
11
|
-
* @param width 矩形的宽
|
|
12
|
-
* @param height 矩形的高
|
|
9
|
+
* @param {number} [x=0] 矩形原点的x坐标
|
|
10
|
+
* @param {number} [y=0] 矩形原点的y坐标
|
|
11
|
+
* @param {number} [width=0] 矩形的宽
|
|
12
|
+
* @param {number} [height=0] 矩形的高
|
|
13
13
|
*/
|
|
14
14
|
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
15
15
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference path="./Element.d.ts" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @package io.dcloud.uniapp.runtime
|
|
5
|
+
*/
|
|
6
|
+
declare class DomNode implements Element {
|
|
7
|
+
firstChild: Element | null
|
|
8
|
+
lastChild: Element | null
|
|
9
|
+
parentNode: Element | null
|
|
10
|
+
parentElement: Element | null
|
|
11
|
+
previousSibling: Element | null
|
|
12
|
+
nextSibling: Element | null
|
|
13
|
+
nextElementSibling: Element | null
|
|
14
|
+
children: Element[]
|
|
15
|
+
tagName: string
|
|
16
|
+
nodeName: string
|
|
17
|
+
ext: Map<string, any>
|
|
18
|
+
dataset: Map<string, any | null>
|
|
19
|
+
attributes: Map<string, any | null>
|
|
20
|
+
style: CSSStyleDeclaration
|
|
21
|
+
scrollWidth: number
|
|
22
|
+
scrollHeight: number
|
|
23
|
+
scrollLeft: number
|
|
24
|
+
scrollTop: number
|
|
25
|
+
offsetLeft: number
|
|
26
|
+
offsetTop: number
|
|
27
|
+
offsetWidth: number
|
|
28
|
+
offsetHeight: number
|
|
29
|
+
getNodeId(): string
|
|
30
|
+
appendChild(aChild: Element): void
|
|
31
|
+
insertBefore(newChild: Element, refChild: Element): void
|
|
32
|
+
setAttribute(key: string, value: any | null): void
|
|
33
|
+
getAttribute(key: string): any | null
|
|
34
|
+
hasAttribute(key: string): boolean
|
|
35
|
+
removeAttribute(key: string): void
|
|
36
|
+
updateStyle(map: Map<string, any>): void
|
|
37
|
+
getBoundingClientRect(): DOMRect
|
|
38
|
+
getDrawableContext(): DrawableContext | null
|
|
39
|
+
addEventListener<T extends Event, R>(type: string, callback: (event: T) => R): void
|
|
40
|
+
removeEventListener(type: string): void
|
|
41
|
+
removeChild(aChild: Element): Element
|
|
42
|
+
remove(): void
|
|
43
|
+
dispatchEvent(type: string, value: Event): void
|
|
44
|
+
scrollTo(x: number, y: number): void
|
|
45
|
+
scrollBy(x: number, y: number): void
|
|
46
|
+
focus(): void
|
|
47
|
+
blur(): void
|
|
48
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
/// <reference path='./INode.d.ts' />
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* @package io.dcloud.uniapp.runtime
|
|
5
3
|
*/
|
|
6
4
|
|
|
7
5
|
declare class DrawableContext {
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
7
|
+
* 设置字体大小
|
|
8
|
+
* @defaultValue 10px
|
|
10
9
|
*/
|
|
11
10
|
font : string
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
12
|
+
* 设置填充颜色
|
|
13
|
+
* @defaultValue #000 (黑色)
|
|
14
14
|
*/
|
|
15
15
|
fillStyle : string
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 指定如何绘制每一条线条末端的属性,可选值:`butt`线段末端以方形结束;`round`线段末端以圆形结束;`square`线段末端以方形结束,但是会增加一个一半宽度的矩形区域。
|
|
18
|
+
* @defaultValue butt
|
|
18
19
|
*/
|
|
19
20
|
lineCap : string
|
|
20
21
|
/**
|
|
@@ -22,19 +23,23 @@ declare class DrawableContext {
|
|
|
22
23
|
*/
|
|
23
24
|
lineDashOffset : number
|
|
24
25
|
/**
|
|
25
|
-
* 设置 2 个长度不为 0
|
|
26
|
+
* 设置 2 个长度不为 0 的线条相连部分如何连接在一起的属性,可选值:`bevel`斜角;`round`圆角;`miter`尖角。
|
|
27
|
+
* @defaultValue miter
|
|
26
28
|
*/
|
|
27
29
|
lineJoin : string
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
31
|
+
* 设置线条的宽度
|
|
32
|
+
* @defaultValue 1px
|
|
30
33
|
*/
|
|
31
34
|
lineWidth : number
|
|
32
35
|
/**
|
|
33
|
-
*
|
|
36
|
+
* 设置边框的颜色
|
|
37
|
+
* @defaultValue #000 (黑色)
|
|
34
38
|
*/
|
|
35
39
|
strokeStyle : string
|
|
36
40
|
/**
|
|
37
|
-
*
|
|
41
|
+
* 设置文本的对齐方式,可取值:`left`左对齐;`center`居中对齐;`right`右对齐。
|
|
42
|
+
* @defaultValue left
|
|
38
43
|
*/
|
|
39
44
|
textAlign : string
|
|
40
45
|
/**
|
|
@@ -49,9 +54,9 @@ declare class DrawableContext {
|
|
|
49
54
|
* @param {number} radius 圆弧的半径
|
|
50
55
|
* @param {number} startAngle 圆弧的起始点,x 轴方向开始计算,单位为弧度
|
|
51
56
|
* @param {number} endAngle 圆弧的终点,单位为弧度
|
|
52
|
-
* @param {number} anticlockwise 圆弧绘制方向,true:逆时针绘制,false
|
|
57
|
+
* @param {number} [anticlockwise=true] 圆弧绘制方向,true:逆时针绘制,false:顺时针绘制。
|
|
53
58
|
*/
|
|
54
|
-
arc(x : number, y : number, radius : number, startAngle : number, endAngle : number, anticlockwise ?: boolean) : void
|
|
59
|
+
arc(x : number, y : number, radius : number, startAngle : number, endAngle : number, anticlockwise ?: boolean | null) : void
|
|
55
60
|
|
|
56
61
|
/**
|
|
57
62
|
* 将一个新的路径的起始点移动到 (x,y) 坐标
|
|
@@ -59,7 +64,7 @@ declare class DrawableContext {
|
|
|
59
64
|
* @param {number} y 点的Y轴坐标
|
|
60
65
|
*/
|
|
61
66
|
moveTo(x : number, y : number) : void
|
|
62
|
-
|
|
67
|
+
|
|
63
68
|
/**
|
|
64
69
|
* 创建一个矩形路径
|
|
65
70
|
* @param {number} x 矩形起点的X轴坐标
|
|
@@ -101,10 +106,10 @@ declare class DrawableContext {
|
|
|
101
106
|
|
|
102
107
|
/**
|
|
103
108
|
* 填充当前或已存在的路径
|
|
104
|
-
* @param {string} fillRule
|
|
109
|
+
* @param {string} [fillRule=nonzero] 填充规则。可取值:`nonzero`非零环绕规则;`evenodd`奇偶环绕规则。
|
|
105
110
|
*/
|
|
106
|
-
fill(fillRule ?: string) : void
|
|
107
|
-
|
|
111
|
+
fill(fillRule ?: string | null) : void
|
|
112
|
+
|
|
108
113
|
/**
|
|
109
114
|
* 绘制一个实心矩形
|
|
110
115
|
* @param {number} x 矩形起点的X轴坐标
|
|
@@ -113,7 +118,7 @@ declare class DrawableContext {
|
|
|
113
118
|
* @param {number} height 矩形高度
|
|
114
119
|
*/
|
|
115
120
|
fillRect(x : number, y : number, width : number, height : number) : void
|
|
116
|
-
|
|
121
|
+
|
|
117
122
|
/**
|
|
118
123
|
* 绘制实心字符
|
|
119
124
|
* @param {string} text 要绘制的字符
|
|
@@ -134,4 +139,25 @@ declare class DrawableContext {
|
|
|
134
139
|
* @param {Array<number>} segments 一组描述交替绘制线段和间距长度的数字。
|
|
135
140
|
*/
|
|
136
141
|
setLineDash(segments : Array<number>) : void
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 根据控制点和半径绘制圆弧路径
|
|
145
|
+
* @param {number} x1 第一个控制点的 x 轴坐标
|
|
146
|
+
* @param {number} y1 第一个控制点的 y 轴坐标
|
|
147
|
+
* @param {number} x2 第二个控制点的 x 轴坐标
|
|
148
|
+
* @param {number} y2 第二个控制点的 y 轴坐标
|
|
149
|
+
* @param {number} radius 圆弧的半径
|
|
150
|
+
*/
|
|
151
|
+
// arcTo(x1 : number, y1 : number, x2 : number, y2 : number, radius : number) : void
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 创建三次方贝塞尔曲线路径
|
|
155
|
+
* @param {number} cp1x 第一个贝塞尔控制点的 x 坐标
|
|
156
|
+
* @param {number} cp1y 第一个贝塞尔控制点的 y 坐标
|
|
157
|
+
* @param {number} cp2x 第二个贝塞尔控制点的 x 坐标
|
|
158
|
+
* @param {number} cp2y 第二个贝塞尔控制点的 y 坐标
|
|
159
|
+
* @param {number} x 结束点的 x 坐标
|
|
160
|
+
* @param {number} y 结束点的 y 坐标
|
|
161
|
+
*/
|
|
162
|
+
bezierCurveTo(cp1x : number, cp1y : number, cp2x : number, cp2y : number, x : number, y : number) : void
|
|
137
163
|
}
|