assistsx-js 0.1.28 → 0.1.30

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.
@@ -38,11 +38,19 @@ export type AccessibilityEventListener = (event: AccessibilityEvent) => void;
38
38
  export interface WebFloatingWindowOptions {
39
39
  initialWidth?: number;
40
40
  initialHeight?: number;
41
+ /** Initial window X position (default 0) */
42
+ initialX?: number;
43
+ /** Initial window Y position (default 0) */
44
+ initialY?: number;
41
45
  minWidth?: number;
42
46
  minHeight?: number;
43
47
  maxWidth?: number;
44
48
  maxHeight?: number;
45
49
  initialCenter?: boolean;
50
+ /** Whether to show top operation area (title bar, close button, etc.) */
51
+ showTopOperationArea?: boolean;
52
+ /** Whether to show bottom operation area (zoom, back/forward/refresh, etc.) */
53
+ showBottomOperationArea?: boolean;
46
54
  }
47
55
  export declare const callbacks: Map<string, (data: string) => void>;
48
56
  export declare const accessibilityEventListeners: AccessibilityEventListener[];
@@ -112,6 +120,12 @@ export declare class AssistsX {
112
120
  * @returns 剪贴板最新文本
113
121
  */
114
122
  static getClipboardLatestText(): any;
123
+ /**
124
+ * 获取剪贴板文本内容(异步)
125
+ * @param timeout 超时时间(秒),默认30秒
126
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
127
+ */
128
+ static getClipboardText(timeout?: number): Promise<string>;
115
129
  /**
116
130
  * 在浏览器中打开URL
117
131
  * @param url 要打开的URL
package/dist/AssistsX.js CHANGED
@@ -174,6 +174,18 @@ export class AssistsX {
174
174
  const response = this.call(CallMethod.getClipboardLatestText);
175
175
  return response.getDataOrDefault({});
176
176
  }
177
+ /**
178
+ * 获取剪贴板文本内容(异步)
179
+ * @param timeout 超时时间(秒),默认30秒
180
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
181
+ */
182
+ static async getClipboardText(timeout) {
183
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
184
+ timeout,
185
+ });
186
+ const data = response.getDataOrDefault({ text: "" });
187
+ return data.text || "";
188
+ }
177
189
  /**
178
190
  * 在浏览器中打开URL
179
191
  * @param url 要打开的URL
@@ -228,17 +240,21 @@ export class AssistsX {
228
240
  return data.value;
229
241
  }
230
242
  static async loadWebViewOverlay(url, options = {}) {
231
- const { initialWidth, initialHeight, minWidth, minHeight, maxWidth, maxHeight, initialCenter, timeout, } = options;
243
+ const { initialWidth, initialHeight, initialX, initialY, minWidth, minHeight, maxWidth, maxHeight, initialCenter, showTopOperationArea, showBottomOperationArea, timeout, } = options;
232
244
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
233
245
  args: {
234
246
  url,
235
247
  initialWidth,
236
248
  initialHeight,
249
+ initialX,
250
+ initialY,
237
251
  minWidth,
238
252
  minHeight,
239
253
  maxWidth,
240
254
  maxHeight,
241
255
  initialCenter,
256
+ showTopOperationArea,
257
+ showBottomOperationArea,
242
258
  },
243
259
  timeout,
244
260
  });
@@ -517,4 +517,10 @@ export declare class AssistsXAsync {
517
517
  prettyPrint?: boolean;
518
518
  timeout?: number;
519
519
  }): Promise<string>;
520
+ /**
521
+ * 获取剪贴板文本内容
522
+ * @param timeout 超时时间(秒),默认30秒
523
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
524
+ */
525
+ static getClipboardText(timeout?: number): Promise<string>;
520
526
  }
@@ -203,17 +203,21 @@ export class AssistsXAsync {
203
203
  return data.value;
204
204
  }
205
205
  static async loadWebViewOverlay(url, options = {}) {
206
- const { initialWidth, initialHeight, minWidth, minHeight, maxWidth, maxHeight, initialCenter, timeout, } = options;
206
+ const { initialWidth, initialHeight, initialX, initialY, minWidth, minHeight, maxWidth, maxHeight, initialCenter, showTopOperationArea, showBottomOperationArea, timeout, } = options;
207
207
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
208
208
  args: {
209
209
  url,
210
210
  initialWidth,
211
211
  initialHeight,
212
+ initialX,
213
+ initialY,
212
214
  minWidth,
213
215
  minHeight,
214
216
  maxWidth,
215
217
  maxHeight,
216
218
  initialCenter,
219
+ showTopOperationArea,
220
+ showBottomOperationArea,
217
221
  },
218
222
  timeout,
219
223
  });
@@ -843,4 +847,16 @@ export class AssistsXAsync {
843
847
  const data = response.getDataOrDefault({ file: "" });
844
848
  return data.file;
845
849
  }
850
+ /**
851
+ * 获取剪贴板文本内容
852
+ * @param timeout 超时时间(秒),默认30秒
853
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
854
+ */
855
+ static async getClipboardText(timeout) {
856
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
857
+ timeout,
858
+ });
859
+ const data = response.getDataOrDefault({ text: "" });
860
+ return data.text || "";
861
+ }
846
862
  }
