/** * Comic strips in the text flow (`:::strip`, #566): a daily strip in a * column or across the page, a comic inside a prose book. A strip has the * body of a comic page; it is laid out as one unbreakable box of a fixed * height (`height`) or proportions (`aspect`, its width over its height), * set where it occurs (`placement=here`) or floated to the head or foot of * a page like a figure (`top`, `bottom`, `auto`), a column wide or a page * wide (`span`). Its panels are cut from the box: the box is the frame, * the gutters and panel styles are the comics config's, and nothing bleeds. * A strip may be narrower than the measure it spans (`width`, a length or * a percentage of that measure), set at its start, centre or end (`align`, * following the text direction), and carry a caption (`caption`), set in * the resource caption style and numbered in a resource type's sequence * when `type` names one (#590). * * ```md * :::strip{split="* | * | *" aspect=3.2 span=page placement=top} * ::panel{art=d1} * ana: Morning! * ::panel{art=d2} * ::panel{art=d3} * ::: * ``` */ import type { ResolvedConfig, VDTComicPage } from '../vdt.js'; import type { Dimension, Resource } from '../types.js'; import type { ComicSplitList } from './split.js'; import type { ComicPageSource } from './types.js'; /** Where and how wide a strip is set. */ export interface ComicStripPlacement { /** `'column'` (default): the measure of the column it falls in; * `'page'`: the width of the content area, across the columns. */ span: 'column' | 'page'; /** `'here'` (default): in the flow, where it is written (it moves to the * next column or page whole when it does not fit). `'top'` / `'bottom'` * / `'auto'`: floated to the head or foot of the first page with room * from this point on, like a figure. */ position: 'here' | 'auto' | 'top' | 'bottom'; /** The strip's extent across the flow (its height on a horizontal page), * when written (`height=4cm`; a bare number is in mm). */ height?: Dimension; /** Width over height on the sheet (`aspect=3`, `aspect=4/1`, `4:1`), * when written. */ aspect?: number; /** How wide the strip is, when written: a length (`width=12cm`, a bare * number in millimetres) or a share of the measure it spans * (`width=60%`, `fraction` 0.6). Never wider than that measure. */ width?: { length: Dimension; } | { fraction: number; }; /** Where a strip narrower than its measure stands in it: at its start, * centre (default) or end, along the text direction (the start is the * right on a right-to-left page, the top on a vertical one). */ align: ComicStripAlign; /** The caption set under (or over, per `captionStyle.position`) the * strip, as written (inline Markdown), when it has one. */ caption?: string; /** The resource type (`type=figure`) whose label and number the caption * takes, when written: the strip is counted in that type's sequence. */ type?: string; /** The strip's identifier (`id=…`): a `:ref` naming it prints its label * and number (when it has a `type`). */ id?: string; } /** Where a strip narrower than its measure stands (see * {@link ComicStripPlacement.align}). */ export type ComicStripAlign = 'start' | 'center' | 'end'; /** A positive ratio written `3`, `3.2`, `4/1` or `4:1`; undefined when * unreadable. */ export declare function parseComicAspect(value: string | undefined): number | undefined; /** A strip's `width` as written: a percentage of its measure, or a length * (a bare number in millimetres); undefined when unreadable or not * positive. */ export declare function parseComicStripWidth(value: string | undefined): ComicStripPlacement['width']; /** A strip's `align` as written; `'center'` when absent or unknown. */ export declare function parseComicStripAlign(value: string | undefined): ComicStripAlign; /** A strip's placement as its fence attributes write it. */ export declare function comicStripPlacement(attrs: Readonly>): ComicStripPlacement; /** The strip's width (px) in a measure `measure` px wide: its `width`, * never wider than the measure nor narrower than a pixel. */ export declare function comicStripWidth(placement: Pick, measure: number, dpi: number): number; /** How far (px, along the measure, from its start) a strip `width` px wide * stands in a measure `measure` px wide. */ export declare function comicStripOffset(align: ComicStripAlign, measure: number, width: number): number; /** How many cells a split sets side by side (`across`) and stacked * (`down`) at most — the grid its panels would make if they were all * square. */ export declare function comicSplitGrid(list: ComicSplitList): { across: number; down: number; }; /** The proportions of a strip: its `aspect`, else those that make its * panels about square (three panels side by side: 3). */ export declare function comicStripAspect(source: Pick): number; /** * A strip's extent across the flow (px) for a strip `measure` px wide * along the flow's measure (its `width` taken): * its `height`, else the measure over its aspect (times it on a vertical * page, where the measure runs down the sheet), never more than `max` (a * strip never runs past a fresh column) nor less than a pixel. */ export declare function comicStripExtent(source: Pick, measure: number, dpi: number, vertical: boolean, max: number): number; /** What {@link layoutComicStrip} needs. */ export interface ComicStripContext { resolved: ResolvedConfig; /** The strip's box on the sheet (px): its width and height there (the * flow box turned on a vertical page). */ width: number; height: number; /** Where that box stands in its block's box on the sheet (px from the * block's top-left corner): a strip narrower than its measure, or one * with a caption before it. Default 0, 0. */ x?: number; y?: number; resources: ReadonlyMap; sourceOffset?: number; pageIndex: number; } /** Lay out a strip in its own box: coordinates relative to its block's * top-left corner on the sheet (`VDTBlock.comic`). Nothing bleeds. */ export declare function layoutComicStrip(source: ComicPageSource, ctx: ComicStripContext): VDTComicPage; //# sourceMappingURL=strip.d.ts.map