/** * The exercises of a document set as ordinary blocks (#1227): each * `:::exercise` becomes a box (its style's `box`, or a frameless one) of * paragraphs, chips and drawn boxes the layout already knows — so an * exercise is placed, split, balanced, tagged and painted as any box is. * Its solutions go where the book says (#1229), and every exercise leaves * a record of what it asks and answers for the digital outputs (#1230). */ import type { ContentBlock } from '../parse/index.js'; import type { CalloutStyleConfig, ChipStyleConfig, DigitSystem, HeadingCounters, OutlineEntry, ParagraphStyleConfig } from '../types.js'; import type { ExerciseSettings } from '../defaults/exercises.js'; import type { ExerciseIssue, ExerciseModel } from './types.js'; import type { ExerciseRecord } from './record.js'; /** Container ids of the synthetic boxes and groups (clear of the parser's * and of the other synthetic bases: 1e9 chapter-end notes, 1.5e9 * listings, 1.75e9 flow columns, 1.8e9 frames, 1.9e9 comic text, 2e9 * page-span embeds). */ export declare const EXERCISE_CONTAINER_BASE = 1600000000; /** What the expansion needs from the document. */ export interface ExpandContext { settings: ExerciseSettings; /** The document's locale and digits. */ locale?: string; digits?: DigitSystem; /** Heading counters before the document (a book's earlier chapters). */ headings?: HeadingCounters; /** Exercise counters carried from earlier chapters, by counter name. */ counters?: Record; /** The size of the text, points, and the room across a column. */ bodySizePt: number; lineHeightPt: number; measurePt: number; /** A right-to-left document (its designs are mirrored). */ rtl?: boolean; /** A vertical page (縦組み): items are numbered ①, ②. */ vertical?: boolean; /** The text's font family: drawn letters (grids, matching) use it. */ bodyFont?: string; /** Ids of the configured box styles (a style's `box` must name one). */ boxIds: ReadonlySet; /** The room a box style takes across (its side padding and border), * points, by id: what an exercise set on that box has less to draw on. */ boxInsets?: ReadonlyMap; /** The book's outline, whose `exercise` entries a * `:::solutions{scope="book"}` prints (#1229). */ outline?: readonly OutlineEntry[]; } export interface ExerciseExpansion { blocks: ContentBlock[]; /** Whether any exercise was set. */ wrapped: boolean; boxes: CalloutStyleConfig[]; paragraphStyles: ParagraphStyleConfig[]; chipStyles: ChipStyleConfig[]; records: ExerciseRecord[]; issues: ExerciseIssue[]; /** The counters after the document, for the next chapter. */ counters: Record; } /** The exercise numbers of a document, each exercise's own counter reset * by the heading level its style names. */ export declare function numberExercises(blocks: readonly ContentBlock[], exercises: ExerciseModel[], ctx: ExpandContext): { numbers: Map; counters: Record; }; /** * Set the exercises of `blocks`. Blocks outside exercises pass as they are; * a `:::solutions` line becomes the solutions the book prints there. */ export declare function expandExercises(blocks: readonly ContentBlock[], ctx: ExpandContext): ExerciseExpansion; /** A length in points, `em` read against `sizePt`. */ export declare function dimPt(d: { value: number; unit: string; }, sizePt: number): number; //# sourceMappingURL=expand.d.ts.map