/** The character classes galjp converts. */ type LayerId = 'latin' | 'digit' | 'hiragana' | 'katakana' | 'kanji' | 'symbol'; declare const LAYER_IDS: readonly LayerId[]; /** * How aggressively a kanji may be taken apart. * * - `horizontal` — left/right splits only. Closest to galjp v4. * - `balanced` — also splits top/bottom when every piece stays readable. * - `aggressive` — also unwraps enclosures (国 → 囗玉). */ type SplitPolicy = 'horizontal' | 'balanced' | 'aggressive'; /** Which route produced a conversion. Surfaced by {@link Converter.explain}. */ type KanjiRoute = 'override' | 'homoglyph' | 'variant' | 'decompose' | 'style' | 'none'; interface GaljpOptions { /** Enable/disable individual layers. Every layer is on by default. */ layers?: Partial>; /** Replace a kanji with its traditional/variant form (学 → 學). Default true. */ variant?: boolean; /** How far a kanji may be split apart. Default `'balanced'`. */ splitPolicy?: SplitPolicy; /** Style single-component kanji that cannot be split (口 → ロ). Default true. */ styleStandalone?: boolean; /** Maximum recursion depth when decomposing. Default 2. */ maxDepth?: number; /** Seed for candidate selection. Without one, the first candidate always wins. */ seed?: number | string; /** * Text to leave untouched. Defaults to URLs and emoji. * Pass `false` to convert everything. */ preserve?: RegExp | readonly RegExp[] | ((text: string) => boolean) | false; /** Literal (never regex) replacements applied before any layer. */ dictionary?: Readonly>; } type ResolvedOptions = Required> & { layers: Record; preserve: readonly RegExp[] | ((text: string) => boolean) | false; }; interface Explanation { route: KanjiRoute; result: string; /** Intermediate forms, e.g. `['沢', '澤', 'シ睪']`. */ steps: readonly string[]; } interface Converter { convert(input: string): string; /** Every rendering this converter could produce for a single character. */ candidates(char: string): readonly string[]; /** How a single character is converted, and by which route. */ explain(char: string): Explanation; readonly options: Readonly; } declare function resolveOptions(options?: GaljpOptions): ResolvedOptions; declare function createConverter(options?: GaljpOptions): Converter; declare function galjp(input: string, options?: GaljpOptions): string; /** * Build metadata. * * GENERATED FILE — do not edit. Rebuild with: npm run data:build * * See structure.ts / legible.ts for data attribution. */ declare const DATA_META: { readonly structureEntries: 5129; readonly legibleEntries: 1177; readonly variantEntries: 81; readonly hash: "248ce2764477ecec"; }; interface CoverageReport { total: number; converted: number; ratio: number; byRoute: Record; } /** * How much of a character set this configuration can actually convert. * * Used by the CI gate in docs/DESIGN.md §7.3 and by scripts/coverage.ts. */ declare function measureCoverage(chars: Iterable, options?: GaljpOptions): CoverageReport; export { type Converter, type CoverageReport, DATA_META, type Explanation, type GaljpOptions, type KanjiRoute, LAYER_IDS, type LayerId, type ResolvedOptions, type SplitPolicy, createConverter, galjp, measureCoverage, resolveOptions };