// Type definitions for @oix1987/yjd // These declarations are the package entry types (referenced via "types" in package.json), // so they are declared at top level rather than wrapped in `declare module`. /** A person/task suggestion returned by a mention source. */ export interface MentionItem { id: string | number; name?: string; label?: string; avatar_url?: string; [key: string]: any; } /** Config for a single mention trigger character. */ export interface MentionTrigger { /** Trigger character, e.g. '#'. */ char: string; /** Async (or sync) lookup of suggestions for the typed query. */ source: (query: string) => MentionItem[] | Promise; /** Custom HTML for a suggestion row. Defaults to avatar + name. */ renderItem?: (item: MentionItem) => string; /** * Custom token this trigger serializes to in getContent()/getMarkdown(). * Defaults to `#[Name](id)`. Return e.g. `'#' + item.id` to store a bare id * with no regex post-processing. */ serialize?: (item: MentionItem) => string; } /** @mention configuration. The token inserted carries `data-id`. */ export interface MentionOptions { /** Primary trigger character (default '@'). */ trigger?: string; source?: (query: string) => MentionItem[] | Promise; renderItem?: (item: MentionItem) => string; /** Custom token for the primary trigger. Defaults to `@[Name](id)`. */ serialize?: (item: MentionItem) => string; /** Additional triggers, e.g. '#' for task references. */ triggers?: MentionTrigger[]; } /** Image upload hook configuration. */ export interface ImageOptions { /** * Upload the chosen file and resolve to its URL. While pending, a placeholder * is shown; on resolve the src is swapped, on reject the image is removed. * Omit to fall back to inline base64 (data URLs). */ upload?: (file: File) => string | Promise; /** `accept` attribute for the file picker (default 'image/*'). */ accept?: string; /** Maximum file size in bytes; larger files emit 'image:error'. */ maxSize?: number; /** Display cap for inserted images (px or any CSS length, e.g. '60vh'). */ maxHeight?: number | string; /** Display cap for inserted images (px or any CSS length). */ maxWidth?: number | string; } /** Result of a file.upload hook — a URL, or richer metadata. */ export interface FileUploadResult { url: string; name?: string; size?: string; } /** Attachment (non-image file) upload hook. Inserts a "file chip". */ export interface FileOptions { /** * Upload the chosen file; resolve to a URL string or { url, name, size }. * While pending a placeholder chip is shown. Omit to inline a data: URL. */ upload?: (file: File) => string | FileUploadResult | Promise; /** `accept` attribute for the file picker (e.g. '.pdf,.zip,.docx'). */ accept?: string; /** Maximum file size in bytes; larger files emit 'file:error'. */ maxSize?: number; } /** Video drop/insert config (inline