import { Editor } from '../../core/Editor.js'; import { StoryLocator, TrackChangeOverlapInfo, TrackChangeWordRevisionIds, TrackedChangeAddress } from '../../../../../../document-api/src/index.js'; import { InternalTrackChangeSubtype, InternalTrackChangeType } from './tracked-change-type-utils.js'; import { TrackedChangeRuntimeRef } from './tracked-change-runtime-ref.js'; export type GroupedTrackedChange = { rawId: string; commandRawId?: string; id: string; from: number; to: number; hasInsert: boolean; hasDelete: boolean; hasFormat: boolean; attrs: Record; excerpt?: string; wordRevisionIds?: TrackChangeWordRevisionIds; overlap?: TrackChangeOverlapInfo; /** Set for whole-object structural revisions (e.g. whole-table insert/delete). */ structural?: { side: 'insertion' | 'deletion'; subtype: InternalTrackChangeSubtype; }; }; export type TrackedChangeNavigationSelection = { from: number; to: number; }; export type TrackedChangeProjectedSide = 'inserted' | 'deleted'; type ChangeTypeInput = Pick; export declare function resolveTrackedChangeType(change: ChangeTypeInput): InternalTrackChangeType; export declare function getTrackedChangeMarkAlias(mark: { readonly type: { readonly name: string; }; readonly attrs?: Readonly>; }): string | null; /** * Resolve a tracked-change navigation target to a text-backed PM selection. * * Generic comment/thread cursor placement can land on an unstable outer wrapper, * which may jump outside the text-backed change. Track-change navigation can do * better because the resolver owns the raw mark ranges: * - multi-character text changes use a collapsed caret inside the first text * node rather than at the tracked-change boundary; * - one-character changes use the marked range itself, since there is no stable * interior collapsed caret; * - structural revisions return `null` so callers can use rendered-element * fallback. */ export declare function resolveTrackedChangeNavigationSelection(editor: Editor, id: string): TrackedChangeNavigationSelection | null; export declare function groupTrackedChanges(editor: Editor): GroupedTrackedChange[]; export declare function resolveTrackedChange(editor: Editor, id: string): GroupedTrackedChange | null; export declare function toCanonicalTrackedChangeId(editor: Editor, rawId: string): string | null; export declare function buildTrackedChangeCanonicalIdMap(editor: Editor): Map; export declare function splitProjectedTrackedChangeId(value: string): { baseId: string; side: TrackedChangeProjectedSide | null; }; /** * Resolves a tracked-change identity across stories. * * Accepts either: * - A bare canonical id string (body back-compat), OR * - A public {@link TrackedChangeAddress} (with optional `story`). * * Returns the grouped change AND the story editor that owns it, so callers * can apply mutations (accept/reject) against the correct runtime without * re-resolving. */ export interface ResolvedStoryTrackedChange { /** The owning story editor (body host editor OR a story runtime editor). */ editor: Editor; /** Public story locator. */ story: StoryLocator; /** Internal runtime ref. */ runtimeRef: TrackedChangeRuntimeRef; /** The grouped change in the owning editor. */ change: GroupedTrackedChange; /** Optional commit callback — present for non-body runtimes. */ commit?: (hostEditor: Editor) => void; } type TrackedChangeLookupInput = string | TrackedChangeAddress; /** * Resolves a tracked-change id/address to the owning story editor and the * grouped change within it. * * For body addresses (no `story` field) this is an O(n) search against the * host editor's grouped marks — same as the legacy body-only resolver. * * For non-body addresses it resolves the correct story runtime, then performs * the lookup within that editor's state. * * Returns `null` if the address resolves to no matching tracked change. */ export declare function resolveTrackedChangeInStory(hostEditor: Editor, input: TrackedChangeLookupInput): ResolvedStoryTrackedChange | null; export {}; //# sourceMappingURL=tracked-change-resolver.d.ts.map