MCPcopy Index your code
hub / github.com/simstudioai/sim / renderSlide

Function renderSlide

apps/sim/lib/pptx-renderer/renderer/slide-renderer.ts:199–315  ·  view source on GitHub ↗
(
  presentation: PresentationData,
  slide: SlideData,
  options?: SlideRendererOptions
)

Source from the content-addressed store, hash-verified

197 * 4. Slide shapes (on top)
198 */
199export function renderSlide(
200 presentation: PresentationData,
201 slide: SlideData,
202 options?: SlideRendererOptions
203): SlideHandle {
204 const isSharedCache = !!options?.mediaUrlCache
205
206 // Create render context (resolves slide -> layout -> master -> theme chain)
207 const ctx = createRenderContext(
208 presentation,
209 slide,
210 options?.mediaUrlCache,
211 options?.chartInstances
212 )
213 if (options?.onNavigate) {
214 ctx.onNavigate = options.onNavigate
215 }
216
217 // Create slide container
218 const container = document.createElement('div')
219 container.style.position = 'relative'
220 container.style.width = `${presentation.width}px`
221 container.style.height = `${presentation.height}px`
222 container.style.overflow = 'hidden'
223 container.style.backgroundColor = '#FFFFFF'
224
225 // Render background
226 try {
227 renderBackground(ctx, container)
228 } catch (e) {
229 options?.onNodeError?.('__background__', e)
230 }
231
232 // --- Render master template shapes (behind layout and slide) ---
233 // Respect showMasterSp flags:
234 // - layout.showMasterSp === false → skip master shapes
235 // - slide.showMasterSp === false → skip both master AND layout shapes
236 if (slide.showMasterSp && ctx.layout.showMasterSp) {
237 const masterCtx: RenderContext = {
238 ...ctx,
239 slide: { ...ctx.slide, rels: ctx.master.rels },
240 }
241 const masterShapes = parseTemplateShapes(ctx.master.spTree, slide.nodes)
242 for (const node of masterShapes) {
243 try {
244 const el = renderNode(node, masterCtx)
245 container.appendChild(el)
246 } catch {
247 // Master shape errors are non-fatal
248 }
249 }
250 }
251
252 // --- Render layout template shapes ---
253 if (slide.showMasterSp) {
254 const layoutCtx: RenderContext = {
255 ...ctx,
256 slide: { ...ctx.slide, rels: ctx.layout.rels },

Callers

nothing calls this directly

Calls 5

createRenderContextFunction · 0.90
renderBackgroundFunction · 0.90
parseTemplateShapesFunction · 0.85
renderNodeFunction · 0.85
createErrorPlaceholderFunction · 0.85

Tested by

no test coverage detected