import type React from 'react'; import type { SidebarBlockConfig } from '../Sidebar/Block'; export declare type URIDetailView = React.VoidFunctionComponent<{ uri: string; }>; export interface ProtocolConfig { main: URIDetailView; title: URIDetailView; /** * Provides plain-text title. * * @deprecated do not use. * For window titles, put within relevant tab component. */ plainTitle?: (uri: string) => Promise; } /** Defines which React components should be used for which protocol among tabs. */ export declare type ProtocolRegistry = Record; interface SidebarConfig { icon: React.FC>; title: JSX.Element | string; blocks: SidebarBlockConfig[]; description?: string; } export declare type SuperSidebarConfig> = { [sidebarID in SidebarIDs[number]]: SidebarConfig; }; export declare type TabbedWorkspaceContext = { /** The URI of currently focused tab. */ focusedTabURI?: string; /** Navigates currently focused tab to a new URI. */ navigateFocusedTab?: (newURI: string) => void; /** Open a new tab with specified URI next to the focused one. */ spawnTab: (uri: string, opts?: { atIdx?: number; }) => void; /** Despawns tab with given URI. */ closeTabWithURI: (uri: string) => void; protocolConfiguration: ProtocolRegistry; state: State; dispatch: React.Dispatch>; }; /** Current state of tabs and sidebars in the workspace. */ export interface State { /** * Tabs, according to the order * (would be left-to-right in LTR, currently the only direction supported). */ detailTabURIs: Readonly; /** Selected tab index in `detailTabURIs`. */ focusedTabIdx: number; /** * Selected sidebar ID * (see `TabbedWorkspaceProps['sidebarConfig']`, sidebar configuration * is not part of state (though maybe it should be?)). */ selectedSidebarID?: SidebarID; } export declare type Action = { type: 'spawn-tab'; payload: { /** * If specified, tab will be spawned at this index. * Every tab at index >= atIdx will be shifted to the right, * increasing index by 1. */ atIdx?: number; uri: string; }; } | { type: 'focus-tab'; payload: { idx: number; }; } | { type: 'navigate-focused-tab'; payload: { uri: string; }; } | { type: 'move-tab'; payload: { sourceIdx: number; destinationIdx: number; }; } | { type: 'close-tab'; payload: { idx: number; }; } | { type: 'close-tab-with-uri'; payload: { uri: string; }; } | { type: 'focus-sidebar'; payload: { id: SidebarID; }; }; export {};