import { Range } from '../rga/Range'; import { ChunkSlice } from '../util/ChunkSlice'; import { Cursor } from '../editor/Cursor'; import type { Point } from '../rga/Point'; import type { OverlayPoint } from '../overlay/OverlayPoint'; import type { Printable } from 'tree-dump/lib/types'; import type { Peritext } from '../Peritext'; import type { PeritextMlNode } from './types'; import type { Slice } from '../slice/Slice'; export declare abstract class AbstractInlineAttr { slice: Slice; constructor(slice: Slice); /** @returns Whether the attribute starts at the start of the inline. */ isStart(): boolean; /** @returns Whether the attribute ends at the end of the inline. */ isEnd(): boolean; /** @returns Whether the attribute is collapsed to a point. */ isCollapsed(): boolean; } /** The attribute started before this inline and ends after this inline. */ export declare class InlineAttrPassing extends AbstractInlineAttr { } /** The attribute starts at the beginning of this inline. */ export declare class InlineAttrStart extends AbstractInlineAttr { isStart(): boolean; } /** The attribute ends at the end of this inline. */ export declare class InlineAttrEnd extends AbstractInlineAttr { isEnd(): boolean; } /** The attribute starts and ends in this inline, exactly contains it. */ export declare class InlineAttrContained extends AbstractInlineAttr { isStart(): boolean; isEnd(): boolean; } /** The attribute is collapsed at start of this inline. */ export declare class InlineAttrStartPoint extends AbstractInlineAttr { isStart(): boolean; isCollapsed(): boolean; } /** The attribute is collapsed at end of this inline. */ export declare class InlineAttrEndPoint extends AbstractInlineAttr { isEnd(): boolean; isCollapsed(): boolean; } export type InlineAttr = InlineAttrPassing | InlineAttrStart | InlineAttrEnd | InlineAttrContained | InlineAttrStartPoint | InlineAttrEndPoint; export type InlineAttrStack = InlineAttr[]; export type InlineAttrs = Record>; /** * The `Inline` class represents a range of inline text within a block, which * has the same annotations and formatting for all of its text contents, i.e. * its text contents can be rendered as a single (``) element. However, * the text contents might still be composed of multiple {@link ChunkSlice}s, * which are the smallest units of text and need to be concatenated to get the * full text content of the inline. */ export declare class Inline extends Range implements Printable { readonly txt: Peritext; readonly p1: OverlayPoint; readonly p2: OverlayPoint; constructor(txt: Peritext, p1: OverlayPoint, p2: OverlayPoint, start: Point, end: Point); /** * @returns A stable unique identifier of this *inline* within a list of other * inlines of the parent block. Can be used for UI libraries to track the * identity of the inline across renders. */ key(): number; /** * @returns The position of the inline within the text. */ pos(): number; protected createAttr(slice: Slice): InlineAttr; private _attr; /** * @returns Returns the attributes of the inline, which are the slice * annotations and formatting applied to the inline. * * @todo Rename to `.stat()`. * @todo Create a more efficient way to compute inline stats, separate: (1) * boolean flags, (2) cursor, (3) other attributes. */ attr(): InlineAttrs; hasCursor(): boolean; /** @todo Make this return a list of cursors. */ cursorStart(): Cursor | undefined; cursorEnd(): Cursor | undefined; /** * Returns a 2-tuple if this inline is part of a selection. The 2-tuple sides * specify how selection ends on each side. Empty string means the selection * continues past that edge, `focus` and `anchor` specify that the edge * is either a focus caret or an anchor, respectively. * * @returns Selection state of this inline. */ selection(): undefined | [left: 'anchor' | 'focus' | '', right: 'anchor' | 'focus' | '']; texts(limit?: number): ChunkSlice[]; toJson(): PeritextMlNode; toStringName(): string; toString(tab?: string): string; }