@midscene/harmony 1.17.8-beta-20261110095715.0 → 1.17.8
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/es/600.mjs +29 -0
- package/dist/es/cli.mjs +1 -1
- package/dist/lib/bin.js +29 -0
- package/dist/lib/cli.js +30 -1
- package/dist/lib/index.js +29 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +4 -4
- package/static/index.html +1 -1
- package/static/static/js/{index.2cc08367.js → index.adbc3a23.js} +86 -96
- package/static/static/js/index.adbc3a23.js.map +1 -0
- package/static/static/js/index.2cc08367.js.map +0 -1
- /package/static/static/js/{index.2cc08367.js.LICENSE.txt → index.adbc3a23.js.LICENSE.txt} +0 -0
package/dist/es/600.mjs
CHANGED
|
@@ -682,6 +682,21 @@ class HarmonyDevice {
|
|
|
682
682
|
const hdc = await this.getHdc();
|
|
683
683
|
await hdc.fling(startX, startY, endX, endY, speed ?? defaultFastSwipeSpeed);
|
|
684
684
|
}
|
|
685
|
+
assertScrollDirection(start, end, direction, size) {
|
|
686
|
+
node_assert([
|
|
687
|
+
start.x,
|
|
688
|
+
start.y,
|
|
689
|
+
end.x,
|
|
690
|
+
end.y
|
|
691
|
+
].every(Number.isFinite) && start.x >= 0 && start.x < size.width && start.y >= 0 && start.y < size.height, 'Scroll origin must be finite and inside the viewport');
|
|
692
|
+
const travel = {
|
|
693
|
+
down: start.y - end.y,
|
|
694
|
+
up: end.y - start.y,
|
|
695
|
+
left: end.x - start.x,
|
|
696
|
+
right: start.x - end.x
|
|
697
|
+
}[direction];
|
|
698
|
+
node_assert(Number.isFinite(travel) && travel > 0, `No space to scroll ${direction} from the located point; choose a point farther from the screen edge`);
|
|
699
|
+
}
|
|
685
700
|
async scrollInDirection(direction, distance, startPoint) {
|
|
686
701
|
const { width, height } = await this.size();
|
|
687
702
|
const isVertical = 'up' === direction || 'down' === direction;
|
|
@@ -718,6 +733,13 @@ class HarmonyDevice {
|
|
|
718
733
|
}
|
|
719
734
|
};
|
|
720
735
|
const end = endPoints[direction];
|
|
736
|
+
this.assertScrollDirection({
|
|
737
|
+
x: sx,
|
|
738
|
+
y: sy
|
|
739
|
+
}, end, direction, {
|
|
740
|
+
width,
|
|
741
|
+
height
|
|
742
|
+
});
|
|
721
743
|
await hdc.fling(sx, sy, end.x, end.y, defaultFastSwipeSpeed);
|
|
722
744
|
return;
|
|
723
745
|
}
|
|
@@ -779,6 +801,13 @@ class HarmonyDevice {
|
|
|
779
801
|
}
|
|
780
802
|
};
|
|
781
803
|
const target = flingTargets[direction];
|
|
804
|
+
this.assertScrollDirection({
|
|
805
|
+
x: sx,
|
|
806
|
+
y: sy
|
|
807
|
+
}, target, direction, {
|
|
808
|
+
width,
|
|
809
|
+
height
|
|
810
|
+
});
|
|
782
811
|
await repeat(defaultScrollUntilTimes, ()=>hdc.fling(sx, sy, target.x, target.y, defaultFastSwipeSpeed));
|
|
783
812
|
await sleep(1000);
|
|
784
813
|
return;
|
package/dist/es/cli.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { HarmonyMidsceneTools } from "./430.mjs";
|
|
|
4
4
|
const tools = new HarmonyMidsceneTools();
|
|
5
5
|
runToolsCLI(tools, 'midscene-harmony', {
|
|
6
6
|
stripPrefix: 'harmony_',
|
|
7
|
-
version: "1.17.8
|
|
7
|
+
version: "1.17.8",
|
|
8
8
|
extraCommands: createReportCliCommands()
|
|
9
9
|
}).catch((e)=>{
|
|
10
10
|
process.exit(reportCLIError(e));
|
package/dist/lib/bin.js
CHANGED
|
@@ -862,6 +862,21 @@ var __webpack_exports__ = {};
|
|
|
862
862
|
const hdc = await this.getHdc();
|
|
863
863
|
await hdc.fling(startX, startY, endX, endY, speed ?? defaultFastSwipeSpeed);
|
|
864
864
|
}
|
|
865
|
+
assertScrollDirection(start, end, direction, size) {
|
|
866
|
+
external_node_assert_default()([
|
|
867
|
+
start.x,
|
|
868
|
+
start.y,
|
|
869
|
+
end.x,
|
|
870
|
+
end.y
|
|
871
|
+
].every(Number.isFinite) && start.x >= 0 && start.x < size.width && start.y >= 0 && start.y < size.height, 'Scroll origin must be finite and inside the viewport');
|
|
872
|
+
const travel = {
|
|
873
|
+
down: start.y - end.y,
|
|
874
|
+
up: end.y - start.y,
|
|
875
|
+
left: end.x - start.x,
|
|
876
|
+
right: start.x - end.x
|
|
877
|
+
}[direction];
|
|
878
|
+
external_node_assert_default()(Number.isFinite(travel) && travel > 0, `No space to scroll ${direction} from the located point; choose a point farther from the screen edge`);
|
|
879
|
+
}
|
|
865
880
|
async scrollInDirection(direction, distance, startPoint) {
|
|
866
881
|
const { width, height } = await this.size();
|
|
867
882
|
const isVertical = 'up' === direction || 'down' === direction;
|
|
@@ -898,6 +913,13 @@ var __webpack_exports__ = {};
|
|
|
898
913
|
}
|
|
899
914
|
};
|
|
900
915
|
const end = endPoints[direction];
|
|
916
|
+
this.assertScrollDirection({
|
|
917
|
+
x: sx,
|
|
918
|
+
y: sy
|
|
919
|
+
}, end, direction, {
|
|
920
|
+
width,
|
|
921
|
+
height
|
|
922
|
+
});
|
|
901
923
|
await hdc.fling(sx, sy, end.x, end.y, defaultFastSwipeSpeed);
|
|
902
924
|
return;
|
|
903
925
|
}
|
|
@@ -959,6 +981,13 @@ var __webpack_exports__ = {};
|
|
|
959
981
|
}
|
|
960
982
|
};
|
|
961
983
|
const target = flingTargets[direction];
|
|
984
|
+
this.assertScrollDirection({
|
|
985
|
+
x: sx,
|
|
986
|
+
y: sy
|
|
987
|
+
}, target, direction, {
|
|
988
|
+
width,
|
|
989
|
+
height
|
|
990
|
+
});
|
|
962
991
|
await (0, utils_namespaceObject.repeat)(defaultScrollUntilTimes, ()=>hdc.fling(sx, sy, target.x, target.y, defaultFastSwipeSpeed));
|
|
963
992
|
await (0, core_utils_namespaceObject.sleep)(1000);
|
|
964
993
|
return;
|
package/dist/lib/cli.js
CHANGED
|
@@ -859,6 +859,21 @@ var __webpack_exports__ = {};
|
|
|
859
859
|
const hdc = await this.getHdc();
|
|
860
860
|
await hdc.fling(startX, startY, endX, endY, speed ?? defaultFastSwipeSpeed);
|
|
861
861
|
}
|
|
862
|
+
assertScrollDirection(start, end, direction, size) {
|
|
863
|
+
external_node_assert_default()([
|
|
864
|
+
start.x,
|
|
865
|
+
start.y,
|
|
866
|
+
end.x,
|
|
867
|
+
end.y
|
|
868
|
+
].every(Number.isFinite) && start.x >= 0 && start.x < size.width && start.y >= 0 && start.y < size.height, 'Scroll origin must be finite and inside the viewport');
|
|
869
|
+
const travel = {
|
|
870
|
+
down: start.y - end.y,
|
|
871
|
+
up: end.y - start.y,
|
|
872
|
+
left: end.x - start.x,
|
|
873
|
+
right: start.x - end.x
|
|
874
|
+
}[direction];
|
|
875
|
+
external_node_assert_default()(Number.isFinite(travel) && travel > 0, `No space to scroll ${direction} from the located point; choose a point farther from the screen edge`);
|
|
876
|
+
}
|
|
862
877
|
async scrollInDirection(direction, distance, startPoint) {
|
|
863
878
|
const { width, height } = await this.size();
|
|
864
879
|
const isVertical = 'up' === direction || 'down' === direction;
|
|
@@ -895,6 +910,13 @@ var __webpack_exports__ = {};
|
|
|
895
910
|
}
|
|
896
911
|
};
|
|
897
912
|
const end = endPoints[direction];
|
|
913
|
+
this.assertScrollDirection({
|
|
914
|
+
x: sx,
|
|
915
|
+
y: sy
|
|
916
|
+
}, end, direction, {
|
|
917
|
+
width,
|
|
918
|
+
height
|
|
919
|
+
});
|
|
898
920
|
await hdc.fling(sx, sy, end.x, end.y, defaultFastSwipeSpeed);
|
|
899
921
|
return;
|
|
900
922
|
}
|
|
@@ -956,6 +978,13 @@ var __webpack_exports__ = {};
|
|
|
956
978
|
}
|
|
957
979
|
};
|
|
958
980
|
const target = flingTargets[direction];
|
|
981
|
+
this.assertScrollDirection({
|
|
982
|
+
x: sx,
|
|
983
|
+
y: sy
|
|
984
|
+
}, target, direction, {
|
|
985
|
+
width,
|
|
986
|
+
height
|
|
987
|
+
});
|
|
959
988
|
await (0, utils_namespaceObject.repeat)(defaultScrollUntilTimes, ()=>hdc.fling(sx, sy, target.x, target.y, defaultFastSwipeSpeed));
|
|
960
989
|
await (0, core_utils_namespaceObject.sleep)(1000);
|
|
961
990
|
return;
|
|
@@ -1362,7 +1391,7 @@ var __webpack_exports__ = {};
|
|
|
1362
1391
|
const tools = new HarmonyMidsceneTools();
|
|
1363
1392
|
(0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-harmony', {
|
|
1364
1393
|
stripPrefix: 'harmony_',
|
|
1365
|
-
version: "1.17.8
|
|
1394
|
+
version: "1.17.8",
|
|
1366
1395
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
1367
1396
|
}).catch((e)=>{
|
|
1368
1397
|
process.exit((0, cli_namespaceObject.reportCLIError)(e));
|
package/dist/lib/index.js
CHANGED
|
@@ -848,6 +848,21 @@ var __webpack_exports__ = {};
|
|
|
848
848
|
const hdc = await this.getHdc();
|
|
849
849
|
await hdc.fling(startX, startY, endX, endY, speed ?? defaultFastSwipeSpeed);
|
|
850
850
|
}
|
|
851
|
+
assertScrollDirection(start, end, direction, size) {
|
|
852
|
+
external_node_assert_default()([
|
|
853
|
+
start.x,
|
|
854
|
+
start.y,
|
|
855
|
+
end.x,
|
|
856
|
+
end.y
|
|
857
|
+
].every(Number.isFinite) && start.x >= 0 && start.x < size.width && start.y >= 0 && start.y < size.height, 'Scroll origin must be finite and inside the viewport');
|
|
858
|
+
const travel = {
|
|
859
|
+
down: start.y - end.y,
|
|
860
|
+
up: end.y - start.y,
|
|
861
|
+
left: end.x - start.x,
|
|
862
|
+
right: start.x - end.x
|
|
863
|
+
}[direction];
|
|
864
|
+
external_node_assert_default()(Number.isFinite(travel) && travel > 0, `No space to scroll ${direction} from the located point; choose a point farther from the screen edge`);
|
|
865
|
+
}
|
|
851
866
|
async scrollInDirection(direction, distance, startPoint) {
|
|
852
867
|
const { width, height } = await this.size();
|
|
853
868
|
const isVertical = 'up' === direction || 'down' === direction;
|
|
@@ -884,6 +899,13 @@ var __webpack_exports__ = {};
|
|
|
884
899
|
}
|
|
885
900
|
};
|
|
886
901
|
const end = endPoints[direction];
|
|
902
|
+
this.assertScrollDirection({
|
|
903
|
+
x: sx,
|
|
904
|
+
y: sy
|
|
905
|
+
}, end, direction, {
|
|
906
|
+
width,
|
|
907
|
+
height
|
|
908
|
+
});
|
|
887
909
|
await hdc.fling(sx, sy, end.x, end.y, defaultFastSwipeSpeed);
|
|
888
910
|
return;
|
|
889
911
|
}
|
|
@@ -945,6 +967,13 @@ var __webpack_exports__ = {};
|
|
|
945
967
|
}
|
|
946
968
|
};
|
|
947
969
|
const target = flingTargets[direction];
|
|
970
|
+
this.assertScrollDirection({
|
|
971
|
+
x: sx,
|
|
972
|
+
y: sy
|
|
973
|
+
}, target, direction, {
|
|
974
|
+
width,
|
|
975
|
+
height
|
|
976
|
+
});
|
|
948
977
|
await (0, shared_utils_namespaceObject.repeat)(defaultScrollUntilTimes, ()=>hdc.fling(sx, sy, target.x, target.y, defaultFastSwipeSpeed));
|
|
949
978
|
await (0, utils_namespaceObject.sleep)(1000);
|
|
950
979
|
return;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ export declare class HarmonyDevice implements AbstractInterface {
|
|
|
106
106
|
clearInput(element?: ElementInfo): Promise<void>;
|
|
107
107
|
private pressKey;
|
|
108
108
|
scroll(deltaX: number, deltaY: number, speed?: number): Promise<void>;
|
|
109
|
+
private assertScrollDirection;
|
|
109
110
|
private scrollInDirection;
|
|
110
111
|
scrollDown(distance?: number, startPoint?: Point): Promise<void>;
|
|
111
112
|
scrollUp(distance?: number, startPoint?: Point): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/harmony",
|
|
3
|
-
"version": "1.17.8
|
|
3
|
+
"version": "1.17.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/midscene.git",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"@inquirer/prompts": "^7.8.6",
|
|
48
48
|
"open": "10.1.0",
|
|
49
49
|
"zod": "^3.25.1",
|
|
50
|
-
"@midscene/core": "1.17.8
|
|
51
|
-
"@midscene/
|
|
52
|
-
"@midscene/
|
|
50
|
+
"@midscene/core": "1.17.8",
|
|
51
|
+
"@midscene/shared": "1.17.8",
|
|
52
|
+
"@midscene/playground": "1.17.8"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@rslib/core": "~0.19.6",
|
package/static/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.d4684574.js"></script><script defer src="/static/js/208.eb5899a1.js"></script><script defer src="/static/js/index.
|
|
1
|
+
<!DOCTYPE html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.d4684574.js"></script><script defer src="/static/js/208.eb5899a1.js"></script><script defer src="/static/js/index.adbc3a23.js"></script><link href="/static/css/index.67caac18.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
|