import { Descendant } from 'slate'; import type { TokenMatchMetadata, RichTextTokenMetadata } from '../types'; /** Regex that matches $namespace:token_name|filter$ patterns. */ export declare const TOKEN_PATTERN: RegExp; /** Matches an escaped dollar (`$$`, literal `$`) OR a `$token$` pattern. `$$` is tried first so it's * never mis-read as a token boundary. Group 1 is the raw content (undefined for `$$`), reused as the * `nameToValue` key so it round-trips without re-parsing. */ export declare const TOKEN_OR_ESCAPE_PATTERN: RegExp; /** Build a name -> value map and raw content from TokenMatchMetadata. `start`/`end` are RAW offsets * but we hold the RESOLVED string, so we walk both cursors in parallel, advancing the resolved cursor * by each value's length (or pattern length when unresolved). */ export declare function normalizeTokenMetadata(metadata: TokenMatchMetadata[] | null | undefined, resolvedContent: string): { nameToValue: Map; rawContent: string; reconciled: boolean; }; /** Does `resolvedContent` match `rawContent`'s literal structure (each $token$ = wildcard)? True means * only a token VALUE lagged (keep frozen raw); false means literal text changed (raw is stale). Linear * glob walk, not a compiled regex, since adjacent tokens give catastrophic-backtracking `[\s\S]*[\s\S]*`. */ export declare function isValueOnlyChange(rawContent: string, resolvedContent: string): boolean; /** Mark each `$name$` with `tokenName` and each `$$` with `isEscapedDollar`. With `nameToValue` * (preview) nodes display resolved values, escaped dollars show `$`; without it, raw `$name$`/`$$`. * `slateToHtml` re-derives the patterns from marks, so display text is never reversed by lookup. */ export declare function wrapRawTokensInTree(nodes: Descendant[], nameToValue?: Map): Descendant[]; export interface TokenMapResult { /** Map of token NAME -> resolved value (1:1, unambiguous). */ nameToValue: Map; /** The raw richTextContent (with $token$ patterns), derived from token metadata. */ rawContent: string | null; } /** * Derive the name -> value map and raw content from framework token metadata * (injected via `tokenMetadataProp`). Memoized on the metadata + resolved content. */ export declare function useTokenMap(resolvedContent: string, richTextTokenMetadata?: RichTextTokenMetadata | null): TokenMapResult; //# sourceMappingURL=useTokenMap.d.ts.map