webmarker-js 0.5.0 → 0.7.0
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/main.js +4 -4
- package/dist/module.js +4 -4
- package/package.json +2 -2
- package/playwright-report/index.html +68 -0
- package/src/index.ts +4 -3
- package/chrome-extension/dist/index.d.ts +0 -72
- package/chrome-extension/dist/main.js +0 -1069
- package/chrome-extension/dist/module.js +0 -1048
package/README.md
CHANGED
@@ -87,7 +87,7 @@ await page.evaluate(async () => await WebMarker.unmark());
|
|
87
87
|
A custom CSS selector to specify which elements to mark.
|
88
88
|
|
89
89
|
- Type: `string`
|
90
|
-
- Default: `
|
90
|
+
- Default: `'a[href], button, input:not([type="hidden"]), select, textarea, summary, [role="button"], [tabindex]:not([tabindex="-1"])'`
|
91
91
|
|
92
92
|
### getLabel
|
93
93
|
|
@@ -158,7 +158,7 @@ const markedElements = mark({
|
|
158
158
|
// Use a blue dashed outline with a transparent and slighly blue background
|
159
159
|
boundingBoxStyle: { outline: "2px dashed blue", backgroundColor: "rgba(0, 0, 255, 0.1)"},
|
160
160
|
// Place the mark at the top right corner of the element
|
161
|
-
markPlacement: "top-end"
|
161
|
+
markPlacement: "top-end",
|
162
162
|
// Show bounding boxes over elements (defaults to true)
|
163
163
|
showBoundingBoxes: true,
|
164
164
|
// Generate labels as 'Element 0', 'Element 1', 'Element 2'...
|
package/dist/main.js
CHANGED
@@ -931,7 +931,7 @@ var WebMarker = (() => {
|
|
931
931
|
function mark(options = {}) {
|
932
932
|
try {
|
933
933
|
const {
|
934
|
-
selector =
|
934
|
+
selector = 'a[href], button, input:not([type="hidden"]), select, textarea, summary, [role="button"], [tabindex]:not([tabindex="-1"])',
|
935
935
|
getLabel = (_, index) => index.toString(),
|
936
936
|
markAttribute = "data-mark-label",
|
937
937
|
markPlacement = "top-start",
|
@@ -972,7 +972,7 @@ var WebMarker = (() => {
|
|
972
972
|
markClass
|
973
973
|
);
|
974
974
|
fragment.appendChild(markElement);
|
975
|
-
const boundingBoxElement = showBoundingBoxes ? createBoundingBox(element, boundingBoxStyle, label, boundingBoxClass) : void 0;
|
975
|
+
const boundingBoxElement = showBoundingBoxes ? createBoundingBox(element, index, boundingBoxStyle, label, boundingBoxClass) : void 0;
|
976
976
|
if (boundingBoxElement) {
|
977
977
|
fragment.appendChild(boundingBoxElement);
|
978
978
|
}
|
@@ -1010,7 +1010,7 @@ var WebMarker = (() => {
|
|
1010
1010
|
);
|
1011
1011
|
return markElement;
|
1012
1012
|
}
|
1013
|
-
function createBoundingBox(element, style, label, boundingBoxClass) {
|
1013
|
+
function createBoundingBox(element, index, style, label, boundingBoxClass) {
|
1014
1014
|
const boundingBoxElement = document.createElement("div");
|
1015
1015
|
boundingBoxElement.className = `webmarker-bounding-box ${boundingBoxClass}`.trim();
|
1016
1016
|
boundingBoxElement.id = `webmarker-bounding-box-${label}`;
|
@@ -1031,7 +1031,7 @@ var WebMarker = (() => {
|
|
1031
1031
|
position: "absolute",
|
1032
1032
|
pointerEvents: "none"
|
1033
1033
|
},
|
1034
|
-
typeof style === "function" ? style(element,
|
1034
|
+
typeof style === "function" ? style(element, index) : style
|
1035
1035
|
);
|
1036
1036
|
return boundingBoxElement;
|
1037
1037
|
}
|
package/dist/module.js
CHANGED
@@ -907,7 +907,7 @@ var cleanupFns = [];
|
|
907
907
|
function mark(options = {}) {
|
908
908
|
try {
|
909
909
|
const {
|
910
|
-
selector =
|
910
|
+
selector = 'a[href], button, input:not([type="hidden"]), select, textarea, summary, [role="button"], [tabindex]:not([tabindex="-1"])',
|
911
911
|
getLabel = (_, index) => index.toString(),
|
912
912
|
markAttribute = "data-mark-label",
|
913
913
|
markPlacement = "top-start",
|
@@ -948,7 +948,7 @@ function mark(options = {}) {
|
|
948
948
|
markClass
|
949
949
|
);
|
950
950
|
fragment.appendChild(markElement);
|
951
|
-
const boundingBoxElement = showBoundingBoxes ? createBoundingBox(element, boundingBoxStyle, label, boundingBoxClass) : void 0;
|
951
|
+
const boundingBoxElement = showBoundingBoxes ? createBoundingBox(element, index, boundingBoxStyle, label, boundingBoxClass) : void 0;
|
952
952
|
if (boundingBoxElement) {
|
953
953
|
fragment.appendChild(boundingBoxElement);
|
954
954
|
}
|
@@ -986,7 +986,7 @@ function createMark(element, index, style, label, markPlacement = "top-start", m
|
|
986
986
|
);
|
987
987
|
return markElement;
|
988
988
|
}
|
989
|
-
function createBoundingBox(element, style, label, boundingBoxClass) {
|
989
|
+
function createBoundingBox(element, index, style, label, boundingBoxClass) {
|
990
990
|
const boundingBoxElement = document.createElement("div");
|
991
991
|
boundingBoxElement.className = `webmarker-bounding-box ${boundingBoxClass}`.trim();
|
992
992
|
boundingBoxElement.id = `webmarker-bounding-box-${label}`;
|
@@ -1007,7 +1007,7 @@ function createBoundingBox(element, style, label, boundingBoxClass) {
|
|
1007
1007
|
position: "absolute",
|
1008
1008
|
pointerEvents: "none"
|
1009
1009
|
},
|
1010
|
-
typeof style === "function" ? style(element,
|
1010
|
+
typeof style === "function" ? style(element, index) : style
|
1011
1011
|
);
|
1012
1012
|
return boundingBoxElement;
|
1013
1013
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webmarker-js",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.7.0",
|
4
4
|
"description": "A library for marking web pages for Set-of-Mark prompting with vision-language models.",
|
5
5
|
"source": "src/index.ts",
|
6
6
|
"main": "dist/main.js",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"docs:dev": "cd docs && next",
|
15
15
|
"docs:build": "cd docs && next build",
|
16
16
|
"docs:start": "cd docs && next start",
|
17
|
-
"test:playwright": "
|
17
|
+
"test:playwright": "npx playwright test"
|
18
18
|
},
|
19
19
|
"author": "Reid Barber",
|
20
20
|
"license": "MIT",
|