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.
- package/dist/AgentationVue.vue +411 -528
- package/dist/components/AgentationToolbar.vue +49 -76
- package/dist/components/AnnotationInput.vue +30 -40
- package/dist/components/AnnotationMarker.vue +20 -25
- package/dist/components/ComponentChain.vue +19 -29
- package/dist/components/ElementHighlight.vue +13 -16
- package/dist/components/SettingsPanel.vue +29 -41
- package/dist/components/SettingsPopover.vue +128 -159
- package/dist/components/VaButton.vue +6 -12
- package/dist/components/VaIcon.vue +5 -5
- package/dist/components/VaIconButton.vue +15 -23
- package/dist/components/VaToggle.vue +7 -8
- package/package.json +7 -12
- package/dist/composables/useAnimationPause.js +0 -52
- package/dist/composables/useAnnotations.js +0 -106
- package/dist/composables/useAreaSelect.js +0 -62
- package/dist/composables/useElementDetection.js +0 -85
- package/dist/composables/useInteractionMode.js +0 -29
- package/dist/composables/useKeyboardShortcuts.js +0 -202
- package/dist/composables/useMarkerPositions.js +0 -45
- package/dist/composables/useMultiSelect.js +0 -108
- package/dist/composables/useOutputFormatter.js +0 -100
- package/dist/composables/useSettings.js +0 -48
- package/dist/composables/useTextSelection.js +0 -33
- package/dist/composables/useToolbarAutoHide.js +0 -270
- package/dist/composables/useToolbarDragSnap.js +0 -296
- package/dist/constants.js +0 -8
- package/dist/directives/vaTooltip.js +0 -241
- package/dist/icons.js +0 -21
- package/dist/index.js +0 -168
- package/dist/types.js +0 -1
- package/dist/utils/clipboard.js +0 -22
- package/dist/utils/dom-inspector.js +0 -168
- package/dist/utils/math.js +0 -9
- package/dist/utils/portal.js +0 -18
- package/dist/utils/selectors.js +0 -103
- package/dist/utils/style.js +0 -14
package/dist/utils/selectors.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.generateSelector = generateSelector;
|
|
7
|
-
exports.getElementName = getElementName;
|
|
8
|
-
exports.getElementPath = getElementPath;
|
|
9
|
-
const HASH_CLASS_PATTERNS = [/^[a-z]+-[a-zA-Z0-9]{5,}$/, /^css-[a-z0-9]+$/, /^_[a-z0-9]{6,}$/i, /^__/, /^svelte-/, /^emotion-/];
|
|
10
|
-
function isHashClass(cls) {
|
|
11
|
-
return HASH_CLASS_PATTERNS.some(p => p.test(cls));
|
|
12
|
-
}
|
|
13
|
-
function getMeaningfulClasses(el) {
|
|
14
|
-
return Array.from(el.classList).filter(c => !isHashClass(c) && !c.startsWith("__va-"));
|
|
15
|
-
}
|
|
16
|
-
function bubbleSvg(el) {
|
|
17
|
-
if (el instanceof SVGElement && !(el instanceof SVGSVGElement)) {
|
|
18
|
-
const svg = el.closest("svg");
|
|
19
|
-
if (svg) return svg;
|
|
20
|
-
}
|
|
21
|
-
return el;
|
|
22
|
-
}
|
|
23
|
-
function generateSelector(el) {
|
|
24
|
-
el = bubbleSvg(el);
|
|
25
|
-
if (el.id && document.querySelectorAll(`#${CSS.escape(el.id)}`).length === 1) {
|
|
26
|
-
return `#${el.id}`;
|
|
27
|
-
}
|
|
28
|
-
const tag = el.tagName.toLowerCase();
|
|
29
|
-
const classes = getMeaningfulClasses(el);
|
|
30
|
-
if (classes.length > 0) {
|
|
31
|
-
const selector = `${tag}.${classes.join(".")}`;
|
|
32
|
-
if (document.querySelectorAll(selector).length === 1) {
|
|
33
|
-
return selector;
|
|
34
|
-
}
|
|
35
|
-
const parent2 = el.parentElement;
|
|
36
|
-
if (parent2) {
|
|
37
|
-
const parentTag = parent2.tagName.toLowerCase();
|
|
38
|
-
const parentClasses = getMeaningfulClasses(parent2);
|
|
39
|
-
let parentSelector = parentTag;
|
|
40
|
-
if (parentClasses.length > 0) {
|
|
41
|
-
parentSelector = `${parentTag}.${parentClasses[0]}`;
|
|
42
|
-
}
|
|
43
|
-
const full = `${parentSelector} > ${selector}`;
|
|
44
|
-
if (document.querySelectorAll(full).length === 1) {
|
|
45
|
-
return full;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const parent = el.parentElement;
|
|
50
|
-
if (parent) {
|
|
51
|
-
const siblings = Array.from(parent.children);
|
|
52
|
-
const index = siblings.indexOf(el) + 1;
|
|
53
|
-
const parentSelector = parent === document.body ? "body" : generateSelector(parent);
|
|
54
|
-
return `${parentSelector} > ${tag}:nth-child(${index})`;
|
|
55
|
-
}
|
|
56
|
-
return tag;
|
|
57
|
-
}
|
|
58
|
-
function getElementName(el) {
|
|
59
|
-
el = bubbleSvg(el);
|
|
60
|
-
const tag = el.tagName.toLowerCase();
|
|
61
|
-
const textTags = ["button", "a", "h1", "h2", "h3", "h4", "h5", "h6", "label", "span", "p"];
|
|
62
|
-
if (textTags.includes(tag)) {
|
|
63
|
-
const text = (el.textContent || "").trim();
|
|
64
|
-
if (text.length > 0) {
|
|
65
|
-
const truncated = text.length > 30 ? `${text.slice(0, 30)}...` : text;
|
|
66
|
-
return `"${truncated}" ${tag}`;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (tag === "img") {
|
|
70
|
-
const alt = el.getAttribute("alt");
|
|
71
|
-
if (alt) return `img[alt="${alt}"]`;
|
|
72
|
-
}
|
|
73
|
-
if (tag === "input") {
|
|
74
|
-
const placeholder = el.getAttribute("placeholder");
|
|
75
|
-
if (placeholder) return `input[placeholder="${placeholder}"]`;
|
|
76
|
-
const type = el.getAttribute("type") || "text";
|
|
77
|
-
return `input[type="${type}"]`;
|
|
78
|
-
}
|
|
79
|
-
const classes = getMeaningfulClasses(el);
|
|
80
|
-
if (classes.length > 0) {
|
|
81
|
-
return `${tag}.${classes.join(".")}`;
|
|
82
|
-
}
|
|
83
|
-
return `<${tag}>`;
|
|
84
|
-
}
|
|
85
|
-
function getElementPath(el) {
|
|
86
|
-
el = bubbleSvg(el);
|
|
87
|
-
const parts = [];
|
|
88
|
-
let current = el;
|
|
89
|
-
while (current && current !== document.documentElement) {
|
|
90
|
-
const tag = current.tagName.toLowerCase();
|
|
91
|
-
const classes = getMeaningfulClasses(current);
|
|
92
|
-
if (current.id) {
|
|
93
|
-
parts.unshift(`${tag}#${current.id}`);
|
|
94
|
-
break;
|
|
95
|
-
} else if (classes.length > 0) {
|
|
96
|
-
parts.unshift(`${tag}.${classes.join(".")}`);
|
|
97
|
-
} else {
|
|
98
|
-
parts.unshift(tag);
|
|
99
|
-
}
|
|
100
|
-
current = current.parentElement;
|
|
101
|
-
}
|
|
102
|
-
return parts.join(" > ");
|
|
103
|
-
}
|
package/dist/utils/style.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.boundingBoxToStyle = boundingBoxToStyle;
|
|
7
|
-
function boundingBoxToStyle(rect) {
|
|
8
|
-
return {
|
|
9
|
-
left: `${rect.x}px`,
|
|
10
|
-
top: `${rect.y}px`,
|
|
11
|
-
width: `${rect.width}px`,
|
|
12
|
-
height: `${rect.height}px`
|
|
13
|
-
};
|
|
14
|
-
}
|