deeke-script-app 1.0.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 (36) hide show
  1. package/.vscode/settings.json +9 -0
  2. package/@deekeScript/@type/Class/Rect.d.ts +14 -0
  3. package/@deekeScript/@type/Class/UiSelector.d.ts +192 -0
  4. package/@deekeScript/@type/README.md +19 -0
  5. package/@deekeScript/@type/interface/App.d.ts +93 -0
  6. package/@deekeScript/@type/interface/Console.d.ts +46 -0
  7. package/@deekeScript/@type/interface/DeekeScript.d.ts +9 -0
  8. package/@deekeScript/@type/interface/Device.d.ts +78 -0
  9. package/@deekeScript/@type/interface/Dialogs.d.ts +41 -0
  10. package/@deekeScript/@type/interface/Encrypt.d.ts +58 -0
  11. package/@deekeScript/@type/interface/Engines.d.ts +24 -0
  12. package/@deekeScript/@type/interface/FloatDialogs.d.ts +20 -0
  13. package/@deekeScript/@type/interface/Gesture.d.ts +54 -0
  14. package/@deekeScript/@type/interface/Http.d.ts +41 -0
  15. package/@deekeScript/@type/interface/Intent.d.ts +12 -0
  16. package/@deekeScript/@type/interface/Storage.d.ts +109 -0
  17. package/@deekeScript/@type/interface/System.d.ts +102 -0
  18. package/@deekeScript/@type/interface/UiObject.d.ts +223 -0
  19. package/README.md +35 -0
  20. package/deekeScript.json +2089 -0
  21. package/images/a.png +0 -0
  22. package/package.json +42 -0
  23. package/script/index.js +44 -0
  24. package/script/index.js.map +1 -0
  25. package/script/task/task.js +88 -0
  26. package/script/task/task.js.map +1 -0
  27. package/script/task/test.js +57 -0
  28. package/script/task/test.js.map +1 -0
  29. package/src/deekeScriptZipBuild +47 -0
  30. package/src/index.ts +1 -0
  31. package/src/task/code.js +4 -0
  32. package/src/task/task.ts +16 -0
  33. package/src/task/test.ts +14 -0
  34. package/test.js +169 -0
  35. package/tsconfig.json +107 -0
  36. package/webpack.config.js +56 -0
