import { IView } from './view.ts'; import { TypedEventTarget } from 'typescript-event-target'; /** * The event is emitted when the navigation view was updated. * It contains the new active view in the `detail` attribute. */ interface UpdateActiveViewEvent extends CustomEvent { type: 'updateActive'; } /** * This event is emitted when the list of registered views is changed */ interface UpdateViewsEvent extends CustomEvent { type: 'update'; } /** * The files navigation manages the available and active views * * Custom views for the files app can be registered (examples are the favorites views or the shared-with-you view). * It is also possible to listen on changes of the registered views or when the current active view is changed. * * @example * ```js * const navigation = getNavigation() * navigation.addEventListener('update', () => { * // This will be called whenever a new view is registered or a view is removed * const viewNames = navigation.views.map((view) => view.name) * console.warn('Registered views changed', viewNames) * }) * // Or you can react to changes of the current active view * navigation.addEventListener('updateActive', (event) => { * // This will be called whenever the active view changed * const newView = event.detail // you could also use `navigation.active` * console.warn('Active view changed to ' + newView.name) * }) * ``` */ export declare class Navigation extends TypedEventTarget<{ updateActive: UpdateActiveViewEvent; update: UpdateViewsEvent; }> { private _views; private _currentView; /** * Register a new view on the navigation * * @param views The views to register * @throws {Error} if a view with the same id is already registered * @throws {Error} if the registered view is invalid */ register(...views: IView[]): void; /** * Remove a registered view * * @param id The id of the view to remove */ remove(id: string): void; /** * Set the currently active view * * @param id - The id of the view to set as active * @throws {Error} If no view with the given id was registered * @fires UpdateActiveViewEvent */ setActive(id: string | null): void; /** * The currently active files view */ get active(): IView | null; /** * All registered views */ get views(): IView[]; } /** * Get the current files navigation */ export declare function getNavigation(): Navigation; export {};