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
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.vaTooltipDirective = exports.default = void 0;
|
|
7
|
-
const TOOLTIP_STATE_KEY = "__vaTooltipState";
|
|
8
|
-
const TOOLTIP_MARGIN = 8;
|
|
9
|
-
const DEFAULT_OFFSET = 12;
|
|
10
|
-
const DEFAULT_SHOW_DELAY = 300;
|
|
11
|
-
function normalizeTooltipValue(value) {
|
|
12
|
-
if (!value) return null;
|
|
13
|
-
if (typeof value === "string") {
|
|
14
|
-
const text2 = value.trim();
|
|
15
|
-
if (!text2) return null;
|
|
16
|
-
return {
|
|
17
|
-
text: text2,
|
|
18
|
-
placement: "top",
|
|
19
|
-
offset: DEFAULT_OFFSET,
|
|
20
|
-
showDelay: DEFAULT_SHOW_DELAY
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
if (typeof value !== "object") return null;
|
|
24
|
-
if (value.disabled) return null;
|
|
25
|
-
const text = typeof value.text === "string" ? value.text.trim() : "";
|
|
26
|
-
if (!text) return null;
|
|
27
|
-
const shortcut = typeof value.shortcut === "string" ? value.shortcut.trim() : void 0;
|
|
28
|
-
const placement = value.placement === "bottom" ? "bottom" : "top";
|
|
29
|
-
const offset = Number.isFinite(value.offset) ? Math.max(4, Number(value.offset)) : DEFAULT_OFFSET;
|
|
30
|
-
const showDelay = Number.isFinite(value.showDelay) ? Math.max(0, Number(value.showDelay)) : DEFAULT_SHOW_DELAY;
|
|
31
|
-
return {
|
|
32
|
-
text,
|
|
33
|
-
shortcut: shortcut || void 0,
|
|
34
|
-
placement,
|
|
35
|
-
offset,
|
|
36
|
-
showDelay
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function getState(el) {
|
|
40
|
-
return el[TOOLTIP_STATE_KEY];
|
|
41
|
-
}
|
|
42
|
-
function isHostDisabled(el) {
|
|
43
|
-
if ("disabled" in el) return Boolean(el.disabled);
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
function createTooltipElement(value) {
|
|
47
|
-
const tooltipEl = document.createElement("div");
|
|
48
|
-
tooltipEl.className = "__va-tooltip";
|
|
49
|
-
tooltipEl.setAttribute("role", "tooltip");
|
|
50
|
-
updateTooltipContent(tooltipEl, value);
|
|
51
|
-
return tooltipEl;
|
|
52
|
-
}
|
|
53
|
-
function updateTooltipContent(tooltipEl, value) {
|
|
54
|
-
tooltipEl.innerHTML = "";
|
|
55
|
-
tooltipEl.setAttribute("data-placement", value.placement);
|
|
56
|
-
const labelEl = document.createElement("span");
|
|
57
|
-
labelEl.className = "__va-tooltip-label";
|
|
58
|
-
labelEl.textContent = value.text;
|
|
59
|
-
tooltipEl.appendChild(labelEl);
|
|
60
|
-
if (value.shortcut) {
|
|
61
|
-
const shortcutEl = document.createElement("kbd");
|
|
62
|
-
shortcutEl.className = "__va-tooltip-shortcut";
|
|
63
|
-
shortcutEl.textContent = value.shortcut;
|
|
64
|
-
tooltipEl.appendChild(shortcutEl);
|
|
65
|
-
}
|
|
66
|
-
const arrowEl = document.createElement("span");
|
|
67
|
-
arrowEl.className = "__va-tooltip-arrow";
|
|
68
|
-
arrowEl.setAttribute("aria-hidden", "true");
|
|
69
|
-
tooltipEl.appendChild(arrowEl);
|
|
70
|
-
}
|
|
71
|
-
function positionTooltip(el) {
|
|
72
|
-
const state = getState(el);
|
|
73
|
-
if (!state?.value || !state.tooltipEl) return;
|
|
74
|
-
const tooltipEl = state.tooltipEl;
|
|
75
|
-
const hostRect = el.getBoundingClientRect();
|
|
76
|
-
const viewportWidth = window.innerWidth;
|
|
77
|
-
const viewportHeight = window.innerHeight;
|
|
78
|
-
tooltipEl.style.left = "0px";
|
|
79
|
-
tooltipEl.style.top = "0px";
|
|
80
|
-
const tooltipRect = tooltipEl.getBoundingClientRect();
|
|
81
|
-
let placement = state.value.placement;
|
|
82
|
-
let top = placement === "top" ? hostRect.top - tooltipRect.height - state.value.offset : hostRect.bottom + state.value.offset;
|
|
83
|
-
if (placement === "top" && top < TOOLTIP_MARGIN) {
|
|
84
|
-
placement = "bottom";
|
|
85
|
-
top = hostRect.bottom + state.value.offset;
|
|
86
|
-
} else if (placement === "bottom" && top + tooltipRect.height > viewportHeight - TOOLTIP_MARGIN) {
|
|
87
|
-
placement = "top";
|
|
88
|
-
top = hostRect.top - tooltipRect.height - state.value.offset;
|
|
89
|
-
}
|
|
90
|
-
const centeredLeft = hostRect.left + hostRect.width / 2 - tooltipRect.width / 2;
|
|
91
|
-
const maxLeft = Math.max(TOOLTIP_MARGIN, viewportWidth - tooltipRect.width - TOOLTIP_MARGIN);
|
|
92
|
-
const left = Math.min(Math.max(centeredLeft, TOOLTIP_MARGIN), maxLeft);
|
|
93
|
-
const maxTop = Math.max(TOOLTIP_MARGIN, viewportHeight - tooltipRect.height - TOOLTIP_MARGIN);
|
|
94
|
-
tooltipEl.setAttribute("data-placement", placement);
|
|
95
|
-
tooltipEl.style.left = `${Math.round(left)}px`;
|
|
96
|
-
tooltipEl.style.top = `${Math.round(Math.min(Math.max(top, TOOLTIP_MARGIN), maxTop))}px`;
|
|
97
|
-
}
|
|
98
|
-
function attachWindowListeners(el) {
|
|
99
|
-
const state = getState(el);
|
|
100
|
-
if (!state) return;
|
|
101
|
-
window.addEventListener("scroll", state.onWindowReposition, true);
|
|
102
|
-
window.addEventListener("resize", state.onWindowReposition, {
|
|
103
|
-
passive: true
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function detachWindowListeners(el) {
|
|
107
|
-
const state = getState(el);
|
|
108
|
-
if (!state) return;
|
|
109
|
-
window.removeEventListener("scroll", state.onWindowReposition, true);
|
|
110
|
-
window.removeEventListener("resize", state.onWindowReposition);
|
|
111
|
-
}
|
|
112
|
-
function clearShowTimer(el) {
|
|
113
|
-
const state = getState(el);
|
|
114
|
-
if (!state?.showTimer) return;
|
|
115
|
-
clearTimeout(state.showTimer);
|
|
116
|
-
state.showTimer = null;
|
|
117
|
-
}
|
|
118
|
-
function showTooltipNow(el) {
|
|
119
|
-
const state = getState(el);
|
|
120
|
-
if (!state?.value || isHostDisabled(el)) return;
|
|
121
|
-
if (!state.tooltipEl) state.tooltipEl = createTooltipElement(state.value);else updateTooltipContent(state.tooltipEl, state.value);
|
|
122
|
-
if (!document.body.contains(state.tooltipEl)) document.body.appendChild(state.tooltipEl);
|
|
123
|
-
positionTooltip(el);
|
|
124
|
-
state.tooltipEl.classList.add("__va-tooltip--visible");
|
|
125
|
-
attachWindowListeners(el);
|
|
126
|
-
}
|
|
127
|
-
function scheduleShowTooltip(el) {
|
|
128
|
-
const state = getState(el);
|
|
129
|
-
if (!state?.value || isHostDisabled(el)) return;
|
|
130
|
-
clearShowTimer(el);
|
|
131
|
-
if (state.value.showDelay <= 0) {
|
|
132
|
-
showTooltipNow(el);
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
state.showTimer = setTimeout(() => {
|
|
136
|
-
state.showTimer = null;
|
|
137
|
-
showTooltipNow(el);
|
|
138
|
-
}, state.value.showDelay);
|
|
139
|
-
}
|
|
140
|
-
function hideTooltip(el) {
|
|
141
|
-
const state = getState(el);
|
|
142
|
-
if (!state) return;
|
|
143
|
-
clearShowTimer(el);
|
|
144
|
-
if (!state.tooltipEl) return;
|
|
145
|
-
detachWindowListeners(el);
|
|
146
|
-
state.tooltipEl.classList.remove("__va-tooltip--visible");
|
|
147
|
-
state.tooltipEl.remove();
|
|
148
|
-
}
|
|
149
|
-
function syncAriaLabel(el) {
|
|
150
|
-
const state = getState(el);
|
|
151
|
-
if (!state) return;
|
|
152
|
-
if (!state.value && state.ownsAriaLabel) {
|
|
153
|
-
el.removeAttribute("aria-label");
|
|
154
|
-
state.ownsAriaLabel = false;
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (!state.value) return;
|
|
158
|
-
if (!el.hasAttribute("aria-label")) {
|
|
159
|
-
el.setAttribute("aria-label", state.value.text);
|
|
160
|
-
state.ownsAriaLabel = true;
|
|
161
|
-
} else if (state.ownsAriaLabel) {
|
|
162
|
-
el.setAttribute("aria-label", state.value.text);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function updateTooltipValue(el, value) {
|
|
166
|
-
const state = getState(el);
|
|
167
|
-
if (!state) return;
|
|
168
|
-
state.value = normalizeTooltipValue(value);
|
|
169
|
-
syncAriaLabel(el);
|
|
170
|
-
if (!state.value) {
|
|
171
|
-
hideTooltip(el);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
if (state.tooltipEl) {
|
|
175
|
-
updateTooltipContent(state.tooltipEl, state.value);
|
|
176
|
-
positionTooltip(el);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function bindTooltip(el, binding) {
|
|
180
|
-
if (getState(el)) {
|
|
181
|
-
updateTooltipValue(el, binding.value);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const state = {
|
|
185
|
-
value: null,
|
|
186
|
-
tooltipEl: null,
|
|
187
|
-
ownsAriaLabel: false,
|
|
188
|
-
showTimer: null,
|
|
189
|
-
onMouseEnter: () => scheduleShowTooltip(el),
|
|
190
|
-
onMouseLeave: () => hideTooltip(el),
|
|
191
|
-
onFocus: () => scheduleShowTooltip(el),
|
|
192
|
-
onBlur: () => hideTooltip(el),
|
|
193
|
-
onPointerDown: () => hideTooltip(el),
|
|
194
|
-
onKeyDown: event => {
|
|
195
|
-
if (event.key === "Escape") hideTooltip(el);
|
|
196
|
-
},
|
|
197
|
-
onWindowReposition: () => positionTooltip(el)
|
|
198
|
-
};
|
|
199
|
-
el[TOOLTIP_STATE_KEY] = state;
|
|
200
|
-
el.addEventListener("mouseenter", state.onMouseEnter);
|
|
201
|
-
el.addEventListener("mouseleave", state.onMouseLeave);
|
|
202
|
-
el.addEventListener("focus", state.onFocus, true);
|
|
203
|
-
el.addEventListener("blur", state.onBlur, true);
|
|
204
|
-
el.addEventListener("pointerdown", state.onPointerDown);
|
|
205
|
-
el.addEventListener("keydown", state.onKeyDown);
|
|
206
|
-
updateTooltipValue(el, binding.value);
|
|
207
|
-
}
|
|
208
|
-
function unbindTooltip(el) {
|
|
209
|
-
const state = getState(el);
|
|
210
|
-
if (!state) return;
|
|
211
|
-
hideTooltip(el);
|
|
212
|
-
el.removeEventListener("mouseenter", state.onMouseEnter);
|
|
213
|
-
el.removeEventListener("mouseleave", state.onMouseLeave);
|
|
214
|
-
el.removeEventListener("focus", state.onFocus, true);
|
|
215
|
-
el.removeEventListener("blur", state.onBlur, true);
|
|
216
|
-
el.removeEventListener("pointerdown", state.onPointerDown);
|
|
217
|
-
el.removeEventListener("keydown", state.onKeyDown);
|
|
218
|
-
if (state.ownsAriaLabel) el.removeAttribute("aria-label");
|
|
219
|
-
delete el[TOOLTIP_STATE_KEY];
|
|
220
|
-
}
|
|
221
|
-
const vaTooltipDirective = exports.vaTooltipDirective = {
|
|
222
|
-
beforeMount(el, binding) {
|
|
223
|
-
bindTooltip(el, binding);
|
|
224
|
-
},
|
|
225
|
-
updated(el, binding) {
|
|
226
|
-
updateTooltipValue(el, binding.value);
|
|
227
|
-
},
|
|
228
|
-
unmounted(el) {
|
|
229
|
-
unbindTooltip(el);
|
|
230
|
-
},
|
|
231
|
-
bind(el, binding) {
|
|
232
|
-
bindTooltip(el, binding);
|
|
233
|
-
},
|
|
234
|
-
componentUpdated(el, binding) {
|
|
235
|
-
updateTooltipValue(el, binding.value);
|
|
236
|
-
},
|
|
237
|
-
unbind(el) {
|
|
238
|
-
unbindTooltip(el);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
module.exports = vaTooltipDirective;
|
package/dist/icons.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.icons = void 0;
|
|
7
|
-
const icons = exports.icons = {
|
|
8
|
-
"cursor": '<path d="m4 4 7 17 2.5-7.5L21 11Z"/>',
|
|
9
|
-
"area-select": '<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 3v18" opacity="0.3"/>',
|
|
10
|
-
"pause": '<rect x="6" y="4" width="4" height="16"/><rect x="14" y="4" width="4" height="16"/>',
|
|
11
|
-
"play": '<polygon points="5,3 19,12 5,21"/>',
|
|
12
|
-
"copy": '<rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"/>',
|
|
13
|
-
"trash": '<path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2"/><path d="M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6"/>',
|
|
14
|
-
"settings": '<path d="M14.4 2h-4.8l-.6 3a7.8 7.8 0 0 0-1.9 1.1L4.3 5 2 9.1l2.2 2a7.7 7.7 0 0 0 0 1.8L2 14.9 4.3 19l2.8-1.1A7.8 7.8 0 0 0 9 19l.6 3h4.8l.6-3a7.8 7.8 0 0 0 1.9-1.1l2.8 1.1 2.3-4.1-2.2-2a7.7 7.7 0 0 0 0-1.8l2.2-2L19.7 5l-2.8 1.1A7.8 7.8 0 0 0 15 5z"/><circle cx="12" cy="12" r="3"/>',
|
|
15
|
-
"minimize": '<polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" y1="10" x2="21" y2="3"/><line x1="3" y1="21" x2="10" y2="14"/>',
|
|
16
|
-
"sun": '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/>',
|
|
17
|
-
"moon": '<path d="M21 12.8A9 9 0 1 1 11.2 3 7 7 0 0 0 21 12.8z"/>',
|
|
18
|
-
"pencil": '<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/>',
|
|
19
|
-
"plus": '<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',
|
|
20
|
-
"close": '<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>'
|
|
21
|
-
};
|
package/dist/index.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "AgentationVue", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _AgentationVue.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.AgentationVuePlugin = void 0;
|
|
13
|
-
Object.defineProperty(exports, "ComponentChain", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _ComponentChain.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "DEFAULT_SHORTCUT_CONFIG", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _useKeyboardShortcuts.DEFAULT_SHORTCUT_CONFIG;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "VaButton", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _VaButton.default;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "VaIcon", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _VaIcon.default;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(exports, "VaIconButton", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () {
|
|
40
|
-
return _VaIconButton.default;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(exports, "VaToggle", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _VaToggle.default;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
Object.defineProperty(exports, "formatAnnotations", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function () {
|
|
53
|
-
return _useOutputFormatter.formatAnnotations;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(exports, "icons", {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
get: function () {
|
|
59
|
-
return _icons.icons;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(exports, "useAnimationPause", {
|
|
63
|
-
enumerable: true,
|
|
64
|
-
get: function () {
|
|
65
|
-
return _useAnimationPause.useAnimationPause;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
Object.defineProperty(exports, "useAnnotations", {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
get: function () {
|
|
71
|
-
return _useAnnotations.useAnnotations;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
Object.defineProperty(exports, "useAreaSelect", {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function () {
|
|
77
|
-
return _useAreaSelect.useAreaSelect;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
Object.defineProperty(exports, "useElementDetection", {
|
|
81
|
-
enumerable: true,
|
|
82
|
-
get: function () {
|
|
83
|
-
return _useElementDetection.useElementDetection;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
Object.defineProperty(exports, "useInteractionMode", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
get: function () {
|
|
89
|
-
return _useInteractionMode.useInteractionMode;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
Object.defineProperty(exports, "useKeyboardShortcuts", {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
get: function () {
|
|
95
|
-
return _useKeyboardShortcuts.useKeyboardShortcuts;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
Object.defineProperty(exports, "useMarkerPositions", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function () {
|
|
101
|
-
return _useMarkerPositions.useMarkerPositions;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
Object.defineProperty(exports, "useMultiSelect", {
|
|
105
|
-
enumerable: true,
|
|
106
|
-
get: function () {
|
|
107
|
-
return _useMultiSelect.useMultiSelect;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
Object.defineProperty(exports, "useOutputFormatter", {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function () {
|
|
113
|
-
return _useOutputFormatter.useOutputFormatter;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
Object.defineProperty(exports, "useSettings", {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function () {
|
|
119
|
-
return _useSettings.useSettings;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
Object.defineProperty(exports, "useTextSelection", {
|
|
123
|
-
enumerable: true,
|
|
124
|
-
get: function () {
|
|
125
|
-
return _useTextSelection.useTextSelection;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
Object.defineProperty(exports, "useToolbarAutoHide", {
|
|
129
|
-
enumerable: true,
|
|
130
|
-
get: function () {
|
|
131
|
-
return _useToolbarAutoHide.useToolbarAutoHide;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
Object.defineProperty(exports, "vaTooltipDirective", {
|
|
135
|
-
enumerable: true,
|
|
136
|
-
get: function () {
|
|
137
|
-
return _vaTooltip.vaTooltipDirective;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
var _AgentationVue = _interopRequireDefault(require("./AgentationVue.vue"));
|
|
141
|
-
var _vaTooltip = require("./directives/vaTooltip");
|
|
142
|
-
var _ComponentChain = _interopRequireDefault(require("./components/ComponentChain.vue"));
|
|
143
|
-
var _VaButton = _interopRequireDefault(require("./components/VaButton.vue"));
|
|
144
|
-
var _VaIcon = _interopRequireDefault(require("./components/VaIcon.vue"));
|
|
145
|
-
var _VaIconButton = _interopRequireDefault(require("./components/VaIconButton.vue"));
|
|
146
|
-
var _VaToggle = _interopRequireDefault(require("./components/VaToggle.vue"));
|
|
147
|
-
var _useAnimationPause = require("./composables/useAnimationPause");
|
|
148
|
-
var _useAnnotations = require("./composables/useAnnotations");
|
|
149
|
-
var _useAreaSelect = require("./composables/useAreaSelect");
|
|
150
|
-
var _useElementDetection = require("./composables/useElementDetection");
|
|
151
|
-
var _useInteractionMode = require("./composables/useInteractionMode");
|
|
152
|
-
var _useKeyboardShortcuts = require("./composables/useKeyboardShortcuts");
|
|
153
|
-
var _useMarkerPositions = require("./composables/useMarkerPositions");
|
|
154
|
-
var _useMultiSelect = require("./composables/useMultiSelect");
|
|
155
|
-
var _useOutputFormatter = require("./composables/useOutputFormatter");
|
|
156
|
-
var _useSettings = require("./composables/useSettings");
|
|
157
|
-
var _useTextSelection = require("./composables/useTextSelection");
|
|
158
|
-
var _useToolbarAutoHide = require("./composables/useToolbarAutoHide");
|
|
159
|
-
var _icons = require("./icons");
|
|
160
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
161
|
-
module.exports = _AgentationVue.default;
|
|
162
|
-
const AgentationVuePlugin = exports.AgentationVuePlugin = {
|
|
163
|
-
install(app) {
|
|
164
|
-
app.component("AgentationVue", _AgentationVue.default);
|
|
165
|
-
app.component("agentation-vue", _AgentationVue.default);
|
|
166
|
-
app.directive("va-tooltip", _vaTooltip.vaTooltipDirective);
|
|
167
|
-
}
|
|
168
|
-
};
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/utils/clipboard.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copyToClipboard = copyToClipboard;
|
|
7
|
-
async function copyToClipboard(text) {
|
|
8
|
-
try {
|
|
9
|
-
await navigator.clipboard.writeText(text);
|
|
10
|
-
return true;
|
|
11
|
-
} catch {
|
|
12
|
-
const textarea = document.createElement("textarea");
|
|
13
|
-
textarea.value = text;
|
|
14
|
-
textarea.style.position = "fixed";
|
|
15
|
-
textarea.style.opacity = "0";
|
|
16
|
-
document.body.appendChild(textarea);
|
|
17
|
-
textarea.select();
|
|
18
|
-
const success = document.execCommand("copy");
|
|
19
|
-
document.body.removeChild(textarea);
|
|
20
|
-
return success;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.detectVueComponents = detectVueComponents;
|
|
7
|
-
exports.getAccessibilityInfo = getAccessibilityInfo;
|
|
8
|
-
exports.getComputedStylesSummary = getComputedStylesSummary;
|
|
9
|
-
exports.getNearbyElements = getNearbyElements;
|
|
10
|
-
exports.getNearbyText = getNearbyText;
|
|
11
|
-
exports.getRelevantComputedStyles = getRelevantComputedStyles;
|
|
12
|
-
exports.isFixed = isFixed;
|
|
13
|
-
let vueDetectionAvailable = null;
|
|
14
|
-
const DEFAULT_STYLE_VALUES = /* @__PURE__ */new Set(["none", "normal", "auto", "0px", "rgba(0, 0, 0, 0)", "transparent", "static", "visible"]);
|
|
15
|
-
const TEXT_ELEMENTS = /* @__PURE__ */new Set(["p", "span", "h1", "h2", "h3", "h4", "h5", "h6", "label", "li", "td", "th", "blockquote", "figcaption", "caption", "legend", "dt", "dd", "pre", "code", "em", "strong", "b", "i", "a", "time", "cite", "q"]);
|
|
16
|
-
const FORM_INPUT_ELEMENTS = /* @__PURE__ */new Set(["input", "textarea", "select"]);
|
|
17
|
-
const MEDIA_ELEMENTS = /* @__PURE__ */new Set(["img", "video", "canvas", "svg"]);
|
|
18
|
-
const CONTAINER_ELEMENTS = /* @__PURE__ */new Set(["div", "section", "article", "nav", "header", "footer", "aside", "main", "ul", "ol", "form", "fieldset"]);
|
|
19
|
-
function getComponentFromElement(el) {
|
|
20
|
-
const v2 = el.__vue__;
|
|
21
|
-
if (v2) return v2;
|
|
22
|
-
const v3 = el.__vueParentComponent;
|
|
23
|
-
if (v3) return v3;
|
|
24
|
-
let current = el.parentElement;
|
|
25
|
-
while (current && current !== document.body) {
|
|
26
|
-
const v2p = current.__vue__;
|
|
27
|
-
if (v2p) return v2p;
|
|
28
|
-
const v3p = current.__vueParentComponent;
|
|
29
|
-
if (v3p) return v3p;
|
|
30
|
-
current = current.parentElement;
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
function inferNameFromFile(filePath) {
|
|
35
|
-
const file = filePath.split("/").pop();
|
|
36
|
-
if (!file) return null;
|
|
37
|
-
return file.replace(/\.vue$/, "");
|
|
38
|
-
}
|
|
39
|
-
function getInstanceName(inst, includeFile) {
|
|
40
|
-
if (inst.$options) {
|
|
41
|
-
const name = inst.$options.name || inst.$options._componentTag || inferNameFromFile(inst.$options.__file || "");
|
|
42
|
-
if (name) {
|
|
43
|
-
if (includeFile && inst.$options.__file) {
|
|
44
|
-
const file = inst.$options.__file.split("/").pop();
|
|
45
|
-
return `${name} (${file})`;
|
|
46
|
-
}
|
|
47
|
-
return name;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (inst.type) {
|
|
51
|
-
const name = inst.type.name || inst.type.__name || inferNameFromFile(inst.type.__file || "");
|
|
52
|
-
if (!name) return null;
|
|
53
|
-
if (includeFile && inst.type.__file) {
|
|
54
|
-
const file = inst.type.__file.split("/").pop();
|
|
55
|
-
return `${name} (${file})`;
|
|
56
|
-
}
|
|
57
|
-
return name;
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
function walkComponentChain(inst, includeFile) {
|
|
62
|
-
const chain = [];
|
|
63
|
-
let current = inst;
|
|
64
|
-
let depth = 0;
|
|
65
|
-
while (current && depth < 20) {
|
|
66
|
-
const name = getInstanceName(current, includeFile);
|
|
67
|
-
if (name && !name.startsWith("_") && !/^App(?:\s*\(|$)/.test(name)) chain.push(name);
|
|
68
|
-
current = current.$parent || current.parent;
|
|
69
|
-
depth++;
|
|
70
|
-
}
|
|
71
|
-
return chain.reverse();
|
|
72
|
-
}
|
|
73
|
-
function detectVueComponents(el, includeFile = false) {
|
|
74
|
-
if (vueDetectionAvailable === false) return void 0;
|
|
75
|
-
const inst = getComponentFromElement(el);
|
|
76
|
-
if (inst) {
|
|
77
|
-
vueDetectionAvailable = true;
|
|
78
|
-
const chain = walkComponentChain(inst, includeFile);
|
|
79
|
-
return chain.length > 0 ? chain.join(" > ") : void 0;
|
|
80
|
-
}
|
|
81
|
-
if (vueDetectionAvailable === null) {
|
|
82
|
-
vueDetectionAvailable = false;
|
|
83
|
-
return void 0;
|
|
84
|
-
}
|
|
85
|
-
return void 0;
|
|
86
|
-
}
|
|
87
|
-
function isFixed(el) {
|
|
88
|
-
let current = el;
|
|
89
|
-
while (current && current !== document.body) {
|
|
90
|
-
const position = getComputedStyle(current).position;
|
|
91
|
-
if (position === "fixed" || position === "sticky") return true;
|
|
92
|
-
current = current.parentElement;
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
function getNearbyElements(el, maxCount = 3) {
|
|
97
|
-
const nearby = [];
|
|
98
|
-
const parent = el.parentElement;
|
|
99
|
-
if (!parent) return "";
|
|
100
|
-
for (const sibling of Array.from(parent.children)) {
|
|
101
|
-
if (sibling === el) continue;
|
|
102
|
-
const tag = sibling.tagName.toLowerCase();
|
|
103
|
-
const cls = Array.from(sibling.classList).filter(c => !c.startsWith("__va-")).slice(0, 2).join(".");
|
|
104
|
-
const name = cls ? `${tag}.${cls}` : tag;
|
|
105
|
-
nearby.push(`\`${name}\``);
|
|
106
|
-
if (nearby.length >= maxCount) break;
|
|
107
|
-
}
|
|
108
|
-
return nearby.join(", ");
|
|
109
|
-
}
|
|
110
|
-
function getNearbyText(el, maxLen = 140) {
|
|
111
|
-
const ownText = (el.textContent || "").replace(/\s+/g, " ").trim();
|
|
112
|
-
if (ownText.length >= 2) {
|
|
113
|
-
return ownText.length > maxLen ? `${ownText.slice(0, maxLen)}...` : ownText;
|
|
114
|
-
}
|
|
115
|
-
const parentText = (el.parentElement?.textContent || "").replace(/\s+/g, " ").trim();
|
|
116
|
-
if (parentText.length >= 2) {
|
|
117
|
-
return parentText.length > maxLen ? `${parentText.slice(0, maxLen)}...` : parentText;
|
|
118
|
-
}
|
|
119
|
-
return void 0;
|
|
120
|
-
}
|
|
121
|
-
function getRelevantComputedStyles(el) {
|
|
122
|
-
const style = getComputedStyle(el);
|
|
123
|
-
const tag = el.tagName.toLowerCase();
|
|
124
|
-
const result = {};
|
|
125
|
-
let properties;
|
|
126
|
-
if (TEXT_ELEMENTS.has(tag)) {
|
|
127
|
-
properties = ["color", "font-size", "font-weight", "font-family", "line-height"];
|
|
128
|
-
} else if (tag === "button" || tag === "a" && el.getAttribute("role") === "button") {
|
|
129
|
-
properties = ["background-color", "color", "padding", "border-radius", "font-size"];
|
|
130
|
-
} else if (FORM_INPUT_ELEMENTS.has(tag)) {
|
|
131
|
-
properties = ["background-color", "color", "padding", "border-radius", "font-size"];
|
|
132
|
-
} else if (MEDIA_ELEMENTS.has(tag)) {
|
|
133
|
-
properties = ["width", "height", "object-fit", "border-radius", "background"];
|
|
134
|
-
} else if (CONTAINER_ELEMENTS.has(tag)) {
|
|
135
|
-
properties = ["display", "gap", "padding", "margin", "background-color", "border-radius"];
|
|
136
|
-
} else {
|
|
137
|
-
properties = ["color", "font-size", "margin", "padding", "background-color"];
|
|
138
|
-
}
|
|
139
|
-
for (const prop of properties) {
|
|
140
|
-
const value = style.getPropertyValue(prop).trim();
|
|
141
|
-
if (value && !DEFAULT_STYLE_VALUES.has(value)) result[prop] = value;
|
|
142
|
-
}
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
function getComputedStylesSummary(el) {
|
|
146
|
-
const style = getComputedStyle(el);
|
|
147
|
-
const props = ["display", "padding", "margin", "background-color", "color", "border-radius", "font-size", "font-weight", "width", "height", "position", "z-index", "opacity", "transition", "transform"];
|
|
148
|
-
return props.map(p => `${p}: ${style.getPropertyValue(p)}`).filter(line => {
|
|
149
|
-
const [prop, val] = line.split(": ");
|
|
150
|
-
if (!val) return false;
|
|
151
|
-
if (DEFAULT_STYLE_VALUES.has(val)) return false;
|
|
152
|
-
if (["1", "400"].includes(val)) return false;
|
|
153
|
-
if (prop === "display" && val === "block") return false;
|
|
154
|
-
if (prop === "display" && val === "inline") return false;
|
|
155
|
-
return true;
|
|
156
|
-
}).join("\n");
|
|
157
|
-
}
|
|
158
|
-
function getAccessibilityInfo(el) {
|
|
159
|
-
const parts = [];
|
|
160
|
-
const role = el.getAttribute("role");
|
|
161
|
-
if (role) parts.push(`role="${role}"`);
|
|
162
|
-
for (const attr of Array.from(el.attributes)) {
|
|
163
|
-
if (attr.name.startsWith("aria-")) {
|
|
164
|
-
parts.push(`${attr.name}="${attr.value}"`);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return parts.length > 0 ? parts.join(", ") : void 0;
|
|
168
|
-
}
|
package/dist/utils/math.js
DELETED
package/dist/utils/portal.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createPortalContainer = createPortalContainer;
|
|
7
|
-
exports.destroyPortalContainer = destroyPortalContainer;
|
|
8
|
-
var _constants = require("../constants");
|
|
9
|
-
function createPortalContainer() {
|
|
10
|
-
const container = document.createElement("div");
|
|
11
|
-
container.id = "__va-portal";
|
|
12
|
-
container.setAttribute(_constants.VA_DATA_ATTR, "");
|
|
13
|
-
document.body.appendChild(container);
|
|
14
|
-
return container;
|
|
15
|
-
}
|
|
16
|
-
function destroyPortalContainer(el) {
|
|
17
|
-
el.remove();
|
|
18
|
-
}
|