Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
types.ts94 linesDownload Raw Back to PgTree
1import { IFileTreeHandle, FileEntry, Directory, FileType, IFileEntryItem, IItemRenderer, FileOrDir } from 'react-aspen';2import { IDisposable } from 'notificar';3import { TreeModelX } from './TreeModelX';4import React from 'react';5 6 7export interface IFileTreeXTriggerEvents {8    onEvent(event: string, path: string): boolean | Promise<boolean>9}10 11export interface IItemRendererX extends IItemRenderer {12    getBoundingClientRectForItem(item: FileEntry | Directory): ClientRect13}14 15// Here imagination is your limit! IFileTreeHandle has core low-level features you can build on top of as your application needs16export interface IFileTreeXHandle extends IFileTreeHandle {17    getActiveFile(): FileEntry | Directory18    setActiveFile(path: string)19    setActiveFile(file: FileEntry)20    setActiveFile(dir: Directory)21 22    getPseudoActiveFile(): FileEntry | Directory23    setPseudoActiveFile(path: string)24    setPseudoActiveFile(file: FileEntry)25    setPseudoActiveFile(dir: Directory)26 27    rename(path: string)28    rename(file: FileEntry)29    rename(dir: Directory)30 31    newFile(dirpath: string)32    newFile(dir: Directory)33    newFolder(dirpath: string)34    newFolder(dir: Directory)35    toggleDirectory(path: string)36    toggleDirectory(dir: Directory)37 38    first(file: FileEntry): FileEntry | Directory39    first(dir: Directory): FileEntry | Directory40    first(): FileEntry | Directory41 42    parent(file: FileEntry): Directory43    parent(dir: Directory): Directory44 45    hasParent(file: FileEntry): boolean46    hasParent(dir: Directory): boolean47 48    isOpen(file: FileEntry): boolean49    isOpen(dir: Directory): boolean50 51    isClosed(file: FileEntry): boolean52    isClosed(dir: Directory): boolean53 54    itemData(file: FileEntry): array55    itemData(dir: Directory): array56 57    children(file: FileEntry): array58    children(dir: Directory): array59 60    getModel(): TreeModelX61    /**62     * If document.activeElement === filetree wrapper element63     */64    hasDirectFocus(): boolean65 66    // events67    onBlur(callback: () => void): IDisposable68}69 70export interface IFileTreeXProps {71    height: number72    width: number73    model: TreeModelX74 75    /**76     * Same as unix's `mv` command as in `mv [SOURCE] [DEST]`77     */78    mv: (oldPath: string, newPath: string) => boolean | Promise<boolean>79 80    /**81     * Amalgam of unix's `mkdir` and `touch` command82     */83    create: (path: string, type: FileType) => IFileEntryItem | Promise<IFileEntryItem>84    onReady?: (handle: IFileTreeXHandle) => void85    onEvent?: (event: IFileTreeXTriggerEvents) => void86    onContextMenu?: (ev: React.MouseEvent, item?: FileOrDir) => void87    onScroll?: (ev: React.UIEvent<HTMLDivElement>) => void88}89 90export enum FileTreeXEvent {91    OnBlur,92    onTreeEvents,93}94 
codekingpro/portable-devtools · Team Ai