agent-ui-annotation 0.3.1 → 0.4.1
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 +140 -0
- package/dist/adapters/angular/annotation.module.d.ts +5 -44
- package/dist/adapters/angular/annotation.module.d.ts.map +1 -1
- package/dist/adapters/react/AgentUIAnnotation.js +1 -1
- package/dist/adapters/svelte/index.js +2 -2
- package/dist/adapters/vanilla/index.d.ts +9 -2
- package/dist/adapters/vanilla/index.d.ts.map +1 -1
- package/dist/adapters/vanilla/index.js +24 -18
- package/dist/adapters/vanilla/index.js.map +1 -1
- package/dist/adapters/vue/AgentUIAnnotation.vue.d.ts +1 -1
- package/dist/adapters/vue/AgentUIAnnotation.vue.d.ts.map +1 -1
- package/dist/adapters/vue/index.js +2 -2
- package/dist/agent-ui-annotation.js +16 -10
- package/dist/agent-ui-annotation.js.map +1 -1
- package/dist/{annotation-element-D4fn1LnU.js → annotation-element-z6TdBGsn.js} +919 -631
- package/dist/annotation-element-z6TdBGsn.js.map +1 -0
- package/dist/core/i18n/i18n.d.ts +35 -0
- package/dist/core/i18n/i18n.d.ts.map +1 -0
- package/dist/core/i18n/index.d.ts +8 -0
- package/dist/core/i18n/index.d.ts.map +1 -0
- package/dist/core/i18n/locales/en.d.ts +3 -0
- package/dist/core/i18n/locales/en.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-CN.d.ts +3 -0
- package/dist/core/i18n/locales/zh-CN.d.ts.map +1 -0
- package/dist/core/i18n/types.d.ts +124 -0
- package/dist/core/i18n/types.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/scopes/output.d.ts.map +1 -1
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/element/annotation-element.d.ts +4 -0
- package/dist/element/annotation-element.d.ts.map +1 -1
- package/dist/element/templates/marker.d.ts.map +1 -1
- package/dist/element/templates/popup.d.ts.map +1 -1
- package/dist/element/templates/settings.d.ts.map +1 -1
- package/dist/element/templates/toolbar.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/annotation-element-D4fn1LnU.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
**[Live Demo](https://yeomansiii.github.io/agent-ui-annotation/)**
|
|
8
8
|
|
|
9
|
+
<p align="center">
|
|
10
|
+
<img src="demo/workflow.gif" alt="agent-ui-annotation workflow: Click, Annotate, Copy, Output" width="760">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
9
13
|
A web page annotation toolbar for AI coding agents. Click on elements, add notes, and export structured markdown that helps AI assistants locate and modify specific UI components.
|
|
10
14
|
|
|
11
15
|
## Overview
|
|
@@ -196,6 +200,133 @@ When active, clicks are blocked from triggering buttons/links while annotating (
|
|
|
196
200
|
### Persistence
|
|
197
201
|
Annotations are saved to localStorage and persist across page reloads (7-day retention).
|
|
198
202
|
|
|
203
|
+
## Internationalization (i18n)
|
|
204
|
+
|
|
205
|
+
agent-ui-annotation supports multiple languages with built-in English and Simplified Chinese translations.
|
|
206
|
+
|
|
207
|
+
### Basic Usage
|
|
208
|
+
|
|
209
|
+
Initialize i18n once at your app's entry point, before rendering any components:
|
|
210
|
+
|
|
211
|
+
```javascript
|
|
212
|
+
import { initI18n } from 'agent-ui-annotation';
|
|
213
|
+
|
|
214
|
+
// Initialize at app startup (optional for English - it's the default)
|
|
215
|
+
initI18n({ locale: 'zh-CN' });
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
> **Note:** If you're using English, you can skip calling `initI18n()` entirely - English is the default locale.
|
|
219
|
+
|
|
220
|
+
### Framework Examples
|
|
221
|
+
|
|
222
|
+
**React** (in App.tsx or main.tsx):
|
|
223
|
+
```tsx
|
|
224
|
+
import { initI18n } from 'agent-ui-annotation';
|
|
225
|
+
import { AgentUIAnnotation } from 'agent-ui-annotation/react';
|
|
226
|
+
|
|
227
|
+
// Initialize once at app startup
|
|
228
|
+
initI18n({ locale: 'zh-CN' });
|
|
229
|
+
|
|
230
|
+
function App() {
|
|
231
|
+
return <AgentUIAnnotation theme="auto" />;
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Vue** (in main.ts):
|
|
236
|
+
```typescript
|
|
237
|
+
import { initI18n } from 'agent-ui-annotation';
|
|
238
|
+
|
|
239
|
+
initI18n({ locale: 'zh-CN' });
|
|
240
|
+
|
|
241
|
+
// Then create your Vue app...
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Svelte** (in +layout.ts or main entry):
|
|
245
|
+
```typescript
|
|
246
|
+
import { initI18n } from 'agent-ui-annotation';
|
|
247
|
+
|
|
248
|
+
initI18n({ locale: 'zh-CN' });
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Vanilla JS:**
|
|
252
|
+
```javascript
|
|
253
|
+
import { createAnnotation, initI18n } from 'agent-ui-annotation/vanilla';
|
|
254
|
+
|
|
255
|
+
// Option 1: Use initI18n (recommended for consistency with other frameworks)
|
|
256
|
+
initI18n({ locale: 'zh-CN' });
|
|
257
|
+
const annotation = createAnnotation({ theme: 'auto' });
|
|
258
|
+
|
|
259
|
+
// Option 2: Pass locale directly to createAnnotation
|
|
260
|
+
const annotation = createAnnotation({ locale: 'zh-CN' });
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Custom Translations
|
|
264
|
+
|
|
265
|
+
Override specific strings while keeping the rest:
|
|
266
|
+
|
|
267
|
+
```javascript
|
|
268
|
+
import { initI18n } from 'agent-ui-annotation';
|
|
269
|
+
|
|
270
|
+
initI18n({
|
|
271
|
+
locale: 'en',
|
|
272
|
+
translations: {
|
|
273
|
+
toolbar: {
|
|
274
|
+
copiedFeedback: 'Successfully copied!',
|
|
275
|
+
},
|
|
276
|
+
popup: {
|
|
277
|
+
addFeedback: 'Enter your notes...',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Output Translation
|
|
284
|
+
|
|
285
|
+
By default, markdown output stays in English for AI compatibility. To translate output:
|
|
286
|
+
|
|
287
|
+
```javascript
|
|
288
|
+
initI18n({
|
|
289
|
+
locale: 'zh-CN',
|
|
290
|
+
translateOutput: true, // Translate markdown labels
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Built-in Locales
|
|
295
|
+
|
|
296
|
+
| Locale | Language |
|
|
297
|
+
|--------|----------|
|
|
298
|
+
| `en` | English (default) |
|
|
299
|
+
| `zh-CN` | Simplified Chinese |
|
|
300
|
+
|
|
301
|
+
### Register Custom Locale
|
|
302
|
+
|
|
303
|
+
```javascript
|
|
304
|
+
import { registerLocale, initI18n, en } from 'agent-ui-annotation';
|
|
305
|
+
|
|
306
|
+
const customLocale = {
|
|
307
|
+
...en,
|
|
308
|
+
toolbar: {
|
|
309
|
+
...en.toolbar,
|
|
310
|
+
settings: 'Einstellungen',
|
|
311
|
+
},
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
registerLocale('de', customLocale);
|
|
315
|
+
initI18n({ locale: 'de' });
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Contributing Translations
|
|
319
|
+
|
|
320
|
+
We welcome contributions for additional languages! To add a new locale:
|
|
321
|
+
|
|
322
|
+
1. Copy `src/core/i18n/locales/en.ts` as a template
|
|
323
|
+
2. Create a new file like `src/core/i18n/locales/de.ts` for your language
|
|
324
|
+
3. Translate all strings, keeping the same key structure
|
|
325
|
+
4. Export from `src/core/i18n/index.ts`
|
|
326
|
+
5. Submit a pull request
|
|
327
|
+
|
|
328
|
+
See the [en.ts](src/core/i18n/locales/en.ts) and [zh-CN.ts](src/core/i18n/locales/zh-CN.ts) files for examples.
|
|
329
|
+
|
|
199
330
|
## API Reference
|
|
200
331
|
|
|
201
332
|
### Options
|
|
@@ -211,6 +342,13 @@ interface AnnotationOptions {
|
|
|
211
342
|
onAnnotationsClear?: (annotations: Annotation[]) => void;
|
|
212
343
|
onCopy?: (content: string, level: OutputLevel) => void;
|
|
213
344
|
}
|
|
345
|
+
|
|
346
|
+
// i18n is configured separately via initI18n()
|
|
347
|
+
interface I18nOptions {
|
|
348
|
+
locale?: string; // e.g., 'en', 'zh-CN'
|
|
349
|
+
translations?: PartialTranslations; // Custom translation overrides
|
|
350
|
+
translateOutput?: boolean; // Translate markdown output (default: false)
|
|
351
|
+
}
|
|
214
352
|
```
|
|
215
353
|
|
|
216
354
|
### Instance Methods
|
|
@@ -236,6 +374,8 @@ interface AnnotationInstance {
|
|
|
236
374
|
| `annotation-color` | string | `#AF52DE` | Marker color |
|
|
237
375
|
| `disabled` | boolean | `false` | Disable the toolbar |
|
|
238
376
|
|
|
377
|
+
> **Note:** For i18n, call `initI18n()` at app startup rather than using component attributes.
|
|
378
|
+
|
|
239
379
|
### Custom Events
|
|
240
380
|
|
|
241
381
|
| Event | Detail | Description |
|
|
@@ -1,50 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Usage in Angular:
|
|
5
|
-
*
|
|
6
|
-
* 1. Import in your module:
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
9
|
-
* import 'agent-ui-annotation'; // Registers the custom element
|
|
10
|
-
*
|
|
11
|
-
* @NgModule({
|
|
12
|
-
* schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
13
|
-
* // ...
|
|
14
|
-
* })
|
|
15
|
-
* export class AppModule {}
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* 2. Use in template:
|
|
19
|
-
* ```html
|
|
20
|
-
* <agent-ui-annotation
|
|
21
|
-
* theme="auto"
|
|
22
|
-
* output-level="standard"
|
|
23
|
-
* (annotation:create)="onAnnotationCreate($event)"
|
|
24
|
-
* (annotation:copy)="onCopy($event)"
|
|
25
|
-
* ></agent-ui-annotation>
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* 3. Access element in component:
|
|
29
|
-
* ```typescript
|
|
30
|
-
* import { ViewChild, ElementRef } from '@angular/core';
|
|
31
|
-
* import type { AnnotationElement } from 'agent-ui-annotation';
|
|
32
|
-
*
|
|
33
|
-
* @Component({ ... })
|
|
34
|
-
* export class AppComponent {
|
|
35
|
-
* @ViewChild('annotation') annotationRef!: ElementRef<AnnotationElement>;
|
|
36
|
-
*
|
|
37
|
-
* activate() {
|
|
38
|
-
* this.annotationRef.nativeElement.activate();
|
|
39
|
-
* }
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export type { Annotation, AnnotationId, OutputLevel, ThemeMode, Settings } from '../../core/types';
|
|
1
|
+
import { I18nOptions } from '../../core/i18n';
|
|
2
|
+
export type { Annotation, AnnotationId, OutputLevel, ThemeMode, Settings, PartialTranslationStrings, I18nOptions } from '../../core/types';
|
|
44
3
|
export { AnnotationElement } from '../../element/annotation-element';
|
|
4
|
+
export { initI18n } from '../../core/i18n';
|
|
45
5
|
/**
|
|
46
6
|
* Initialize agent-ui-annotation for Angular
|
|
47
7
|
* Call this in your app's initialization
|
|
8
|
+
* @param i18nOptions Optional i18n configuration (locale, translations, translateOutput)
|
|
48
9
|
*/
|
|
49
|
-
export declare function initAgentUIAnnotation(): void;
|
|
10
|
+
export declare function initAgentUIAnnotation(i18nOptions?: I18nOptions): void;
|
|
50
11
|
//# sourceMappingURL=annotation.module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation.module.d.ts","sourceRoot":"","sources":["../../../src/adapters/angular/annotation.module.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"annotation.module.d.ts","sourceRoot":"","sources":["../../../src/adapters/angular/annotation.module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAM7D,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3I,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,WAAW,QAK9D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "svelte/internal/disclose-version";
|
|
2
2
|
import * as e from "svelte/internal/client";
|
|
3
3
|
import { onMount as C } from "svelte";
|
|
4
|
-
import { r as b } from "../../annotation-element-
|
|
5
|
-
import { A as k } from "../../annotation-element-
|
|
4
|
+
import { r as b } from "../../annotation-element-z6TdBGsn.js";
|
|
5
|
+
import { A as k } from "../../annotation-element-z6TdBGsn.js";
|
|
6
6
|
var U = e.from_html("<agent-ui-annotation></agent-ui-annotation>", 2);
|
|
7
7
|
function M(n, a) {
|
|
8
8
|
e.push(a, !0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Scope, AnnotationId, OutputLevel, ThemeMode, Settings } from '../../core/types';
|
|
1
|
+
import { Scope, AnnotationId, OutputLevel, ThemeMode, Settings, PartialTranslationStrings } from '../../core/types';
|
|
2
2
|
import { AnnotationElement, registerAnnotationElement } from '../../element/annotation-element';
|
|
3
3
|
export interface AnnotationOptions {
|
|
4
4
|
/** Container element to append Annotation to (defaults to document.body) */
|
|
@@ -21,6 +21,12 @@ export interface AnnotationOptions {
|
|
|
21
21
|
onScopesClear?: (scopes: Scope[]) => void;
|
|
22
22
|
/** Callback when output is copied */
|
|
23
23
|
onCopy?: (content: string, level: OutputLevel) => void;
|
|
24
|
+
/** Locale for UI strings (default: 'en') */
|
|
25
|
+
locale?: string;
|
|
26
|
+
/** Custom translation overrides */
|
|
27
|
+
translations?: PartialTranslationStrings;
|
|
28
|
+
/** Whether to translate markdown output (default: false for AI compatibility) */
|
|
29
|
+
translateOutput?: boolean;
|
|
24
30
|
}
|
|
25
31
|
export interface AnnotationInstance {
|
|
26
32
|
/** The underlying custom element */
|
|
@@ -68,6 +74,7 @@ export declare function createAnnotation(options?: AnnotationOptions): Annotatio
|
|
|
68
74
|
* ```
|
|
69
75
|
*/
|
|
70
76
|
export declare function init(options?: Omit<AnnotationOptions, 'autoActivate'>): AnnotationInstance;
|
|
71
|
-
export type { Scope, AnnotationId, OutputLevel, ThemeMode, Settings };
|
|
77
|
+
export type { Scope, AnnotationId, OutputLevel, ThemeMode, Settings, PartialTranslationStrings };
|
|
72
78
|
export { AnnotationElement, registerAnnotationElement };
|
|
79
|
+
export { initI18n } from '../../core/i18n';
|
|
73
80
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/vanilla/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/vanilla/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACzH,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AAM1C,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,iBAAiB;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uCAAuC;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,uCAAuC;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,uCAAuC;IACvC,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,2CAA2C;IAC3C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IAC1C,qCAAqC;IACrC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvD,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,iFAAiF;IACjF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,oCAAoC;IACpC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,0BAA0B;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,wBAAwB;IACxB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,+BAA+B;IAC/B,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD,iCAAiC;IACjC,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,WAAW,KAAK,MAAM,CAAC;IAC3C,uBAAuB;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,qCAAqC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,kBAAkB,CAyGpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,OAAO,GAAE,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAM,GAAG,kBAAkB,CAE9F;AAGD,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,yBAAyB,EAAE,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import { A as
|
|
3
|
-
|
|
4
|
-
function
|
|
1
|
+
import { r as A, h as g } from "../../annotation-element-z6TdBGsn.js";
|
|
2
|
+
import { A as b } from "../../annotation-element-z6TdBGsn.js";
|
|
3
|
+
A();
|
|
4
|
+
function E(n = {}) {
|
|
5
5
|
const {
|
|
6
|
-
container:
|
|
7
|
-
theme:
|
|
8
|
-
outputLevel:
|
|
6
|
+
container: p = document.body,
|
|
7
|
+
theme: v = "auto",
|
|
8
|
+
outputLevel: m = "standard",
|
|
9
9
|
scopeColor: o,
|
|
10
|
-
autoActivate:
|
|
10
|
+
autoActivate: f = !1,
|
|
11
11
|
onScopeCreate: a,
|
|
12
12
|
onScopeUpdate: i,
|
|
13
13
|
onScopeDelete: r,
|
|
14
14
|
onScopesClear: c,
|
|
15
|
-
onCopy: l
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
onCopy: l,
|
|
16
|
+
locale: u,
|
|
17
|
+
translations: d,
|
|
18
|
+
translateOutput: s
|
|
19
|
+
} = n;
|
|
20
|
+
(u || d || s !== void 0) && g({ locale: u, translations: d, translateOutput: s });
|
|
21
|
+
const t = document.createElement("agent-ui-annotation");
|
|
22
|
+
return t.setAttribute("theme", v), t.setAttribute("output-level", m), o && t.setAttribute("scope-color", o), a && t.addEventListener("annotation:scope", ((e) => {
|
|
18
23
|
a(e.detail.scope);
|
|
19
24
|
})), i && t.addEventListener("annotation:update", ((e) => {
|
|
20
25
|
i(e.detail.scope);
|
|
@@ -24,7 +29,7 @@ function m(n = {}) {
|
|
|
24
29
|
c(e.detail.scopes);
|
|
25
30
|
})), l && t.addEventListener("annotation:copy", ((e) => {
|
|
26
31
|
l(e.detail.content, e.detail.level);
|
|
27
|
-
})),
|
|
32
|
+
})), p.appendChild(t), f && requestAnimationFrame(() => {
|
|
28
33
|
t.activate();
|
|
29
34
|
}), {
|
|
30
35
|
element: t,
|
|
@@ -51,13 +56,14 @@ function m(n = {}) {
|
|
|
51
56
|
}
|
|
52
57
|
};
|
|
53
58
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
59
|
+
function L(n = {}) {
|
|
60
|
+
return E({ ...n, autoActivate: !0 });
|
|
56
61
|
}
|
|
57
62
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
b as AnnotationElement,
|
|
64
|
+
E as createAnnotation,
|
|
65
|
+
L as init,
|
|
66
|
+
g as initI18n,
|
|
67
|
+
A as registerAnnotationElement
|
|
62
68
|
};
|
|
63
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/adapters/vanilla/index.ts"],"sourcesContent":["/**\n * Vanilla JS adapter for Annotation\n */\n\nimport type { Scope, AnnotationId, OutputLevel, ThemeMode, Settings } from '../../core/types';\nimport {\n AnnotationElement,\n registerAnnotationElement,\n} from '../../element/annotation-element';\n\n// Ensure custom element is registered\nregisterAnnotationElement();\n\nexport interface AnnotationOptions {\n /** Container element to append Annotation to (defaults to document.body) */\n container?: HTMLElement;\n /** Theme mode */\n theme?: ThemeMode;\n /** Output detail level */\n outputLevel?: OutputLevel;\n /** Scope marker color */\n scopeColor?: string;\n /** Whether to auto-activate on mount */\n autoActivate?: boolean;\n /** Callback when a scope is created */\n onScopeCreate?: (scope: Scope) => void;\n /** Callback when a scope is updated */\n onScopeUpdate?: (scope: Scope) => void;\n /** Callback when a scope is deleted */\n onScopeDelete?: (id: AnnotationId) => void;\n /** Callback when all scopes are cleared */\n onScopesClear?: (scopes: Scope[]) => void;\n /** Callback when output is copied */\n onCopy?: (content: string, level: OutputLevel) => void;\n}\n\nexport interface AnnotationInstance {\n /** The underlying custom element */\n element: AnnotationElement;\n /** Activate the tool */\n activate: () => void;\n /** Deactivate the tool */\n deactivate: () => void;\n /** Toggle activation */\n toggle: () => void;\n /** Copy output to clipboard */\n copyOutput: (level?: OutputLevel) => Promise<boolean>;\n /** Get output without copying */\n getOutput: (level?: OutputLevel) => string;\n /** Clear all scopes */\n clearAll: () => void;\n /** Destroy and remove the element */\n destroy: () => void;\n}\n\n/**\n * Create an Annotation instance\n *\n * @example\n * ```js\n * import { createAnnotation } from 'annotation/vanilla';\n *\n * const scope = createAnnotation({\n * theme: 'auto',\n * onScopeCreate: (scope) => console.log('Created:', scope),\n * });\n *\n * // Later:\n * scope.activate();\n * ```\n */\nexport function createAnnotation(options: AnnotationOptions = {}): AnnotationInstance {\n const {\n container = document.body,\n theme = 'auto',\n outputLevel = 'standard',\n scopeColor,\n autoActivate = false,\n onScopeCreate,\n onScopeUpdate,\n onScopeDelete,\n onScopesClear,\n onCopy,\n } = options;\n\n // Create element\n const element = document.createElement('agent-ui-annotation') as AnnotationElement;\n\n // Set attributes\n element.setAttribute('theme', theme);\n element.setAttribute('output-level', outputLevel);\n if (scopeColor) {\n element.setAttribute('scope-color', scopeColor);\n }\n\n // Add event listeners\n if (onScopeCreate) {\n element.addEventListener('annotation:scope', ((e: CustomEvent) => {\n onScopeCreate(e.detail.scope);\n }) as EventListener);\n }\n\n if (onScopeUpdate) {\n element.addEventListener('annotation:update', ((e: CustomEvent) => {\n onScopeUpdate(e.detail.scope);\n }) as EventListener);\n }\n\n if (onScopeDelete) {\n element.addEventListener('annotation:delete', ((e: CustomEvent) => {\n onScopeDelete(e.detail.id);\n }) as EventListener);\n }\n\n if (onScopesClear) {\n element.addEventListener('annotation:clear', ((e: CustomEvent) => {\n onScopesClear(e.detail.scopes);\n }) as EventListener);\n }\n\n if (onCopy) {\n element.addEventListener('annotation:copy', ((e: CustomEvent) => {\n onCopy(e.detail.content, e.detail.level);\n }) as EventListener);\n }\n\n // Append to container\n container.appendChild(element);\n\n // Auto-activate if requested\n if (autoActivate) {\n // Wait for next tick to ensure element is connected\n requestAnimationFrame(() => {\n element.activate();\n });\n }\n\n return {\n element,\n\n activate() {\n element.activate();\n },\n\n deactivate() {\n element.deactivate();\n },\n\n toggle() {\n element.toggle();\n },\n\n async copyOutput(level?: OutputLevel) {\n return element.copyOutput(level);\n },\n\n getOutput(level?: OutputLevel) {\n return element.getOutput(level);\n },\n\n clearAll() {\n element.clearAll();\n },\n\n destroy() {\n element.remove();\n },\n };\n}\n\n/**\n * Initialize Annotation with a simple API\n *\n * @example\n * ```js\n * import { init } from 'annotation/vanilla';\n *\n * const scope = init(); // Creates and activates immediately\n * ```\n */\nexport function init(options: Omit<AnnotationOptions, 'autoActivate'> = {}): AnnotationInstance {\n return createAnnotation({ ...options, autoActivate: true });\n}\n\n// Re-export types\nexport type { Scope, AnnotationId, OutputLevel, ThemeMode, Settings };\nexport { AnnotationElement, registerAnnotationElement };\n"],"names":["registerAnnotationElement","createAnnotation","options","container","theme","outputLevel","scopeColor","autoActivate","onScopeCreate","onScopeUpdate","onScopeDelete","onScopesClear","onCopy","element","level","init"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/adapters/vanilla/index.ts"],"sourcesContent":["/**\n * Vanilla JS adapter for Annotation\n */\n\nimport type { Scope, AnnotationId, OutputLevel, ThemeMode, Settings, PartialTranslationStrings } from '../../core/types';\nimport {\n AnnotationElement,\n registerAnnotationElement,\n} from '../../element/annotation-element';\nimport { initI18n } from '../../core/i18n';\n\n// Ensure custom element is registered\nregisterAnnotationElement();\n\nexport interface AnnotationOptions {\n /** Container element to append Annotation to (defaults to document.body) */\n container?: HTMLElement;\n /** Theme mode */\n theme?: ThemeMode;\n /** Output detail level */\n outputLevel?: OutputLevel;\n /** Scope marker color */\n scopeColor?: string;\n /** Whether to auto-activate on mount */\n autoActivate?: boolean;\n /** Callback when a scope is created */\n onScopeCreate?: (scope: Scope) => void;\n /** Callback when a scope is updated */\n onScopeUpdate?: (scope: Scope) => void;\n /** Callback when a scope is deleted */\n onScopeDelete?: (id: AnnotationId) => void;\n /** Callback when all scopes are cleared */\n onScopesClear?: (scopes: Scope[]) => void;\n /** Callback when output is copied */\n onCopy?: (content: string, level: OutputLevel) => void;\n /** Locale for UI strings (default: 'en') */\n locale?: string;\n /** Custom translation overrides */\n translations?: PartialTranslationStrings;\n /** Whether to translate markdown output (default: false for AI compatibility) */\n translateOutput?: boolean;\n}\n\nexport interface AnnotationInstance {\n /** The underlying custom element */\n element: AnnotationElement;\n /** Activate the tool */\n activate: () => void;\n /** Deactivate the tool */\n deactivate: () => void;\n /** Toggle activation */\n toggle: () => void;\n /** Copy output to clipboard */\n copyOutput: (level?: OutputLevel) => Promise<boolean>;\n /** Get output without copying */\n getOutput: (level?: OutputLevel) => string;\n /** Clear all scopes */\n clearAll: () => void;\n /** Destroy and remove the element */\n destroy: () => void;\n}\n\n/**\n * Create an Annotation instance\n *\n * @example\n * ```js\n * import { createAnnotation } from 'annotation/vanilla';\n *\n * const scope = createAnnotation({\n * theme: 'auto',\n * onScopeCreate: (scope) => console.log('Created:', scope),\n * });\n *\n * // Later:\n * scope.activate();\n * ```\n */\nexport function createAnnotation(options: AnnotationOptions = {}): AnnotationInstance {\n const {\n container = document.body,\n theme = 'auto',\n outputLevel = 'standard',\n scopeColor,\n autoActivate = false,\n onScopeCreate,\n onScopeUpdate,\n onScopeDelete,\n onScopesClear,\n onCopy,\n locale,\n translations,\n translateOutput,\n } = options;\n\n // Initialize i18n if locale options provided\n if (locale || translations || translateOutput !== undefined) {\n initI18n({ locale, translations, translateOutput });\n }\n\n // Create element\n const element = document.createElement('agent-ui-annotation') as AnnotationElement;\n\n // Set attributes\n element.setAttribute('theme', theme);\n element.setAttribute('output-level', outputLevel);\n if (scopeColor) {\n element.setAttribute('scope-color', scopeColor);\n }\n\n // Add event listeners\n if (onScopeCreate) {\n element.addEventListener('annotation:scope', ((e: CustomEvent) => {\n onScopeCreate(e.detail.scope);\n }) as EventListener);\n }\n\n if (onScopeUpdate) {\n element.addEventListener('annotation:update', ((e: CustomEvent) => {\n onScopeUpdate(e.detail.scope);\n }) as EventListener);\n }\n\n if (onScopeDelete) {\n element.addEventListener('annotation:delete', ((e: CustomEvent) => {\n onScopeDelete(e.detail.id);\n }) as EventListener);\n }\n\n if (onScopesClear) {\n element.addEventListener('annotation:clear', ((e: CustomEvent) => {\n onScopesClear(e.detail.scopes);\n }) as EventListener);\n }\n\n if (onCopy) {\n element.addEventListener('annotation:copy', ((e: CustomEvent) => {\n onCopy(e.detail.content, e.detail.level);\n }) as EventListener);\n }\n\n // Append to container\n container.appendChild(element);\n\n // Auto-activate if requested\n if (autoActivate) {\n // Wait for next tick to ensure element is connected\n requestAnimationFrame(() => {\n element.activate();\n });\n }\n\n return {\n element,\n\n activate() {\n element.activate();\n },\n\n deactivate() {\n element.deactivate();\n },\n\n toggle() {\n element.toggle();\n },\n\n async copyOutput(level?: OutputLevel) {\n return element.copyOutput(level);\n },\n\n getOutput(level?: OutputLevel) {\n return element.getOutput(level);\n },\n\n clearAll() {\n element.clearAll();\n },\n\n destroy() {\n element.remove();\n },\n };\n}\n\n/**\n * Initialize Annotation with a simple API\n *\n * @example\n * ```js\n * import { init } from 'annotation/vanilla';\n *\n * const scope = init(); // Creates and activates immediately\n * ```\n */\nexport function init(options: Omit<AnnotationOptions, 'autoActivate'> = {}): AnnotationInstance {\n return createAnnotation({ ...options, autoActivate: true });\n}\n\n// Re-export types and i18n\nexport type { Scope, AnnotationId, OutputLevel, ThemeMode, Settings, PartialTranslationStrings };\nexport { AnnotationElement, registerAnnotationElement };\nexport { initI18n } from '../../core/i18n';\n"],"names":["registerAnnotationElement","createAnnotation","options","container","theme","outputLevel","scopeColor","autoActivate","onScopeCreate","onScopeUpdate","onScopeDelete","onScopesClear","onCopy","locale","translations","translateOutput","initI18n","element","level","init"],"mappings":";;AAYAA,EAAA;AAkEO,SAASC,EAAiBC,IAA6B,IAAwB;AACpF,QAAM;AAAA,IACJ,WAAAC,IAAY,SAAS;AAAA,IACrB,OAAAC,IAAQ;AAAA,IACR,aAAAC,IAAc;AAAA,IACd,YAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,EAAA,IACEb;AAGJ,GAAIW,KAAUC,KAAgBC,MAAoB,WAChDC,EAAS,EAAE,QAAAH,GAAQ,cAAAC,GAAc,iBAAAC,EAAA,CAAiB;AAIpD,QAAME,IAAU,SAAS,cAAc,qBAAqB;AAG5D,SAAAA,EAAQ,aAAa,SAASb,CAAK,GACnCa,EAAQ,aAAa,gBAAgBZ,CAAW,GAC5CC,KACFW,EAAQ,aAAa,eAAeX,CAAU,GAI5CE,KACFS,EAAQ,iBAAiB,qBAAqB,CAAC,MAAmB;AAChE,IAAAT,EAAc,EAAE,OAAO,KAAK;AAAA,EAC9B,EAAA,GAGEC,KACFQ,EAAQ,iBAAiB,sBAAsB,CAAC,MAAmB;AACjE,IAAAR,EAAc,EAAE,OAAO,KAAK;AAAA,EAC9B,EAAA,GAGEC,KACFO,EAAQ,iBAAiB,sBAAsB,CAAC,MAAmB;AACjE,IAAAP,EAAc,EAAE,OAAO,EAAE;AAAA,EAC3B,EAAA,GAGEC,KACFM,EAAQ,iBAAiB,qBAAqB,CAAC,MAAmB;AAChE,IAAAN,EAAc,EAAE,OAAO,MAAM;AAAA,EAC/B,EAAA,GAGEC,KACFK,EAAQ,iBAAiB,oBAAoB,CAAC,MAAmB;AAC/D,IAAAL,EAAO,EAAE,OAAO,SAAS,EAAE,OAAO,KAAK;AAAA,EACzC,EAAA,GAIFT,EAAU,YAAYc,CAAO,GAGzBV,KAEF,sBAAsB,MAAM;AAC1B,IAAAU,EAAQ,SAAA;AAAA,EACV,CAAC,GAGI;AAAA,IACL,SAAAA;AAAA,IAEA,WAAW;AACT,MAAAA,EAAQ,SAAA;AAAA,IACV;AAAA,IAEA,aAAa;AACX,MAAAA,EAAQ,WAAA;AAAA,IACV;AAAA,IAEA,SAAS;AACP,MAAAA,EAAQ,OAAA;AAAA,IACV;AAAA,IAEA,MAAM,WAAWC,GAAqB;AACpC,aAAOD,EAAQ,WAAWC,CAAK;AAAA,IACjC;AAAA,IAEA,UAAUA,GAAqB;AAC7B,aAAOD,EAAQ,UAAUC,CAAK;AAAA,IAChC;AAAA,IAEA,WAAW;AACT,MAAAD,EAAQ,SAAA;AAAA,IACV;AAAA,IAEA,UAAU;AACR,MAAAA,EAAQ,OAAA;AAAA,IACV;AAAA,EAAA;AAEJ;AAYO,SAASE,EAAKjB,IAAmD,IAAwB;AAC9F,SAAOD,EAAiB,EAAE,GAAGC,GAAS,cAAc,IAAM;AAC5D;"}
|
|
@@ -38,8 +38,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
|
38
38
|
onAnnotationsClear?: ((annotations: import('..').Scope[]) => any) | undefined;
|
|
39
39
|
}>, {
|
|
40
40
|
disabled: boolean;
|
|
41
|
-
theme: ThemeMode;
|
|
42
41
|
outputLevel: OutputLevel;
|
|
42
|
+
theme: ThemeMode;
|
|
43
43
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
44
44
|
elementRef: unknown;
|
|
45
45
|
}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentUIAnnotation.vue.d.ts","sourceRoot":"","sources":["../../../src/adapters/vue/AgentUIAnnotation.vue"],"names":[],"mappings":"AAgJA,OAAO,KAAK,EAA4B,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAOzF,KAAK,WAAW,GAAG;IACjB,iBAAiB;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;IArBF;;OAEG;IAEH,CA5HO;;IAwHP;;OAEG;IAEH,CA3HmC;;;;;;;;;;;;;;;cA2ItB,OAAO;
|
|
1
|
+
{"version":3,"file":"AgentUIAnnotation.vue.d.ts","sourceRoot":"","sources":["../../../src/adapters/vue/AgentUIAnnotation.vue"],"names":[],"mappings":"AAgJA,OAAO,KAAK,EAA4B,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAOzF,KAAK,WAAW,GAAG;IACjB,iBAAiB;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;IArBF;;OAEG;IAEH,CA5HO;;IAwHP;;OAEG;IAEH,CA3HmC;;;;;;;;;;;;;;;cA2ItB,OAAO;iBAJJ,WAAW;WAFjB,SAAS;;;;AAkLnB,wBAWG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as p } from "../../annotation-element-
|
|
2
|
-
import { A as P } from "../../annotation-element-
|
|
1
|
+
import { r as p } from "../../annotation-element-z6TdBGsn.js";
|
|
2
|
+
import { A as P } from "../../annotation-element-z6TdBGsn.js";
|
|
3
3
|
import { defineComponent as f, ref as m, onMounted as y, onUnmounted as A, watch as E, resolveComponent as L, openBlock as O, createBlock as h } from "vue";
|
|
4
4
|
const R = /* @__PURE__ */ f({
|
|
5
5
|
__name: "AgentUIAnnotation",
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { r as e } from "./annotation-element-
|
|
2
|
-
import { A as
|
|
3
|
-
import { createAnnotation as
|
|
1
|
+
import { r as e } from "./annotation-element-z6TdBGsn.js";
|
|
2
|
+
import { A as o, S as r, c as s, a as i, b as c, d as l, e as m, g as f, f as A, i as E, h as g, j as p, k as C, t as S, l as h, z as O } from "./annotation-element-z6TdBGsn.js";
|
|
3
|
+
import { createAnnotation as x, init as d } from "./adapters/vanilla/index.js";
|
|
4
4
|
e();
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
o as AnnotationElement,
|
|
7
7
|
r as SCOPE_COLORS,
|
|
8
8
|
s as collectElementInfo,
|
|
9
|
-
|
|
9
|
+
x as createAnnotation,
|
|
10
10
|
i as createAnnotationCore,
|
|
11
11
|
c as createEventBus,
|
|
12
12
|
l as createStore,
|
|
13
|
-
m as
|
|
14
|
-
f as
|
|
15
|
-
A as
|
|
16
|
-
|
|
13
|
+
m as en,
|
|
14
|
+
f as generateSelectorPath,
|
|
15
|
+
A as getAccentColor,
|
|
16
|
+
E as identifyElement,
|
|
17
|
+
d as init,
|
|
18
|
+
g as initI18n,
|
|
17
19
|
e as registerAnnotationElement,
|
|
18
|
-
|
|
20
|
+
p as registerLocale,
|
|
21
|
+
C as resolveTheme,
|
|
22
|
+
S as t,
|
|
23
|
+
h as tOutput,
|
|
24
|
+
O as zhCN
|
|
19
25
|
};
|
|
20
26
|
//# sourceMappingURL=agent-ui-annotation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-ui-annotation.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Annotation - Web page annotation toolbar for AI coding agents\n *\n * @example Basic usage (auto-registers custom element)\n * ```js\n * import 'annotation';\n *\n * // Add to HTML:\n * // <agent-ui-annotation theme=\"auto\"></agent-ui-annotation>\n * ```\n *\n * @example Vanilla JS\n * ```js\n * import { createAnnotation } from 'annotation';\n *\n * const scope = createAnnotation({\n * theme: 'dark',\n * onScopeCreate: (scope) => console.log('New scope:', scope),\n * });\n *\n * scope.activate();\n * ```\n *\n * @example React\n * ```jsx\n * import { Annotation } from 'annotation/react';\n *\n * function App() {\n * return (\n * <Annotation\n * theme=\"auto\"\n * onScopeCreate={(scope) => console.log('New scope:', scope)}\n * />\n * );\n * }\n * ```\n */\n\n// Auto-register custom element\nimport { registerAnnotationElement } from './element/annotation-element';\nregisterAnnotationElement();\n\n// Core exports\nexport {\n // Types\n type AnnotationId,\n type Position,\n type ElementRect,\n type AccessibilityInfo,\n type ComputedStylesSubset,\n type NearbyContext,\n type ElementInfo,\n type Scope,\n type OutputLevel,\n type ThemeMode,\n type ToolbarPosition,\n type ToolMode,\n type Settings,\n type SelectionRect,\n type EnvironmentInfo,\n type EventMap,\n type AppState,\n type AnnotationEventDetail,\n type AnnotationColor,\n SCOPE_COLORS,\n\n // Controller\n createAnnotationCore,\n type AnnotationCore,\n type AnnotationCoreOptions,\n\n // Store\n createStore,\n type Store,\n\n // Event Bus\n createEventBus,\n type EventBus,\n\n // Element utilities\n identifyElement,\n generateSelectorPath,\n collectElementInfo,\n} from './core';\n\n// Web Component\nexport {\n AnnotationElement,\n registerAnnotationElement,\n} from './element';\n\n// Vanilla adapter\nexport {\n createAnnotation,\n init,\n type AnnotationOptions,\n type AnnotationInstance,\n} from './adapters/vanilla';\n\n// Theme utilities\nexport {\n resolveTheme,\n getAccentColor,\n} from './themes';\n"],"names":["registerAnnotationElement"],"mappings":";;;AAwCAA,EAAA;"}
|
|
1
|
+
{"version":3,"file":"agent-ui-annotation.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Annotation - Web page annotation toolbar for AI coding agents\n *\n * @example Basic usage (auto-registers custom element)\n * ```js\n * import 'annotation';\n *\n * // Add to HTML:\n * // <agent-ui-annotation theme=\"auto\"></agent-ui-annotation>\n * ```\n *\n * @example Vanilla JS\n * ```js\n * import { createAnnotation } from 'annotation';\n *\n * const scope = createAnnotation({\n * theme: 'dark',\n * onScopeCreate: (scope) => console.log('New scope:', scope),\n * });\n *\n * scope.activate();\n * ```\n *\n * @example React\n * ```jsx\n * import { Annotation } from 'annotation/react';\n *\n * function App() {\n * return (\n * <Annotation\n * theme=\"auto\"\n * onScopeCreate={(scope) => console.log('New scope:', scope)}\n * />\n * );\n * }\n * ```\n */\n\n// Auto-register custom element\nimport { registerAnnotationElement } from './element/annotation-element';\nregisterAnnotationElement();\n\n// Core exports\nexport {\n // Types\n type AnnotationId,\n type Position,\n type ElementRect,\n type AccessibilityInfo,\n type ComputedStylesSubset,\n type NearbyContext,\n type ElementInfo,\n type Scope,\n type OutputLevel,\n type ThemeMode,\n type ToolbarPosition,\n type ToolMode,\n type Settings,\n type SelectionRect,\n type EnvironmentInfo,\n type EventMap,\n type AppState,\n type AnnotationEventDetail,\n type AnnotationColor,\n SCOPE_COLORS,\n\n // Controller\n createAnnotationCore,\n type AnnotationCore,\n type AnnotationCoreOptions,\n\n // Store\n createStore,\n type Store,\n\n // Event Bus\n createEventBus,\n type EventBus,\n\n // Element utilities\n identifyElement,\n generateSelectorPath,\n collectElementInfo,\n} from './core';\n\n// Web Component\nexport {\n AnnotationElement,\n registerAnnotationElement,\n} from './element';\n\n// Vanilla adapter\nexport {\n createAnnotation,\n init,\n type AnnotationOptions,\n type AnnotationInstance,\n} from './adapters/vanilla';\n\n// Theme utilities\nexport {\n resolveTheme,\n getAccentColor,\n} from './themes';\n\n// i18n\nexport {\n initI18n,\n registerLocale,\n t,\n tOutput,\n en,\n zhCN,\n type TranslationStrings,\n type PartialTranslationStrings,\n type I18nOptions,\n} from './core/i18n';\n"],"names":["registerAnnotationElement"],"mappings":";;;AAwCAA,EAAA;"}
|