@ng-annotate/angular 0.2.1 → 0.2.3

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-annotate-angular.mjs","sources":["../../src/inspector.service.ts","../../src/bridge.service.ts","../../src/overlay/overlay.component.ts","../../src/ng-annotate.module.ts","../../src/provide-ng-annotate.ts","../../src/ng-annotate-angular.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport type { ComponentContext } from './types';\n\ninterface NgDevMode {\n getComponent: (element: Element) => unknown;\n}\n\ndeclare const ng: NgDevMode;\n\ninterface NgCmp {\n selectors?: unknown[][];\n inputs?: Record<string, string>;\n}\n\ninterface ComponentInstance {\n constructor: { name: string; ɵcmp?: NgCmp } & (new (...args: unknown[]) => unknown);\n [key: string]: unknown;\n}\n\ninterface ManifestEntry {\n component: string;\n template?: string;\n}\n\nconst DOM_SNAPSHOT_MAX = 5000;\n\n@Injectable()\nexport class InspectorService {\n getComponentContext(element: Element): ComponentContext | null {\n const component = this.findNearestComponent(element);\n if (!component) return null;\n\n const componentName = (component as ComponentInstance).constructor.name;\n const { component: componentFilePath, template: templateFilePath } =\n this.resolveFilePaths(componentName);\n const selector = this.getSelector(component as ComponentInstance);\n const inputs = this.getInputs(component as ComponentInstance);\n const domSnapshot = this.snapshot(element);\n const componentTreePath = this.buildTreePath(element);\n\n return {\n componentName,\n componentFilePath,\n ...(templateFilePath ? { templateFilePath } : {}),\n selector,\n inputs,\n domSnapshot,\n componentTreePath,\n };\n }\n\n private findNearestComponent(element: Element): unknown {\n let current: Element | null = element;\n while (current) {\n try {\n const comp = ng.getComponent(current);\n if (comp) return comp;\n } catch {\n // ignore\n }\n current = current.parentElement;\n }\n return null;\n }\n\n private getSelector(component: ComponentInstance): string {\n try {\n const cmp = component.constructor.ɵcmp;\n if (!cmp?.selectors?.length) return 'unknown-selector';\n const first = cmp.selectors[0];\n if (!first.length) return 'unknown-selector';\n\n // Element selector: [['app-foo']]\n // Attribute selector: [['', 'appFoo', '']]\n if (first[0] === '') {\n // Attribute selector — find non-empty entries\n const attrParts: string[] = [];\n for (let i = 1; i < first.length; i += 2) {\n if (typeof first[i] === 'string' && first[i]) {\n attrParts.push(`[${String(first[i])}]`);\n }\n }\n return attrParts.join('') || 'unknown-selector';\n }\n return String(first[0]);\n } catch {\n return 'unknown-selector';\n }\n }\n\n private getInputs(component: ComponentInstance): Record<string, unknown> {\n try {\n const cmp = component.constructor.ɵcmp;\n if (!cmp?.inputs) return {};\n const result: Record<string, unknown> = {};\n for (const [propName] of Object.entries(cmp.inputs)) {\n if (typeof propName === 'symbol') continue;\n if (propName.startsWith('ɵ')) continue;\n result[propName] = (component as Record<string, unknown>)[propName];\n }\n return result;\n } catch {\n return {};\n }\n }\n\n private buildTreePath(element: Element): string[] {\n const path: string[] = [];\n let current: Element | null = element.parentElement;\n while (current) {\n try {\n const comp = ng.getComponent(current);\n if (comp) {\n path.unshift((comp as ComponentInstance).constructor.name);\n }\n } catch {\n // ignore\n }\n current = current.parentElement;\n }\n return path;\n }\n\n private snapshot(element: Element): string {\n const html = element.outerHTML;\n if (html.length <= DOM_SNAPSHOT_MAX) return html;\n return html.slice(0, DOM_SNAPSHOT_MAX) + '<!-- truncated -->';\n }\n\n private resolveFilePaths(componentName: string): { component: string; template?: string } {\n try {\n const manifest = (window as unknown as { __NG_ANNOTATE_MANIFEST__?: Record<string, ManifestEntry> })\n .__NG_ANNOTATE_MANIFEST__;\n const entry = manifest?.[componentName];\n if (entry) return entry;\n } catch {\n // ignore\n }\n return { component: `(unresolved: ${componentName})` };\n }\n}\n","import { Injectable, NgZone, OnDestroy, inject } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\nimport type { Session, Annotation } from './types';\n\ntype BridgeMessage =\n | { type: 'session:created'; session: Session }\n | { type: 'annotations:sync'; annotations: Annotation[] }\n | { type: 'annotation:created'; annotation: Annotation }\n | { type: string };\n\n@Injectable()\nexport class BridgeService implements OnDestroy {\n readonly session$ = new BehaviorSubject<Session | null>(null);\n readonly annotations$ = new BehaviorSubject<Annotation[]>([]);\n readonly connected$ = new BehaviorSubject<boolean>(false);\n\n private readonly zone = inject(NgZone);\n private ws: WebSocket | null = null;\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null;\n\n init(): void {\n this.connect();\n }\n\n private connect(): void {\n const wsUrl = `ws://${location.host}/__annotate`;\n this.ws = new WebSocket(wsUrl);\n\n this.ws.onopen = () => {\n this.zone.run(() => {\n this.connected$.next(true);\n });\n };\n\n this.ws.onmessage = (event: MessageEvent<string>) => {\n this.zone.run(() => {\n try {\n const data = JSON.parse(event.data) as BridgeMessage;\n if (data.type === 'session:created') {\n this.session$.next((data as Extract<BridgeMessage, { type: 'session:created' }>).session);\n } else if (data.type === 'annotations:sync') {\n this.annotations$.next(\n (data as Extract<BridgeMessage, { type: 'annotations:sync' }>).annotations,\n );\n } else if (data.type === 'annotation:created') {\n const annotation = (\n data as Extract<BridgeMessage, { type: 'annotation:created' }>\n ).annotation;\n const current = this.annotations$.getValue();\n this.annotations$.next([...current, annotation]);\n }\n } catch {\n // ignore malformed messages\n }\n });\n };\n\n this.ws.onclose = () => {\n this.zone.run(() => {\n this.connected$.next(false);\n this.reconnectTimer = setTimeout(() => { this.connect(); }, 3000);\n });\n };\n\n this.ws.onerror = (event) => {\n console.warn('[ng-annotate] WebSocket error', event);\n };\n }\n\n createAnnotation(payload: Record<string, unknown>): void {\n this.send({ type: 'annotation:create', payload });\n }\n\n replyToAnnotation(id: string, message: string): void {\n this.send({ type: 'annotation:reply', id, message });\n }\n\n deleteAnnotation(id: string): void {\n this.send({ type: 'annotation:delete', id });\n }\n\n private send(msg: Record<string, unknown>): void {\n if (this.ws?.readyState === WebSocket.OPEN) {\n this.ws.send(JSON.stringify(msg));\n }\n }\n\n ngOnDestroy(): void {\n if (this.reconnectTimer !== null) {\n clearTimeout(this.reconnectTimer);\n this.reconnectTimer = null;\n }\n this.ws?.close();\n }\n}\n","import {\n Component,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n HostListener,\n OnInit,\n ViewChild,\n ElementRef,\n inject,\n} from '@angular/core';\nimport { JsonPipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { InspectorService } from '../inspector.service';\nimport { BridgeService } from '../bridge.service';\nimport type { Annotation, ComponentContext, AnnotationStatus } from '../types';\n\ntype OverlayMode = 'hidden' | 'inspect' | 'annotate' | 'thread';\n\ninterface HighlightRect {\n top: string;\n left: string;\n width: string;\n height: string;\n}\n\ninterface AnnotationBadge {\n annotation: Annotation;\n top: string;\n left: string;\n icon: string;\n label: string;\n}\n\n@Component({\n selector: 'nga-overlay',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [JsonPipe, FormsModule],\n styles: [`\n :host {\n position: fixed; top: 0; left: 0; width: 100%; height: 100%;\n pointer-events: none; z-index: 9999;\n }\n .nga-highlight-rect {\n position: fixed; border: 2px solid #3b82f6;\n background: rgba(59,130,246,0.1); pointer-events: none;\n transition: top 0.05s, left 0.05s, width 0.05s, height 0.05s;\n }\n .nga-component-label {\n position: absolute; top: -22px; left: 0; background: #1e293b; color: #f8fafc;\n font-family: monospace; font-size: 11px; padding: 2px 6px;\n border-radius: 3px; white-space: nowrap;\n }\n .nga-annotate-panel, .nga-thread-panel {\n pointer-events: all; position: fixed; right: 16px; top: 50%;\n transform: translateY(-50%); background: #ffffff; border: 1px solid #e2e8f0;\n border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.15);\n padding: 16px; min-width: 320px; max-width: 400px;\n }\n .nga-panel-title {\n margin: 0 0 12px; font-size: 14px; font-weight: 600;\n color: #1e293b; font-family: monospace;\n }\n .nga-inputs { margin-bottom: 10px; }\n .nga-input-row {\n display: flex; gap: 8px; font-size: 12px;\n font-family: monospace; margin-bottom: 4px;\n }\n .nga-input-key { color: #64748b; min-width: 80px; }\n .nga-input-val {\n color: #1e293b; overflow: hidden;\n text-overflow: ellipsis; white-space: nowrap;\n }\n .nga-selection {\n font-size: 12px; color: #475569; margin-bottom: 8px; font-style: italic;\n }\n .nga-textarea, .nga-reply-input {\n width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1;\n border-radius: 4px; padding: 8px; font-size: 13px;\n font-family: inherit; resize: vertical; margin-bottom: 10px;\n }\n .nga-textarea:focus, .nga-reply-input:focus {\n outline: none; border-color: #3b82f6;\n }\n .nga-actions { display: flex; gap: 8px; }\n .nga-btn {\n padding: 6px 14px; border-radius: 4px; font-size: 13px;\n cursor: pointer; border: none; transition: opacity 0.15s;\n }\n .nga-btn:disabled { opacity: 0.4; cursor: not-allowed; }\n .nga-btn-submit { background: #3b82f6; color: #ffffff; }\n .nga-btn-cancel { background: #f1f5f9; color: #475569; }\n .nga-replies { max-height: 200px; overflow-y: auto; margin-bottom: 10px; }\n .nga-reply { display: flex; gap: 8px; margin-bottom: 8px; font-size: 13px; }\n .nga-reply-author { font-weight: 600; min-width: 48px; }\n .nga-reply-author--agent { color: #7c3aed; }\n .nga-reply-author--user { color: #2563eb; }\n .nga-badge {\n pointer-events: all; position: fixed; width: 18px; height: 18px;\n border-radius: 50%; display: flex; align-items: center;\n justify-content: center; font-size: 10px; cursor: pointer;\n transform: translate(-50%, -50%);\n }\n .nga-badge--pending { background: #3b82f6; color: #ffffff; }\n .nga-badge--acknowledged { background: #f59e0b; color: #ffffff; }\n .nga-badge--resolved { background: #22c55e; color: #ffffff; }\n .nga-badge--dismissed { background: #94a3b8; color: #ffffff; }\n .nga-keyboard-hint {\n pointer-events: none; position: fixed; bottom: 16px; right: 16px;\n background: rgba(15,23,42,0.7); color: #f8fafc; font-size: 12px;\n padding: 6px 10px; border-radius: 6px;\n }\n .nga-keyboard-hint kbd {\n background: rgba(255,255,255,0.15); border-radius: 3px;\n padding: 1px 5px; font-family: monospace;\n }\n `],\n template: `\n <!-- Keyboard hint -->\n @if (mode === 'hidden') {\n <div class=\"nga-keyboard-hint\">\n <kbd>Alt+Shift+A</kbd> to annotate\n </div>\n }\n @if (mode === 'inspect') {\n <div class=\"nga-keyboard-hint\">\n Click a component &nbsp; <kbd>Esc</kbd> to cancel\n </div>\n }\n\n <!-- Inspect highlight rect -->\n @if (mode === 'inspect' && hoveredContext !== null && highlightRect !== null) {\n <div\n class=\"nga-highlight-rect\"\n [style.top]=\"highlightRect.top\"\n [style.left]=\"highlightRect.left\"\n [style.width]=\"highlightRect.width\"\n [style.height]=\"highlightRect.height\"\n >\n <span class=\"nga-component-label\">{{ hoveredContext.componentName }}</span>\n </div>\n }\n\n <!-- Annotate panel -->\n @if (mode === 'annotate' && selectedContext !== null) {\n <div class=\"nga-annotate-panel\">\n <h3 class=\"nga-panel-title\">{{ selectedContext.componentName }}</h3>\n\n @if (inputEntries().length > 0) {\n <div class=\"nga-inputs\">\n @for (entry of inputEntries(); track entry.key) {\n <div class=\"nga-input-row\">\n <span class=\"nga-input-key\">{{ entry.key }}:</span>\n <span class=\"nga-input-val\">{{ entry.value | json }}</span>\n </div>\n }\n </div>\n }\n\n @if (selectionText) {\n <div class=\"nga-selection\">\n <em>\"{{ selectionText }}\"</em>\n </div>\n }\n\n <textarea\n #textArea\n class=\"nga-textarea\"\n [(ngModel)]=\"annotationText\"\n placeholder=\"Describe the change...\"\n rows=\"4\"\n ></textarea>\n\n <div class=\"nga-actions\">\n <button class=\"nga-btn nga-btn-submit\" (click)=\"submit()\" [disabled]=\"annotationText.trim() === ''\">\n Submit\n </button>\n <button class=\"nga-btn nga-btn-cancel\" (click)=\"cancel()\">Cancel</button>\n </div>\n </div>\n }\n\n <!-- Thread panel -->\n @if (mode === 'thread' && threadAnnotation !== null) {\n <div class=\"nga-thread-panel\">\n <h3 class=\"nga-panel-title\">{{ threadAnnotation.componentName }}</h3>\n\n <div class=\"nga-replies\">\n @for (reply of threadAnnotation.replies; track reply.message) {\n <div class=\"nga-reply\">\n <span class=\"nga-reply-author nga-reply-author--{{ reply.author }}\">{{ reply.author }}</span>\n <span class=\"nga-reply-text\">{{ reply.message }}</span>\n </div>\n }\n </div>\n\n <input\n class=\"nga-reply-input\"\n type=\"text\"\n [(ngModel)]=\"replyText\"\n placeholder=\"Reply...\"\n (keydown.enter)=\"sendReply()\"\n />\n\n <div class=\"nga-actions\">\n <button class=\"nga-btn nga-btn-submit\" (click)=\"sendReply()\" [disabled]=\"replyText.trim() === ''\">\n Send\n </button>\n <button class=\"nga-btn nga-btn-cancel\" (click)=\"closeThread()\">Close</button>\n </div>\n </div>\n }\n\n <!-- Annotation badges -->\n @for (badge of badges; track badge.annotation.id) {\n <div\n class=\"nga-badge nga-badge--{{ badge.annotation.status }}\"\n [style.top]=\"badge.top\"\n [style.left]=\"badge.left\"\n (click)=\"openThread(badge.annotation)\"\n [title]=\"badge.label\"\n >\n {{ badge.icon }}\n </div>\n }\n `,\n})\nexport class OverlayComponent implements OnInit {\n @ViewChild('textArea') textArea?: ElementRef<HTMLTextAreaElement>;\n\n mode: OverlayMode = 'hidden';\n hoveredContext: ComponentContext | null = null;\n highlightRect: HighlightRect | null = null;\n selectedContext: ComponentContext | null = null;\n annotationText = '';\n selectionText = '';\n threadAnnotation: Annotation | null = null;\n replyText = '';\n badges: AnnotationBadge[] = [];\n\n private readonly inspector = inject(InspectorService);\n private readonly bridge = inject(BridgeService);\n private readonly cdr = inject(ChangeDetectorRef);\n\n ngOnInit(): void {\n this.bridge.annotations$.subscribe((annotations) => {\n this.updateBadges(annotations);\n this.cdr.markForCheck();\n });\n }\n\n @HostListener('document:keydown.alt.shift.a', ['$event'])\n toggleInspect(event?: Event): void {\n event?.preventDefault();\n if (this.mode === 'hidden') this.mode = 'inspect';\n else if (this.mode === 'inspect') this.mode = 'hidden';\n else if (this.mode === 'annotate') this.mode = 'inspect';\n this.cdr.markForCheck();\n }\n\n @HostListener('document:keydown.escape')\n onEscape(): void {\n if (this.mode === 'annotate') this.mode = 'inspect';\n else if (this.mode === 'inspect') this.mode = 'hidden';\n else if (this.mode === 'thread') this.mode = 'hidden';\n this.cdr.markForCheck();\n }\n\n @HostListener('window:scroll')\n @HostListener('window:resize')\n onScrollOrResize(): void {\n if (this.badges.length > 0) {\n this.refreshBadgePositions();\n this.cdr.markForCheck();\n }\n }\n\n @HostListener('document:mousemove', ['$event'])\n onMouseMove(event: MouseEvent): void {\n if (this.mode !== 'inspect') return;\n const target = event.target as Element;\n if (target.closest('nga-overlay')) return;\n const context = this.inspector.getComponentContext(target);\n this.hoveredContext = context;\n if (context) {\n const rect = target.getBoundingClientRect();\n this.highlightRect = {\n top: `${rect.top.toString()}px`,\n left: `${rect.left.toString()}px`,\n width: `${rect.width.toString()}px`,\n height: `${rect.height.toString()}px`,\n };\n } else {\n this.highlightRect = null;\n }\n this.cdr.markForCheck();\n }\n\n @HostListener('document:click', ['$event'])\n onClick(event: MouseEvent): void {\n if (this.mode !== 'inspect') return;\n const target = event.target as Element;\n if (target.closest('nga-overlay')) return;\n const context = this.inspector.getComponentContext(target);\n if (!context) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n this.selectedContext = context;\n this.annotationText = '';\n this.selectionText = window.getSelection()?.toString() ?? '';\n this.mode = 'annotate';\n this.cdr.markForCheck();\n\n setTimeout(() => { this.textArea?.nativeElement.focus(); }, 0);\n }\n\n submit(): void {\n if (!this.selectedContext || !this.annotationText.trim()) return;\n this.bridge.createAnnotation({\n ...this.selectedContext,\n annotationText: this.annotationText.trim(),\n selectionText: this.selectionText || undefined,\n });\n this.selectedContext = null;\n this.annotationText = '';\n this.mode = 'inspect';\n this.cdr.markForCheck();\n }\n\n cancel(): void {\n this.mode = 'inspect';\n this.cdr.markForCheck();\n }\n\n openThread(annotation: Annotation): void {\n this.threadAnnotation = annotation;\n this.mode = 'thread';\n this.cdr.markForCheck();\n }\n\n closeThread(): void {\n this.threadAnnotation = null;\n this.mode = 'hidden';\n this.cdr.markForCheck();\n }\n\n sendReply(): void {\n if (!this.threadAnnotation || !this.replyText.trim()) return;\n this.bridge.replyToAnnotation(this.threadAnnotation.id, this.replyText.trim());\n this.replyText = '';\n this.cdr.markForCheck();\n }\n\n inputEntries(): { key: string; value: unknown }[] {\n if (!this.selectedContext) return [];\n return Object.entries(this.selectedContext.inputs)\n .slice(0, 5)\n .map(([key, value]) => ({ key, value }));\n }\n\n private updateBadges(annotations: Annotation[]): void {\n this.badges = annotations\n .map((annotation) => {\n const el = this.findComponentElement(annotation.componentName, annotation.selector);\n if (!el) return null;\n const rect = el.getBoundingClientRect();\n return {\n annotation,\n top: `${rect.top.toString()}px`,\n left: `${(rect.left + rect.width - 12).toString()}px`,\n icon: this.badgeIcon(annotation.status),\n label: `${annotation.componentName}: ${annotation.annotationText.slice(0, 40)}`,\n };\n })\n .filter((b): b is AnnotationBadge => b !== null);\n }\n\n private refreshBadgePositions(): void {\n this.badges = this.badges.map((badge) => {\n const el = this.findComponentElement(badge.annotation.componentName, badge.annotation.selector);\n if (!el) return badge;\n const rect = el.getBoundingClientRect();\n return {\n ...badge,\n top: `${rect.top.toString()}px`,\n left: `${(rect.left + rect.width - 12).toString()}px`,\n };\n });\n }\n\n private findComponentElement(componentName: string, selector: string): Element | null {\n const bySelector = document.querySelector(selector);\n if (bySelector) return bySelector;\n\n const all = document.querySelectorAll('*');\n for (const el of Array.from(all)) {\n try {\n const comp = (window as unknown as { ng?: { getComponent: (el: Element) => { constructor: { name: string } } | null } })\n .ng;\n if (comp?.getComponent(el)?.constructor.name === componentName) return el;\n } catch {\n // ignore\n }\n }\n return null;\n }\n\n private badgeIcon(status: AnnotationStatus): string {\n const icons: Record<AnnotationStatus, string> = {\n pending: '●',\n acknowledged: '◐',\n resolved: '✓',\n dismissed: '✕',\n };\n return icons[status];\n }\n}\n","import {\n NgModule,\n isDevMode,\n provideAppInitializer,\n inject,\n ApplicationRef,\n EnvironmentInjector,\n createComponent,\n} from '@angular/core';\nimport { InspectorService } from './inspector.service';\nimport { BridgeService } from './bridge.service';\nimport { OverlayComponent } from './overlay/overlay.component';\n\n@NgModule({\n providers: isDevMode()\n ? [\n InspectorService,\n BridgeService,\n provideAppInitializer(() => {\n const bridge = inject(BridgeService);\n const appRef = inject(ApplicationRef);\n const envInjector = inject(EnvironmentInjector);\n bridge.init();\n const overlayRef = createComponent(OverlayComponent, { environmentInjector: envInjector });\n appRef.attachView(overlayRef.hostView);\n document.body.appendChild(overlayRef.location.nativeElement);\n }),\n ]\n : [],\n})\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class -- required by NgModule pattern\nexport class NgAnnotateModule {}\n","import {\n ApplicationRef,\n EnvironmentInjector,\n createComponent,\n inject,\n isDevMode,\n makeEnvironmentProviders,\n provideAppInitializer,\n} from '@angular/core';\nimport { InspectorService } from './inspector.service';\nimport { BridgeService } from './bridge.service';\nimport { OverlayComponent } from './overlay/overlay.component';\n\nexport function provideNgAnnotate() {\n return makeEnvironmentProviders([\n InspectorService,\n BridgeService,\n provideAppInitializer(() => {\n if (!isDevMode()) return;\n const bridge = inject(BridgeService);\n const appRef = inject(ApplicationRef);\n const envInjector = inject(EnvironmentInjector);\n bridge.init();\n const overlayRef = createComponent(OverlayComponent, { environmentInjector: envInjector });\n appRef.attachView(overlayRef.hostView);\n document.body.appendChild(overlayRef.location.nativeElement);\n }),\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,gBAAgB,GAAG,IAAI;MAGhB,gBAAgB,CAAA;AAC3B,IAAA,mBAAmB,CAAC,OAAgB,EAAA;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;AACpD,QAAA,IAAI,CAAC,SAAS;AAAE,YAAA,OAAO,IAAI;AAE3B,QAAA,MAAM,aAAa,GAAI,SAA+B,CAAC,WAAW,CAAC,IAAI;AACvE,QAAA,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAChE,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC;QACtC,MAAM,QAAQ,GAAG,IA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C,aAAa,CAAC;AAC9D,QAAA,CAAC,CAAC;AACH,KAAA,CAAC;AACJ;;AC5BA;;AAEG;;;;"}
@@ -0,0 +1,135 @@
1
+ import * as i0 from '@angular/core';
2
+ import { OnDestroy, OnInit, ElementRef } from '@angular/core';
3
+ import { BehaviorSubject } from 'rxjs';
4
+
5
+ declare class NgAnnotateModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgAnnotateModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgAnnotateModule, never, never, never>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgAnnotateModule>;
9
+ }
10
+
11
+ declare function provideNgAnnotate(): i0.EnvironmentProviders;
12
+
13
+ type AnnotationStatus = 'pending' | 'acknowledged' | 'resolved' | 'dismissed';
14
+ interface AnnotationReply {
15
+ id: string;
16
+ createdAt: string;
17
+ author: 'agent' | 'user';
18
+ message: string;
19
+ }
20
+ interface Annotation {
21
+ id: string;
22
+ sessionId: string;
23
+ createdAt: string;
24
+ status: AnnotationStatus;
25
+ replies: AnnotationReply[];
26
+ componentName: string;
27
+ componentFilePath: string;
28
+ templateFilePath?: string;
29
+ selector: string;
30
+ inputs: Record<string, unknown>;
31
+ domSnapshot: string;
32
+ componentTreePath: string[];
33
+ annotationText: string;
34
+ selectionText?: string;
35
+ }
36
+ interface Session {
37
+ id: string;
38
+ createdAt: string;
39
+ lastSeenAt: string;
40
+ active: boolean;
41
+ url: string;
42
+ }
43
+ interface ComponentContext {
44
+ componentName: string;
45
+ componentFilePath: string;
46
+ templateFilePath?: string;
47
+ selector: string;
48
+ inputs: Record<string, unknown>;
49
+ domSnapshot: string;
50
+ componentTreePath: string[];
51
+ }
52
+
53
+ declare class InspectorService {
54
+ getComponentContext(element: Element): ComponentContext | null;
55
+ private findNearestComponent;
56
+ private getSelector;
57
+ private getInputs;
58
+ private buildTreePath;
59
+ private snapshot;
60
+ private resolveFilePaths;
61
+ static ɵfac: i0.ɵɵFactoryDeclaration<InspectorService, never>;
62
+ static ɵprov: i0.ɵɵInjectableDeclaration<InspectorService>;
63
+ }
64
+
65
+ declare class BridgeService implements OnDestroy {
66
+ readonly session$: BehaviorSubject<Session>;
67
+ readonly annotations$: BehaviorSubject<Annotation[]>;
68
+ readonly connected$: BehaviorSubject<boolean>;
69
+ private readonly zone;
70
+ private ws;
71
+ private reconnectTimer;
72
+ init(): void;
73
+ private connect;
74
+ createAnnotation(payload: Record<string, unknown>): void;
75
+ replyToAnnotation(id: string, message: string): void;
76
+ deleteAnnotation(id: string): void;
77
+ private send;
78
+ ngOnDestroy(): void;
79
+ static ɵfac: i0.ɵɵFactoryDeclaration<BridgeService, never>;
80
+ static ɵprov: i0.ɵɵInjectableDeclaration<BridgeService>;
81
+ }
82
+
83
+ type OverlayMode = 'hidden' | 'inspect' | 'annotate' | 'thread';
84
+ interface HighlightRect {
85
+ top: string;
86
+ left: string;
87
+ width: string;
88
+ height: string;
89
+ }
90
+ interface AnnotationBadge {
91
+ annotation: Annotation;
92
+ top: string;
93
+ left: string;
94
+ icon: string;
95
+ label: string;
96
+ }
97
+ declare class OverlayComponent implements OnInit {
98
+ textArea?: ElementRef<HTMLTextAreaElement>;
99
+ mode: OverlayMode;
100
+ hoveredContext: ComponentContext | null;
101
+ highlightRect: HighlightRect | null;
102
+ selectedContext: ComponentContext | null;
103
+ annotationText: string;
104
+ selectionText: string;
105
+ threadAnnotation: Annotation | null;
106
+ replyText: string;
107
+ badges: AnnotationBadge[];
108
+ private readonly inspector;
109
+ private readonly bridge;
110
+ private readonly cdr;
111
+ ngOnInit(): void;
112
+ toggleInspect(event?: Event): void;
113
+ onEscape(): void;
114
+ onScrollOrResize(): void;
115
+ onMouseMove(event: MouseEvent): void;
116
+ onClick(event: MouseEvent): void;
117
+ submit(): void;
118
+ cancel(): void;
119
+ openThread(annotation: Annotation): void;
120
+ closeThread(): void;
121
+ sendReply(): void;
122
+ inputEntries(): {
123
+ key: string;
124
+ value: unknown;
125
+ }[];
126
+ private updateBadges;
127
+ private refreshBadgePositions;
128
+ private findComponentElement;
129
+ private badgeIcon;
130
+ static ɵfac: i0.ɵɵFactoryDeclaration<OverlayComponent, never>;
131
+ static ɵcmp: i0.ɵɵComponentDeclaration<OverlayComponent, "nga-overlay", never, {}, {}, never, never, true, never>;
132
+ }
133
+
134
+ export { BridgeService, InspectorService, NgAnnotateModule, OverlayComponent, provideNgAnnotate };
135
+ export type { Annotation, AnnotationReply, AnnotationStatus, ComponentContext, Session };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-annotate/angular",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,12 +10,19 @@
10
10
  "dist",
11
11
  "schematics"
12
12
  ],
13
- "main": "dist/index.js",
14
- "types": "dist/index.d.ts",
13
+ "main": "dist/fesm2022/ng-annotate-angular.mjs",
14
+ "module": "dist/fesm2022/ng-annotate-angular.mjs",
15
+ "types": "dist/types/ng-annotate-angular.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/types/ng-annotate-angular.d.ts",
19
+ "default": "./dist/fesm2022/ng-annotate-angular.mjs"
20
+ }
21
+ },
15
22
  "scripts": {
16
- "build": "tsc && npm run build:schematics",
23
+ "build": "ng-packagr -p ng-package.json && npm run build:schematics",
24
+ "build:watch": "ng-packagr -p ng-package.json --watch",
17
25
  "build:schematics": "tsc -p schematics/tsconfig.json",
18
- "build:watch": "tsc --watch",
19
26
  "lint": "eslint src/",
20
27
  "lint:fix": "eslint src/ --fix"
21
28
  },
