# @embedpdf/plugin-annotation — . ANNOTATION_DEFAULTS [VariableDeclaration] (from packages/plugin/annotation/src/contract.ts): ANNOTATION_DEFAULTS: AnnotationSettings ={ tools: [], afterCreate:{ select: true, tool: 'stay', editText: true} , chrome:{ accent: null, outline:{ color: null, style: 'solid', width: 1} , handles:{ shape: 'square', size: 8, hitSize: 24, fill: '#ffffff', stroke: null} , rotationHandle:{ enabled: true, size: 10, hitSize: 24, offset: 32, stalk: true, fill: null, stroke: null, } , guides:{ enabled: true, color: '#e91e63', rotationColor: null, style: 'solid', width: 1.5} , marquee:{ fill: null, stroke: null} , textOutline: null, readout:{ enabled: true, background: 'rgb(0 0 0 / 0.8)', color: '#ffffff'} , } , snap:{ alignment: true, alignmentThresholdPx: 6, rotation: true, rotationAngles: [0, 90, 180, 270], rotationThresholdDeg: 4, } , editable: true, } ARMED_STAMP_TOOL_ID [VariableDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): ARMED_STAMP_TOOL_ID = 'stamp' AfterCreateSettings [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AfterCreateSettings{ readonly select: boolean; readonly tool: 'stay' | 'default'; readonly editText: boolean; } Annotation [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/declarations.ts): export type Annotation = ReadOf; AnnotationAnchor [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationAnchor{ readonly page: PageRef; readonly bounds: Rect; readonly boundsIn?: (view: ViewEnv) => Rect | null; } AnnotationBundle [InterfaceDeclaration] (from packages/engine/core/src/transfer/AnnotationBundle.ts): export interface AnnotationBundle{ readonly format: 'embedpdf/annotations'; readonly version: 1; readonly pages: readonly BundlePage[]; readonly items: readonly AnnotationBundleItem[]; readonly resources: Readonly>; } AnnotationCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationCapability extends SettingsApi{ get(ref: AnnotationRef): Annotation | null; list(filter?: AnnotationFilter): readonly Annotation[]; getAt(page: PageRef | number, point: Point): Annotation | null; isPending(ref: AnnotationRef): boolean; getStatus(): ResourceStatus; getHovered(): Annotation | null; refresh(options?: OperationOptions): Promise; create( page: PageRef | number, draft: AnnotationDraft | Annotation, resources?: AnnotationResources, options?: OperationOptions &{ tool?: string; select?: boolean} , ): Promise<{ annotation: Annotation} >; createFromSelection( tool: string, options?: OperationOptions &{ clear?: boolean} , ): Promise<{ annotations: readonly Annotation[]} >; update( ref: AnnotationRef, patch: AnnotationPatch, resources?: AnnotationResources, options?: OperationOptions, ): Promise<{ annotation: Annotation} >; delete(ref: AnnotationRef, options?: OperationOptions): Promise; reorder( refs: readonly AnnotationRef[], position: AnnotationPosition, options?: OperationOptions, ): Promise; duplicate( refs: readonly AnnotationRef[], options?: AnnotationDuplicateOptions & OperationOptions, ): Promise; export( selection?: AnnotationExportSelection, options?: OperationOptions, ): Promise; import( bundle: AnnotationBundle, options?: AnnotationImportOptions & OperationOptions & HistoryOptions, ): Promise; downloadResource( ref: AnnotationRef, role: AnnotationResourceRole, options?: OperationOptions, ): Promise; readonly links: AnnotationLinksCapability; readonly selection: AnnotationSelectionCapability; readonly draft: AnnotationDraftCapability; readonly text: AnnotationTextCapability; readonly tools: AnnotationToolsCapability; readonly stamps: AnnotationStampsCapability; readonly comments: CommentsCapability; setFilePickerProvider(provider: FilePickerProvider | null): Unsubscribe; canRead(): boolean; canCreate(): boolean; canUpdate(ref: AnnotationRef): boolean; canDelete(ref: AnnotationRef): boolean; canDuplicate(refs: readonly AnnotationRef[]): boolean; isEditable(ref: AnnotationRef): boolean; isMovable(ref: AnnotationRef): boolean; cancel(): void; readonly onCreated: EventHook; readonly onUpdated: EventHook; readonly onDeleted: EventHook; readonly onReordered: EventHook; readonly onResynced: EventHook; readonly onWriteFailed: EventHook; readonly onSelectionChanged: EventHook; readonly onDraftChanged: EventHook; readonly onEditingChanged: EventHook; readonly onHoverChanged: EventHook; } AnnotationConfig [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type AnnotationConfig = DeepPartial; AnnotationCreatedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationCreatedEvent{ readonly annotation: Annotation; readonly origin: EventOrigin; } AnnotationDeletedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDeletedEvent{ readonly refs: readonly AnnotationRef[]; readonly page: PageRef; readonly origin: EventOrigin; } AnnotationDraft [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/declarations.ts): export type AnnotationDraft = CreateOf< WritableAnnotationDeclaration, C >; AnnotationDraftCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDraftCapability{ get(): CreationDraft | null; finish(options?: OperationOptions): Promise<{ annotation: Annotation} | null>; cancel(): void; } AnnotationDraftChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDraftChangedEvent{ readonly draft: CreationDraft | null; } AnnotationDuplicateOptions [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDuplicateOptions{ readonly page?: PageRef | number; readonly offset?:{ readonly x: number; readonly y: number} ; readonly select?: boolean; } AnnotationDuplicateResult [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDuplicateResult{ readonly annotations: readonly Annotation[]; readonly dropped: readonly AnnotationImportDrop[]; } AnnotationEditingChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationEditingChangedEvent{ readonly ref: AnnotationRef | null; } AnnotationExportSelection [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationExportSelection{ readonly refs?: readonly AnnotationRef[]; readonly pages?: readonly (PageRef | number)[]; } AnnotationFilter [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationFilter{ readonly pages?: readonly (PageRef | number)[]; readonly subtype?: AnnotationSubtype; } AnnotationFlags [InterfaceDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export interface AnnotationFlags{ invisible: boolean; hidden: boolean; print: boolean; noZoom: boolean; noRotate: boolean; noView: boolean; readOnly: boolean; locked: boolean; toggleNoView: boolean; lockedContents: boolean; } AnnotationHoverChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationHoverChangedEvent{ readonly ref: AnnotationRef | null; } AnnotationImportDrop [InterfaceDeclaration] (from packages/engine/core/src/transfer/annotationImport.ts): export interface AnnotationImportDrop{ readonly ref: AnnotationRef; readonly field?: string; readonly reason: AnnotationDropReason; } AnnotationImportOptions [InterfaceDeclaration] (from packages/engine/core/src/transfer/annotationImport.ts): export interface AnnotationImportOptions extends WriteOptions{ readonly pages?: BundleImportPages; readonly attribution?: 'restore' | 'stamp'; } AnnotationImportResult [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationImportResult{ readonly annotations: readonly Annotation[]; readonly refMap: ReadonlyArray<{ readonly from: AnnotationRef; readonly to: AnnotationRef} >; readonly dropped: readonly AnnotationImportDrop[]; } AnnotationLinksCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationLinksCapability{ get(ref: AnnotationRef): PdfLinkTarget | null; set(ref: AnnotationRef, target: PdfLinkTarget, options?: OperationOptions): Promise; clear(ref: AnnotationRef, options?: OperationOptions): Promise; } AnnotationOption [InterfaceDeclaration] (from packages/core/annotation/src/kinds/define.ts): export interface AnnotationOption{ readonly value: string; readonly label: string; readonly labelKey: string; } AnnotationPatch [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/declarations.ts): export type AnnotationPatch = UpdateOf< WritableAnnotationDeclaration, C >; AnnotationPosition [TypeAliasDeclaration] (from packages/engine/core/src/mutation/ListPosition.ts): export type AnnotationPosition = ListPosition; AnnotationProperties [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationProperties{ readonly properties: readonly AnnotationProperty[]; readonly values: FieldValues; readonly mixed: readonly string[]; } AnnotationProperty [TypeAliasDeclaration] (from packages/core/annotation/src/kinds/define.ts): export type AnnotationProperty = |{ readonly key: 'color' | 'interiorColor' | 'fontColor'; readonly control: 'color'; readonly label: string; readonly labelKey: string; readonly allowsNone?: boolean; } |{ readonly key: 'opacity' | 'strokeWidth' | 'fontSize'; readonly control: 'number'; readonly label: string; readonly labelKey: string; readonly min: number; readonly max: number; readonly step: number; } |{ readonly key: 'borderStyle'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly AnnotationOption[]; readonly cloudy: boolean; } |{ readonly key: 'lineEndings' | 'fontFamily' | 'textAlign' | 'blendMode' | 'icon' | 'subtype'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly AnnotationOption[]; } |{ readonly key: 'orientation'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly AnnotationOption[]; } |{ readonly key: FlagKey; readonly control: 'flag'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'overlayText'; readonly control: 'text'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'bold' | 'italic' | 'underline'; readonly control: 'textFormat'; readonly label: string; readonly labelKey: string; readonly format: 'bold' | 'italic' | 'underline'; } |{ readonly key: 'link'; readonly control: 'link'; readonly label: string; readonly labelKey: string; } ; AnnotationRef [TypeAliasDeclaration] (from packages/engine/core/src/identity/AnnotationRef.ts): export type AnnotationRef = |{ kind: 'objectNumber'; page: PageRef; objectNumber: number; } |{ kind: 'baseIndex'; page: PageRef; baseIndex: number; } ; AnnotationReorderedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationReorderedEvent{ readonly page: PageRef; readonly order: readonly AnnotationRef[]; readonly origin: EventOrigin; } AnnotationResourceRole [TypeAliasDeclaration] (from packages/engine/core/src/annotation/resources.ts): export type AnnotationResourceRole = (typeof ANNOTATION_RESOURCE_ROLE_NAMES)[number]; AnnotationResources [TypeAliasDeclaration] (from packages/engine/core/src/annotation/resources.ts): export type AnnotationResources = Partial>; AnnotationResyncedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationResyncedEvent{ readonly pages: readonly PageRef[] | 'all'; } AnnotationRotationAnchor [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type AnnotationRotationAnchor = RotationAnchor; AnnotationSelectionAnchor [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSelectionAnchor{ readonly page: PageRef; readonly bounds: Rect; readonly rotationHandle?: Point; } AnnotationSelectionCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSelectionCapability{ select(refs: readonly AnnotationRef[]): void; add(refs: readonly AnnotationRef[]): void; selectAll(page?: PageRef | number): void; selectInRect(page: PageRef | number, rect: Rect): void; clear(): void; getSelected(): readonly Annotation[]; update( changes: AnnotationPatch | ((annotation: Annotation) => AnnotationPatch), options?: OperationOptions, ): Promise>; updateLink( target: PdfLinkTarget | null, options?: OperationOptions, ): Promise>; getProperties(): AnnotationProperties; delete(options?: OperationOptions): Promise>; rotateBy(degrees: 90 | -90, options?: OperationOptions): Promise; resetRotation(options?: OperationOptions): Promise; group(options?: OperationOptions): Promise; ungroup(options?: OperationOptions): Promise; canGroup(): boolean; canUngroup(): boolean; duplicate( options?: OperationOptions &{ offset?:{ readonly x: number; readonly y: number} } , ): Promise; canDuplicate(): boolean; getAnchor(): AnnotationSelectionAnchor | null; getRotationAnchor(): AnnotationRotationAnchor | null; } AnnotationSelectionChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSelectionChangedEvent{ readonly refs: readonly AnnotationRef[]; readonly previousRefs: readonly AnnotationRef[]; } AnnotationSettings [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSettings{ readonly tools: readonly AnnotationToolInput[]; readonly afterCreate: AfterCreateSettings; readonly chrome: ChromeSettings; readonly snap: SnapSettings; readonly editable: EditableKinds; } AnnotationStampsCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationStampsCapability{ arm(stamp: StampInput, options?: OperationOptions): Promise; disarm(): void; isArmed(): boolean; place( stamp: StampInput, placement: StampPlacement, options?: OperationOptions, ): Promise<{ annotation: Annotation} >; } AnnotationState [InterfaceDeclaration] (from packages/plugin/annotation/src/state.ts): export interface AnnotationState{ readonly status: ResourceStatus; readonly selected: readonly Annotation[]; readonly hovered: Annotation | null; readonly editing: Annotation | null; } AnnotationSubtype [TypeAliasDeclaration] (from packages/engine/core/src/annotation/subtype.ts): export type AnnotationSubtype = (typeof ANNOTATION_SUBTYPES)[number]; AnnotationTextCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationTextCapability{ begin(ref: AnnotationRef): void; end(options?: OperationOptions): Promise; getEditing(): Annotation | null; toggleFormat(format: TextFormat, options?: OperationOptions): Promise; } AnnotationToken [VariableDeclaration] (from packages/plugin/annotation/src/token.ts): AnnotationToken = createCapabilityToken('annotation', { hint: `add annotationPlugin() from '@embedpdf/plugin-annotation' to your plugins list`, promises:{ refresh: true, create: true, createFromSelection: true, update: true, delete: true, reorder: true, duplicate: true, export: true, import: true, downloadResource: true, 'links.set': true, 'links.clear': true, 'selection.update': true, 'selection.updateLink': true, 'selection.delete': true, 'selection.rotateBy': true, 'selection.resetRotation': true, 'selection.group': true, 'selection.ungroup': true, 'selection.duplicate': true, 'draft.finish': true, 'text.end': true, 'text.toggleFormat': true, 'stamps.arm': true, 'stamps.place': true, 'comments.reply': true, 'comments.setText': true, 'comments.setStatus': true, 'comments.setMarked': true, 'comments.delete': true, 'comments.deleteThread': true, } , } ) AnnotationTool [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationTool{ readonly id: string; readonly subtype: KindName; readonly preset: string; readonly cursor: string; readonly enables: readonly string[]; readonly defaults?: FieldValues; readonly ghost: ResolvedGhost; readonly meta?: Readonly>; } AnnotationToolDefinition [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface AnnotationToolDefinition{ id: string; extends?: string; subtype?: KindName; fieldsKind?: string; preset?: string; defaults?: ToolDefaultsFor; flags?: Partial; cursor?: string; enables?: string[]; source?: K extends 'stamp' ? StampSourceSpec : K extends 'file-attachment' ? PromptSourceSpec : never; selection?: SelectionAuthoring; ink?: K extends 'ink' ? InkAuthoringOptions : never; upright?: boolean; clickCreate?: ClickCreate | false; ghost?: GhostPolicy; afterCreate?: Partial; meta?: Record; } AnnotationToolInput [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type AnnotationToolInput = DirectToolDef | BuiltinToolOverride | ExtendedBuiltinToolDef; AnnotationToolsCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationToolsCapability{ list(): readonly AnnotationTool[]; get(id: string): AnnotationTool | null; register(tool: AnnotationToolInput): Unsubscribe; getDefaults(id: string): ToolDefaults; updateDefaults(id: string, changes: FieldValues): void; getProperties(id: string): AnnotationProperties; readonly onDefaultsChanged: EventHook; } AnnotationTransfer [VariableDeclaration] (from packages/engine/core/src/transfer/AnnotationTransfer.ts): AnnotationTransfer = bundleCodec({ kind: 'annotation', keys: ANNOTATION_BUNDLE_KEYS, assertManifest: assertAnnotationBundleManifest, } ) AnnotationUpdatedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationUpdatedEvent{ readonly annotation: Annotation; readonly origin: EventOrigin; } AnnotationWriteFailedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationWriteFailedEvent{ readonly refs: readonly AnnotationRef[]; readonly error: PluginErrorInfo; } ArmedStampInfo [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ArmedStampInfo{ readonly width: number; readonly height: number; readonly name?: string; readonly subject?: string; } ArmedStampPreview [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ArmedStampPreview{ readonly bytes: Uint8Array; readonly mimeType?: string; } AttachmentContent [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentContent{ bytes: Uint8Array; name: string; mimeType: string | null; } AttachmentFileSource [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentFileSource{ data: Uint8Array | ArrayBuffer | Blob; name?: string; mimeType?: string; description?: string; } Behavior [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface Behavior{ readonly id: string; matches(annotation: Annotation): boolean; engaged(annotation: Annotation): boolean; } BlendMode [TypeAliasDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export type BlendMode = | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity'; ChromeSettings [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ChromeSettings{ readonly accent: string | null; readonly outline:{ readonly color: string | null; readonly style: LineStyle; readonly width: number; } ; readonly handles:{ readonly shape: 'square' | 'circle'; readonly size: number; readonly hitSize: number; readonly fill: string; readonly stroke: string | null; } ; readonly rotationHandle:{ readonly enabled: boolean; readonly size: number; readonly hitSize: number; readonly offset: number; readonly stalk: boolean; readonly fill: string | null; readonly stroke: string | null; } ; readonly guides:{ readonly enabled: boolean; readonly color: string; readonly rotationColor: string | null; readonly style: LineStyle; readonly width: number; } ; readonly marquee:{ readonly fill: string | null; readonly stroke: string | null; } ; readonly textOutline: string | null; readonly readout:{ readonly enabled: boolean; readonly background: string; readonly color: string; } ; } ClickCreate [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type ClickCreate = |{ width: number; height: number; anchor?: 'center' | 'top-left'} |{ length: number; rotation?: number; anchor?: 'center' | 'start' | 'end'} ; Color [TypeAliasDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export type Color = string; CommentThread [InterfaceDeclaration] (from packages/engine/core/src/annotation/comments.ts): export interface CommentThread{ root: T; page: PageRef; replies: T[]; groupedParts: T[]; review: CommentThreadReview; } CommentThreadChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface CommentThreadChangedEvent{ readonly rootRef: AnnotationRef; readonly type: 'reply' | 'text' | 'status' | 'marked' | 'deleted'; } CommentThreadReview [InterfaceDeclaration] (from packages/engine/core/src/annotation/comments.ts): export interface CommentThreadReview{ byReviewer: Record; lastChange: ReviewStatus | null; markedBy: string[]; statusRefs: AnnotationRef[]; mine: ReviewStatus | null; } CommentsCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface CommentsCapability{ listThreads(): readonly CommentThread[]; getThread(ref: AnnotationRef): CommentThread | null; reply( ref: AnnotationRef, text: string, options?: OperationOptions, ): Promise<{ annotation: Annotation} >; setText(ref: AnnotationRef, text: string, options?: OperationOptions): Promise; setStatus(ref: AnnotationRef, state: string, options?: OperationOptions): Promise; setMarked(ref: AnnotationRef, marked: boolean, options?: OperationOptions): Promise; delete(ref: AnnotationRef, options?: OperationOptions): Promise; deleteThread(ref: AnnotationRef, options?: OperationOptions): Promise; canReply(ref: AnnotationRef): boolean; canSetText(ref: AnnotationRef): boolean; canSetStatus(ref: AnnotationRef): boolean; canSetMarked(ref: AnnotationRef): boolean; canDelete(ref: AnnotationRef): boolean; canDeleteThread(ref: AnnotationRef): boolean; readonly onThreadChanged: EventHook; } CreationDraft [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type CreationDraft = CreationDraftAnchor; DEFAULT_TOOLS [VariableDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): DEFAULT_TOOLS: AnnotationToolInput[] = [{ id: 'square', subtype: 'square', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , clickCreate:{ width: 80, height: 60} , upright: true, } , { id: 'circle', subtype: 'circle', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , clickCreate:{ width: 80, height: 60} , upright: true, } , { id: 'line', subtype: 'line', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , clickCreate:{ length: 80} , upright: true, } , { id: 'distance', extends: 'line', clickCreate: false, defaults:{ intent: 'line-dimension', strokeWidth: 1, lineEndings:{ start: 'closed-arrow', end: 'closed-arrow'} , captionEnabled: true, captionPosition: 'inline', leader:{ length: 12, extension: 5, offset: 0} , } , } , { id: 'calibrate', extends: 'line', enables: ['annotation-draw'], defaults:{ strokeWidth: 1} , clickCreate: false, } , { id: 'polygon', subtype: 'polygon', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , } , { id: 'polyline', subtype: 'polyline', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , } , { id: 'perimeter', extends: 'polyline', defaults:{ intent: 'polyline-dimension', strokeWidth: 1, lineEndings:{ start: 'none', end: 'none'} , captionEnabled: true, } , } , { id: 'area', extends: 'polygon', defaults:{ intent: 'polygon-dimension', strokeWidth: 1, captionEnabled: true} , } , { id: 'ink', subtype: 'ink', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: '#ef4444', strokeWidth: 6, blendMode: 'normal'} , ink:{ groupStrokesMs: 800} , } , { id: 'ink-highlight', extends: 'ink', defaults:{ intent: 'ink-highlight', color: '#ffcd45', strokeWidth: 14, blendMode: 'multiply'} , ink:{ straighten:{ deviationThreshold: 0.15, axisSnapDegrees: 15} , } , } , { id: 'free-text', subtype: 'free-text', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 2, fontColor: '#ef4444'} , upright: true, clickCreate:{ width: 180, height: 40, anchor: 'top-left'} , } , { id: 'free-text-callout', subtype: 'free-text-callout', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6, lineEnding: 'open-arrow'} , upright: true, } , { id: 'highlight', subtype: 'highlight', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ffe16a', blendMode: 'multiply'} , selection:{ kind: 'markup'} , } , { id: 'redact', subtype: 'redact', cursor: 'crosshair', enables: ['text-select', 'annotation-draw', 'annotation-edit'], defaults:{ color: '#e44234', interiorColor: '#000000', fontSize: 14, fontColor: '#ffffff', opacity: 1, } , selection:{ kind: 'markup'} , } , { id: 'underline', subtype: 'underline', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'markup'} , } , { id: 'strikeout', subtype: 'strikeout', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'markup'} , } , { id: 'squiggly', subtype: 'squiggly', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'markup'} , } , { id: 'insert-text', subtype: 'caret', fieldsKind: 'caret', preset: 'caret', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'text-edit', operation: 'insert'} , } , { id: 'replace-text', subtype: 'strikeout', fieldsKind: 'strikeout', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'text-edit', operation: 'replace'} , } , { id: ARMED_STAMP_TOOL_ID, subtype: 'stamp', cursor: 'copy', enables: ['annotation-place', 'annotation-edit'], source:{ kind: 'prompt', accept: 'image/png, image/jpeg, application/pdf'} , upright: true, ghost: true, } , { id: 'link', subtype: 'link', cursor: 'crosshair', enables: DRAW_TAGS, } , { id: 'note', subtype: 'text', cursor: 'crosshair', enables: ['annotation-place', 'annotation-edit'], defaults:{ icon: 'comment', color: '#facc15'} , flags:{ noZoom: true, noRotate: true} , upright: true, ghost: true, } , { id: 'attachment', subtype: 'file-attachment', cursor: 'crosshair', enables: ['annotation-place', 'annotation-edit'], source:{ kind: 'prompt'} , defaults:{ icon: 'paperclip', color: '#facc15'} , flags:{ noZoom: true, noRotate: true} , upright: true, ghost: true, } , ] EditableKind [TypeAliasDeclaration] (from packages/core/annotation/src/editable.ts): export type EditableKind = AnnotationSubtype | MeasurementIntent; EditableKinds [TypeAliasDeclaration] (from packages/core/annotation/src/editable.ts): export type EditableKinds = boolean | readonly EditableKind[]; Face [InterfaceDeclaration] (from packages/plugin/annotation/src/rich-text.ts): export interface Face{ family: string; weight?: number; italic?: boolean; } FieldValues [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type FieldValues = Readonly>; FilePickerProvider [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type FilePickerProvider = ( request: FilePromptRequest, ) => Promise; FilePromptRequest [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface FilePromptRequest{ toolId: string; subtype: KindName; accept?: string; page: PageRef; point: Point; } FlagKey [TypeAliasDeclaration] (from packages/core/annotation/src/kinds/define.ts): export type FlagKey = | 'invisible' | 'hidden' | 'print' | 'noZoom' | 'noRotate' | 'noView' | 'readOnly' | 'locked' | 'toggleNoView' | 'lockedContents'; GhostPolicy [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type GhostPolicy = boolean |{ opacity: number} ; HandleRole [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type HandleRole = 'corner' | 'side' | 'point'; ImageGhost [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ImageGhost{ readonly page: PageRef; readonly box: Rect; readonly rot: number; readonly opacity: number; } InkAuthoringOptions [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface InkAuthoringOptions{ groupStrokesMs?: number; straighten?: InkStraightenOptions; } LineEnding [TypeAliasDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export type LineEnding = | 'none' | 'square' | 'circle' | 'diamond' | 'open-arrow' | 'closed-arrow' | 'butt' | 'r-open-arrow' | 'r-closed-arrow' | 'slash'; LineEndings [InterfaceDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export interface LineEndings{ start: LineEnding; end: LineEnding; } LineStyle [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type LineStyle = 'solid' | 'dashed'; LinkNavItem [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface LinkNavItem{ readonly id: string; readonly bounds: Rect; readonly target: PdfLinkTarget; readonly attached: boolean; readonly activate?: PdfActionTree; readonly ref?: AnnotationRef; readonly hoverEvents?:{ enter: boolean; exit: boolean} ; } MIN_DRAG [VariableDeclaration] (from packages/core/annotation/src/placement.ts): MIN_DRAG = 3 MarkupSubtype [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type MarkupSubtype = 'highlight' | 'underline' | 'strikeout' | 'squiggly'; MeasurementIntent [TypeAliasDeclaration] (from packages/core/annotation/src/editable.ts): export type MeasurementIntent = 'line-dimension' | 'polyline-dimension' | 'polygon-dimension'; PdfLinkTarget [TypeAliasDeclaration] (from packages/engine/core/src/dto/PdfLinkTarget.ts): export type PdfLinkTarget = |{ kind: 'goto'; destination: Destination} |{ kind: 'uri'; uri: string} |{ kind: 'goto-remote'; file: string} |{ kind: 'launch'; path: string} |{ kind: 'javascript'} |{ kind: 'named'; name: string} |{ kind: 'unsupported'} ; Placement [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type Placement = |{ kind: 'box'; rect: Rect; rot: number} |{ kind: 'segment'; a: Point; b: Point} ; PromptSourceSpec [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface PromptSourceSpec{ kind: 'prompt'; accept?: string; } ResolvedGhost [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type ResolvedGhost = false |{ opacity: number} ; ResolvedTool [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface ResolvedTool{ id: string; subtype: KindName; preset: string; fieldsKind: string; cursor: string; enables: ReadonlySet; defaults?: FieldValues; flags?: Partial; source?: StampSourceSpec; selection?: SelectionAuthoring; ink?: InkAuthoringOptions; upright: boolean; clickCreate: ClickCreate | false; ghost: ResolvedGhost; afterCreate?: Partial; capture: boolean; meta?: Record; } ReviewStatus [InterfaceDeclaration] (from packages/engine/core/src/annotation/comments.ts): export interface ReviewStatus{ state: string; stateModel: string; by: string | null; at: IsoDateTime | null; ref: AnnotationRef; } SelectionAuthoring [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type SelectionAuthoring = |{ kind: 'markup'} |{ kind: 'text-edit'; operation: 'insert' | 'replace'} ; SnapSettings [InterfaceDeclaration] (from packages/core/annotation/src/types.ts): export interface SnapSettings{ readonly alignment: boolean; readonly alignmentThresholdPx: number; readonly rotation: boolean; readonly rotationAngles: readonly number[]; readonly rotationThresholdDeg: number; } StampInput [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface StampInput{ source: BinarySource; targetWidth?: number; name?: string; subject?: string; preview?: BinarySource | StampPreviewProvider; intrinsicSize?:{ width: number; height: number} ; } StampPlacement [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface StampPlacement{ readonly page: PageRef | number; readonly center: Point; readonly targetWidth?: number; readonly rotation?: number; readonly select?: boolean; } StampPreviewProvider [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type StampPreviewProvider = (devicePixelWidth: number) => Promise; StampSourceSpec [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type StampSourceSpec ={ kind: 'bytes'; source: BinarySource} | PromptSourceSpec; TextAlign [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type TextAlign = 'left' | 'center' | 'right'; TextFormat [TypeAliasDeclaration] (from packages/plugin/annotation/src/rich-text.ts): export type TextFormat = 'bold' | 'italic' | 'underline'; TextItem [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface TextItem{ readonly id: string; readonly ref: AnnotationRef | null; readonly box: Rect; readonly contents: string; readonly richText:{ paragraphs: RichTextParagraph[]} ; readonly face:{ family: string; weight: number; italic: boolean} ; readonly programs: readonly MountableFontProgram[]; readonly editing: boolean; readonly rot?: number; readonly css:{ fontFamily: string; fontSize: number; color: string; fontWeight: number; fontStyle: 'normal' | 'italic'; textDecoration: 'none' | 'underline'; align: 'left' | 'center' | 'right'; padding: number; } ; } TextSelection [InterfaceDeclaration] (from packages/plugin/annotation/src/rich-text.ts): export interface TextSelection extends RichTextRange{ id: string; } ThreadDeleteResult [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ThreadDeleteResult{ readonly deleted: AnnotationRef[]; readonly failed: Array<{ ref: AnnotationRef; error: unknown} >; } ToolAuthoringKind [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type ToolAuthoringKind = keyof typeof TOOL_DEFAULT_FIELDS; ToolDefaults [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ToolDefaults{ readonly color?: string | null; readonly interiorColor?: string | null; readonly opacity?: number; readonly strokeWidth?: number; readonly fontFamily?: string; readonly fontSize?: number; readonly fontColor?: string; readonly textAlign?: 'left' | 'center' | 'right'; readonly icon?: string; readonly contents?: string | null; readonly [field: string]: unknown; } ToolDefaultsChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ToolDefaultsChangedEvent{ readonly toolId: string; readonly defaults: ToolDefaults; } ToolDefaultsFor [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type ToolDefaultsFor = ToolDraftOf & (K extends 'free-text' | 'free-text-callout' ? ToolRichText : unknown); annotationKey [FunctionDeclaration] (from packages/engine/core/src/identity/annotationKey.ts): export function annotationKey(ref: AnnotationRef): string{ switch (ref.kind){ case 'objectNumber': return `obj:${ ref.objectNumber} `; case 'baseIndex': return `base:${ ref.page.objectNumber} :${ ref.baseIndex} `; } } annotationPlugin [VariableDeclaration] (from packages/plugin/annotation/src/annotation.plugin.ts): annotationPlugin = (config?: AnnotationConfig) => definePlugin({ id: 'annotation', token: AnnotationToken, scope: 'document', requires: [InteractionToken], optional: [SelectionToken, PublicActionsToken, RenderToken, FontsToken], state: initialAnnotationModel, settings:{ defaults: ANNOTATION_DEFAULTS, registered: config, whole: ['chrome.marquee']} , create: createAnnotationController, } ) annotationState [VariableDeclaration] (from packages/plugin/annotation/src/state.ts): annotationState = defineState(AnnotationToken, { read: (annotation): AnnotationState => ({ status: annotation.getStatus(), selected: annotation.selection.getSelected(), hovered: annotation.getHovered(), editing: annotation.text.getEditing(), } ), empty:{ status: 'loading', selected: [], hovered: null, editing: null} , } ) gesturePlacement [FunctionDeclaration] (from packages/core/annotation/src/placement.ts): export function gesturePlacement( form: GestureForm, from: Point, to: Point, clickCreate: ClickCreate | false | undefined, frame: PlacementFrame ={ } , ): Placement | null{ if (!isDrag(form, from, to)){ return clickCreate ? resolveClickPlacement(from, clickCreate, frame) : null; } const a = frame.pageBox ? clampPointToBox(from, frame.pageBox) : from; const b = frame.pageBox ? clampPointToBox(to, frame.pageBox) : to; if (form === 'segment') return{ kind: 'segment', a, b} ; const rot = uprightTurn(frame); const dragged = rectFromPoints(a, b); return{ kind: 'box', rect: rot % 180 ? transposedAboutCenter(dragged) : dragged, rot} ; } kindNamed [FunctionDeclaration] (from packages/core/annotation/src/kinds/index.ts): export function kindNamed(name: string): AnnotationKind{ const kind = KINDS[name]; if (kind) return kind; let shown = shownOnly.get(name); if (!shown){ shown ={ name, family: boxFamily, style: plainStyle, caps:{ ...NO_CAPS, rasterOnly: true} , properties: [], } ; shownOnly.set(name, shown); } return shown; } orientationPatch [FunctionDeclaration] (from packages/core/annotation/src/record/shape.ts): export function orientationPatch( annotation: Annotation, rotation: Rotation, ):{ box: Rect; rotation: Rotation | null} | Record{ if (!kindOf(annotation).caps.quarterTurns) return{ } ; const shape = shapeOf(annotation); if (shape.kind !== 'box') return{ } ; const stands = standingRect(shape.box, shape.rotation); return{ box: standingRect(stands, rotation), rotation: rotation || null} ; } propertiesOf [FunctionDeclaration] (from packages/core/annotation/src/props.ts): export function propertiesOf(kind: AnnotationKind): readonly AnnotationProperty[]{ let properties = withFlags.get(kind); if (!properties){ properties = [...kind.properties, ...FLAG_PROPERTIES]; withFlags.set(kind, properties); } return properties; } resolveClickPlacement [FunctionDeclaration] (from packages/core/annotation/src/placement.ts): export function resolveClickPlacement( point: Point, policy: ClickCreate, frame: PlacementFrame ={ } , ): Placement{ const seen = frame.upright ? (frame.displayRotation ?? 0) : 0; if ('length' in policy){ const turn = ((policy.rotation ?? 0) * Math.PI) / 180; const span = rotatePoint({ x: Math.cos(turn) * policy.length, y: Math.sin(turn) * policy.length} , { x: 0, y: 0} , -seen, ); const before = policy.anchor === 'start' ? 0 : policy.anchor === 'end' ? 1 : 0.5; const a ={ x: point.x - span.x * before, y: point.y - span.y * before} ; const b ={ x: a.x + span.x, y: a.y + span.y} ; const bounds = rectFromPoints(a, b); const placed = clampRectToBox(bounds, frame.pageBox); const dx = placed.x - bounds.x; const dy = placed.y - bounds.y; return{ kind: 'segment', a:{ x: a.x + dx, y: a.y + dy} , b:{ x: b.x + dx, y: b.y + dy} } ; } const{ width, height} = policy; const rot = uprightTurn(frame); const rect = policy.anchor === 'top-left' ? uprightAnchoredRect(point, width, height, seen) :{ x: point.x - width / 2, y: point.y - height / 2, width, height} ; const shown = rot % 180 ? transposedAboutCenter(rect) : rect; const placed = clampRectToBox(shown, frame.pageBox); return{ kind: 'box', rect:{ ...rect, x: rect.x + placed.x - shown.x, y: rect.y + placed.y - shown.y} , rot, } ; } widgetAppearanceOf [FunctionDeclaration] (from packages/core/annotation/src/record/defaults.ts): export function widgetAppearanceOf(defaults: FieldValues): WidgetAppearance{ return Object.fromEntries( WIDGET_APPEARANCE_FIELDS.filter((name) => defaults[name] !== undefined).map((name) => [ name, defaults[name], ]), ) as WidgetAppearance; }