import type { PostextConfig } from '../types.js'; /** * A book's configuration in layers (#1209): the general settings every * edition reads, and per language an override that changes only the fields * it names. The override is merged over the general settings field by * field: * * - objects merge key by key, down to the leaves; * - a colour (`hex`) or a length (`value` + `unit`) is one value, replaced * whole; * - a list whose entries carry an `id` (`calloutStyles`, `headingStyles`, * `colorPalette`, `resourceTypes`, a template's frames…) merges entry by * entry on the `id`; a `levels` list (headings, lists, the contents) * merges on `level`, `customFonts` on `name`. An entry the general list * lacks is added after its entries; `{ id, $remove: true }` takes one * out for this language (a list reordered in one language takes every * general entry out, then lists its own); * - any other list (a fallback face stack, tab stops) is replaced whole; * - `null` takes a general value out: the field reads the language's * default, as if neither layer set it. */ export type ConfigOverride = { [key: string]: unknown; }; /** The marker an override list entry carries to take the general list's * entry with the same key out. */ export declare const REMOVE_ENTRY = "$remove"; /** The configuration an edition lays out with: `override` over * `general`, field by field (see {@link ConfigOverride}). Neither input * is mutated; with no override, `general` itself. */ export declare function mergeConfigLayers(general: PostextConfig, override: ConfigOverride | undefined | null): PostextConfig; /** The override that turns `general` into `own`: the fields `own` sets * differently, `null` for the ones it leaves out, so that * `mergeConfigLayers(general, diffConfigLayers(general, own))` is `own` * (as JSON, key order aside). Empty when the two agree. */ export declare function diffConfigLayers(general: PostextConfig, own: PostextConfig): ConfigOverride; /** Whether the two configurations say the same, key order aside. */ export declare function sameConfig(a: unknown, b: unknown): boolean; /** The settings two or more editions agree on: the fields every one of * `configs` sets to the same value, objects compared field by field and * keyed lists entry by entry (an entry they all have, with the fields * they agree on). What a book whose editions each kept a whole * configuration shares, as its general settings. */ export declare function commonConfig(configs: readonly PostextConfig[]): PostextConfig; /** Where `override` sets something: each leaf as a dotted path, list * entries named by their key (`calloutStyles[id=note].background`, * `headings.levels[level=2].fontSize`); a `null` (back to the default) * and a removed entry are leaves too. */ export declare function overridePaths(override: ConfigOverride | undefined | null): string[]; /** The override that turns `general` into `own` with nothing a reader * would not miss: a `null` (or a removed list entry) that `normalize` * makes no difference for — the general value is the default of `own`'s * language too, which normalizing `own` (stripping its defaults) took * out — is left out. `own` is taken as `normalize` gives it. */ export declare function leastConfigOverride(general: PostextConfig, own: PostextConfig, normalize: (c: PostextConfig) => PostextConfig): ConfigOverride; //# sourceMappingURL=configLayers.d.ts.map