@@ -52,6 +52,7 @@ export declare const CallMethod: {
52
52
  readonly getNetworkType: "getNetworkType";
53
53
  readonly isAppInstalled: "isAppInstalled";
54
54
  readonly getClipboardLatestText: "getClipboardLatestText";
55
+ readonly getClipboardText: "getClipboardText";
55
56
  readonly openUrlInBrowser: "openUrlInBrowser";
56
57
  readonly keepScreenOn: "keepScreenOn";
57
58
  readonly clearKeepScreenOn: "clearKeepScreenOn";
@@ -53,6 +53,7 @@ export const CallMethod = {
53
53
  getNetworkType: "getNetworkType",
54
54
  isAppInstalled: "isAppInstalled",
55
55
  getClipboardLatestText: "getClipboardLatestText",
56
+ getClipboardText: "getClipboardText",
56
57
  openUrlInBrowser: "openUrlInBrowser",
57
58
  keepScreenOn: "keepScreenOn",
58
59
  clearKeepScreenOn: "clearKeepScreenOn",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AssistsX.ts CHANGED
@@ -44,11 +44,19 @@ export type AccessibilityEventListener = (event: AccessibilityEvent) => void;
44
44
  export interface WebFloatingWindowOptions {
45
45
  initialWidth?: number;
46
46
  initialHeight?: number;
47
+ /** Initial window X position (default 0) */
48
+ initialX?: number;
49
+ /** Initial window Y position (default 0) */
50
+ initialY?: number;
47
51
  minWidth?: number;
48
52
  minHeight?: number;
49
53
  maxWidth?: number;
50
54
  maxHeight?: number;
51
55
  initialCenter?: boolean;
56
+ /** Whether to show top operation area (title bar, close button, etc.) */
57
+ showTopOperationArea?: boolean;
58
+ /** Whether to show bottom operation area (zoom, back/forward/refresh, etc.) */
59
+ showBottomOperationArea?: boolean;
52
60
  }
53
61
 
54
62
  // 回调函数存储对象
@@ -257,6 +265,19 @@ export class AssistsX {
257
265
  return response.getDataOrDefault({});
258
266
  }
259
267
 
268
+ /**
269
+ * 获取剪贴板文本内容(异步)
270
+ * @param timeout 超时时间(秒),默认30秒
271
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
272
+ */
273
+ public static async getClipboardText(timeout?: number): Promise<string> {
274
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
275
+ timeout,
276
+ });
277
+ const data = response.getDataOrDefault({ text: "" });
278
+ return data.text || "";
279
+ }
280
+
260
281
  /**
261
282
  * 在浏览器中打开URL
262
283
  * @param url 要打开的URL
@@ -323,11 +344,15 @@ export class AssistsX {
323
344
  const {
324
345
  initialWidth,
325
346
  initialHeight,
347
+ initialX,
348
+ initialY,
326
349
  minWidth,
327
350
  minHeight,
328
351
  maxWidth,
329
352
  maxHeight,
330
353
  initialCenter,
354
+ showTopOperationArea,
355
+ showBottomOperationArea,
331
356
  timeout,
332
357
  } = options;
333
358
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
@@ -335,11 +360,15 @@ export class AssistsX {
335
360
  url,
336
361
  initialWidth,
337
362
  initialHeight,
363
+ initialX,
364
+ initialY,
338
365
  minWidth,
339
366
  minHeight,
340
367
  maxWidth,
341
368
  maxHeight,
342
369
  initialCenter,
370
+ showTopOperationArea,
371
+ showBottomOperationArea,
343
372
  },
344
373
  timeout,
345
374
  });
@@ -354,11 +354,15 @@ export class AssistsXAsync {
354
354
  const {
355
355
  initialWidth,
356
356
  initialHeight,
357
+ initialX,
358
+ initialY,
357
359
  minWidth,
358
360
  minHeight,
359
361
  maxWidth,
360
362
  maxHeight,
361
363
  initialCenter,
364
+ showTopOperationArea,
365
+ showBottomOperationArea,
362
366
  timeout,
363
367
  } = options;
364
368
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
@@ -366,11 +370,15 @@ export class AssistsXAsync {
366
370
  url,
367
371
  initialWidth,
368
372
  initialHeight,
373
+ initialX,
374
+ initialY,
369
375
  minWidth,
370
376
  minHeight,
371
377
  maxWidth,
372
378
  maxHeight,
373
379
  initialCenter,
380
+ showTopOperationArea,
381
+ showBottomOperationArea,
374
382
  },
375
383
  timeout,
376
384
  });
@@ -1280,6 +1288,19 @@ export class AssistsXAsync {
1280
1288
  return data.file;
1281
1289
  }
1282
1290
 
1291
+ /**
1292
+ * 获取剪贴板文本内容
1293
+ * @param timeout 超时时间(秒),默认30秒
1294
+ * @returns 剪贴板文本内容,如果获取失败则返回空字符串
1295
+ */
1296
+ public static async getClipboardText(timeout?: number): Promise<string> {
1297
+ const response = await this.asyncCall(CallMethod.getClipboardText, {
1298
+ timeout,
1299
+ });
1300
+ const data = response.getDataOrDefault({ text: "" });
1301
+ return data.text || "";
1302
+ }
1303
+
1283
1304
  /**
1284
1305
  * 发送HTTP请求
1285
1306
  * @param options 请求选项
package/src/CallMethod.ts CHANGED
@@ -57,6 +57,7 @@ export const CallMethod = {
57
57
  getNetworkType: "getNetworkType",
58
58
  isAppInstalled: "isAppInstalled",
59
59
  getClipboardLatestText: "getClipboardLatestText",
60
+ getClipboardText: "getClipboardText",
60
61
  openUrlInBrowser: "openUrlInBrowser",
61
62
  keepScreenOn: "keepScreenOn",
62
63
  clearKeepScreenOn: "clearKeepScreenOn",