/** * Turn a public target address back into the model node it names. Headings are * matched by their containment path (see {@link headingPath}) — the ancestor * heading texts from the top level down, ignoring source depth — so a skipped * level needs no annotation. A duplicate sibling heading no longer collides * with an earlier one: {@link headingPath} disambiguates each occurrence past * the first, so every heading-bearing section has its own unique address and * `.find()` below matches at most one. The `ifMatch` precondition still guards * against staleness between reading a target and applying an edit. */ import { BlockNode, BodyChild, DocumentModel, FrontmatterEntry, SectionNode } from "./model.js"; import { HeadingAddress, TargetType } from "./instructions.js"; export type ResolvedTarget = { kind: "heading"; section: SectionNode; } | { kind: "headingChild"; section: SectionNode; child: BodyChild; index: number; } | { kind: "block"; block: BlockNode; } | { kind: "frontmatter"; entry: FrontmatterEntry; }; /** Resolve a heading address to its section (root for `null`/`[]`), or `null`. */ export declare const resolveHeading: (model: DocumentModel, address: HeadingAddress) => { kind: "heading"; section: SectionNode; } | null; /** * Resolve a block address to its block node, or `null`. Mirrors * resolveHeading: a duplicate id's later occurrence is disambiguated (see * {@link disambiguatedBlockId}), so recomputing every block's address and * matching by plain string equality resolves at most one candidate. */ export declare const resolveBlock: (model: DocumentModel, id: string) => { kind: "block"; block: BlockNode; } | null; /** Resolve a frontmatter key to its entry, or `null`. */ export declare const resolveFrontmatter: (model: DocumentModel, key: string) => { kind: "frontmatter"; entry: FrontmatterEntry; } | null; /** * Refine a resolved section to one of its direct body's top-level blocks by * position (negative counts from the end). Out-of-range throws * {@link TargetNotFoundError} — the address names a block that does not exist, * distinct from the `null` a missing *heading* returns so that * `createTargetIfMissing` heading semantics stay untouched. */ export declare const resolveWithin: (section: SectionNode, within: number) => Extract; /** The addressing subset of an instruction the resolver needs. */ export type Addressed = { targetType: "heading"; target: HeadingAddress; within?: number; } | { targetType: "block"; target: string; } | { targetType: "frontmatter"; target: string; }; /** Dispatch to the target-type-specific resolver. */ export declare const resolveTarget: (model: DocumentModel, instruction: Addressed) => ResolvedTarget | null; /** The target types the resolver understands (kept in sync with the union). */ export declare const RESOLVABLE_TARGET_TYPES: readonly TargetType[]; //# sourceMappingURL=resolve.d.ts.map