import type { Ref } from 'vue'; import type { Item as ContextMenuItem } from './utils/contextmenu'; import ServiceContainer from './ServiceContainer'; import type { Driver } from './adapters'; import type { ConfigDefaults } from './stores/config'; import type { FeaturesConfig, FeaturesPreset } from './features'; export type App = ReturnType; export interface VueFinderProps { id: string; driver: Driver; config?: ConfigDefaults; features?: FeaturesPreset | FeaturesConfig; debug?: boolean; locale?: string; contextMenuItems?: ContextMenuItem[]; selectionMode?: 'single' | 'multiple'; selectionFilterType?: 'files' | 'dirs' | 'both'; selectionFilterMimeIncludes?: string[]; onError?: (error: any) => void; onSelect?: SelectEvent; onPathChange?: UpdatePathEvent; onUploadComplete?: (files: DirEntry[]) => void; onDeleteComplete?: (deletedItems: DirEntry[]) => void; onNotify?: NotifyEvent; onReady?: () => void; /** * Handler for file double-click events * Receives a cancelable event object. Call event.preventDefault() to prevent default behavior. * @param event - Cancelable event object containing the file item */ onFileDclick?: (event: ItemDclickEvent) => void; /** * Handler for folder double-click events * Receives a cancelable event object. Call event.preventDefault() to prevent default behavior. * @param event - Cancelable event object containing the folder item */ onFolderDclick?: (event: ItemDclickEvent) => void; /** * Custom uploader configuration (optional) * If provided, will override adapter's configureUploader */ customUploader?: (uppy: any, context: { getTargetPath: () => string; }) => void; } export type SelectEvent = (items: DirEntry[]) => void; export type UpdatePathEvent = (path: string) => void; export type NotifyEvent = (notification: NotifyPayload) => void; export interface NotifyPayload { type: 'success' | 'error' | 'info' | 'warning'; message: string; } export interface VueFinderComposable { refresh: () => Promise; open: (path: string) => Promise; preview: (path: string) => void; notify: (type: 'success' | 'error' | 'info' | 'warning', message: string) => void; getPath: () => string; /** Reactive current directory path. Updates as the user navigates. */ path: Readonly>; select: (paths: string[]) => void; selectOne: (path: string) => void; clearSelection: () => void; getSelectedPaths: () => string[]; createFolder: (name: string, path?: string) => Promise; createFile: (name: string, path?: string) => Promise; delete: (paths: string[], path?: string) => Promise; rename: (itemPath: string, newName: string, path?: string) => Promise; copy: (sources: string[], destination: string, path?: string) => Promise; move: (sources: string[], destination: string, path?: string) => Promise; getFiles: () => DirEntry[]; getStorages: () => string[]; isLoading: () => boolean; isReadOnly: () => boolean; } /** * Double-click event object carrying the clicked item * Allows handlers to prevent default behavior by calling preventDefault() */ export interface ItemDclickEvent { /** The file or folder that was double-clicked */ item: DirEntry; /** Whether the default behavior was prevented */ defaultPrevented: boolean; /** Prevents the default behavior from executing */ preventDefault(): void; } export type DirEntryType = 'file' | 'dir'; export interface DirEntry { dir: string; basename: string; extension: string; path: string; storage: string; type: DirEntryType; file_size: number | null; last_modified: number | null; mime_type: string | null; read_only?: boolean; visibility: string; previewUrl?: string; } export interface StorageInfo { filesystem?: string; } export interface PinnedFolder { path: string; storage: string; basename: string; type: 'dir'; } export interface TreeViewFolder { storage: string; path: string; basename: string; type: 'dir'; } export interface TreeViewData { path: string; folders: TreeViewFolder[]; } export interface FsData { storages: string[]; dirname: string; files: DirEntry[]; read_only?: boolean; } export interface MenuItem { id?: string; label?: string; type?: 'separator'; items?: MenuItem[]; action?: () => void; enabled?: () => boolean; hidden?: () => boolean; checked?: () => boolean; } export type { FeatureName, FeaturesConfig, FeaturesPreset } from './features';