# @embedpdf/svelte — ./attachment 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; } ; AttachedFile [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachedFile extends Readonly{ readonly id: string; readonly home: AttachedFileHome; } AttachedFileHome [TypeAliasDeclaration] (from packages/plugin/attachment/src/contract.ts): export type AttachedFileHome = |{ readonly kind: 'document'; readonly ref: AttachmentRef} |{ readonly kind: 'page'; readonly ref: AnnotationRef} ; AttachmentCapability [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachmentCapability{ list(): readonly AttachedFile[]; get(id: string): AttachedFile | null; getSelected(): readonly AttachedFile[]; select(files: readonly AttachedFile[]): void; isPending(file: AttachedFile): boolean; getStatus(): ResourceStatus; ensureLoaded(options?: OperationOptions): Promise; refresh(options?: OperationOptions): Promise; canDownload(): boolean; canCreate(): boolean; canDelete(file: AttachedFile): boolean; create( files: readonly AttachmentFileSource[], options?: OperationOptions, ): Promise; delete(file: AttachedFile, options?: OperationOptions): Promise; download(file: AttachedFile, options?: OperationOptions): Promise; reveal(file: AttachedFile): void; readonly onChanged: EventHook; readonly onResynced: EventHook; } AttachmentContent [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentContent{ bytes: Uint8Array; name: string; mimeType: string | null; } AttachmentFileInfo [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentFileInfo{ name: string; mimeType: string | null; description: string | null; sizeBytes: number | null; md5: string | null; createdAt: IsoDateTime | null; modifiedAt: IsoDateTime | null; } AttachmentFileSource [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentFileSource{ data: Uint8Array | ArrayBuffer | Blob; name?: string; mimeType?: string; description?: string; } AttachmentRef [TypeAliasDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export type AttachmentRef ={ kind: 'key'; key: string} ; AttachmentState [InterfaceDeclaration] (from packages/plugin/attachment/src/state.ts): export interface AttachmentState{ readonly files: readonly AttachedFile[]; readonly selected: readonly AttachedFile[]; readonly status: ResourceStatus; readonly canCreate: boolean; readonly canDownload: boolean; } AttachmentToken [VariableDeclaration] (from packages/plugin/attachment/src/token.ts): AttachmentToken = createCapabilityToken('attachment', { hint: "add attachmentPlugin() from '@embedpdf/plugin-attachment' to your plugins list", promises:{ ensureLoaded: true, refresh: true, create: true, delete: true, download: true, } , } ) AttachmentsChangedEvent [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachmentsChangedEvent{ readonly type: 'created' | 'deleted' | 'restored'; readonly files: readonly AttachedFile[]; readonly origin: EventOrigin; } AttachmentsResyncedEvent [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachmentsResyncedEvent{ readonly files: readonly AttachedFile[]; } attachmentPlugin [VariableDeclaration] (from packages/plugin/attachment/src/attachment.plugin.ts): attachmentPlugin = () => definePlugin({ id: 'attachment', token: AttachmentToken, scope: 'document', optional: [AnnotationToken, StageToken], state: initialAttachmentModel, create: createAttachmentController, } ) attachmentState [VariableDeclaration] (from packages/plugin/attachment/src/state.ts): attachmentState = defineState(AttachmentToken, { read: (attachment): AttachmentState => ({ files: attachment.list(), selected: attachment.getSelected(), status: attachment.getStatus(), canCreate: attachment.canCreate(), canDownload: attachment.canDownload(), } ), empty:{ files: [], selected: [], status: 'idle', canCreate: false, canDownload: false, } , ensure: (attachment) => attachment.ensureLoaded(), } ) displayNameOf [FunctionDeclaration] (from packages/plugin/attachment/src/names.ts): export function displayNameOf(file:{ readonly name: string} ): string{ return file.name.replace(HIDDEN, '').trim() || 'attachment'; } useAttachment [FunctionDeclaration] (from packages/framework/svelte/src/attachment/readers.ts): export function useAttachment(): AttachmentCapability{ return useCapability(AttachmentToken); } useAttachmentEvent [FunctionDeclaration] (from packages/framework/svelte/src/attachment/readers.ts): export function useAttachmentEvent( select: (attachment: AttachmentCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(AttachmentToken, select, handler); } useAttachmentState [VariableDeclaration] (from packages/framework/svelte/src/attachment/readers.ts): useAttachmentState = stateReader(attachmentState)