ms-types 0.3.10 → 0.3.11
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/package.json +1 -1
- package/types/global.d.ts +1 -0
- package/types/image.d.ts +25 -3
- package/types/node.d.ts +24 -0
- package/types/ui.d.ts +13 -0
- package/types/zh//345/205/250/345/261/200/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +25 -3
- package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +24 -0
- package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +13 -0
package/package.json
CHANGED
package/types/global.d.ts
CHANGED
package/types/image.d.ts
CHANGED
|
@@ -128,7 +128,7 @@ declare namespace image {
|
|
|
128
128
|
/**
|
|
129
129
|
* 查找颜色
|
|
130
130
|
* @param imageId 图片id
|
|
131
|
-
* @param color 颜色 支持"主色-偏色"格式,如"
|
|
131
|
+
* @param color 颜色 支持"主色-偏色"格式,如"#6DD1E6-#101010"
|
|
132
132
|
* @param threshold 阈值 0.0-1.0
|
|
133
133
|
* @param x 左上角x 全屏传0
|
|
134
134
|
* @param y 左上角y 全屏传0
|
|
@@ -140,7 +140,7 @@ declare namespace image {
|
|
|
140
140
|
* @example
|
|
141
141
|
* const imageId = image.readImage("screen.jpg")
|
|
142
142
|
* if (imageId) {
|
|
143
|
-
* const points = image.findColor(imageId, "
|
|
143
|
+
* const points = image.findColor(imageId, "#6DD1E6-#101010", 0.9, 0, 0, 100, 100, 1, 1)
|
|
144
144
|
* if (points.length > 0) {
|
|
145
145
|
* logi("找到颜色")
|
|
146
146
|
* }
|
|
@@ -174,7 +174,7 @@ declare namespace image {
|
|
|
174
174
|
* @example
|
|
175
175
|
* const imageId = image.readImage("screen.jpg")
|
|
176
176
|
* if (imageId) {
|
|
177
|
-
* const points = image.findMultiColor(imageId, "
|
|
177
|
+
* const points = image.findMultiColor(imageId, "#6DD1E6-#101010", 0.9, "1|2|#6DD1E6-#101010", 0, 0, 100, 100, 1, 1)
|
|
178
178
|
* if (points.length > 0) {
|
|
179
179
|
* logi("找到颜色")
|
|
180
180
|
* }
|
|
@@ -193,6 +193,28 @@ declare namespace image {
|
|
|
193
193
|
limit: number,
|
|
194
194
|
orz: number
|
|
195
195
|
): { x: number; y: number }[];
|
|
196
|
+
/**
|
|
197
|
+
* 统计颜色数量
|
|
198
|
+
* @param imageId 图片id
|
|
199
|
+
* @param colors 颜色列表,支持 "主色-偏色|主色-偏色|...",如 "#0A0A0A-#101010|#FFFFFF-#101010"
|
|
200
|
+
* @param threshold 相似度阈值 0.0-1.0
|
|
201
|
+
* @param x 区域左上角x(全图传0)
|
|
202
|
+
* @param y 区域左上角y(全图传0)
|
|
203
|
+
* @param ex 区域右下角x(全图传0)
|
|
204
|
+
* @param ey 区域右下角y(全图传0)
|
|
205
|
+
* @returns 命中像素数量
|
|
206
|
+
* @example
|
|
207
|
+
* const n = image.countColor("screen", "#0A0A0A-#101010|#FFFFFF-#101010", 0.92, 100, 200, 500, 700)
|
|
208
|
+
*/
|
|
209
|
+
function countColor(
|
|
210
|
+
imageId: string,
|
|
211
|
+
colors: string,
|
|
212
|
+
threshold: number,
|
|
213
|
+
x: number,
|
|
214
|
+
y: number,
|
|
215
|
+
ex: number,
|
|
216
|
+
ey: number
|
|
217
|
+
): number;
|
|
196
218
|
/**
|
|
197
219
|
* 查找图片
|
|
198
220
|
* @param imageId 图片id
|
package/types/node.d.ts
CHANGED
|
@@ -267,6 +267,30 @@ declare class NodeSelector {
|
|
|
267
267
|
* @returns 节点选择器
|
|
268
268
|
*/
|
|
269
269
|
childCount(childCount: number | string): NodeSelector;
|
|
270
|
+
/**
|
|
271
|
+
* 获取节点x坐标
|
|
272
|
+
* @param x x坐标
|
|
273
|
+
* @returns 节点选择器
|
|
274
|
+
*/
|
|
275
|
+
x(x: number | string): NodeSelector;
|
|
276
|
+
/**
|
|
277
|
+
* 获取节点y坐标
|
|
278
|
+
* @param y y坐标
|
|
279
|
+
* @returns 节点选择器
|
|
280
|
+
*/
|
|
281
|
+
y(y: number | string): NodeSelector;
|
|
282
|
+
/**
|
|
283
|
+
* 获取节点宽度
|
|
284
|
+
* @param width 宽度
|
|
285
|
+
* @returns 节点选择器
|
|
286
|
+
*/
|
|
287
|
+
width(width: number | string): NodeSelector;
|
|
288
|
+
/**
|
|
289
|
+
* 获取节点高度
|
|
290
|
+
* @param height 高度
|
|
291
|
+
* @returns 节点选择器
|
|
292
|
+
*/
|
|
293
|
+
height(height: number | string): NodeSelector;
|
|
270
294
|
/**
|
|
271
295
|
* 获取节点位置
|
|
272
296
|
* @param x x坐标
|
package/types/ui.d.ts
CHANGED
|
@@ -104,6 +104,11 @@ declare namespace ms {
|
|
|
104
104
|
* UI模块 提供WebView相关功能
|
|
105
105
|
*/
|
|
106
106
|
declare namespace ui {
|
|
107
|
+
/**
|
|
108
|
+
* 显示WebView
|
|
109
|
+
*/
|
|
110
|
+
function show(): void;
|
|
111
|
+
|
|
107
112
|
/**
|
|
108
113
|
* 设置事件回调函数
|
|
109
114
|
* @param onEvent 事件回调函数
|
|
@@ -128,6 +133,14 @@ declare namespace ui {
|
|
|
128
133
|
*/
|
|
129
134
|
function call(key: string, data: Record<string, any>): void;
|
|
130
135
|
|
|
136
|
+
/**
|
|
137
|
+
* 执行JavaScript代码
|
|
138
|
+
* @param code JavaScript代码字符串
|
|
139
|
+
* @example
|
|
140
|
+
* ui.eval("console.log('Hello from KuaiJS')")
|
|
141
|
+
*/
|
|
142
|
+
function eval(code: string): void;
|
|
143
|
+
|
|
131
144
|
/**
|
|
132
145
|
* 显示Toast提示消息
|
|
133
146
|
* @param message 提示消息内容
|
|
@@ -126,7 +126,7 @@ declare namespace $图片 {
|
|
|
126
126
|
/**
|
|
127
127
|
* 查找颜色
|
|
128
128
|
* @param 图片ID 图片id
|
|
129
|
-
* @param 颜色 颜色 支持"主色-偏色"格式,如"
|
|
129
|
+
* @param 颜色 颜色 支持"主色-偏色"格式,如"#6DD1E6-#101010"
|
|
130
130
|
* @param 阈值 0.0-1.0
|
|
131
131
|
* @param 区域左上角x 全屏传0
|
|
132
132
|
* @param 区域左上角y 全屏传0
|
|
@@ -138,7 +138,7 @@ declare namespace $图片 {
|
|
|
138
138
|
* @example
|
|
139
139
|
* const 图片ID = $图片.读取图片("screen.jpg")
|
|
140
140
|
* if (图片ID) {
|
|
141
|
-
* const 颜色点数组 = $图片.单点找色(图片ID, "
|
|
141
|
+
* const 颜色点数组 = $图片.单点找色(图片ID, "#6DD1E6-#101010", 0.9, 0, 0, 100, 100, 1, 1)
|
|
142
142
|
* if (颜色点数组.length > 0) {
|
|
143
143
|
* $打印信息日志("找到颜色")
|
|
144
144
|
* }
|
|
@@ -172,7 +172,7 @@ declare namespace $图片 {
|
|
|
172
172
|
* @example
|
|
173
173
|
* const 图片ID = $图片.读取图片("screen.jpg")
|
|
174
174
|
* if (图片ID) {
|
|
175
|
-
* const 颜色点数组 = $图片.多点找色(图片ID, "
|
|
175
|
+
* const 颜色点数组 = $图片.多点找色(图片ID, "#6DD1E6-#101010", 0.9, "1|2|#6DD1E6-#101010", 0, 0, 100, 100, 1, 1)
|
|
176
176
|
* if (颜色点数组.length > 0) {
|
|
177
177
|
* $打印信息日志("找到颜色")
|
|
178
178
|
* }
|
|
@@ -191,6 +191,28 @@ declare namespace $图片 {
|
|
|
191
191
|
限制数量: 数字,
|
|
192
192
|
查找方向: 数字
|
|
193
193
|
): { x: 数字; y: 数字 }[];
|
|
194
|
+
/**
|
|
195
|
+
* 统计颜色数量
|
|
196
|
+
* @param 图片ID 图片id
|
|
197
|
+
* @param 颜色列表 支持"主色-偏色|主色-偏色|...",例如"#0A0A0A-#101010|#FFFFFF-#101010"
|
|
198
|
+
* @param 阈值 0.0-1.0
|
|
199
|
+
* @param 区域左上角x 全屏传0
|
|
200
|
+
* @param 区域左上角y 全屏传0
|
|
201
|
+
* @param 区域右下角x 全屏传0
|
|
202
|
+
* @param 区域右下角y 全屏传0
|
|
203
|
+
* @returns 命中像素数量
|
|
204
|
+
* @example
|
|
205
|
+
* const 数量 = $图片.统计颜色数量("screen", "#0A0A0A-#101010|#FFFFFF-#101010", 0.92, 100, 200, 500, 700)
|
|
206
|
+
*/
|
|
207
|
+
function 统计颜色数量(
|
|
208
|
+
图片ID: 字符串,
|
|
209
|
+
颜色列表: 字符串,
|
|
210
|
+
阈值: 数字,
|
|
211
|
+
区域左上角x: 数字,
|
|
212
|
+
区域左上角y: 数字,
|
|
213
|
+
区域右下角x: 数字,
|
|
214
|
+
区域右下角y: 数字
|
|
215
|
+
): 数字;
|
|
194
216
|
/**
|
|
195
217
|
* 查找图片
|
|
196
218
|
* @param 图片ID 图片id
|
|
@@ -268,6 +268,30 @@ declare class $节点选择器 {
|
|
|
268
268
|
* @returns 节点选择器
|
|
269
269
|
*/
|
|
270
270
|
childCount(childCount: 数字 | 字符串): $节点选择器;
|
|
271
|
+
/**
|
|
272
|
+
* 获取节点x坐标
|
|
273
|
+
* @param x x坐标
|
|
274
|
+
* @returns 节点选择器
|
|
275
|
+
*/
|
|
276
|
+
x(x: 数字 | 字符串): $节点选择器;
|
|
277
|
+
/**
|
|
278
|
+
* 获取节点y坐标
|
|
279
|
+
* @param y y坐标
|
|
280
|
+
* @returns 节点选择器
|
|
281
|
+
*/
|
|
282
|
+
y(y: 数字 | 字符串): $节点选择器;
|
|
283
|
+
/**
|
|
284
|
+
* 获取节点宽度
|
|
285
|
+
* @param width 宽度
|
|
286
|
+
* @returns 节点选择器
|
|
287
|
+
*/
|
|
288
|
+
width(width: 数字 | 字符串): $节点选择器;
|
|
289
|
+
/**
|
|
290
|
+
* 获取节点高度
|
|
291
|
+
* @param height 高度
|
|
292
|
+
* @returns 节点选择器
|
|
293
|
+
*/
|
|
294
|
+
height(height: 数字 | 字符串): $节点选择器;
|
|
271
295
|
/**
|
|
272
296
|
* 获取节点位置
|
|
273
297
|
* @param x x坐标
|
|
@@ -94,6 +94,11 @@ declare namespace $快点 {
|
|
|
94
94
|
* UI模块 提供WebView相关功能
|
|
95
95
|
*/
|
|
96
96
|
declare namespace $视图 {
|
|
97
|
+
/**
|
|
98
|
+
* 显示WebView
|
|
99
|
+
*/
|
|
100
|
+
function 显示(): 无返回值;
|
|
101
|
+
|
|
97
102
|
/**
|
|
98
103
|
* 设置事件回调函数
|
|
99
104
|
* @param onEvent 事件回调函数
|
|
@@ -118,6 +123,14 @@ declare namespace $视图 {
|
|
|
118
123
|
*/
|
|
119
124
|
function 调用函数(函数名: 字符串, 数据: 任意类型): 无返回值;
|
|
120
125
|
|
|
126
|
+
/**
|
|
127
|
+
* 执行JavaScript代码
|
|
128
|
+
* @param 代码 JavaScript代码字符串
|
|
129
|
+
* @example
|
|
130
|
+
* $视图.执行JS代码("console.log('Hello KuaiJS')")
|
|
131
|
+
*/
|
|
132
|
+
function 执行JS代码(代码: 字符串): 无返回值;
|
|
133
|
+
|
|
121
134
|
/**
|
|
122
135
|
* 显示Toast提示消息
|
|
123
136
|
* @param 消息内容 提示消息内容
|