import { type DataBaseNode, type BlockyDocument } from "./tree"; import { Subject } from "rxjs"; import { type FinalizedChangeset, type ChangesetApplyOptions, type ChangesetStateLogger } from "./change"; import { NodeLocation } from "./location"; import { VersionHistory } from "./versionHistory"; import { type CursorState } from "./cursor"; export declare enum CursorStateUpdateReason { beforeChangeset = "beforeChangeset", /** * The user changed the cursor manually through the changeset */ changeset = "changeset", /** * handled by the browser, when the "input" event is trigger. */ contentChanged = "contentChanged", /** * UI Event */ uiEvent = "uiEvent" } export interface CursorStateUpdateEvent { prevState: CursorState | null; state: CursorState | null; reason: CursorStateUpdateReason; } export declare class State implements ChangesetStateLogger { #private; readonly userId: string; readonly document: BlockyDocument; readonly beforeChangesetApply: Subject; get changesetApplied(): Subject; /** * Important jobs need to put in the first stage * - Update the editor * - Data sync */ readonly changesetApplied$: Subject; /** * Secondary jobs: * - Update toolbar * - Plugins */ readonly changesetApplied2$: Subject; readonly versionHistory: VersionHistory; readonly cursorStateChanged: Subject; constructor(userId: string, document: BlockyDocument, initVersion?: number); get cursorState(): CursorState | null; get appliedVersion(): number; __setCursorState(cursorState: CursorState | null, reason: CursorStateUpdateReason): void; getLocationOfNode(node: DataBaseNode, acc?: (number | string)[]): NodeLocation; apply(changeset: FinalizedChangeset): boolean; rebase(changeset: FinalizedChangeset, options?: Partial): FinalizedChangeset; findNodeByLocation(location: NodeLocation): DataBaseNode; }