import type { ComposedPageFence, ContentBlock } from '../parse/types.js'; import type { ResolvedCalloutStyleConfig } from '../types.js'; import { type ContentWarning, type VDTBlock, type VDTComposedPage, type VDTPage } from '../vdt.js'; import { dimensionToPx } from '../units.js'; import { type FrameAreas, type Rect } from '../composed/geometry.js'; import { type ComposedContinuation, type ComposedContinuationInput } from '../composed/continuation.js'; import type { FrameLook, FrameLookEntry, ResolvedFrame, ResolvedPageTemplate } from '../composed/types.js'; import { type PageTemplateSource } from '../composed/templates.js'; import { type BoxExclusion, type PlannedCallout } from './calloutLayout.js'; import type { ImportedJumps } from '../composed/carry.js'; import { type FrameLayoutPass } from './frameLayout.js'; /** A story of the page: the box `composed/wrap.ts` made of a chain's * content, by the name of the chain's first frame. */ export interface ComposedStory { startIdx: number; plan: PlannedCallout; } export interface ComposedPageInput { pass: FrameLayoutPass; page: VDTPage; template: ResolvedPageTemplate; fence: ComposedPageFence; /** Content index of the page's opening and closing markers. */ startIdx: number; endIdx: number; /** The page's stories by head frame name. */ stories: ReadonlyMap; /** The style a frame is drawn with: its `style`, or frameless. */ styleOf(frame: ResolvedFrame): ResolvedCalloutStyleConfig; areas: FrameAreas; dpi: number; emPx: number; /** Source offset of the body in the chapter file. */ bodyOffset: number; /** The page swaps its mirrored margins (an `'outer'` corner icon). */ mirrored: boolean; /** The gap text keeps from a frame that pushes it. */ pushGapPx: number; /** The box a frame takes given the one its placement gives: on a spread * (#861, `composed/spread.ts`), off the spine band unless the frame * crosses the gutter. An `'auto'` height is measured at the width it * returns. */ fitBox?: (frame: ResolvedFrame, rect: Rect) => Rect; /** Shapes a frame's lines keep off, by frame name, in page (flow) * coordinates: a comic text panel's slanted edges (#909). */ frameExclusions?: ReadonlyMap; /** The document's locale (`config.locale`), named by `frameOverflow`. */ locale?: string; /** The book's other templates, resolved for this page's side, in * `pageTemplates` order: a `useTemplate` proposal (#858) lays the page * with each that has the overflowing frame's name. */ alternatives?: () => readonly ResolvedPageTemplate[]; /** A page added by continuation (#859): what its frames receive from * the page before it. */ continuing?: ComposedContinuationInput; } export interface ComposedPageLayout { composed: VDTComposedPage; /** Frame boxes and their content, in paint-independent page order (each * frame's box first): for `page.floats` and `doc.blocks`. */ blocks: VDTBlock[]; warnings: ContentWarning[]; /** Story heads laid in a frame of this page. A story left out (its frame * is missing on this side) is set in the flow after the page. */ laid: Set; /** The frames `fitBox` moved or narrowed in the layout kept (a spread's * gutter, #861): the box placed and the box it took. Only the * composition the reflow ladder (#858) settles on counts, not the ones * it tried. Not kept by the page memo (spreads are laid afresh). */ fitted?: Map; /** Content the page's frames send on to other pages (#859), in template * order. */ continuations?: ComposedContinuation[]; } export declare function layoutComposedPage(asked: ComposedPageInput): ComposedPageLayout; /** * The pass the stories carried in from other chapters (#943) are laid with: * `base` with their blocks appended to its content, and every lookup the * box typesetter keys by content index answered for them from what the * sender gave (heading numbers) or worked out again from the carried * blocks alone (paragraph groups, ordered-list markers). A carried story's * box is set in the context of the text, with the list indents its sender * set its lists with; the typography of a styled section or a part of this * chapter does not reach it. */ export declare function carriedPass(base: FrameLayoutPass, carried: ImportedJumps): FrameLayoutPass; /** A frame style whose box keeps its drawn size when the frame's text is * set at `scale` (#858): the frame is laid out `1 / scale` as large and * painted at `scale`, so its padding, border, corner radius, stripe and * tab are laid out `1 / scale` as large to come out as drawn. Only the * text and what it holds shrink: padding that keeps room for the photos * set over a box stays that room. */ export declare function keepChromeAt(style: ResolvedCalloutStyleConfig, scale: number): ResolvedCalloutStyleConfig; /** The callout style a frame is drawn with: `base` (its `style`, or the * frameless frame style) with what a frame sets of its own: its padding * (side by side) and a measure that is the frame's. A style's placement, * span, width and margins do not apply to a frame. */ export declare function frameStyleOf(base: ResolvedCalloutStyleConfig, frame: ResolvedFrame): ResolvedCalloutStyleConfig; /** `frame` with the named look `named` (#1089) laid over its own `look` * (`lookOver`): the order is the style, the template frame's look, then * the named look. `frame` itself when there is none. */ export declare function withNamedLook(frame: ResolvedFrame, named: FrameLookEntry | undefined): ResolvedFrame; /** `base` with what a frame's `look` sets (#976) written over it: colours * of the fill, border, stripe, icon, marker, title, text and label tab, * and the tracking of the body. A fill colour turns the fill on. A part * the style does not have (a label tab it lacks) is left out. Kept per * style and look, so the pieces a measurement is keyed by (`body`, * `lists`) keep their identity from one call to the next. */ export declare function styleWithLook(base: ResolvedCalloutStyleConfig, look: FrameLook): ResolvedCalloutStyleConfig; /** The story heads of a composed page's stories, by the head frame's * name, read from the boxes `wrapComposedPages` made (`FRAME_ATTR`). */ export declare function composedStories(startIdx: number, endIdx: number, plans: ReadonlyMap): Map; /** `d` in px, 0 when unset. */ export declare function lengthPx(d: Parameters[0] | undefined, dpi: number, emPx: number): number; /** A composed page of the pass whose template is known: its markers and * its stories. */ export interface PlannedComposedPage { startIdx: number; endIdx: number; stories: Map; /** The story box holding block `idx`, if any. */ storyAt(idx: number): ComposedStory | undefined; } /** The composed pages of `blocks` whose template `source` has, by their * opening marker's index. */ export declare function planComposedPages(blocks: readonly ContentBlock[], plans: ReadonlyMap, source: PageTemplateSource): Map; /** The planned composed page whose markers enclose block `idx`. */ export declare function composedPageAt(pages: ReadonlyMap, idx: number): PlannedComposedPage | undefined; //# sourceMappingURL=composedLayout.d.ts.map