UNPKG

file-surf

Version:

A React package that extends Monaco Editor with VS Code-like file explorer capabilities, allowing users to navigate through multiple files and folders with a familiar interface

51 lines (46 loc) 1.43 kB
import React from 'react'; type FileType = 'file' | 'folder'; interface FileNode { name: string; type: FileType; content?: string; children?: FileNode[]; } interface FileMap { node: FileNode; path: string; parentPath: string | null; } interface FileSurfProps { files: Map<string, FileMap>; height?: string | number; width?: string | number; theme?: 'dark' | 'light'; } interface FileTreeProps { files: Map<string, FileMap>; onFileSelect: (path: string) => void; selectedFile: string | null; explorerWidth: number; } interface MonacoEditorProps { files: Map<string, FileMap>; selectedFile: string | null; openTabs: string[]; activeTab: string | null; onTabChange: (path: string) => void; onTabClose: (path: string) => void; highlightedFile: string | null; } interface UseFileSurfReturn { files: Map<string, FileMap>; addFile: (parentPath: string, newFile: FileNode) => void; updateFile: (filePath: string, newContent: string) => void; deleteFile: (filePath: string) => void; } declare const FileSurf: React.FC<FileSurfProps>; /** * Custom hook for managing file system operations */ declare const useFileSurf: (initialFiles: FileNode) => UseFileSurfReturn; export { type FileMap, type FileNode, FileSurf, type FileSurfProps, type FileTreeProps, type FileType, type MonacoEditorProps, type UseFileSurfReturn, useFileSurf };