import { IDocumentManager } from '@jupyterlab/docmanager'; import { Contents } from '@jupyterlab/services'; import { Toolbar } from '@jupyterlab/ui-components'; import { ISignal } from '@lumino/signaling'; import { Widget } from '@lumino/widgets'; export declare const FILE_BROWSER_ID = "xtralab:file-browser"; interface IXtralabFileBrowserOptions { contentsManager: Contents.IManager; docManager: IDocumentManager; onOpenFile?: (serverPath: string) => void; } /** * Public API of the xtralab file browser used by command handlers and other * collaborators. Kept narrow on purpose so the React component stays free to * evolve the underlying tree integration. */ export interface IXtralabFileBrowser { /** * The contents manager backing the tree. Exposed so command handlers can * issue contents operations (rename, delete, copy, …) against the same * drive the tree was loaded from. */ readonly contentsManager: Contents.IManager; /** * The toolbar shown above the tree. Plugin code populates it with command * buttons after the widget is constructed. */ readonly toolbar: Toolbar; /** * Canonical paths of the items currently selected in the tree. Folder * paths carry a trailing slash; file paths do not. */ readonly selectedPaths: readonly string[]; /** * Emits when the tree's selection changes. Commands that have an * `isVisible` / `isEnabled` predicate should listen so they re-evaluate. */ readonly selectionChanged: ISignal; /** * Emits when {@link refresh} is called. The React component listens and * re-fetches the directories that were previously loaded so the tree * matches the contents on disk again. */ readonly refreshRequested: ISignal; /** * Emits when the widget is asked to surface a newly-created path * (for example, after the toolbar's "new folder" command). The React * component listens and inserts the path into the model so the user * sees the new item without a full refresh. */ readonly pathAdded: ISignal; /** * Emits when an external caller asks the tree to scroll to and select * the given canonical path. The React component listens, lazily loads * any unloaded ancestor directories, expands them, and selects the * target. Used by the editor breadcrumbs to jump back to a file or * folder shown in the breadcrumb trail. */ readonly revealRequested: ISignal; /** * Emits when an external caller asks the tree to return to the * workspace root: clear any current selection and scroll back to the * first row. Distinct from {@link revealRequested} because the * workspace root has no tree row of its own — it cannot be reached * by passing a path. */ readonly rootRequested: ISignal; /** * Emits when an external caller asks the tree to collapse every * expanded folder. The React component listens and walks the loaded * directories, calling `.collapse()` on each expanded one. */ readonly collapseAllRequested: ISignal; /** * Whether the filter box above the tree is shown. Mirrors the default * file browser's `showFileFilter`: hidden on startup and flipped by the * toolbar toggle. Also forced to `true` when the tree opens a search * session on its own — typing a letter while the tree has focus. */ readonly fileFilterVisible: boolean; /** * Emits when {@link fileFilterVisible} changes. The React component * listens to show or hide the filter box; the toggle command listens * to refresh its toggled state. */ readonly fileFilterVisibleChanged: ISignal; /** * Trigger a refresh of every loaded directory in the tree. */ refresh(): void; /** * Notify the React component that a new path was created and should * appear in the tree. `canonicalPath` follows the `@pierre/trees` * convention: directories carry a trailing slash, files do not. */ notifyPathAdded(canonicalPath: string): void; /** * Ask the tree to reveal {@link canonicalPath}: load and expand any * unloaded ancestor directories, then select and scroll the target * into view. `canonicalPath` follows the `@pierre/trees` convention * (directories carry a trailing slash, files do not). Must be a * non-empty path — use {@link scrollToRoot} for the root gesture. */ reveal(canonicalPath: string): void; /** * Ask the tree to return to the workspace root: clear any current * selection and scroll back to the top of the tree. */ scrollToRoot(): void; /** * Ask the tree to collapse every currently expanded folder. */ collapseAll(): void; /** * Show or hide the filter box above the tree. */ setFileFilterVisible(visible: boolean): void; /** * Toggle the filter box above the tree. */ toggleFileFilter(): void; } /** * Lumino widget that hosts the React-based `@pierre/trees` file browser. * The widget is laid out with a JupyterLab `Toolbar` on top and the tree * filling the remaining space. */ export declare class XtralabFileBrowser extends Widget implements IXtralabFileBrowser { constructor(options: IXtralabFileBrowserOptions); get contentsManager(): Contents.IManager; get toolbar(): Toolbar; get selectedPaths(): readonly string[]; get selectionChanged(): ISignal; get refreshRequested(): ISignal; get pathAdded(): ISignal; get revealRequested(): ISignal; get rootRequested(): ISignal; get collapseAllRequested(): ISignal; get fileFilterVisible(): boolean; get fileFilterVisibleChanged(): ISignal; /** * Update the cached selection. Called from the React tree when the * underlying `@pierre/trees` model emits a selection change. */ updateSelection(paths: readonly string[]): void; refresh(): void; notifyPathAdded(canonicalPath: string): void; reveal(canonicalPath: string): void; scrollToRoot(): void; collapseAll(): void; setFileFilterVisible(visible: boolean): void; toggleFileFilter(): void; private _contentsManager; private _docManager; private _onOpenFile; private _selectedPaths; private _selectionChanged; private _refreshRequested; private _pathAdded; private _revealRequested; private _rootRequested; private _collapseAllRequested; private _fileFilterVisible; private _fileFilterVisibleChanged; private _toolbar; private _content; } export {};