/** * @file 文档生成模块 - 类型定义 * @description 定义结构化文档数据模型(PPTX / DOCX / PDF) */ export interface ThemeColors { primary: string; secondary?: string; accent?: string; background?: string; backgroundDark?: string; textPrimary: string; textSecondary?: string; textOnDark?: string; border?: string; chartColors?: string[]; heading?: string; body?: string; caption?: string; link?: string; tableHeader?: string; tableHeaderText?: string; tableBorder?: string; tableAltRow?: string; [key: string]: string | string[] | undefined; } export interface ThemeFonts { title: string; heading: string; body: string; caption: string; } export interface ThemeSizes { title: number; heading: number; subheading?: number; body: number; caption: number; statValue?: number; h1?: number; h2?: number; h3?: number; h4?: number; } export interface ThemeSpacing { margin: number; gap: number; lineSpacing?: number; paragraphAfter?: number; headingBefore?: number; headingAfter?: number; } export interface PageMargin { top: number; right: number; bottom: number; left: number; } export interface PageConfig { size: string; margin: PageMargin; } export interface ThemeConfig { name: string; displayName?: string; colors: ThemeColors; fonts: ThemeFonts; sizes: ThemeSizes; spacing: ThemeSpacing; page?: PageConfig; } export interface DocTypeConfig { defaultTheme: string; themes: string[]; customThemesDir?: string | null; slideSize?: { width: number; height: number; }; pageSize?: string; } export type SlideType = 'cover' | 'toc' | 'section' | 'content' | 'two_column' | 'chart' | 'table' | 'image_text' | 'stats' | 'closing' | 'blank'; export interface ChartDataset { label: string; data: number[]; color?: string; /** Bubble sizes (for bubble chart) */ sizes?: number[]; } export interface ChartData { /** * 图表类型。gauge 为简化格式透传类型:pptxgenjs 无原生仪表盘图表, * 由 PPTX 渲染层降级为数值文本页;HTML 报告链路使用独立的 ReportChartData。 */ type: 'bar' | 'bar-horizontal' | 'line' | 'pie' | 'doughnut' | 'area' | 'radar' | 'scatter' | 'bubble' | 'gauge'; /** 分类轴标签。PPTX 链路可由简化格式 data[].name 派生 */ labels: string[]; /** 数据系列。PPTX 链路可由简化格式 data[].value 映射派生 */ datasets: ChartDataset[]; title?: string; /** Radar chart indicators: [{name, max}] or string[] */ indicators?: { name: string; max: number; }[] | string[]; /** Gauge chart max value (passed through from shorthand format) */ max?: number; } export interface TableData { headers: string[]; rows: (string | number)[][]; } export interface StatItem { value: string | number; label: string; color?: string; } /** Bullet 项:支持纯文本或带层级的对象 */ export type BulletItem = string | { text: string; level?: number; }; export interface ColumnContent { title?: string; bullets?: BulletItem[]; text?: string; /** Bullet icon style: 'check' (✓), 'cross' (✗), 'bullet' (●, default) */ icon?: 'check' | 'cross' | 'bullet' | 'arrow' | 'diamond'; } export interface SlideDefinition { type: SlideType; title?: string; subtitle?: string; /** cover / section / closing */ items?: string[]; /** toc / content - 支持嵌套层级 */ bullets?: BulletItem[]; /** content */ text?: string; /** content / image_text */ left?: ColumnContent; right?: ColumnContent; /** two_column */ chart?: ChartData; /** chart */ table?: TableData; /** table */ stats?: StatItem[]; /** stats */ image_url?: string; /** image_text */ background?: string; /** 自定义背景色 */ /** Bullet icon style for content/columns: 'check' (✓), 'cross' (✗), 'bullet' (●, default) */ icon?: 'check' | 'cross' | 'bullet' | 'arrow' | 'diamond'; } export interface PresentationData { title: string; theme?: string; slides: SlideDefinition[]; filename?: string; } export type BlockType = 'heading' | 'paragraph' | 'bullets' | 'numbers' | 'table' | 'image' | 'page_break' | 'toc' | 'spacer'; export interface InlineRun { text: string; bold?: boolean; italic?: boolean; underline?: boolean; color?: string; fontSize?: number; link?: string; } export interface BlockDefinition { type: BlockType; /** heading level 1-4 */ level?: number; /** heading / paragraph text */ text?: string; /** paragraph 支持 inline runs */ runs?: InlineRun[]; /** bullets / numbers items */ items?: string[]; /** table data */ table?: TableData; /** image */ image_url?: string; image_width?: number; image_height?: number; image_alt?: string; /** spacer height (pt) */ height?: number; } export interface DocumentOptions { pageSize?: string; margins?: PageMargin; includeToc?: boolean; headerText?: string; footerText?: string; showPageNumbers?: boolean; } export interface DocumentData { title: string; theme?: string; blocks: BlockDefinition[]; options?: DocumentOptions; filename?: string; } export interface RenderResult { buffer: Buffer; filename: string; mimeType: string; size: number; } //# sourceMappingURL=types.d.ts.map