agentation-vue3 1.0.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/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # agentation-vue3
2
+
3
+ [中文](#中文) | [English](#english)
4
+
5
+ ---
6
+
7
+ ## 中文
8
+
9
+ > **作者 [binyy](https://github.com/408460486)**,基于 [Benji Taylor](https://x.com/benjitaylor)、[Dennis Jin](https://x.com/seldom) 和 [Alex Vanderzon](https://x.com/alexvanderzon) 的 React 版本
10
+ >
11
+ > 原始 React 版本:[GitHub](https://github.com/benjitaylor/agentation) · [NPM](https://www.npmjs.com/package/agentation)
12
+
13
+ Agentation 是一个与 AI 工具无关的 Vue 3 可视化反馈工具。点击页面上的元素,添加注释,然后复制结构化输出,帮助 AI 编程助手找到您所指的确切代码。
14
+
15
+ ### 安装
16
+
17
+ ```bash
18
+ npm install agentation-vue3 -D
19
+ ```
20
+
21
+ ### 使用方法
22
+
23
+ ```vue
24
+ <script setup>
25
+ import { Agentation } from 'agentation-vue3'
26
+ import 'agentation-vue3/dist/style.css'
27
+ </script>
28
+
29
+ <template>
30
+ <YourApp />
31
+ <Agentation />
32
+ </template>
33
+ ```
34
+
35
+ 工具栏出现在右下角。点击激活,然后点击任意元素进行标注。
36
+
37
+ ### 属性
38
+
39
+ | 属性 | 类型 | 默认值 | 描述 |
40
+ |------|------|--------|------|
41
+ | `accentColor` | `string` | `'#3c82f7'` | 自定义强调色(十六进制) |
42
+ | `copyToClipboard` | `boolean` | `true` | 点击复制按钮时是否复制到剪贴板 |
43
+ | `lightMode` | `boolean` | `false` | 浅色模式样式 |
44
+ | `zIndex` | `number` | `2147483647` | 工具栏的 z-index |
45
+
46
+ ### 功能特性
47
+
48
+ - **点击标注** – 点击任意元素,自动识别选择器
49
+ - **文本选择** – 选择文本以标注特定内容
50
+ - **动画暂停** – 冻结 CSS 动画以捕获特定状态
51
+ - **结构化输出** – 复制包含选择器、位置和上下文的 markdown
52
+ - **深色/浅色模式** – 匹配您的偏好或手动设置
53
+ - **可拖拽工具栏** – 将工具栏重新定位到屏幕任意位置
54
+ - **键盘快捷键** – 按 ESC 关闭工具栏
55
+ - **零依赖** – 纯 CSS 动画,无运行时库
56
+
57
+ ### 工作原理
58
+
59
+ Agentation 捕获类名、选择器和元素位置,以便 AI 助手可以 `grep` 搜索您所指的确切代码。您不再需要描述"侧边栏中的蓝色按钮",而是直接给 AI 助手提供 `.sidebar > button.primary` 和您的反馈。
60
+
61
+ ### 系统要求
62
+
63
+ - Vue 3.3+
64
+ - 桌面浏览器(不支持移动端)
65
+
66
+ ### 文档
67
+
68
+ 完整文档请访问 [agentation.dev](https://agentation.dev)
69
+
70
+ ---
71
+
72
+ ## English
73
+
74
+ > **Made by [binyy](https://github.com/408460486)**, forked from [Benji Taylor](https://x.com/benjitaylor), [Dennis Jin](https://x.com/seldom), and [Alex Vanderzon](https://x.com/alexvanderzon)'s React version
75
+ >
76
+ > Original React Version: [GitHub](https://github.com/benjitaylor/agentation) · [NPM](https://www.npmjs.com/package/agentation)
77
+
78
+ Agentation is an agent-agnostic visual feedback tool for Vue 3. Click elements on your page, add notes, and copy structured output that helps AI coding agents find the exact code you're referring to.
79
+
80
+ ### Install
81
+
82
+ ```bash
83
+ npm install agentation-vue3 -D
84
+ ```
85
+
86
+ ### Usage
87
+
88
+ ```vue
89
+ <script setup>
90
+ import { Agentation } from 'agentation-vue3'
91
+ import 'agentation-vue3/dist/style.css'
92
+ </script>
93
+
94
+ <template>
95
+ <YourApp />
96
+ <Agentation />
97
+ </template>
98
+ ```
99
+
100
+ The toolbar appears in the bottom-right corner. Click to activate, then click any element to annotate it.
101
+
102
+ ### Props
103
+
104
+ | Prop | Type | Default | Description |
105
+ |------|------|---------|-------------|
106
+ | `accentColor` | `string` | `'#3c82f7'` | Custom accent color (hex) |
107
+ | `copyToClipboard` | `boolean` | `true` | Whether to copy to clipboard when the copy button is clicked |
108
+ | `lightMode` | `boolean` | `false` | Light mode styling |
109
+ | `zIndex` | `number` | `2147483647` | z-index for the toolbar |
110
+
111
+ ### Features
112
+
113
+ - **Click to annotate** – Click any element with automatic selector identification
114
+ - **Text selection** – Select text to annotate specific content
115
+ - **Animation pause** – Freeze CSS animations to capture specific states
116
+ - **Structured output** – Copy markdown with selectors, positions, and context
117
+ - **Dark/light mode** – Matches your preference or set manually
118
+ - **Draggable toolbar** – Reposition the toolbar anywhere on screen
119
+ - **Keyboard shortcuts** – Press ESC to close the toolbar
120
+ - **Zero dependencies** – Pure CSS animations, no runtime libraries
121
+
122
+ ### How it works
123
+
124
+ Agentation captures class names, selectors, and element positions so AI agents can `grep` for the exact code you're referring to. Instead of describing "the blue button in the sidebar," you give the agent `.sidebar > button.primary` and your feedback.
125
+
126
+ ### Requirements
127
+
128
+ - Vue 3.3+
129
+ - Desktop browser (mobile not supported)
130
+
131
+ ### Docs
132
+
133
+ Full documentation at [agentation.dev](https://agentation.dev)
134
+
135
+ ---
136
+
137
+ ## License
138
+
139
+ © 2026 Binyy
140
+ Licensed under PolyForm Shield 1.0.0
@@ -0,0 +1,426 @@
1
+ import { ComponentOptionsMixin } from 'vue';
2
+ import { ComponentProvideOptions } from 'vue';
3
+ import { CSSProperties } from 'vue';
4
+ import { DefineComponent } from 'vue';
5
+ import { ExtractPropTypes } from 'vue';
6
+ import { FunctionalComponent } from 'vue';
7
+ import { PropType } from 'vue';
8
+ import { PublicProps } from 'vue';
9
+
10
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
+
12
+ declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
13
+
14
+ declare type __VLS_Prettify<T> = {
15
+ [K in keyof T]: T[K];
16
+ } & {};
17
+
18
+ declare type __VLS_Prettify_2<T> = {
19
+ [K in keyof T]: T[K];
20
+ } & {};
21
+
22
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
23
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
24
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
25
+ } : {
26
+ type: PropType<T[K]>;
27
+ required: true;
28
+ };
29
+ };
30
+
31
+ declare type __VLS_TypePropsToRuntimeProps_2<T> = {
32
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
33
+ type: PropType<__VLS_NonUndefinedable_2<T[K]>>;
34
+ } : {
35
+ type: PropType<T[K]>;
36
+ required: true;
37
+ };
38
+ };
39
+
40
+ declare type __VLS_WithDefaults<P, D> = {
41
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
42
+ default: D[K];
43
+ }> : P[K];
44
+ };
45
+
46
+ declare type __VLS_WithDefaults_2<P, D> = {
47
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_2<P[K] & {
48
+ default: D[K];
49
+ }> : P[K];
50
+ };
51
+
52
+ export declare interface AgentationProps {
53
+ /** Custom accent color (hex) */
54
+ accentColor?: string;
55
+ /** Whether to copy to clipboard when the copy button is clicked */
56
+ copyToClipboard?: boolean;
57
+ /** Light mode styling */
58
+ lightMode?: boolean;
59
+ /** z-index for the toolbar */
60
+ zIndex?: number;
61
+ /** Demo annotations to show on page load */
62
+ demoAnnotations?: Array<{
63
+ selector: string;
64
+ comment: string;
65
+ }>;
66
+ /** Delay before showing demo annotations (ms) */
67
+ demoDelay?: number;
68
+ /** Enable demo mode */
69
+ enableDemoMode?: boolean;
70
+ }
71
+
72
+ export declare const AnimatedBunny: FunctionalComponent<IconPropsWithColor>;
73
+
74
+ /**
75
+ * Annotation Type | 标注类型
76
+ *
77
+ * Represents a single annotation created by the user on a web page element.
78
+ * Contains all metadata needed to identify, locate, and describe the annotated element.
79
+ *
80
+ * 表示用户在网页元素上创建的单个标注。
81
+ * 包含识别、定位和描述被标注元素所需的所有元数据。
82
+ */
83
+ export declare type Annotation = {
84
+ /** Unique identifier for the annotation | 标注的唯一标识符 */
85
+ id: string;
86
+ /** X position as percentage of viewport width | X 位置(视口宽度的百分比) */
87
+ x: number;
88
+ /**
89
+ * Y position in pixels from top of document (absolute positioning)
90
+ * OR from viewport top (if isFixed is true)
91
+ * Y 位置(从文档顶部的像素值,或如果 isFixed 为 true 则从视口顶部)
92
+ */
93
+ y: number;
94
+ /** User's comment/feedback text | 用户的评论/反馈文本 */
95
+ comment: string;
96
+ /** Human-readable element name (e.g., "button 'Submit'") | 人类可读的元素名称 */
97
+ element: string;
98
+ /** CSS selector path to the element (e.g., ".form > button.primary") | 元素的 CSS 选择器路径 */
99
+ elementPath: string;
100
+ /** Unix timestamp when annotation was created | 创建标注时的 Unix 时间戳 */
101
+ timestamp: number;
102
+ /** Selected text content if user selected text | 用户选中的文本内容(如果有) */
103
+ selectedText?: string;
104
+ /**
105
+ * Element's bounding box coordinates and dimensions
106
+ * 元素的边界框坐标和尺寸
107
+ */
108
+ boundingBox?: {
109
+ x: number;
110
+ y: number;
111
+ width: number;
112
+ height: number;
113
+ };
114
+ /** Text content from element and nearby siblings | 元素及其相邻兄弟元素的文本内容 */
115
+ nearbyText?: string;
116
+ /** CSS class names (cleaned of module hashes) | CSS 类名(已清理模块哈希) */
117
+ cssClasses?: string;
118
+ /** Identifiers of nearby sibling elements | 相邻兄弟元素的标识符 */
119
+ nearbyElements?: string;
120
+ /** Computed CSS styles snapshot | 计算后的 CSS 样式快照 */
121
+ computedStyles?: string;
122
+ /** Full DOM ancestry path (for forensic mode) | 完整的 DOM 祖先路径(用于取证模式) */
123
+ fullPath?: string;
124
+ /** Accessibility attributes (role, aria-label, etc.) | 无障碍属性 */
125
+ accessibility?: string;
126
+ /** True if created via drag selection (multi-select mode) | 是否通过拖拽选择创建 */
127
+ isMultiSelect?: boolean;
128
+ /** True if element has fixed/sticky positioning | 元素是否具有固定/粘性定位 */
129
+ isFixed?: boolean;
130
+ };
131
+
132
+ export declare const AnnotationPopup: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<AnnotationPopupProps>, {
133
+ placeholder: string;
134
+ initialValue: string;
135
+ submitLabel: string;
136
+ accentColor: string;
137
+ isExiting: boolean;
138
+ lightMode: boolean;
139
+ }>>, {
140
+ /** Shake the popup (e.g., when user clicks outside) */
141
+ shake: () => void;
142
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
143
+ submit: (text: string) => void;
144
+ cancel: () => void;
145
+ }, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<AnnotationPopupProps>, {
146
+ placeholder: string;
147
+ initialValue: string;
148
+ submitLabel: string;
149
+ accentColor: string;
150
+ isExiting: boolean;
151
+ lightMode: boolean;
152
+ }>>> & Readonly<{
153
+ onSubmit?: ((text: string) => any) | undefined;
154
+ onCancel?: (() => any) | undefined;
155
+ }>, {
156
+ placeholder: string;
157
+ initialValue: string;
158
+ submitLabel: string;
159
+ accentColor: string;
160
+ isExiting: boolean;
161
+ lightMode: boolean;
162
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
163
+
164
+ export declare interface AnnotationPopupExpose {
165
+ /** Shake the popup (e.g., when user clicks outside) */
166
+ shake: () => void;
167
+ }
168
+
169
+ export declare interface AnnotationPopupProps {
170
+ /** Element name to display in header */
171
+ element: string;
172
+ /** Optional timestamp display (e.g., "@ 1.23s" for animation feedback) */
173
+ timestamp?: string;
174
+ /** Optional selected/highlighted text */
175
+ selectedText?: string;
176
+ /** Placeholder text for the textarea */
177
+ placeholder?: string;
178
+ /** Initial value for textarea (for edit mode) */
179
+ initialValue?: string;
180
+ /** Label for submit button (default: "Add") */
181
+ submitLabel?: string;
182
+ /** Position styles (left, top) */
183
+ popupStyle?: Record<string, string | number>;
184
+ /** Custom color for submit button and textarea focus (hex) */
185
+ accentColor?: string;
186
+ /** External exit state (parent controls exit animation) */
187
+ isExiting?: boolean;
188
+ /** Light mode styling */
189
+ lightMode?: boolean;
190
+ /** Computed styles for the selected element */
191
+ computedStyles?: Record<string, string>;
192
+ }
193
+
194
+ /**
195
+ * Clears all annotations for a given page from localStorage.
196
+ * 从 localStorage 清除指定页面的所有标注。
197
+ *
198
+ * @param pathname - The page pathname | 页面路径名
199
+ */
200
+ export declare function clearAnnotations(pathname: string): void;
201
+
202
+ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<AgentationProps>, {
203
+ accentColor: string;
204
+ copyToClipboard: boolean;
205
+ lightMode: boolean;
206
+ zIndex: number;
207
+ demoAnnotations: () => never[];
208
+ demoDelay: number;
209
+ enableDemoMode: boolean;
210
+ }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
211
+ copy: (markdown: string) => void;
212
+ annotationAdd: (annotation: Annotation) => void;
213
+ annotationDelete: (annotation: Annotation) => void;
214
+ annotationUpdate: (annotation: Annotation) => void;
215
+ annotationsClear: (annotations: Annotation[]) => void;
216
+ }, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<AgentationProps>, {
217
+ accentColor: string;
218
+ copyToClipboard: boolean;
219
+ lightMode: boolean;
220
+ zIndex: number;
221
+ demoAnnotations: () => never[];
222
+ demoDelay: number;
223
+ enableDemoMode: boolean;
224
+ }>>> & Readonly<{
225
+ onCopy?: ((markdown: string) => any) | undefined;
226
+ onAnnotationAdd?: ((annotation: Annotation) => any) | undefined;
227
+ onAnnotationDelete?: ((annotation: Annotation) => any) | undefined;
228
+ onAnnotationUpdate?: ((annotation: Annotation) => any) | undefined;
229
+ onAnnotationsClear?: ((annotations: Annotation[]) => any) | undefined;
230
+ }>, {
231
+ accentColor: string;
232
+ lightMode: boolean;
233
+ zIndex: number;
234
+ copyToClipboard: boolean;
235
+ demoAnnotations: Array<{
236
+ selector: string;
237
+ comment: string;
238
+ }>;
239
+ demoDelay: number;
240
+ enableDemoMode: boolean;
241
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
242
+ export { _default as Agentation }
243
+ export { _default as AgentationVue }
244
+
245
+ /**
246
+ * Gets accessibility information for an element
247
+ */
248
+ export declare function getAccessibilityInfo(target: HTMLElement): string;
249
+
250
+ /**
251
+ * Gets key computed styles for an element (useful for styling issues)
252
+ */
253
+ export declare function getComputedStylesSnapshot(target: HTMLElement): string;
254
+
255
+ /**
256
+ * Gets key computed styles for the annotation popup display.
257
+ * Returns different properties based on element type to show the most relevant
258
+ * CSS properties for debugging (e.g., typography for text, layout for containers).
259
+ */
260
+ export declare function getDetailedComputedStyles(target: HTMLElement): Record<string, string>;
261
+
262
+ /**
263
+ * Gets CSS class names from an element (cleaned of module hashes)
264
+ */
265
+ export declare function getElementClasses(target: HTMLElement): string;
266
+
267
+ /**
268
+ * Gets a readable path for an element (e.g., "article > section > p")
269
+ */
270
+ export declare function getElementPath(target: HTMLElement, maxDepth?: number): string;
271
+
272
+ /**
273
+ * Gets full computed styles for forensic output.
274
+ * Returns a comprehensive semicolon-separated string of all relevant CSS properties
275
+ * for maximum debugging detail in the forensic output format.
276
+ */
277
+ export declare function getForensicComputedStyles(target: HTMLElement): string;
278
+
279
+ /**
280
+ * Gets full DOM ancestry path (for forensic mode)
281
+ */
282
+ export declare function getFullElementPath(target: HTMLElement): string;
283
+
284
+ /**
285
+ * Gets nearby sibling elements for structural context
286
+ */
287
+ export declare function getNearbyElements(element: HTMLElement): string;
288
+
289
+ /**
290
+ * Gets text content from element and siblings for context
291
+ */
292
+ export declare function getNearbyText(element: HTMLElement): string;
293
+
294
+ /**
295
+ * Generates a storage key for a given pathname.
296
+ * 根据给定路径名生成存储键。
297
+ *
298
+ * @param pathname - The page pathname (e.g., "/dashboard") | 页面路径名
299
+ * @returns The full storage key | 完整的存储键
300
+ */
301
+ export declare function getStorageKey(pathname: string): string;
302
+
303
+ export declare const IconChatEllipsis: FunctionalComponent<IconPropsWithStyle>;
304
+
305
+ export declare const IconCheck: FunctionalComponent<IconProps>;
306
+
307
+ export declare const IconCheckmark: FunctionalComponent<IconProps>;
308
+
309
+ export declare const IconCheckmarkCircle: FunctionalComponent<IconProps>;
310
+
311
+ export declare const IconCheckmarkLarge: FunctionalComponent<IconProps>;
312
+
313
+ export declare const IconCheckSmall: FunctionalComponent<IconProps>;
314
+
315
+ export declare const IconCheckSmallAnimated: FunctionalComponent<IconProps>;
316
+
317
+ export declare const IconClose: FunctionalComponent<IconProps>;
318
+
319
+ export declare const IconCopyAlt: FunctionalComponent<IconProps>;
320
+
321
+ export declare const IconCopyAnimated: FunctionalComponent<IconCopyAnimatedProps>;
322
+
323
+ declare interface IconCopyAnimatedProps extends IconProps {
324
+ copied?: boolean;
325
+ }
326
+
327
+ export declare const IconEye: FunctionalComponent<IconProps>;
328
+
329
+ export declare const IconEyeAlt: FunctionalComponent<IconProps>;
330
+
331
+ export declare const IconEyeAnimated: FunctionalComponent<IconEyeAnimatedProps>;
332
+
333
+ declare interface IconEyeAnimatedProps extends IconProps {
334
+ isOpen?: boolean;
335
+ }
336
+
337
+ export declare const IconEyeClosed: FunctionalComponent<IconProps>;
338
+
339
+ export declare const IconEyeMinus: FunctionalComponent<IconProps>;
340
+
341
+ export declare const IconGear: FunctionalComponent<IconProps>;
342
+
343
+ export declare const IconHelp: FunctionalComponent<IconProps>;
344
+
345
+ export declare const IconListSparkle: FunctionalComponent<IconPropsWithStyle>;
346
+
347
+ export declare const IconMoon: FunctionalComponent<IconProps>;
348
+
349
+ export declare const IconPause: FunctionalComponent<IconProps>;
350
+
351
+ export declare const IconPauseAlt: FunctionalComponent<IconProps>;
352
+
353
+ export declare const IconPausePlayAnimated: FunctionalComponent<IconPausePlayAnimatedProps>;
354
+
355
+ declare interface IconPausePlayAnimatedProps extends IconProps {
356
+ isPaused?: boolean;
357
+ }
358
+
359
+ export declare const IconPlayAlt: FunctionalComponent<IconProps>;
360
+
361
+ export declare const IconPlus: FunctionalComponent<IconProps>;
362
+
363
+ declare interface IconProps {
364
+ size?: number;
365
+ }
366
+
367
+ declare interface IconPropsWithColor extends IconProps {
368
+ color?: string;
369
+ }
370
+
371
+ declare interface IconPropsWithStyle extends IconProps {
372
+ style?: CSSProperties;
373
+ }
374
+
375
+ export declare const IconSun: FunctionalComponent<IconProps>;
376
+
377
+ export declare const IconTrashAlt: FunctionalComponent<IconProps>;
378
+
379
+ export declare const IconXmark: FunctionalComponent<IconProps>;
380
+
381
+ export declare const IconXmarkLarge: FunctionalComponent<IconProps>;
382
+
383
+ /**
384
+ * Simplified element identifier for animation feedback (less verbose)
385
+ */
386
+ export declare function identifyAnimationElement(target: HTMLElement): string;
387
+
388
+ /**
389
+ * Identifies an element and returns a human-readable name + path
390
+ */
391
+ export declare function identifyElement(target: HTMLElement): {
392
+ name: string;
393
+ path: string;
394
+ };
395
+
396
+ /**
397
+ * Loads annotations from localStorage for a given page.
398
+ * Automatically filters out annotations older than the retention period.
399
+ *
400
+ * 从 localStorage 加载指定页面的标注。
401
+ * 自动过滤掉超过保留期的旧标注。
402
+ *
403
+ * @param pathname - The page pathname | 页面路径名
404
+ * @returns Array of annotations (empty if none found or on error) | 标注数组
405
+ */
406
+ export declare function loadAnnotations<T = Annotation>(pathname: string): T[];
407
+
408
+ /**
409
+ * Parses a forensic computed styles string back into a Record.
410
+ * Inverse of getForensicComputedStyles - used when editing annotations.
411
+ */
412
+ export declare function parseComputedStylesString(stylesStr: string | undefined): Record<string, string> | undefined;
413
+
414
+ /**
415
+ * Saves annotations to localStorage for a given page.
416
+ * Silently fails if localStorage is full or disabled.
417
+ *
418
+ * 将标注保存到 localStorage。
419
+ * 如果 localStorage 已满或被禁用,则静默失败。
420
+ *
421
+ * @param pathname - The page pathname | 页面路径名
422
+ * @param annotations - Array of annotations to save | 要保存的标注数组
423
+ */
424
+ export declare function saveAnnotations<T = Annotation>(pathname: string, annotations: T[]): void;
425
+
426
+ export { }