@@ -0,0 +1,9 @@
1
+ {
2
+ "cSpell.words": [
3
+ "jiangqiao"
4
+ ],
5
+ "files.exclude": {
6
+ "**/node_modules": true, // 隐藏 node_modules 文件夹
7
+ "**/@deekeScript": true, // 隐藏 DeekeScript文件夹
8
+ }
9
+ }
@@ -0,0 +1,14 @@
1
+ declare global {
2
+ class Rect {
3
+ left: number;
4
+ top: number;
5
+ right: number;
6
+ bottom: number;
7
+
8
+ constructor(left: number, top: number, right: number, bottom: number);
9
+ public height(): number;
10
+ public width(): number;
11
+ }
12
+ }
13
+
14
+ export { };
@@ -0,0 +1,192 @@
1
+ import { UiObject } from "../interface/UiObject";
2
+
3
+ declare global {
4
+ function UiSelector(): UiSelector;
5
+ /**
6
+ * 控件选择器
7
+ */
8
+ class UiSelector {
9
+ //public setLevel(level: number): UiSelector; //这个方法待完善
10
+ //public getLevel(): number;//这个方法待完善
11
+ public UiSelector(): void;//使用new UiSelector() 或者 UiSelector() 都可以实例化选择器
12
+
13
+ /**
14
+ *
15
+ * @param text 控件文本
16
+ */
17
+ public text(text: string): UiSelector;
18
+
19
+ /**
20
+ *
21
+ * @param text 模糊匹配文本控件
22
+ */
23
+ public textContains(text: string): UiSelector;
24
+
25
+ /**
26
+ *
27
+ * @param text 正则匹配文本控件
28
+ */
29
+ public textMatches(text: string): UiSelector;
30
+
31
+ //public textStartsWith(text: string): UiSelector;
32
+ //public textEndsWith(text: string): UiSelector;
33
+
34
+ /**
35
+ *
36
+ * @param desc 控件描述内容
37
+ */
38
+ public desc(desc: string): UiSelector;
39
+
40
+ /**
41
+ *
42
+ * @param desc 模糊匹配描述控件
43
+ */
44
+ public descContains(desc: string): UiSelector;
45
+
46
+ /**
47
+ *
48
+ * @param desc 正则表达式匹配描述控件
49
+ */
50
+ public descMatches(desc: string): UiSelector;
51
+ //public descStartsWith(desc: string): UiSelector;
52
+ //public descEndsWith(desc: string): UiSelector;
53
+
54
+ /**
55
+ *
56
+ * @param className 控件类名
57
+ */
58
+ public className(className: string): UiSelector;
59
+ //public classNameMatches(className: string): UiSelector;
60
+
61
+ // public packageName(packageName: string): UiSelector;
62
+ //public packageNameMatches(packageName: string): UiSelector;
63
+
64
+ /**
65
+ *
66
+ * @param id 控件ID
67
+ */
68
+ public id(id: string): UiSelector;
69
+
70
+ /**
71
+ *
72
+ * @param left 左边距 整数
73
+ * @param top 上边距 整数
74
+ * @param right 右边距 整数
75
+ * @param bottom 下边距 整数
76
+ */
77
+ public bounds(left: Number, top: Number, right: Number, bottom: Number): UiSelector;
78
+
79
+ /**
80
+ *
81
+ * @param bool 是否可以点击
82
+ */
83
+ public clickable(bool: boolean): UiSelector;
84
+
85
+ /**
86
+ *
87
+ * @param bool 是否选中
88
+ */
89
+ public checked(bool: boolean): UiSelector;
90
+
91
+ /**
92
+ *
93
+ * @param bool 是否被选择
94
+ */
95
+ public selected(bool: boolean): UiSelector;
96
+
97
+ /**
98
+ *
99
+ * @param bool 是否可用,为false时,用户无法通过点击、输入等方式与该控件交互
100
+ */
101
+ public enabled(bool: boolean): UiSelector;
102
+
103
+ /**
104
+ *
105
+ * @param bool 是否已被勾选
106
+ */
107
+ public checked(bool: boolean): UiSelector;
108
+
109
+ /**
110
+ *
111
+ * @param bool 是否可以滚动
112
+ */
113
+ public scrollable(bool: boolean): UiSelector;
114
+
115
+ /**
116
+ *
117
+ * @param bool 是否可以勾选
118
+ */
119
+ public checkable(bool: boolean): UiSelector;
120
+
121
+ /**
122
+ *
123
+ * @param bool 是否可以聚焦
124
+ */
125
+ public focusable(bool: boolean): UiSelector;
126
+
127
+ /**
128
+ *
129
+ * @param bool 是否可见
130
+ */
131
+ public isVisibleToUser(bool: boolean): UiSelector;
132
+
133
+ /**
134
+ *
135
+ * @param filter 过滤控件,回调函数,返回true表示符合条件,返回false表示不符合条件
136
+ */
137
+ public filter(filter: (v: UiObject) => boolean): UiSelector;
138
+
139
+ /**
140
+ * 判断节点是否存在,底层使用的findOne方法
141
+ */
142
+ public exists(): boolean;
143
+
144
+ /**
145
+ *
146
+ * 等待节点出现,一直阻塞直到找到节点
147
+ */
148
+ public waitFindOne(): UiObject;
149
+
150
+ /**
151
+ * 查找所有符合条件的控件
152
+ */
153
+ public find(): UiObject[];
154
+
155
+ /**
156
+ * 在当前的所有控件对象中查找所有符合某个控件选择器的控件
157
+ * @param obj 控件选择器
158
+ */
159
+ public findBy(obj: UiSelector): UiObject[];
160
+
161
+ /**
162
+ * 查找某个控件选择器,在timeout时间内,如果找不到,则返回null;如果找到立马返回
163
+ * @param timeout 查找时间(毫秒数)
164
+ */
165
+ public findBy(timeout: Number): UiObject[];
166
+
167
+ /**
168
+ * 返回一个符合当前选择器条件的控件
169
+ */
170
+ public findOne(): UiObject;
171
+
172
+ /**
173
+ * 返回一个符合当前选择器条件的控件
174
+ */
175
+ public findOnce(): UiObject;
176
+
177
+ /**
178
+ * 返回一个符合当前控件选择的控件
179
+ * @param obj 控件选择器
180
+ */
181
+ public findOneBy(obj: UiSelector): UiObject;
182
+
183
+ /**
184
+ * 查找某个控件选择器,在timeout时间内,如果找不到,则返回null;如果找到立马返回
185
+ * @param timeout 查找时间(毫秒数)
186
+ */
187
+ public findOneBy(timeout: Number): UiObject;
188
+ }
189
+ }
190
+
191
+
192
+ export {};
@@ -0,0 +1,19 @@
1
+
2
+ ### 说明
3
+
4
+ - Global.d.ts主要放一些全局的函数或者常量
5
+ - class主要是存储一些对象
6
+
7
+ > 应该说,DeekeScript设计中,暴露给外部的api主要通过这两种形式存在。
8
+
9
+ ### 详细说明
10
+ #### 在class文件夹中的类全部是以下面的形式使用的:
11
+ ```
12
+ App.currentPackageName();
13
+ ```
14
+
15
+ #### 在Global.d.ts中,都是以下面的方式使用的:
16
+ ```
17
+ //方式1
18
+ let a = UiSelector();
19
+ ```
@@ -0,0 +1,93 @@
1
+ declare global {
2
+ var App: App;
3
+ }
4
+
5
+ interface App {
6
+ /**
7
+ * 获取当前包名
8
+ */
9
+ public currentPackageName(): string;
10
+
11
+ /**
12
+ * 获取当前版本号
13
+ */
14
+ public currentVersionCode(): number;
15
+
16
+ /**
17
+ * 获取当前版本名称
18
+ */
19
+ public currentVersionName(): string;
20
+
21
+ /**
22
+ * 获取包信息
23
+ */
24
+ public packageInfo(): any;//这里是返回的PackageInfo(Android对象)
25
+
26
+ /**
27
+ * 创建一个Intent对象
28
+ * @param i Intent对象
29
+ */
30
+ public intent(i: Intent): Intent;
31
+
32
+ /**
33
+ * 调整到某个Activity
34
+ * @param uri 跳转的uri
35
+ */
36
+ public gotoIntent(uri: string): void;
37
+
38
+ /**
39
+ * 启动Activity
40
+ * @param intent Intent对象
41
+ */
42
+ public startActivity(intent: Intent): void;
43
+
44
+ /**
45
+ * 返回到App
46
+ */
47
+ public backApp(): void;
48
+
49
+ /**
50
+ * 启动服务
51
+ * @param service Intent对象
52
+ */
53
+ public startService(service: Intent): any;//这里的参数和返回都是ComponentName(Android对象)
54
+
55
+ /**
56
+ * 发送广播
57
+ * @param intent Intent对象
58
+ */
59
+ public sendBroadcast(intent: Intent): void;
60
+
61
+ /**
62
+ * 通过包名,打开某个App
63
+ * @param packageName 包名
64
+ */
65
+ public launch(packageName: string): void;
66
+
67
+ /**
68
+ * 通知
69
+ * @param title 标题
70
+ * @param content 内容
71
+ */
72
+ public notifySuccess(title: string, content: string): void;
73
+
74
+ /**
75
+ * 通过包名,获取某个App的版本名称
76
+ * @param packageName 包名
77
+ */
78
+ public getAppVersionName(packageName: string): string;
79
+
80
+ /**
81
+ * 通过包名,获取某个App版本号
82
+ * @param packageName 包名
83
+ */
84
+ public getAppVersionCode(packageName: string): number;
85
+
86
+ /**
87
+ * 通过包名,进入某个App设置界面
88
+ * @param packageName 包名
89
+ */
90
+ public openAppSettings(packageName: string): void;
91
+ }
92
+
93
+ export { };
@@ -0,0 +1,46 @@
1
+ // TypeScript 类型定义文件,用于给 Rhino 的 console 函数提供代码提示
2
+
3
+ declare global {
4
+ // Rhino 中的 console 对象
5
+ var console: Console;
6
+ }
7
+
8
+ interface Console {
9
+ /**
10
+ * 记录普通日志信息
11
+ * @param message 要记录的消息
12
+ */
13
+ log(...message: any[]): void;
14
+
15
+ /**
16
+ * 记录警告信息
17
+ * @param message 要记录的警告消息
18
+ */
19
+ warn(...message: any[]): void;
20
+
21
+ /**
22
+ * 记录错误信息
23
+ * @param message 要记录的错误消息
24
+ */
25
+ error(...message: any[]): void;
26
+
27
+ /**
28
+ * 记录信息,通常用于调试目的
29
+ * @param message 要记录的信息
30
+ */
31
+ info(...message: any[]): void;
32
+
33
+ /**
34
+ * 记录调试信息
35
+ * @param message 要记录的调试信息
36
+ */
37
+ debug(...message: any[]): void;
38
+
39
+ /**
40
+ * 打印堆栈追踪
41
+ * @param message 堆栈追踪信息
42
+ */
43
+ trace(...message: any[]): void;
44
+ }
45
+
46
+ export { };
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ var DeekeScript: DeekeScript;
3
+ }
4
+
5
+ interface DeekeScript {
6
+ public version(): number;
7
+ }
8
+
9
+ export { }
@@ -0,0 +1,78 @@
1
+ declare global {
2
+ var Device: Device;
3
+ }
4
+
5
+ interface Device {
6
+ /**
7
+ * 保持屏幕常亮(需要在当前App界面)
8
+ * @param second 屏幕保持亮屏时间,单位秒
9
+ */
10
+ public keepScreenOn(second: number): void;
11
+
12
+ /**
13
+ * 关闭屏幕
14
+ */
15
+ public closeScreenLight(): void;
16
+
17
+ /**
18
+ * 获取屏幕宽度
19
+ */
20
+ public width(): number;
21
+
22
+ /**
23
+ * 获取屏幕高度
24
+ */
25
+ public height(): number;
26
+
27
+ /**
28
+ * 获取设备版本,如 26
29
+ */
30
+ public sdkInt(): number;
31
+
32
+ /**
33
+ * 获取设备
34
+ */
35
+ public device(): string;
36
+
37
+ /**
38
+ * 获取设备版本,如 "8.1.0"
39
+ */
40
+ public androidVersion(): string;
41
+
42
+ /**
43
+ * 生成设备唯一标识符, 卸载App前,可以通过getUuid获取,卸载后丢失
44
+ */
45
+ public createUuid(): string;
46
+
47
+ /**
48
+ * 获取设备唯一标识符
49
+ */
50
+ public getUuid(): string;
51
+
52
+ /**
53
+ * 判断屏幕是否亮着
54
+ */
55
+ public isScreenOn(): boolean;
56
+
57
+ /**
58
+ * 获取设备品牌, 如 "HUAWEI" 或 "Xiaomi"
59
+ */
60
+ public brand(): string;
61
+
62
+ /**
63
+ * 获取设备操作系统名称, 如 "Android"
64
+ */
65
+ public os(): string;
66
+
67
+ /**
68
+ * 获取设备型号名称, 如 "Honor V30" 或类似的字符串
69
+ */
70
+ public model(): string;
71
+
72
+ /**
73
+ * 获取设备代号, 例如 "REL" 表示正式发布的版本
74
+ */
75
+ public codename(): string;
76
+ }
77
+
78
+ export { };
@@ -0,0 +1,41 @@
1
+ declare global {
2
+ var Dialogs: Dialogs;
3
+ }
4
+
5
+ interface Dialogs {
6
+ /**
7
+ * 弹窗(App内运行)
8
+ * @param title 标题
9
+ * @param content 内容
10
+ */
11
+ public show(title: string, content: string): void;
12
+
13
+ /**
14
+ * 弹窗(App内运行)
15
+ * @param title 标题
16
+ */
17
+ public show(title: string): void;
18
+
19
+ /**
20
+ * 确认弹窗(App内运行)
21
+ * @param title 标题
22
+ * @param content 内容
23
+ */
24
+ public confirm(title: string, content: string, callback: (result: boolean) => void): void;
25
+
26
+ /**
27
+ * 输入弹窗(App内运行)
28
+ * @param title 标题
29
+ * @param content 内容
30
+ */
31
+ public input(title: string): string;
32
+
33
+ /**
34
+ * 输入弹窗(App内运行)
35
+ * @param title 标题
36
+ * @param value 默认值
37
+ */
38
+ public input(title: string, value: object): string;
39
+ }
40
+
41
+ export { };
@@ -0,0 +1,58 @@
1
+ declare global {
2
+ var Encrypt: Encrypt;
3
+ }
4
+
5
+ interface Encrypt {
6
+ /**
7
+ * md5加密
8
+ * @param input
9
+ */
10
+ public md5(input: string): string;
11
+
12
+ /**
13
+ * sha1加密
14
+ * @param input
15
+ */
16
+ public sha1(input: string): string;
17
+
18
+ /**
19
+ * sha256加密
20
+ * @param input
21
+ */
22
+ public sha256(input: string): string;
23
+
24
+ /**
25
+ * base64 encode
26
+ * @param input
27
+ */
28
+ public base64Encode(input: string): string;
29
+
30
+ /**
31
+ * base64 decode
32
+ * @param input
33
+ */
34
+ public base64Decode(input: string): string;
35
+
36
+ /**
37
+ * 生成iv
38
+ */
39
+ public generateIv(): string;
40
+
41
+ /**
42
+ * aescbc加密
43
+ * @param key
44
+ * @param iv
45
+ * @param input
46
+ */
47
+ public aesCbcEncrypt(key: string, iv: string, input: string): string;
48
+
49
+ /**
50
+ * aescbc解密
51
+ * @param key
52
+ * @param iv
53
+ * @param input
54
+ */
55
+ public aesCbcDecrypt(key: string, iv: string, input: string): string;
56
+ }
57
+
58
+ export { };
@@ -0,0 +1,24 @@
1
+ declare global {
2
+ var Engines: Engines;
3
+ }
4
+
5
+ interface Engines {
6
+ /**
7
+ * 执行脚本
8
+ * @param file 文件路径,相对根目录的路径
9
+ */
10
+ public execScript(file: string): void;
11
+
12
+ /**
13
+ * 执行脚本
14
+ * @param content 脚本内容
15
+ */
16
+ public executeScriptStr(content: string): void;
17
+
18
+ /**
19
+ * 关闭所有脚本
20
+ */
21
+ public closeAll(): void;
22
+ }
23
+
24
+ export { };
@@ -0,0 +1,20 @@
1
+ declare global {
2
+ var FloatDialogs: FloatDialogs;
3
+ }
4
+
5
+ interface FloatDialogs {
6
+ /**
7
+ * 悬浮窗弹窗(需要开启悬浮窗权限)
8
+ * @param title 弹窗标题
9
+ * @param content 弹窗内容
10
+ */
11
+ public show(title: string, content: string): void;
12
+
13
+ /**
14
+ * 悬浮窗弹窗(需要开启悬浮窗权限)
15
+ * @param content 弹窗内容
16
+ */
17
+ public show(content: string): void;
18
+ }
19
+
20
+ export { };
@@ -0,0 +1,54 @@
1
+ declare global {
2
+ var Gesture: Gesture;
3
+ }
4
+
5
+ interface Gesture {
6
+ /**
7
+ * 点击屏幕位置
8
+ * @param x x坐标
9
+ * @param y y坐标
10
+ */
11
+ public click(x: number, y: number): boolean;
12
+
13
+ /**
14
+ * 长按屏幕位置
15
+ * @param x x坐标
16
+ * @param y y坐标
17
+ */
18
+ public longClick(x: number, y: number): boolean;
19
+
20
+ /**
21
+ * 长按屏幕位置(可设置时长)
22
+ * @param x x坐标
23
+ * @param y y坐标
24
+ * @param duration 长按时长,毫秒
25
+ */
26
+ public press(x: number, y: number, duration: number): boolean;
27
+
28
+ /**
29
+ * 从(x1,y1)滑动到(x2,y2),并且耗时duration毫秒
30
+ * @param x1 起始位置,x坐标
31
+ * @param y1 起始位置,y坐标
32
+ * @param x2 结束位置,x坐标
33
+ * @param y2 结束位置,y坐标
34
+ * @param duration 滑动时长,毫秒
35
+ */
36
+ public swipe(x1: number, y1: number, x2: number, y2: number, duration: number): boolean;
37
+
38
+ /**
39
+ * 返回键
40
+ */
41
+ public back(): boolean;
42
+
43
+ /**
44
+ * 主页键(Home键)
45
+ */
46
+ public home(): boolean;
47
+
48
+ /**
49
+ * 任务切换键
50
+ */
51
+ public recents(): boolean;
52
+ }
53
+
54
+ export { };
@@ -0,0 +1,41 @@
1
+ declare global {
2
+ var Http: Http;
3
+ }
4
+
5
+ interface Http {
6
+ /**
7
+ * post请求 {"Content-Type":"application/json"}
8
+ * @param url 请求地址
9
+ * @param json 请求内容,请使用JOSN.parse()将对象处理成字符串
10
+ */
11
+ public post(url: string, json: object): string;
12
+
13
+ /**
14
+ *
15
+ * @param url 请求地址
16
+ * @param json 请求内容
17
+ * @param headers 请求头n的请求头,如:{"Content-Type":"application/json"}
18
+ */
19
+ public postHeaders(url: string, json: string, headers: object): string | null;
20
+
21
+ /**
22
+ * get请求
23
+ * @param url 请求地址
24
+ */
25
+ public get(url: string): string;
26
+
27
+ /**
28
+ * 带请求头的get请求
29
+ * @param url 请求地址
30
+ * @param headers 请求头
31
+ */
32
+ public getHeaders(url: string, headers: object): string | null;
33
+
34
+ //下面的方法,暂时还没使用过
35
+ // public postFile(url: string, files: string[], params: object, httpCallback: {
36
+ // success: (response: object) => void,
37
+ // error: (response: object) => void
38
+ // }): boolean;
39
+ }
40
+
41
+ export { };