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 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 a Map of the marked elements. The returned Map's keys are the mark labels, and the values are an object with the element (`element`), mark element (`markElement`), and mask element (`markElement`).
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.get("0").element);
29
+ console.log(elements["0"].element);
30
30
 
31
31
  // Remove markings
32
32
  unmark();
@@ -1,5 +1,5 @@
1
- export type Placement = "top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end";
2
- export interface MarkOptions {
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
- export interface MarkedElement {
47
+ interface MarkedElement {
48
48
  element: Element;
49
49
  markElement: HTMLElement;
50
50
  maskElement?: HTMLElement;
51
51
  }
52
- export function mark(options?: MarkOptions): Promise<Map<string, MarkedElement>>;
53
- export function unmark(): void;
54
- export function isMarked(): boolean;
55
-
56
- //# sourceMappingURL=types.d.ts.map
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 };