@json-to-office/core-pptx 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +393 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin/createPresentationGenerator.d.ts +18 -0
- package/dist/plugin/createPresentationGenerator.d.ts.map +1 -0
- package/dist/plugin/example/index.d.ts +4 -0
- package/dist/plugin/example/index.d.ts.map +1 -0
- package/dist/plugin/example/weather.component.d.ts +28 -0
- package/dist/plugin/example/weather.component.d.ts.map +1 -0
- package/dist/plugin/index.d.ts +32 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/schema.d.ts +13 -0
- package/dist/plugin/schema.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +106 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin/validation.d.ts +30 -0
- package/dist/plugin/validation.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/generator.ts","../src/types.ts","../src/utils/warn.ts","../src/core/grid.ts","../src/themes/defaults.ts","../src/core/structure.ts","../src/core/render.ts","../src/utils/color.ts","../src/components/text.ts","../src/components/image.ts","../src/components/shape.ts","../src/components/table.ts","../src/utils/environment.ts","../src/components/highcharts.ts","../src/components/chart.ts","../src/components/index.ts","../src/core/template.ts","../src/index.ts"],"sourcesContent":["/**\n * Presentation Generator\n * Main orchestration functions for the PPTX generation pipeline\n */\n\nimport PptxGenJS from 'pptxgenjs';\nimport JSZip from 'jszip';\nimport { writeFileSync } from 'fs';\nimport type { PresentationComponentDefinition, PptxThemeConfig, PipelineWarning } from '../types';\nimport { isPresentationComponent } from '../types';\nimport { processPresentation } from './structure';\nimport { renderPresentation } from './render';\n\n/**\n * Options for the generation pipeline\n */\nexport interface GenerationOptions {\n customThemes?: Record<string, PptxThemeConfig>;\n}\n\n/**\n * Result from generateBufferWithWarnings\n */\nexport interface GenerationResult {\n buffer: Buffer;\n warnings: PipelineWarning[];\n}\n\n/**\n * Type guard for presentation component\n */\nexport function isPresentationComponentDefinition(\n definition: unknown\n): definition is PresentationComponentDefinition {\n if (typeof definition !== 'object' || definition === null) return false;\n const def = definition as Record<string, unknown>;\n return def.name === 'pptx' && 'props' in def;\n}\n\n/**\n * Generate a PptxGenJS instance from a presentation component definition\n */\nexport async function generatePresentation(\n document: PresentationComponentDefinition,\n options?: GenerationOptions,\n warnings?: PipelineWarning[]\n): Promise<PptxGenJS> {\n if (!document || document.name !== 'pptx') {\n throw new Error('Top-level component must be a pptx component');\n }\n\n const processed = processPresentation(document, options);\n return await renderPresentation(processed, warnings);\n}\n\n/**\n * Generate a buffer from JSON definition\n */\nexport async function generateBufferFromJson(\n jsonConfig: string | PresentationComponentDefinition,\n options?: GenerationOptions\n): Promise<Buffer> {\n const result = await generateBufferWithWarnings(jsonConfig, options);\n return result.buffer;\n}\n\n/**\n * Generate a buffer from JSON definition, returning warnings alongside the buffer\n */\nexport async function generateBufferWithWarnings(\n jsonConfig: string | PresentationComponentDefinition,\n options?: GenerationOptions\n): Promise<GenerationResult> {\n let component: PresentationComponentDefinition;\n\n if (typeof jsonConfig === 'string') {\n const parsed = JSON.parse(jsonConfig);\n if (!isPresentationComponent(parsed)) {\n throw new Error('Parsed JSON must be a presentation component');\n }\n component = parsed;\n } else {\n component = jsonConfig;\n }\n\n const warnings: PipelineWarning[] = [];\n const pptx = await generatePresentation(component, options, warnings);\n const data = await pptx.write({ outputType: 'nodebuffer' });\n const buffer = await neutralizeTableStyle(data as Buffer);\n return { buffer, warnings };\n}\n\n/**\n * Generate and save a .pptx file from JSON definition\n */\nexport async function generateAndSaveFromJson(\n jsonConfig: string | PresentationComponentDefinition,\n outputPath: string,\n options?: GenerationOptions\n): Promise<void> {\n const buffer = await generateBufferFromJson(jsonConfig, options);\n writeFileSync(outputPath, buffer);\n}\n\n/**\n * Generate from a JSON file path\n */\nexport async function generateFromFile(\n filePath: string,\n outputPath: string\n): Promise<void> {\n const { readFileSync } = await import('fs');\n const json = readFileSync(filePath, 'utf-8');\n await generateAndSaveFromJson(json, outputPath);\n}\n\n/**\n * Replace the default table style (Medium Style 2 - Accent 1, which applies allCaps\n * to headers) with \"No Style, No Grid\" so table text renders as authored.\n */\nconst MEDIUM_STYLE_2_ACCENT_1 = '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}';\nconst NO_STYLE_NO_GRID = '{2D5ABB26-0587-4C30-8999-92F81FD0307C}';\n\nasync function neutralizeTableStyle(buffer: Buffer): Promise<Buffer> {\n const zip = await JSZip.loadAsync(buffer);\n let changed = false;\n for (const [path, entry] of Object.entries(zip.files)) {\n if (!path.match(/^ppt\\/slides\\/slide\\d+\\.xml$/)) continue;\n const xml = await entry.async('string');\n if (xml.includes(MEDIUM_STYLE_2_ACCENT_1)) {\n zip.file(path, xml.replaceAll(MEDIUM_STYLE_2_ACCENT_1, NO_STYLE_NO_GRID));\n changed = true;\n }\n }\n return changed ? await zip.generateAsync({ type: 'nodebuffer' }) as Buffer : buffer;\n}\n\n/**\n * Save a PptxGenJS instance to file\n */\nexport async function savePresentation(\n pptx: PptxGenJS,\n outputPath: string\n): Promise<void> {\n const data = await pptx.write({ outputType: 'nodebuffer' });\n const buffer = await neutralizeTableStyle(data as Buffer);\n writeFileSync(outputPath, buffer);\n}\n\n/**\n * Export the main API\n */\nexport const PresentationGenerator = {\n generate: generatePresentation,\n generateBufferFromJson,\n generateBufferWithWarnings,\n generateAndSaveFromJson,\n generateFromFile,\n save: savePresentation,\n isPresentationComponentDefinition,\n};\n","/**\n * PPTX Core Types\n */\n\nexport interface PptxComponentInput {\n name: string;\n id?: string;\n enabled?: boolean;\n props: Record<string, any>;\n children?: PptxComponentInput[];\n}\n\nexport interface PresentationComponentDefinition {\n name: 'pptx';\n $schema?: string;\n id?: string;\n props: {\n title?: string;\n author?: string;\n subject?: string;\n company?: string;\n theme?: string;\n slideWidth?: number;\n slideHeight?: number;\n rtlMode?: boolean;\n pageNumberFormat?: '9' | '09';\n grid?: GridConfig;\n templates?: TemplateSlideDefinition[];\n };\n children?: PptxComponentInput[];\n}\n\nexport interface SlideComponentDefinition {\n name: 'slide';\n id?: string;\n props: {\n background?: {\n color?: string;\n image?: { path?: string; base64?: string };\n };\n transition?: {\n type?: string;\n speed?: string;\n };\n notes?: string;\n layout?: string;\n hidden?: boolean;\n template?: string;\n placeholders?: Record<string, PptxComponentInput>;\n };\n children?: PptxComponentInput[];\n}\n\nexport interface ProcessedPresentation {\n metadata: {\n title?: string;\n author?: string;\n subject?: string;\n company?: string;\n };\n theme: PptxThemeConfig;\n grid?: GridConfig;\n slideWidth: number;\n slideHeight: number;\n rtlMode: boolean;\n pageNumberFormat: '9' | '09';\n slides: ProcessedSlide[];\n templates?: TemplateSlideDefinition[];\n}\n\nexport interface ProcessedSlide {\n components: PptxComponentInput[];\n background?: {\n color?: string;\n image?: { path?: string; base64?: string };\n };\n notes?: string;\n layout?: string;\n hidden?: boolean;\n template?: string;\n placeholders?: Record<string, PptxComponentInput>;\n}\n\nexport interface GridConfig {\n columns?: number;\n rows?: number;\n margin?: number | { top: number; right: number; bottom: number; left: number };\n gutter?: number | { column: number; row: number };\n}\n\nexport interface GridPosition {\n column: number;\n row: number;\n columnSpan?: number;\n rowSpan?: number;\n}\n\nexport interface TextStyle {\n fontSize?: number;\n fontFace?: string;\n fontColor?: string;\n bold?: boolean;\n italic?: boolean;\n align?: string;\n lineSpacing?: number;\n charSpacing?: number;\n paraSpaceAfter?: number;\n}\n\nexport type StyleName = 'title' | 'subtitle' | 'heading1' | 'heading2' | 'heading3' | 'body' | 'caption';\n\nexport interface PptxThemeConfig {\n name: string;\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n background: string;\n text: string;\n text2?: string;\n background2?: string;\n accent4?: string;\n accent5?: string;\n accent6?: string;\n };\n fonts: {\n heading: string;\n body: string;\n };\n defaults: {\n fontSize: number;\n fontColor: string;\n };\n styles?: Partial<Record<StyleName, TextStyle>>;\n}\n\nexport interface PlaceholderDefinition {\n name: string;\n x?: number; y?: number; w?: number; h?: number;\n grid?: GridPosition;\n defaults?: PptxComponentInput;\n}\n\nexport interface TemplateSlideDefinition {\n name: string;\n background?: { color?: string; image?: { path?: string; base64?: string } };\n margin?: number | [number, number, number, number];\n slideNumber?: { x: number; y: number; w?: number; h?: number; color?: string; fontSize?: number };\n objects?: PptxComponentInput[];\n placeholders?: PlaceholderDefinition[];\n grid?: GridConfig;\n}\n\nexport interface SlideContext {\n slideNumber: number;\n totalSlides: number;\n pageNumberFormat: '9' | '09';\n}\n\nexport interface PipelineWarning {\n code: string; // WarningCode at call sites; string here to avoid circular import\n message: string;\n component?: string;\n slide?: number;\n}\n\nexport function isPresentationComponent(\n component: unknown\n): component is PresentationComponentDefinition {\n return (\n typeof component === 'object' &&\n component !== null &&\n (component as any).name === 'pptx'\n );\n}\n\nexport function isSlideComponent(\n component: unknown\n): component is SlideComponentDefinition {\n return (\n typeof component === 'object' &&\n component !== null &&\n (component as any).name === 'slide'\n );\n}\n","import type { PipelineWarning } from '../types';\n\nexport const W = {\n UNKNOWN_COMPONENT: 'UNKNOWN_COMPONENT',\n UNKNOWN_CHART_TYPE: 'UNKNOWN_CHART_TYPE',\n UNKNOWN_SHAPE: 'UNKNOWN_SHAPE',\n CHART_NO_DATA: 'CHART_NO_DATA',\n CHART_INVALID_SERIES: 'CHART_INVALID_SERIES',\n CHART_MULTI_SERIES: 'CHART_MULTI_SERIES',\n IMAGE_NO_SOURCE: 'IMAGE_NO_SOURCE',\n IMAGE_PROBE_FAILED: 'IMAGE_PROBE_FAILED',\n MISSING_TEMPLATE: 'MISSING_TEMPLATE',\n UNKNOWN_PLACEHOLDER: 'UNKNOWN_PLACEHOLDER',\n PLACEHOLDER_NO_POSITION: 'PLACEHOLDER_NO_POSITION',\n THEME_COLOR_FALLBACK: 'THEME_COLOR_FALLBACK',\n UNKNOWN_COLOR: 'UNKNOWN_COLOR',\n GRID_POSITION_CLAMPED: 'GRID_POSITION_CLAMPED',\n} as const;\n\nexport type WarningCode = typeof W[keyof typeof W];\n\nexport function warn(\n warnings: PipelineWarning[] | undefined,\n code: WarningCode,\n message: string,\n extra?: Partial<PipelineWarning>\n): void {\n if (warnings) {\n warnings.push({ code, message, ...extra });\n } else {\n console.warn(message);\n }\n}\n","/**\n * Grid Layout Resolution\n * Converts grid coordinates to absolute x/y/w/h positions\n */\n\nimport type { GridConfig, GridPosition, PptxComponentInput, PipelineWarning } from '../types';\nimport { warn, W } from '../utils/warn';\n\nexport const DEFAULT_GRID_CONFIG: Required<{\n columns: number;\n rows: number;\n margin: { top: number; right: number; bottom: number; left: number };\n gutter: { column: number; row: number };\n}> = {\n columns: 12,\n rows: 6,\n margin: { top: 0.5, right: 0.5, bottom: 0.5, left: 0.5 },\n gutter: { column: 0.2, row: 0.2 },\n};\n\nfunction resolveMargin(margin: GridConfig['margin']) {\n if (margin == null) return DEFAULT_GRID_CONFIG.margin;\n if (typeof margin === 'number') return { top: margin, right: margin, bottom: margin, left: margin };\n return margin;\n}\n\nfunction resolveGutter(gutter: GridConfig['gutter']) {\n if (gutter == null) return DEFAULT_GRID_CONFIG.gutter;\n if (typeof gutter === 'number') return { column: gutter, row: gutter };\n return gutter;\n}\n\n/**\n * Merge a template-level grid override on top of the presentation grid.\n * Template fields take precedence; nested margin/gutter objects are shallow-merged.\n * Both sides are normalized to object form before merging so that a shorthand\n * base (e.g. margin: 0.5) combined with a partial override (e.g. { top: 1.1 })\n * doesn't lose the other sides.\n */\nexport function mergeGridConfigs(\n base: GridConfig | undefined,\n override: GridConfig | undefined\n): GridConfig | undefined {\n if (!override) return base;\n if (!base) return override;\n\n const merged: GridConfig = {\n columns: override.columns ?? base.columns,\n rows: override.rows ?? base.rows,\n };\n\n // Merge margin — normalize both to object form first\n if (override.margin !== undefined) {\n if (typeof override.margin === 'number') {\n merged.margin = override.margin;\n } else {\n merged.margin = { ...resolveMargin(base.margin), ...override.margin };\n }\n } else {\n merged.margin = base.margin;\n }\n\n // Merge gutter — same normalization\n if (override.gutter !== undefined) {\n if (typeof override.gutter === 'number') {\n merged.gutter = override.gutter;\n } else {\n merged.gutter = { ...resolveGutter(base.gutter), ...override.gutter };\n }\n } else {\n merged.gutter = base.gutter;\n }\n\n return merged;\n}\n\nexport function resolveGridPosition(\n gridPos: GridPosition,\n gridConfig: GridConfig | undefined,\n slideWidth: number,\n slideHeight: number,\n warnings?: PipelineWarning[]\n): { x: number; y: number; w: number; h: number } {\n const cols = Math.max(1, gridConfig?.columns ?? DEFAULT_GRID_CONFIG.columns);\n const rows = Math.max(1, gridConfig?.rows ?? DEFAULT_GRID_CONFIG.rows);\n const margin = resolveMargin(gridConfig?.margin);\n const gutter = resolveGutter(gridConfig?.gutter);\n\n const col = Math.max(0, Math.min(gridPos.column, cols - 1));\n const row = Math.max(0, Math.min(gridPos.row, rows - 1));\n const colSpan = Math.max(1, Math.min(gridPos.columnSpan ?? 1, cols - col));\n const rowSpan = Math.max(1, Math.min(gridPos.rowSpan ?? 1, rows - row));\n\n if (gridPos.column !== col || gridPos.row !== row) {\n warn(warnings, W.GRID_POSITION_CLAMPED,\n `Grid position clamped: column ${gridPos.column}→${col}, row ${gridPos.row}→${row} (grid: ${cols}×${rows})`\n );\n }\n\n const availableW = slideWidth - margin.left - margin.right;\n const availableH = slideHeight - margin.top - margin.bottom;\n const trackW = (availableW - (cols - 1) * gutter.column) / cols;\n const trackH = (availableH - (rows - 1) * gutter.row) / rows;\n\n const x = margin.left + col * (trackW + gutter.column);\n const y = margin.top + row * (trackH + gutter.row);\n const w = colSpan * trackW + (colSpan - 1) * gutter.column;\n const h = rowSpan * trackH + (rowSpan - 1) * gutter.row;\n\n return { x, y, w, h };\n}\n\nexport function resolveComponentGridPosition(\n component: PptxComponentInput,\n gridConfig: GridConfig | undefined,\n slideWidth: number,\n slideHeight: number,\n warnings?: PipelineWarning[]\n): PptxComponentInput {\n const gridPos = component.props.grid as GridPosition | undefined;\n if (!gridPos) return component;\n\n const resolved = resolveGridPosition(gridPos, gridConfig, slideWidth, slideHeight, warnings);\n\n const { grid: _grid, ...restProps } = component.props; // eslint-disable-line no-unused-vars, @typescript-eslint/no-unused-vars\n const newProps = { ...restProps };\n\n // When explicit values use percentage strings, convert grid-resolved inches\n // to percentages too so pptxgenjs receives consistent units per element.\n const hasPercentX = typeof newProps.x === 'string' || typeof newProps.w === 'string';\n const hasPercentY = typeof newProps.y === 'string' || typeof newProps.h === 'string';\n\n const toPercX = (v: number) => `${+((v / slideWidth) * 100).toFixed(2)}%`;\n const toPercY = (v: number) => `${+((v / slideHeight) * 100).toFixed(2)}%`;\n\n // Grid sets x/y/w/h, but explicit values on the element override individually\n if (newProps.x == null) newProps.x = hasPercentX ? toPercX(resolved.x) : resolved.x;\n if (newProps.y == null) newProps.y = hasPercentY ? toPercY(resolved.y) : resolved.y;\n if (newProps.w == null) newProps.w = hasPercentX ? toPercX(resolved.w) : resolved.w;\n if (newProps.h == null) newProps.h = hasPercentY ? toPercY(resolved.h) : resolved.h;\n\n return { ...component, props: newProps };\n}\n","/**\n * PPTX Theme Defaults\n */\n\nimport type { PptxThemeConfig, TextStyle, StyleName } from '../types';\n\nconst DEFAULT_STYLES: Partial<Record<StyleName, TextStyle>> = {\n title: { fontSize: 36, bold: true, fontColor: 'text', align: 'center' },\n subtitle: { fontSize: 20, italic: true, fontColor: 'text2', align: 'center' },\n heading1: { fontSize: 28, bold: true, fontColor: 'primary' },\n heading2: { fontSize: 22, bold: true, fontColor: 'primary' },\n heading3: { fontSize: 18, bold: true, fontColor: 'text' },\n body: { fontSize: 14 },\n caption: { fontSize: 10, italic: true, fontColor: 'text2' },\n};\n\nexport const DEFAULT_PPTX_THEME: PptxThemeConfig = {\n name: 'default',\n colors: {\n primary: '#4472C4',\n secondary: '#ED7D31',\n accent: '#70AD47',\n background: '#FFFFFF',\n text: '#333333',\n text2: '#44546A',\n background2: '#E7E6E6',\n accent4: '#FFC000',\n accent5: '#5B9BD5',\n accent6: '#70AD47',\n },\n fonts: {\n heading: 'Arial',\n body: 'Arial',\n },\n defaults: {\n fontSize: 18,\n fontColor: '#333333',\n },\n styles: DEFAULT_STYLES,\n};\n\nconst PPTX_THEMES: Record<string, PptxThemeConfig> = {\n default: DEFAULT_PPTX_THEME,\n dark: {\n name: 'dark',\n colors: {\n primary: '#5B9BD5',\n secondary: '#FF6F61',\n accent: '#6BCB77',\n background: '#2D2D2D',\n text: '#FFFFFF',\n text2: '#CCCCCC',\n background2: '#3D3D3D',\n accent4: '#FFB347',\n accent5: '#77DD77',\n accent6: '#AEC6CF',\n },\n fonts: {\n heading: 'Arial',\n body: 'Arial',\n },\n defaults: {\n fontSize: 18,\n fontColor: '#FFFFFF',\n },\n styles: DEFAULT_STYLES,\n },\n minimal: {\n name: 'minimal',\n colors: {\n primary: '#000000',\n secondary: '#666666',\n accent: '#999999',\n background: '#FFFFFF',\n text: '#000000',\n text2: '#444444',\n background2: '#F5F5F5',\n accent4: '#BBBBBB',\n accent5: '#DDDDDD',\n accent6: '#888888',\n },\n fonts: {\n heading: 'Helvetica',\n body: 'Helvetica',\n },\n defaults: {\n fontSize: 18,\n fontColor: '#000000',\n },\n styles: DEFAULT_STYLES,\n },\n};\n\nexport function getPptxTheme(name: string): PptxThemeConfig {\n return PPTX_THEMES[name] || DEFAULT_PPTX_THEME;\n}\n\nexport const pptxThemes = PPTX_THEMES;\n","/**\n * Structure Processing\n * JSON -> internal model\n */\n\nimport type {\n PptxComponentInput,\n PresentationComponentDefinition,\n ProcessedPresentation,\n ProcessedSlide,\n TemplateSlideDefinition,\n} from '../types';\nimport { isSlideComponent } from '../types';\nimport { resolveGridPosition, resolveComponentGridPosition, mergeGridConfigs } from './grid';\nimport { getPptxTheme } from '../themes';\nimport type { GenerationOptions } from './generator';\n\nexport function processPresentation(\n document: PresentationComponentDefinition,\n options?: GenerationOptions\n): ProcessedPresentation {\n const { props, children = [] } = document;\n\n const themeName = props.theme ?? 'default';\n const theme = options?.customThemes?.[themeName] ?? getPptxTheme(themeName);\n const slideWidth = props.slideWidth ?? 10;\n const slideHeight = props.slideHeight ?? 7.5;\n\n // Process template slide definitions\n let templates: TemplateSlideDefinition[] | undefined;\n if (props.templates && props.templates.length > 0) {\n templates = props.templates.map((m: TemplateSlideDefinition) => {\n const effectiveGrid = mergeGridConfigs(props.grid, m.grid);\n\n // Resolve grid positions on placeholders\n const resolvedPhs = m.placeholders?.map(ph => {\n if (!ph.grid) return ph;\n const abs = resolveGridPosition(ph.grid, effectiveGrid, slideWidth, slideHeight);\n return {\n ...ph,\n x: ph.x ?? abs.x,\n y: ph.y ?? abs.y,\n w: ph.w ?? abs.w,\n h: ph.h ?? abs.h,\n grid: undefined,\n };\n });\n\n // Resolve grid positions on fixed objects (unified components)\n const resolvedObjects = m.objects?.map(obj =>\n resolveComponentGridPosition(obj, effectiveGrid, slideWidth, slideHeight)\n );\n\n return { ...m, placeholders: resolvedPhs, objects: resolvedObjects };\n });\n }\n\n const slides: ProcessedSlide[] = [];\n\n for (const child of children) {\n if (isSlideComponent(child)) {\n const slideComponents: PptxComponentInput[] = [];\n if (child.children) {\n for (const slideChild of child.children) {\n slideComponents.push(slideChild);\n }\n }\n\n slides.push({\n components: slideComponents,\n background: child.props.background,\n notes: child.props.notes,\n layout: child.props.layout,\n hidden: child.props.hidden,\n template: child.props.template,\n placeholders: child.props.placeholders as Record<string, any> | undefined,\n });\n }\n }\n\n return {\n metadata: {\n title: props.title,\n author: props.author,\n subject: props.subject,\n company: props.company,\n },\n theme,\n grid: props.grid,\n slideWidth,\n slideHeight,\n rtlMode: props.rtlMode ?? false,\n pageNumberFormat: props.pageNumberFormat ?? '9',\n slides,\n templates,\n };\n}\n","/**\n * Render Pipeline\n * Internal model -> pptxgenjs calls\n */\n\nimport PptxGenJS from 'pptxgenjs';\nimport type { ProcessedPresentation, PipelineWarning, SlideContext } from '../types';\nimport { renderComponent } from '../components';\nimport { resolveComponentGridPosition, mergeGridConfigs } from './grid';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\nimport { buildSlideTemplateProps } from './template';\n\nexport async function renderPresentation(\n processed: ProcessedPresentation,\n warnings?: PipelineWarning[]\n): Promise<PptxGenJS> {\n const pptx = new PptxGenJS();\n\n // Set presentation metadata\n if (processed.metadata.title) pptx.title = processed.metadata.title;\n if (processed.metadata.author) pptx.author = processed.metadata.author;\n if (processed.metadata.subject) pptx.subject = processed.metadata.subject;\n if (processed.metadata.company) pptx.company = processed.metadata.company;\n\n // Set layout dimensions\n pptx.defineLayout({\n name: 'CUSTOM',\n width: processed.slideWidth,\n height: processed.slideHeight,\n });\n pptx.layout = 'CUSTOM';\n\n // Set RTL mode\n if (processed.rtlMode) {\n pptx.rtlMode = true;\n }\n\n // Set theme fonts\n pptx.theme = {\n headFontFace: processed.theme.fonts.heading,\n bodyFontFace: processed.theme.fonts.body,\n };\n\n // Register template slides\n const templateMap = new Map(processed.templates?.map(m => [m.name, m]) ?? []);\n if (processed.templates) {\n for (const templateDef of processed.templates) {\n const templateProps = buildSlideTemplateProps(templateDef, processed.theme, warnings);\n pptx.defineSlideMaster(templateProps as any);\n }\n }\n\n // Render each slide\n const totalSlides = processed.slides.length;\n for (let slideIdx = 0; slideIdx < totalSlides; slideIdx++) {\n const slideData = processed.slides[slideIdx];\n const slideCtx: SlideContext = {\n slideNumber: slideIdx + 1,\n totalSlides,\n pageNumberFormat: processed.pageNumberFormat,\n };\n const slide = slideData.template\n ? pptx.addSlide({ masterName: slideData.template })\n : pptx.addSlide();\n\n // Apply slide background\n if (slideData.background) {\n if (slideData.background.color) {\n slide.background = { color: resolveColor(slideData.background.color, processed.theme, warnings) };\n } else if (slideData.background.image) {\n if (slideData.background.image.path) {\n slide.background = { path: slideData.background.image.path };\n } else if (slideData.background.image.base64) {\n slide.background = { data: slideData.background.image.base64 };\n }\n }\n }\n\n // Apply hidden flag\n if (slideData.hidden) {\n slide.hidden = true;\n }\n\n // Determine effective grid for this slide (template grid merged with presentation grid)\n const templateDef = slideData.template ? templateMap.get(slideData.template) : undefined;\n if (slideData.template && !templateDef) {\n warn(warnings, W.MISSING_TEMPLATE, `Unknown template \"${slideData.template}\". Available: ${[...templateMap.keys()].join(', ')}`, { slide: slideIdx });\n }\n const effectiveGrid = mergeGridConfigs(processed.grid, templateDef?.grid);\n\n // Render template fixed objects (grid already resolved in structure.ts)\n if (templateDef?.objects) {\n for (const obj of templateDef.objects) {\n await renderComponent(slide, obj, processed.theme, pptx, warnings, slideCtx);\n }\n }\n\n // Render slide components (resolve grid positions first)\n for (const component of slideData.components) {\n const resolved = resolveComponentGridPosition(\n component,\n effectiveGrid,\n processed.slideWidth,\n processed.slideHeight,\n warnings\n );\n await renderComponent(slide, resolved, processed.theme, pptx, warnings, slideCtx);\n }\n\n // Render placeholder content\n if (slideData.placeholders) {\n if (templateDef) {\n const phMap = new Map(templateDef.placeholders?.map(p => [p.name, p]) ?? []);\n\n for (const [phName, component] of Object.entries(slideData.placeholders)) {\n const phDef = phMap.get(phName);\n if (!phDef) {\n warn(warnings, W.UNKNOWN_PLACEHOLDER, `Unknown placeholder \"${phName}\" in template \"${slideData.template}\". Available: ${[...phMap.keys()].join(', ')}`, { slide: slideIdx });\n continue;\n }\n\n const gridResolved = resolveComponentGridPosition(\n component, effectiveGrid,\n processed.slideWidth, processed.slideHeight, warnings\n );\n\n // Position from placeholder, then defaults props, then component props (most specific wins)\n const posDefaults: Record<string, any> = {};\n if (phDef.x != null) posDefaults.x = phDef.x;\n if (phDef.y != null) posDefaults.y = phDef.y;\n if (phDef.w != null) posDefaults.w = phDef.w;\n if (phDef.h != null) posDefaults.h = phDef.h;\n\n const props = { ...posDefaults, ...(phDef.defaults?.props ?? {}), ...gridResolved.props };\n await renderComponent(slide, { ...gridResolved, props }, processed.theme, pptx, warnings, slideCtx);\n }\n } else {\n // No template found — render placeholders at their own positions if available\n for (const [phName, component] of Object.entries(slideData.placeholders)) {\n const hasPosition = component.props.x != null || component.props.y != null || component.props.grid;\n if (hasPosition) {\n const resolved = resolveComponentGridPosition(\n component, effectiveGrid,\n processed.slideWidth, processed.slideHeight, warnings\n );\n await renderComponent(slide, resolved, processed.theme, pptx, warnings, slideCtx);\n } else {\n warn(warnings, W.PLACEHOLDER_NO_POSITION, `Placeholder \"${phName}\" has no template and no explicit position — skipped`, { slide: slideIdx });\n }\n }\n }\n }\n\n // Add speaker notes\n if (slideData.notes) {\n slide.addNotes(slideData.notes);\n }\n }\n\n return pptx;\n}\n","/**\n * Color utilities for PPTX generation.\n * pptxgenjs expects bare 6-char hex (e.g. 'FF0000'), but our theme\n * convention uses '#'-prefixed values (e.g. '#FF0000').\n */\n\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { SEMANTIC_COLOR_NAMES } from '@json-to-office/shared-pptx';\nimport { warn, W } from './warn';\n\n// Build identity entries from the shared source of truth, then add aliases\nconst SEMANTIC_TO_THEME_KEY: Record<string, keyof PptxThemeConfig['colors']> = {\n ...Object.fromEntries(SEMANTIC_COLOR_NAMES.map(n => [n, n])),\n // Aliases (PowerPoint XML compat)\n accent1: 'primary',\n accent2: 'secondary',\n accent3: 'accent',\n tx1: 'text',\n tx2: 'text2',\n bg1: 'background',\n bg2: 'background2',\n};\n\n/**\n * Resolve a color value to bare hex (no '#' prefix).\n * Accepts hex colors (with or without '#') or semantic theme color names.\n */\nexport function resolveColor(color: string, theme: PptxThemeConfig, warnings?: PipelineWarning[]): string {\n const themeKey = SEMANTIC_TO_THEME_KEY[color];\n if (themeKey) {\n const resolved = theme.colors[themeKey];\n if (resolved) return resolved.startsWith('#') ? resolved.slice(1) : resolved;\n // Fall back to primary for unset optional colors\n warn(warnings, W.THEME_COLOR_FALLBACK, `Theme color \"${themeKey}\" not defined, falling back to primary`);\n return theme.colors.primary.startsWith('#') ? theme.colors.primary.slice(1) : theme.colors.primary;\n }\n // Not a semantic name — treat as literal hex\n const bare = color.startsWith('#') ? color.slice(1) : color;\n // Expand 3-char hex shorthand (e.g. 'FFF' → 'FFFFFF')\n if (/^[0-9A-Fa-f]{3}$/.test(bare)) {\n return bare[0] + bare[0] + bare[1] + bare[1] + bare[2] + bare[2];\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(bare)) {\n warn(warnings, W.UNKNOWN_COLOR, `Unknown color value: \"${color}\", treating as literal`);\n }\n return bare;\n}\n","/**\n * Text Component Renderer\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, StyleName, PipelineWarning, SlideContext } from '../types';\nimport { resolveColor } from '../utils/color';\n\ninterface TextComponentProps {\n text: string;\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n fontSize?: number;\n fontFace?: string;\n color?: string;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean | { style?: string; color?: string };\n strike?: boolean;\n align?: string;\n valign?: string;\n breakLine?: boolean;\n bullet?: boolean | { type?: string; style?: string; startAt?: number };\n margin?: number | number[];\n rotate?: number;\n shadow?: {\n type?: string;\n color?: string;\n blur?: number;\n offset?: number;\n angle?: number;\n opacity?: number;\n };\n fill?: { color: string; transparency?: number };\n hyperlink?: { url?: string; slide?: number; tooltip?: string };\n lineSpacing?: number;\n charSpacing?: number;\n paraSpaceBefore?: number;\n paraSpaceAfter?: number;\n style?: StyleName;\n}\n\nfunction resolvePagePlaceholders(text: string, ctx: SlideContext): string {\n const { slideNumber, totalSlides, pageNumberFormat } = ctx;\n const fmt = (n: number) => pageNumberFormat === '09'\n ? String(n).padStart(String(totalSlides).length, '0')\n : String(n);\n return text\n .replace(/\\{PAGE_NUMBER\\}/g, fmt(slideNumber))\n .replace(/\\{PAGE_COUNT\\}/g, fmt(totalSlides));\n}\n\nexport function renderTextComponent(\n slide: PptxGenJS.Slide,\n props: TextComponentProps,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[],\n slideCtx?: SlideContext\n): void {\n // Resolve named style as defaults\n const style = props.style ? theme.styles?.[props.style] : undefined;\n const isHeadingStyle = props.style && /^(title|heading)/.test(props.style);\n\n const opts: Record<string, unknown> = {};\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // When height is not explicitly set, provide a reasonable default based on\n // font size so that LibreOffice (which renders cy=\"0\" as blank) can display\n // the text. Also mark as textBox for proper auto-sizing in PowerPoint.\n if (props.h === undefined) {\n const fontSize = props.fontSize ?? theme.defaults.fontSize ?? 18;\n const lines = (props.text.match(/\\n/g)?.length ?? 0) + 1;\n opts.h = Math.max(0.5, (fontSize / 72) * 1.6 * lines);\n opts.isTextBox = true;\n }\n\n // Font — cascade: component props → style → theme defaults\n opts.fontSize = props.fontSize ?? style?.fontSize ?? theme.defaults.fontSize;\n opts.fontFace = props.fontFace ?? style?.fontFace ?? (isHeadingStyle ? theme.fonts.heading : theme.fonts.body);\n opts.color = resolveColor(props.color ?? style?.fontColor ?? theme.defaults.fontColor, theme, warnings);\n\n // Formatting\n const bold = props.bold ?? style?.bold;\n const italic = props.italic ?? style?.italic;\n if (bold != null) opts.bold = bold;\n if (italic != null) opts.italic = italic;\n if (props.strike) opts.strike = true;\n\n if (props.underline !== undefined) {\n if (typeof props.underline === 'boolean') {\n opts.underline = { style: 'sng' };\n } else {\n opts.underline = props.underline;\n }\n }\n\n // Alignment\n const align = props.align ?? style?.align;\n if (align) opts.align = align;\n opts.valign = props.valign ?? 'top';\n\n // Bullet\n if (props.bullet !== undefined) opts.bullet = props.bullet;\n\n // Margin — default to 0 so text aligns exactly to grid positions\n opts.margin = props.margin ?? 0;\n\n // Rotation\n if (props.rotate !== undefined) opts.rotate = props.rotate;\n\n // Shadow\n if (props.shadow) {\n opts.shadow = {\n type: props.shadow.type ?? 'outer',\n color: resolveColor(props.shadow.color ?? '000000', theme, warnings),\n blur: props.shadow.blur ?? 3,\n offset: props.shadow.offset ?? 3,\n angle: props.shadow.angle ?? 45,\n opacity: props.shadow.opacity ?? 0.5,\n };\n }\n\n // Fill\n if (props.fill) {\n opts.fill = { color: resolveColor(props.fill.color, theme, warnings) };\n if (props.fill.transparency !== undefined) {\n (opts.fill as Record<string, unknown>).transparency = props.fill.transparency;\n }\n }\n\n // Hyperlink\n if (props.hyperlink) {\n if (props.hyperlink.url) {\n opts.hyperlink = {\n url: props.hyperlink.url,\n tooltip: props.hyperlink.tooltip,\n };\n } else if (props.hyperlink.slide) {\n opts.hyperlink = {\n slide: props.hyperlink.slide,\n tooltip: props.hyperlink.tooltip,\n };\n }\n }\n\n // Line spacing\n const lineSpacing = props.lineSpacing ?? style?.lineSpacing;\n if (lineSpacing !== undefined) opts.lineSpacing = lineSpacing;\n const charSpacing = props.charSpacing ?? style?.charSpacing;\n if (charSpacing !== undefined) opts.charSpacing = charSpacing;\n if (props.paraSpaceBefore !== undefined) opts.paraSpaceBefore = props.paraSpaceBefore;\n const paraSpaceAfter = props.paraSpaceAfter ?? style?.paraSpaceAfter;\n if (paraSpaceAfter !== undefined) opts.paraSpaceAfter = paraSpaceAfter;\n\n // Break line handling\n if (props.breakLine) opts.breakLine = true;\n\n const text = slideCtx ? resolvePagePlaceholders(props.text, slideCtx) : props.text;\n slide.addText(text, opts as any);\n}\n","/**\n * Image Component Renderer\n */\n\nimport path from 'path';\nimport probe from 'probe-image-size';\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\n\n/** Block requests to private/loopback/link-local hosts. */\nfunction isPrivateUrl(urlStr: string): boolean {\n try {\n const { hostname } = new URL(urlStr);\n if (\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n hostname === '::1' ||\n hostname === '[::1]' ||\n hostname.startsWith('10.') ||\n hostname.startsWith('192.168.') ||\n hostname.startsWith('169.254.') ||\n hostname.endsWith('.local') ||\n hostname.endsWith('.internal')\n ) return true;\n if (hostname.startsWith('172.')) {\n const second = parseInt(hostname.split('.')[1], 10);\n if (second >= 16 && second <= 31) return true;\n }\n return false;\n } catch { return true; }\n}\n\ninterface ImageComponentProps {\n path?: string;\n base64?: string;\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n sizing?: { type: string; w?: number; h?: number };\n rotate?: number;\n rounding?: boolean;\n shadow?: {\n type?: string;\n color?: string;\n blur?: number;\n offset?: number;\n angle?: number;\n opacity?: number;\n };\n hyperlink?: { url?: string; slide?: number; tooltip?: string };\n alt?: string;\n}\n\n/**\n * Probe the intrinsic dimensions of an image (URL, file path, or base64).\n * Returns width/height in pixels, or undefined on failure.\n */\nasync function probeImageSize(\n imagePath: string,\n warnings?: PipelineWarning[]\n): Promise<{ width: number; height: number } | undefined> {\n try {\n if (/^data:image\\//.test(imagePath)) {\n const base64Data = imagePath.split(',')[1];\n if (!base64Data) return undefined;\n const buf = Buffer.from(base64Data, 'base64');\n const result = probe.sync(buf);\n return result ? { width: result.width, height: result.height } : undefined;\n }\n\n if (/^https?:\\/\\//.test(imagePath)) {\n if (isPrivateUrl(imagePath)) return undefined;\n const result = await probe(imagePath, { timeout: 5000 });\n return { width: result.width, height: result.height };\n }\n\n // Local file — restrict to CWD to prevent path traversal\n const resolved = path.resolve(imagePath);\n if (!resolved.startsWith(process.cwd())) return undefined;\n const { createReadStream } = await import('fs');\n const result = await probe(createReadStream(resolved));\n return result ? { width: result.width, height: result.height } : undefined;\n } catch (err) {\n warn(warnings, W.IMAGE_PROBE_FAILED, `Image probe failed: ${err instanceof Error ? err.message : String(err)}`, { component: 'image' });\n return undefined;\n }\n}\n\nexport async function renderImageComponent(\n slide: PptxGenJS.Slide,\n props: ImageComponentProps,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[]\n): Promise<void> {\n const opts: Record<string, unknown> = {};\n\n // Source\n if (props.path) {\n opts.path = props.path;\n } else if (props.base64) {\n opts.data = props.base64;\n } else {\n warn(warnings, W.IMAGE_NO_SOURCE, 'Image component missing both path and base64', { component: 'image' });\n return;\n }\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // Sizing — pptxgenjs's contain implementation produces negative srcRect\n // values when the image aspect ratio differs from the box, causing\n // stretching. We handle contain ourselves: probe intrinsic dimensions,\n // calculate fitted size, and center within the box. Cover is delegated to\n // pptxgenjs with correct intrinsic dimensions.\n if (props.sizing && (props.sizing.type === 'contain' || props.sizing.type === 'cover')) {\n const source = props.path || props.base64;\n const intrinsic = source ? await probeImageSize(source, warnings) : undefined;\n\n const boxW = Number(props.sizing.w ?? props.w);\n const boxH = Number(props.sizing.h ?? props.h);\n\n if (intrinsic && !isNaN(boxW) && !isNaN(boxH)) {\n const imgAspect = intrinsic.width / intrinsic.height;\n\n if (props.sizing.type === 'contain') {\n // Fit image inside box, preserving aspect ratio, centered\n const boxAspect = boxW / boxH;\n let fitW: number, fitH: number;\n if (imgAspect > boxAspect) {\n // Image is wider than box — width-limited\n fitW = boxW;\n fitH = boxW / imgAspect;\n } else {\n // Image is taller than box — height-limited\n fitH = boxH;\n fitW = boxH * imgAspect;\n }\n // Center within the box\n const baseX = Number(props.x ?? 0);\n const baseY = Number(props.y ?? 0);\n opts.x = baseX + (boxW - fitW) / 2;\n opts.y = baseY + (boxH - fitH) / 2;\n opts.w = fitW;\n opts.h = fitH;\n // No sizing — element is already the correct size\n } else {\n // Cover: pptxgenjs handles this correctly with real intrinsic dims\n opts.w = intrinsic.width;\n opts.h = intrinsic.height;\n opts.sizing = { type: 'cover', w: boxW, h: boxH };\n }\n } else {\n // Fallback: pass sizing through with w/h auto-filled from outer dims\n opts.sizing = { ...props.sizing, w: boxW, h: boxH };\n }\n } else if (props.sizing) {\n opts.sizing = {\n ...props.sizing,\n w: props.sizing.w ?? props.w,\n h: props.sizing.h ?? props.h,\n };\n }\n\n // Rotation\n if (props.rotate !== undefined) opts.rotate = props.rotate;\n\n // Rounding\n if (props.rounding) opts.rounding = true;\n\n // Shadow\n if (props.shadow) {\n opts.shadow = {\n type: props.shadow.type ?? 'outer',\n color: resolveColor(props.shadow.color ?? '000000', theme, warnings),\n blur: props.shadow.blur ?? 3,\n offset: props.shadow.offset ?? 3,\n angle: props.shadow.angle ?? 45,\n opacity: props.shadow.opacity ?? 0.5,\n };\n }\n\n // Hyperlink\n if (props.hyperlink) {\n if (props.hyperlink.url) {\n opts.hyperlink = {\n url: props.hyperlink.url,\n tooltip: props.hyperlink.tooltip,\n };\n } else if (props.hyperlink.slide) {\n opts.hyperlink = {\n slide: props.hyperlink.slide,\n tooltip: props.hyperlink.tooltip,\n };\n }\n }\n\n // Alt text\n if (props.alt) opts.altText = props.alt;\n\n slide.addImage(opts as any);\n}\n","/**\n * Shape Component Renderer\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, StyleName, PipelineWarning } from '../types';\nimport type { TextSegment } from '@json-to-office/shared-pptx';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\n\ninterface ShapeComponentProps {\n type: string;\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n fill?: { color: string; transparency?: number };\n line?: { color?: string; width?: number; dashType?: string };\n text?: string | TextSegment[];\n fontSize?: number;\n fontFace?: string;\n fontColor?: string;\n charSpacing?: number;\n bold?: boolean;\n italic?: boolean;\n align?: string;\n valign?: string;\n rotate?: number;\n shadow?: {\n type?: string;\n color?: string;\n blur?: number;\n offset?: number;\n angle?: number;\n opacity?: number;\n };\n rectRadius?: number;\n style?: StyleName;\n}\n\nconst SHAPE_TYPE_MAP: Record<string, string> = {\n rect: 'rect',\n roundRect: 'roundRect',\n ellipse: 'ellipse',\n triangle: 'triangle',\n diamond: 'diamond',\n pentagon: 'pentagon',\n hexagon: 'hexagon',\n star5: 'star5',\n star6: 'star6',\n line: 'line',\n arrow: 'rightArrow',\n chevron: 'chevron',\n cloud: 'cloud',\n heart: 'heart',\n lightning: 'lightningBolt',\n};\n\nfunction buildShapeOpts(\n props: ShapeComponentProps,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[]\n): Record<string, unknown> {\n const opts: Record<string, unknown> = {};\n\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n if (props.fill) {\n opts.fill = { color: resolveColor(props.fill.color, theme, warnings) };\n if (props.fill.transparency !== undefined) {\n (opts.fill as Record<string, unknown>).transparency = props.fill.transparency;\n }\n }\n\n if (props.line) {\n opts.line = {};\n if (props.line.color) (opts.line as Record<string, unknown>).color = resolveColor(props.line.color, theme, warnings);\n if (props.line.width) (opts.line as Record<string, unknown>).width = props.line.width;\n if (props.line.dashType) (opts.line as Record<string, unknown>).dashType = props.line.dashType;\n }\n\n if (props.rotate !== undefined) opts.rotate = props.rotate;\n if (props.rectRadius !== undefined) opts.rectRadius = props.rectRadius;\n\n if (props.shadow) {\n opts.shadow = {\n type: props.shadow.type ?? 'outer',\n color: resolveColor(props.shadow.color ?? '000000', theme, warnings),\n blur: props.shadow.blur ?? 3,\n offset: props.shadow.offset ?? 3,\n angle: props.shadow.angle ?? 45,\n opacity: props.shadow.opacity ?? 0.5,\n };\n }\n\n return opts;\n}\n\nexport function renderShapeComponent(\n slide: PptxGenJS.Slide,\n props: ShapeComponentProps,\n theme: PptxThemeConfig,\n pptx: PptxGenJS,\n warnings?: PipelineWarning[]\n): void {\n // Resolve shape type from pptxgenjs ShapeType enum\n const shapeTypeName = SHAPE_TYPE_MAP[props.type] || props.type;\n const shapeType = (pptx.ShapeType as Record<string, any>)[shapeTypeName];\n\n if (!shapeType) {\n warn(warnings, W.UNKNOWN_SHAPE, `Unknown shape type: ${props.type}`, { component: 'shape' });\n return;\n }\n\n // Resolve named style\n const style = props.style ? theme.styles?.[props.style] : undefined;\n const isHeadingStyle = props.style && /^(title|heading)/.test(props.style);\n\n const opts = buildShapeOpts(props, theme, warnings);\n\n // If shape has text, use addText with shape option\n if (props.text && (!Array.isArray(props.text) || props.text.length > 0)) {\n opts.shape = shapeType;\n\n opts.fontSize = props.fontSize ?? style?.fontSize ?? theme.defaults.fontSize;\n opts.fontFace = props.fontFace ?? style?.fontFace ?? (isHeadingStyle ? theme.fonts.heading : theme.fonts.body);\n opts.color = resolveColor(props.fontColor ?? style?.fontColor ?? theme.defaults.fontColor, theme, warnings);\n const bold = props.bold ?? style?.bold;\n const italic = props.italic ?? style?.italic;\n if (bold != null) opts.bold = bold;\n if (italic != null) opts.italic = italic;\n const charSpacing = props.charSpacing ?? style?.charSpacing;\n if (charSpacing !== undefined) opts.charSpacing = charSpacing;\n const align = props.align ?? style?.align;\n if (align) opts.align = align;\n opts.valign = props.valign ?? 'top';\n\n if (Array.isArray(props.text)) {\n const textSegments = props.text.map(seg => {\n const segOpts: Record<string, unknown> = {};\n if (seg.fontSize != null) segOpts.fontSize = seg.fontSize;\n if (seg.fontFace != null) segOpts.fontFace = seg.fontFace;\n if (seg.color != null) segOpts.color = resolveColor(seg.color, theme, warnings);\n if (seg.bold != null) segOpts.bold = seg.bold;\n if (seg.italic != null) segOpts.italic = seg.italic;\n if (seg.breakLine != null) segOpts.breakLine = seg.breakLine;\n if (seg.charSpacing != null) segOpts.charSpacing = seg.charSpacing;\n if (seg.spaceBefore != null) segOpts.paraSpaceBefore = seg.spaceBefore;\n if (seg.spaceAfter != null) segOpts.paraSpaceAfter = seg.spaceAfter;\n return { text: seg.text, options: segOpts };\n });\n slide.addText(textSegments, opts as any);\n } else {\n slide.addText(props.text, opts as any);\n }\n } else {\n // Pure shape without text\n slide.addShape(shapeType, opts as any);\n }\n}\n","/**\n * Table Component Renderer\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\n\n/**\n * Characters that PowerPoint may render as color emoji.\n * Appending VS15 (U+FE0E) forces text-mode rendering.\n */\nconst EMOJI_PRONE_CHARS = /[✓✔✗✘☐☑☒★☆●○■□▶◀▲▼⚡⚠❌❓❗]/gu;\n\nfunction applyTextVariationSelector(text: string): string {\n return text.replace(EMOJI_PRONE_CHARS, (ch) => ch + '\\uFE0E');\n}\n\ninterface TableCell {\n text: string;\n color?: string;\n fill?: string;\n fontSize?: number;\n fontFace?: string;\n bold?: boolean;\n italic?: boolean;\n align?: string;\n valign?: string;\n colspan?: number;\n rowspan?: number;\n margin?: number | number[];\n}\n\ninterface TableComponentProps {\n rows: (string | TableCell)[][];\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n colW?: number | number[];\n rowH?: number | number[];\n border?: { type?: string; pt?: number; color?: string };\n fill?: string;\n fontSize?: number;\n fontFace?: string;\n color?: string;\n align?: string;\n valign?: string;\n autoPage?: boolean;\n autoPageRepeatHeader?: boolean;\n margin?: number | number[];\n borderRadius?: number;\n}\n\nexport function renderTableComponent(\n slide: PptxGenJS.Slide,\n props: TableComponentProps,\n theme: PptxThemeConfig,\n pptx?: PptxGenJS,\n warnings?: PipelineWarning[]\n): void {\n // Pre-compute fills and width for borderRadius feature\n let bgFill: string | undefined;\n let headerFill: string | undefined;\n let borderRadiusTableW: number | undefined;\n if (props.borderRadius && pptx && props.rows.length >= 2) {\n const lastRow = props.rows[props.rows.length - 1];\n const lastCell = lastRow?.[0];\n bgFill = props.fill\n ? resolveColor(props.fill, theme, warnings)\n : (typeof lastCell === 'object' && lastCell.fill)\n ? resolveColor(lastCell.fill, theme, warnings)\n : 'FFFFFF';\n const firstCell = props.rows[0]?.[0];\n headerFill = (typeof firstCell === 'object' && firstCell.fill)\n ? resolveColor(firstCell.fill, theme, warnings)\n : bgFill;\n // Derive width from colW (actual cell widths) so shapes match the table exactly\n borderRadiusTableW = Array.isArray(props.colW)\n ? props.colW.reduce((sum, w) => sum + w, 0)\n : typeof props.colW === 'number'\n ? props.colW * (props.rows[0]?.length ?? 1) // assumes uniform column count\n : typeof props.w === 'number' ? props.w : 5;\n }\n\n // Pre-compute inner border for per-cell border assignment\n const innerBorder = props.border\n ? {\n type: props.border.type ?? 'solid',\n pt: props.border.pt ?? 1,\n color: resolveColor(props.border.color ?? '000000', theme, warnings),\n }\n : undefined;\n\n // Helper: build per-cell border array when borderRadius is active\n const buildBorderRadiusBorders = (rowIndex: number, colIndex: number, colCount: number) => {\n const isTop = rowIndex === 0;\n const isBottom = rowIndex === props.rows.length - 1;\n const isLeft = colIndex === 0;\n const isRight = colIndex === colCount - 1;\n const zeroBorder = { type: 'none', pt: 0 };\n const hInner = innerBorder ?? zeroBorder;\n return [\n (isTop || rowIndex === 1) ? zeroBorder : hInner, // top: outer + header-body seam\n isRight ? zeroBorder : hInner, // right\n (isBottom || rowIndex === 0) ? zeroBorder : hInner, // bottom: outer + header-body seam\n isLeft ? zeroBorder : hInner, // left\n ];\n };\n\n // Convert rows to pptxgenjs format\n const lastRowIdx = props.rows.length - 1;\n const tableRows = props.rows.map((row, rowIndex) =>\n row.map((cell, colIndex) => {\n const lastColIdx = row.length - 1;\n // Corner cells: first/last col of header or last row — transparent\n // so background roundRect shapes show rounded corners through them.\n // All other cells: opaque fill to prevent seam artifacts.\n const isCorner = bgFill &&\n (rowIndex === 0 || rowIndex === lastRowIdx) &&\n (colIndex === 0 || colIndex === lastColIdx);\n\n if (typeof cell === 'string') {\n if (!bgFill) return { text: applyTextVariationSelector(cell) };\n const isHeader = rowIndex === 0;\n const opts: Record<string, unknown> = {\n border: buildBorderRadiusBorders(rowIndex, colIndex, row.length),\n };\n if (!isCorner) opts.fill = { color: isHeader ? headerFill : bgFill };\n return { text: applyTextVariationSelector(cell), options: opts };\n }\n const cellOpts: Record<string, unknown> = {};\n if (cell.color) cellOpts.color = resolveColor(cell.color, theme, warnings);\n if (bgFill) {\n const isHeader = rowIndex === 0;\n if (!isCorner) {\n const resolvedFill = cell.fill ? resolveColor(cell.fill, theme, warnings) : (isHeader ? headerFill : bgFill);\n cellOpts.fill = { color: resolvedFill };\n }\n cellOpts.border = buildBorderRadiusBorders(rowIndex, colIndex, row.length);\n } else if (cell.fill) {\n cellOpts.fill = { color: resolveColor(cell.fill, theme, warnings) };\n }\n if (cell.fontSize) cellOpts.fontSize = cell.fontSize;\n if (cell.fontFace) cellOpts.fontFace = cell.fontFace;\n if (cell.bold) cellOpts.bold = true;\n if (cell.italic) cellOpts.italic = true;\n if (cell.align) cellOpts.align = cell.align;\n if (cell.valign) cellOpts.valign = cell.valign;\n if (cell.colspan) cellOpts.colspan = cell.colspan;\n if (cell.rowspan) cellOpts.rowspan = cell.rowspan;\n if (cell.margin !== undefined) cellOpts.margin = cell.margin;\n\n return { text: applyTextVariationSelector(cell.text), options: cellOpts };\n })\n );\n\n const opts: Record<string, unknown> = {};\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // Column/row sizing\n if (props.colW !== undefined) opts.colW = props.colW;\n if (props.rowH !== undefined) opts.rowH = props.rowH;\n\n // Border — skip table-level border when borderRadius is active (per-cell borders handle it)\n if (props.border && !bgFill) {\n opts.border = {\n type: props.border.type ?? 'solid',\n pt: props.border.pt ?? 1,\n color: resolveColor(props.border.color ?? '000000', theme, warnings),\n };\n }\n\n // Fill\n if (props.fill) opts.fill = { color: resolveColor(props.fill, theme, warnings) };\n\n // Font defaults\n opts.fontSize = props.fontSize ?? theme.defaults.fontSize;\n opts.fontFace = props.fontFace ?? theme.fonts.body;\n if (props.color) opts.color = resolveColor(props.color, theme, warnings);\n\n // Alignment\n if (props.align) opts.align = props.align;\n opts.valign = props.valign ?? 'middle';\n\n // Auto-paging\n if (props.autoPage) opts.autoPage = true;\n if (props.autoPageRepeatHeader) {\n opts.autoPageRepeatHeader = true;\n opts.autoPageHeaderRows = 1;\n }\n\n // Margin\n if (props.margin !== undefined) opts.margin = props.margin;\n\n // Background roundRect shapes — placed BEFORE the table.\n // Corner cells are transparent so these shapes show through at the corners.\n // Non-corner cells are opaque to prevent seam artifacts.\n if (props.borderRadius && pptx && typeof props.x === 'number' && typeof props.y === 'number') {\n let tableH: number = (props.h as number) ?? 2;\n if (typeof props.rowH === 'number') {\n tableH = props.rowH * props.rows.length;\n } else if (Array.isArray(props.rowH)) {\n tableH = props.rowH.reduce((sum, h) => sum + h, 0);\n }\n const headerH = typeof props.rowH === 'number'\n ? props.rowH\n : Array.isArray(props.rowH)\n ? props.rowH[0]\n : 0.45;\n const tableW = borderRadiusTableW!;\n // Suppress shape outlines completely\n const noLine = { type: 'none' };\n\n // Header roundRect (rounded top corners)\n slide.addShape(pptx.ShapeType.roundRect, {\n x: props.x, y: props.y, w: tableW, h: headerH,\n fill: { color: headerFill }, rectRadius: props.borderRadius, line: noLine,\n } as any);\n // Header flat rect — covers the rounded bottom corners of header\n slide.addShape(pptx.ShapeType.rect, {\n x: props.x,\n y: (props.y as number) + headerH - props.borderRadius,\n w: tableW, h: props.borderRadius,\n fill: { color: headerFill }, line: noLine,\n } as any);\n\n // Body roundRect (rounded bottom corners)\n const bodyY = (props.y as number) + headerH;\n const bodyH = tableH - headerH;\n slide.addShape(pptx.ShapeType.roundRect, {\n x: props.x, y: bodyY, w: tableW, h: bodyH,\n fill: { color: bgFill }, rectRadius: props.borderRadius, line: noLine,\n } as any);\n // Body flat rect — covers the rounded top corners of body\n slide.addShape(pptx.ShapeType.rect, {\n x: props.x, y: bodyY, w: tableW, h: props.borderRadius,\n fill: { color: bgFill }, line: noLine,\n } as any);\n }\n\n // When borderRadius is active, override opts.w to match colW sum\n // and suppress any table-level border/outline\n if (bgFill && borderRadiusTableW !== undefined) {\n opts.w = borderRadiusTableW;\n opts.border = [{ type: 'none' }, { type: 'none' }, { type: 'none' }, { type: 'none' }];\n }\n\n slide.addTable(tableRows as any, opts as any);\n}\n","/**\n * Environment detection utilities\n */\n\n/**\n * Check if the current environment is Node.js\n */\nexport function isNodeEnvironment(): boolean {\n return (\n typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null &&\n typeof process.versions.node === 'string'\n );\n}\n","/**\n * Highcharts Component Renderer (PPTX)\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport type { PptxHighchartsProps } from '@json-to-office/shared-pptx';\nimport { isNodeEnvironment } from '../utils/environment';\n\nconst PX_PER_INCH = 96;\nconst DEFAULT_EXPORT_SERVER_URL = 'http://localhost:7801';\n\nfunction getExportServerUrl(propsUrl?: string): string {\n return propsUrl || process.env.HIGHCHARTS_SERVER_URL || DEFAULT_EXPORT_SERVER_URL;\n}\n\n/**\n * Generate chart via Highcharts Export Server\n */\nasync function generateChart(\n config: PptxHighchartsProps\n): Promise<{ base64DataUri: string; width: number; height: number }> {\n if (!isNodeEnvironment()) {\n throw new Error(\n 'Highcharts export server requires a Node.js environment. ' +\n 'Chart generation is not available in browser environments.'\n );\n }\n\n const serverUrl = getExportServerUrl(config.serverUrl);\n\n const response = await fetch(`${serverUrl}/export`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n infile: config.options,\n type: 'png',\n b64: true,\n scale: config.scale,\n }),\n }).catch((error) => {\n throw new Error(\n `Highcharts Export Server is not running at ${serverUrl}. ` +\n 'Start it with: npx highcharts-export-server --enableServer true\\n' +\n `Cause: ${error instanceof Error ? error.message : String(error)}`\n );\n });\n\n if (!response.ok) {\n throw new Error(\n `Highcharts export server returned ${response.status}: ${response.statusText}`\n );\n }\n\n const base64Data = await response.text();\n\n return {\n base64DataUri: `data:image/png;base64,${base64Data}`,\n width: config.options.chart?.width ?? 960,\n height: config.options.chart?.height ?? 720,\n };\n}\n\nexport async function renderHighchartsComponent(\n slide: PptxGenJS.Slide,\n props: PptxHighchartsProps,\n _theme: PptxThemeConfig,\n _warnings?: PipelineWarning[]\n): Promise<void> {\n const chart = await generateChart(props);\n\n const w = props.w ?? chart.width / PX_PER_INCH;\n const h = props.h ?? chart.height / PX_PER_INCH;\n\n slide.addImage({\n data: chart.base64DataUri,\n x: props.x ?? 0,\n y: props.y ?? 0,\n w,\n h,\n } as any);\n}\n","/**\n * Chart Component Renderer — native PowerPoint charts via pptxgenjs slide.addChart()\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\n\ninterface ChartDataSeries {\n name?: string;\n labels?: string[];\n values?: number[];\n sizes?: number[];\n}\n\ninterface ChartComponentProps {\n type: string;\n data: ChartDataSeries[];\n\n showLegend?: boolean;\n showTitle?: boolean;\n showValue?: boolean;\n showPercent?: boolean;\n showLabel?: boolean;\n showSerName?: boolean;\n\n title?: string;\n titleFontSize?: number;\n titleColor?: string;\n titleFontFace?: string;\n\n chartColors?: string[];\n\n legendPos?: string;\n legendFontSize?: number;\n legendFontFace?: string;\n legendColor?: string;\n\n catAxisTitle?: string;\n catAxisHidden?: boolean;\n catAxisLabelRotate?: number;\n catAxisLabelFontSize?: number;\n catAxisLabelColor?: string;\n\n valAxisTitle?: string;\n valAxisHidden?: boolean;\n valAxisMinVal?: number;\n valAxisMaxVal?: number;\n valAxisLabelFormatCode?: string;\n valAxisMajorUnit?: number;\n valAxisLabelColor?: string;\n\n barDir?: string;\n barGrouping?: string;\n barGapWidthPct?: number;\n\n lineSmooth?: boolean;\n lineDataSymbol?: string;\n lineSize?: number;\n\n firstSliceAng?: number;\n holeSize?: number;\n\n radarStyle?: string;\n\n dataLabelColor?: string;\n dataLabelFontSize?: number;\n dataLabelFontFace?: string;\n dataLabelFontBold?: boolean;\n dataLabelPosition?: string;\n\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n}\n\n// Map our type strings to pptxgenjs CHART_NAME values\nconst CHART_TYPE_MAP: Record<string, string> = {\n area: 'area',\n bar: 'bar',\n bar3D: 'bar3D',\n bubble: 'bubble',\n doughnut: 'doughnut',\n line: 'line',\n pie: 'pie',\n radar: 'radar',\n scatter: 'scatter',\n};\n\nconst DEFAULT_THEME_COLORS = ['primary', 'secondary', 'accent', 'accent4', 'accent5', 'accent6'];\n\nexport function renderChartComponent(\n slide: PptxGenJS.Slide,\n props: ChartComponentProps,\n theme: PptxThemeConfig,\n _pptx: PptxGenJS,\n warnings?: PipelineWarning[]\n): void {\n const chartType = CHART_TYPE_MAP[props.type];\n if (!chartType) {\n warn(warnings, W.UNKNOWN_CHART_TYPE, `Unknown chart type: ${props.type}`, { component: 'chart' });\n return;\n }\n\n // Validate data\n if (!props.data || props.data.length === 0) {\n warn(warnings, W.CHART_NO_DATA, 'Chart component has no data series', { component: 'chart' });\n return;\n }\n for (const series of props.data) {\n if (!series.labels || !series.values) {\n warn(warnings, W.CHART_INVALID_SERIES, `Chart series \"${series.name ?? '(unnamed)'}\" missing labels or values`, { component: 'chart' });\n return;\n }\n }\n if ((chartType === 'pie' || chartType === 'doughnut') && props.data.length > 1) {\n warn(warnings, W.CHART_MULTI_SERIES, `${props.type} chart has ${props.data.length} series — only the first will render`, { component: 'chart' });\n }\n\n // Build data array\n const data = props.data.map((series) => {\n const d: Record<string, unknown> = {};\n if (series.name !== undefined) d.name = series.name;\n if (series.labels) d.labels = series.labels;\n if (series.values) d.values = series.values;\n if (series.sizes) d.sizes = series.sizes;\n return d;\n });\n\n // Build chart options\n const opts: Record<string, unknown> = {};\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // Colors — resolve semantic names to hex\n const colorSources = props.chartColors ?? DEFAULT_THEME_COLORS;\n opts.chartColors = colorSources.map((c) => resolveColor(c, theme, warnings));\n\n // Auto-default chart text colors from theme to prevent dark-on-dark / light-on-light\n const themeTextColor = resolveColor('text', theme, warnings);\n opts.titleColor = props.titleColor ? resolveColor(props.titleColor, theme, warnings) : themeTextColor;\n opts.legendColor = props.legendColor ? resolveColor(props.legendColor, theme, warnings) : themeTextColor;\n opts.catAxisLabelColor = props.catAxisLabelColor ? resolveColor(props.catAxisLabelColor, theme, warnings) : themeTextColor;\n opts.valAxisLabelColor = props.valAxisLabelColor ? resolveColor(props.valAxisLabelColor, theme, warnings) : themeTextColor;\n\n // Display toggles\n if (props.showLegend !== undefined) opts.showLegend = props.showLegend;\n if (props.showTitle !== undefined) opts.showTitle = props.showTitle;\n if (props.showValue !== undefined) opts.showValue = props.showValue;\n if (props.showPercent !== undefined) opts.showPercent = props.showPercent;\n if (props.showLabel !== undefined) opts.showLabel = props.showLabel;\n if (props.showSerName !== undefined) opts.showSerName = props.showSerName;\n\n // Title\n if (props.title !== undefined) opts.title = props.title;\n if (props.titleFontSize !== undefined) opts.titleFontSize = props.titleFontSize;\n if (props.titleFontFace !== undefined) opts.titleFontFace = props.titleFontFace;\n\n // Legend\n if (props.legendPos !== undefined) opts.legendPos = props.legendPos;\n if (props.legendFontSize !== undefined) opts.legendFontSize = props.legendFontSize;\n if (props.legendFontFace !== undefined) opts.legendFontFace = props.legendFontFace;\n\n // Category axis\n if (props.catAxisTitle !== undefined) {\n opts.catAxisTitle = props.catAxisTitle;\n opts.showCatAxisTitle = true;\n }\n if (props.catAxisHidden !== undefined) opts.catAxisHidden = props.catAxisHidden;\n if (props.catAxisLabelRotate !== undefined) opts.catAxisLabelRotate = props.catAxisLabelRotate;\n if (props.catAxisLabelFontSize !== undefined) opts.catAxisLabelFontSize = props.catAxisLabelFontSize;\n\n // Value axis\n if (props.valAxisTitle !== undefined) {\n opts.valAxisTitle = props.valAxisTitle;\n opts.showValAxisTitle = true;\n }\n if (props.valAxisHidden !== undefined) opts.valAxisHidden = props.valAxisHidden;\n if (props.valAxisMinVal !== undefined) opts.valAxisMinVal = props.valAxisMinVal;\n if (props.valAxisMaxVal !== undefined) opts.valAxisMaxVal = props.valAxisMaxVal;\n if (props.valAxisLabelFormatCode !== undefined) opts.valAxisLabelFormatCode = props.valAxisLabelFormatCode;\n if (props.valAxisMajorUnit !== undefined) opts.valAxisMajorUnit = props.valAxisMajorUnit;\n\n // Bar-specific\n if (props.barDir !== undefined) opts.barDir = props.barDir;\n if (props.barGrouping !== undefined) opts.barGrouping = props.barGrouping;\n if (props.barGapWidthPct !== undefined) opts.barGapWidthPct = props.barGapWidthPct;\n\n // Line-specific\n if (props.lineSmooth !== undefined) opts.lineSmooth = props.lineSmooth;\n if (props.lineDataSymbol !== undefined) opts.lineDataSymbol = props.lineDataSymbol;\n if (props.lineSize !== undefined) opts.lineSize = props.lineSize;\n\n // Pie/doughnut\n if (props.firstSliceAng !== undefined) opts.firstSliceAng = props.firstSliceAng;\n if (props.holeSize !== undefined) opts.holeSize = props.holeSize;\n\n // Radar\n if (props.radarStyle !== undefined) opts.radarStyle = props.radarStyle;\n\n // Data labels\n opts.dataLabelColor = props.dataLabelColor ? resolveColor(props.dataLabelColor, theme, warnings) : themeTextColor;\n if (props.dataLabelFontSize !== undefined) opts.dataLabelFontSize = props.dataLabelFontSize;\n if (props.dataLabelFontFace !== undefined) opts.dataLabelFontFace = props.dataLabelFontFace;\n if (props.dataLabelFontBold !== undefined) opts.dataLabelFontBold = props.dataLabelFontBold;\n if (props.dataLabelPosition !== undefined) opts.dataLabelPosition = props.dataLabelPosition;\n\n slide.addChart(chartType as any, data as any[], opts as any);\n}\n","/**\n * PPTX Component Renderers\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PptxComponentInput, PipelineWarning, SlideContext } from '../types';\nimport { warn, W } from '../utils/warn';\nimport { renderTextComponent } from './text';\nimport { renderImageComponent } from './image';\nimport { renderShapeComponent } from './shape';\nimport { renderTableComponent } from './table';\nimport { renderHighchartsComponent } from './highcharts';\nimport { renderChartComponent } from './chart';\n\nexport { renderTextComponent } from './text';\nexport { renderImageComponent } from './image';\nexport { renderShapeComponent } from './shape';\nexport { renderTableComponent } from './table';\nexport { renderHighchartsComponent } from './highcharts';\nexport { renderChartComponent } from './chart';\n\nexport async function renderComponent(\n slide: PptxGenJS.Slide,\n component: PptxComponentInput,\n theme: PptxThemeConfig,\n pptx: PptxGenJS,\n warnings?: PipelineWarning[],\n slideCtx?: SlideContext\n): Promise<void> {\n if (component.enabled === false) return;\n\n const { name, props } = component;\n const p = props as any;\n\n switch (name) {\n case 'text':\n renderTextComponent(slide, p, theme, warnings, slideCtx);\n break;\n case 'image':\n await renderImageComponent(slide, p, theme, warnings);\n break;\n case 'shape':\n renderShapeComponent(slide, p, theme, pptx, warnings);\n break;\n case 'table':\n renderTableComponent(slide, p, theme, pptx, warnings);\n break;\n case 'highcharts':\n await renderHighchartsComponent(slide, p, theme, warnings);\n break;\n case 'chart':\n renderChartComponent(slide, p, theme, pptx, warnings);\n break;\n default:\n warn(warnings, W.UNKNOWN_COMPONENT, `Unknown PPTX component type: ${name}`, { component: name });\n }\n}\n","/**\n * Template Slide Builder\n * Converts internal TemplateSlideDefinition to pptxgenjs SlideMasterProps\n *\n * Fixed objects (shapes, text, images) are no longer rendered here — they use\n * the unified component pipeline and are rendered per-slide in render.ts.\n */\n\nimport type { TemplateSlideDefinition, PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\n\nexport function buildSlideTemplateProps(\n def: TemplateSlideDefinition,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[]\n): Record<string, any> {\n const result: Record<string, any> = { title: def.name };\n\n // Background\n if (def.background) {\n if (def.background.color) {\n result.background = { color: resolveColor(def.background.color, theme, warnings) };\n } else if (def.background.image) {\n if (def.background.image.path) {\n result.background = { path: def.background.image.path };\n } else if (def.background.image.base64) {\n result.background = { data: def.background.image.base64 };\n }\n }\n }\n\n // Margin\n if (def.margin !== undefined) result.margin = def.margin;\n\n // Slide number\n if (def.slideNumber) {\n result.slideNumber = {\n x: def.slideNumber.x,\n y: def.slideNumber.y,\n };\n if (def.slideNumber.w !== undefined) result.slideNumber.w = def.slideNumber.w;\n if (def.slideNumber.h !== undefined) result.slideNumber.h = def.slideNumber.h;\n if (def.slideNumber.color) result.slideNumber.color = resolveColor(def.slideNumber.color, theme, warnings);\n if (def.slideNumber.fontSize) result.slideNumber.fontSize = def.slideNumber.fontSize;\n }\n\n return result;\n}\n","// Version information\nexport function getPptxCoreVersion(): string {\n return 'PptxCore v1.0.0';\n}\n\n// Core API\nexport {\n generatePresentation,\n generateBufferFromJson,\n generateBufferWithWarnings,\n generateAndSaveFromJson,\n generateFromFile,\n savePresentation,\n isPresentationComponentDefinition,\n PresentationGenerator,\n} from './core/generator';\n\nexport type { GenerationOptions, GenerationResult } from './core/generator';\n\n// Types\nexport type {\n PptxComponentInput,\n PresentationComponentDefinition,\n SlideComponentDefinition,\n ProcessedPresentation,\n ProcessedSlide,\n PptxThemeConfig,\n PipelineWarning,\n SlideContext,\n} from './types';\n\nexport { isPresentationComponent, isSlideComponent } from './types';\n\n// Warning utilities\nexport { W as WarningCodes } from './utils/warn';\nexport type { WarningCode } from './utils/warn';\n\n// Themes\nexport { DEFAULT_PPTX_THEME, getPptxTheme, pptxThemes } from './themes';\n\n// Component renderers\nexport {\n renderTextComponent,\n renderImageComponent,\n renderShapeComponent,\n renderTableComponent,\n renderHighchartsComponent,\n renderComponent,\n} from './components';\n"],"mappings":";AAMA,OAAO,WAAW;AAClB,SAAS,qBAAqB;;;AC+JvB,SAAS,wBACd,WAC8C;AAC9C,SACE,OAAO,cAAc,YACrB,cAAc,QACb,UAAkB,SAAS;AAEhC;AAEO,SAAS,iBACd,WACuC;AACvC,SACE,OAAO,cAAc,YACrB,cAAc,QACb,UAAkB,SAAS;AAEhC;;;ACtLO,IAAM,IAAI;AAAA,EACf,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,q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AAM,UAAU;AAChD;AAMA,IAAM,0BAA0B;AAChC,IAAM,mBAAmB;AAEzB,eAAe,qBAAqB,QAAiC;AACnE,QAAM,MAAM,MAAM,MAAM,UAAU,MAAM;AACxC,MAAI,UAAU;AACd,aAAW,CAACC,OAAM,KAAK,KAAK,OAAO,QAAQ,IAAI,KAAK,GAAG;AACrD,QAAI,CAACA,MAAK,MAAM,8BAA8B,EAAG;AACjD,UAAM,MAAM,MAAM,MAAM,MAAM,QAAQ;AACtC,QAAI,IAAI,SAAS,uBAAuB,GAAG;AACzC,UAAI,KAAKA,OAAM,IAAI,WAAW,yBAAyB,gBAAgB,CAAC;AACxE,gBAAU;AAAA,IACZ;AAAA,EACF;AACA,SAAO,UAAU,MAAM,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC,IAAc;AAC/E;AAKA,eAAsB,iBACpB,MACA,YACe;AACf,QAAM,OAAO,MAAM,KAAK,MAAM,EAAE,YAAY,aAAa,CAAC;AAC1D,QAAM,SAAS,MAAM,qBAAqB,IAAc;AACxD,gBAAc,YAAY,MAAM;AAClC;AAKO,IAAM,wBAAwB;AAAA,EACnC,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAM;AAAA,EACN;AACF;;;AiB/JO,SAAS,qBAA6B;AAC3C,SAAO;AACT;","names":["result","opts","path"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/generator.ts","../src/types.ts","../src/utils/warn.ts","../src/core/grid.ts","../src/themes/defaults.ts","../src/core/structure.ts","../src/core/render.ts","../src/utils/color.ts","../src/components/text.ts","../src/components/image.ts","../src/components/shape.ts","../src/components/table.ts","../src/utils/environment.ts","../src/components/highcharts.ts","../src/components/chart.ts","../src/components/index.ts","../src/core/template.ts","../src/plugin/index.ts","../src/plugin/createPresentationGenerator.ts","../src/plugin/validation.ts","../src/plugin/schema.ts","../src/index.ts"],"sourcesContent":["/**\n * Presentation Generator\n * Main orchestration functions for the PPTX generation pipeline\n */\n\nimport PptxGenJS from 'pptxgenjs';\nimport JSZip from 'jszip';\nimport { writeFileSync } from 'fs';\nimport type { PresentationComponentDefinition, PptxThemeConfig, PipelineWarning } from '../types';\nimport { isPresentationComponent } from '../types';\nimport { processPresentation } from './structure';\nimport { renderPresentation } from './render';\n\n/**\n * Options for the generation pipeline\n */\nexport interface GenerationOptions {\n customThemes?: Record<string, PptxThemeConfig>;\n}\n\n/**\n * Result from generateBufferWithWarnings\n */\nexport interface GenerationResult {\n buffer: Buffer;\n warnings: PipelineWarning[];\n}\n\n/**\n * Type guard for presentation component\n */\nexport function isPresentationComponentDefinition(\n definition: unknown\n): definition is PresentationComponentDefinition {\n if (typeof definition !== 'object' || definition === null) return false;\n const def = definition as Record<string, unknown>;\n return def.name === 'pptx' && 'props' in def;\n}\n\n/**\n * Generate a PptxGenJS instance from a presentation component definition\n */\nexport async function generatePresentation(\n document: PresentationComponentDefinition,\n options?: GenerationOptions,\n warnings?: PipelineWarning[]\n): Promise<PptxGenJS> {\n if (!document || document.name !== 'pptx') {\n throw new Error('Top-level component must be a pptx component');\n }\n\n const processed = processPresentation(document, options);\n return await renderPresentation(processed, warnings);\n}\n\n/**\n * Generate a buffer from JSON definition\n */\nexport async function generateBufferFromJson(\n jsonConfig: string | PresentationComponentDefinition,\n options?: GenerationOptions\n): Promise<Buffer> {\n const result = await generateBufferWithWarnings(jsonConfig, options);\n return result.buffer;\n}\n\n/**\n * Generate a buffer from JSON definition, returning warnings alongside the buffer\n */\nexport async function generateBufferWithWarnings(\n jsonConfig: string | PresentationComponentDefinition,\n options?: GenerationOptions\n): Promise<GenerationResult> {\n let component: PresentationComponentDefinition;\n\n if (typeof jsonConfig === 'string') {\n const parsed = JSON.parse(jsonConfig);\n if (!isPresentationComponent(parsed)) {\n throw new Error('Parsed JSON must be a presentation component');\n }\n component = parsed;\n } else {\n component = jsonConfig;\n }\n\n const warnings: PipelineWarning[] = [];\n const pptx = await generatePresentation(component, options, warnings);\n const data = await pptx.write({ outputType: 'nodebuffer' });\n const buffer = await neutralizeTableStyle(data as Buffer);\n return { buffer, warnings };\n}\n\n/**\n * Generate and save a .pptx file from JSON definition\n */\nexport async function generateAndSaveFromJson(\n jsonConfig: string | PresentationComponentDefinition,\n outputPath: string,\n options?: GenerationOptions\n): Promise<void> {\n const buffer = await generateBufferFromJson(jsonConfig, options);\n writeFileSync(outputPath, buffer);\n}\n\n/**\n * Generate from a JSON file path\n */\nexport async function generateFromFile(\n filePath: string,\n outputPath: string\n): Promise<void> {\n const { readFileSync } = await import('fs');\n const json = readFileSync(filePath, 'utf-8');\n await generateAndSaveFromJson(json, outputPath);\n}\n\n/**\n * Replace the default table style (Medium Style 2 - Accent 1, which applies allCaps\n * to headers) with \"No Style, No Grid\" so table text renders as authored.\n */\nconst MEDIUM_STYLE_2_ACCENT_1 = '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}';\nconst NO_STYLE_NO_GRID = '{2D5ABB26-0587-4C30-8999-92F81FD0307C}';\n\nasync function neutralizeTableStyle(buffer: Buffer): Promise<Buffer> {\n const zip = await JSZip.loadAsync(buffer);\n let changed = false;\n for (const [path, entry] of Object.entries(zip.files)) {\n if (!path.match(/^ppt\\/slides\\/slide\\d+\\.xml$/)) continue;\n const xml = await entry.async('string');\n if (xml.includes(MEDIUM_STYLE_2_ACCENT_1)) {\n zip.file(path, xml.replaceAll(MEDIUM_STYLE_2_ACCENT_1, NO_STYLE_NO_GRID));\n changed = true;\n }\n }\n return changed ? await zip.generateAsync({ type: 'nodebuffer' }) as Buffer : buffer;\n}\n\n/**\n * Save a PptxGenJS instance to file\n */\nexport async function savePresentation(\n pptx: PptxGenJS,\n outputPath: string\n): Promise<void> {\n const data = await pptx.write({ outputType: 'nodebuffer' });\n const buffer = await neutralizeTableStyle(data as Buffer);\n writeFileSync(outputPath, buffer);\n}\n\n/**\n * Export the main API\n */\nexport const PresentationGenerator = {\n generate: generatePresentation,\n generateBufferFromJson,\n generateBufferWithWarnings,\n generateAndSaveFromJson,\n generateFromFile,\n save: savePresentation,\n isPresentationComponentDefinition,\n};\n","/**\n * PPTX Core Types\n */\n\nexport interface PptxComponentInput {\n name: string;\n id?: string;\n enabled?: boolean;\n props: Record<string, any>;\n children?: PptxComponentInput[];\n}\n\nexport interface PresentationComponentDefinition {\n name: 'pptx';\n $schema?: string;\n id?: string;\n props: {\n title?: string;\n author?: string;\n subject?: string;\n company?: string;\n theme?: string;\n slideWidth?: number;\n slideHeight?: number;\n rtlMode?: boolean;\n pageNumberFormat?: '9' | '09';\n grid?: GridConfig;\n templates?: TemplateSlideDefinition[];\n };\n children?: PptxComponentInput[];\n}\n\nexport interface SlideComponentDefinition {\n name: 'slide';\n id?: string;\n props: {\n background?: {\n color?: string;\n image?: { path?: string; base64?: string };\n };\n transition?: {\n type?: string;\n speed?: string;\n };\n notes?: string;\n layout?: string;\n hidden?: boolean;\n template?: string;\n placeholders?: Record<string, PptxComponentInput>;\n };\n children?: PptxComponentInput[];\n}\n\nexport interface ProcessedPresentation {\n metadata: {\n title?: string;\n author?: string;\n subject?: string;\n company?: string;\n };\n theme: PptxThemeConfig;\n grid?: GridConfig;\n slideWidth: number;\n slideHeight: number;\n rtlMode: boolean;\n pageNumberFormat: '9' | '09';\n slides: ProcessedSlide[];\n templates?: TemplateSlideDefinition[];\n}\n\nexport interface ProcessedSlide {\n components: PptxComponentInput[];\n background?: {\n color?: string;\n image?: { path?: string; base64?: string };\n };\n notes?: string;\n layout?: string;\n hidden?: boolean;\n template?: string;\n placeholders?: Record<string, PptxComponentInput>;\n}\n\nexport interface GridConfig {\n columns?: number;\n rows?: number;\n margin?: number | { top: number; right: number; bottom: number; left: number };\n gutter?: number | { column: number; row: number };\n}\n\nexport interface GridPosition {\n column: number;\n row: number;\n columnSpan?: number;\n rowSpan?: number;\n}\n\nexport interface TextStyle {\n fontSize?: number;\n fontFace?: string;\n fontColor?: string;\n bold?: boolean;\n italic?: boolean;\n align?: string;\n lineSpacing?: number;\n charSpacing?: number;\n paraSpaceAfter?: number;\n}\n\nexport type StyleName = 'title' | 'subtitle' | 'heading1' | 'heading2' | 'heading3' | 'body' | 'caption';\n\nexport interface PptxThemeConfig {\n name: string;\n colors: {\n primary: string;\n secondary: string;\n accent: string;\n background: string;\n text: string;\n text2?: string;\n background2?: string;\n accent4?: string;\n accent5?: string;\n accent6?: string;\n };\n fonts: {\n heading: string;\n body: string;\n };\n defaults: {\n fontSize: number;\n fontColor: string;\n };\n styles?: Partial<Record<StyleName, TextStyle>>;\n}\n\nexport interface PlaceholderDefinition {\n name: string;\n x?: number; y?: number; w?: number; h?: number;\n grid?: GridPosition;\n defaults?: PptxComponentInput;\n}\n\nexport interface TemplateSlideDefinition {\n name: string;\n background?: { color?: string; image?: { path?: string; base64?: string } };\n margin?: number | [number, number, number, number];\n slideNumber?: { x: number; y: number; w?: number; h?: number; color?: string; fontSize?: number };\n objects?: PptxComponentInput[];\n placeholders?: PlaceholderDefinition[];\n grid?: GridConfig;\n}\n\nexport interface SlideContext {\n slideNumber: number;\n totalSlides: number;\n pageNumberFormat: '9' | '09';\n}\n\nexport interface PipelineWarning {\n code: string; // WarningCode at call sites; string here to avoid circular import\n message: string;\n component?: string;\n slide?: number;\n}\n\nexport function isPresentationComponent(\n component: unknown\n): component is PresentationComponentDefinition {\n return (\n typeof component === 'object' &&\n component !== null &&\n (component as any).name === 'pptx'\n );\n}\n\nexport function isSlideComponent(\n component: unknown\n): component is SlideComponentDefinition {\n return (\n typeof component === 'object' &&\n component !== null &&\n (component as any).name === 'slide'\n );\n}\n","import type { PipelineWarning } from '../types';\n\nexport const W = {\n UNKNOWN_COMPONENT: 'UNKNOWN_COMPONENT',\n UNKNOWN_CHART_TYPE: 'UNKNOWN_CHART_TYPE',\n UNKNOWN_SHAPE: 'UNKNOWN_SHAPE',\n CHART_NO_DATA: 'CHART_NO_DATA',\n CHART_INVALID_SERIES: 'CHART_INVALID_SERIES',\n CHART_MULTI_SERIES: 'CHART_MULTI_SERIES',\n IMAGE_NO_SOURCE: 'IMAGE_NO_SOURCE',\n IMAGE_PROBE_FAILED: 'IMAGE_PROBE_FAILED',\n MISSING_TEMPLATE: 'MISSING_TEMPLATE',\n UNKNOWN_PLACEHOLDER: 'UNKNOWN_PLACEHOLDER',\n PLACEHOLDER_NO_POSITION: 'PLACEHOLDER_NO_POSITION',\n THEME_COLOR_FALLBACK: 'THEME_COLOR_FALLBACK',\n UNKNOWN_COLOR: 'UNKNOWN_COLOR',\n GRID_POSITION_CLAMPED: 'GRID_POSITION_CLAMPED',\n} as const;\n\nexport type WarningCode = typeof W[keyof typeof W];\n\nexport function warn(\n warnings: PipelineWarning[] | undefined,\n code: WarningCode,\n message: string,\n extra?: Partial<PipelineWarning>\n): void {\n if (warnings) {\n warnings.push({ code, message, ...extra });\n } else {\n console.warn(message);\n }\n}\n","/**\n * Grid Layout Resolution\n * Converts grid coordinates to absolute x/y/w/h positions\n */\n\nimport type { GridConfig, GridPosition, PptxComponentInput, PipelineWarning } from '../types';\nimport { warn, W } from '../utils/warn';\n\nexport const DEFAULT_GRID_CONFIG: Required<{\n columns: number;\n rows: number;\n margin: { top: number; right: number; bottom: number; left: number };\n gutter: { column: number; row: number };\n}> = {\n columns: 12,\n rows: 6,\n margin: { top: 0.5, right: 0.5, bottom: 0.5, left: 0.5 },\n gutter: { column: 0.2, row: 0.2 },\n};\n\nfunction resolveMargin(margin: GridConfig['margin']) {\n if (margin == null) return DEFAULT_GRID_CONFIG.margin;\n if (typeof margin === 'number') return { top: margin, right: margin, bottom: margin, left: margin };\n return margin;\n}\n\nfunction resolveGutter(gutter: GridConfig['gutter']) {\n if (gutter == null) return DEFAULT_GRID_CONFIG.gutter;\n if (typeof gutter === 'number') return { column: gutter, row: gutter };\n return gutter;\n}\n\n/**\n * Merge a template-level grid override on top of the presentation grid.\n * Template fields take precedence; nested margin/gutter objects are shallow-merged.\n * Both sides are normalized to object form before merging so that a shorthand\n * base (e.g. margin: 0.5) combined with a partial override (e.g. { top: 1.1 })\n * doesn't lose the other sides.\n */\nexport function mergeGridConfigs(\n base: GridConfig | undefined,\n override: GridConfig | undefined\n): GridConfig | undefined {\n if (!override) return base;\n if (!base) return override;\n\n const merged: GridConfig = {\n columns: override.columns ?? base.columns,\n rows: override.rows ?? base.rows,\n };\n\n // Merge margin — normalize both to object form first\n if (override.margin !== undefined) {\n if (typeof override.margin === 'number') {\n merged.margin = override.margin;\n } else {\n merged.margin = { ...resolveMargin(base.margin), ...override.margin };\n }\n } else {\n merged.margin = base.margin;\n }\n\n // Merge gutter — same normalization\n if (override.gutter !== undefined) {\n if (typeof override.gutter === 'number') {\n merged.gutter = override.gutter;\n } else {\n merged.gutter = { ...resolveGutter(base.gutter), ...override.gutter };\n }\n } else {\n merged.gutter = base.gutter;\n }\n\n return merged;\n}\n\nexport function resolveGridPosition(\n gridPos: GridPosition,\n gridConfig: GridConfig | undefined,\n slideWidth: number,\n slideHeight: number,\n warnings?: PipelineWarning[]\n): { x: number; y: number; w: number; h: number } {\n const cols = Math.max(1, gridConfig?.columns ?? DEFAULT_GRID_CONFIG.columns);\n const rows = Math.max(1, gridConfig?.rows ?? DEFAULT_GRID_CONFIG.rows);\n const margin = resolveMargin(gridConfig?.margin);\n const gutter = resolveGutter(gridConfig?.gutter);\n\n const col = Math.max(0, Math.min(gridPos.column, cols - 1));\n const row = Math.max(0, Math.min(gridPos.row, rows - 1));\n const colSpan = Math.max(1, Math.min(gridPos.columnSpan ?? 1, cols - col));\n const rowSpan = Math.max(1, Math.min(gridPos.rowSpan ?? 1, rows - row));\n\n if (gridPos.column !== col || gridPos.row !== row) {\n warn(warnings, W.GRID_POSITION_CLAMPED,\n `Grid position clamped: column ${gridPos.column}→${col}, row ${gridPos.row}→${row} (grid: ${cols}×${rows})`\n );\n }\n\n const availableW = slideWidth - margin.left - margin.right;\n const availableH = slideHeight - margin.top - margin.bottom;\n const trackW = (availableW - (cols - 1) * gutter.column) / cols;\n const trackH = (availableH - (rows - 1) * gutter.row) / rows;\n\n const x = margin.left + col * (trackW + gutter.column);\n const y = margin.top + row * (trackH + gutter.row);\n const w = colSpan * trackW + (colSpan - 1) * gutter.column;\n const h = rowSpan * trackH + (rowSpan - 1) * gutter.row;\n\n return { x, y, w, h };\n}\n\nexport function resolveComponentGridPosition(\n component: PptxComponentInput,\n gridConfig: GridConfig | undefined,\n slideWidth: number,\n slideHeight: number,\n warnings?: PipelineWarning[]\n): PptxComponentInput {\n const gridPos = component.props.grid as GridPosition | undefined;\n if (!gridPos) return component;\n\n const resolved = resolveGridPosition(gridPos, gridConfig, slideWidth, slideHeight, warnings);\n\n const { grid: _grid, ...restProps } = component.props; // eslint-disable-line no-unused-vars, @typescript-eslint/no-unused-vars\n const newProps = { ...restProps };\n\n // When explicit values use percentage strings, convert grid-resolved inches\n // to percentages too so pptxgenjs receives consistent units per element.\n const hasPercentX = typeof newProps.x === 'string' || typeof newProps.w === 'string';\n const hasPercentY = typeof newProps.y === 'string' || typeof newProps.h === 'string';\n\n const toPercX = (v: number) => `${+((v / slideWidth) * 100).toFixed(2)}%`;\n const toPercY = (v: number) => `${+((v / slideHeight) * 100).toFixed(2)}%`;\n\n // Grid sets x/y/w/h, but explicit values on the element override individually\n if (newProps.x == null) newProps.x = hasPercentX ? toPercX(resolved.x) : resolved.x;\n if (newProps.y == null) newProps.y = hasPercentY ? toPercY(resolved.y) : resolved.y;\n if (newProps.w == null) newProps.w = hasPercentX ? toPercX(resolved.w) : resolved.w;\n if (newProps.h == null) newProps.h = hasPercentY ? toPercY(resolved.h) : resolved.h;\n\n return { ...component, props: newProps };\n}\n","/**\n * PPTX Theme Defaults\n */\n\nimport type { PptxThemeConfig, TextStyle, StyleName } from '../types';\n\nconst DEFAULT_STYLES: Partial<Record<StyleName, TextStyle>> = {\n title: { fontSize: 36, bold: true, fontColor: 'text', align: 'center' },\n subtitle: { fontSize: 20, italic: true, fontColor: 'text2', align: 'center' },\n heading1: { fontSize: 28, bold: true, fontColor: 'primary' },\n heading2: { fontSize: 22, bold: true, fontColor: 'primary' },\n heading3: { fontSize: 18, bold: true, fontColor: 'text' },\n body: { fontSize: 14 },\n caption: { fontSize: 10, italic: true, fontColor: 'text2' },\n};\n\nexport const DEFAULT_PPTX_THEME: PptxThemeConfig = {\n name: 'default',\n colors: {\n primary: '#4472C4',\n secondary: '#ED7D31',\n accent: '#70AD47',\n background: '#FFFFFF',\n text: '#333333',\n text2: '#44546A',\n background2: '#E7E6E6',\n accent4: '#FFC000',\n accent5: '#5B9BD5',\n accent6: '#70AD47',\n },\n fonts: {\n heading: 'Arial',\n body: 'Arial',\n },\n defaults: {\n fontSize: 18,\n fontColor: '#333333',\n },\n styles: DEFAULT_STYLES,\n};\n\nconst PPTX_THEMES: Record<string, PptxThemeConfig> = {\n default: DEFAULT_PPTX_THEME,\n dark: {\n name: 'dark',\n colors: {\n primary: '#5B9BD5',\n secondary: '#FF6F61',\n accent: '#6BCB77',\n background: '#2D2D2D',\n text: '#FFFFFF',\n text2: '#CCCCCC',\n background2: '#3D3D3D',\n accent4: '#FFB347',\n accent5: '#77DD77',\n accent6: '#AEC6CF',\n },\n fonts: {\n heading: 'Arial',\n body: 'Arial',\n },\n defaults: {\n fontSize: 18,\n fontColor: '#FFFFFF',\n },\n styles: DEFAULT_STYLES,\n },\n minimal: {\n name: 'minimal',\n colors: {\n primary: '#000000',\n secondary: '#666666',\n accent: '#999999',\n background: '#FFFFFF',\n text: '#000000',\n text2: '#444444',\n background2: '#F5F5F5',\n accent4: '#BBBBBB',\n accent5: '#DDDDDD',\n accent6: '#888888',\n },\n fonts: {\n heading: 'Helvetica',\n body: 'Helvetica',\n },\n defaults: {\n fontSize: 18,\n fontColor: '#000000',\n },\n styles: DEFAULT_STYLES,\n },\n};\n\nexport function getPptxTheme(name: string): PptxThemeConfig {\n return PPTX_THEMES[name] || DEFAULT_PPTX_THEME;\n}\n\nexport const pptxThemes = PPTX_THEMES;\n","/**\n * Structure Processing\n * JSON -> internal model\n */\n\nimport type {\n PptxComponentInput,\n PresentationComponentDefinition,\n ProcessedPresentation,\n ProcessedSlide,\n TemplateSlideDefinition,\n} from '../types';\nimport { isSlideComponent } from '../types';\nimport { resolveGridPosition, resolveComponentGridPosition, mergeGridConfigs } from './grid';\nimport { getPptxTheme } from '../themes';\nimport type { GenerationOptions } from './generator';\n\nexport function processPresentation(\n document: PresentationComponentDefinition,\n options?: GenerationOptions\n): ProcessedPresentation {\n const { props, children = [] } = document;\n\n const themeName = props.theme ?? 'default';\n const theme = options?.customThemes?.[themeName] ?? getPptxTheme(themeName);\n const slideWidth = props.slideWidth ?? 10;\n const slideHeight = props.slideHeight ?? 7.5;\n\n // Process template slide definitions\n let templates: TemplateSlideDefinition[] | undefined;\n if (props.templates && props.templates.length > 0) {\n templates = props.templates.map((m: TemplateSlideDefinition) => {\n const effectiveGrid = mergeGridConfigs(props.grid, m.grid);\n\n // Resolve grid positions on placeholders\n const resolvedPhs = m.placeholders?.map(ph => {\n if (!ph.grid) return ph;\n const abs = resolveGridPosition(ph.grid, effectiveGrid, slideWidth, slideHeight);\n return {\n ...ph,\n x: ph.x ?? abs.x,\n y: ph.y ?? abs.y,\n w: ph.w ?? abs.w,\n h: ph.h ?? abs.h,\n grid: undefined,\n };\n });\n\n // Resolve grid positions on fixed objects (unified components)\n const resolvedObjects = m.objects?.map(obj =>\n resolveComponentGridPosition(obj, effectiveGrid, slideWidth, slideHeight)\n );\n\n return { ...m, placeholders: resolvedPhs, objects: resolvedObjects };\n });\n }\n\n const slides: ProcessedSlide[] = [];\n\n for (const child of children) {\n if (isSlideComponent(child)) {\n const slideComponents: PptxComponentInput[] = [];\n if (child.children) {\n for (const slideChild of child.children) {\n slideComponents.push(slideChild);\n }\n }\n\n slides.push({\n components: slideComponents,\n background: child.props.background,\n notes: child.props.notes,\n layout: child.props.layout,\n hidden: child.props.hidden,\n template: child.props.template,\n placeholders: child.props.placeholders as Record<string, any> | undefined,\n });\n }\n }\n\n return {\n metadata: {\n title: props.title,\n author: props.author,\n subject: props.subject,\n company: props.company,\n },\n theme,\n grid: props.grid,\n slideWidth,\n slideHeight,\n rtlMode: props.rtlMode ?? false,\n pageNumberFormat: props.pageNumberFormat ?? '9',\n slides,\n templates,\n };\n}\n","/**\n * Render Pipeline\n * Internal model -> pptxgenjs calls\n */\n\nimport PptxGenJS from 'pptxgenjs';\nimport type { ProcessedPresentation, PipelineWarning, SlideContext } from '../types';\nimport { renderComponent } from '../components';\nimport { resolveComponentGridPosition, mergeGridConfigs } from './grid';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\nimport { buildSlideTemplateProps } from './template';\n\nexport async function renderPresentation(\n processed: ProcessedPresentation,\n warnings?: PipelineWarning[]\n): Promise<PptxGenJS> {\n const pptx = new PptxGenJS();\n\n // Set presentation metadata\n if (processed.metadata.title) pptx.title = processed.metadata.title;\n if (processed.metadata.author) pptx.author = processed.metadata.author;\n if (processed.metadata.subject) pptx.subject = processed.metadata.subject;\n if (processed.metadata.company) pptx.company = processed.metadata.company;\n\n // Set layout dimensions\n pptx.defineLayout({\n name: 'CUSTOM',\n width: processed.slideWidth,\n height: processed.slideHeight,\n });\n pptx.layout = 'CUSTOM';\n\n // Set RTL mode\n if (processed.rtlMode) {\n pptx.rtlMode = true;\n }\n\n // Set theme fonts\n pptx.theme = {\n headFontFace: processed.theme.fonts.heading,\n bodyFontFace: processed.theme.fonts.body,\n };\n\n // Register template slides\n const templateMap = new Map(processed.templates?.map(m => [m.name, m]) ?? []);\n if (processed.templates) {\n for (const templateDef of processed.templates) {\n const templateProps = buildSlideTemplateProps(templateDef, processed.theme, warnings);\n pptx.defineSlideMaster(templateProps as any);\n }\n }\n\n // Render each slide\n const totalSlides = processed.slides.length;\n for (let slideIdx = 0; slideIdx < totalSlides; slideIdx++) {\n const slideData = processed.slides[slideIdx];\n const slideCtx: SlideContext = {\n slideNumber: slideIdx + 1,\n totalSlides,\n pageNumberFormat: processed.pageNumberFormat,\n };\n const slide = slideData.template\n ? pptx.addSlide({ masterName: slideData.template })\n : pptx.addSlide();\n\n // Apply slide background\n if (slideData.background) {\n if (slideData.background.color) {\n slide.background = { color: resolveColor(slideData.background.color, processed.theme, warnings) };\n } else if (slideData.background.image) {\n if (slideData.background.image.path) {\n slide.background = { path: slideData.background.image.path };\n } else if (slideData.background.image.base64) {\n slide.background = { data: slideData.background.image.base64 };\n }\n }\n }\n\n // Apply hidden flag\n if (slideData.hidden) {\n slide.hidden = true;\n }\n\n // Determine effective grid for this slide (template grid merged with presentation grid)\n const templateDef = slideData.template ? templateMap.get(slideData.template) : undefined;\n if (slideData.template && !templateDef) {\n warn(warnings, W.MISSING_TEMPLATE, `Unknown template \"${slideData.template}\". Available: ${[...templateMap.keys()].join(', ')}`, { slide: slideIdx });\n }\n const effectiveGrid = mergeGridConfigs(processed.grid, templateDef?.grid);\n\n // Render template fixed objects (grid already resolved in structure.ts)\n if (templateDef?.objects) {\n for (const obj of templateDef.objects) {\n await renderComponent(slide, obj, processed.theme, pptx, warnings, slideCtx);\n }\n }\n\n // Render slide components (resolve grid positions first)\n for (const component of slideData.components) {\n const resolved = resolveComponentGridPosition(\n component,\n effectiveGrid,\n processed.slideWidth,\n processed.slideHeight,\n warnings\n );\n await renderComponent(slide, resolved, processed.theme, pptx, warnings, slideCtx);\n }\n\n // Render placeholder content\n if (slideData.placeholders) {\n if (templateDef) {\n const phMap = new Map(templateDef.placeholders?.map(p => [p.name, p]) ?? []);\n\n for (const [phName, component] of Object.entries(slideData.placeholders)) {\n const phDef = phMap.get(phName);\n if (!phDef) {\n warn(warnings, W.UNKNOWN_PLACEHOLDER, `Unknown placeholder \"${phName}\" in template \"${slideData.template}\". Available: ${[...phMap.keys()].join(', ')}`, { slide: slideIdx });\n continue;\n }\n\n const gridResolved = resolveComponentGridPosition(\n component, effectiveGrid,\n processed.slideWidth, processed.slideHeight, warnings\n );\n\n // Position from placeholder, then defaults props, then component props (most specific wins)\n const posDefaults: Record<string, any> = {};\n if (phDef.x != null) posDefaults.x = phDef.x;\n if (phDef.y != null) posDefaults.y = phDef.y;\n if (phDef.w != null) posDefaults.w = phDef.w;\n if (phDef.h != null) posDefaults.h = phDef.h;\n\n const props = { ...posDefaults, ...(phDef.defaults?.props ?? {}), ...gridResolved.props };\n await renderComponent(slide, { ...gridResolved, props }, processed.theme, pptx, warnings, slideCtx);\n }\n } else {\n // No template found — render placeholders at their own positions if available\n for (const [phName, component] of Object.entries(slideData.placeholders)) {\n const hasPosition = component.props.x != null || component.props.y != null || component.props.grid;\n if (hasPosition) {\n const resolved = resolveComponentGridPosition(\n component, effectiveGrid,\n processed.slideWidth, processed.slideHeight, warnings\n );\n await renderComponent(slide, resolved, processed.theme, pptx, warnings, slideCtx);\n } else {\n warn(warnings, W.PLACEHOLDER_NO_POSITION, `Placeholder \"${phName}\" has no template and no explicit position — skipped`, { slide: slideIdx });\n }\n }\n }\n }\n\n // Add speaker notes\n if (slideData.notes) {\n slide.addNotes(slideData.notes);\n }\n }\n\n return pptx;\n}\n","/**\n * Color utilities for PPTX generation.\n * pptxgenjs expects bare 6-char hex (e.g. 'FF0000'), but our theme\n * convention uses '#'-prefixed values (e.g. '#FF0000').\n */\n\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { SEMANTIC_COLOR_NAMES } from '@json-to-office/shared-pptx';\nimport { warn, W } from './warn';\n\n// Build identity entries from the shared source of truth, then add aliases\nconst SEMANTIC_TO_THEME_KEY: Record<string, keyof PptxThemeConfig['colors']> = {\n ...Object.fromEntries(SEMANTIC_COLOR_NAMES.map(n => [n, n])),\n // Aliases (PowerPoint XML compat)\n accent1: 'primary',\n accent2: 'secondary',\n accent3: 'accent',\n tx1: 'text',\n tx2: 'text2',\n bg1: 'background',\n bg2: 'background2',\n};\n\n/**\n * Resolve a color value to bare hex (no '#' prefix).\n * Accepts hex colors (with or without '#') or semantic theme color names.\n */\nexport function resolveColor(color: string, theme: PptxThemeConfig, warnings?: PipelineWarning[]): string {\n const themeKey = SEMANTIC_TO_THEME_KEY[color];\n if (themeKey) {\n const resolved = theme.colors[themeKey];\n if (resolved) return resolved.startsWith('#') ? resolved.slice(1) : resolved;\n // Fall back to primary for unset optional colors\n warn(warnings, W.THEME_COLOR_FALLBACK, `Theme color \"${themeKey}\" not defined, falling back to primary`);\n return theme.colors.primary.startsWith('#') ? theme.colors.primary.slice(1) : theme.colors.primary;\n }\n // Not a semantic name — treat as literal hex\n const bare = color.startsWith('#') ? color.slice(1) : color;\n // Expand 3-char hex shorthand (e.g. 'FFF' → 'FFFFFF')\n if (/^[0-9A-Fa-f]{3}$/.test(bare)) {\n return bare[0] + bare[0] + bare[1] + bare[1] + bare[2] + bare[2];\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(bare)) {\n warn(warnings, W.UNKNOWN_COLOR, `Unknown color value: \"${color}\", treating as literal`);\n }\n return bare;\n}\n","/**\n * Text Component Renderer\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, StyleName, PipelineWarning, SlideContext } from '../types';\nimport { resolveColor } from '../utils/color';\n\ninterface TextComponentProps {\n text: string;\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n fontSize?: number;\n fontFace?: string;\n color?: string;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean | { style?: string; color?: string };\n strike?: boolean;\n align?: string;\n valign?: string;\n breakLine?: boolean;\n bullet?: boolean | { type?: string; style?: string; startAt?: number };\n margin?: number | number[];\n rotate?: number;\n shadow?: {\n type?: string;\n color?: string;\n blur?: number;\n offset?: number;\n angle?: number;\n opacity?: number;\n };\n fill?: { color: string; transparency?: number };\n hyperlink?: { url?: string; slide?: number; tooltip?: string };\n lineSpacing?: number;\n charSpacing?: number;\n paraSpaceBefore?: number;\n paraSpaceAfter?: number;\n style?: StyleName;\n}\n\nfunction resolvePagePlaceholders(text: string, ctx: SlideContext): string {\n const { slideNumber, totalSlides, pageNumberFormat } = ctx;\n const fmt = (n: number) => pageNumberFormat === '09'\n ? String(n).padStart(String(totalSlides).length, '0')\n : String(n);\n return text\n .replace(/\\{PAGE_NUMBER\\}/g, fmt(slideNumber))\n .replace(/\\{PAGE_COUNT\\}/g, fmt(totalSlides));\n}\n\nexport function renderTextComponent(\n slide: PptxGenJS.Slide,\n props: TextComponentProps,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[],\n slideCtx?: SlideContext\n): void {\n // Resolve named style as defaults\n const style = props.style ? theme.styles?.[props.style] : undefined;\n const isHeadingStyle = props.style && /^(title|heading)/.test(props.style);\n\n const opts: Record<string, unknown> = {};\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // When height is not explicitly set, provide a reasonable default based on\n // font size so that LibreOffice (which renders cy=\"0\" as blank) can display\n // the text. Also mark as textBox for proper auto-sizing in PowerPoint.\n if (props.h === undefined) {\n const fontSize = props.fontSize ?? theme.defaults.fontSize ?? 18;\n const lines = (props.text.match(/\\n/g)?.length ?? 0) + 1;\n opts.h = Math.max(0.5, (fontSize / 72) * 1.6 * lines);\n opts.isTextBox = true;\n }\n\n // Font — cascade: component props → style → theme defaults\n opts.fontSize = props.fontSize ?? style?.fontSize ?? theme.defaults.fontSize;\n opts.fontFace = props.fontFace ?? style?.fontFace ?? (isHeadingStyle ? theme.fonts.heading : theme.fonts.body);\n opts.color = resolveColor(props.color ?? style?.fontColor ?? theme.defaults.fontColor, theme, warnings);\n\n // Formatting\n const bold = props.bold ?? style?.bold;\n const italic = props.italic ?? style?.italic;\n if (bold != null) opts.bold = bold;\n if (italic != null) opts.italic = italic;\n if (props.strike) opts.strike = true;\n\n if (props.underline !== undefined) {\n if (typeof props.underline === 'boolean') {\n opts.underline = { style: 'sng' };\n } else {\n opts.underline = props.underline;\n }\n }\n\n // Alignment\n const align = props.align ?? style?.align;\n if (align) opts.align = align;\n opts.valign = props.valign ?? 'top';\n\n // Bullet\n if (props.bullet !== undefined) opts.bullet = props.bullet;\n\n // Margin — default to 0 so text aligns exactly to grid positions\n opts.margin = props.margin ?? 0;\n\n // Rotation\n if (props.rotate !== undefined) opts.rotate = props.rotate;\n\n // Shadow\n if (props.shadow) {\n opts.shadow = {\n type: props.shadow.type ?? 'outer',\n color: resolveColor(props.shadow.color ?? '000000', theme, warnings),\n blur: props.shadow.blur ?? 3,\n offset: props.shadow.offset ?? 3,\n angle: props.shadow.angle ?? 45,\n opacity: props.shadow.opacity ?? 0.5,\n };\n }\n\n // Fill\n if (props.fill) {\n opts.fill = { color: resolveColor(props.fill.color, theme, warnings) };\n if (props.fill.transparency !== undefined) {\n (opts.fill as Record<string, unknown>).transparency = props.fill.transparency;\n }\n }\n\n // Hyperlink\n if (props.hyperlink) {\n if (props.hyperlink.url) {\n opts.hyperlink = {\n url: props.hyperlink.url,\n tooltip: props.hyperlink.tooltip,\n };\n } else if (props.hyperlink.slide) {\n opts.hyperlink = {\n slide: props.hyperlink.slide,\n tooltip: props.hyperlink.tooltip,\n };\n }\n }\n\n // Line spacing\n const lineSpacing = props.lineSpacing ?? style?.lineSpacing;\n if (lineSpacing !== undefined) opts.lineSpacing = lineSpacing;\n const charSpacing = props.charSpacing ?? style?.charSpacing;\n if (charSpacing !== undefined) opts.charSpacing = charSpacing;\n if (props.paraSpaceBefore !== undefined) opts.paraSpaceBefore = props.paraSpaceBefore;\n const paraSpaceAfter = props.paraSpaceAfter ?? style?.paraSpaceAfter;\n if (paraSpaceAfter !== undefined) opts.paraSpaceAfter = paraSpaceAfter;\n\n // Break line handling\n if (props.breakLine) opts.breakLine = true;\n\n const text = slideCtx ? resolvePagePlaceholders(props.text, slideCtx) : props.text;\n slide.addText(text, opts as any);\n}\n","/**\n * Image Component Renderer\n */\n\nimport path from 'path';\nimport probe from 'probe-image-size';\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\n\n/** Block requests to private/loopback/link-local hosts. */\nfunction isPrivateUrl(urlStr: string): boolean {\n try {\n const { hostname } = new URL(urlStr);\n if (\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n hostname === '::1' ||\n hostname === '[::1]' ||\n hostname.startsWith('10.') ||\n hostname.startsWith('192.168.') ||\n hostname.startsWith('169.254.') ||\n hostname.endsWith('.local') ||\n hostname.endsWith('.internal')\n ) return true;\n if (hostname.startsWith('172.')) {\n const second = parseInt(hostname.split('.')[1], 10);\n if (second >= 16 && second <= 31) return true;\n }\n return false;\n } catch { return true; }\n}\n\ninterface ImageComponentProps {\n path?: string;\n base64?: string;\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n sizing?: { type: string; w?: number; h?: number };\n rotate?: number;\n rounding?: boolean;\n shadow?: {\n type?: string;\n color?: string;\n blur?: number;\n offset?: number;\n angle?: number;\n opacity?: number;\n };\n hyperlink?: { url?: string; slide?: number; tooltip?: string };\n alt?: string;\n}\n\n/**\n * Probe the intrinsic dimensions of an image (URL, file path, or base64).\n * Returns width/height in pixels, or undefined on failure.\n */\nasync function probeImageSize(\n imagePath: string,\n warnings?: PipelineWarning[]\n): Promise<{ width: number; height: number } | undefined> {\n try {\n if (/^data:image\\//.test(imagePath)) {\n const base64Data = imagePath.split(',')[1];\n if (!base64Data) return undefined;\n const buf = Buffer.from(base64Data, 'base64');\n const result = probe.sync(buf);\n return result ? { width: result.width, height: result.height } : undefined;\n }\n\n if (/^https?:\\/\\//.test(imagePath)) {\n if (isPrivateUrl(imagePath)) return undefined;\n const result = await probe(imagePath, { timeout: 5000 });\n return { width: result.width, height: result.height };\n }\n\n // Local file — restrict to CWD to prevent path traversal\n const resolved = path.resolve(imagePath);\n if (!resolved.startsWith(process.cwd())) return undefined;\n const { createReadStream } = await import('fs');\n const result = await probe(createReadStream(resolved));\n return result ? { width: result.width, height: result.height } : undefined;\n } catch (err) {\n warn(warnings, W.IMAGE_PROBE_FAILED, `Image probe failed: ${err instanceof Error ? err.message : String(err)}`, { component: 'image' });\n return undefined;\n }\n}\n\nexport async function renderImageComponent(\n slide: PptxGenJS.Slide,\n props: ImageComponentProps,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[]\n): Promise<void> {\n const opts: Record<string, unknown> = {};\n\n // Source\n if (props.path) {\n opts.path = props.path;\n } else if (props.base64) {\n opts.data = props.base64;\n } else {\n warn(warnings, W.IMAGE_NO_SOURCE, 'Image component missing both path and base64', { component: 'image' });\n return;\n }\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // Sizing — pptxgenjs's contain implementation produces negative srcRect\n // values when the image aspect ratio differs from the box, causing\n // stretching. We handle contain ourselves: probe intrinsic dimensions,\n // calculate fitted size, and center within the box. Cover is delegated to\n // pptxgenjs with correct intrinsic dimensions.\n if (props.sizing && (props.sizing.type === 'contain' || props.sizing.type === 'cover')) {\n const source = props.path || props.base64;\n const intrinsic = source ? await probeImageSize(source, warnings) : undefined;\n\n const boxW = Number(props.sizing.w ?? props.w);\n const boxH = Number(props.sizing.h ?? props.h);\n\n if (intrinsic && !isNaN(boxW) && !isNaN(boxH)) {\n const imgAspect = intrinsic.width / intrinsic.height;\n\n if (props.sizing.type === 'contain') {\n // Fit image inside box, preserving aspect ratio, centered\n const boxAspect = boxW / boxH;\n let fitW: number, fitH: number;\n if (imgAspect > boxAspect) {\n // Image is wider than box — width-limited\n fitW = boxW;\n fitH = boxW / imgAspect;\n } else {\n // Image is taller than box — height-limited\n fitH = boxH;\n fitW = boxH * imgAspect;\n }\n // Center within the box\n const baseX = Number(props.x ?? 0);\n const baseY = Number(props.y ?? 0);\n opts.x = baseX + (boxW - fitW) / 2;\n opts.y = baseY + (boxH - fitH) / 2;\n opts.w = fitW;\n opts.h = fitH;\n // No sizing — element is already the correct size\n } else {\n // Cover: pptxgenjs handles this correctly with real intrinsic dims\n opts.w = intrinsic.width;\n opts.h = intrinsic.height;\n opts.sizing = { type: 'cover', w: boxW, h: boxH };\n }\n } else {\n // Fallback: pass sizing through with w/h auto-filled from outer dims\n opts.sizing = { ...props.sizing, w: boxW, h: boxH };\n }\n } else if (props.sizing) {\n opts.sizing = {\n ...props.sizing,\n w: props.sizing.w ?? props.w,\n h: props.sizing.h ?? props.h,\n };\n }\n\n // Rotation\n if (props.rotate !== undefined) opts.rotate = props.rotate;\n\n // Rounding\n if (props.rounding) opts.rounding = true;\n\n // Shadow\n if (props.shadow) {\n opts.shadow = {\n type: props.shadow.type ?? 'outer',\n color: resolveColor(props.shadow.color ?? '000000', theme, warnings),\n blur: props.shadow.blur ?? 3,\n offset: props.shadow.offset ?? 3,\n angle: props.shadow.angle ?? 45,\n opacity: props.shadow.opacity ?? 0.5,\n };\n }\n\n // Hyperlink\n if (props.hyperlink) {\n if (props.hyperlink.url) {\n opts.hyperlink = {\n url: props.hyperlink.url,\n tooltip: props.hyperlink.tooltip,\n };\n } else if (props.hyperlink.slide) {\n opts.hyperlink = {\n slide: props.hyperlink.slide,\n tooltip: props.hyperlink.tooltip,\n };\n }\n }\n\n // Alt text\n if (props.alt) opts.altText = props.alt;\n\n slide.addImage(opts as any);\n}\n","/**\n * Shape Component Renderer\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, StyleName, PipelineWarning } from '../types';\nimport type { TextSegment } from '@json-to-office/shared-pptx';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\n\ninterface ShapeComponentProps {\n type: string;\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n fill?: { color: string; transparency?: number };\n line?: { color?: string; width?: number; dashType?: string };\n text?: string | TextSegment[];\n fontSize?: number;\n fontFace?: string;\n fontColor?: string;\n charSpacing?: number;\n bold?: boolean;\n italic?: boolean;\n align?: string;\n valign?: string;\n rotate?: number;\n shadow?: {\n type?: string;\n color?: string;\n blur?: number;\n offset?: number;\n angle?: number;\n opacity?: number;\n };\n rectRadius?: number;\n style?: StyleName;\n}\n\nconst SHAPE_TYPE_MAP: Record<string, string> = {\n rect: 'rect',\n roundRect: 'roundRect',\n ellipse: 'ellipse',\n triangle: 'triangle',\n diamond: 'diamond',\n pentagon: 'pentagon',\n hexagon: 'hexagon',\n star5: 'star5',\n star6: 'star6',\n line: 'line',\n arrow: 'rightArrow',\n chevron: 'chevron',\n cloud: 'cloud',\n heart: 'heart',\n lightning: 'lightningBolt',\n};\n\nfunction buildShapeOpts(\n props: ShapeComponentProps,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[]\n): Record<string, unknown> {\n const opts: Record<string, unknown> = {};\n\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n if (props.fill) {\n opts.fill = { color: resolveColor(props.fill.color, theme, warnings) };\n if (props.fill.transparency !== undefined) {\n (opts.fill as Record<string, unknown>).transparency = props.fill.transparency;\n }\n }\n\n if (props.line) {\n opts.line = {};\n if (props.line.color) (opts.line as Record<string, unknown>).color = resolveColor(props.line.color, theme, warnings);\n if (props.line.width) (opts.line as Record<string, unknown>).width = props.line.width;\n if (props.line.dashType) (opts.line as Record<string, unknown>).dashType = props.line.dashType;\n }\n\n if (props.rotate !== undefined) opts.rotate = props.rotate;\n if (props.rectRadius !== undefined) opts.rectRadius = props.rectRadius;\n\n if (props.shadow) {\n opts.shadow = {\n type: props.shadow.type ?? 'outer',\n color: resolveColor(props.shadow.color ?? '000000', theme, warnings),\n blur: props.shadow.blur ?? 3,\n offset: props.shadow.offset ?? 3,\n angle: props.shadow.angle ?? 45,\n opacity: props.shadow.opacity ?? 0.5,\n };\n }\n\n return opts;\n}\n\nexport function renderShapeComponent(\n slide: PptxGenJS.Slide,\n props: ShapeComponentProps,\n theme: PptxThemeConfig,\n pptx: PptxGenJS,\n warnings?: PipelineWarning[]\n): void {\n // Resolve shape type from pptxgenjs ShapeType enum\n const shapeTypeName = SHAPE_TYPE_MAP[props.type] || props.type;\n const shapeType = (pptx.ShapeType as Record<string, any>)[shapeTypeName];\n\n if (!shapeType) {\n warn(warnings, W.UNKNOWN_SHAPE, `Unknown shape type: ${props.type}`, { component: 'shape' });\n return;\n }\n\n // Resolve named style\n const style = props.style ? theme.styles?.[props.style] : undefined;\n const isHeadingStyle = props.style && /^(title|heading)/.test(props.style);\n\n const opts = buildShapeOpts(props, theme, warnings);\n\n // If shape has text, use addText with shape option\n if (props.text && (!Array.isArray(props.text) || props.text.length > 0)) {\n opts.shape = shapeType;\n\n opts.fontSize = props.fontSize ?? style?.fontSize ?? theme.defaults.fontSize;\n opts.fontFace = props.fontFace ?? style?.fontFace ?? (isHeadingStyle ? theme.fonts.heading : theme.fonts.body);\n opts.color = resolveColor(props.fontColor ?? style?.fontColor ?? theme.defaults.fontColor, theme, warnings);\n const bold = props.bold ?? style?.bold;\n const italic = props.italic ?? style?.italic;\n if (bold != null) opts.bold = bold;\n if (italic != null) opts.italic = italic;\n const charSpacing = props.charSpacing ?? style?.charSpacing;\n if (charSpacing !== undefined) opts.charSpacing = charSpacing;\n const align = props.align ?? style?.align;\n if (align) opts.align = align;\n opts.valign = props.valign ?? 'top';\n\n if (Array.isArray(props.text)) {\n const textSegments = props.text.map(seg => {\n const segOpts: Record<string, unknown> = {};\n if (seg.fontSize != null) segOpts.fontSize = seg.fontSize;\n if (seg.fontFace != null) segOpts.fontFace = seg.fontFace;\n if (seg.color != null) segOpts.color = resolveColor(seg.color, theme, warnings);\n if (seg.bold != null) segOpts.bold = seg.bold;\n if (seg.italic != null) segOpts.italic = seg.italic;\n if (seg.breakLine != null) segOpts.breakLine = seg.breakLine;\n if (seg.charSpacing != null) segOpts.charSpacing = seg.charSpacing;\n if (seg.spaceBefore != null) segOpts.paraSpaceBefore = seg.spaceBefore;\n if (seg.spaceAfter != null) segOpts.paraSpaceAfter = seg.spaceAfter;\n return { text: seg.text, options: segOpts };\n });\n slide.addText(textSegments, opts as any);\n } else {\n slide.addText(props.text, opts as any);\n }\n } else {\n // Pure shape without text\n slide.addShape(shapeType, opts as any);\n }\n}\n","/**\n * Table Component Renderer\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\n\n/**\n * Characters that PowerPoint may render as color emoji.\n * Appending VS15 (U+FE0E) forces text-mode rendering.\n */\nconst EMOJI_PRONE_CHARS = /[✓✔✗✘☐☑☒★☆●○■□▶◀▲▼⚡⚠❌❓❗]/gu;\n\nfunction applyTextVariationSelector(text: string): string {\n return text.replace(EMOJI_PRONE_CHARS, (ch) => ch + '\\uFE0E');\n}\n\ninterface TableCell {\n text: string;\n color?: string;\n fill?: string;\n fontSize?: number;\n fontFace?: string;\n bold?: boolean;\n italic?: boolean;\n align?: string;\n valign?: string;\n colspan?: number;\n rowspan?: number;\n margin?: number | number[];\n}\n\ninterface TableComponentProps {\n rows: (string | TableCell)[][];\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n colW?: number | number[];\n rowH?: number | number[];\n border?: { type?: string; pt?: number; color?: string };\n fill?: string;\n fontSize?: number;\n fontFace?: string;\n color?: string;\n align?: string;\n valign?: string;\n autoPage?: boolean;\n autoPageRepeatHeader?: boolean;\n margin?: number | number[];\n borderRadius?: number;\n}\n\nexport function renderTableComponent(\n slide: PptxGenJS.Slide,\n props: TableComponentProps,\n theme: PptxThemeConfig,\n pptx?: PptxGenJS,\n warnings?: PipelineWarning[]\n): void {\n // Pre-compute fills and width for borderRadius feature\n let bgFill: string | undefined;\n let headerFill: string | undefined;\n let borderRadiusTableW: number | undefined;\n if (props.borderRadius && pptx && props.rows.length >= 2) {\n const lastRow = props.rows[props.rows.length - 1];\n const lastCell = lastRow?.[0];\n bgFill = props.fill\n ? resolveColor(props.fill, theme, warnings)\n : (typeof lastCell === 'object' && lastCell.fill)\n ? resolveColor(lastCell.fill, theme, warnings)\n : 'FFFFFF';\n const firstCell = props.rows[0]?.[0];\n headerFill = (typeof firstCell === 'object' && firstCell.fill)\n ? resolveColor(firstCell.fill, theme, warnings)\n : bgFill;\n // Derive width from colW (actual cell widths) so shapes match the table exactly\n borderRadiusTableW = Array.isArray(props.colW)\n ? props.colW.reduce((sum, w) => sum + w, 0)\n : typeof props.colW === 'number'\n ? props.colW * (props.rows[0]?.length ?? 1) // assumes uniform column count\n : typeof props.w === 'number' ? props.w : 5;\n }\n\n // Pre-compute inner border for per-cell border assignment\n const innerBorder = props.border\n ? {\n type: props.border.type ?? 'solid',\n pt: props.border.pt ?? 1,\n color: resolveColor(props.border.color ?? '000000', theme, warnings),\n }\n : undefined;\n\n // Helper: build per-cell border array when borderRadius is active\n const buildBorderRadiusBorders = (rowIndex: number, colIndex: number, colCount: number) => {\n const isTop = rowIndex === 0;\n const isBottom = rowIndex === props.rows.length - 1;\n const isLeft = colIndex === 0;\n const isRight = colIndex === colCount - 1;\n const zeroBorder = { type: 'none', pt: 0 };\n const hInner = innerBorder ?? zeroBorder;\n return [\n (isTop || rowIndex === 1) ? zeroBorder : hInner, // top: outer + header-body seam\n isRight ? zeroBorder : hInner, // right\n (isBottom || rowIndex === 0) ? zeroBorder : hInner, // bottom: outer + header-body seam\n isLeft ? zeroBorder : hInner, // left\n ];\n };\n\n // Convert rows to pptxgenjs format\n const lastRowIdx = props.rows.length - 1;\n const tableRows = props.rows.map((row, rowIndex) =>\n row.map((cell, colIndex) => {\n const lastColIdx = row.length - 1;\n // Corner cells: first/last col of header or last row — transparent\n // so background roundRect shapes show rounded corners through them.\n // All other cells: opaque fill to prevent seam artifacts.\n const isCorner = bgFill &&\n (rowIndex === 0 || rowIndex === lastRowIdx) &&\n (colIndex === 0 || colIndex === lastColIdx);\n\n if (typeof cell === 'string') {\n if (!bgFill) return { text: applyTextVariationSelector(cell) };\n const isHeader = rowIndex === 0;\n const opts: Record<string, unknown> = {\n border: buildBorderRadiusBorders(rowIndex, colIndex, row.length),\n };\n if (!isCorner) opts.fill = { color: isHeader ? headerFill : bgFill };\n return { text: applyTextVariationSelector(cell), options: opts };\n }\n const cellOpts: Record<string, unknown> = {};\n if (cell.color) cellOpts.color = resolveColor(cell.color, theme, warnings);\n if (bgFill) {\n const isHeader = rowIndex === 0;\n if (!isCorner) {\n const resolvedFill = cell.fill ? resolveColor(cell.fill, theme, warnings) : (isHeader ? headerFill : bgFill);\n cellOpts.fill = { color: resolvedFill };\n }\n cellOpts.border = buildBorderRadiusBorders(rowIndex, colIndex, row.length);\n } else if (cell.fill) {\n cellOpts.fill = { color: resolveColor(cell.fill, theme, warnings) };\n }\n if (cell.fontSize) cellOpts.fontSize = cell.fontSize;\n if (cell.fontFace) cellOpts.fontFace = cell.fontFace;\n if (cell.bold) cellOpts.bold = true;\n if (cell.italic) cellOpts.italic = true;\n if (cell.align) cellOpts.align = cell.align;\n if (cell.valign) cellOpts.valign = cell.valign;\n if (cell.colspan) cellOpts.colspan = cell.colspan;\n if (cell.rowspan) cellOpts.rowspan = cell.rowspan;\n if (cell.margin !== undefined) cellOpts.margin = cell.margin;\n\n return { text: applyTextVariationSelector(cell.text), options: cellOpts };\n })\n );\n\n const opts: Record<string, unknown> = {};\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // Column/row sizing\n if (props.colW !== undefined) opts.colW = props.colW;\n if (props.rowH !== undefined) opts.rowH = props.rowH;\n\n // Border — skip table-level border when borderRadius is active (per-cell borders handle it)\n if (props.border && !bgFill) {\n opts.border = {\n type: props.border.type ?? 'solid',\n pt: props.border.pt ?? 1,\n color: resolveColor(props.border.color ?? '000000', theme, warnings),\n };\n }\n\n // Fill\n if (props.fill) opts.fill = { color: resolveColor(props.fill, theme, warnings) };\n\n // Font defaults\n opts.fontSize = props.fontSize ?? theme.defaults.fontSize;\n opts.fontFace = props.fontFace ?? theme.fonts.body;\n if (props.color) opts.color = resolveColor(props.color, theme, warnings);\n\n // Alignment\n if (props.align) opts.align = props.align;\n opts.valign = props.valign ?? 'middle';\n\n // Auto-paging\n if (props.autoPage) opts.autoPage = true;\n if (props.autoPageRepeatHeader) {\n opts.autoPageRepeatHeader = true;\n opts.autoPageHeaderRows = 1;\n }\n\n // Margin\n if (props.margin !== undefined) opts.margin = props.margin;\n\n // Background roundRect shapes — placed BEFORE the table.\n // Corner cells are transparent so these shapes show through at the corners.\n // Non-corner cells are opaque to prevent seam artifacts.\n if (props.borderRadius && pptx && typeof props.x === 'number' && typeof props.y === 'number') {\n let tableH: number = (props.h as number) ?? 2;\n if (typeof props.rowH === 'number') {\n tableH = props.rowH * props.rows.length;\n } else if (Array.isArray(props.rowH)) {\n tableH = props.rowH.reduce((sum, h) => sum + h, 0);\n }\n const headerH = typeof props.rowH === 'number'\n ? props.rowH\n : Array.isArray(props.rowH)\n ? props.rowH[0]\n : 0.45;\n const tableW = borderRadiusTableW!;\n // Suppress shape outlines completely\n const noLine = { type: 'none' };\n\n // Header roundRect (rounded top corners)\n slide.addShape(pptx.ShapeType.roundRect, {\n x: props.x, y: props.y, w: tableW, h: headerH,\n fill: { color: headerFill }, rectRadius: props.borderRadius, line: noLine,\n } as any);\n // Header flat rect — covers the rounded bottom corners of header\n slide.addShape(pptx.ShapeType.rect, {\n x: props.x,\n y: (props.y as number) + headerH - props.borderRadius,\n w: tableW, h: props.borderRadius,\n fill: { color: headerFill }, line: noLine,\n } as any);\n\n // Body roundRect (rounded bottom corners)\n const bodyY = (props.y as number) + headerH;\n const bodyH = tableH - headerH;\n slide.addShape(pptx.ShapeType.roundRect, {\n x: props.x, y: bodyY, w: tableW, h: bodyH,\n fill: { color: bgFill }, rectRadius: props.borderRadius, line: noLine,\n } as any);\n // Body flat rect — covers the rounded top corners of body\n slide.addShape(pptx.ShapeType.rect, {\n x: props.x, y: bodyY, w: tableW, h: props.borderRadius,\n fill: { color: bgFill }, line: noLine,\n } as any);\n }\n\n // When borderRadius is active, override opts.w to match colW sum\n // and suppress any table-level border/outline\n if (bgFill && borderRadiusTableW !== undefined) {\n opts.w = borderRadiusTableW;\n opts.border = [{ type: 'none' }, { type: 'none' }, { type: 'none' }, { type: 'none' }];\n }\n\n slide.addTable(tableRows as any, opts as any);\n}\n","/**\n * Environment detection utilities\n */\n\n/**\n * Check if the current environment is Node.js\n */\nexport function isNodeEnvironment(): boolean {\n return (\n typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null &&\n typeof process.versions.node === 'string'\n );\n}\n","/**\n * Highcharts Component Renderer (PPTX)\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport type { PptxHighchartsProps } from '@json-to-office/shared-pptx';\nimport { isNodeEnvironment } from '../utils/environment';\n\nconst PX_PER_INCH = 96;\nconst DEFAULT_EXPORT_SERVER_URL = 'http://localhost:7801';\n\nfunction getExportServerUrl(propsUrl?: string): string {\n return propsUrl || process.env.HIGHCHARTS_SERVER_URL || DEFAULT_EXPORT_SERVER_URL;\n}\n\n/**\n * Generate chart via Highcharts Export Server\n */\nasync function generateChart(\n config: PptxHighchartsProps\n): Promise<{ base64DataUri: string; width: number; height: number }> {\n if (!isNodeEnvironment()) {\n throw new Error(\n 'Highcharts export server requires a Node.js environment. ' +\n 'Chart generation is not available in browser environments.'\n );\n }\n\n const serverUrl = getExportServerUrl(config.serverUrl);\n\n const response = await fetch(`${serverUrl}/export`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n infile: config.options,\n type: 'png',\n b64: true,\n scale: config.scale,\n }),\n }).catch((error) => {\n throw new Error(\n `Highcharts Export Server is not running at ${serverUrl}. ` +\n 'Start it with: npx highcharts-export-server --enableServer true\\n' +\n `Cause: ${error instanceof Error ? error.message : String(error)}`\n );\n });\n\n if (!response.ok) {\n throw new Error(\n `Highcharts export server returned ${response.status}: ${response.statusText}`\n );\n }\n\n const base64Data = await response.text();\n\n return {\n base64DataUri: `data:image/png;base64,${base64Data}`,\n width: config.options.chart?.width ?? 960,\n height: config.options.chart?.height ?? 720,\n };\n}\n\nexport async function renderHighchartsComponent(\n slide: PptxGenJS.Slide,\n props: PptxHighchartsProps,\n _theme: PptxThemeConfig,\n _warnings?: PipelineWarning[]\n): Promise<void> {\n const chart = await generateChart(props);\n\n const w = props.w ?? chart.width / PX_PER_INCH;\n const h = props.h ?? chart.height / PX_PER_INCH;\n\n slide.addImage({\n data: chart.base64DataUri,\n x: props.x ?? 0,\n y: props.y ?? 0,\n w,\n h,\n } as any);\n}\n","/**\n * Chart Component Renderer — native PowerPoint charts via pptxgenjs slide.addChart()\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\nimport { warn, W } from '../utils/warn';\n\ninterface ChartDataSeries {\n name?: string;\n labels?: string[];\n values?: number[];\n sizes?: number[];\n}\n\ninterface ChartComponentProps {\n type: string;\n data: ChartDataSeries[];\n\n showLegend?: boolean;\n showTitle?: boolean;\n showValue?: boolean;\n showPercent?: boolean;\n showLabel?: boolean;\n showSerName?: boolean;\n\n title?: string;\n titleFontSize?: number;\n titleColor?: string;\n titleFontFace?: string;\n\n chartColors?: string[];\n\n legendPos?: string;\n legendFontSize?: number;\n legendFontFace?: string;\n legendColor?: string;\n\n catAxisTitle?: string;\n catAxisHidden?: boolean;\n catAxisLabelRotate?: number;\n catAxisLabelFontSize?: number;\n catAxisLabelColor?: string;\n\n valAxisTitle?: string;\n valAxisHidden?: boolean;\n valAxisMinVal?: number;\n valAxisMaxVal?: number;\n valAxisLabelFormatCode?: string;\n valAxisMajorUnit?: number;\n valAxisLabelColor?: string;\n\n barDir?: string;\n barGrouping?: string;\n barGapWidthPct?: number;\n\n lineSmooth?: boolean;\n lineDataSymbol?: string;\n lineSize?: number;\n\n firstSliceAng?: number;\n holeSize?: number;\n\n radarStyle?: string;\n\n dataLabelColor?: string;\n dataLabelFontSize?: number;\n dataLabelFontFace?: string;\n dataLabelFontBold?: boolean;\n dataLabelPosition?: string;\n\n x?: number | string;\n y?: number | string;\n w?: number | string;\n h?: number | string;\n}\n\n// Map our type strings to pptxgenjs CHART_NAME values\nconst CHART_TYPE_MAP: Record<string, string> = {\n area: 'area',\n bar: 'bar',\n bar3D: 'bar3D',\n bubble: 'bubble',\n doughnut: 'doughnut',\n line: 'line',\n pie: 'pie',\n radar: 'radar',\n scatter: 'scatter',\n};\n\nconst DEFAULT_THEME_COLORS = ['primary', 'secondary', 'accent', 'accent4', 'accent5', 'accent6'];\n\nexport function renderChartComponent(\n slide: PptxGenJS.Slide,\n props: ChartComponentProps,\n theme: PptxThemeConfig,\n _pptx: PptxGenJS,\n warnings?: PipelineWarning[]\n): void {\n const chartType = CHART_TYPE_MAP[props.type];\n if (!chartType) {\n warn(warnings, W.UNKNOWN_CHART_TYPE, `Unknown chart type: ${props.type}`, { component: 'chart' });\n return;\n }\n\n // Validate data\n if (!props.data || props.data.length === 0) {\n warn(warnings, W.CHART_NO_DATA, 'Chart component has no data series', { component: 'chart' });\n return;\n }\n for (const series of props.data) {\n if (!series.labels || !series.values) {\n warn(warnings, W.CHART_INVALID_SERIES, `Chart series \"${series.name ?? '(unnamed)'}\" missing labels or values`, { component: 'chart' });\n return;\n }\n }\n if ((chartType === 'pie' || chartType === 'doughnut') && props.data.length > 1) {\n warn(warnings, W.CHART_MULTI_SERIES, `${props.type} chart has ${props.data.length} series — only the first will render`, { component: 'chart' });\n }\n\n // Build data array\n const data = props.data.map((series) => {\n const d: Record<string, unknown> = {};\n if (series.name !== undefined) d.name = series.name;\n if (series.labels) d.labels = series.labels;\n if (series.values) d.values = series.values;\n if (series.sizes) d.sizes = series.sizes;\n return d;\n });\n\n // Build chart options\n const opts: Record<string, unknown> = {};\n\n // Position\n if (props.x !== undefined) opts.x = props.x;\n if (props.y !== undefined) opts.y = props.y;\n if (props.w !== undefined) opts.w = props.w;\n if (props.h !== undefined) opts.h = props.h;\n\n // Colors — resolve semantic names to hex\n const colorSources = props.chartColors ?? DEFAULT_THEME_COLORS;\n opts.chartColors = colorSources.map((c) => resolveColor(c, theme, warnings));\n\n // Auto-default chart text colors from theme to prevent dark-on-dark / light-on-light\n const themeTextColor = resolveColor('text', theme, warnings);\n opts.titleColor = props.titleColor ? resolveColor(props.titleColor, theme, warnings) : themeTextColor;\n opts.legendColor = props.legendColor ? resolveColor(props.legendColor, theme, warnings) : themeTextColor;\n opts.catAxisLabelColor = props.catAxisLabelColor ? resolveColor(props.catAxisLabelColor, theme, warnings) : themeTextColor;\n opts.valAxisLabelColor = props.valAxisLabelColor ? resolveColor(props.valAxisLabelColor, theme, warnings) : themeTextColor;\n\n // Display toggles\n if (props.showLegend !== undefined) opts.showLegend = props.showLegend;\n if (props.showTitle !== undefined) opts.showTitle = props.showTitle;\n if (props.showValue !== undefined) opts.showValue = props.showValue;\n if (props.showPercent !== undefined) opts.showPercent = props.showPercent;\n if (props.showLabel !== undefined) opts.showLabel = props.showLabel;\n if (props.showSerName !== undefined) opts.showSerName = props.showSerName;\n\n // Title\n if (props.title !== undefined) opts.title = props.title;\n if (props.titleFontSize !== undefined) opts.titleFontSize = props.titleFontSize;\n if (props.titleFontFace !== undefined) opts.titleFontFace = props.titleFontFace;\n\n // Legend\n if (props.legendPos !== undefined) opts.legendPos = props.legendPos;\n if (props.legendFontSize !== undefined) opts.legendFontSize = props.legendFontSize;\n if (props.legendFontFace !== undefined) opts.legendFontFace = props.legendFontFace;\n\n // Category axis\n if (props.catAxisTitle !== undefined) {\n opts.catAxisTitle = props.catAxisTitle;\n opts.showCatAxisTitle = true;\n }\n if (props.catAxisHidden !== undefined) opts.catAxisHidden = props.catAxisHidden;\n if (props.catAxisLabelRotate !== undefined) opts.catAxisLabelRotate = props.catAxisLabelRotate;\n if (props.catAxisLabelFontSize !== undefined) opts.catAxisLabelFontSize = props.catAxisLabelFontSize;\n\n // Value axis\n if (props.valAxisTitle !== undefined) {\n opts.valAxisTitle = props.valAxisTitle;\n opts.showValAxisTitle = true;\n }\n if (props.valAxisHidden !== undefined) opts.valAxisHidden = props.valAxisHidden;\n if (props.valAxisMinVal !== undefined) opts.valAxisMinVal = props.valAxisMinVal;\n if (props.valAxisMaxVal !== undefined) opts.valAxisMaxVal = props.valAxisMaxVal;\n if (props.valAxisLabelFormatCode !== undefined) opts.valAxisLabelFormatCode = props.valAxisLabelFormatCode;\n if (props.valAxisMajorUnit !== undefined) opts.valAxisMajorUnit = props.valAxisMajorUnit;\n\n // Bar-specific\n if (props.barDir !== undefined) opts.barDir = props.barDir;\n if (props.barGrouping !== undefined) opts.barGrouping = props.barGrouping;\n if (props.barGapWidthPct !== undefined) opts.barGapWidthPct = props.barGapWidthPct;\n\n // Line-specific\n if (props.lineSmooth !== undefined) opts.lineSmooth = props.lineSmooth;\n if (props.lineDataSymbol !== undefined) opts.lineDataSymbol = props.lineDataSymbol;\n if (props.lineSize !== undefined) opts.lineSize = props.lineSize;\n\n // Pie/doughnut\n if (props.firstSliceAng !== undefined) opts.firstSliceAng = props.firstSliceAng;\n if (props.holeSize !== undefined) opts.holeSize = props.holeSize;\n\n // Radar\n if (props.radarStyle !== undefined) opts.radarStyle = props.radarStyle;\n\n // Data labels\n opts.dataLabelColor = props.dataLabelColor ? resolveColor(props.dataLabelColor, theme, warnings) : themeTextColor;\n if (props.dataLabelFontSize !== undefined) opts.dataLabelFontSize = props.dataLabelFontSize;\n if (props.dataLabelFontFace !== undefined) opts.dataLabelFontFace = props.dataLabelFontFace;\n if (props.dataLabelFontBold !== undefined) opts.dataLabelFontBold = props.dataLabelFontBold;\n if (props.dataLabelPosition !== undefined) opts.dataLabelPosition = props.dataLabelPosition;\n\n slide.addChart(chartType as any, data as any[], opts as any);\n}\n","/**\n * PPTX Component Renderers\n */\n\nimport type PptxGenJS from 'pptxgenjs';\nimport type { PptxThemeConfig, PptxComponentInput, PipelineWarning, SlideContext } from '../types';\nimport { warn, W } from '../utils/warn';\nimport { renderTextComponent } from './text';\nimport { renderImageComponent } from './image';\nimport { renderShapeComponent } from './shape';\nimport { renderTableComponent } from './table';\nimport { renderHighchartsComponent } from './highcharts';\nimport { renderChartComponent } from './chart';\n\nexport { renderTextComponent } from './text';\nexport { renderImageComponent } from './image';\nexport { renderShapeComponent } from './shape';\nexport { renderTableComponent } from './table';\nexport { renderHighchartsComponent } from './highcharts';\nexport { renderChartComponent } from './chart';\n\nexport async function renderComponent(\n slide: PptxGenJS.Slide,\n component: PptxComponentInput,\n theme: PptxThemeConfig,\n pptx: PptxGenJS,\n warnings?: PipelineWarning[],\n slideCtx?: SlideContext\n): Promise<void> {\n if (component.enabled === false) return;\n\n const { name, props } = component;\n const p = props as any;\n\n switch (name) {\n case 'text':\n renderTextComponent(slide, p, theme, warnings, slideCtx);\n break;\n case 'image':\n await renderImageComponent(slide, p, theme, warnings);\n break;\n case 'shape':\n renderShapeComponent(slide, p, theme, pptx, warnings);\n break;\n case 'table':\n renderTableComponent(slide, p, theme, pptx, warnings);\n break;\n case 'highcharts':\n await renderHighchartsComponent(slide, p, theme, warnings);\n break;\n case 'chart':\n renderChartComponent(slide, p, theme, pptx, warnings);\n break;\n default:\n warn(warnings, W.UNKNOWN_COMPONENT, `Unknown PPTX component type: ${name}`, { component: name });\n }\n}\n","/**\n * Template Slide Builder\n * Converts internal TemplateSlideDefinition to pptxgenjs SlideMasterProps\n *\n * Fixed objects (shapes, text, images) are no longer rendered here — they use\n * the unified component pipeline and are rendered per-slide in render.ts.\n */\n\nimport type { TemplateSlideDefinition, PptxThemeConfig, PipelineWarning } from '../types';\nimport { resolveColor } from '../utils/color';\n\nexport function buildSlideTemplateProps(\n def: TemplateSlideDefinition,\n theme: PptxThemeConfig,\n warnings?: PipelineWarning[]\n): Record<string, any> {\n const result: Record<string, any> = { title: def.name };\n\n // Background\n if (def.background) {\n if (def.background.color) {\n result.background = { color: resolveColor(def.background.color, theme, warnings) };\n } else if (def.background.image) {\n if (def.background.image.path) {\n result.background = { path: def.background.image.path };\n } else if (def.background.image.base64) {\n result.background = { data: def.background.image.base64 };\n }\n }\n }\n\n // Margin\n if (def.margin !== undefined) result.margin = def.margin;\n\n // Slide number\n if (def.slideNumber) {\n result.slideNumber = {\n x: def.slideNumber.x,\n y: def.slideNumber.y,\n };\n if (def.slideNumber.w !== undefined) result.slideNumber.w = def.slideNumber.w;\n if (def.slideNumber.h !== undefined) result.slideNumber.h = def.slideNumber.h;\n if (def.slideNumber.color) result.slideNumber.color = resolveColor(def.slideNumber.color, theme, warnings);\n if (def.slideNumber.fontSize) result.slideNumber.fontSize = def.slideNumber.fontSize;\n }\n\n return result;\n}\n","/**\n * Plugin system for json-to-pptx\n *\n * @example\n * ```typescript\n * import { createComponent, createVersion, createPresentationGenerator } from '@json-to-office/core-pptx/plugin';\n * import { Type } from '@sinclair/typebox';\n *\n * const bannerComponent = createComponent({\n * name: 'banner' as const,\n * versions: {\n * '1.0.0': createVersion({\n * propsSchema: Type.Object({ title: Type.String() }),\n * render: async ({ props }) => [{\n * name: 'text',\n * props: { text: props.title, x: 0.5, y: 0.5, w: 9, h: 1 }\n * }]\n * })\n * }\n * });\n *\n * const generator = createPresentationGenerator()\n * .addComponent(bannerComponent);\n * ```\n */\n\n// Component creation (from shared)\nexport {\n createComponent,\n createVersion,\n type CustomComponent,\n type ComponentVersion,\n type ComponentVersionMap,\n type RenderFunction,\n type RenderContext,\n} from '@json-to-office/shared/plugin';\n\n// Generator\nexport {\n createPresentationGenerator,\n type PresentationGeneratorOptions,\n} from './createPresentationGenerator';\n\n// Types\nexport {\n type PresentationGenerator,\n type PresentationGeneratorBuilder,\n type BufferGenerationResult,\n type FileGenerationResult,\n type ValidationResult,\n type ExtractCustomComponentType,\n type CustomComponentUnion,\n type ExtendedPptxComponentInput,\n type ExtendedPresentationComponent,\n type InferBuilderComponents,\n type InferDocumentType,\n type InferComponentDefinition,\n} from './types';\n\n// Validation\nexport {\n validateComponentProps,\n validatePresentation,\n cleanComponentProps,\n ComponentValidationError,\n DuplicateComponentError,\n type ValidationError,\n type ComponentValidationResult,\n} from './validation';\n\n// Schema\nexport { generatePluginPresentationSchema, exportPluginSchema } from './schema';\n\n// Version resolution (from shared)\nexport { resolveComponentVersion } from '@json-to-office/shared/plugin';\n","import JSZip from 'jszip';\nimport type { TSchema } from '@sinclair/typebox';\nimport type { CustomComponent } from '@json-to-office/shared/plugin';\nimport {\n resolveComponentVersion,\n DuplicateComponentError,\n ComponentValidationError,\n} from '@json-to-office/shared/plugin';\nimport type {\n PptxComponentInput,\n PresentationComponentDefinition,\n PipelineWarning,\n PptxThemeConfig,\n} from '../types';\nimport type {\n ExtendedPresentationComponent,\n PresentationGeneratorBuilder,\n BufferGenerationResult,\n FileGenerationResult,\n ValidationResult,\n} from './types';\nimport { validatePresentation, cleanComponentProps } from './validation';\nimport { generatePluginPresentationSchema, exportPluginSchema } from './schema';\nimport { processPresentation } from '../core/structure';\nimport { renderPresentation } from '../core/render';\nimport { getPptxTheme } from '../themes';\n\n/**\n * Options for creating a presentation generator\n */\nexport interface PresentationGeneratorOptions {\n /** Theme configuration or theme name */\n theme?: PptxThemeConfig | string;\n /** Custom themes map */\n customThemes?: Record<string, PptxThemeConfig>;\n /** Enable debug logging */\n debug?: boolean;\n}\n\n/**\n * Internal state held by each builder instance\n */\ninterface BuilderState {\n components: readonly CustomComponent<any, any, any>[];\n componentNames: Set<string>;\n theme?: PptxThemeConfig | string;\n customThemes?: Record<string, PptxThemeConfig>;\n debug: boolean;\n}\n\n/**\n * Replace the default table style (Medium Style 2 - Accent 1, which applies allCaps\n * to headers) with \"No Style, No Grid\" so table text renders as authored.\n */\nconst MEDIUM_STYLE_2_ACCENT_1 = '{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}';\nconst NO_STYLE_NO_GRID = '{2D5ABB26-0587-4C30-8999-92F81FD0307C}';\n\nasync function neutralizeTableStyle(buffer: Buffer): Promise<Buffer> {\n const zip = await JSZip.loadAsync(buffer);\n let changed = false;\n for (const [path, entry] of Object.entries(zip.files)) {\n if (!path.match(/^ppt\\/slides\\/slide\\d+\\.xml$/)) continue;\n const xml = await entry.async('string');\n if (xml.includes(MEDIUM_STYLE_2_ACCENT_1)) {\n zip.file(path, xml.replaceAll(MEDIUM_STYLE_2_ACCENT_1, NO_STYLE_NO_GRID));\n changed = true;\n }\n }\n return changed\n ? ((await zip.generateAsync({ type: 'nodebuffer' })) as Buffer)\n : buffer;\n}\n\n/**\n * Create the builder implementation with the given state\n */\nfunction createBuilderImpl<\n TComponents extends readonly CustomComponent<any, any, any>[],\n>(state: BuilderState): PresentationGeneratorBuilder<TComponents> {\n const componentMap = new Map(state.components.map((c) => [c.name, c]));\n\n /**\n * Process custom components in slide children, recursively resolving them\n * to standard PptxComponentInput elements.\n */\n async function processSlideComponents(\n components: PptxComponentInput[],\n warningsCollector: PipelineWarning[],\n theme: PptxThemeConfig,\n depth = 0\n ): Promise<PptxComponentInput[]> {\n if (depth > 20) {\n throw new Error(\n 'Maximum component nesting depth exceeded (20). Check for circular component references.'\n );\n }\n const processed: PptxComponentInput[] = [];\n\n for (const componentData of components) {\n const customComponent = componentMap.get(componentData.name);\n\n if (customComponent) {\n try {\n if (!componentData.props) {\n throw new Error(\n `Custom component '${componentData.name}' must have a 'props' property. ` +\n `Use format: { name: '${componentData.name}', props: {...} }`\n );\n }\n\n const componentWithVersion = componentData as {\n name: string;\n version?: string;\n props: Record<string, any>;\n children?: PptxComponentInput[];\n };\n\n // Resolve version\n const versionEntry = resolveComponentVersion(\n customComponent.name,\n customComponent.versions,\n componentWithVersion.version\n );\n\n // Validate and clean props\n const cleanedProps = cleanComponentProps(\n versionEntry,\n componentWithVersion.props\n );\n\n // Process nested children if container\n let nestedChildren: unknown[] | undefined;\n if (\n componentWithVersion.children &&\n Array.isArray(componentWithVersion.children)\n ) {\n nestedChildren = await processSlideComponents(\n componentWithVersion.children,\n warningsCollector,\n theme,\n depth + 1\n );\n }\n\n // Create addWarning callback\n const versionLabel = componentWithVersion.version\n ? `${customComponent.name}@${componentWithVersion.version}`\n : customComponent.name;\n\n const addWarning = (\n message: string,\n context?: Record<string, unknown>\n ) => {\n warningsCollector.push({\n code: (context?.code as string) ?? 'PLUGIN_WARNING',\n message,\n component: versionLabel,\n slide: context?.slide as number | undefined,\n });\n };\n\n // Call render\n const result = await versionEntry.render({\n props: cleanedProps,\n theme,\n addWarning,\n children: nestedChildren,\n });\n\n const resultComponents = (\n Array.isArray(result) ? result : [result]\n ) as PptxComponentInput[];\n\n // Recursively process in case result contains more custom components\n const processedResult = await processSlideComponents(\n resultComponents,\n warningsCollector,\n theme,\n depth + 1\n );\n processed.push(...processedResult);\n\n if (state.debug) {\n console.log(\n `Processed custom component '${versionLabel}':`,\n processedResult\n );\n }\n } catch (error) {\n if (error instanceof ComponentValidationError) {\n throw error;\n }\n throw new Error(\n `Error processing custom component '${customComponent.name}': ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n } else {\n // Standard component — process children recursively\n if (componentData.children && Array.isArray(componentData.children)) {\n const processedChildren = await processSlideComponents(\n componentData.children,\n warningsCollector,\n theme,\n depth + 1\n );\n processed.push({\n ...componentData,\n children: processedChildren,\n });\n } else {\n processed.push(componentData);\n }\n }\n }\n\n return processed;\n }\n\n /**\n * Add a custom component to the generator\n */\n function addComponent<TNewComponent extends CustomComponent<any, any, any>>(\n component: TNewComponent\n ): PresentationGeneratorBuilder<readonly [...TComponents, TNewComponent]> {\n if (!component.name) {\n throw new Error('Component name is required');\n }\n\n if (state.componentNames.has(component.name)) {\n throw new DuplicateComponentError(component.name);\n }\n\n const newComponentNames = new Set(state.componentNames);\n newComponentNames.add(component.name);\n\n const newState: BuilderState = {\n components: [...state.components, component],\n componentNames: newComponentNames,\n theme: state.theme,\n customThemes: state.customThemes,\n debug: state.debug,\n };\n\n return createBuilderImpl<readonly [...TComponents, TNewComponent]>(\n newState\n );\n }\n\n /**\n * Generate a presentation buffer\n */\n async function generate(\n document: ExtendedPresentationComponent<TComponents>\n ): Promise<BufferGenerationResult> {\n try {\n const internalDocument =\n document as unknown as PresentationComponentDefinition;\n\n if (!internalDocument || internalDocument.name !== 'pptx') {\n throw new Error('Top-level component must be a pptx component');\n }\n\n // Resolve theme for render context\n const themeName =\n typeof state.theme === 'string'\n ? state.theme\n : internalDocument.props.theme ?? 'default';\n const resolvedTheme =\n typeof state.theme === 'object'\n ? state.theme\n : state.customThemes?.[themeName] ?? getPptxTheme(themeName);\n\n const warnings: PipelineWarning[] = [];\n\n // Process custom components in all slide children\n const processedChildren = internalDocument.children\n ? await processAllSlides(\n internalDocument.children,\n warnings,\n resolvedTheme\n )\n : [];\n\n const processedDocument: PresentationComponentDefinition = {\n ...internalDocument,\n children: processedChildren,\n };\n\n // Run the standard PPTX pipeline\n const processed = processPresentation(processedDocument, {\n customThemes: state.customThemes,\n });\n const pptx = await renderPresentation(processed, warnings);\n const data = await pptx.write({ outputType: 'nodebuffer' });\n const buffer = await neutralizeTableStyle(data as Buffer);\n\n return { buffer, warnings };\n } catch (error) {\n if (state.debug) {\n console.error('Presentation generation error:', error);\n }\n throw error;\n }\n }\n\n /**\n * Process custom components inside all slides.\n * Walks the top-level children (slides), then processes each slide's children.\n */\n async function processAllSlides(\n children: PptxComponentInput[],\n warnings: PipelineWarning[],\n theme: PptxThemeConfig\n ): Promise<PptxComponentInput[]> {\n const result: PptxComponentInput[] = [];\n\n for (const child of children) {\n if (child.name === 'slide' && child.children) {\n const processedSlideChildren = await processSlideComponents(\n child.children,\n warnings,\n theme\n );\n result.push({ ...child, children: processedSlideChildren });\n } else {\n // Non-slide top-level children — process in case they're custom\n const processedTopLevel = await processSlideComponents(\n [child],\n warnings,\n theme\n );\n result.push(...processedTopLevel);\n }\n }\n\n return result;\n }\n\n /**\n * Generate and save to file\n */\n async function generateFile(\n document: ExtendedPresentationComponent<TComponents>,\n outputPath: string\n ): Promise<FileGenerationResult> {\n const { buffer, warnings } = await generate(document);\n const fs = await import('fs/promises');\n await fs.writeFile(outputPath, new Uint8Array(buffer));\n return { warnings };\n }\n\n /**\n * Get registered component names\n */\n function getComponentNames(): string[] {\n return Array.from(state.componentNames);\n }\n\n /**\n * Validate a document without generating it\n */\n function validate(\n document: ExtendedPresentationComponent<TComponents>\n ): ValidationResult {\n try {\n const internalDocument =\n document as unknown as PresentationComponentDefinition;\n const result = validatePresentation(\n internalDocument,\n state.components as unknown as CustomComponent<TSchema>[]\n );\n if (!result.valid) {\n return {\n valid: false,\n errors: result.errors.map((e) => ({\n path: e.path,\n message: e.message,\n })),\n };\n }\n return { valid: true };\n } catch (error) {\n if (error instanceof ComponentValidationError) {\n return {\n valid: false,\n errors: error.errors.map((e) => ({\n path: e.path,\n message: e.message,\n })),\n };\n }\n return {\n valid: false,\n errors: [\n {\n path: 'document',\n message: error instanceof Error ? error.message : String(error),\n },\n ],\n };\n }\n }\n\n /**\n * Generate the extended JSON schema\n */\n function generateSchema(): TSchema {\n return generatePluginPresentationSchema(\n state.components as unknown as CustomComponent<TSchema>[]\n );\n }\n\n /**\n * Export the schema to a file\n */\n async function exportSchemaToFile(\n outputPath: string,\n options?: { prettyPrint?: boolean }\n ): Promise<void> {\n await exportPluginSchema(\n state.components as unknown as CustomComponent<TSchema>[],\n outputPath,\n options\n );\n }\n\n return Object.freeze({\n addComponent,\n generate,\n generateBuffer: generate,\n generateFile,\n getComponentNames,\n validate,\n generateSchema,\n exportSchema: exportSchemaToFile,\n });\n}\n\n/**\n * Create a presentation generator with chainable component registration.\n */\nexport function createPresentationGenerator(\n options: PresentationGeneratorOptions = {}\n): PresentationGeneratorBuilder<readonly []> {\n const initialState: BuilderState = {\n components: [],\n componentNames: new Set(),\n theme: options.theme,\n customThemes: options.customThemes,\n debug: options.debug ?? false,\n };\n\n return createBuilderImpl<readonly []>(initialState);\n}\n","import type { TSchema, Static } from '@sinclair/typebox';\nimport type { CustomComponent } from '@json-to-office/shared/plugin';\nimport type { PresentationComponentDefinition } from '../types';\nimport {\n resolveComponentVersion,\n validateCustomComponentProps,\n ComponentValidationError,\n type ComponentValidationResult,\n} from '@json-to-office/shared/plugin';\nimport type { ValidationError } from '@json-to-office/shared';\n\n// Re-export errors from shared\nexport {\n DuplicateComponentError,\n ComponentValidationError,\n} from '@json-to-office/shared/plugin';\nexport type { ComponentValidationResult } from '@json-to-office/shared/plugin';\nexport type { ValidationError } from '@json-to-office/shared';\n\n/**\n * Validate component props against a schema.\n */\nexport function validateComponentProps<TPropsSchema extends TSchema>(\n schema: { propsSchema: TPropsSchema },\n props: unknown,\n componentName?: string\n): ComponentValidationResult<TPropsSchema> {\n return validateCustomComponentProps<TPropsSchema>(schema.propsSchema, props, {\n clean: true,\n applyDefaults: true,\n componentName,\n });\n}\n\n/**\n * Validate presentation and all custom components (version-aware).\n * PPTX has no structural document validation — only custom component props are checked.\n */\nexport function validatePresentation(\n document: PresentationComponentDefinition,\n customComponents: CustomComponent<any, any, any>[]\n): { valid: boolean; errors: ValidationError[] } {\n const errors: ValidationError[] = [];\n\n function validateComponents(components: any[], pathPrefix = 'children') {\n components.forEach((componentData, index) => {\n const customComponent = customComponents.find(\n (cc) => cc.name === componentData.name\n );\n\n if (customComponent) {\n const versionEntry = resolveComponentVersion(\n customComponent.name,\n customComponent.versions,\n componentData.version\n );\n\n const validation = validateComponentProps(\n versionEntry,\n componentData.props,\n customComponent.name\n );\n\n if (!validation.valid && validation.errors) {\n const indexedErrors = validation.errors.map(\n (error: ValidationError) => ({\n ...error,\n path: `${pathPrefix}[${index}].${error.path}`,\n })\n );\n errors.push(...indexedErrors);\n }\n }\n\n // Recurse into children (slides, containers, etc.)\n if (componentData.children && Array.isArray(componentData.children)) {\n validateComponents(\n componentData.children,\n `${pathPrefix}[${index}].children`\n );\n }\n });\n }\n\n if (document.children) {\n validateComponents(document.children);\n }\n\n return errors.length > 0\n ? { valid: false, errors }\n : { valid: true, errors: [] };\n}\n\n/**\n * Validates component props and returns typed props or throws.\n */\nexport function getValidatedProps<TPropsSchema extends TSchema>(\n schema: { propsSchema: TPropsSchema },\n props: unknown\n): Static<TPropsSchema> {\n const validation = validateComponentProps(schema, props);\n\n if (!validation.valid) {\n throw new ComponentValidationError(validation.errors || [], props);\n }\n\n return validation.data!;\n}\n\nexport const cleanComponentProps = getValidatedProps;\n","import type { TSchema } from '@sinclair/typebox';\nimport type { CustomComponent } from '@json-to-office/shared/plugin';\nimport {\n generateUnifiedDocumentSchema,\n type CustomComponentInfo,\n} from '@json-to-office/shared-pptx';\n\n/**\n * Generate a JSON schema for plugin-enhanced presentations at RUNTIME.\n */\nexport function generatePluginPresentationSchema(\n customComponents: CustomComponent<any, any, any>[]\n): TSchema {\n const customComponentInfos: CustomComponentInfo[] = customComponents.map(\n (component) => {\n const versionKeys = Object.keys(component.versions);\n\n const versions = versionKeys.map((v) => ({\n version: v,\n propsSchema: component.versions[v].propsSchema,\n hasChildren: component.versions[v].hasChildren === true,\n description: component.versions[v].description,\n }));\n\n return {\n name: component.name,\n versions,\n };\n }\n );\n\n return generateUnifiedDocumentSchema({\n customComponents: customComponentInfos,\n });\n}\n\n/**\n * Export a plugin-enhanced JSON schema to a file at RUNTIME\n */\nexport async function exportPluginSchema(\n customComponents: CustomComponent<any, any, any>[],\n outputPath: string,\n options: { prettyPrint?: boolean } = {}\n): Promise<void> {\n const { prettyPrint = true } = options;\n\n const { convertToJsonSchema, exportSchemaToFile } = await import(\n '@json-to-office/shared'\n );\n\n const schema = generatePluginPresentationSchema(customComponents);\n\n const jsonSchema = convertToJsonSchema(schema, {\n $schema: 'http://json-schema.org/draft-07/schema#',\n });\n\n await exportSchemaToFile(jsonSchema, outputPath, { prettyPrint });\n}\n","// Version information\nexport function getPptxCoreVersion(): string {\n return 'PptxCore v1.0.0';\n}\n\n// Core API\nexport {\n generatePresentation,\n generateBufferFromJson,\n generateBufferWithWarnings,\n generateAndSaveFromJson,\n generateFromFile,\n savePresentation,\n isPresentationComponentDefinition,\n PresentationGenerator,\n} from './core/generator';\n\nexport type { GenerationOptions, GenerationResult } from './core/generator';\n\n// Types\nexport type {\n PptxComponentInput,\n PresentationComponentDefinition,\n SlideComponentDefinition,\n ProcessedPresentation,\n ProcessedSlide,\n PptxThemeConfig,\n PipelineWarning,\n SlideContext,\n} from './types';\n\nexport { isPresentationComponent, isSlideComponent } from './types';\n\n// Warning utilities\nexport { W as WarningCodes } from './utils/warn';\nexport type { WarningCode } from './utils/warn';\n\n// Themes\nexport { DEFAULT_PPTX_THEME, getPptxTheme, pptxThemes } from './themes';\n\n// Plugin system\nexport {\n createComponent,\n createVersion,\n createPresentationGenerator,\n resolveComponentVersion,\n validateComponentProps,\n validatePresentation,\n cleanComponentProps,\n ComponentValidationError,\n DuplicateComponentError,\n generatePluginPresentationSchema,\n exportPluginSchema,\n} from './plugin';\n\nexport type {\n CustomComponent,\n ComponentVersion,\n ComponentVersionMap,\n RenderFunction,\n RenderContext,\n PresentationGeneratorOptions,\n PresentationGenerator as PluginPresentationGenerator,\n PresentationGeneratorBuilder,\n BufferGenerationResult as PluginBufferGenerationResult,\n FileGenerationResult as PluginFileGenerationResult,\n ValidationResult as PluginValidationResult,\n ExtractCustomComponentType,\n CustomComponentUnion,\n ExtendedPptxComponentInput,\n ExtendedPresentationComponent,\n InferBuilderComponents,\n InferDocumentType,\n InferComponentDefinition,\n ComponentValidationResult,\n ValidationError as PluginValidationError,\n} from './plugin';\n\n// Component renderers\nexport {\n renderTextComponent,\n renderImageComponent,\n renderShapeComponent,\n renderTableComponent,\n renderHighchartsComponent,\n renderComponent,\n} from './components';\n"],"mappings":";AAMA,OAAO,WAAW;AAClB,SAAS,qBAAqB;;;AC+JvB,SAAS,wBACd,WAC8C;AAC9C,SACE,OAAO,cAAc,YACrB,cAAc,QACb,UAAkB,SAAS;AAEhC;AAEO,SAAS,iBACd,WACuC;AACvC,SACE,OAAO,cAAc,YACrB,cAAc,QACb,UAAkB,SAAS;AAEhC;;;ACtLO,IAAM,IAAI;AAAA,EACf,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,sBAAsB;AAAA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AA,UAChE;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAKA,WAAS,iBAA0B;AACjC,WAAO;AAAA,MACL,MAAM;AAAA,IACR;AAAA,EACF;AAKA,iBAAe,mBACb,YACA,SACe;AACf,UAAM;AAAA,MACJ,MAAM;AAAA,MACN;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,OAAO;AAAA,IACnB;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,EAChB,CAAC;AACH;AAKO,SAAS,4BACd,UAAwC,CAAC,GACE;AAC3C,QAAM,eAA6B;AAAA,IACjC,YAAY,CAAC;AAAA,IACb,gBAAgB,oBAAI,IAAI;AAAA,IACxB,OAAO,QAAQ;AAAA,IACf,cAAc,QAAQ;AAAA,IACtB,OAAO,QAAQ,SAAS;AAAA,EAC1B;AAEA,SAAO,kBAA+B,YAAY;AACpD;;;AD7XA,SAAS,2BAAAE,gCAA+B;;;AIzEjC,SAAS,qBAA6B;AAC3C,SAAO;AACT;","names":["result","opts","path","JSZip","resolveComponentVersion","DuplicateComponentError","ComponentValidationError","ComponentValidationError","MEDIUM_STYLE_2_ACCENT_1","NO_STYLE_NO_GRID","neutralizeTableStyle","JSZip","path","resolveComponentVersion","ComponentValidationError","DuplicateComponentError","resolveComponentVersion"]}
|