import { DataStorage } from '../utility/dataStorage'; import { ProjectSource } from './api'; export interface EditorHistoryConfig { storage: DataStorage; } export interface ProjectHistoryConfig { id: string; storage: DataStorage; } /** * Track historical events in the editor. * * Uses a project identifier to store the history in the storage. * * Example identifiers: `local`, `gh/blinkk/project`. * * Usage: * * ``` * const editorHistory = new EditorHistory({ * storage: storage, * }); * const projectHistory = editorHistory.getProject('local'); * projectHistory.recentWorkspaces; * ``` * * The history is also used to store history of the general access * of projects. * * ``` * const recentProjects = editorHistory.recentProjects; * ``` */ export declare class EditorHistory { config: EditorHistoryConfig; constructor(config: EditorHistoryConfig); /** * Adds a project data to the history of recent projects. * * @param project Project information to add to the history. * @returns Updated recent project history. */ addRecentProject(project: RecentProjectData): Array; /** * Retrieve the project specific history data. */ getProject(projectId: string): ProjectHistory; /** * Retrieve the recent projects. */ get recentProjects(): Array; } export declare class ProjectHistory { config: ProjectHistoryConfig; data: ProjectHistoryData; constructor(config: ProjectHistoryConfig); /** * Adds file data to the history of the project. * * @param workspace Workspace name the file belongs to. * @param file File information to add to the history. * @returns Updated recent file history. */ addRecentFile(workspace: string, file: RecentFileData): Array; /** * Adds workspace to the history of the project. * * @param workspace Workspace information to add to the history. * @returns Updated recent file history. */ addRecentWorkspace(workspace: RecentWorkspaceData): Array; getRecentFiles(workspace: string): Array; getRecentWorkspaces(): Array; save(): void; } export interface ProjectHistoryData { recentFiles?: Record>; recentWorkspaces?: Array; } export interface RecentProjectData { /** * Project identifier. * * ex: `local`, `blinkk/project` */ identifier: string; /** * Source of the project. */ source?: ProjectSource | string; /** * Label for displaying the project to the user. */ label: string; /** * Avatar url for the project. */ avatarUrl?: string; /** * Timestamp of last date visited */ lastVisited: string; } export interface RecentFileData { /** * Path for the file. */ path: string; /** * Timestamp of last date visited */ lastVisited: string; } export interface RecentWorkspaceData { /** * Name of the workspace. */ name: string; /** * Timestamp of last date visited */ lastVisited: string; }