@extend-ai/react-pptx 0.2.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @extend-ai/react-pptx
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Add first-class controlled and uncontrolled responsive zoom modes, resize-aware resolved zoom,
8
+ and controller APIs for consumer-owned zoom controls while preserving `fitMode` compatibility.
9
+
3
10
  ## 0.1.1
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -25,6 +25,36 @@ during SSR is safe.
25
25
  Unknown or degraded content is surfaced through `onWarning` and `showDiagnostics` rather
26
26
  than silently removed.
27
27
 
28
+ ## Responsive zoom
29
+
30
+ The viewer accepts the same responsive zoom shape as `@extend-ai/react-docx`. Numeric values are
31
+ percentages, while `automatic`, `fit-page`, and `fit-width` remain active as the viewport changes.
32
+ For example, the shared API can be expressed as:
33
+
34
+ ```tsx
35
+ <Viewer defaultZoom="fit-width" />
36
+ ```
37
+
38
+ With this package's component and required source, use:
39
+
40
+ ```tsx
41
+ <ReactPptxViewer
42
+ source={file}
43
+ defaultZoom="fit-width"
44
+ onZoomChange={({ level, resolvedZoom }) => {
45
+ console.log(level, resolvedZoom);
46
+ }}
47
+ />
48
+ ```
49
+
50
+ `automatic` shrinks slides that are wider than the viewport without enlarging them. `fit-width`
51
+ may enlarge or shrink to fill the available width, and `fit-page` uses both viewport dimensions.
52
+ The controller exposes `setZoom(level)`, `getZoom()`, and `getResolvedZoom()`, so a custom toolbar
53
+ can retain the semantic mode while displaying its current percentage. Zooming in or out from a
54
+ responsive mode should pass `getResolvedZoom() + delta` to `setZoom()`, which switches to a numeric
55
+ level. The older `fitMode` prop remains supported for compatibility; `contain` maps to `automatic`
56
+ when the new zoom props are absent.
57
+
28
58
  ## Supported presentation formats
29
59
 
30
60
  `.pptx` and legacy PowerPoint 97–2003 `.ppt` files are both accepted by the same `source`
package/dist/index.css CHANGED
@@ -135,9 +135,6 @@
135
135
  min-height: var(--rpv-height);
136
136
  overflow: visible;
137
137
  }
