import { IFuseOptions } from 'fuse.js'; import { Connectable, Subject } from 'rxjs'; import { DeepPartial } from 'utility-types'; import { RivSelect } from '../../input/select/state'; import { HighlightComponent } from '../../visualization/highlight/highlight.component'; export declare namespace RivViews { const ViewPermissions: readonly ["private", "shared", "public"]; type ViewPermission = (typeof ViewPermissions)[number]; const MenuContexts: readonly ["tab", "all-views", "overflow"]; type MenuContext = (typeof MenuContexts)[number]; type User = RivSelect.BaseOption; const UserSelectModes: readonly ["select", "search-select"]; type UserSelectMode = (typeof UserSelectModes)[number]; type SearchSelectUser = U & { new: boolean; }; type OnAddUser = (searchText: string) => SearchSelectUser; type View = { id: string | number; title: string; enabled: boolean; } & ({ permission: 'private' | 'public'; } | { permission: 'shared'; sharedUsers: U[]; }); type FullView> = V & { active: boolean; system: boolean; titleHighlightIndices?: HighlightComponent.HighlightIndices[]; temporary: boolean; }; type CoreState> = { views: V[]; activeViewId: V['id'] | null; temporaryViewId: V['id'] | null; containerWidth: number; editingViewContext: { id: V['id']; autoRename: boolean; menuContext: MenuContext; } | null; deletingViewContext: { id: V['id']; menuContext: MenuContext; } | null; overflow: { search: string; pickerOpen: boolean; }; all: { search: string; privateOpen: boolean; sharedOpen: boolean; publicOpen: boolean; }; userSource: UserSource; userSelectMode: UserSelectMode; onAddUser?: OnAddUser; newTooltip?: string; hasSystemView: boolean; }; type FullState> = CoreState & { allViews: FullView[]; displayedViews: FullView[]; enabledViews: FullView[]; allEnabledViews: FullView[]; all: { privateViews: FullView[]; sharedViews: FullView[]; publicViews: FullView[]; }; }; type Action> = { type: 'load'; } | { type: 'setActiveView'; id: V['id']; source?: 'tab' | 'menu' | 'overflow'; } | { type: 'setEnabled'; id: V['id']; enabled: boolean; source?: 'menu' | 'eyeIcon'; } | { type: 'setContainerWidth'; width: number; } | { type: 'setOverflowPickerOpen'; open: boolean; } | { type: 'setOverflowSearchQuery'; query: string; } | { type: 'setAllViewsSearchQuery'; query: string; } | { type: 'updateView'; view: V; } | { type: 'deleteView'; view: V; } | { type: 'duplicateView'; view: V; menuContext: MenuContext; } | { type: 'copyLinkToView'; view: V; } | { type: 'setEditingView'; context: CoreState['editingViewContext']; } | { type: 'setDeletingView'; context: CoreState['deletingViewContext']; } | { type: 'viewOrderChange'; previousEnabledIndex: number; newEnabledIndex: number; source?: 'tabDrag' | 'overflowDrag'; viewTitle?: V['title']; } | { type: 'setAllViewsToggle'; permission: ViewPermission; open: boolean; } | { type: 'createTemporaryView'; view: V; }; type Source> = () => V[] | Promise; type Save> = (views: V[]) => void | Promise; type Duplicate> = (viewToDuplicate: V) => V | Promise; type UserSource = () => U[] | Promise; type CopyLink> = (view: V) => void | Promise; type SetActiveViewId> = (id: V['id']) => void | Promise; type Manager> = { actions: Subject>; state: Connectable>; }; type ManagerOptions> = { initialState?: DeepPartial>; fuseOptions?: IFuseOptions; }; type CreateManagerInput> = { source: Source; save: Save; duplicate: Duplicate; userSource: UserSource; userSelectMode?: UserSelectMode; onAddUser?: OnAddUser; newTooltip?: string; copyLink: CopyLink; setActiveViewId: SetActiveViewId; options?: ManagerOptions; }; function createManager>({ source, save, duplicate, userSource, userSelectMode, onAddUser, newTooltip, copyLink, options, setActiveViewId, }: CreateManagerInput): Manager; function getPermissionTitle(permission: ViewPermission): string; function getPermissionDescription(permission: ViewPermission): string; function isSharedView>(view?: FullView): view is FullView & { permission: 'shared'; sharedUsers: U[]; }; /** * Converts SearchSelectUser items back to U[] for storage in sharedUsers. * * Cast required because TypeScript cannot prove that destructuring `new` * from `U & { new: boolean }` yields exactly `U` (spread/rest doesn't * narrow intersection types). * * - Strips `new: false` so isEqual() comparisons work (original users lack `new`) * - Preserves `new: true` so the backend knows which users to create */ function toSharedUsers(users: SearchSelectUser[]): U[]; }