agentation-vue 0.2.3 → 0.2.5

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 (35) hide show
  1. package/dist/AgentationVue.vue +19 -23
  2. package/dist/components/AgentationToolbar.vue +2 -2
  3. package/dist/components/AnnotationInput.vue +2 -2
  4. package/dist/components/AnnotationMarker.vue +5 -5
  5. package/dist/components/ComponentChain.vue +4 -1
  6. package/dist/components/ElementHighlight.vue +1 -1
  7. package/dist/components/SettingsPanel.vue +3 -7
  8. package/dist/components/SettingsPopover.vue +1 -1
  9. package/dist/components/VaIcon.vue +1 -1
  10. package/dist/components/VaIconButton.vue +1 -1
  11. package/package.json +4 -10
  12. package/dist/composables/useAnimationPause.js +0 -52
  13. package/dist/composables/useAnnotations.js +0 -106
  14. package/dist/composables/useAreaSelect.js +0 -62
  15. package/dist/composables/useElementDetection.js +0 -85
  16. package/dist/composables/useInteractionMode.js +0 -29
  17. package/dist/composables/useKeyboardShortcuts.js +0 -202
  18. package/dist/composables/useMarkerPositions.js +0 -45
  19. package/dist/composables/useMultiSelect.js +0 -108
  20. package/dist/composables/useOutputFormatter.js +0 -100
  21. package/dist/composables/useSettings.js +0 -48
  22. package/dist/composables/useTextSelection.js +0 -33
  23. package/dist/composables/useToolbarAutoHide.js +0 -270
  24. package/dist/composables/useToolbarDragSnap.js +0 -296
  25. package/dist/constants.js +0 -8
  26. package/dist/directives/vaTooltip.js +0 -241
  27. package/dist/icons.js +0 -21
  28. package/dist/index.js +0 -168
  29. package/dist/types.js +0 -1
  30. package/dist/utils/clipboard.js +0 -22
  31. package/dist/utils/dom-inspector.js +0 -168
  32. package/dist/utils/math.js +0 -9
  33. package/dist/utils/portal.js +0 -18
  34. package/dist/utils/selectors.js +0 -103
  35. package/dist/utils/style.js +0 -14
@@ -5,23 +5,23 @@ import AnnotationInput from "./components/AnnotationInput.vue";
5
5
  import AnnotationMarker from "./components/AnnotationMarker.vue";
6
6
  import ElementHighlight from "./components/ElementHighlight.vue";
7
7
  import SettingsPopover from "./components/SettingsPopover.vue";
