/** * Pre-pass and derived typography for `:::part{number="…" title="…"}` * containers. Like the other container plans, part ranges are resolved up * front per content-block index (the placement loop rewinds `blockIdx` on * keep-with-next rollbacks and replays the markers in between). */ import type { ContentBlock } from '../parse/index.js'; import type { ResolvedConfig, VDTDocument } from '../vdt.js'; import type { BlockMeasureContext } from './measureContentBlock.js'; export interface PlannedPart { /** Content-block index of the `containerStart` marker. */ startIdx: number; /** Content-block index of the matching `containerEnd` marker. */ endIdx: number; containerId: number; /** `number` attribute as written (`'I'`, `'2'`, …); `''` when absent. */ number: string; /** `title` attribute; `''` when absent. */ title: string; /** `palette` attribute parsed: palette id → hex colour (see * {@link parsePartPalette}); empty when absent. */ palette: Record; } export interface PartPlan { /** Start-marker index → part. */ byStart: Map; /** End-marker index → part. */ byEnd: Map; /** Content-block index → enclosing part (markers excluded). A part nested * inside another part is flattened into the outer one. */ byBlock: Array; } export declare function planParts(contentBlocks: readonly ContentBlock[]): PartPlan; /** Parse a part's `palette` attribute — `"band=#f6c297, band-grey: #fadec7"` * — into palette id → hex. Pairs are separated by commas, semicolons or * whitespace; `=` or `:` joins id and colour; a colour must be a 3-, 6- or * 8-digit hex (the `#` is optional and normalised in). Malformed pairs are * skipped. */ export declare function parsePartPalette(attr: string | undefined): Record; /** Numeric value of a part number written as a decimal (`'3'`, fullwidth * `'3'`, Arabic-Indic `'٣'`, Persian `'۳'`), a roman numeral (`'III'`, `'iv'`) or Chinese numerals (`'三'`, * `'十二'`, `'一二〇'`, Japanese `'百一'`), the latter also with the words * that frame them (`'卷三'`, `'第一卷'`, `'第十二部'`, `'第三巻'`), so `{numberDecimal}` / * `{numberRoman}` work whichever way the author wrote it. `undefined` for * anything else. */ export declare function parsePartNumber(raw: string): number | undefined; /** Per entry of `doc.partMarks` (a part set without a divider page), the * index of the page it takes effect on: the earliest page holding a block * placed after its fence. `undefined` when nothing follows the fence. */ export declare function partMarkPages(doc: Pick): (number | undefined)[]; /** Shallow copy of `resolved` whose `bodyText` and list configs carry the * `parts.bodyStyle` overrides, so the body/list resolvers yield the part * typography without any part-specific branches (the callout approach). * Ordered-list numbers are set bold in `numberColor`; bullets take * `bulletColor`. Level-specific values only follow an override when they * still equal the general value they were resolved from. The * `bodyStyle.unorderedLists` / `orderedLists` partials apply last. */ export declare function derivePartResolvedConfig(resolved: ResolvedConfig): ResolvedConfig; /** Measurement context for the blocks inside a part: the derived config * plus the body / blockquote styles, list indents and ordered-list number * widths recomputed from it. */ export declare function derivePartMeasureContext(ctx: BlockMeasureContext): BlockMeasureContext; //# sourceMappingURL=parts.d.ts.map