demowright 2.7.3 → 2.7.5
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/helpers.d.mts +3 -2
- package/dist/helpers.mjs +7 -2
- package/package.json +1 -1
package/dist/helpers.d.mts
CHANGED
|
@@ -13,13 +13,14 @@ declare function hudWait(page: Page, ms: number): Promise<void>;
|
|
|
13
13
|
declare function moveTo(page: Page, x: number, y: number, steps?: number): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Smoothly move the HUD cursor to the center of `selector`.
|
|
16
|
-
* Returns the element center coordinates
|
|
16
|
+
* Returns the element center coordinates, or `null` if the selector
|
|
17
|
+
* doesn't match any element.
|
|
17
18
|
* When HUD is inactive, resolves coordinates but skips the animation.
|
|
18
19
|
*/
|
|
19
20
|
declare function moveToEl(page: Page, selector: string): Promise<{
|
|
20
21
|
x: number;
|
|
21
22
|
y: number;
|
|
22
|
-
}>;
|
|
23
|
+
} | null>;
|
|
23
24
|
/**
|
|
24
25
|
* Animated click on `selector` — moves cursor, fires mousedown/mouseup
|
|
25
26
|
* ripple, then performs the actual DOM click.
|
package/dist/helpers.mjs
CHANGED
|
@@ -54,17 +54,21 @@ async function moveTo(page, x, y, steps = 10) {
|
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Smoothly move the HUD cursor to the center of `selector`.
|
|
57
|
-
* Returns the element center coordinates
|
|
57
|
+
* Returns the element center coordinates, or `null` if the selector
|
|
58
|
+
* doesn't match any element.
|
|
58
59
|
* When HUD is inactive, resolves coordinates but skips the animation.
|
|
59
60
|
*/
|
|
60
61
|
async function moveToEl(page, selector) {
|
|
61
62
|
const center = await page.evaluate((s) => {
|
|
62
|
-
const
|
|
63
|
+
const el = document.querySelector(s);
|
|
64
|
+
if (!el) return null;
|
|
65
|
+
const r = el.getBoundingClientRect();
|
|
63
66
|
return {
|
|
64
67
|
x: r.x + r.width / 2,
|
|
65
68
|
y: r.y + r.height / 2
|
|
66
69
|
};
|
|
67
70
|
}, selector);
|
|
71
|
+
if (!center) return null;
|
|
68
72
|
if (await isHudActive(page)) await moveTo(page, center.x, center.y);
|
|
69
73
|
return center;
|
|
70
74
|
}
|
|
@@ -77,6 +81,7 @@ async function clickEl(page, selector) {
|
|
|
77
81
|
const active = await isHudActive(page);
|
|
78
82
|
if (active) {
|
|
79
83
|
const c = await moveToEl(page, selector);
|
|
84
|
+
if (!c) return;
|
|
80
85
|
await page.waitForTimeout(150);
|
|
81
86
|
await page.evaluate(([x, y]) => {
|
|
82
87
|
document.dispatchEvent(new MouseEvent("mousedown", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "demowright",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"description": "Playwright video production plugin — cursor overlay, keystroke badges, TTS narration, and narration-driven video scripts for test recordings",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|