import { StreamModel } from '../../stream-text/src/model'; import { StreamInline } from '../../stream-text/src/types'; import { StreamPart } from './types'; type TextPart = Extract; interface PlanBase { /** Position path plus type: a part keeps its element while it keeps its place and type. */ key: string; /** Index of its first unit on the element's clock. */ start: number; units: number; } export type PlanNode = PlanBase & { kind: 'text'; part: TextPart; model: StreamModel; full: StreamInline[]; } | PlanBase & { kind: 'code'; part: Extract; ends: number[]; } | PlanBase & { kind: 'markdown'; part: Extract; ends: number[]; } | PlanBase & { kind: 'atom'; part: Extract; } | PlanBase & { kind: 'list'; part: Extract; items: PlanItem[]; } | PlanBase & { kind: 'quote'; part: Extract; children: PlanNode[]; }; export interface PlanItem extends PlanBase { checked?: boolean; children: PlanNode[]; } /** Text models by content, so an unchanged part keeps its model and its content's identity across parses. */ export type PlanCache = Map; export interface StreamPlan { nodes: PlanNode[]; /** Units on the clock, all parts together. */ total: number; cache: PlanCache; } /** Where each line of `raw` ends: a delegated block reveals line by line. */ export declare function lineEnds(raw: string): number[]; /** * Lays the parts out on one clock, in document order: text by words (the same * units `TxStreamText` releases), code by words (`TxCodeStream`'s), delegated * Markdown by lines, and a rule or a custom part as one unit each. */ export declare function planParts(parts: readonly StreamPart[], locale?: string, previous?: PlanCache): StreamPlan; export {};