agentation-vue 0.2.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/LICENSE +27 -0
- package/dist/AgentationVue.d.vue.ts +27 -0
- package/dist/AgentationVue.vue +839 -0
- package/dist/AgentationVue.vue.d.ts +27 -0
- package/dist/components/AgentationToolbar.d.vue.ts +36 -0
- package/dist/components/AgentationToolbar.vue +233 -0
- package/dist/components/AgentationToolbar.vue.d.ts +36 -0
- package/dist/components/AnnotationInput.d.vue.ts +21 -0
- package/dist/components/AnnotationInput.vue +105 -0
- package/dist/components/AnnotationInput.vue.d.ts +21 -0
- package/dist/components/AnnotationMarker.d.vue.ts +15 -0
- package/dist/components/AnnotationMarker.vue +46 -0
- package/dist/components/AnnotationMarker.vue.d.ts +15 -0
- package/dist/components/ComponentChain.d.vue.ts +10 -0
- package/dist/components/ComponentChain.vue +91 -0
- package/dist/components/ComponentChain.vue.d.ts +10 -0
- package/dist/components/ElementHighlight.d.vue.ts +9 -0
- package/dist/components/ElementHighlight.vue +33 -0
- package/dist/components/ElementHighlight.vue.d.ts +9 -0
- package/dist/components/SettingsPanel.d.vue.ts +10 -0
- package/dist/components/SettingsPanel.vue +143 -0
- package/dist/components/SettingsPanel.vue.d.ts +10 -0
- package/dist/components/SettingsPopover.d.vue.ts +14 -0
- package/dist/components/SettingsPopover.vue +235 -0
- package/dist/components/SettingsPopover.vue.d.ts +14 -0
- package/dist/components/VaButton.d.vue.ts +23 -0
- package/dist/components/VaButton.vue +19 -0
- package/dist/components/VaButton.vue.d.ts +23 -0
- package/dist/components/VaIcon.d.vue.ts +6 -0
- package/dist/components/VaIcon.vue +18 -0
- package/dist/components/VaIcon.vue.d.ts +6 -0
- package/dist/components/VaIconButton.d.vue.ts +25 -0
- package/dist/components/VaIconButton.vue +43 -0
- package/dist/components/VaIconButton.vue.d.ts +25 -0
- package/dist/components/VaToggle.d.vue.ts +10 -0
- package/dist/components/VaToggle.vue +23 -0
- package/dist/components/VaToggle.vue.d.ts +10 -0
- package/dist/composables/useAnimationPause.d.ts +7 -0
- package/dist/composables/useAnimationPause.js +52 -0
- package/dist/composables/useAnimationPause.mjs +43 -0
- package/dist/composables/useAnnotations.d.ts +105 -0
- package/dist/composables/useAnnotations.js +106 -0
- package/dist/composables/useAnnotations.mjs +108 -0
- package/dist/composables/useAreaSelect.d.ts +21 -0
- package/dist/composables/useAreaSelect.js +62 -0
- package/dist/composables/useAreaSelect.mjs +41 -0
- package/dist/composables/useElementDetection.d.ts +22 -0
- package/dist/composables/useElementDetection.js +85 -0
- package/dist/composables/useElementDetection.mjs +82 -0
- package/dist/composables/useInteractionMode.d.ts +5 -0
- package/dist/composables/useInteractionMode.js +29 -0
- package/dist/composables/useInteractionMode.mjs +20 -0
- package/dist/composables/useKeyboardShortcuts.d.ts +43 -0
- package/dist/composables/useKeyboardShortcuts.js +202 -0
- package/dist/composables/useKeyboardShortcuts.mjs +223 -0
- package/dist/composables/useMarkerPositions.d.ts +5 -0
- package/dist/composables/useMarkerPositions.js +45 -0
- package/dist/composables/useMarkerPositions.mjs +36 -0
- package/dist/composables/useMultiSelect.d.ts +20 -0
- package/dist/composables/useMultiSelect.js +108 -0
- package/dist/composables/useMultiSelect.mjs +85 -0
- package/dist/composables/useOutputFormatter.d.ts +5 -0
- package/dist/composables/useOutputFormatter.js +100 -0
- package/dist/composables/useOutputFormatter.mjs +91 -0
- package/dist/composables/useSettings.d.ts +14 -0
- package/dist/composables/useSettings.js +48 -0
- package/dist/composables/useSettings.mjs +38 -0
- package/dist/composables/useTextSelection.d.ts +11 -0
- package/dist/composables/useTextSelection.js +33 -0
- package/dist/composables/useTextSelection.mjs +22 -0
- package/dist/composables/useToolbarAutoHide.d.ts +19 -0
- package/dist/composables/useToolbarAutoHide.js +270 -0
- package/dist/composables/useToolbarAutoHide.mjs +208 -0
- package/dist/composables/useToolbarDragSnap.d.ts +30 -0
- package/dist/composables/useToolbarDragSnap.js +296 -0
- package/dist/composables/useToolbarDragSnap.mjs +245 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +8 -0
- package/dist/constants.mjs +2 -0
- package/dist/directives/vaTooltip.d.ts +22 -0
- package/dist/directives/vaTooltip.js +241 -0
- package/dist/directives/vaTooltip.mjs +257 -0
- package/dist/icons.d.ts +16 -0
- package/dist/icons.js +21 -0
- package/dist/icons.mjs +15 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +168 -0
- package/dist/index.mjs +30 -0
- package/dist/styles/agentation.css +1 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.js +1 -0
- package/dist/types.mjs +0 -0
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +22 -0
- package/dist/utils/clipboard.mjs +16 -0
- package/dist/utils/dom-inspector.d.ts +7 -0
- package/dist/utils/dom-inspector.js +168 -0
- package/dist/utils/dom-inspector.mjs +242 -0
- package/dist/utils/math.d.ts +1 -0
- package/dist/utils/math.js +9 -0
- package/dist/utils/math.mjs +3 -0
- package/dist/utils/portal.d.ts +2 -0
- package/dist/utils/portal.js +18 -0
- package/dist/utils/portal.mjs +11 -0
- package/dist/utils/selectors.d.ts +3 -0
- package/dist/utils/selectors.js +103 -0
- package/dist/utils/selectors.mjs +105 -0
- package/dist/utils/style.d.ts +2 -0
- package/dist/utils/style.js +14 -0
- package/dist/utils/style.mjs +8 -0
- package/package.json +49 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Annotation, OutputDetail } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
outputDetail?: OutputDetail;
|
|
4
|
+
markerColor?: string;
|
|
5
|
+
copyToClipboard?: boolean;
|
|
6
|
+
blockPageInteractions?: boolean;
|
|
7
|
+
autoHideToolbar?: boolean;
|
|
8
|
+
pageUrl?: string;
|
|
9
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
10
|
+
activationKey?: 'none' | 'Meta' | 'Alt' | 'Shift';
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
|
|
13
|
+
copy: (markdown: string) => any;
|
|
14
|
+
"annotation-add": (annotation: Annotation) => any;
|
|
15
|
+
"annotation-delete": (annotation: Annotation) => any;
|
|
16
|
+
"annotation-update": (annotation: Annotation) => any;
|
|
17
|
+
"annotations-clear": (annotations: Annotation[]) => any;
|
|
18
|
+
}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onCopy?: ((markdown: string) => any) | undefined;
|
|
20
|
+
"onAnnotation-add"?: ((annotation: Annotation) => any) | undefined;
|
|
21
|
+
"onAnnotation-delete"?: ((annotation: Annotation) => any) | undefined;
|
|
22
|
+
"onAnnotation-update"?: ((annotation: Annotation) => any) | undefined;
|
|
23
|
+
"onAnnotations-clear"?: ((annotations: Annotation[]) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
copyToClipboard: boolean;
|
|
26
|
+
}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { InteractionMode, ToolbarAnchor } from '../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
mode: InteractionMode;
|
|
4
|
+
annotationCount: number;
|
|
5
|
+
isPaused: boolean;
|
|
6
|
+
isAreaMode: boolean;
|
|
7
|
+
autoHideEnabled: boolean;
|
|
8
|
+
placement: ToolbarAnchor;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {
|
|
11
|
+
expanded: import("vue-demi").Ref<boolean, boolean>;
|
|
12
|
+
placement: import("vue-demi").Ref<ToolbarAnchor, ToolbarAnchor>;
|
|
13
|
+
}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
|
|
14
|
+
activate: () => any;
|
|
15
|
+
copy: () => any;
|
|
16
|
+
clear: () => any;
|
|
17
|
+
deactivate: () => any;
|
|
18
|
+
"toggle-pause": () => any;
|
|
19
|
+
"toggle-area": (value: boolean) => any;
|
|
20
|
+
"update:placement": (value: ToolbarAnchor) => any;
|
|
21
|
+
"open-settings": (anchorEl: HTMLElement | null) => any;
|
|
22
|
+
"drag-start": () => any;
|
|
23
|
+
"drag-end": () => any;
|
|
24
|
+
}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
|
+
onActivate?: (() => any) | undefined;
|
|
26
|
+
onCopy?: (() => any) | undefined;
|
|
27
|
+
onClear?: (() => any) | undefined;
|
|
28
|
+
onDeactivate?: (() => any) | undefined;
|
|
29
|
+
"onToggle-pause"?: (() => any) | undefined;
|
|
30
|
+
"onToggle-area"?: ((value: boolean) => any) | undefined;
|
|
31
|
+
"onUpdate:placement"?: ((value: ToolbarAnchor) => any) | undefined;
|
|
32
|
+
"onOpen-settings"?: ((anchorEl: HTMLElement | null) => any) | undefined;
|
|
33
|
+
"onDrag-start"?: (() => any) | undefined;
|
|
34
|
+
"onDrag-end"?: (() => any) | undefined;
|
|
35
|
+
}>, {}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { InteractionMode, ToolbarAnchor } from '../types'
|
|
3
|
+
import { computed, onBeforeUnmount, ref, toRef, watch } from 'vue-demi'
|
|
4
|
+
import { useToolbarAutoHide } from '../composables/useToolbarAutoHide'
|
|
5
|
+
import { useToolbarDragSnap } from '../composables/useToolbarDragSnap'
|
|
6
|
+
import VaIcon from './VaIcon.vue'
|
|
7
|
+
import VaIconButton from './VaIconButton.vue'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
mode: InteractionMode
|
|
11
|
+
annotationCount: number
|
|
12
|
+
isPaused: boolean
|
|
13
|
+
isAreaMode: boolean
|
|
14
|
+
autoHideEnabled: boolean
|
|
15
|
+
placement: ToolbarAnchor
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits<{
|
|
19
|
+
'activate': []
|
|
20
|
+
'deactivate': []
|
|
21
|
+
'copy': []
|
|
22
|
+
'clear': []
|
|
23
|
+
'toggle-pause': []
|
|
24
|
+
'toggle-area': [value: boolean]
|
|
25
|
+
'update:placement': [value: ToolbarAnchor]
|
|
26
|
+
'open-settings': [anchorEl: HTMLElement | null]
|
|
27
|
+
'drag-start': []
|
|
28
|
+
'drag-end': []
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const expanded = ref(false)
|
|
32
|
+
const {
|
|
33
|
+
placement,
|
|
34
|
+
isDragging,
|
|
35
|
+
toolbarStyle,
|
|
36
|
+
toolbarEl,
|
|
37
|
+
snapAnchors,
|
|
38
|
+
activeSnapAnchor,
|
|
39
|
+
isExpandedDrag,
|
|
40
|
+
getSnapStyle,
|
|
41
|
+
onTogglePointerDown,
|
|
42
|
+
onHandlePointerDown,
|
|
43
|
+
onPointerMove,
|
|
44
|
+
onPointerUp,
|
|
45
|
+
onPointerCancel,
|
|
46
|
+
consumeToggleClickSuppression,
|
|
47
|
+
cleanup,
|
|
48
|
+
} = useToolbarDragSnap({
|
|
49
|
+
expanded,
|
|
50
|
+
initialPlacement: props.placement,
|
|
51
|
+
onDragStart: () => emit('drag-start'),
|
|
52
|
+
onDragEnd: () => emit('drag-end'),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const autoHideEnabled = toRef(props, 'autoHideEnabled')
|
|
56
|
+
const {
|
|
57
|
+
isAutoHideActive,
|
|
58
|
+
isAutoHideRevealed,
|
|
59
|
+
onToolbarPointerEnter,
|
|
60
|
+
onToolbarPointerLeave,
|
|
61
|
+
onToolbarPointerDown,
|
|
62
|
+
onToolbarFocusIn,
|
|
63
|
+
onToolbarFocusOut,
|
|
64
|
+
} = useToolbarAutoHide({
|
|
65
|
+
enabled: autoHideEnabled,
|
|
66
|
+
expanded,
|
|
67
|
+
isDragging,
|
|
68
|
+
placement,
|
|
69
|
+
toolbarEl,
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const toolbarClass = computed(() => [
|
|
73
|
+
`__va-toolbar--place-${placement.value}`,
|
|
74
|
+
{
|
|
75
|
+
'__va-toolbar--collapsed': !expanded.value,
|
|
76
|
+
'__va-toolbar--expanded': expanded.value,
|
|
77
|
+
'__va-toolbar--dragging': isDragging.value,
|
|
78
|
+
'__va-toolbar--auto-hide': isAutoHideActive.value,
|
|
79
|
+
'__va-toolbar--auto-hide-revealed': isAutoHideRevealed.value,
|
|
80
|
+
},
|
|
81
|
+
])
|
|
82
|
+
|
|
83
|
+
function onToggleClick() {
|
|
84
|
+
if (consumeToggleClickSuppression()) {
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
onActivate()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function onActivate() {
|
|
91
|
+
expanded.value = true
|
|
92
|
+
emit('activate')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function onDeactivate() {
|
|
96
|
+
expanded.value = false
|
|
97
|
+
emit('deactivate')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function onClear() {
|
|
101
|
+
// eslint-disable-next-line no-alert
|
|
102
|
+
if (confirm('Clear all annotations?'))
|
|
103
|
+
emit('clear')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function onOpenSettings(e: MouseEvent) {
|
|
107
|
+
const anchorEl = e.currentTarget instanceof HTMLElement ? e.currentTarget : null
|
|
108
|
+
emit('open-settings', anchorEl)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
onBeforeUnmount(() => {
|
|
112
|
+
cleanup()
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
watch(
|
|
116
|
+
() => props.placement,
|
|
117
|
+
(value) => {
|
|
118
|
+
if (placement.value !== value)
|
|
119
|
+
placement.value = value
|
|
120
|
+
},
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
watch(placement, value => emit('update:placement', value))
|
|
124
|
+
|
|
125
|
+
defineExpose({ expanded, placement })
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<div class="__va-toolbar-layer" data-agentation-vue>
|
|
130
|
+
<div v-if="isDragging" class="__va-snap-zones" aria-hidden="true">
|
|
131
|
+
<div
|
|
132
|
+
v-for="anchor in snapAnchors"
|
|
133
|
+
:key="anchor"
|
|
134
|
+
class="__va-snap-zone"
|
|
135
|
+
:class="{ '__va-snap-zone--active': activeSnapAnchor === anchor, '__va-snap-zone--rect': isExpandedDrag }"
|
|
136
|
+
:style="getSnapStyle(anchor)"
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div
|
|
141
|
+
ref="toolbarEl"
|
|
142
|
+
class="__va-toolbar"
|
|
143
|
+
:class="toolbarClass"
|
|
144
|
+
:style="toolbarStyle"
|
|
145
|
+
@pointerenter="onToolbarPointerEnter"
|
|
146
|
+
@pointerleave="onToolbarPointerLeave"
|
|
147
|
+
@pointerdown.capture="onToolbarPointerDown"
|
|
148
|
+
@focusin="onToolbarFocusIn"
|
|
149
|
+
@focusout="onToolbarFocusOut"
|
|
150
|
+
>
|
|
151
|
+
<div class="__va-toolbar-stage __va-toolbar-stage--toggle" :aria-hidden="expanded">
|
|
152
|
+
<button
|
|
153
|
+
type="button"
|
|
154
|
+
class="__va-toolbar-toggle"
|
|
155
|
+
aria-label="Appui long pour déplacer"
|
|
156
|
+
@click="onToggleClick"
|
|
157
|
+
@pointerdown="onTogglePointerDown"
|
|
158
|
+
@pointermove="onPointerMove"
|
|
159
|
+
@pointerup="onPointerUp"
|
|
160
|
+
@pointercancel="onPointerCancel"
|
|
161
|
+
>
|
|
162
|
+
<VaIcon name="cursor" />
|
|
163
|
+
<span v-if="annotationCount > 0" class="__va-toolbar-badge">{{ annotationCount }}</span>
|
|
164
|
+
</button>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div class="__va-toolbar-stage __va-toolbar-stage--menu" :aria-hidden="!expanded">
|
|
168
|
+
<button
|
|
169
|
+
type="button"
|
|
170
|
+
class="__va-drag-handle"
|
|
171
|
+
aria-label="Glisser pour déplacer"
|
|
172
|
+
@pointerdown="onHandlePointerDown"
|
|
173
|
+
@pointermove="onPointerMove"
|
|
174
|
+
@pointerup="onPointerUp"
|
|
175
|
+
@pointercancel="onPointerCancel"
|
|
176
|
+
>
|
|
177
|
+
<span class="__va-drag-handle-dots" aria-hidden="true">
|
|
178
|
+
<span />
|
|
179
|
+
<span />
|
|
180
|
+
<span />
|
|
181
|
+
<span />
|
|
182
|
+
<span />
|
|
183
|
+
<span />
|
|
184
|
+
</span>
|
|
185
|
+
</button>
|
|
186
|
+
|
|
187
|
+
<div class="__va-toolbar-sep" />
|
|
188
|
+
|
|
189
|
+
<!-- Element selector (default mode) -->
|
|
190
|
+
<VaIconButton :active="!isAreaMode" title="Element selector" shortcut="V" @click="emit('toggle-area', false)">
|
|
191
|
+
<VaIcon name="cursor" />
|
|
192
|
+
</VaIconButton>
|
|
193
|
+
|
|
194
|
+
<!-- Area selection -->
|
|
195
|
+
<VaIconButton :active="isAreaMode" title="Area selection" shortcut="A" @click="emit('toggle-area', true)">
|
|
196
|
+
<VaIcon name="area-select" />
|
|
197
|
+
</VaIconButton>
|
|
198
|
+
|
|
199
|
+
<div class="__va-toolbar-sep" />
|
|
200
|
+
|
|
201
|
+
<!-- Pause animations -->
|
|
202
|
+
<VaIconButton :active="isPaused" title="Pause animations" shortcut="P" @click="emit('toggle-pause')">
|
|
203
|
+
<VaIcon v-if="!isPaused" name="pause" />
|
|
204
|
+
<VaIcon v-else name="play" />
|
|
205
|
+
</VaIconButton>
|
|
206
|
+
|
|
207
|
+
<div class="__va-toolbar-sep" />
|
|
208
|
+
|
|
209
|
+
<!-- Copy -->
|
|
210
|
+
<VaIconButton :disabled="annotationCount === 0" title="Copy annotations" shortcut="C" @click="$emit('copy')">
|
|
211
|
+
<VaIcon name="copy" />
|
|
212
|
+
</VaIconButton>
|
|
213
|
+
|
|
214
|
+
<!-- Clear -->
|
|
215
|
+
<VaIconButton :disabled="annotationCount === 0" title="Clear annotations" shortcut="Backspace" @click="onClear">
|
|
216
|
+
<VaIcon name="trash" />
|
|
217
|
+
</VaIconButton>
|
|
218
|
+
|
|
219
|
+
<div class="__va-toolbar-sep" />
|
|
220
|
+
|
|
221
|
+
<!-- Settings -->
|
|
222
|
+
<VaIconButton title="Settings" @click="onOpenSettings">
|
|
223
|
+
<VaIcon name="settings" />
|
|
224
|
+
</VaIconButton>
|
|
225
|
+
|
|
226
|
+
<!-- Minimize -->
|
|
227
|
+
<VaIconButton title="Minimize" shortcut="Esc" @click="onDeactivate">
|
|
228
|
+
<VaIcon name="close" />
|
|
229
|
+
</VaIconButton>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { InteractionMode, ToolbarAnchor } from '../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
mode: InteractionMode;
|
|
4
|
+
annotationCount: number;
|
|
5
|
+
isPaused: boolean;
|
|
6
|
+
isAreaMode: boolean;
|
|
7
|
+
autoHideEnabled: boolean;
|
|
8
|
+
placement: ToolbarAnchor;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {
|
|
11
|
+
expanded: import("vue-demi").Ref<boolean, boolean>;
|
|
12
|
+
placement: import("vue-demi").Ref<ToolbarAnchor, ToolbarAnchor>;
|
|
13
|
+
}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
|
|
14
|
+
activate: () => any;
|
|
15
|
+
copy: () => any;
|
|
16
|
+
clear: () => any;
|
|
17
|
+
deactivate: () => any;
|
|
18
|
+
"toggle-pause": () => any;
|
|
19
|
+
"toggle-area": (value: boolean) => any;
|
|
20
|
+
"update:placement": (value: ToolbarAnchor) => any;
|
|
21
|
+
"open-settings": (anchorEl: HTMLElement | null) => any;
|
|
22
|
+
"drag-start": () => any;
|
|
23
|
+
"drag-end": () => any;
|
|
24
|
+
}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
|
+
onActivate?: (() => any) | undefined;
|
|
26
|
+
onCopy?: (() => any) | undefined;
|
|
27
|
+
onClear?: (() => any) | undefined;
|
|
28
|
+
onDeactivate?: (() => any) | undefined;
|
|
29
|
+
"onToggle-pause"?: (() => any) | undefined;
|
|
30
|
+
"onToggle-area"?: ((value: boolean) => any) | undefined;
|
|
31
|
+
"onUpdate:placement"?: ((value: ToolbarAnchor) => any) | undefined;
|
|
32
|
+
"onOpen-settings"?: ((anchorEl: HTMLElement | null) => any) | undefined;
|
|
33
|
+
"onDrag-start"?: (() => any) | undefined;
|
|
34
|
+
"onDrag-end"?: (() => any) | undefined;
|
|
35
|
+
}>, {}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
position: {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
elementName?: string;
|
|
7
|
+
componentChain?: string;
|
|
8
|
+
computedStyles?: Record<string, string>;
|
|
9
|
+
initialComment?: string;
|
|
10
|
+
isEditing?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
|
|
13
|
+
cancel: () => any;
|
|
14
|
+
add: (comment: string) => any;
|
|
15
|
+
delete: () => any;
|
|
16
|
+
}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
onCancel?: (() => any) | undefined;
|
|
18
|
+
onAdd?: ((comment: string) => any) | undefined;
|
|
19
|
+
onDelete?: (() => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref } from 'vue-demi'
|
|
3
|
+
import ComponentChain from './ComponentChain.vue'
|
|
4
|
+
import VaButton from './VaButton.vue'
|
|
5
|
+
import VaIcon from './VaIcon.vue'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
position: { x: number, y: number }
|
|
9
|
+
elementName?: string
|
|
10
|
+
componentChain?: string
|
|
11
|
+
computedStyles?: Record<string, string>
|
|
12
|
+
initialComment?: string
|
|
13
|
+
isEditing?: boolean
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
add: [comment: string]
|
|
18
|
+
cancel: []
|
|
19
|
+
delete: []
|
|
20
|
+
}>()
|
|
21
|
+
|
|
22
|
+
const comment = ref(props.initialComment || '')
|
|
23
|
+
const inputEl = ref<HTMLInputElement | null>(null)
|
|
24
|
+
const computedStyleEntries = computed(() => Object.entries(props.computedStyles || {}))
|
|
25
|
+
|
|
26
|
+
const inputStyle = computed(() => {
|
|
27
|
+
const x = Math.min(props.position.x, window.innerWidth - 380)
|
|
28
|
+
const y = Math.min(props.position.y + 20, window.innerHeight - 150)
|
|
29
|
+
return {
|
|
30
|
+
left: `${Math.max(10, x)}px`,
|
|
31
|
+
top: `${Math.max(10, y)}px`,
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
function onAdd() {
|
|
36
|
+
const text = comment.value.trim()
|
|
37
|
+
if (!text)
|
|
38
|
+
return
|
|
39
|
+
emit('add', text)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onMounted(() => {
|
|
43
|
+
inputEl.value?.focus()
|
|
44
|
+
})
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<template>
|
|
48
|
+
<div
|
|
49
|
+
class="__va-input"
|
|
50
|
+
:style="inputStyle"
|
|
51
|
+
data-agentation-vue
|
|
52
|
+
@click.stop
|
|
53
|
+
@mousedown.stop
|
|
54
|
+
>
|
|
55
|
+
<details
|
|
56
|
+
v-if="computedStyleEntries.length > 0"
|
|
57
|
+
class="__va-input-styles"
|
|
58
|
+
@click.stop
|
|
59
|
+
@mousedown.stop
|
|
60
|
+
>
|
|
61
|
+
<summary class="__va-input-styles-summary">
|
|
62
|
+
<ComponentChain v-if="componentChain" :chain="componentChain" variant="light" truncate="leaf" />
|
|
63
|
+
<span v-else class="__va-input-styles-element">{{ elementName || 'Annotation' }}</span>
|
|
64
|
+
</summary>
|
|
65
|
+
<div class="__va-input-styles-block">
|
|
66
|
+
<div
|
|
67
|
+
v-for="[prop, value] in computedStyleEntries"
|
|
68
|
+
:key="prop"
|
|
69
|
+
class="__va-input-style-line"
|
|
70
|
+
>
|
|
71
|
+
<span class="__va-input-style-prop">{{ prop }}</span>: <span class="__va-input-style-value">{{ value }}</span>;
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</details>
|
|
75
|
+
<div v-else-if="componentChain" class="__va-input-chain">
|
|
76
|
+
<ComponentChain :chain="componentChain" variant="light" truncate="leaf" />
|
|
77
|
+
</div>
|
|
78
|
+
<span v-else class="__va-input-label">{{ elementName || 'Annotation' }}</span>
|
|
79
|
+
<input
|
|
80
|
+
ref="inputEl"
|
|
81
|
+
v-model="comment"
|
|
82
|
+
placeholder="Add a comment..."
|
|
83
|
+
@keydown.enter="onAdd"
|
|
84
|
+
@keydown.escape="$emit('cancel')"
|
|
85
|
+
>
|
|
86
|
+
<div class="__va-input-actions">
|
|
87
|
+
<button
|
|
88
|
+
v-if="isEditing"
|
|
89
|
+
class="__va-input-delete-btn"
|
|
90
|
+
type="button"
|
|
91
|
+
@click="$emit('delete')"
|
|
92
|
+
>
|
|
93
|
+
<VaIcon name="trash" />
|
|
94
|
+
</button>
|
|
95
|
+
<div class="__va-input-actions-right">
|
|
96
|
+
<VaButton variant="secondary" @click="$emit('cancel')">
|
|
97
|
+
Cancel
|
|
98
|
+
</VaButton>
|
|
99
|
+
<VaButton :disabled="!comment.trim()" @click="onAdd">
|
|
100
|
+
{{ isEditing ? 'Save' : 'Add' }}
|
|
101
|
+
</VaButton>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
position: {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
elementName?: string;
|
|
7
|
+
componentChain?: string;
|
|
8
|
+
computedStyles?: Record<string, string>;
|
|
9
|
+
initialComment?: string;
|
|
10
|
+
isEditing?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
|
|
13
|
+
cancel: () => any;
|
|
14
|
+
add: (comment: string) => any;
|
|
15
|
+
delete: () => any;
|
|
16
|
+
}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
onCancel?: (() => any) | undefined;
|
|
18
|
+
onAdd?: ((comment: string) => any) | undefined;
|
|
19
|
+
onDelete?: (() => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
number: number;
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
isFixed?: boolean;
|
|
6
|
+
isStale?: boolean;
|
|
7
|
+
isPending?: boolean;
|
|
8
|
+
isSelection?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
|
|
11
|
+
click: () => any;
|
|
12
|
+
}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onClick?: (() => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue-demi'
|
|
3
|
+
import VaIcon from './VaIcon.vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
number: number
|
|
7
|
+
x: number
|
|
8
|
+
y: number
|
|
9
|
+
isFixed?: boolean
|
|
10
|
+
isStale?: boolean
|
|
11
|
+
isPending?: boolean
|
|
12
|
+
isSelection?: boolean
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
defineEmits<{
|
|
16
|
+
click: []
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
const markerStyle = computed(() => ({
|
|
20
|
+
left: `${props.x}%`,
|
|
21
|
+
top: `${props.y}px`,
|
|
22
|
+
}))
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div
|
|
27
|
+
class="__va-marker"
|
|
28
|
+
:class="{
|
|
29
|
+
'__va-marker--fixed': isFixed,
|
|
30
|
+
'__va-marker--stale': isStale,
|
|
31
|
+
'__va-marker--pending': isPending,
|
|
32
|
+
'__va-marker--selection': isSelection,
|
|
33
|
+
}"
|
|
34
|
+
:style="markerStyle"
|
|
35
|
+
data-agentation-vue
|
|
36
|
+
@click.stop="$emit('click')"
|
|
37
|
+
>
|
|
38
|
+
<template v-if="isPending">
|
|
39
|
+
<VaIcon name="plus" class="__va-marker-plus" />
|
|
40
|
+
</template>
|
|
41
|
+
<template v-else>
|
|
42
|
+
<span class="__va-marker-number">{{ number }}</span>
|
|
43
|
+
<VaIcon name="pencil" class="__va-marker-pencil" />
|
|
44
|
+
</template>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
number: number;
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
isFixed?: boolean;
|
|
6
|
+
isStale?: boolean;
|
|
7
|
+
isPending?: boolean;
|
|
8
|
+
isSelection?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {
|
|
11
|
+
click: () => any;
|
|
12
|
+
}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onClick?: (() => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
chain: string;
|
|
3
|
+
variant?: 'dark' | 'light';
|
|
4
|
+
truncate?: 'none' | 'auto' | 'leaf';
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
variant: "dark" | "light";
|
|
8
|
+
truncate: "none" | "auto" | "leaf";
|
|
9
|
+
}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue-demi'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
chain: string
|
|
6
|
+
variant?: 'dark' | 'light'
|
|
7
|
+
truncate?: 'none' | 'auto' | 'leaf'
|
|
8
|
+
}>(), {
|
|
9
|
+
variant: 'light',
|
|
10
|
+
truncate: 'none',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const TRUNCATE_THRESHOLD = 4
|
|
14
|
+
|
|
15
|
+
const components = computed(() => props.chain.split(' > '))
|
|
16
|
+
const shouldTruncate = computed(() => components.value.length >= TRUNCATE_THRESHOLD)
|
|
17
|
+
|
|
18
|
+
// For 'auto' mode: first + ellipsis + last 2
|
|
19
|
+
const autoTruncated = computed(() => {
|
|
20
|
+
if (!shouldTruncate.value)
|
|
21
|
+
return components.value
|
|
22
|
+
const all = components.value
|
|
23
|
+
return [all[0], null, all[all.length - 2], all[all.length - 1]] as (string | null)[]
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// For 'leaf' mode
|
|
27
|
+
const leafExpanded = ref(false)
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<!-- Mode: 'auto' — automatic breadcrumb collapse for hover labels -->
|
|
32
|
+
<span
|
|
33
|
+
v-if="truncate === 'auto'"
|
|
34
|
+
class="__va-comp-chain"
|
|
35
|
+
:class="`__va-comp-chain--${variant}`"
|
|
36
|
+
>
|
|
37
|
+
<template v-if="shouldTruncate">
|
|
38
|
+
<span
|
|
39
|
+
v-for="(comp, i) in autoTruncated"
|
|
40
|
+
:key="i"
|
|
41
|
+
:class="comp === null ? '__va-comp-ellipsis' : '__va-comp'"
|
|
42
|
+
>
|
|
43
|
+
<template v-if="comp === null">…</template>
|
|
44
|
+
<template v-else><span class="__va-comp-bracket"><</span>{{ comp }}<span class="__va-comp-bracket">></span></template>
|
|
45
|
+
</span>
|
|
46
|
+
</template>
|
|
47
|
+
<template v-else>
|
|
48
|
+
<span v-for="comp in components" :key="comp" class="__va-comp">
|
|
49
|
+
<span class="__va-comp-bracket"><</span>{{ comp }}<span class="__va-comp-bracket">></span>
|
|
50
|
+
</span>
|
|
51
|
+
</template>
|
|
52
|
+
</span>
|
|
53
|
+
|
|
54
|
+
<!-- Mode: 'leaf' — collapsed breadcrumb with click-to-expand -->
|
|
55
|
+
<span
|
|
56
|
+
v-else-if="truncate === 'leaf'"
|
|
57
|
+
class="__va-comp-chain"
|
|
58
|
+
:class="[
|
|
59
|
+
`__va-comp-chain--${variant}`,
|
|
60
|
+
shouldTruncate ? '__va-comp-chain--collapsible' : '',
|
|
61
|
+
]"
|
|
62
|
+
@click.stop="shouldTruncate ? (leafExpanded = !leafExpanded) : undefined"
|
|
63
|
+
>
|
|
64
|
+
<template v-if="!shouldTruncate || leafExpanded">
|
|
65
|
+
<span v-for="comp in components" :key="comp" class="__va-comp">
|
|
66
|
+
<span class="__va-comp-bracket"><</span>{{ comp }}<span class="__va-comp-bracket">></span>
|
|
67
|
+
</span>
|
|
68
|
+
</template>
|
|
69
|
+
<template v-else>
|
|
70
|
+
<span
|
|
71
|
+
v-for="(comp, i) in autoTruncated"
|
|
72
|
+
:key="i"
|
|
73
|
+
:class="comp === null ? '__va-comp-ellipsis' : '__va-comp'"
|
|
74
|
+
>
|
|
75
|
+
<template v-if="comp === null">…</template>
|
|
76
|
+
<template v-else><span class="__va-comp-bracket"><</span>{{ comp }}<span class="__va-comp-bracket">></span></template>
|
|
77
|
+
</span>
|
|
78
|
+
</template>
|
|
79
|
+
</span>
|
|
80
|
+
|
|
81
|
+
<!-- Mode: 'none' (default) — full chain -->
|
|
82
|
+
<span
|
|
83
|
+
v-else
|
|
84
|
+
class="__va-comp-chain"
|
|
85
|
+
:class="`__va-comp-chain--${variant}`"
|
|
86
|
+
>
|
|
87
|
+
<span v-for="comp in components" :key="comp" class="__va-comp">
|
|
88
|
+
<span class="__va-comp-bracket"><</span>{{ comp }}<span class="__va-comp-bracket">></span>
|
|
89
|
+
</span>
|
|
90
|
+
</span>
|
|
91
|
+
</template>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
chain: string;
|
|
3
|
+
variant?: 'dark' | 'light';
|
|
4
|
+
truncate?: 'none' | 'auto' | 'leaf';
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue-demi").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
7
|
+
variant: "dark" | "light";
|
|
8
|
+
truncate: "none" | "auto" | "leaf";
|
|
9
|
+
}, {}, {}, {}, string, import("vue-demi").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
export default _default;
|