/** Environment-neutral configuration and bridge contracts for DOM-synchronized MSDF text. * @module three-blocks/text */ export declare const TEXT_SCHEMA_VERSION: 1; export interface BuiltinTextFontSource { readonly builtin: string; } export interface ProjectTextFontSource { readonly path: string; } export interface PackageTextFontSource { readonly package: string; readonly file: string; readonly checksum: string; } export type TextFontSource = BuiltinTextFontSource | ProjectTextFontSource | PackageTextFontSource; export interface TextFontWeightVariant { /** Generated RGBA8 KTX2 MSDF atlas instanced at this weight. */ readonly atlas: string; /** Generated glyph, metric, and kerning metadata instanced at this weight. */ readonly metrics: string; } export interface TextFontRoute { /** Authoring font input. It is hashed by tooling and is not deployed automatically. */ readonly source: TextFontSource; /** Browser font used by DOM layout. */ readonly browser: string; /** Generated RGBA8 KTX2 MSDF atlas. Represents weight 400 unless `weights` overrides it. */ readonly atlas: string; /** Generated glyph, metric, and kerning metadata. */ readonly metrics: string; /** Atlas instances baked at other weights (`msdf-atlas --wght`); keys are CSS weight numbers. */ readonly weights?: Readonly>; readonly families: readonly string[]; readonly languages?: readonly string[]; readonly default?: boolean; } export type TextUnicodePreset = 'latin' | 'japanese-kana'; export interface TextUnicodeRange { readonly start: number; readonly end: number; } export interface TextGenerationOptions { readonly presets?: readonly TextUnicodePreset[]; readonly ranges?: readonly TextUnicodeRange[]; readonly additionalCharacters?: string; readonly size?: number; readonly distanceRange?: number; readonly padding?: number; readonly maxTextureSize?: number; } export interface TextConfiguration> = Readonly>> { readonly schemaVersion?: typeof TEXT_SCHEMA_VERSION; /** Semantic HTML and typed content modules inspected by text tooling. */ readonly content: readonly string[]; readonly fonts: TFonts; readonly generation?: TextGenerationOptions; } export type TextContentValue = string | readonly TextContentValue[] | { readonly [key: string]: TextContentValue; }; /** Preserve literal font keys while validating the public generation/runtime contract. */ export declare function defineText>>(configuration: TextConfiguration): TextConfiguration & { readonly schemaVersion: typeof TEXT_SCHEMA_VERSION; }; /** Marker understood by semantic glyph extraction; source files are not scanned indiscriminately. */ export declare function defineTextContent(content: TContent): TContent; export interface TextCanvasRect { readonly width: number; readonly height: number; } export interface TextElementRect extends TextCanvasRect { readonly x: number; readonly y: number; } export interface TextLineBox { readonly text: string; readonly x: number; readonly top: number; readonly bottom: number; readonly width: number; } export interface TextComputedStyle { readonly fontSize: number; readonly letterSpacing: number; readonly fontWeight: number; readonly fontFamily: string; readonly textAlign: string; readonly textTransform: string; readonly color: number; readonly opacity: number; readonly fontKey: string | null; readonly language: string; } export interface TextCreateUpdate { readonly id: string; readonly type: 'create' | 'update'; readonly styles: TextComputedStyle; readonly rect: TextElementRect; readonly lines: readonly TextLineBox[]; readonly zIndex: number; readonly visible: boolean; } export interface TextRectUpdate { readonly id: string; readonly type: 'rect'; readonly rect: TextElementRect; } export interface TextVisibilityUpdate { readonly id: string; readonly type: 'visibility'; readonly visible: boolean; } export interface TextRemoveUpdate { readonly id: string; readonly type: 'remove'; } export type TextElementUpdate = TextCreateUpdate | TextRectUpdate | TextVisibilityUpdate | TextRemoveUpdate; export interface TextSyncBatch { readonly schemaVersion: typeof TEXT_SCHEMA_VERSION; readonly sequence: number; readonly updates: readonly TextElementUpdate[]; readonly canvasRect: TextCanvasRect; } export interface TextSyncDelivery { /** Incremental frame batches preserve rect-only scrolling; snapshots replace worker state. */ readonly kind: 'batch' | 'snapshot'; readonly batch: TextSyncBatch; } /** Latest complete snapshot is replayed after worker restart; incremental batches stay ordered events. */ export interface TextBridgeState { readonly textSnapshot: TextSyncBatch; } export interface TextBridgeEvents { readonly textBatch: TextSyncBatch; } export interface TextReadyState { readonly ready: true; readonly fonts: readonly string[]; readonly batches: number; readonly missingGlyphs: readonly number[]; } export interface TextErrorState { readonly ready: false; readonly message: string; readonly missingGlyphs: readonly number[]; } export type TextFallbackStatus = 'loading' | 'ready' | 'fallback' | 'error'; /** Worker-to-main signal controlling accessible DOM fallback for affected elements. */ export interface TextFallbackSignal { readonly status: TextFallbackStatus; /** Empty means every synchronized element. */ readonly elementIds: readonly string[]; readonly diagnostic?: MissingGlyphDiagnostic; } export interface MissingGlyphDiagnostic { readonly code: 'missing-glyphs'; readonly font: string; readonly codePoints: readonly number[]; readonly command: string; } export declare function isTextSyncBatch(value: unknown): value is TextSyncBatch; export declare function isTextSyncDelivery(value: unknown): value is TextSyncDelivery; export declare function assertTextSyncBatch(value: unknown): asserts value is TextSyncBatch; export declare function assertTextSyncDelivery(value: unknown): asserts value is TextSyncDelivery;