{"version":3,"file":"react.cjs","sources":["../src/react.tsx"],"sourcesContent":["/**\n * The React wrapper.\n *\n * ```tsx\n * <PresentationViewer src=\"/file.pptx\" width=\"100%\" height=\"100vh\" />\n * ```\n *\n * The component owns three things the API layer deliberately does not: when to re-render\n * (a resize, a slide change, a prop change), how to keep the canvas backing store in step\n * with its CSS size, and keyboard navigation.\n */\n\nimport {\n  forwardRef,\n  useCallback,\n  useEffect,\n  useImperativeHandle,\n  useMemo,\n  useRef,\n  useState,\n} from 'react';\n\nimport { Presentation } from './presentation.js';\nimport {\n  PptxError,\n  type PresentationInfo,\n  type PresentationViewerProps,\n  type TextLayerRun,\n} from './types.js';\n\n/** Imperative handle, for callers that need to drive the viewer. */\nexport interface PresentationViewerHandle {\n  next(): void;\n  previous(): void;\n  goTo(index: number): void;\n  readonly slide: number;\n  readonly slideCount: number;\n  /** The open presentation, once loaded. */\n  readonly presentation: Presentation | null;\n  /** Redraw the current slide. */\n  redraw(): void;\n}\n\nexport const PresentationViewer = forwardRef<PresentationViewerHandle, PresentationViewerProps>(\n  function PresentationViewer(props, ref) {\n    const {\n      src,\n      width = '100%',\n      height = '100%',\n      initialSlide = 0,\n      slide: controlledSlide,\n      fit = 'contain',\n      zoom = 1,\n      keyboard = true,\n      selectableText = false,\n      wasm,\n      loading,\n      renderError,\n      className,\n      style,\n      onLoad,\n      onError,\n      onSlideChange,\n    } = props;\n\n    const canvasRef = useRef<HTMLCanvasElement | null>(null);\n    const [textRuns, setTextRuns] = useState<TextLayerRun[]>([]);\n    const containerRef = useRef<HTMLDivElement | null>(null);\n    const presentationRef = useRef<Presentation | null>(null);\n\n    const [info, setInfo] = useState<PresentationInfo | null>(null);\n    const [error, setError] = useState<PptxError | null>(null);\n    const [uncontrolledSlide, setUncontrolledSlide] = useState(initialSlide);\n\n    const isControlled = controlledSlide !== undefined;\n    const currentSlide = isControlled ? controlledSlide : uncontrolledSlide;\n\n    // Callbacks are held in a ref so that a caller passing an inline arrow function does\n    // not re-open the deck on every render.\n    const handlers = useRef({ onLoad, onError, onSlideChange });\n    handlers.current = { onLoad, onError, onSlideChange };\n\n    // --- open the deck -----------------------------------------------------------\n\n    useEffect(() => {\n      let cancelled = false;\n      const controller = new AbortController();\n      setError(null);\n      setInfo(null);\n\n      Presentation.open(src, { wasm, signal: controller.signal })\n        .then((deck) => {\n          if (cancelled) {\n            deck.destroy();\n            return;\n          }\n          presentationRef.current = deck;\n          setInfo(deck.info);\n          handlers.current.onLoad?.(deck.info);\n        })\n        .catch((e: unknown) => {\n          if (cancelled) return;\n          const err = e instanceof PptxError ? e : new PptxError(String(e), e);\n          setError(err);\n          handlers.current.onError?.(err);\n        });\n\n      return () => {\n        cancelled = true;\n        controller.abort();\n        presentationRef.current?.destroy();\n        presentationRef.current = null;\n      };\n    }, [src, wasm]);\n\n    // Clamp the slide index when a shorter deck loads under a stale index.\n    useEffect(() => {\n      if (!info || isControlled) return;\n      if (uncontrolledSlide >= info.slideCount) {\n        setUncontrolledSlide(Math.max(0, info.slideCount - 1));\n      }\n    }, [info, isControlled, uncontrolledSlide]);\n\n    // --- drawing -----------------------------------------------------------------\n\n    const draw = useCallback(() => {\n      const deck = presentationRef.current;\n      const canvas = canvasRef.current;\n      if (!deck || !canvas || deck.slideCount === 0) return;\n      const index = Math.min(Math.max(0, currentSlide), deck.slideCount - 1);\n\n      // A frame that was missing images is redrawn from the `onAssetsReady` subscription\n      // below, not from a guessed delay here.\n      deck.render(index, canvas, { fit, zoom }).catch((e: unknown) => {\n        const err = e instanceof PptxError ? e : new PptxError(String(e), e);\n        setError(err);\n        handlers.current.onError?.(err);\n      });\n\n      // The overlay is positioned in CSS pixels, so it asks for the layout at the\n      // canvas's CSS size with dpr 1 — the same view, minus the device-pixel scaling.\n      if (selectableText) {\n        setTextRuns(\n          deck.textLayer(index, {\n            width: canvas.clientWidth || undefined,\n            height: canvas.clientHeight || undefined,\n            dpr: 1,\n            fit,\n            zoom,\n          }),\n        );\n      }\n\n      // Warm the neighbours so navigation does not pay for layout.\n      deck.prepare(index + 1);\n      deck.prepare(index - 1);\n    }, [currentSlide, fit, zoom, selectableText]);\n\n    useEffect(() => {\n      draw();\n    }, [draw, info]);\n\n    // Images decode after the first frame. Redraw when they land, rather than polling or\n    // guessing how long decoding takes.\n    useEffect(() => {\n      const deck = presentationRef.current;\n      if (!deck) return;\n      return deck.onAssetsReady(draw);\n    }, [draw, info]);\n\n    // Redraw on resize. `ResizeObserver` rather than a window listener, so a viewer in a\n    // resizable panel stays correct without the page resizing at all.\n    useEffect(() => {\n      const container = containerRef.current;\n      if (!container || typeof ResizeObserver === 'undefined') return;\n      let frame = 0;\n      const observer = new ResizeObserver(() => {\n        // Coalesce: a drag-resize fires this continuously and each draw is a full render.\n        cancelAnimationFrame(frame);\n        frame = requestAnimationFrame(draw);\n      });\n      observer.observe(container);\n      return () => {\n        cancelAnimationFrame(frame);\n        observer.disconnect();\n      };\n    }, [draw]);\n\n    // Redraw when the device pixel ratio changes — dragging a window between a Retina\n    // and a non-Retina display does not fire a resize.\n    useEffect(() => {\n      if (typeof window === 'undefined' || !window.matchMedia) return;\n      const query = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);\n      const onChange = () => draw();\n      query.addEventListener?.('change', onChange);\n      return () => query.removeEventListener?.('change', onChange);\n    }, [draw]);\n\n    // --- navigation --------------------------------------------------------------\n\n    const goTo = useCallback(\n      (index: number) => {\n        const count = presentationRef.current?.slideCount ?? 0;\n        if (count === 0) return;\n        const clamped = Math.min(Math.max(0, index), count - 1);\n        if (clamped === currentSlide) return;\n        if (!isControlled) setUncontrolledSlide(clamped);\n        handlers.current.onSlideChange?.(clamped);\n      },\n      [currentSlide, isControlled],\n    );\n\n    const next = useCallback(() => goTo(currentSlide + 1), [goTo, currentSlide]);\n    const previous = useCallback(() => goTo(currentSlide - 1), [goTo, currentSlide]);\n\n    useEffect(() => {\n      if (!keyboard) return;\n      const container = containerRef.current;\n      if (!container) return;\n      const onKeyDown = (e: KeyboardEvent) => {\n        switch (e.key) {\n          case 'ArrowRight':\n          case 'ArrowDown':\n          case 'PageDown':\n          case ' ':\n            next();\n            break;\n          case 'ArrowLeft':\n          case 'ArrowUp':\n          case 'PageUp':\n            previous();\n            break;\n          case 'Home':\n            goTo(0);\n            break;\n          case 'End':\n            goTo((presentationRef.current?.slideCount ?? 1) - 1);\n            break;\n          default:\n            return;\n        }\n        // Only prevent default for keys actually handled, so Tab and shortcuts still work.\n        e.preventDefault();\n      };\n      container.addEventListener('keydown', onKeyDown);\n      return () => container.removeEventListener('keydown', onKeyDown);\n    }, [keyboard, next, previous, goTo]);\n\n    useImperativeHandle(\n      ref,\n      () => ({\n        next,\n        previous,\n        goTo,\n        get slide() {\n          return currentSlide;\n        },\n        get slideCount() {\n          return presentationRef.current?.slideCount ?? 0;\n        },\n        get presentation() {\n          return presentationRef.current;\n        },\n        redraw: draw,\n      }),\n      [next, previous, goTo, currentSlide, draw],\n    );\n\n    // --- render ------------------------------------------------------------------\n\n    const containerStyle = useMemo<React.CSSProperties>(\n      () => ({\n        width: typeof width === 'number' ? `${width}px` : width,\n        height: typeof height === 'number' ? `${height}px` : height,\n        position: 'relative',\n        overflow: 'hidden',\n        outline: 'none',\n        ...style,\n      }),\n      [width, height, style],\n    );\n\n    const slideText = info ? (presentationRef.current?.text(currentSlide) ?? '') : '';\n\n    return (\n      <div\n        ref={containerRef}\n        className={className}\n        style={containerStyle}\n        tabIndex={keyboard ? 0 : undefined}\n        role=\"region\"\n        aria-roledescription=\"presentation viewer\"\n        aria-label={\n          info ? `Slide ${currentSlide + 1} of ${info.slideCount}` : 'Loading presentation'\n        }\n      >\n        {error ? (\n          (renderError?.(error) ?? <DefaultError error={error} />)\n        ) : (\n          <>\n            <canvas\n              ref={canvasRef}\n              style={{ display: 'block', width: '100%', height: '100%' }}\n              // The canvas is decorative; the text below carries the content for\n              // assistive technology and for find-in-page.\n              aria-hidden=\"true\"\n            />\n            {selectableText && (\n              // Transparent but selectable. `left`/`top` are the run's baseline, so the\n              // span is shifted up by its own size to sit on it, and scaleX corrects the\n              // browser's advance width to the one layout actually measured — without\n              // that the selection drifts from the glyphs across a long line.\n              <div\n                aria-hidden=\"true\"\n                style={{\n                  position: 'absolute',\n                  inset: 0,\n                  overflow: 'hidden',\n                  pointerEvents: 'none',\n                  userSelect: 'text',\n                }}\n              >\n                {textRuns.map((r, i) => (\n                  <span\n                    key={i}\n                    style={{\n                      position: 'absolute',\n                      left: r.x,\n                      top: r.y - r.size,\n                      height: r.size,\n                      fontFamily: r.family,\n                      fontSize: r.size,\n                      fontWeight: r.weight,\n                      fontStyle: r.italic ? 'italic' : 'normal',\n                      lineHeight: 1,\n                      whiteSpace: 'pre',\n                      color: 'transparent',\n                      transformOrigin: '0% 0%',\n                      pointerEvents: 'auto',\n                      cursor: 'text',\n                    }}\n                    ref={(el) => fitSpan(el, r.width, r.rotation)}\n                  >\n                    {r.text}\n                  </span>\n                ))}\n              </div>\n            )}\n            {!info && (loading ?? <DefaultLoading />)}\n            {/* Visually hidden, but present in the accessibility tree and searchable. */}\n            <div\n              style={{\n                position: 'absolute',\n                width: 1,\n                height: 1,\n                overflow: 'hidden',\n                clip: 'rect(0 0 0 0)',\n                clipPath: 'inset(50%)',\n                whiteSpace: 'nowrap',\n              }}\n            >\n              {slideText}\n            </div>\n          </>\n        )}\n      </div>\n    );\n  },\n);\n\n/**\n * Squeezes a span to the width layout measured for the run.\n *\n * The browser re-measures the string itself, and its advance will not match ours exactly —\n * a different fallback face, different kerning. Left alone the two drift apart across a\n * long line and the selection highlight stops matching the glyphs under it. Scaling the\n * span to the measured width pins them together.\n */\nfunction fitSpan(el: HTMLSpanElement | null, width: number, rotation: number): void {\n  if (!el || width <= 0) return;\n  // Rebuilt from the run every time rather than edited in place: React re-runs this ref\n  // on each render, and appending to whatever is already there compounds the correction.\n  const base = rotation ? `rotate(${rotation}rad)` : '';\n  el.style.transform = base;\n  const actual = el.getBoundingClientRect().width;\n  if (actual > 0.5) {\n    el.style.transform = `${base} scaleX(${width / actual})`.trim();\n  }\n}\n\nfunction DefaultLoading() {\n  return (\n    <div\n      style={{\n        position: 'absolute',\n        inset: 0,\n        display: 'grid',\n        placeItems: 'center',\n        font: '14px system-ui, sans-serif',\n        color: '#666',\n      }}\n    >\n      Loading…\n    </div>\n  );\n}\n\nfunction DefaultError({ error }: { error: PptxError }) {\n  return (\n    <div\n      role=\"alert\"\n      style={{\n        position: 'absolute',\n        inset: 0,\n        display: 'grid',\n        placeItems: 'center',\n        padding: 16,\n        font: '14px system-ui, sans-serif',\n        color: '#b00020',\n        textAlign: 'center',\n      }}\n    >\n      {error.message}\n    </div>\n  );\n}\n\nexport type { PresentationViewerProps } from './types.js';\n"],"names":["PresentationViewer","forwardRef","props","ref","src","width","height","initialSlide","controlledSlide","fit","zoom","keyboard","selectableText","wasm","loading","renderError","className","style","onLoad","onError","onSlideChange","canvasRef","useRef","textRuns","setTextRuns","useState","containerRef","presentationRef","info","setInfo","error","setError","uncontrolledSlide","setUncontrolledSlide","isControlled","currentSlide","handlers","useEffect","cancelled","controller","Presentation","deck","e","err","PptxError","draw","useCallback","canvas","index","container","frame","observer","query","onChange","goTo","count","clamped","next","previous","onKeyDown","useImperativeHandle","containerStyle","useMemo","slideText","jsx","DefaultError","jsxs","Fragment","r","i","el","fitSpan","DefaultLoading","rotation","base","actual"],"mappings":"iLA2CaA,EAAqBC,EAAAA,WAChC,SAA4BC,EAAOC,EAAK,CACtC,KAAM,CACJ,IAAAC,EACA,MAAAC,EAAQ,OACR,OAAAC,EAAS,OACT,aAAAC,EAAe,EACf,MAAOC,EACP,IAAAC,EAAM,UACN,KAAAC,EAAO,EACP,SAAAC,EAAW,GACX,eAAAC,EAAiB,GACjB,KAAAC,EACA,QAAAC,EACA,YAAAC,EACA,UAAAC,EACA,MAAAC,EACA,OAAAC,EACA,QAAAC,EACA,cAAAC,CAAA,EACElB,EAEEmB,EAAYC,EAAAA,OAAiC,IAAI,EACjD,CAACC,EAAUC,CAAW,EAAIC,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