@rickcedwhat/playwright-smart-vision 0.2.0-next.c748f46 → 0.2.0-next.ea65044
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/devtools.d.ts.map +1 -1
- package/dist/devtools.js +14 -40
- package/dist/devtools.js.map +1 -1
- package/package.json +1 -1
package/dist/devtools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAoQ7C,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAa9D"}
|
package/dist/devtools.js
CHANGED
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
import { writeScreenBuffer } from './configure.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (!input || e.target !== input) return;
|
|
10
|
-
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
11
|
-
|
|
12
|
-
const start = input.selectionStart ?? input.value.length;
|
|
13
|
-
const end = input.selectionEnd ?? input.value.length;
|
|
14
|
-
|
|
15
|
-
if (e.key.length === 1) {
|
|
16
|
-
input.value = input.value.slice(0, start) + e.key + input.value.slice(end);
|
|
17
|
-
input.setSelectionRange(start + 1, start + 1);
|
|
18
|
-
} else if (e.key === 'Backspace') {
|
|
19
|
-
if (start !== end) {
|
|
20
|
-
input.value = input.value.slice(0, start) + input.value.slice(end);
|
|
21
|
-
input.setSelectionRange(start, start);
|
|
22
|
-
} else if (start > 0) {
|
|
23
|
-
input.value = input.value.slice(0, start - 1) + input.value.slice(end);
|
|
24
|
-
input.setSelectionRange(start - 1, start - 1);
|
|
2
|
+
const FAB_SCRIPT = `(function () {
|
|
3
|
+
if (!window.__ocrKeyboardShield) {
|
|
4
|
+
window.__ocrKeyboardShield = true;
|
|
5
|
+
const shield = (e) => {
|
|
6
|
+
const backdrop = document.getElementById('__ocr-modal-backdrop');
|
|
7
|
+
if (backdrop && backdrop.contains(e.target)) {
|
|
8
|
+
e.stopImmediatePropagation();
|
|
25
9
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
document.getElementById('__ocr-modal-backdrop')?.remove();
|
|
30
|
-
} else {
|
|
31
|
-
return;
|
|
10
|
+
};
|
|
11
|
+
for (const type of ['keydown', 'keyup', 'keypress']) {
|
|
12
|
+
document.addEventListener(type, shield, true);
|
|
32
13
|
}
|
|
14
|
+
}
|
|
33
15
|
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
e.stopImmediatePropagation();
|
|
36
|
-
}, true);
|
|
37
|
-
})();`;
|
|
38
|
-
const FAB_SCRIPT = `(function () {
|
|
39
16
|
if (window.__ocrDevtools) return;
|
|
40
17
|
window.__ocrDevtools = true;
|
|
41
18
|
|
|
@@ -53,6 +30,8 @@ const FAB_SCRIPT = `(function () {
|
|
|
53
30
|
right: 20px;
|
|
54
31
|
z-index: 2147483647;
|
|
55
32
|
font-family: system-ui, sans-serif;
|
|
33
|
+
display: block;
|
|
34
|
+
line-height: 0;
|
|
56
35
|
}
|
|
57
36
|
#__ocr-fab-btn {
|
|
58
37
|
width: 48px;
|
|
@@ -100,7 +79,6 @@ const FAB_SCRIPT = `(function () {
|
|
|
100
79
|
border: none;
|
|
101
80
|
color: #e2e8f0;
|
|
102
81
|
font-size: 13px;
|
|
103
|
-
line-height: 1.4;
|
|
104
82
|
cursor: pointer;
|
|
105
83
|
white-space: nowrap;
|
|
106
84
|
text-align: left;
|
|
@@ -185,9 +163,7 @@ const FAB_SCRIPT = `(function () {
|
|
|
185
163
|
}
|
|
186
164
|
}
|
|
187
165
|
|
|
188
|
-
fab
|
|
189
|
-
fab.addEventListener('mouseup', (e) => e.stopPropagation());
|
|
190
|
-
fab.addEventListener('click', (e) => e.stopPropagation());
|
|
166
|
+
isolateFromPage(fab);
|
|
191
167
|
|
|
192
168
|
(document.body || document.documentElement).appendChild(fab);
|
|
193
169
|
|
|
@@ -288,9 +264,7 @@ export async function injectDevtools(page) {
|
|
|
288
264
|
writeScreenBuffer(name, Buffer.from(b64, 'base64'));
|
|
289
265
|
});
|
|
290
266
|
// addInitScript covers future navigations; evaluate covers the already-loaded page.
|
|
291
|
-
await page.addInitScript(NAME_INPUT_SHIELD);
|
|
292
267
|
await page.addInitScript(FAB_SCRIPT);
|
|
293
|
-
await page.evaluate(NAME_INPUT_SHIELD);
|
|
294
268
|
await page.evaluate(FAB_SCRIPT);
|
|
295
269
|
}
|
|
296
270
|
//# sourceMappingURL=devtools.js.map
|
package/dist/devtools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,
|
|
1
|
+
{"version":3,"file":"devtools.js","sourceRoot":"","sources":["../src/devtools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+Pb,CAAC;AAEP,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAU;IAC7C,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,KAAK,IAAqB,EAAE;QACpE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,IAAY,EAAE,GAAW,EAAiB,EAAE;QACxF,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,oFAAoF;IACpF,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rickcedwhat/playwright-smart-vision",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.ea65044",
|
|
4
4
|
"description": "Computer-vision and OCR-based element assertions for Playwright — local, fast, no GPT Vision required",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|