import { Archive } from '../classes/Archive.js'; import { XmlFile } from '../classes/XmlFile.js'; import { FileMime } from '../enums.js'; import { ThemeXml } from './ThemeXml.js'; import { type ParagraphProperties } from '../properties/paragraph-properties.js'; import { type TableConditionalProperties, type TableConditionalTypes } from '../properties/table-conditional-properties.js'; import { type TableProperties } from '../properties/table-properties.js'; import { type TextProperties } from '../properties/text-properties.js'; declare type ParagraphStyle = { type: 'paragraph'; paragraph?: ParagraphProperties; text?: TextProperties; table?: null; }; declare type CharacterStyle = { type: 'character'; paragraph?: null; text?: TextProperties; table?: null; }; declare type TableStyle = { type: 'table'; paragraph?: null; text?: null; table?: TableProperties & { conditions?: Partial>>; }; }; export declare type AnyStyleDefinition = { id: string; name?: string | null; basedOn?: string | null; isDefault?: boolean | null; } & (CharacterStyle | ParagraphStyle | TableStyle); /** * https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_lsdException_topic_ID0EX4NT.html */ declare type LatentStyle = { name: string; locked?: boolean | null; uiPriority?: number | null; semiHidden?: boolean | null; unhideWhenUsed?: boolean | null; qFormat?: boolean | null; }; declare type DocumentDefaults = { defaultRunProperties?: TextProperties | null; defaultParagraphProperties?: ParagraphProperties | null; }; export declare class StylesXml extends XmlFile { #private; static contentType: FileMime; constructor(location: string); /** * Ensure that a style with this identifier exists. If it doesn't already exist, an empty * (paragraph) style is added just in time. * * @deprecated This is probably an incorrect approach to fixing missing styles. */ ensureStyle(id: string): void; isEmpty(): boolean; protected toNode(): Document; /** * Add a custom style to the available style palette. If it does not have an identifier already, * the system will propose an identifier based on the style name, or create a unique GUID. This * method throws when the identifier is not unique. */ add(properties: Omit & { id?: string; }): string; /** * Add several custom styles to the available palette. Useful for cloning the style configuration of * another DOCX. */ addStyles(styles: AnyStyleDefinition[]): void; /** * The list of custom styles. Does not include latent styles. */ get styles(): AnyStyleDefinition[]; /** * Adds default styles. */ addDefaults(properties: DocumentDefaults): void; /** * Adds a latent style, which means that the Word processor should determine its actual properties */ addLatent(properties: LatentStyle): void; /** * Checks wether a custom style or a latent style with this identifier already exists. */ hasStyle(id: string): boolean; /** * Gets the style data by its identifier. */ get(id: string): AnyStyleDefinition | undefined; static fromDom(dom: Document, location: string, theme?: ThemeXml): StylesXml; /** * Instantiate this class by looking at the DOCX XML for it. */ static fromArchive(archive: Archive, location: string): Promise; } export {};