8
- import { useAnimationPause } from "./composables/useAnimationPause";
9
- import { useAnnotations } from "./composables/useAnnotations";
10
- import { useAreaSelect } from "./composables/useAreaSelect";
11
- import { useElementDetection } from "./composables/useElementDetection";
12
- import { useInteractionMode } from "./composables/useInteractionMode";
13
- import { DEFAULT_SHORTCUT_CONFIG, useKeyboardShortcuts } from "./composables/useKeyboardShortcuts";
14
- import { useMarkerPositions } from "./composables/useMarkerPositions";
15
- import { useMultiSelect } from "./composables/useMultiSelect";
16
- import { useOutputFormatter } from "./composables/useOutputFormatter";
17
- import { useSettings } from "./composables/useSettings";
18
- import { useTextSelection } from "./composables/useTextSelection";
19
- import { VA_DATA_ATTR_SELECTOR } from "./constants";
20
- import { copyToClipboard } from "./utils/clipboard";
21
- import { isFixed as checkIsFixed, detectVueComponents, getAccessibilityInfo, getComputedStylesSummary, getNearbyElements, getNearbyText, getRelevantComputedStyles } from "./utils/dom-inspector";
22
- import { createPortalContainer, destroyPortalContainer } from "./utils/portal";
23
- import { getElementName, getElementPath } from "./utils/selectors";
24
- import { boundingBoxToStyle } from "./utils/style";
8
+ import { useAnimationPause } from "./composables/useAnimationPause.mjs";
9
+ import { useAnnotations } from "./composables/useAnnotations.mjs";
10
+ import { useAreaSelect } from "./composables/useAreaSelect.mjs";
11
+ import { useElementDetection } from "./composables/useElementDetection.mjs";
12
+ import { useInteractionMode } from "./composables/useInteractionMode.mjs";
13
+ import { DEFAULT_SHORTCUT_CONFIG, useKeyboardShortcuts } from "./composables/useKeyboardShortcuts.mjs";
14
+ import { useMarkerPositions } from "./composables/useMarkerPositions.mjs";
15
+ import { useMultiSelect } from "./composables/useMultiSelect.mjs";
16
+ import { useOutputFormatter } from "./composables/useOutputFormatter.mjs";
17
+ import { useSettings } from "./composables/useSettings.mjs";
18
+ import { useTextSelection } from "./composables/useTextSelection.mjs";
19
+ import { VA_DATA_ATTR_SELECTOR } from "./constants.mjs";
20
+ import { copyToClipboard } from "./utils/clipboard.mjs";
21
+ import { isFixed as checkIsFixed, detectVueComponents, getAccessibilityInfo, getComputedStylesSummary, getNearbyElements, getNearbyText, getRelevantComputedStyles } from "./utils/dom-inspector.mjs";
22
+ import { createPortalContainer, destroyPortalContainer } from "./utils/portal.mjs";
23
+ import { getElementName, getElementPath } from "./utils/selectors.mjs";
24
+ import { boundingBoxToStyle } from "./utils/style.mjs";
25
25
  const props = defineProps({
26
26
  outputDetail: { type: String, required: false },
27
27
  markerColor: { type: String, required: false },
@@ -618,12 +618,8 @@ onBeforeUnmount(() => {
618
618
  v-if="mode !== 'idle'"
619
619
  ref="overlayEl"
620
620
  class="__va-intercept"
621
- :class="{
622
- '__va-intercept--input-open': mode === 'input-open'
623
- }"
624
- :style="mode === 'inspect' && !effectiveBlockPageInteractions ? {
625
- pointerEvents: 'none'
626
- } : void 0"
621
+ :class="{ '__va-intercept--input-open': mode === 'input-open' }"
622
+ :style="mode === 'inspect' && !effectiveBlockPageInteractions ? { pointerEvents: 'none' } : void 0"
627
623
  @mousemove="onOverlayMouseMove"
628
624
  @mousedown="onOverlayMouseDown"
629
625
  @mouseup="onOverlayMouseUp"
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, onBeforeUnmount, ref, toRef, watch } from "vue-demi";
3
- import { useToolbarAutoHide } from "../composables/useToolbarAutoHide";
4
- import { useToolbarDragSnap } from "../composables/useToolbarDragSnap";
3
+ import { useToolbarAutoHide } from "../composables/useToolbarAutoHide.mjs";
4
+ import { useToolbarDragSnap } from "../composables/useToolbarDragSnap.mjs";
5
5
  import VaIcon from "./VaIcon.vue";
6
6
  import VaIconButton from "./VaIconButton.vue";
7
7
  const props = defineProps({
@@ -50,7 +50,7 @@ onMounted(() => {
50
50
  >
51
51
  <summary class="__va-input-styles-summary">
52
52
  <ComponentChain v-if="componentChain" :chain="componentChain" variant="light" truncate="leaf" />
53
- <span v-else class="__va-input-styles-element">{{ elementName || 'Annotation' }}</span>
53
+ <span v-else class="__va-input-styles-element">{{ elementName || "Annotation" }}</span>
54
54
  </summary>
55
55
  <div class="__va-input-styles-block">
56
56
  <div
@@ -65,7 +65,7 @@ onMounted(() => {
65
65
  <div v-else-if="componentChain" class="__va-input-chain">
66
66
  <ComponentChain :chain="componentChain" variant="light" truncate="leaf" />
67
67
  </div>
68
- <span v-else class="__va-input-label">{{ elementName || 'Annotation' }}</span>
68
+ <span v-else class="__va-input-label">{{ elementName || "Annotation" }}</span>
69
69
  <input
70
70
  ref="inputEl"
71
71
  v-model="comment"
@@ -21,11 +21,11 @@ const markerStyle = computed(() => ({
21
21
  <div
22
22
  class="__va-marker"
23
23
  :class="{
24
- '__va-marker--fixed': isFixed,
25
- '__va-marker--stale': isStale,
26
- '__va-marker--pending': isPending,
27
- '__va-marker--selection': isSelection,
28
- }"
24
+ '__va-marker--fixed': isFixed,
25
+ '__va-marker--stale': isStale,
26
+ '__va-marker--pending': isPending,
27
+ '__va-marker--selection': isSelection
28
+ }"
29
29
  :style="markerStyle"
30
30
  data-agentation-vue
31
31
  @click.stop="$emit('click')"
@@ -45,7 +45,10 @@ const leafExpanded = ref(false);
45
45
  <span
46
46
  v-else-if="truncate === 'leaf'"
47
47
  class="__va-comp-chain"
48
- :class="[`__va-comp-chain--${variant}`, shouldTruncate ? '__va-comp-chain--collapsible' : '']"
48
+ :class="[
49
+ `__va-comp-chain--${variant}`,
50
+ shouldTruncate ? '__va-comp-chain--collapsible' : ''
51
+ ]"
49
52
  @click.stop="shouldTruncate ? leafExpanded = !leafExpanded : void 0"
50
53
  >
51
54
  <template v-if="!shouldTruncate || leafExpanded">
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed } from "vue-demi";
3
- import { boundingBoxToStyle } from "../utils/style";
3
+ import { boundingBoxToStyle } from "../utils/style.mjs";
4
4
  import ComponentChain from "./ComponentChain.vue";
5
5
  const props = defineProps({
6
6
  rect: { type: [Object, null], required: true },
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, toRef } from "vue-demi";
3
- import { vaTooltipDirective } from "../directives/vaTooltip";
3
+ import { vaTooltipDirective } from "../directives/vaTooltip.mjs";
4
4
  import VaIcon from "./VaIcon.vue";
5
5
  import VaToggle from "./VaToggle.vue";
6
6
  const props = defineProps({
@@ -72,12 +72,8 @@ function toggleTheme() {
72
72
  :key="color"
73
73
  type="button"
74
74
  class="__va-color-swatch"
75
- :class="{
76
- '__va-color-swatch--active': settings.markerColor === color
77
- }"
78
- :style="{
79
- background: color
80
- }"
75
+ :class="{ '__va-color-swatch--active': settings.markerColor === color }"
76
+ :style="{ background: color }"
81
77
  @click="update('markerColor', color)"
82
78
  />
83
79
  </div>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { nextTick, onBeforeUnmount, ref, watch } from "vue-demi";
3
- import { clamp } from "../utils/math";
3
+ import { clamp } from "../utils/math.mjs";
4
4
  import SettingsPanel from "./SettingsPanel.vue";
5
5
  const props = defineProps({
6
6
  open: { type: Boolean, required: true },
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { icons } from "../icons";
2
+ import { icons } from "../icons.mjs";
3
3
  defineProps({
4
4
  name: { type: null, required: true }
5
5
  });
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed } from "vue-demi";
3
- import { vaTooltipDirective } from "../directives/vaTooltip";
3
+ import { vaTooltipDirective } from "../directives/vaTooltip.mjs";
4
4
  const props = defineProps({
5
5
  active: { type: Boolean, required: false, default: false },
6
6
  disabled: { type: Boolean, required: false, default: false },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentation-vue",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Visual feedback tool for AI coding agents — Vue 2.7 & 3",
5
5
  "author": "Dorian Becker",
6
6
  "license": "PolyForm-Shield-1.0.0",
@@ -23,18 +23,12 @@
23
23
  ],
24
24
  "exports": {
25
25
  ".": {
26
- "import": {
27
- "types": "./dist/index.d.ts",
28
- "default": "./dist/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.ts",
32
- "default": "./dist/index.js"
33
- }
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.mjs"
34
28
  },
35
29
  "./style.css": "./dist/styles/agentation.css"
36
30
  },
37
- "main": "./dist/index.js",
31
+ "main": "./dist/index.mjs",
38
32
  "module": "./dist/index.mjs",
39
33
  "types": "./dist/index.d.ts",
40
34
  "files": [
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAnimationPause = useAnimationPause;
7
- var _vueDemi = require("vue-demi");
8
- function useAnimationPause() {
9
- const isPaused = (0, _vueDemi.ref)(false);
10
- let styleEl = null;
11
- function pause() {
12
- if (styleEl) return;
13
- styleEl = document.createElement("style");
14
- styleEl.setAttribute("data-agentation-pause", "");
15
- styleEl.textContent = `
16
- *, *::before, *::after {
17
- animation-play-state: paused !important;
18
- transition: none !important;
19
- }
20
- `;
21
- document.head.appendChild(styleEl);
22
- document.querySelectorAll("video").forEach(v => v.pause());
23
- isPaused.value = true;
24
- }
25
- function resume() {
26
- if (styleEl) {
27
- styleEl.remove();
28
- styleEl = null;
29
- }
30
- document.querySelectorAll("video").forEach(v => {
31
- v.play().catch(() => {});
32
- });
33
- isPaused.value = false;
34
- }
35
- function toggle() {
36
- if (isPaused.value) {
37
- resume();
38
- } else {
39
- pause();
40
- }
41
- }
42
- function cleanup() {
43
- if (isPaused.value) resume();
44
- }
45
- return {
46
- isPaused,
47
- toggle,
48
- pause,
49
- resume,
50
- cleanup
51
- };
52
- }
@@ -1,106 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAnnotations = useAnnotations;
7
- var _vueDemi = require("vue-demi");
8
- const STORAGE_KEY = "agentation-vue-annotations";
9
- function serializeAnnotations(annotations2) {
10
- return JSON.stringify(annotations2.map(({
11
- _targetRef,
12
- ...rest
13
- }) => rest));
14
- }
15
- function getCurrentUrl() {
16
- return typeof window !== "undefined" ? window.location.href : "";
17
- }
18
- function parseStore(raw, currentUrl) {
19
- if (!raw) return {};
20
- try {
21
- const parsed = JSON.parse(raw);
22
- if (Array.isArray(parsed)) return {
23
- [currentUrl]: parsed
24
- };
25
- if (!parsed || typeof parsed !== "object") return {};
26
- return Object.fromEntries(Object.entries(parsed).filter(([, value]) => Array.isArray(value)));
27
- } catch {}
28
- return {};
29
- }
30
- function loadAnnotations(url) {
31
- try {
32
- const stored = sessionStorage.getItem(STORAGE_KEY);
33
- const store = parseStore(stored, url);
34
- const annotations2 = store[url];
35
- return Array.isArray(annotations2) ? annotations2 : [];
36
- } catch {}
37
- return [];
38
- }
39
- function getCounterSeed(annotations2) {
40
- return annotations2.reduce((max, annotation) => {
41
- const parsed = Number.parseInt(annotation.id, 10);
42
- return Number.isFinite(parsed) ? Math.max(max, parsed) : max;
43
- }, 0);
44
- }
45
- const annotations = (0, _vueDemi.ref)([]);
46
- let scopedUrl = getCurrentUrl();
47
- let counter = 0;
48
- function setScopeUrl(url) {
49
- scopedUrl = url || getCurrentUrl();
50
- annotations.value = loadAnnotations(scopedUrl);
51
- counter = getCounterSeed(annotations.value);
52
- }
53
- function save() {
54
- try {
55
- const stored = sessionStorage.getItem(STORAGE_KEY);
56
- const store = parseStore(stored, scopedUrl);
57
- if (annotations.value.length > 0) store[scopedUrl] = annotations.value;else delete store[scopedUrl];
58
- const serialized = JSON.stringify(Object.fromEntries(Object.entries(store).map(([url, scopedAnnotations]) => [url, JSON.parse(serializeAnnotations(scopedAnnotations))])));
59
- sessionStorage.setItem(STORAGE_KEY, serialized);
60
- } catch {}
61
- }
62
- function addAnnotation(annotation) {
63
- counter++;
64
- const full = {
65
- ...annotation,
66
- url: annotation.url || scopedUrl,
67
- id: String(counter),
68
- timestamp: Date.now()
69
- };
70
- annotations.value.push(full);
71
- save();
72
- return full;
73
- }
74
- function removeAnnotation(id) {
75
- const index = annotations.value.findIndex(a => a.id === id);
76
- if (index === -1) return void 0;
77
- const [removed] = annotations.value.splice(index, 1);
78
- save();
79
- return removed;
80
- }
81
- function updateAnnotation(id, updates) {
82
- const ann = annotations.value.find(a => a.id === id);
83
- if (!ann) return void 0;
84
- Object.assign(ann, updates);
85
- save();
86
- return ann;
87
- }
88
- function clearAnnotations() {
89
- const cleared = [...annotations.value];
90
- annotations.value.splice(0);
91
- counter = 0;
92
- save();
93
- return cleared;
94
- }
95
- setScopeUrl(scopedUrl);
96
- function useAnnotations(initialUrl = getCurrentUrl()) {
97
- setScopeUrl(initialUrl);
98
- return {
99
- annotations,
100
- addAnnotation,
101
- removeAnnotation,
102
- updateAnnotation,
103
- clearAnnotations,
104
- setScopeUrl
105
- };
106
- }
@@ -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
- }