agentation-vue 0.2.2 → 0.2.4

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.
Files changed (37) hide show
  1. package/dist/AgentationVue.vue +411 -528
  2. package/dist/components/AgentationToolbar.vue +49 -76
  3. package/dist/components/AnnotationInput.vue +30 -40
  4. package/dist/components/AnnotationMarker.vue +20 -25
  5. package/dist/components/ComponentChain.vue +19 -29
  6. package/dist/components/ElementHighlight.vue +13 -16
  7. package/dist/components/SettingsPanel.vue +29 -41
  8. package/dist/components/SettingsPopover.vue +128 -159
  9. package/dist/components/VaButton.vue +6 -12
  10. package/dist/components/VaIcon.vue +5 -5
  11. package/dist/components/VaIconButton.vue +15 -23
  12. package/dist/components/VaToggle.vue +7 -8
  13. package/package.json +7 -12
  14. package/dist/composables/useAnimationPause.js +0 -52
  15. package/dist/composables/useAnnotations.js +0 -106
  16. package/dist/composables/useAreaSelect.js +0 -62
  17. package/dist/composables/useElementDetection.js +0 -85
  18. package/dist/composables/useInteractionMode.js +0 -29
  19. package/dist/composables/useKeyboardShortcuts.js +0 -202
  20. package/dist/composables/useMarkerPositions.js +0 -45
  21. package/dist/composables/useMultiSelect.js +0 -108
  22. package/dist/composables/useOutputFormatter.js +0 -100
  23. package/dist/composables/useSettings.js +0 -48
  24. package/dist/composables/useTextSelection.js +0 -33
  25. package/dist/composables/useToolbarAutoHide.js +0 -270
  26. package/dist/composables/useToolbarDragSnap.js +0 -296
  27. package/dist/constants.js +0 -8
  28. package/dist/directives/vaTooltip.js +0 -241
  29. package/dist/icons.js +0 -21
  30. package/dist/index.js +0 -168
  31. package/dist/types.js +0 -1
  32. package/dist/utils/clipboard.js +0 -22
  33. package/dist/utils/dom-inspector.js +0 -168
  34. package/dist/utils/math.js +0 -9
  35. package/dist/utils/portal.js +0 -18
  36. package/dist/utils/selectors.js +0 -103
  37. package/dist/utils/style.js +0 -14
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAreaSelect = useAreaSelect;
7
- var _vueDemi = require("vue-demi");
8
- function useAreaSelect(mode, transitionFn) {
9
- const areaRect = (0, _vueDemi.ref)(null);
10
- const isAreaMode = (0, _vueDemi.ref)(false);
11
- let startX = 0;
12
- let startY = 0;
13
- function toggleAreaMode() {
14
- isAreaMode.value = !isAreaMode.value;
15
- }
16
- function onMouseDown(e) {
17
- const shouldActivate = mode.value === "inspect" && e.altKey || mode.value === "inspect" && isAreaMode.value;
18
- if (!shouldActivate) return false;
19
- e.preventDefault();
20
- document.documentElement.style.userSelect = "none";
21
- startX = e.clientX;
22
- startY = e.clientY;
23
- areaRect.value = {
24
- x: startX,
25
- y: startY,
26
- width: 0,
27
- height: 0
28
- };
29
- transitionFn("area-selecting");
30
- return true;
31
- }
32
- function onMouseMove(e) {
33
- if (mode.value !== "area-selecting") return;
34
- const x = Math.min(startX, e.clientX);
35
- const y = Math.min(startY, e.clientY);
36
- const width = Math.abs(e.clientX - startX);
37
- const height = Math.abs(e.clientY - startY);
38
- areaRect.value = {
39
- x,
40
- y,
41
- width,
42
- height
43
- };
44
- }
45
- function onMouseUp() {
46
- if (mode.value !== "area-selecting") return;
47
- document.documentElement.style.userSelect = "";
48
- }
49
- function reset() {
50
- areaRect.value = null;
51
- document.documentElement.style.userSelect = "";
52
- }
53
- return {
54
- areaRect,
55
- isAreaMode,
56
- toggleAreaMode,
57
- onMouseDown,
58
- onMouseMove,
59
- onMouseUp,
60
- reset
61
- };
62
- }
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useElementDetection = useElementDetection;
7
- var _vueDemi = require("vue-demi");
8
- var _constants = require("../constants");
9
- var _domInspector = require("../utils/dom-inspector");
10
- var _selectors = require("../utils/selectors");
11
- function useElementDetection(overlayRef, showComponentTree) {
12
- const hoveredElement = (0, _vueDemi.ref)(null);
13
- const hoveredRect = (0, _vueDemi.ref)(null);
14
- const hoveredName = (0, _vueDemi.ref)("");
15
- const hoveredComponentChain = (0, _vueDemi.ref)();
16
- let lastElement = null;
17
- let rafId = null;
18
- function getElementUnderOverlay(e) {
19
- const overlay = overlayRef.value;
20
- if (!overlay) return document.elementFromPoint(e.clientX, e.clientY);
21
- const previousPointerEvents = overlay.style.pointerEvents;
22
- overlay.style.pointerEvents = "none";
23
- const el = document.elementFromPoint(e.clientX, e.clientY);
24
- overlay.style.pointerEvents = previousPointerEvents;
25
- return el;
26
- }
27
- function clearHighlight() {
28
- hoveredElement.value = null;
29
- hoveredRect.value = null;
30
- hoveredName.value = "";
31
- hoveredComponentChain.value = void 0;
32
- lastElement = null;
33
- }
34
- function updateHighlight(el) {
35
- const rect = el.getBoundingClientRect();
36
- hoveredElement.value = el;
37
- hoveredRect.value = {
38
- x: rect.left,
39
- y: rect.top,
40
- width: rect.width,
41
- height: rect.height
42
- };
43
- hoveredName.value = (0, _selectors.getElementName)(el);
44
- if (showComponentTree?.()) {
45
- hoveredComponentChain.value = (0, _domInspector.detectVueComponents)(el);
46
- } else {
47
- hoveredComponentChain.value = void 0;
48
- }
49
- }
50
- function onMouseMove(e) {
51
- if (rafId !== null) return;
52
- rafId = requestAnimationFrame(() => {
53
- rafId = null;
54
- const el = getElementUnderOverlay(e);
55
- if (el === lastElement) return;
56
- if (el?.closest(_constants.VA_DATA_ATTR_SELECTOR)) {
57
- clearHighlight();
58
- return;
59
- }
60
- lastElement = el;
61
- if (el) {
62
- updateHighlight(el);
63
- } else {
64
- clearHighlight();
65
- }
66
- });
67
- }
68
- function cleanup() {
69
- if (rafId !== null) {
70
- cancelAnimationFrame(rafId);
71
- rafId = null;
72
- }
73
- clearHighlight();
74
- }
75
- return {
76
- hoveredElement,
77
- hoveredRect,
78
- hoveredName,
79
- hoveredComponentChain,
80
- onMouseMove,
81
- clearHighlight,
82
- getElementUnderOverlay,
83
- cleanup
84
- };
85
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useInteractionMode = useInteractionMode;
7
- var _vueDemi = require("vue-demi");
8
- function useInteractionMode() {
9
- const mode = (0, _vueDemi.ref)("idle");
10
- const allowedTransitions = {
11
- "idle": ["inspect"],
12
- "inspect": ["idle", "input-open", "multi-selecting", "area-selecting"],
13
- "multi-selecting": ["input-open", "inspect"],
14
- "area-selecting": ["input-open", "inspect"],
15
- "input-open": ["inspect", "idle"]
16
- };
17
- function transition(to) {
18
- if (allowedTransitions[mode.value]?.includes(to)) {
19
- mode.value = to;
20
- return true;
21
- }
22
- console.warn(`[agentation-vue] Invalid transition: ${mode.value} \u2192 ${to}`);
23
- return false;
24
- }
25
- return {
26
- mode,
27
- transition
28
- };
29
- }
@@ -1,202 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DEFAULT_SHORTCUT_CONFIG = void 0;
7
- exports.useKeyboardShortcuts = useKeyboardShortcuts;
8
- var _vueDemi = require("vue-demi");
9
- var _constants = require("../constants");
10
- const DEFAULT_KEYMAP = {
11
- "activate": "",
12
- "element-select": "v",
13
- "area-select": "a",
14
- "pause-animations": "p",
15
- "copy": "c",
16
- "clear": "Backspace",
17
- "settings": "",
18
- "minimize": "Escape"
19
- };
20
- const DEFAULT_SHORTCUT_CONFIG = exports.DEFAULT_SHORTCUT_CONFIG = {
21
- enabledWhenClosed: true,
22
- priorityWhenOpen: true,
23
- doubleTap: {
24
- enabled: true,
25
- key: "Shift",
26
- thresholdMs: 280
27
- },
28
- keymap: {},
29
- conflictPolicy: "ignore-editables"
30
- };
31
- const BROWSER_BLACKLIST = /* @__PURE__ */new Set(["Meta+l", "Meta+t", "Meta+w", "Meta+r", "Meta+n", "Meta+q", "Meta+Shift+t", "Meta+Shift+n", "Control+l", "Control+t", "Control+w", "Control+r", "Control+n", "Control+q", "Control+Shift+t", "Control+Shift+n", "Meta+c", "Meta+v", "Meta+x", "Meta+a", "Meta+z", "Control+c", "Control+v", "Control+x", "Control+a", "Control+z"]);
32
- function useKeyboardShortcuts(options) {
33
- const {
34
- mode,
35
- settingsOpen,
36
- toolbarRef,
37
- isInteractionLocked,
38
- actions
39
- } = options;
40
- let lastActivationKeyUpTime = 0;
41
- let listenerAttached = false;
42
- let mergedKeymap = {
43
- ...DEFAULT_KEYMAP,
44
- ...options.config.value.keymap
45
- };
46
- (0, _vueDemi.watch)(options.config, cfg2 => {
47
- mergedKeymap = {
48
- ...DEFAULT_KEYMAP,
49
- ...cfg2.keymap
50
- };
51
- });
52
- function cfg() {
53
- return options.config.value;
54
- }
55
- function getCurrentScope() {
56
- if (mode.value === "idle" && (!toolbarRef.value || !toolbarRef.value.expanded)) {
57
- return "closed";
58
- }
59
- if (settingsOpen.value) {
60
- return "settings";
61
- }
62
- if (mode.value === "input-open") {
63
- return "input";
64
- }
65
- return "open";
66
- }
67
- function isForeignEditable() {
68
- const active = document.activeElement;
69
- if (!active) return false;
70
- const tag = active.tagName.toLowerCase();
71
- const isEditable = tag === "input" || tag === "textarea" || active.isContentEditable;
72
- if (!isEditable) return false;
73
- return !active.closest(_constants.VA_DATA_ATTR_SELECTOR);
74
- }
75
- function isBrowserCombo(e) {
76
- if (!e.metaKey && !e.ctrlKey) return false;
77
- const parts = [];
78
- if (e.metaKey) parts.push("Meta");
79
- if (e.ctrlKey) parts.push("Control");
80
- if (e.shiftKey) parts.push("Shift");
81
- parts.push(e.key);
82
- return BROWSER_BLACKLIST.has(parts.join("+"));
83
- }
84
- function findActionForKey(key) {
85
- const normalized = key.toLowerCase();
86
- for (const [action, mappedKey] of Object.entries(mergedKeymap)) {
87
- if (!mappedKey) continue;
88
- if (mappedKey.toLowerCase() === normalized || mappedKey === key) {
89
- return action;
90
- }
91
- }
92
- return null;
93
- }
94
- function executeAction(action) {
95
- switch (action) {
96
- case "element-select":
97
- actions.elementSelect();
98
- break;
99
- case "area-select":
100
- actions.areaSelect();
101
- break;
102
- case "pause-animations":
103
- actions.pauseAnimations();
104
- break;
105
- case "copy":
106
- actions.copy();
107
- break;
108
- case "clear":
109
- actions.clear();
110
- break;
111
- case "settings":
112
- actions.openSettings();
113
- break;
114
- case "minimize":
115
- actions.deactivate();
116
- if (toolbarRef.value) toolbarRef.value.expanded = false;
117
- break;
118
- }
119
- }
120
- function consume(e) {
121
- e.preventDefault();
122
- e.stopPropagation();
123
- }
124
- function onKeyDown(e) {
125
- if (e.repeat) return;
126
- if (isBrowserCombo(e)) return;
127
- const hasModifier = e.metaKey || e.ctrlKey || e.altKey;
128
- const scope = getCurrentScope();
129
- if (scope === "closed") {
130
- return;
131
- }
132
- if (scope === "settings") {
133
- if (e.key === "Escape") {
134
- consume(e);
135
- actions.closeSettings();
136
- }
137
- return;
138
- }
139
- if (scope === "input") {
140
- if (e.key === "Escape") {
141
- consume(e);
142
- actions.inputCancel();
143
- }
144
- return;
145
- }
146
- if (cfg().conflictPolicy === "ignore-editables" && isForeignEditable()) return;
147
- if (isInteractionLocked()) return;
148
- if (hasModifier) return;
149
- const action = findActionForKey(e.key);
150
- if (!action) return;
151
- if (cfg().priorityWhenOpen) {
152
- consume(e);
153
- }
154
- executeAction(action);
155
- }
156
- function onKeyUp(e) {
157
- const {
158
- doubleTap
159
- } = cfg();
160
- if (!doubleTap.enabled) return;
161
- if (e.key !== doubleTap.key) return;
162
- if (e.repeat) return;
163
- const now = Date.now();
164
- const delta = now - lastActivationKeyUpTime;
165
- lastActivationKeyUpTime = now;
166
- if (delta < doubleTap.thresholdMs && delta > 50) {
167
- lastActivationKeyUpTime = 0;
168
- const scope = getCurrentScope();
169
- if (scope === "closed") {
170
- actions.activate();
171
- if (toolbarRef.value) toolbarRef.value.expanded = true;
172
- } else if (scope === "open") {
173
- actions.deactivate();
174
- if (toolbarRef.value) toolbarRef.value.expanded = false;
175
- }
176
- }
177
- }
178
- function onBlurOrVisibility() {
179
- lastActivationKeyUpTime = 0;
180
- }
181
- function attach() {
182
- if (listenerAttached) return;
183
- listenerAttached = true;
184
- document.addEventListener("keydown", onKeyDown, true);
185
- document.addEventListener("keyup", onKeyUp, true);
186
- window.addEventListener("blur", onBlurOrVisibility);
187
- document.addEventListener("visibilitychange", onBlurOrVisibility);
188
- }
189
- function detach() {
190
- if (!listenerAttached) return;
191
- listenerAttached = false;
192
- document.removeEventListener("keydown", onKeyDown, true);
193
- document.removeEventListener("keyup", onKeyUp, true);
194
- window.removeEventListener("blur", onBlurOrVisibility);
195
- document.removeEventListener("visibilitychange", onBlurOrVisibility);
196
- }
197
- (0, _vueDemi.onMounted)(attach);
198
- (0, _vueDemi.onBeforeUnmount)(detach);
199
- return {
200
- cleanup: detach
201
- };
202
- }
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useMarkerPositions = useMarkerPositions;
7
- var _vueDemi = require("vue-demi");
8
- function useMarkerPositions(annotations) {
9
- let resizeObserver = null;
10
- let rafId = null;
11
- function recalculatePositions() {
12
- if (rafId !== null) return;
13
- rafId = requestAnimationFrame(() => {
14
- rafId = null;
15
- for (const annotation of annotations.value) {
16
- const el = annotation._targetRef?.deref();
17
- if (!el) continue;
18
- const rect = el.getBoundingClientRect();
19
- const scrollTop = window.scrollY || document.documentElement.scrollTop;
20
- annotation.x = (rect.left + rect.width / 2) / window.innerWidth * 100;
21
- annotation.y = annotation.isFixed ? rect.top + rect.height / 2 : rect.top + rect.height / 2 + scrollTop;
22
- }
23
- });
24
- }
25
- (0, _vueDemi.onMounted)(() => {
26
- window.addEventListener("resize", recalculatePositions, {
27
- passive: true
28
- });
29
- window.addEventListener("scroll", recalculatePositions, {
30
- passive: true
31
- });
32
- resizeObserver = new ResizeObserver(recalculatePositions);
33
- const appRoot = document.querySelector("#app") || document.body;
34
- resizeObserver.observe(appRoot);
35
- });
36
- (0, _vueDemi.onBeforeUnmount)(() => {
37
- window.removeEventListener("resize", recalculatePositions);
38
- window.removeEventListener("scroll", recalculatePositions);
39
- resizeObserver?.disconnect();
40
- if (rafId !== null) cancelAnimationFrame(rafId);
41
- });
42
- return {
43
- recalculatePositions
44
- };
45
- }
@@ -1,108 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useMultiSelect = useMultiSelect;
7
- var _vueDemi = require("vue-demi");
8
- var _constants = require("../constants");
9
- const LEAF_TAGS = /* @__PURE__ */new Set(["button", "a", "input", "img"]);
10
- function useMultiSelect(mode, transitionFn) {
11
- const selectionRect = (0, _vueDemi.ref)(null);
12
- const selectedElements = (0, _vueDemi.ref)([]);
13
- let startX = 0;
14
- let startY = 0;
15
- let cachedElements = [];
16
- let rafId = null;
17
- function cacheElements() {
18
- cachedElements = [];
19
- for (const el of document.querySelectorAll("body *")) {
20
- if (el.closest(_constants.VA_DATA_ATTR_SELECTOR)) continue;
21
- const rect = el.getBoundingClientRect();
22
- if (rect.width === 0 || rect.height === 0) continue;
23
- const isLeaf = el.children.length === 0 || LEAF_TAGS.has(el.tagName.toLowerCase());
24
- if (isLeaf) {
25
- cachedElements.push({
26
- el,
27
- rect,
28
- isLeaf
29
- });
30
- }
31
- }
32
- }
33
- function onMouseDown(e) {
34
- if (mode.value !== "inspect" || !e.shiftKey) return false;
35
- e.preventDefault();
36
- document.documentElement.style.userSelect = "none";
37
- startX = e.clientX;
38
- startY = e.clientY;
39
- selectionRect.value = {
40
- x: startX,
41
- y: startY,
42
- width: 0,
43
- height: 0
44
- };
45
- transitionFn("multi-selecting");
46
- cacheElements();
47
- return true;
48
- }
49
- function onMouseMove(e) {
50
- if (mode.value !== "multi-selecting") return;
51
- const x = Math.min(startX, e.clientX);
52
- const y = Math.min(startY, e.clientY);
53
- const width = Math.abs(e.clientX - startX);
54
- const height = Math.abs(e.clientY - startY);
55
- selectionRect.value = {
56
- x,
57
- y,
58
- width,
59
- height
60
- };
61
- if (rafId !== null) return;
62
- rafId = requestAnimationFrame(() => {
63
- rafId = null;
64
- collectIntersectedElements();
65
- });
66
- }
67
- function onMouseUp() {
68
- if (mode.value !== "multi-selecting") return;
69
- document.documentElement.style.userSelect = "";
70
- if (rafId !== null) {
71
- cancelAnimationFrame(rafId);
72
- rafId = null;
73
- }
74
- collectIntersectedElements();
75
- }
76
- function collectIntersectedElements() {
77
- if (!selectionRect.value) return;
78
- const rect = selectionRect.value;
79
- const intersected = [];
80
- for (const {
81
- el,
82
- rect: elRect
83
- } of cachedElements) {
84
- if (elRect.left < rect.x + rect.width && elRect.right > rect.x && elRect.top < rect.y + rect.height && elRect.bottom > rect.y) {
85
- intersected.push(el);
86
- }
87
- }
88
- selectedElements.value = intersected;
89
- }
90
- function reset() {
91
- selectionRect.value = null;
92
- selectedElements.value = [];
93
- cachedElements = [];
94
- document.documentElement.style.userSelect = "";
95
- if (rafId !== null) {
96
- cancelAnimationFrame(rafId);
97
- rafId = null;
98
- }
99
- }
100
- return {
101
- selectionRect,
102
- selectedElements,
103
- onMouseDown,
104
- onMouseMove,
105
- onMouseUp,
106
- reset
107
- };
108
- }
@@ -1,100 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.formatAnnotations = formatAnnotations;
7
- exports.useOutputFormatter = useOutputFormatter;
8
- function formatAnnotations(annotations, detail, pageUrl) {
9
- const shortUrl = pageUrl.replace(/^https?:\/\//, "");
10
- const lines = [];
11
- lines.push(`## Feedback \u2014 ${shortUrl}`);
12
- lines.push("");
13
- if (detail === "forensic") {
14
- const viewport = typeof window !== "undefined" ? `${window.innerWidth}x${window.innerHeight}` : "unknown";
15
- const userAgent = typeof navigator !== "undefined" ? navigator.userAgent : "unknown";
16
- const dpr = typeof window !== "undefined" ? String(window.devicePixelRatio) : "unknown";
17
- lines.push("### Environment");
18
- lines.push(`- **Viewport:** ${viewport}`);
19
- lines.push(`- **URL:** ${pageUrl}`);
20
- lines.push(`- **User Agent:** ${userAgent}`);
21
- lines.push(`- **Timestamp:** ${(/* @__PURE__ */new Date()).toISOString()}`);
22
- lines.push(`- **Device Pixel Ratio:** ${dpr}`);
23
- lines.push("");
24
- }
25
- for (let i = 0; i < annotations.length; i++) {
26
- const ann = annotations[i];
27
- const num = i + 1;
28
- if (ann.selectedText) {
29
- lines.push(`### ${num}. "${ann.selectedText}" (selected text)`);
30
- } else if (ann.isMultiSelect) {
31
- lines.push(`### ${num}. Multi-selection (${ann.elements?.length || 0} elements)`);
32
- } else if (ann.isAreaSelect) {
33
- lines.push(`### ${num}. Area selection`);
34
- } else {
35
- lines.push(`### ${num}. \`${ann.element}\` \u2014 ${ann.elementPath}`);
36
- }
37
- lines.push(`- **Comment:** ${ann.comment}`);
38
- if (ann.selectedText) {
39
- lines.push(`- **In element:** \`${ann.element}\` \u2014 ${ann.elementPath}`);
40
- }
41
- if (ann.isMultiSelect && ann.elements) {
42
- lines.push(`- **Elements:**`);
43
- for (const el of ann.elements) {
44
- lines.push(` - \`${el.element}\` \u2014 ${el.elementPath}`);
45
- }
46
- }
47
- if (ann.isAreaSelect && ann.area) {
48
- lines.push(`- **Area:** x: ${Math.round(ann.area.x)}, y: ${Math.round(ann.area.y)}, width: ${Math.round(ann.area.width)}, height: ${Math.round(ann.area.height)}`);
49
- }
50
- if ((ann.isAreaSelect || ann.isMultiSelect) && ann.elementPath) {
51
- lines.push(`- **Selection path:** ${ann.elementPath}`);
52
- }
53
- if ((ann.isAreaSelect || ann.isMultiSelect) && ann.boundingBox) {
54
- const b = ann.boundingBox;
55
- lines.push(`- **Selection box:** x: ${Math.round(b.x)}, y: ${Math.round(b.y)}, width: ${Math.round(b.width)}, height: ${Math.round(b.height)}`);
56
- }
57
- if (ann.vueComponents) {
58
- lines.push(`- **Components:** ${ann.vueComponents}`);
59
- }
60
- if (!ann.isMultiSelect && !ann.isAreaSelect && !ann.selectedText) {
61
- if (ann.elementPath) {
62
- lines.push(`- **Path:** ${ann.elementPath}`);
63
- }
64
- }
65
- if (ann.nearbyElements) {
66
- lines.push(`- **Nearby:** ${ann.nearbyElements}`);
67
- }
68
- if (ann.nearbyText && !ann.selectedText) {
69
- lines.push(`- **Context:** ${ann.nearbyText}`);
70
- }
71
- if (detail === "forensic") {
72
- if (ann.fullPath) {
73
- lines.push(`- **Full path:** ${ann.fullPath}`);
74
- }
75
- if (ann.cssClasses) {
76
- lines.push(`- **CSS classes:** ${ann.cssClasses}`);
77
- }
78
- if (ann.boundingBox) {
79
- const b = ann.boundingBox;
80
- lines.push(`- **Bounding box:** x: ${Math.round(b.x)}, y: ${Math.round(b.y)}, width: ${Math.round(b.width)}, height: ${Math.round(b.height)}`);
81
- }
82
- if (ann.computedStyles) {
83
- lines.push(`- **Computed styles:**`);
84
- for (const line of ann.computedStyles.split("\n")) {
85
- lines.push(` - ${line}`);
86
- }
87
- }
88
- if (ann.accessibility) {
89
- lines.push(`- **Accessibility:** ${ann.accessibility}`);
90
- }
91
- }
92
- lines.push("");
93
- }
94
- return lines.join("\n");
95
- }
96
- function useOutputFormatter() {
97
- return {
98
- formatAnnotations
99
- };
100
- }
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useSettings = useSettings;
7
- var _vueDemi = require("vue-demi");
8
- const STORAGE_KEY = "agentation-vue-settings";
9
- const defaults = {
10
- outputDetail: "standard",
11
- markerColor: "#42B883",
12
- blockPageInteractions: false,
13
- autoHideToolbar: false,
14
- toolbarPlacement: "bottom-right",
15
- clearAfterCopy: false,
16
- showComponentTree: true,
17
- theme: "auto",
18
- activationKey: "Shift"
19
- };
20
- function loadSettings() {
21
- try {
22
- const stored = localStorage.getItem(STORAGE_KEY);
23
- if (stored) return {
24
- ...defaults,
25
- ...JSON.parse(stored)
26
- };
27
- } catch {}
28
- return {
29
- ...defaults
30
- };
31
- }
32
- const settings = (0, _vueDemi.reactive)(loadSettings());
33
- (0, _vueDemi.watch)(() => ({
34
- ...settings
35
- }), val => {
36
- try {
37
- localStorage.setItem(STORAGE_KEY, JSON.stringify(val));
38
- } catch {}
39
- });
40
- function useSettings() {
41
- function resetSettings() {
42
- Object.assign(settings, defaults);
43
- }
44
- return {
45
- settings,
46
- resetSettings
47
- };
48
- }