import type { Dimension, ElementPlacement } from '../types.js'; import type { FrameConfig, FrameLook, FrameLookEntry, FrameSize, LabelStyle, ModuleWidth, PageTemplate, PageTemplateGrid, ResolvedFrame, ResolvedFrameFit, ResolvedFrameGroup, ResolvedLabelStyle, ResolvedPageTemplate, ResolvePageTemplateOptions } from './types.js'; export declare const DEFAULT_FRAME_FIT: Readonly; /** What a frame that sets nothing comes to (besides its name). */ export declare const DEFAULT_FRAME: { width: FrameSize; height: FrameSize; layer: number; rotate: number; verticalAlign: "top"; columns: number; exclude: "none"; flow: boolean; pin: boolean; grow: number; shrink: number; priority: number; optional: boolean; crossGutter: boolean; }; export declare const DEFAULT_FRAME_GROUP: { kind: "stack"; gap: Dimension; align: "start"; }; export declare const DEFAULT_PAGE_TEMPLATE: { area: "content"; spread: boolean; gutter: Dimension; role: string; }; /** The `role` of a module template (#1062, DESIGN §12.7). */ export declare const MODULE_ROLE = "module"; /** Whether a resolved template is a module (#1062): a page fence never lays * one (`moduleAsPage`). */ export declare function isModuleTemplate(template: Pick | undefined): boolean; export declare const DEFAULT_LABEL_STYLE: { fontStyle: "normal"; textTransform: "none"; minScale: number; }; export declare const FRAME_VERTICAL_ALIGNS: readonly ["top", "middle", "bottom", "justify"]; export declare const FRAME_EXCLUDES: readonly ["none", "push"]; export declare const FRAME_WRAPS: readonly ["box", "contour"]; export declare const FRAME_OVERLAPS: readonly ["check", "allow"]; export declare const FRAME_TAKES: readonly ["h1", "h2", "h3", "h4", "h5", "h6", "toc"]; export declare const FRAME_GROUP_KINDS: readonly ["stack", "row", "grid"]; export declare const FRAME_GRID_ROW_ALIGNS: readonly ["start", "center", "end", "stretch"]; export declare const FRAME_GROUP_ALIGNS: readonly ["start", "center", "end", "space-between"]; export declare const TEMPLATE_AREAS: readonly ["content", "trim", "bleed"]; export declare const FRAME_WRITING_MODES: readonly ["horizontal-tb", "vertical-rl"]; export declare const FRAME_DIRECTIONS: readonly ["ltr", "rtl"]; export declare const LABEL_FONT_STYLES: readonly ["normal", "italic"]; export declare const LABEL_TEXT_TRANSFORMS: readonly ["none", "uppercase"]; export declare const LABEL_OVERLAPS: readonly ["check", "allow"]; /** `LabelStyle.align` and `LabelStyle.kind` (#1058). */ export declare const LABEL_ALIGNS: readonly ["start", "center", "end"]; export declare const LABEL_KINDS: readonly ["legend"]; /** The shape of a frame's `look` (#976): which keys it has and what each * holds, a colour or a length. */ export declare const LOOK_TREE: { readonly background: "color"; readonly border: { readonly color: "color"; }; readonly stripe: { readonly color: "color"; }; readonly icon: { readonly color: "color"; }; readonly marker: { readonly color: "color"; readonly rule: { readonly color: "color"; }; }; readonly titleStyle: { readonly color: "color"; }; readonly body: { readonly color: "color"; readonly boldColor: "color"; readonly italicColor: "color"; readonly letterSpacing: "tracking"; }; readonly label: { readonly color: "color"; readonly background: "color"; readonly rule: { readonly color: "color"; }; }; }; /** A length the engine can use: a finite, non-negative value in a known * unit. */ export declare function isFrameDimension(v: unknown): v is Dimension; /** `v` as a frame size, or undefined when it is none. A percentage is * clamped to 0 … 100. */ export declare function normalizeFrameSize(v: unknown): FrameSize | undefined; /** The id an anchor names (`'#dinero'` → `'dinero'`), or undefined. */ export declare function anchorTarget(placement: ElementPlacement | undefined): string | undefined; /** The frame a `continueIn` of the form `'#frame'` names. */ export declare function continueInFrame(continueIn: unknown): string | undefined; /** The template a `continueIn` of the form `'template:'` names. */ export declare function continueInTemplate(continueIn: unknown): string | undefined; /** The later page fence `'page:'` names, and the frame of it * `'page:#'` names (#917): a story that jumps there. `` * may be `{attr.name}`, the fence's attribute (`resolveContinueIn`). */ export declare function continueInPage(continueIn: unknown): { page: string; frame?: string; } | undefined; /** `continueIn` with each `{attr.name}` read from the page fence's * attributes (#917): `'page:{attr.sigue}'` with `sigue="p47"` is * `'page:p47'`. An attribute the fence lacks reads as nothing. */ export declare function resolveContinueIn(continueIn: string, attrs: Readonly>): string; /** The chain of template indices from `index` up to its root, nearest * first; `null` when it loops back on itself. A parent that does not * exist ends the chain (the template stands alone). */ export declare function templateChain(templates: readonly PageTemplate[], index: number, byId?: Map): number[] | null; /** The index of the template `id` means: the first with that id. */ export declare function templateIndex(templates: readonly PageTemplate[] | undefined, id: string): number | undefined; /** A problem resolution met, with the JSON pointer of the field at fault. * `validatePageTemplates` reports them as config warnings. */ export interface TemplateIssue { kind: 'frameDuplicate' | 'frameStyleUnknown' | 'frameAnchorUnknown' | 'groupFrameUnknown' | 'groupFrameTwice' | 'frameChainLoop' | 'overflowTargetUnknown'; path: string; value: string; used: string; /** For a name that does not exist: the closest that does (filled by the * validator). */ known?: readonly string[]; } /** A module's `width` (#1088) the engine can use: a length, a percentage * above 0, or `'fill'`. */ export declare function moduleWidth(v: unknown): ModuleWidth | undefined; /** A module's `grow` or `shrink` (#1095) the engine can use: a finite * number, 0 or more. */ export declare function moduleFactor(v: unknown): number | undefined; /** A frame's `growWith` (#1117) the engine can use: `'children'`, or the * names of a list (a name that is no string, or empty, is left out; a * list with none is no list). */ export declare function growWithOf(v: unknown): { growWith?: 'children' | string[]; }; /** A frame as the layout reads it: every default filled in, sizes read * from `width`/`height` and else `placement.size`, values the engine * cannot use replaced by their default. */ export declare function normalizeFrame(frame: FrameConfig, grid?: Required, where?: { configPath: string; fieldPaths: Record; }): ResolvedFrame; /** The named looks of `frameLooks` (#1089) the engine can use: entries * with an id (the first of each id wins), each with what a frame's * `look` could not use left out (`normalizeLook`); an entry that keeps no * field still names a look (it changes nothing). None when the list * holds no entry with an id. */ export declare function normalizeFrameLooks(raw: unknown): FrameLookEntry[] | undefined; /** The look a frame wears with a named look laid over its own (#1089): * `over`'s fields (an entry's `id` and `name` left out) over `below`'s, * key by key at every level. */ export declare function lookOver(below: FrameLook | undefined, over: FrameLook): FrameLook; /** `name` read as an instance of a repeated frame (#1061): `card[2]` is * item 2 of frame `card`. Undefined for any other name. */ export declare function repeatInstance(name: string): { frame: string; item: number; } | undefined; /** The name of item `item`'s instance of frame `frame` (#1061). */ export declare function repeatInstanceName(frame: string, item: number): string; /** The frames a template's grids repeat (#1061), each with its grid. */ export declare function repeatedFrames(template: Pick): Map; /** What `resolvePageTemplate` reads of a configuration: the raw or the * resolved one alike. */ export interface PageTemplateSource { pageTemplates?: readonly PageTemplate[]; /** The callout style ids frames may name. Unset: not checked. */ calloutStyles?: readonly { id: string; }[]; } /** * Resolve the template at `index` of `templates` (see * {@link resolvePageTemplate}), with the issues met on the way. `prefix` * is the JSON pointer of the list (`/pageTemplates`). * @internal the validator's; hosts call `resolvePageTemplate`. */ export declare function resolveTemplateAt(templates: readonly PageTemplate[], index: number, options?: ResolvePageTemplateOptions & { calloutStyleIds?: ReadonlySet; prefix?: string; }): { template: ResolvedPageTemplate; issues: TemplateIssue[]; } | undefined; /** * The template `id` of `config.pageTemplates`, ready to lay out: its * `extends` chain merged (scalar fields replace, `grid` merges key by key, * frames and groups merge by `name` with `remove: true` dropping one, * decoration elements merge by `id`), then the variant of the page's side * (`options.parity`; none on a spread), then every default filled in and * every reference settled (see `validatePageTemplates` for what is fixed * and reported). Undefined when no template has that id, or its chain * loops. The first template with an id is the one it means. * * Memoised per `pageTemplates` array (the resolved configuration holds a * copy of its own): treat the result as read-only, and give a changed list * as a new array. */ export declare function resolvePageTemplate(config: PageTemplateSource | undefined, id: string, options?: ResolvePageTemplateOptions): ResolvedPageTemplate | undefined; /** The label styles with their defaults filled in. */ export declare function resolveLabelStyles(styles: readonly LabelStyle[] | undefined): ResolvedLabelStyle[]; /** * The page templates as stored. Every field is kept as written, a value * equal to its default included: in a template that `extends` another, or * in a variant, it overrides the parent's, so it is never a restated * default. Keys set to `undefined` are left out, and an empty list is no * list. */ export declare function stripPageTemplatesDefaults(templates: readonly PageTemplate[] | undefined): PageTemplate[] | undefined; /** The label styles without the values that restate a default (and `name` * equal to `id`); an empty list is no list. */ export declare function stripLabelStylesDefaults(styles: readonly LabelStyle[] | undefined): LabelStyle[] | undefined; //# sourceMappingURL=templates.d.ts.map