IPinManagerService.ts
1 import { HasPinAbility, IFileInfo } from '../../MetaData'; 2 import { IPinItem } from './IPinItem'; 3 import { Signal } from '@preact/signals-core'; 4 5 export const IPinManagerServiceSymbol = Symbol.for('IPinManagerService'); 6 7 export enum PinStatus { 8 UnPinned, 9 Pinned, 10 Working, 11 } 12 13 /** 14 * Manages pinned items. 15 */ 16 export interface IPinManagerService { 17 /** 18 * Checks whether an item is pinned or not. 19 * @param item The item to check. 20 */ 21 isPinned(item: HasPinAbility): PinStatus; 22 23 /** 24 * Adds a pin to an item. 25 * @param item the item to pin. 26 */ 27 addPin(item: HasPinAbility): Promise<void>; 28 29 /** 30 * Removes a pin from an item. 31 * @param item the item to remove the pin from. 32 */ 33 removePin(item: HasPinAbility): Promise<void>; 34 35 /** 36 * List all currently pinned items. 37 */ 38 listPins(): IPinItem[]; 39 40 /** 41 * Resolves a {@link IPinItem} to its original {@link IFileInfo}. 42 * @param item The item to resolve. 43 * @returns The resolved {@link IFileInfo} or undefined. 44 */ 45 resolvePin(item: IPinItem): IFileInfo | undefined; 46 47 /** 48 * A list of all currently pinned items. 49 */ 50 pins: Signal<IPinItem[]>; 51 }