/** * Text panels (`::panel{text}`, #885, DESIGN ยง7): a panel whose body is * Markdown, poured into the frame the split generated for it the way a * composed page pours a slot into a frame. * * The block parser reads the body as any text and sets its blocks right * after the comic's directive. Before layout, {@link wrapComicTextPanels} * puts each panel's blocks in one frameless story box (the composed pages' * {@link FRAME_STYLE_ID} box); the comic page's layout then sets each story * in its panel's frame with the composed pages' frame layout * (`layoutComposedPage`, one frame filling the panel's text area), so a * text panel has real paragraphs: selectable, searchable, read in order by * tagged PDF and EPUB. A strip's text frames are laid once the strip has * its place on the page ({@link layoutStripTextFrames}), a spread's on its * two pages; a comic inside a container keeps its text in the flow after * the comic, never lost. */ import type { ContentBlock } from '../parse/types.js'; import type { ResolvedCalloutStyleConfig } from '../types.js'; import type { ContentWarning, ResolvedConfig, VDTBlock, VDTComicPage, VDTPage } from '../vdt.js'; import { type BoundingBox } from '../vdt.js'; import type { ResolvedFrame } from '../composed/types.js'; import type { BoxExclusion, PlannedCallout } from '../pipeline/calloutLayout.js'; import type { FrameLayoutPass } from '../pipeline/frameLayout.js'; import { type PlannedComposedPage } from '../pipeline/composedLayout.js'; import { resolvedDirection } from '../pipeline/config.js'; import type { ComicPageSource } from './types.js'; /** `containerAttrs` key of a text panel's story box: the panel's index in * its page's source (`ComicPanelSource.index`). */ export declare const COMIC_PANEL_ATTR = "__comicPanel"; /** The story key of a text panel (its box's `FRAME_ATTR`). */ export declare const comicTextStoryKey: (panelIndex: number) => string; /** Whether text panels can be set in their frames in a document: in every * one since postext 1.39 (#909). Up to 1.38 a vertical or right-to-left * document set them in the flow after the comic; now the frame takes the * text in the page's flow frame, mirrored or turned (set vertically on a * vertical page). Kept for the callers that ask. */ export declare function comicTextPanelsSupported(resolved?: Pick & Parameters[0]): boolean; /** Why a text panel's Markdown is set in the flow instead of its frame: * never since postext 1.40 (#959: strips and spreads take their text in * the frames too); `'flow'` only for a caller that passes `supported` * false. Undefined when its frame takes it. Kept for the callers that * ask; `source` is read no more. */ export declare function comicTextPanelFallback(source: Pick, supported: boolean): 'strip' | 'spread' | 'flow' | undefined; /** * `blocks` with the Markdown of every text panel of a comic page set in * its frame regrouped in a story box of its own (see the module comment). * Only comics outside any container and whose frame takes text * ({@link comicTextPanelFallback}). The same array comes back when there * is nothing to wrap. */ export declare function wrapComicTextPanels(blocks: readonly ContentBlock[], supported: boolean): { blocks: ContentBlock[]; wrapped: boolean; }; /** The text panels' stories of every comic page of the pass, by the index * of its directive: the markers they span (the directive to the closing * marker of the last story) and the stories by key * ({@link comicTextStoryKey}). */ export declare function planComicTextPanels(blocks: readonly ContentBlock[], plans: ReadonlyMap): Map; /** What {@link layoutComicTextFrames} reads of the pass (as a composed page * does, `ComposedPageInput`). */ export interface ComicTextFramesInput { pass: FrameLayoutPass; resolved: ResolvedConfig; page: VDTPage; comic: VDTComicPage; plan: PlannedComposedPage; /** The style a frame is drawn with: its `style`, else frameless. */ styleOf(frame: ResolvedFrame): ResolvedCalloutStyleConfig; dpi: number; emPx: number; bodyOffset: number; mirrored: boolean; pushGapPx: number; locale?: string; /** Only the text panels with these source indexes are laid (a spread * gives each panel to one of its two pages); all when unset. */ only?: ReadonlySet; /** Boxes on the sheet the text keeps off (a spread's gutter), each set * short where it crosses a line. */ avoid?: readonly BoundingBox[]; } export interface ComicTextFramesLayout { /** The frames' boxes and content, for `page.floats` and `doc.blocks`. */ blocks: VDTBlock[]; /** The stories set (by key). */ laid: Set; } /** * Set the text panels of a laid-out comic page in their frames: each text * frame of `comic.frames` gets the blocks its story was set in * (`blockIds`), its overflow and its scale; a frame its text does not fit * clips it (`comicPanelFrame`, reason `textOverflow`). The frame's text * area is the panel's box inside its border and the lettering's inset; * with a `box` style, the panel's box (the style's padding keeps the text * off its edges). * * `comic` is on the sheet of `page`: a comic page, a half of a spread, or * a strip moved there ({@link layoutStripTextFrames}). */ export declare function layoutComicTextFrames(input: ComicTextFramesInput): ComicTextFramesLayout; /** * The text panels of a strip (`:::strip`, #959), laid once the strip's block * has its place on the page: the strip's comic stands relative to its block * (`VDTBlock.comic`), so it is moved onto the sheet where the block sits * ({@link flowRectToPage}), its text set there in the page's flow frame, and * what the frames came to (blocks, overflow, scale, warnings) written back * on the block's comic, which keeps moving with the block. `input.comic` is * ignored; `block` is the strip. */ export declare function layoutStripTextFrames(input: Omit & { block: Pick; }): ComicTextFramesLayout; /** The least scale a text panel's `shrink` attribute lets its text take * (#909): `shrink` alone, 0.5; `shrink=0.7` (or `70%`), that, kept * between 0.25 and 1; undefined without it (or `shrink=false`). */ export declare function shrinkScale(value: string | undefined): number | undefined; /** The shapes a frameless text set in a slanted cell keeps off (#909): * for each band of `area` (2 px tall) what lies outside the cell's * outline, `edge` in from it, on the left and on the right, as two * contours (page coordinates of the outline's frame). */ export declare function slantExclusions(poly: readonly { x: number; y: number; }[], area: { x: number; y: number; width: number; height: number; }, edge: number): BoxExclusion[]; /** The box with straight sides inside a convex polygon (a cell cut by * slanted lines), so that text keeps off the slants: the larger of the box * that keeps the whole height and the width every row of it shares (then * the height every column of that width shares), and the box that keeps * the whole width first. Falls back to `box` when both are degenerate. */ export declare function innerBox(poly: readonly { x: number; y: number; }[], box: { x: number; y: number; width: number; height: number; }): { x: number; y: number; width: number; height: number; }; /** The source warnings of a comic's frames (#885): a `box` that names no * callout style, and text panels whose Markdown is set in the flow * ({@link comicTextPanelFallback}). Offsets as in `source`. */ export declare function comicFrameSourceWarnings(source: ComicPageSource, calloutStyles: ReadonlySet, supported: boolean): ContentWarning[]; //# sourceMappingURL=textPanels.d.ts.map