import { SDThemeColorName, SDThemeFontRef } from '../types/sd-props.js'; /** Catalogue view selector. `inUse` lists styles referenced by document content. */ export type StyleCatalogView = 'quickGallery' | 'recommended' | 'currentDocument' | 'all' | 'inUse'; /** Normalized style kind. `linked` is a deduplicated paragraph/character pair. */ export type StyleCatalogItemType = 'paragraph' | 'character' | 'linked' | 'table' | 'numbering' | 'unknown'; /** Type filter values accepted on input (the concrete, requestable kinds). */ export type StyleCatalogFilterType = Exclude; /** Where a catalogue item originated. */ export type StyleProvenance = 'authored' | 'default-floor' | 'latent'; export type StyleCatalogDiagnosticSeverity = 'info' | 'warning' | 'error'; /** Status of a backing OOXML package part. */ export type StyleSourcePartStatus = 'present' | 'missing' | 'malformed'; /** * Usage-scan availability. `unsupported` when usage was not requested; * `complete` when the full document was scanned; `partial` when the body story * was scanned but secondary stories (headers/footers/comments/footnotes/endnotes) * were deferred; `failed` when the body story could not be scanned and usage is * unavailable. */ export type StyleCatalogUsageStatus = 'unsupported' | 'complete' | 'partial' | 'failed'; /** Preview-resolution availability. `available` once previews were requested and resolved. */ export type StyleCatalogPreviewStatus = 'unsupported' | 'available'; /** Whether the requested `view` is supported in this pass. */ export type StyleCatalogViewStatus = 'supported' | 'unsupported'; export declare const STYLE_CATALOG_VIEWS: readonly StyleCatalogView[]; export declare const STYLE_CATALOG_FILTER_TYPES: readonly StyleCatalogFilterType[]; export interface StyleCatalogItemVisibility { /** Belongs in the Word-style quick gallery (Home-tab Styles gallery). */ quickGallery: boolean; /** Belongs in the pane "Recommended" view. */ recommended: boolean; /** Belongs in the pane "All styles" view. */ all: boolean; /** Hard-hidden or semi-hidden, so it should not surface in quick UI. */ effectivelyHidden: boolean; } /** Optional usage rollup. Present when `includeUsage` (or the `inUse` view) is requested. */ export interface StyleCatalogItemUsage { used: boolean; paragraphCount?: number; runCount?: number; tableCount?: number; numberingCount?: number; } /** * Where a preview font came from. `theme` names the theme font slot it was * resolved from; `fallback: true` means the document has no usable theme and * the value is the default Office theme's. */ export type StyleCatalogPreviewFontSource = { origin: 'literal'; } | { origin: 'theme'; themeFont: SDThemeFontRef; fallback?: true; }; /** * Where a preview color came from. `theme` names the theme color and the * tint/shade bytes (0-255) applied to it, as in `SDColorRef`. */ export type StyleCatalogPreviewColorSource = { origin: 'literal'; } | { origin: 'theme'; themeColor: SDThemeColorName; tint?: number; shade?: number; fallback?: true; } /** The document sets no color (Word's automatic color); the value is the black text renders with. */ | { origin: 'default'; }; /** Origin of the theme-capable preview tokens. A token without a source is absent from `css`. */ export interface StyleCatalogPreviewSources { fontFamily?: StyleCatalogPreviewFontSource; color?: StyleCatalogPreviewColorSource; } /** Optional resolved preview tokens. Present when `includePreview` is requested. */ export interface StyleCatalogItemPreview { available: boolean; /** UI-safe CSS tokens. Theme fonts and colors are already resolved. */ css?: Record; /** Whether `css.fontFamily` and `css.color` came from the theme or were set directly. */ sources?: StyleCatalogPreviewSources; unsupportedReason?: string; } /** One normalized style. Linked paragraph/character pairs are deduplicated. */ export interface StyleCatalogItem { id: string; name: string; aliases: string[]; type: StyleCatalogItemType; custom: boolean; builtin: boolean; default: boolean; basedOn: string | null; next: string | null; link: string | null; priority: number | null; qFormat: boolean; hidden: boolean; semiHidden: boolean; unhideWhenUsed: boolean; locked: boolean; provenance: StyleProvenance; visibility: StyleCatalogItemVisibility; usage?: StyleCatalogItemUsage; preview?: StyleCatalogItemPreview; } export interface StyleCatalogDefaults { paragraphStyleId: string | null; characterStyleId: string | null; tableStyleId: string | null; } export interface StyleCatalogDiagnostic { severity: StyleCatalogDiagnosticSeverity; code: string; part?: string; message: string; } /** * Per-source status so consumers can fail closed. A `missing` or `malformed` * styles part still yields a default-floor catalogue with provenance, rather * than guessing. */ export interface StyleCatalogSourceStatus { styles: StyleSourcePartStatus; settings: StyleSourcePartStatus; /** The theme part that theme-backed preview fonts and colors resolve against. */ theme?: StyleSourcePartStatus; usage: StyleCatalogUsageStatus; preview: StyleCatalogPreviewStatus; view: StyleCatalogViewStatus; } export interface StylesGetCatalogInput { /** Which list to return as `items`. Defaults to `all`. */ view?: StyleCatalogView; /** Restrict items to these style kinds. */ types?: StyleCatalogFilterType[]; /** Include hard-hidden / semi-hidden styles. Defaults to false. */ includeHidden?: boolean; /** Include latent-only style metadata as `provenance: 'latent'`. Defaults to false. */ includeLatent?: boolean; /** Request per-style usage counts (body-story scan; secondary stories deferred). */ includeUsage?: boolean; /** Request resolved style previews (small UI-safe CSS tokens). */ includePreview?: boolean; /** Include diagnostics on the result. Defaults to true. */ includeDiagnostics?: boolean; } export interface StylesGetCatalogResult { version: 'style-catalog/v1'; /** Opaque catalogue revision token, or null when the runtime omits one. */ revision: string | null; /** The view that `items` reflects (echoes the requested view). */ view: StyleCatalogView; defaults: StyleCatalogDefaults; /** The list selected by `view`, after `types` / `includeHidden` filtering. */ items: StyleCatalogItem[]; /** The full available style set, after `types` / `includeHidden` filtering. */ styles: StyleCatalogItem[]; sourceStatus: StyleCatalogSourceStatus; diagnostics: StyleCatalogDiagnostic[]; } export interface StylesGetCatalogAdapter { getCatalog(input?: StylesGetCatalogInput): StylesGetCatalogResult; } /** Validates `styles.getCatalog` input. `undefined` is a valid (default) call. */ export declare function validateStylesGetCatalogInput(input?: StylesGetCatalogInput): void; /** * Executes `styles.getCatalog` using the provided adapter. * Validates input, then delegates to the adapter. */ export declare function executeStylesGetCatalog(adapter: Partial | null | undefined, input?: StylesGetCatalogInput): StylesGetCatalogResult;