@eigenpal/docx-editor-core/utils/stylePreview
Paragraph-style preview + option resolution — shared between the React and Vue toolbars so the style-picker dropdown looks and behaves identically.
Pure logic only: no i18n and no framework CSS types. The returned preview is a plain { fontSize, lineHeight, fontWeight?, fontStyle?, color? } object, which is structurally assignable to both React's CSSProperties and Vue's inline-style record, so neither adapter needs a cast. Name localization stays in the adapters (they own the i18n t() boundary).
Functions (2)
getStylePreviewPropsfunctionSource ↗
Build the inline preview style for a style option. fontSize is in half-points (OOXML); known styles use [STYLE_PREVIEW_SIZES](STYLE_PREVIEW_SIZES) instead.
declare function getStylePreviewProps(input: {
styleId: string;
fontSize?: number;
bold?: boolean;
italic?: boolean;
color?: string;
}): StylePreviewProps;resolveParagraphStyleOptionsfunctionSource ↗
Filter the document's styles to the visible paragraph styles, extract their visual fields, and sort by UI priority — the list a toolbar style picker shows. Returns [] when there are no styles (adapters fall back to presets).
declare function resolveParagraphStyleOptions(styles: Style[] | undefined): ResolvedStyleOption[];Interfaces (2)
ResolvedStyleOptioninterfaceSource ↗
A resolved paragraph-style option (document order, with extracted visual fields). Adapters add their own localized label on top of name.
interface ResolvedStyleOption| Member | Type | Summary |
|---|---|---|
| bold? | boolean | |
| color? | string | |
| fontSize? | number | |
| italic? | boolean | |
| name | string | |
| priority | number | |
| styleId | string |
StylePreviewPropsinterfaceSource ↗
Inline preview style for a paragraph-style dropdown item.
interface StylePreviewProps| Member | Type | Summary |
|---|---|---|
| color? | string | |
| fontSize | string | |
| fontStyle? | 'italic' | |
| fontWeight? | 'bold' | |
| lineHeight | string |
Variables (4)
HEADING_COLORconstSource ↗
Google-Docs heading preview color.
HEADING_COLOR = "#4a6c8c"STYLE_DEFAULT_BOLDconstSource ↗
Styles rendered bold in the dropdown preview by default.
STYLE_DEFAULT_BOLD: ReadonlySet<string>STYLE_DEFAULT_COLORconstSource ↗
Default preview text color (hex, no #) for styles that don't set one.
STYLE_DEFAULT_COLOR: Record<string, string>STYLE_PREVIEW_SIZESconstSource ↗
Dropdown preview sizes (px) for well-known styles, matching Google Docs.
STYLE_PREVIEW_SIZES: Record<string, number>