assistsx-js 0.0.2044 → 0.0.2047

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/dist/Bounds.d.ts CHANGED
@@ -11,6 +11,11 @@ export declare class Bounds {
11
11
  readonly exactCenterY: number;
12
12
  readonly isEmpty: boolean;
13
13
  constructor(left: number, top: number, right: number, bottom: number, width: number, height: number, centerX: number, centerY: number, exactCenterX: number, exactCenterY: number, isEmpty: boolean);
14
+ /**
15
+ * 判断该 Bounds 是否在屏幕内(满足基本几何有效性)
16
+ * @returns {boolean}
17
+ */
18
+ isInScreen(): boolean;
14
19
  static from(data: {
15
20
  left: number;
16
21
  top: number;
package/dist/Bounds.js CHANGED
@@ -14,6 +14,16 @@ export class Bounds {
14
14
  this.exactCenterY = exactCenterY;
15
15
  this.isEmpty = isEmpty;
16
16
  }
17
+ /**
18
+ * 判断该 Bounds 是否在屏幕内(满足基本几何有效性)
19
+ * @returns {boolean}
20
+ */
21
+ isInScreen() {
22
+ return this.centerX > 0 &&
23
+ this.centerY > 0 &&
24
+ this.height > 0 &&
25
+ this.width > 0;
26
+ }
17
27
  // 从普通对象创建 Bounds 实例
18
28
  static from(data) {
19
29
  return new Bounds(data.left, data.top, data.right, data.bottom, data.width, data.height, data.centerX, data.centerY, data.exactCenterX, data.exactCenterY, data.isEmpty);
package/dist/Step.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare class Step {
28
28
  tag?: string | undefined;
29
29
  data?: any | undefined;
30
30
  delayMs?: number;
31
- }): Promise<Step>;
31
+ }): Promise<Step | undefined>;
32
32
  /**
33
33
  * 获取当前步骤ID
34
34
  */
package/dist/Step.js CHANGED
@@ -25,11 +25,15 @@ export class Step {
25
25
  //步骤开始
26
26
  if (stepId) {
27
27
  this._stepId = stepId;
28
- console.log(`使用传入步骤ID: ${this._stepId}`);
28
+ if (Step.showLog) {
29
+ console.log(`使用传入步骤ID: ${this._stepId}`);
30
+ }
29
31
  }
30
32
  else {
31
33
  this._stepId = generateUUID();
32
- console.log(`生成步骤ID: ${this._stepId}`);
34
+ if (Step.showLog) {
35
+ console.log(`生成步骤ID: ${this._stepId}`);
36
+ }
33
37
  }
34
38
  stepStore.startStep(this._stepId, tag, data);
35
39
  currentStep = new Step({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2044",
3
+ "version": "0.0.2047",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/Bounds.ts CHANGED
@@ -1,114 +1,126 @@
1
1
  // Bounds 类,对应 Kotlin 的 data class
2
2
  export class Bounds {
3
- // 构造函数
4
- constructor(
5
- public readonly left: number,
6
- public readonly top: number,
7
- public readonly right: number,
8
- public readonly bottom: number,
9
- public readonly width: number,
10
- public readonly height: number,
11
- public readonly centerX: number,
12
- public readonly centerY: number,
13
- public readonly exactCenterX: number,
14
- public readonly exactCenterY: number,
15
- public readonly isEmpty: boolean
16
- ) {}
3
+ // 构造函数
4
+ constructor(
5
+ public readonly left: number,
6
+ public readonly top: number,
7
+ public readonly right: number,
8
+ public readonly bottom: number,
9
+ public readonly width: number,
10
+ public readonly height: number,
11
+ public readonly centerX: number,
12
+ public readonly centerY: number,
13
+ public readonly exactCenterX: number,
14
+ public readonly exactCenterY: number,
15
+ public readonly isEmpty: boolean
16
+ ) { }
17
17
 
18
- // 从普通对象创建 Bounds 实例
19
- static from(data: {
20
- left: number;
21
- top: number;
22
- right: number;
23
- bottom: number;
24
- width: number;
25
- height: number;
26
- centerX: number;
27
- centerY: number;
28
- exactCenterX: number;
29
- exactCenterY: number;
30
- isEmpty: boolean;
31
- }): Bounds {
32
- return new Bounds(
33
- data.left,
34
- data.top,
35
- data.right,
36
- data.bottom,
37
- data.width,
38
- data.height,
39
- data.centerX,
40
- data.centerY,
41
- data.exactCenterX,
42
- data.exactCenterY,
43
- data.isEmpty
44
- );
45
- }
18
+ /**
19
+ * 判断该 Bounds 是否在屏幕内(满足基本几何有效性)
20
+ * @returns {boolean}
21
+ */
22
+ public isInScreen(): boolean {
23
+ return this.centerX > 0 &&
24
+ this.centerY > 0 &&
25
+ this.height > 0 &&
26
+ this.width > 0;
27
+ }
46
28
 
47
- // 从 JSON 字符串创建实例
48
- static fromJSON(json: string): Bounds {
49
- const data = JSON.parse(json);
50
- return Bounds.from(data);
51
- }
52
29
 
53
- static fromData(data: any): Bounds {
54
- return new Bounds(
55
- data.left,
56
- data.top,
57
- data.right,
58
- data.bottom,
59
- data.width,
60
- data.height,
61
- data.centerX,
62
- data.centerY,
63
- data.exactCenterX,
64
- data.exactCenterY,
65
- data.isEmpty
66
- );
67
- }
30
+ // 从普通对象创建 Bounds 实例
31
+ static from(data: {
32
+ left: number;
33
+ top: number;
34
+ right: number;
35
+ bottom: number;
36
+ width: number;
37
+ height: number;
38
+ centerX: number;
39
+ centerY: number;
40
+ exactCenterX: number;
41
+ exactCenterY: number;
42
+ isEmpty: boolean;
43
+ }): Bounds {
44
+ return new Bounds(
45
+ data.left,
46
+ data.top,
47
+ data.right,
48
+ data.bottom,
49
+ data.width,
50
+ data.height,
51
+ data.centerX,
52
+ data.centerY,
53
+ data.exactCenterX,
54
+ data.exactCenterY,
55
+ data.isEmpty
56
+ );
57
+ }
68
58
 
69
- // 转换为普通对象
70
- toJSON(): {
71
- left: number;
72
- top: number;
73
- right: number;
74
- bottom: number;
75
- width: number;
76
- height: number;
77
- centerX: number;
78
- centerY: number;
79
- exactCenterX: number;
80
- exactCenterY: number;
81
- isEmpty: boolean;
82
- } {
83
- return {
84
- left: this.left,
85
- top: this.top,
86
- right: this.right,
87
- bottom: this.bottom,
88
- width: this.width,
89
- height: this.height,
90
- centerX: this.centerX,
91
- centerY: this.centerY,
92
- exactCenterX: this.exactCenterX,
93
- exactCenterY: this.exactCenterY,
94
- isEmpty: this.isEmpty,
95
- };
96
- }
59
+ // 从 JSON 字符串创建实例
60
+ static fromJSON(json: string): Bounds {
61
+ const data = JSON.parse(json);
62
+ return Bounds.from(data);
63
+ }
97
64
 
98
- // 克隆方法
99
- clone(): Bounds {
100
- return new Bounds(
101
- this.left,
102
- this.top,
103
- this.right,
104
- this.bottom,
105
- this.width,
106
- this.height,
107
- this.centerX,
108
- this.centerY,
109
- this.exactCenterX,
110
- this.exactCenterY,
111
- this.isEmpty
112
- );
113
- }
65
+ static fromData(data: any): Bounds {
66
+ return new Bounds(
67
+ data.left,
68
+ data.top,
69
+ data.right,
70
+ data.bottom,
71
+ data.width,
72
+ data.height,
73
+ data.centerX,
74
+ data.centerY,
75
+ data.exactCenterX,
76
+ data.exactCenterY,
77
+ data.isEmpty
78
+ );
79
+ }
80
+
81
+ // 转换为普通对象
82
+ toJSON(): {
83
+ left: number;
84
+ top: number;
85
+ right: number;
86
+ bottom: number;
87
+ width: number;
88
+ height: number;
89
+ centerX: number;
90
+ centerY: number;
91
+ exactCenterX: number;
92
+ exactCenterY: number;
93
+ isEmpty: boolean;
94
+ } {
95
+ return {
96
+ left: this.left,
97
+ top: this.top,
98
+ right: this.right,
99
+ bottom: this.bottom,
100
+ width: this.width,
101
+ height: this.height,
102
+ centerX: this.centerX,
103
+ centerY: this.centerY,
104
+ exactCenterX: this.exactCenterX,
105
+ exactCenterY: this.exactCenterY,
106
+ isEmpty: this.isEmpty,
107
+ };
108
+ }
109
+
110
+ // 克隆方法
111
+ clone(): Bounds {
112
+ return new Bounds(
113
+ this.left,
114
+ this.top,
115
+ this.right,
116
+ this.bottom,
117
+ this.width,
118
+ this.height,
119
+ this.centerX,
120
+ this.centerY,
121
+ this.exactCenterX,
122
+ this.exactCenterY,
123
+ this.isEmpty
124
+ );
125
+ }
114
126
  }
package/src/Step.ts CHANGED
@@ -55,7 +55,7 @@ export class Step {
55
55
  data?: any | undefined;
56
56
  delayMs?: number;
57
57
  } = {}
58
- ): Promise<Step> {
58
+ ): Promise<Step | undefined> {
59
59
  const stepStore = useStepStore();
60
60
  let implnName = impl.name;
61
61
  let currentStep: Step | undefined;
@@ -64,10 +64,14 @@ export class Step {
64
64
  //步骤开始
65
65
  if (stepId) {
66
66
  this._stepId = stepId;
67
- console.log(`使用传入步骤ID: ${this._stepId}`);
67
+ if (Step.showLog) {
68
+ console.log(`使用传入步骤ID: ${this._stepId}`);
69
+ }
68
70
  } else {
69
71
  this._stepId = generateUUID();
70
- console.log(`生成步骤ID: ${this._stepId}`);
72
+ if (Step.showLog) {
73
+ console.log(`生成步骤ID: ${this._stepId}`);
74
+ }
71
75
  }
72
76
 
73
77
  stepStore.startStep(this._stepId, tag, data);