import type { PostextConfig } from '../types.js'; import type { WordDocument, WordStyle } from './model.js'; export type ParagraphTarget = { kind: 'body'; } | { kind: 'heading'; level: number; style?: string; } | { kind: 'paragraphs'; style: string; } | { kind: 'callout'; type: string; } | { kind: 'calloutTitle'; type: string; } /** A `:::verse` poem (#620): Shift+Enter breaks lines, a paragraph is a * stanza, a run of one-line paragraphs one stanza. */ | { kind: 'verse'; style?: string; } | { kind: 'quote'; } | { kind: 'caption'; } /** Postext Markdown written as text: passed through verbatim. */ | { kind: 'markup'; } /** Starts a new chapter titled with the paragraph's text. */ | { kind: 'chapter'; } | { kind: 'drop'; }; export type CharacterTarget = { kind: 'text'; } | { kind: 'bold'; } | { kind: 'italic'; } | { kind: 'boldItalic'; } | { kind: 'smallCaps'; } | { kind: 'sup'; } | { kind: 'sub'; } | { kind: 'chip'; style: string; } | { kind: 'markup'; } | { kind: 'drop'; }; export type ParagraphTargetKind = ParagraphTarget['kind']; export type CharacterTargetKind = CharacterTarget['kind']; export interface WordImportOptions { /** Soft returns (Shift+Enter) inside a paragraph: a forced line break * (#620, a backslash at the end of the Markdown line; `\\` in a list * item), a space, or a new paragraph of the same style. A paragraph in * a verse style is a poem either way, a line of verse at each soft * return. */ lineBreaks: 'break' | 'space' | 'paragraph'; /** Bold, italic, small caps and scripts set by hand on runs. */ directFormatting: 'keep' | 'ignore'; /** Short bold paragraphs in body text (headings typed by hand) become * headings of this level; 0 keeps them as paragraphs. */ manualHeadings: number; /** Page breaks typed in Word: `:::pagebreak`, or dropped (the design * decides where pages turn). */ pageBreaks: 'keep' | 'drop'; /** Pictures become bitmap resources placed where they were. */ images: boolean; /** Tables become table resources placed where they were. */ tables: boolean; } export interface WordTemplate { /** Stable id ('' for the unsaved working mapping). */ id: string; name: string; /** Keys are Word style names, compared without case. */ paragraphs: Record; characters: Record; options: WordImportOptions; updatedAt: number; } export declare const DEFAULT_IMPORT_OPTIONS: WordImportOptions; /** Word style names the Sandbox's own exports use. */ export declare const MARKUP_STYLE = "Postext Markup"; export declare const MARKUP_CHAR_STYLE = "Postext Markup Inline"; export declare const CHAPTER_STYLE = "Postext Chapter"; export declare function emptyTemplate(name?: string): WordTemplate; /** The book's callout types, or the engine's built-in one (`note`) when * the configuration lists none. */ export declare const calloutStylesOf: (config: PostextConfig) => import("../types.js").CalloutStyleConfig[]; /** The book's chip styles, or the engine's built-in one (`chip`). */ export declare const chipStylesOf: (config: PostextConfig) => import("../types.js").ChipStyleConfig[]; /** A Word style name as Word shows it: built-in names are stored in lower * case (`heading 1`, `caption`) and shown capitalised. */ export declare function displayStyleName(name: string): string; /** The entry of `map` for a style name, compared without case. */ export declare function lookup(map: Record, name: string): T | undefined; /** The target a paragraph style gets when no template names it: the * Sandbox's own export styles, Postext styles with the same name, Word's * built-in roles along the `basedOn` chain, and the outline level. */ export declare function guessParagraphTarget(name: string, config: PostextConfig, doc?: WordDocument, style?: WordStyle): ParagraphTarget; /** The target a character style gets when no template names it. */ export declare function guessCharacterTarget(name: string, config: PostextConfig, doc?: WordDocument, style?: WordStyle): CharacterTarget; /** A template read from untrusted JSON, or undefined when it is none. */ export declare function parseTemplate(v: unknown): WordTemplate | undefined; /** The JSON a template is shared as. */ export declare function templateFile(t: WordTemplate): string; export declare function newTemplateId(): string; //# sourceMappingURL=template.d.ts.map