@@ -25,8 +32,9 @@
25
32
  },
26
33
  "devDependencies": {
27
34
  "@angular-devkit/schematics": ">=17.0.0",
28
- "typescript": "~5.6.0",
29
35
  "@angular/core": "^21.0.0",
30
- "rxjs": "^7.0.0"
36
+ "ng-packagr": "^21.2.0",
37
+ "rxjs": "^7.0.0",
38
+ "typescript": "~5.9.0"
31
39
  }
32
40
  }
@@ -3,6 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = default_1;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
5
  const tasks_1 = require("@angular-devkit/schematics/tasks");
6
+ const MIN_ANGULAR_MAJOR = 21;
7
+ function checkAngularVersion() {
8
+ return (tree) => {
9
+ const pkgPath = 'package.json';
10
+ if (!tree.exists(pkgPath))
11
+ return;
12
+ const pkg = JSON.parse(tree.read(pkgPath).toString('utf-8'));
13
+ const version = (pkg['dependencies']?.['@angular/core'] ?? pkg['devDependencies']?.['@angular/core']) || '';
14
+ const match = version.match(/(\d+)/);
15
+ const major = match ? parseInt(match[1], 10) : 0;
16
+ if (major > 0 && major < MIN_ANGULAR_MAJOR) {
17
+ throw new schematics_1.SchematicsException(`@ng-annotate/angular requires Angular ${MIN_ANGULAR_MAJOR} or higher. ` +
18
+ `Found: ${version}`);
19
+ }
20
+ };
21
+ }
6
22
  function addVitePlugin() {
7
23
  return (tree, context) => {
8
24
  const candidates = ['vite.config.ts', 'vite.config.js', 'vite.config.mts'];
@@ -89,6 +105,6 @@ function addDevDependency() {
89
105
  function default_1() {
90
106
  return (tree, context) => {
91
107
  context.logger.info('Setting up @ng-annotate/vite-plugin...');
92
- return (0, schematics_1.chain)([addDevDependency(), addVitePlugin(), addProviders(), addMcpConfig()])(tree, context);
108
+ return (0, schematics_1.chain)([checkAngularVersion(), addDevDependency(), addVitePlugin(), addProviders(), addMcpConfig()])(tree, context);
93
109
  };
94
110
  }
@@ -1,6 +1,31 @@
1
- import { Rule, SchematicContext, Tree, chain } from '@angular-devkit/schematics';
1
+ import { Rule, SchematicContext, Tree, chain, SchematicsException } from '@angular-devkit/schematics';
2
2
  import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
3
3
 
4
+ const MIN_ANGULAR_MAJOR = 21;
5
+
6
+ function checkAngularVersion(): Rule {
7
+ return (tree: Tree) => {
8
+ const pkgPath = 'package.json';
9
+ if (!tree.exists(pkgPath)) return;
10
+
11
+ const pkg = JSON.parse(tree.read(pkgPath)!.toString('utf-8')) as Record<
12
+ string,
13
+ Record<string, string>
14
+ >;
15
+ const version: string =
16
+ (pkg['dependencies']?.['@angular/core'] ?? pkg['devDependencies']?.['@angular/core']) || '';
17
+ const match = version.match(/(\d+)/);
18
+ const major = match ? parseInt(match[1], 10) : 0;
19
+
20
+ if (major > 0 && major < MIN_ANGULAR_MAJOR) {
21
+ throw new SchematicsException(
22
+ `@ng-annotate/angular requires Angular ${MIN_ANGULAR_MAJOR} or higher. ` +
23
+ `Found: ${version}`,
24
+ );
25
+ }
26
+ };
27
+ }
28
+
4
29
  function addVitePlugin(): Rule {
5
30
  return (tree: Tree, context: SchematicContext) => {
6
31
  const candidates = ['vite.config.ts', 'vite.config.js', 'vite.config.mts'];
@@ -119,7 +144,7 @@ function addDevDependency(): Rule {
119
144
  export default function (): Rule {
120
145
  return (tree: Tree, context: SchematicContext) => {
121
146
  context.logger.info('Setting up @ng-annotate/vite-plugin...');
122
- return chain([addDevDependency(), addVitePlugin(), addProviders(), addMcpConfig()])(
147
+ return chain([checkAngularVersion(), addDevDependency(), addVitePlugin(), addProviders(), addMcpConfig()])(
123
148
  tree,
124
149
  context,
125
150
  );
@@ -1,18 +0,0 @@
1
- import { OnDestroy } from '@angular/core';
2
- import { BehaviorSubject } from 'rxjs';
3
- import type { Session, Annotation } from './types.js';
4
- export declare class BridgeService implements OnDestroy {
5
- readonly session$: BehaviorSubject<Session | null>;
6
- readonly annotations$: BehaviorSubject<Annotation[]>;
7
- readonly connected$: BehaviorSubject<boolean>;
8
- private readonly zone;
9
- private ws;
10
- private reconnectTimer;
11
- init(): void;
12
- private connect;
13
- createAnnotation(payload: Record<string, unknown>): void;
14
- replyToAnnotation(id: string, message: string): void;
15
- deleteAnnotation(id: string): void;
16
- private send;
17
- ngOnDestroy(): void;
18
- }
@@ -1,85 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Injectable, NgZone, inject } from '@angular/core';
8
- import { BehaviorSubject } from 'rxjs';
9
- let BridgeService = class BridgeService {
10
- constructor() {
11
- this.session$ = new BehaviorSubject(null);
12
- this.annotations$ = new BehaviorSubject([]);
13
- this.connected$ = new BehaviorSubject(false);
14
- this.zone = inject(NgZone);
15
- this.ws = null;
16
- this.reconnectTimer = null;
17
- }
18
- init() {
19
- this.connect();
20
- }
21
- connect() {
22
- const wsUrl = `ws://${location.host}/__annotate`;
23
- this.ws = new WebSocket(wsUrl);
24
- this.ws.onopen = () => {
25
- this.zone.run(() => {
26
- this.connected$.next(true);
27
- });
28
- };
29
- this.ws.onmessage = (event) => {
30
- this.zone.run(() => {
31
- try {
32
- const data = JSON.parse(event.data);
33
- if (data.type === 'session:created') {
34
- this.session$.next(data.session);
35
- }
36
- else if (data.type === 'annotations:sync') {
37
- this.annotations$.next(data.annotations);
38
- }
39
- else if (data.type === 'annotation:created') {
40
- const annotation = data.annotation;
41
- const current = this.annotations$.getValue();
42
- this.annotations$.next([...current, annotation]);
43
- }
44
- }
45
- catch {
46
- // ignore malformed messages
47
- }
48
- });
49
- };
50
- this.ws.onclose = () => {
51
- this.zone.run(() => {
52
- this.connected$.next(false);
53
- this.reconnectTimer = setTimeout(() => { this.connect(); }, 3000);
54
- });
55
- };
56
- this.ws.onerror = (event) => {
57
- console.warn('[ng-annotate] WebSocket error', event);
58
- };
59
- }
60
- createAnnotation(payload) {
61
- this.send({ type: 'annotation:create', payload });
62
- }
63
- replyToAnnotation(id, message) {
64
- this.send({ type: 'annotation:reply', id, message });
65
- }
66
- deleteAnnotation(id) {
67
- this.send({ type: 'annotation:delete', id });
68
- }
69
- send(msg) {
70
- if (this.ws?.readyState === WebSocket.OPEN) {
71
- this.ws.send(JSON.stringify(msg));
72
- }
73
- }
74
- ngOnDestroy() {
75
- if (this.reconnectTimer !== null) {
76
- clearTimeout(this.reconnectTimer);
77
- this.reconnectTimer = null;
78
- }
79
- this.ws?.close();
80
- }
81
- };
82
- BridgeService = __decorate([
83
- Injectable()
84
- ], BridgeService);
85
- export { BridgeService };
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export { NgAnnotateModule } from './ng-annotate.module.js';
2
- export { provideNgAnnotate } from './provide-ng-annotate.js';
3
- export { InspectorService } from './inspector.service.js';
4
- export { BridgeService } from './bridge.service.js';
5
- export { OverlayComponent } from './overlay/overlay.component.js';
6
- export * from './types.js';
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- export { NgAnnotateModule } from './ng-annotate.module.js';
2
- export { provideNgAnnotate } from './provide-ng-annotate.js';
3
- export { InspectorService } from './inspector.service.js';
4
- export { BridgeService } from './bridge.service.js';
5
- export { OverlayComponent } from './overlay/overlay.component.js';
6
- export * from './types.js';
@@ -1,10 +0,0 @@
1
- import type { ComponentContext } from './types.js';
2
- export declare class InspectorService {
3
- getComponentContext(element: Element): ComponentContext | null;
4
- private findNearestComponent;
5
- private getSelector;
6
- private getInputs;
7
- private buildTreePath;
8
- private snapshot;
9
- private resolveFilePaths;
10
- }
@@ -1,130 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Injectable } from '@angular/core';
8
- const DOM_SNAPSHOT_MAX = 5000;
9
- let InspectorService = class InspectorService {
10
- getComponentContext(element) {
11
- const component = this.findNearestComponent(element);
12
- if (!component)
13
- return null;
14
- const componentName = component.constructor.name;
15
- const { component: componentFilePath, template: templateFilePath } = this.resolveFilePaths(componentName);
16
- const selector = this.getSelector(component);
17
- const inputs = this.getInputs(component);
18
- const domSnapshot = this.snapshot(element);
19
- const componentTreePath = this.buildTreePath(element);
20
- return {
21
- componentName,
22
- componentFilePath,
23
- ...(templateFilePath ? { templateFilePath } : {}),
24
- selector,
25
- inputs,
26
- domSnapshot,
27
- componentTreePath,
28
- };
29
- }
30
- findNearestComponent(element) {
31
- let current = element;
32
- while (current) {
33
- try {
34
- const comp = ng.getComponent(current);
35
- if (comp)
36
- return comp;
37
- }
38
- catch {
39
- // ignore
40
- }
41
- current = current.parentElement;
42
- }
43
- return null;
44
- }
45
- getSelector(component) {
46
- try {
47
- const cmp = component.constructor.ɵcmp;
48
- if (!cmp?.selectors?.length)
49
- return 'unknown-selector';
50
- const first = cmp.selectors[0];
51
- if (!first.length)
52
- return 'unknown-selector';
53
- // Element selector: [['app-foo']]
54
- // Attribute selector: [['', 'appFoo', '']]
55
- if (first[0] === '') {
56
- // Attribute selector — find non-empty entries
57
- const attrParts = [];
58
- for (let i = 1; i < first.length; i += 2) {
59
- if (typeof first[i] === 'string' && first[i]) {
60
- attrParts.push(`[${String(first[i])}]`);
61
- }
62
- }
63
- return attrParts.join('') || 'unknown-selector';
64
- }
65
- return String(first[0]);
66
- }
67
- catch {
68
- return 'unknown-selector';
69
- }
70
- }
71
- getInputs(component) {
72
- try {
73
- const cmp = component.constructor.ɵcmp;
74
- if (!cmp?.inputs)
75
- return {};
76
- const result = {};
77
- for (const [propName] of Object.entries(cmp.inputs)) {
78
- if (typeof propName === 'symbol')
79
- continue;
80
- if (propName.startsWith('ɵ'))
81
- continue;
82
- result[propName] = component[propName];
83
- }
84
- return result;
85
- }
86
- catch {
87
- return {};
88
- }
89
- }
90
- buildTreePath(element) {
91
- const path = [];
92
- let current = element.parentElement;
93
- while (current) {
94
- try {
95
- const comp = ng.getComponent(current);
96
- if (comp) {
97
- path.unshift(comp.constructor.name);
98
- }
99
- }
100
- catch {
101
- // ignore
102
- }
103
- current = current.parentElement;
104
- }
105
- return path;
106
- }
107
- snapshot(element) {
108
- const html = element.outerHTML;
109
- if (html.length <= DOM_SNAPSHOT_MAX)
110
- return html;
111
- return html.slice(0, DOM_SNAPSHOT_MAX) + '<!-- truncated -->';
112
- }
113
- resolveFilePaths(componentName) {
114
- try {
115
- const manifest = window
116
- .__NG_ANNOTATE_MANIFEST__;
117
- const entry = manifest?.[componentName];
118
- if (entry)
119
- return entry;
120
- }
121
- catch {
122
- // ignore
123
- }
124
- return { component: `(unresolved: ${componentName})` };
125
- }
126
- };
127
- InspectorService = __decorate([
128
- Injectable()
129
- ], InspectorService);
130
- export { InspectorService };
@@ -1,2 +0,0 @@
1
- export declare class NgAnnotateModule {
2
- }
@@ -1,33 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { NgModule, isDevMode, provideAppInitializer, inject, ApplicationRef, EnvironmentInjector, createComponent, } from '@angular/core';
8
- import { InspectorService } from './inspector.service.js';
9
- import { BridgeService } from './bridge.service.js';
10
- import { OverlayComponent } from './overlay/overlay.component.js';
11
- let NgAnnotateModule = class NgAnnotateModule {
12
- };
13
- NgAnnotateModule = __decorate([
14
- NgModule({
15
- providers: isDevMode()
16
- ? [
17
- InspectorService,
18
- BridgeService,
19
- provideAppInitializer(() => {
20
- const bridge = inject(BridgeService);
21
- const appRef = inject(ApplicationRef);
22
- const envInjector = inject(EnvironmentInjector);
23
- bridge.init();
24
- const overlayRef = createComponent(OverlayComponent, { environmentInjector: envInjector });
25
- appRef.attachView(overlayRef.hostView);
26
- document.body.appendChild(overlayRef.location.nativeElement);
27
- }),
28
- ]
29
- : [],
30
- })
31
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class -- required by NgModule pattern
32
- ], NgAnnotateModule);
33
- export { NgAnnotateModule };