open-agreements
Version:
Open-source legal template filling CLI and library
51 lines • 1.84 kB
TypeScript
export type StyleDef = {
styleId: string;
name: string;
basedOn: string | null;
pPr: Element | null;
rPr: Element | null;
};
export type StylesModel = {
byId: Map<string, StyleDef>;
};
export declare function parseStylesXml(stylesDoc: Document | null): StylesModel;
export type ParagraphAlignment = 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFY';
export type ParagraphFormatting = {
styleId: string | null;
styleName: string;
alignment: ParagraphAlignment;
leftIndentPt: number;
firstLineIndentPt: number;
};
export declare function extractParagraphFormatting(pPr: Element | null, styles: StylesModel): ParagraphFormatting;
export type RunFormatting = {
bold: boolean;
italic: boolean;
underline: boolean;
highlightVal: string | null;
fontName: string;
fontSizePt: number;
colorHex: string | null;
};
/**
* Tri-state run formatting resolved from a named style's `basedOn` chain: `null` means no
* chain member specifies the property (distinct from an explicit `w:val="0"` → `false`).
* Consumers seeding their own style templates (e.g. the DOCX → ODT converter's `styles.xml`)
* use `null` to fall back to template defaults instead of overriding them.
*/
export type StyleRunFormatting = {
bold: boolean | null;
italic: boolean | null;
fontName: string | null;
fontSizePt: number | null;
colorHex: string | null;
};
/** Resolve a named style's effective run formatting through its `basedOn` chain. */
export declare function extractStyleRunFormatting(styles: StylesModel, styleId: string | null): StyleRunFormatting;
export declare function extractEffectiveRunFormatting(params: {
run: Element;
paragraphPPr: Element | null;
paragraphStyleId: string | null;
styles: StylesModel;
}): RunFormatting;
//# sourceMappingURL=styles.d.ts.map