/** * Where a reference in a block document sits, and so how it draws — SPEC §13.3, * "A reference's card" (C22, C24): its chip in a sentence, its row alone on its * line, and its card in the row's place when its writer chose one. * * The rule is the protocol's (`documentLineDrawOf` in `@estiva-app/protocol`), * read here off the editor's own tree so it can be asked on every keystroke * without writing the document out. `linkPlaces.test.ts` runs the same * documents through both and holds them to one answer. * * - **Alone on its line**: a top-level paragraph, or a list item's, whose line * (up to a hard break) holds this reference and nothing but spaces besides. * A heading, a quote, a callout and a table cell are sentences, and so is * anything inside a block this rule does not name. * - **A marker around it** (bold, italic, code…) makes it a sentence. * - **A person or a Folder** alone on its line stays a chip. * - **Its card** is `embed` `detailed`; anything else (none, `compact`, a value * this version does not know) draws the row. * * `LinkPlaces` puts each reference's place on a node decoration, which * `ReferenceNode`'s view reads and hands to the app's view as `place`. * * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-lone-links-chip-menu-offers-row-or-card.md */ import { Extension } from '@tiptap/core'; import type { Node as PmNode } from '@tiptap/pm/model'; import { Decoration } from '@tiptap/pm/view'; /** How a reference draws: its chip, its row, or its card in the row's place. */ export type LinkPlace = 'chip' | 'row' | 'card'; /** * Whether what `uri` names stays a chip alone on its line: a person (`npub`, * `nprofile`) or a Folder (an `naddr` of kind 39000). */ export declare function staysChip(uri: string): boolean; /** How the reference node at `pos` draws. Anything that is not a reference with a `uri` draws as a chip. */ export declare function linkPlaceAt(doc: PmNode, pos: number): LinkPlace; /** Every reference that does not draw as its chip, with its place. */ export declare function linkPlaces(doc: PmNode): { pos: number; size: number; place: Exclude; }[]; /** The place a node view's decorations give it; `chip` without one. */ export declare function placeOf(decorations: readonly Decoration[] | undefined): LinkPlace; /** * Marks each reference that draws as its row or its card, for `ReferenceNode`'s * view. Without it every reference is a chip, as in a message's box. */ export declare const LinkPlaces: Extension; //# sourceMappingURL=LinkPlaces.d.ts.map