import type { TextFontFaceRequest, TextResizeMode } from './richText.js'; export interface TextLayoutAddress { readonly sourceNodeId: string; readonly instancePath: readonly string[]; readonly rowPath: readonly { readonly repeatId: string; readonly key: string | number; }[]; } export interface TextLayoutRect { readonly x: number; readonly y: number; readonly width: number; readonly height: number; } /** Captured effective input, not a replacement canonical node or a saved document sidecar. */ export interface TextLayoutPlan { readonly documentId: string; readonly sourceRevision: string; readonly revisionKey: string; readonly address: TextLayoutAddress; readonly authoredBounds: TextLayoutRect; readonly mode: TextResizeMode; readonly text: string; readonly font: Omit; readonly fontSize: number; readonly lineHeight: number; readonly align: 'start' | 'center' | 'end'; } export interface TextLayoutFace { readonly environmentId: string; readonly faceId: string; readonly family: string; readonly weight: number; readonly style: 'normal' | 'italic'; readonly sample: string; } export interface TextLayoutRange { /** UTF-16 offsets into the complete plain string; boundaries follow native grapheme segmentation. */ readonly start: number; readonly end: number; readonly line: number; readonly rects: readonly TextLayoutRect[]; } export interface TextLayoutLine { readonly paragraph: number; readonly start: number; readonly end: number; readonly box: TextLayoutRect; readonly baseline: number; readonly fragments: readonly TextLayoutRect[]; } export interface TextLayoutGeometry { /** Native advance/line extents, not glyph ink bounds or ancestor-clipped output extents. */ readonly effectiveBounds: TextLayoutRect; readonly contentBounds: TextLayoutRect; readonly lines: readonly TextLayoutLine[]; readonly ranges: readonly TextLayoutRange[]; } /** All geometry is local CSS pixels. Apply the existing scene transform and ancestor clip at consumption. */ export interface TextLayoutSnapshot extends TextLayoutGeometry { readonly inputKey: string; readonly plan: TextLayoutPlan; readonly environmentId: string; readonly faces: readonly TextLayoutFace[]; } export declare const TEXT_LAYOUT_MAX_UNITS = 32768; export declare const TEXT_LAYOUT_MAX_RANGES = 8192; export declare const TEXT_LAYOUT_MAX_LINES = 2048; /** This initial LTR contract conservatively excludes bidi controls and RTL script blocks. */ export declare const textLayoutNeedsBidi: (text: string) => boolean; /** Only immutable data is accepted; DOM objects and mutable resolver state never enter a snapshot. */ export declare function freezeTextLayout(value: T): T; export declare function captureTextLayoutPlan(value: TextLayoutPlan): TextLayoutPlan; export declare const textLayoutInputKey: (plan: TextLayoutPlan) => string; /** Empty paragraphs explicitly prepare the same face's space metric for their native strut. */ export declare function textLayoutFontRequests(plan: TextLayoutPlan): readonly TextFontFaceRequest[];