/** * Pre-pass for `:::paragraphs{style="…"}` containers. The placement loop * rewinds `blockIdx` on keep-with-next rollbacks and replays the blocks in * between (marker blocks included), so container state is resolved up front * per content-block index instead of being pushed/popped inside the loop. */ import type { ContentBlock } from '../parse/index.js'; import type { ParagraphContainerSpacing, TextAlign } from '../types.js'; import type { ResolvedConfig } from '../vdt.js'; import { type BlockStyle } from './styles.js'; export interface ParagraphContainer { /** `containerId` of the start/end marker pair. */ id: number; /** The `style` id the container names; undefined for a container that * only sets attributes (`:::paragraphs{align=end}`). */ styleId?: string; /** Style for every paragraph in the container. */ style: BlockStyle; /** Style for the container's last paragraph: its `marginBottomPx` is * the space under the container, the larger of `spaceBetween` and * `marginBottom` (a negative `marginBottom` as it is). With * `bodyText.paragraphContainerSpacing: 'add'` (1.4) it is baked into * the grid snap that closes the container (grid wins, margin is a * minimum — the same convention snapped headings follow); with * `'collapse'` the flow snaps under the text and carries what the snap * left of the space, so it merges with the next block's own. */ tailStyle: BlockStyle; /** Applied on entry through pending spacing. */ marginTopPx: number; /** Fallback for containers whose last block is not a paragraph. */ marginBottomPx: number; /** The style's `snapToGrid`: whether the flow snaps back onto the * baseline grid under the container's last paragraph (EF-184). */ snapToGrid: boolean; /** The style's `containerSpacing` (#715): the rule the space under this * container follows. Absent: `bodyText.paragraphContainerSpacing`. */ spacing?: ParagraphContainerSpacing; /** A container that names no style and sits in none (#424): its * attributes apply over the text style of wherever it is set — the * body's, a part's or a styled section's, a box's — which * {@link containerStyle} reads; `style` holds them over the document's * body text. */ overBody?: LayoutAttrs; /** The fence's own layout attributes over the style (#1119), kept so a * box can set the container again in its own body * ({@link restyleContainerFor}). */ layout?: LayoutAttrs; /** The container names no style and takes its enclosing container's * (`styleId` is that one's), with no margins of its own. */ attrsOnly?: true; } /** The style a paragraph of `container` is set in: the container's tail * style for its last block, else its style; a container that only sets * attributes takes them over `bodyStyle`, the text style where it is set. */ export declare function containerStyle(container: ParagraphContainer, isTail: boolean, bodyStyle: BlockStyle, dpi: number): BlockStyle; export interface ParagraphContainerPlan { /** Container id → entry, for `paragraphs` containers with a known style. */ byId: Map; /** Content-block index → innermost enclosing paragraph container. */ byBlock: Array; } export declare function planParagraphContainers(contentBlocks: readonly ContentBlock[], resolved: ResolvedConfig): ParagraphContainerPlan; /** * The containers of the document's plan as a box sets them (#1119): a box * whose resolved configuration gives a paragraph style its own body * (`deriveCalloutResolvedConfig`) sets the style's containers again * against it, with the fence's attributes over them; every other * container is the plan's own. The identity when `resolved` sets no style * apart from `documentStyles` (the document's resolved styles). */ export declare function restyleContainerFor(resolved: ResolvedConfig, documentStyles: ResolvedConfig['paragraphStyles']): (container: ParagraphContainer | undefined) => ParagraphContainer | undefined; /** What a `:::paragraphs` fence sets beside its style (#424): `align` * (`start`, `end`, `left`, `right`, `center`, `justify`), `indent` (from * the start side) and `endIndent` (from the end side), lengths whose bare * numbers count ems of the text (`indent=2` is 2字下げ). 地付き is * `{align=end}`, 地から1字上げ `{align=end endIndent=1}`. */ interface LayoutAttrs { textAlign?: TextAlign; indent?: string; endIndent?: string; } /** The paragraph style a block is set in (`VDTBlock.paragraphStyleId`): a * poem's fence style when the config has it, else, for a paragraph, the * style of the innermost `:::paragraphs` container around it — as * `buildBlockKind` picks the block's style. */ export declare function paragraphStyleIdOf(raw: ContentBlock, container: ParagraphContainer | undefined, resolved: ResolvedConfig): string | undefined; export {}; //# sourceMappingURL=paragraphContainers.d.ts.map