webmarker-js 0.0.4 → 0.0.6
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/README.md +2 -2
- package/dist/{types.d.ts → index.d.ts} +8 -8
- package/dist/main.js +1023 -274
- package/dist/module.js +1017 -282
- package/esbuild.config.js +28 -0
- package/package.json +10 -10
- package/src/index.ts +8 -6
- package/test-results/.last-run.json +4 -0
- package/dist/main.js.map +0 -1
- package/dist/module.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/README.md
CHANGED
@@ -17,7 +17,7 @@ Mark web pages for use with vision-language models.
|
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
20
|
-
The `mark()` function will add markings for all interactive elements on a web page, and return
|
20
|
+
The `mark()` function will add markings for all interactive elements on a web page, and return an object containing the marked elements. The returned objects's keys are the mark labels, and the values are an object with the element (`element`), mark element (`markElement`), and mask element (`maskElement`).
|
21
21
|
|
22
22
|
```javascript
|
23
23
|
import { mark, unmark } from "webmarker-js";
|
@@ -26,7 +26,7 @@ import { mark, unmark } from "webmarker-js";
|
|
26
26
|
let elements = await mark();
|
27
27
|
|
28
28
|
// Reference an element by label
|
29
|
-
console.log(elements
|
29
|
+
console.log(elements["0"].element);
|
30
30
|
|
31
31
|
// Remove markings
|
32
32
|
unmark();
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
type Placement = "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
|
2
|
+
interface MarkOptions {
|
3
3
|
/**
|
4
4
|
* A CSS selector to specify the elements to be marked.
|
5
5
|
*/
|
@@ -44,13 +44,13 @@ export interface MarkOptions {
|
|
44
44
|
*/
|
45
45
|
viewPortOnly?: boolean;
|
46
46
|
}
|
47
|
-
|
47
|
+
interface MarkedElement {
|
48
48
|
element: Element;
|
49
49
|
markElement: HTMLElement;
|
50
50
|
maskElement?: HTMLElement;
|
51
51
|
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
declare function mark(options?: MarkOptions): Promise<Record<string, MarkedElement>>;
|
53
|
+
declare function unmark(): void;
|
54
|
+
declare function isMarked(): boolean;
|
55
|
+
export { mark, unmark, isMarked };
|
56
|
+
export type { MarkOptions, MarkedElement, Placement };
|