'use client'; import { useMemo, useRef, type CSSProperties, type ReactNode } from 'react'; import { AnimatePresence } from 'motion/react'; import type { PPTElement, PPTImageElement, PPTShapeElement, PPTTableElement, PPTTextElement, PPTVideoElement, Slide, SlideBackground, } from '@openmaic/dsl'; import type { SlideEffects } from './types/effects'; import { findElementGeometry, type PercentageGeometry } from './utils/geometry'; import { useSlideBackgroundStyle } from './hooks/useSlideBackgroundStyle'; import { useViewportSize } from './hooks/useViewportSize'; import { SlideElement } from './SlideElement'; import { HighlightOverlay } from './effects/HighlightOverlay'; import { SpotlightOverlay } from './effects/SpotlightOverlay'; import { LaserOverlay } from './effects/LaserOverlay'; import { useOptionalSlideContext } from './context'; import { SLIDE_RENDERER_STYLES } from './styles'; export interface SlideCanvasProps { /** * Single slide data (PPTist-style). May be omitted when this component is * rendered inside a `` that supplies it. */ slide?: Slide; /** * Canvas scale. When omitted, the canvas auto-fits the container using * `slide.viewportSize` and `slide.viewportRatio`. Set to a fixed number * (e.g. 1) to skip auto-fit and render at slide-native dimensions. */ scale?: number; /** Percent of the container to use when auto-fitting the slide. */ canvasPercentage?: number; /** Called with the computed fit scale when `scale` is omitted. */ onScaleChange?: (scale: number) => void; /** Override `slide.background`. */ background?: SlideBackground; /** Optional play-time effects, all default off. */ effects?: SlideEffects; /** Replace default rendering for image elements. */ renderImage?: ( element: PPTImageElement, resolvedSrc: string, defaultContent: ReactNode, ) => ReactNode; /** Replace default