import { INode } from '../../node/node.ts'; import { ISidebarAction } from './SidebarAction.ts'; import { ISidebarContext, ISidebarTab } from './SidebarTab.ts'; export interface ISidebar { /** * If the files sidebar can currently be accessed, * meaning it is rendered on the current page either by the files app * or by an app rendering the sidebar within its own app. * Registering tabs also works if the sidebar is currently not available. */ readonly available: boolean; /** * The current open state of the sidebar */ readonly isOpen: boolean; /** * The currently active sidebar tab id */ readonly activeTab?: string; /** * The currently opened node in the sidebar */ readonly node?: INode; /** * Open the sidebar for a specific node. * * When the sidebar is fully opened the `files:sidebar:opened` event is emitted, * see also `@nextcloud/event-bus`. * * @param node - The node to open the sidebar for * @param tab - The tab to open by default */ open(node: INode, tab?: string): void; /** * Close the sidebar. * * When the sidebar is fully closed the `files:sidebar:closed` event is emitted, * see also `@nextcloud/event-bus`. */ close(): void; /** * Set the active sidebar tab * * @param tabId - The tab to set active */ setActiveTab(tabId: string): void; /** * Render the sidebar as a fullscreen overlay of the current page. * * @param isFullScreen - Whether to render the sidebar fullscreen */ setFullScreenMode(isFullScreen: boolean): void; /** * Render the sidebar into an element of the current app. * * The sidebar is rendered into the app content element as soon as the page is loaded, * so this is only needed by apps that render the sidebar into a specific element * or that set up their own layout after the page was loaded. * Calling this again moves an already rendered sidebar into the requested element. * * Requires the app to request the sidebar for the current page, * by dispatching the `OCA\Files\Event\LoadSidebar` event while rendering it. * Within the files app the sidebar is part of the app layout, so this does nothing. * * @param target - The element to render the sidebar into */ mount(target: HTMLElement): void; /** * Register a new sidebar tab. * This should ideally be done on app initialization using Nextcloud init scripts. * * @param tab - The sidebar tab to register */ registerTab(tab: ISidebarTab): void; /** * Get all registered sidebar tabs. * If a node is passed only the enabled tabs are retrieved. */ getTabs(context?: ISidebarContext): ISidebarTab[]; /** * Get all registered sidebar actions. * * If a context is provided only the enabled actions are returned. * * @param context - The context */ getActions(context?: ISidebarContext): ISidebarAction[]; /** * Register a new sidebar action. * * @param action - The action to register */ registerAction(action: ISidebarAction): void; } /** * Get a reference to the files sidebar. */ export declare function getSidebar(): ISidebar;