138
- .rpv-viewport > * {
139
- max-width: 100%;
140
- }
141
138
  .rpv-status {
142
139
  position: absolute;
143
140
  z-index: 5;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/styles.css"],"sourcesContent":[".rpv-root {\n --rpv-ink: #17211d;\n --rpv-paper: #f8f5ee;\n --rpv-panel: #ebe5d9;\n --rpv-rule: #c7bfb1;\n --rpv-accent: #d8663a;\n color: var(--rpv-ink);\n background: var(--rpv-paper);\n border: 1px solid var(--rpv-rule);\n font:\n 500 14px/1.4 ui-sans-serif,\n system-ui,\n sans-serif;\n min-width: 0;\n}\n.rpv-root button {\n color: inherit;\n font: inherit;\n}\n.rpv-toolbar {\n min-height: 48px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n padding: 0 14px;\n border-bottom: 1px solid var(--rpv-rule);\n background: color-mix(in srgb, var(--rpv-paper) 90%, white);\n}\n.rpv-toolbar__cluster {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.rpv-toolbar button {\n width: 30px;\n height: 30px;\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n.rpv-toolbar button:hover:not(:disabled) {\n background: var(--rpv-panel);\n}\n.rpv-toolbar button:focus-visible,\n.rpv-thumbnail:focus-visible {\n outline: 3px solid color-mix(in srgb, var(--rpv-accent) 55%, transparent);\n outline-offset: 2px;\n}\n.rpv-toolbar button:disabled {\n opacity: 0.35;\n}\n.rpv-toolbar__count {\n min-width: 66px;\n text-align: center;\n font-variant-numeric: tabular-nums;\n}\n.rpv-workspace {\n display: flex;\n min-height: var(--rpv-height);\n max-height: var(--rpv-height);\n}\n.rpv-filmstrip {\n width: 184px;\n flex: 0 0 184px;\n overflow: auto;\n padding: 18px 14px 32px;\n border-right: 1px solid var(--rpv-rule);\n background: var(--rpv-panel);\n}\n.rpv-filmstrip__sizer {\n position: relative;\n width: 100%;\n}\n.rpv-filmstrip__item {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n}\n.rpv-thumbnail {\n position: relative;\n display: block;\n width: 100%;\n padding: 0 0 15px 24px;\n border: 0;\n background: transparent;\n cursor: pointer;\n text-align: left;\n}\n.rpv-thumbnail__number {\n position: absolute;\n top: 4px;\n left: 0;\n color: #756d63;\n font-size: 10px;\n font-variant-numeric: tabular-nums;\n}\n.rpv-thumbnail__canvas {\n display: block;\n min-height: 76px;\n overflow: hidden;\n background: white;\n border: 1px solid var(--rpv-rule);\n transition:\n transform 160ms cubic-bezier(0.22, 1, 0.36, 1),\n border-color 160ms;\n}\n.rpv-thumbnail:hover .rpv-thumbnail__canvas {\n transform: translateY(-2px);\n}\n.rpv-thumbnail[data-active] .rpv-thumbnail__canvas {\n border: 2px solid var(--rpv-accent);\n}\n.rpv-stage {\n position: relative;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n background: #d8d2c8;\n}\n.rpv-viewport {\n width: 100%;\n height: 100%;\n overflow: auto;\n overflow-anchor: none;\n padding: 34px;\n box-sizing: border-box;\n}\n.rpv-root[data-rpv-scroll-owner='external'] .rpv-workspace {\n min-height: 0;\n max-height: none;\n}\n.rpv-viewport[data-rpv-scroll-owner='external'] {\n height: auto;\n min-height: var(--rpv-height);\n overflow: visible;\n}\n.rpv-viewport > * {\n max-width: 100%;\n}\n.rpv-status {\n position: absolute;\n z-index: 5;\n inset: 0;\n display: grid;\n place-content: center;\n justify-items: center;\n gap: 10px;\n padding: 40px;\n text-align: center;\n background: #d8d2c8;\n}\n.rpv-status--error strong {\n font-size: 18px;\n}\n.rpv-status--error span {\n max-width: 52ch;\n color: #645e56;\n}\n.rpv-spinner {\n width: 25px;\n height: 25px;\n border: 2px solid #aaa197;\n border-top-color: var(--rpv-accent);\n border-radius: 50%;\n animation: rpv-spin 0.8s linear infinite;\n}\n.rpv-slide-label {\n position: absolute;\n right: 14px;\n bottom: 10px;\n padding: 3px 7px;\n background: color-mix(in srgb, var(--rpv-ink) 82%, transparent);\n color: var(--rpv-paper);\n font-size: 11px;\n}\n.rpv-diagnostics {\n width: 270px;\n flex: 0 0 270px;\n overflow: auto;\n border-left: 1px solid var(--rpv-rule);\n padding: 20px;\n background: var(--rpv-paper);\n}\n.rpv-diagnostics h2,\n.rpv-notes h2 {\n margin: 0 0 16px;\n font-size: 12px;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n}\n.rpv-diagnostics dl {\n margin: 0 0 24px;\n}\n.rpv-diagnostics dl div {\n display: flex;\n justify-content: space-between;\n padding: 7px 0;\n border-bottom: 1px solid var(--rpv-rule);\n}\n.rpv-diagnostics dd {\n margin: 0;\n font-variant-numeric: tabular-nums;\n}\n.rpv-diagnostics p {\n padding: 10px 0;\n margin: 0;\n border-bottom: 1px solid var(--rpv-rule);\n font-size: 12px;\n}\n.rpv-diagnostics p strong {\n display: block;\n color: var(--rpv-accent);\n}\n.rpv-notes {\n padding: 20px 24px;\n border-top: 1px solid var(--rpv-rule);\n}\n.rpv-notes p {\n max-width: 72ch;\n}\n@keyframes rpv-spin {\n to {\n transform: rotate(360deg);\n }\n}\n@media (max-width: 760px) {\n .rpv-filmstrip {\n width: 108px;\n flex-basis: 108px;\n padding-inline: 8px;\n }\n .rpv-thumbnail {\n padding-left: 0;\n }\n .rpv-thumbnail__number {\n display: none;\n }\n .rpv-diagnostics {\n position: absolute;\n right: 0;\n z-index: 4;\n height: 100%;\n box-sizing: border-box;\n }\n .rpv-viewport {\n padding: 18px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .rpv-spinner {\n animation: none;\n }\n .rpv-thumbnail__canvas {\n transition: none;\n }\n}\n"],"mappings":";AAAA,CAAC;AACC,aAAW;AACX,eAAa;AACb,eAAa;AACb,cAAY;AACZ,gBAAc;AACd,SAAO,IAAI;AACX,cAAY,IAAI;AAChB,UAAQ,IAAI,MAAM,IAAI;AACtB;AAAA,IACE,IAAI,IAAI,CAAC,IAAI,a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AAY,IAAI;AAClB;AACA,CARC,gBAQgB;AACjB,CAAC,UAAU;AACT,UAAQ,EAAE,EAAE;AACZ,aAAW;AACX,kBAAgB;AAChB,kBAAgB;AAClB;AACA,CAfC,gBAegB;AACf,UAAQ,EAAE,EAAE;AACd;AACA,CAlBC,gBAkBgB,GAAG;AAClB,WAAS;AACT,mBAAiB;AACjB,WAAS,IAAI;AACb,iBAAe,IAAI,MAAM,IAAI;AAC/B;AACA,CAxBC,gBAwBgB;AACf,UAAQ;AACR,wBAAsB;AACxB;AACA,CA5BC,gBA4BgB;AACf,WAAS,KAAK;AACd,UAAQ;AACR,iBAAe,IAAI,MAAM,IAAI;AAC7B,aAAW;AACb;AACA,CAlCC,gBAkCgB,EAAE;AACjB,WAAS;AACT,SAAO,IAAI;AACb;AACA,CA7BC;AA8BC,WAAS,KAAK;AACd,cAAY,IAAI,MAAM,IAAI;AAC5B;AACA,CAjCC,UAiCU;AACT,aAAW;AACb;AACA,WAxDa;AAyDX;AACE,eAAW,OAAO;AACpB;AACF;AACA,QAAO,WAAY;AACjB,GAtKD;AAuKG,WAAO;AACP,gBAAY;AACZ,oBAAgB;AAClB;AACA,GA5LD;AA6LG,kBAAc;AAChB;AACA,GAlJD;AAmJG,aAAS;AACX;AACA,GA9DD;AA+DG,cAAU;AACV,WAAO;AACP,aAAS;AACT,YAAQ;AACR,gBAAY;AACd;AACA,GA7HD;AA8HG,aAAS;AACX;AACF;AACA,QAAO,wBAAyB;AAC9B,GA3FD;AA4FG,eAAW;AACb;AACA,GA5JD;AA6JG,gBAAY;AACd;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/styles.css"],"sourcesContent":[".rpv-root {\n --rpv-ink: #17211d;\n --rpv-paper: #f8f5ee;\n --rpv-panel: #ebe5d9;\n --rpv-rule: #c7bfb1;\n --rpv-accent: #d8663a;\n color: var(--rpv-ink);\n background: var(--rpv-paper);\n border: 1px solid var(--rpv-rule);\n font:\n 500 14px/1.4 ui-sans-serif,\n system-ui,\n sans-serif;\n min-width: 0;\n}\n.rpv-root button {\n color: inherit;\n font: inherit;\n}\n.rpv-toolbar {\n min-height: 48px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n padding: 0 14px;\n border-bottom: 1px solid var(--rpv-rule);\n background: color-mix(in srgb, var(--rpv-paper) 90%, white);\n}\n.rpv-toolbar__cluster {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.rpv-toolbar button {\n width: 30px;\n height: 30px;\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n.rpv-toolbar button:hover:not(:disabled) {\n background: var(--rpv-panel);\n}\n.rpv-toolbar button:focus-visible,\n.rpv-thumbnail:focus-visible {\n outline: 3px solid color-mix(in srgb, var(--rpv-accent) 55%, transparent);\n outline-offset: 2px;\n}\n.rpv-toolbar button:disabled {\n opacity: 0.35;\n}\n.rpv-toolbar__count {\n min-width: 66px;\n text-align: center;\n font-variant-numeric: tabular-nums;\n}\n.rpv-workspace {\n display: flex;\n min-height: var(--rpv-height);\n max-height: var(--rpv-height);\n}\n.rpv-filmstrip {\n width: 184px;\n flex: 0 0 184px;\n overflow: auto;\n padding: 18px 14px 32px;\n border-right: 1px solid var(--rpv-rule);\n background: var(--rpv-panel);\n}\n.rpv-filmstrip__sizer {\n position: relative;\n width: 100%;\n}\n.rpv-filmstrip__item {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n}\n.rpv-thumbnail {\n position: relative;\n display: block;\n width: 100%;\n padding: 0 0 15px 24px;\n border: 0;\n background: transparent;\n cursor: pointer;\n text-align: left;\n}\n.rpv-thumbnail__number {\n position: absolute;\n top: 4px;\n left: 0;\n color: #756d63;\n font-size: 10px;\n font-variant-numeric: tabular-nums;\n}\n.rpv-thumbnail__canvas {\n display: block;\n min-height: 76px;\n overflow: hidden;\n background: white;\n border: 1px solid var(--rpv-rule);\n transition:\n transform 160ms cubic-bezier(0.22, 1, 0.36, 1),\n border-color 160ms;\n}\n.rpv-thumbnail:hover .rpv-thumbnail__canvas {\n transform: translateY(-2px);\n}\n.rpv-thumbnail[data-active] .rpv-thumbnail__canvas {\n border: 2px solid var(--rpv-accent);\n}\n.rpv-stage {\n position: relative;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n background: #d8d2c8;\n}\n.rpv-viewport {\n width: 100%;\n height: 100%;\n overflow: auto;\n overflow-anchor: none;\n padding: 34px;\n box-sizing: border-box;\n}\n.rpv-root[data-rpv-scroll-owner='external'] .rpv-workspace {\n min-height: 0;\n max-height: none;\n}\n.rpv-viewport[data-rpv-scroll-owner='external'] {\n height: auto;\n min-height: var(--rpv-height);\n overflow: visible;\n}\n.rpv-status {\n position: absolute;\n z-index: 5;\n inset: 0;\n display: grid;\n place-content: center;\n justify-items: center;\n gap: 10px;\n padding: 40px;\n text-align: center;\n background: #d8d2c8;\n}\n.rpv-status--error strong {\n font-size: 18px;\n}\n.rpv-status--error span {\n max-width: 52ch;\n color: #645e56;\n}\n.rpv-spinner {\n width: 25px;\n height: 25px;\n border: 2px solid #aaa197;\n border-top-color: var(--rpv-accent);\n border-radius: 50%;\n animation: rpv-spin 0.8s linear infinite;\n}\n.rpv-slide-label {\n position: absolute;\n right: 14px;\n bottom: 10px;\n padding: 3px 7px;\n background: color-mix(in srgb, var(--rpv-ink) 82%, transparent);\n color: var(--rpv-paper);\n font-size: 11px;\n}\n.rpv-diagnostics {\n width: 270px;\n flex: 0 0 270px;\n overflow: auto;\n border-left: 1px solid var(--rpv-rule);\n padding: 20px;\n background: var(--rpv-paper);\n}\n.rpv-diagnostics h2,\n.rpv-notes h2 {\n margin: 0 0 16px;\n font-size: 12px;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n}\n.rpv-diagnostics dl {\n margin: 0 0 24px;\n}\n.rpv-diagnostics dl div {\n display: flex;\n justify-content: space-between;\n padding: 7px 0;\n border-bottom: 1px solid var(--rpv-rule);\n}\n.rpv-diagnostics dd {\n margin: 0;\n font-variant-numeric: tabular-nums;\n}\n.rpv-diagnostics p {\n padding: 10px 0;\n margin: 0;\n border-bottom: 1px solid var(--rpv-rule);\n font-size: 12px;\n}\n.rpv-diagnostics p strong {\n display: block;\n color: var(--rpv-accent);\n}\n.rpv-notes {\n padding: 20px 24px;\n border-top: 1px solid var(--rpv-rule);\n}\n.rpv-notes p {\n max-width: 72ch;\n}\n@keyframes rpv-spin {\n to {\n transform: rotate(360deg);\n }\n}\n@media (max-width: 760px) {\n .rpv-filmstrip {\n width: 108px;\n flex-basis: 108px;\n padding-inline: 8px;\n }\n .rpv-thumbnail {\n padding-left: 0;\n }\n .rpv-thumbnail__number {\n display: none;\n }\n .rpv-diagnostics {\n position: absolute;\n right: 0;\n z-index: 4;\n height: 100%;\n box-sizing: border-box;\n }\n .rpv-viewport {\n padding: 18px;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .rpv-spinner {\n animation: none;\n }\n .rpv-thumbnail__canvas {\n transition: none;\n }\n}\n"],"mappings":";AAAA,CAAC;AACC,aAAW;AACX,eAAa;AACb,eAAa;AACb,cAAY;AACZ,gBAAc;AACd,SAAO,IAAI;AACX,cAAY,IAAI;AAChB,UAAQ,IAAI,MAAM,IAAI;AACtB;AAAA,IACE,IAAI,IAAI,CAAC,IAAI,aAAa;AAAA,IAC1B,SAAS;AAAA,IACT;AACF,aAAW;AACb;AACA,CAfC,SAeS;AACR,SAAO;AACP,QAAM;AACR;AACA,CAAC;AACC,cAAY;AACZ,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,OAAK;AACL,WAAS,EAAE;AACX,iBAAe,IAAI,MAAM,IAAI;AAC7B,cAAY,UAAU,GAAG,IAAI,EAAE,IAAI,aAAa,GAAG,EAAE;AACvD;AACA,CAAC;AACC,WAAS;AACT,eAAa;AACb,OAAK;AACP;AACA,CAfC,YAeY;AACX,SAAO;AACP,UAAQ;AACR,UAAQ;AACR,cAAY;AACZ,UAAQ;AACV;AACA,CAtBC,YAsBY,MAAM,MAAM,KAAK;AAC5B,cAAY,IAAI;AAClB;AACA,CAz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AK;AACd,cAAY,IAAI,MAAM,IAAI;AAC5B;AACA,CAjCC,UAiCU;AACT,aAAW;AACb;AACA,WAxDa;AAyDX;AACE,eAAW,OAAO;AACpB;AACF;AACA,QAAO,WAAY;AACjB,GAnKD;AAoKG,WAAO;AACP,gBAAY;AACZ,oBAAgB;AAClB;AACA,GAzLD;AA0LG,kBAAc;AAChB;AACA,GA/ID;AAgJG,aAAS;AACX;AACA,GA9DD;AA+DG,cAAU;AACV,WAAO;AACP,aAAS;AACT,YAAQ;AACR,gBAAY;AACd;AACA,GA1HD;AA2HG,aAAS;AACX;AACF;AACA,QAAO,wBAAyB;AAC9B,GA3FD;AA4FG,eAAW;AACb;AACA,GAzJD;AA0JG,gBAAY;AACd;AACF;","names":[]}
package/dist/index.d.ts CHANGED
@@ -383,7 +383,15 @@ interface PptxPerformanceMeasurement {
383
383
  }
384
384
  type PresentationSource = BinaryPresentationSource | PresentationDocument | ParsedPresentation;
385
385
  type ViewerMode = 'slide' | 'continuous';
386
+ /** @deprecated Superseded by `ViewerZoomLevel` and the `zoom` prop. */
386
387
  type FitMode = 'contain' | 'none';
388
+ type ViewerZoomMode = 'automatic' | 'fit-page' | 'fit-width';
389
+ type ViewerZoomLevel = number | ViewerZoomMode;
390
+ type ViewerZoomState = {
391
+ level: ViewerZoomLevel;
392
+ /** Resolved percentage; `100` means actual size. */
393
+ resolvedZoom: number;
394
+ };
387
395
  interface ParsePresentationOptions {
388
396
  signal?: AbortSignal;
389
397
  formatHint?: PresentationFormat;
@@ -585,7 +593,8 @@ interface PptxViewerController {
585
593
  goToSlide(index: number, scrollOptions?: ScrollIntoViewOptions): Promise<void>;
586
594
  next(): Promise<void>;
587
595
  previous(): Promise<void>;
588
- setZoom(percent: number): Promise<void>;
596
+ setZoom(level: ViewerZoomLevel): Promise<void>;
597
+ /** @deprecated Use `setZoom()` with a responsive zoom mode. */
589
598
  setFitMode(mode: FitMode): Promise<void>;
590
599
  search(query: string | RegExp, options?: ViewerSearchOptions): PresentationSearchResult[];
591
600
  highlightSearchResult(result: PresentationSearchResult, options?: SearchHighlightOptions): Promise<void>;
@@ -596,7 +605,10 @@ interface PptxViewerController {
596
605
  renderThumbnail(index: number, target: HTMLElement, options?: PptxSlideThumbnailRenderOptions): Promise<() => void>;
597
606
  getDocument(): PresentationDocument | null;
598
607
  getSlideIndex(): number;
599
- getZoom(): number;
608
+ /** Current numeric percentage or active responsive mode. */
609
+ getZoom(): ViewerZoomLevel;
610
+ /** Current clamped percentage after resolving the viewport-dependent mode. */
611
+ getResolvedZoom(): number;
600
612
  }
601
613
  interface ReactPptxViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onError' | 'onLoad'> {
602
614
  source: PresentationSource;
@@ -605,9 +617,11 @@ interface ReactPptxViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chi
605
617
  slideIndex?: number;
606
618
  /** Initial zero-based slide index for uncontrolled usage. */
607
619
  initialSlide?: number;
608
- /** Controlled zoom percentage. */
609
- zoom?: number;
610
- defaultZoom?: number;
620
+ /** Controlled zoom percentage or responsive zoom mode. */
621
+ zoom?: ViewerZoomLevel;
622
+ /** Initial zoom percentage or responsive zoom mode for uncontrolled usage. */
623
+ defaultZoom?: ViewerZoomLevel;
624
+ /** @deprecated Superseded by `zoom`. `contain` maps to `automatic`. */
611
625
  fitMode?: FitMode;
612
626
  width?: number;
613
627
  height?: number | string;
@@ -637,6 +651,8 @@ interface ReactPptxViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chi
637
651
  onError?: (error: PptxViewerError) => void;
638
652
  onWarning?: (warning: PresentationWarning) => void;
639
653
  onSlideChange?: (index: number) => void;
654
+ /** Reports semantic zoom changes and responsive percentage recalculation. */
655
+ onZoomChange?: (state: ViewerZoomState) => void;
640
656
  onSlideRendered?: (index: number, element: HTMLElement) => void;
641
657
  onSlideUnmounted?: (index: number) => void;
642
658
  onSearchResults?: (results: readonly PresentationSearchResult[]) => void;
@@ -695,4 +711,4 @@ declare function createPptxThumbnailRenderer(presentation: ParsedPresentation, o
695
711
  declare const OFFICE_FONT_FALLBACKS: Readonly<Record<string, readonly string[]>>;
696
712
  declare function resolvePptxFontFamily(fontFamily: string, options?: Pick<PptxFontOptions, 'fallbacks' | 'fallbackFamilies' | 'useOfficeFallbacks'>): string;
697
713
 
698
- export { type BinaryPresentationSource, type FitMode, OFFICE_FONT_FALLBACKS, type ParsePresentationOptions, type ParsedPresentation, type PptxFontOptions, type PptxFontSource, type PptxPerformanceMeasurement, type PptxPerformancePhase, type PptxSlideThumbnailItem, type PptxSlideThumbnailRenderOptions, type PptxSlideThumbnailRenderWindow, type PptxSlideThumbnailResolution, type PptxSlideThumbnailStatus, type PptxThumbnailOutput, type PptxThumbnailRenderOptions, type PptxThumbnailRenderResult, type PptxThumbnailRenderer, type PptxThumbnailRendererOptions, type PptxViewerController, PptxViewerError, type PptxViewerThumbnails, type PresentationAsset, type PresentationDocument, type PresentationEmbeddedFont, type PresentationFormat, type PresentationMetadata, type PresentationSearchResult, type PresentationSlide, type PresentationSource, type PresentationTheme, type PresentationWarning, ReactPptxViewer, type ReactPptxViewerProps, type SearchHighlightOptions, type Slide, type SlideComment, type SlideLayout, type SlideMaster, type SlideNode, type SlideNote, type ThumbnailRenderContext, type UsePptxPresentationState, type UsePptxViewerResult, type UsePptxViewerThumbnailsOptions, type ViewerMode, type ViewerSearchOptions, type VirtualizationOptions, type WasmSource, type WorkerWasmSource, createPptxThumbnailRenderer, initWasm, parsePresentation, presentationParsingDefaults, resolvePptxFontFamily, setWasmSource, usePptxModel, usePptxPresentation, usePptxViewer, usePptxViewerThumbnails };
714
+ export { type BinaryPresentationSource, type FitMode, OFFICE_FONT_FALLBACKS, type ParsePresentationOptions, type ParsedPresentation, type PptxFontOptions, type PptxFontSource, type PptxPerformanceMeasurement, type PptxPerformancePhase, type PptxSlideThumbnailItem, type PptxSlideThumbnailRenderOptions, type PptxSlideThumbnailRenderWindow, type PptxSlideThumbnailResolution, type PptxSlideThumbnailStatus, type PptxThumbnailOutput, type PptxThumbnailRenderOptions, type PptxThumbnailRenderResult, type PptxThumbnailRenderer, type PptxThumbnailRendererOptions, type PptxViewerController, PptxViewerError, type PptxViewerThumbnails, type PresentationAsset, type PresentationDocument, type PresentationEmbeddedFont, type PresentationFormat, type PresentationMetadata, type PresentationSearchResult, type PresentationSlide, type PresentationSource, type PresentationTheme, type PresentationWarning, ReactPptxViewer, type ReactPptxViewerProps, type SearchHighlightOptions, type Slide, type SlideComment, type SlideLayout, type SlideMaster, type SlideNode, type SlideNote, type ThumbnailRenderContext, type UsePptxPresentationState, type UsePptxViewerResult, type UsePptxViewerThumbnailsOptions, type ViewerMode, type ViewerSearchOptions, type ViewerZoomLevel, type ViewerZoomMode, type ViewerZoomState, type VirtualizationOptions, type WasmSource, type WorkerWasmSource, createPptxThumbnailRenderer, initWasm, parsePresentation, presentationParsingDefaults, resolvePptxFontFamily, setWasmSource, usePptxModel, usePptxPresentation, usePptxViewer, usePptxViewerThumbnails };