pivotick - v2.0.1
    Preparing search index...

    Interface GraphHistory

    A bounded, session-scoped history of what the canvas holds and shows.

    It is one timeline with a line drawn through it: everything above the line has happened, everything below has been undone and can be redone. Undo walks the line down through a contiguous span, redo walks it back up, and any new action strands whatever was below it. Nothing here reverses a single old entry on its own — that is graph.removeBySource, which is a forward operation and says so.

    Reached as Graph.history.

    interface GraphHistory {
        canRedo(): boolean;
        canUndo(): boolean;
        clear(): void;
        entries(): HistoryEntry[];
        on(listener: (history: GraphHistory) => void): () => void;
        preview(
            throughEntryId: string,
            direction?: "undo" | "redo",
        ): HistoryPreview;
        redo(throughEntryId?: string): HistoryEntry[];
        redoable(): HistoryEntry[];
        undo(throughEntryId?: string): HistoryEntry[];
    }

    Implements

    Index

    Methods

    • Returns boolean

    • Returns boolean

    • Forget everything. The canvas is left exactly as it is.

      Returns void

    • Subscribe to every change to the history — a new entry, a span travelled, a clear.

      Parameters

      Returns () => void

    • What that span would do, played against a copy of the graph rather than summed from the entries — so a hide cancelled by a later unhide nets to zero, and a node a second run also vouches for is not counted as leaving.

      Parameters

      • throughEntryId: string
      • direction: "undo" | "redo" = 'undo'

      Returns HistoryPreview

    • Re-land the span from the line back through throughEntryId — the nearest undone entry by default. Exactly as it was: no provider call, no re-gating, no second trip through a hook.

      Parameters

      • OptionalthroughEntryId: string

      Returns HistoryEntry[]

      what was actually re-applied, newest first.

    • Undo the span from the newest entry through throughEntryId — the newest entry alone by default. A sealed entry inside the span is passed over rather than walled off: the entries around it are named element by element, so skipping one cannot put the rest out of order.

      The whole span lands as one dataBatchChanged, and one re-render.

      Parameters

      • OptionalthroughEntryId: string

      Returns HistoryEntry[]

      what was actually reversed, newest first.