@extend-ai/react-pptx 0.1.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.
@@ -0,0 +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,aAAa;AAAA,IAC1B,SAAS;AAAA,IACT;AACF,aAAW;AACb;AACA,CAfC,SAeS;AACR,SAAO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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":[]}
@@ -0,0 +1,635 @@
1
+ import * as react from 'react';
2
+ import { HTMLAttributes, ReactNode, CSSProperties, Ref, RefCallback } from 'react';
3
+
4
+ type PptxViewerErrorCode = 'aborted' | 'fetch-failed' | 'invalid-source' | 'unsupported-environment' | 'unsupported-format' | 'encrypted-document' | 'resource-limit' | 'parse-failed' | 'render-failed';
5
+ declare class PptxViewerError extends Error {
6
+ readonly code: PptxViewerErrorCode;
7
+ readonly cause?: unknown;
8
+ readonly details?: Readonly<Record<string, unknown>>;
9
+ constructor(code: PptxViewerErrorCode, message: string, options?: {
10
+ cause?: unknown;
11
+ details?: Readonly<Record<string, unknown>>;
12
+ });
13
+ }
14
+
15
+ type PresentationFormat = 'pptx' | 'ppt';
16
+ interface PresentationSize {
17
+ widthEmu: number;
18
+ heightEmu: number;
19
+ }
20
+ interface PresentationWarning {
21
+ code: 'unsupported-feature' | 'degraded-rendering' | 'missing-asset' | 'missing-font' | 'corrupt-content' | 'encrypted-document' | 'resource-limit' | (string & {});
22
+ message: string;
23
+ severity: 'info' | 'warning' | 'error';
24
+ slideIndex?: number;
25
+ nodeId?: string;
26
+ partName?: string;
27
+ feature?: string;
28
+ }
29
+ interface PresentationAsset {
30
+ id: string;
31
+ contentType: string;
32
+ byteLength: number;
33
+ fileName?: string;
34
+ data?: Uint8Array;
35
+ url?: string;
36
+ }
37
+ interface PresentationEmbeddedFont {
38
+ /** Typeface name declared by PowerPoint. */
39
+ family: string;
40
+ /** Asset containing a browser-loadable OpenType or TrueType font. */
41
+ assetId: string;
42
+ style: 'normal' | 'italic';
43
+ weight: '400' | '700';
44
+ }
45
+ interface Rect {
46
+ x: number;
47
+ y: number;
48
+ width: number;
49
+ height: number;
50
+ }
51
+ interface Transform extends Rect {
52
+ rotation?: number;
53
+ flipHorizontal?: boolean;
54
+ flipVertical?: boolean;
55
+ }
56
+ interface ColorValue {
57
+ value: string;
58
+ alpha?: number;
59
+ }
60
+ /** DrawingML picture recolor effects declared on an `a:blip`. */
61
+ interface ImageEffects {
62
+ /** `a:biLevel` black/white threshold, normalized to 0..1. */
63
+ biLevelThreshold?: number;
64
+ /** `a:grayscl` grayscale recolor. */
65
+ grayscale?: boolean;
66
+ /** `a:duotone` two-color ramp, dark then light. */
67
+ duotone?: [ColorValue, ColorValue] | ColorValue[];
68
+ /** `a:lum` brightness, normalized to -1..1. */
69
+ brightness?: number;
70
+ /** `a:lum` contrast, normalized to -1..1. */
71
+ contrast?: number;
72
+ }
73
+ type FillStyle = {
74
+ type: 'none';
75
+ } | {
76
+ type: 'solid';
77
+ color: ColorValue;
78
+ } | {
79
+ type: 'gradient';
80
+ angle?: number;
81
+ stops: Array<{
82
+ position: number;
83
+ color: ColorValue;
84
+ }>;
85
+ } | {
86
+ type: 'pattern';
87
+ preset: string;
88
+ foreground: ColorValue;
89
+ background: ColorValue;
90
+ } | {
91
+ type: 'image';
92
+ assetId: string;
93
+ mode: 'stretch' | 'tile';
94
+ crop?: {
95
+ top: number;
96
+ right: number;
97
+ bottom: number;
98
+ left: number;
99
+ };
100
+ /** Opacity applied to the image fill only, normalized to 0..1. */
101
+ opacity?: number;
102
+ effects?: ImageEffects;
103
+ };
104
+ interface LineStyle {
105
+ color?: ColorValue;
106
+ width?: number;
107
+ dash?: string;
108
+ startArrow?: string;
109
+ endArrow?: string;
110
+ }
111
+ interface TextRun {
112
+ text: string;
113
+ fontFamily?: string;
114
+ /** Explicit East Asian typeface declared for this run. */
115
+ eastAsianFontFamily?: string;
116
+ /** Explicit complex-script typeface declared for this run. */
117
+ complexScriptFontFamily?: string;
118
+ /** Explicit symbol typeface declared for this run. */
119
+ symbolFontFamily?: string;
120
+ fontSizePt?: number;
121
+ bold?: boolean;
122
+ italic?: boolean;
123
+ underline?: boolean;
124
+ strike?: boolean;
125
+ color?: ColorValue;
126
+ baseline?: number;
127
+ /** OOXML run character spacing, in points. */
128
+ characterSpacingPt?: number;
129
+ language?: string;
130
+ alternativeLanguage?: string;
131
+ /** Run-level bidi override from DrawingML. */
132
+ rightToLeft?: boolean;
133
+ /** Minimum font size, in points, at which pair kerning is enabled. */
134
+ kerningThresholdPt?: number;
135
+ hyperlink?: string;
136
+ }
137
+ interface TextTabStop {
138
+ positionEmu: number;
139
+ alignment: 'left' | 'center' | 'right' | 'decimal';
140
+ }
141
+ interface TextSpacing {
142
+ value: number;
143
+ /** Percent values are normalized factors: 1 is 100%. */
144
+ unit: 'points' | 'percent';
145
+ }
146
+ interface TextParagraph {
147
+ runs: TextRun[];
148
+ alignment?: 'left' | 'center' | 'right' | 'justify' | 'distributed';
149
+ level?: number;
150
+ bullet?: {
151
+ kind: 'character' | 'number' | 'picture';
152
+ value?: string;
153
+ fontFamily?: string;
154
+ fontSizePt?: number;
155
+ sizePercent?: number;
156
+ startAt?: number;
157
+ };
158
+ /** Structured values preserve OOXML units; numbers remain accepted for 0.1.x compatibility. */
159
+ lineSpacing?: TextSpacing | number;
160
+ spaceBefore?: TextSpacing | number;
161
+ spaceAfter?: TextSpacing | number;
162
+ rtl?: boolean;
163
+ /** Exact OOXML paragraph left margin, in EMUs. */
164
+ marginLeftEmu?: number;
165
+ /** Exact OOXML first-line or hanging indent, in EMUs. */
166
+ indentEmu?: number;
167
+ /** Default interval used for tabs without an explicit stop, in EMUs. */
168
+ defaultTabSizeEmu?: number;
169
+ /** Explicit DrawingML paragraph tab stops. */
170
+ tabStops?: TextTabStop[];
171
+ eastAsianLineBreak?: boolean;
172
+ latinLineBreak?: boolean;
173
+ hangingPunctuation?: boolean;
174
+ }
175
+ interface TextAutofit {
176
+ mode: 'none' | 'normal' | 'shape';
177
+ /** PowerPoint normal-autofit font scale, normalized to 0..1. */
178
+ fontScale?: number;
179
+ /** PowerPoint normal-autofit line-spacing reduction, normalized to 0..1. */
180
+ lineSpacingReduction?: number;
181
+ }
182
+ interface BaseSlideNode {
183
+ id: string;
184
+ name?: string;
185
+ transform: Transform;
186
+ hidden?: boolean;
187
+ opacity?: number;
188
+ hyperlink?: string;
189
+ altText?: string;
190
+ sourcePart?: string;
191
+ }
192
+ interface ShapeNode extends BaseSlideNode {
193
+ type: 'shape';
194
+ geometry: {
195
+ preset?: string;
196
+ path?: string;
197
+ adjustments?: Record<string, number>;
198
+ };
199
+ fill?: FillStyle;
200
+ line?: LineStyle;
201
+ paragraphs?: TextParagraph[];
202
+ verticalAlignment?: 'top' | 'middle' | 'bottom';
203
+ textInsets?: {
204
+ top: number;
205
+ right: number;
206
+ bottom: number;
207
+ left: number;
208
+ };
209
+ autofit?: TextAutofit;
210
+ textRotation?: number;
211
+ verticalText?: string;
212
+ horizontalOverflow?: string;
213
+ verticalOverflow?: string;
214
+ textWrap?: 'none' | 'square' | (string & {});
215
+ columnCount?: number;
216
+ columnSpacing?: number;
217
+ rightToLeftColumns?: boolean;
218
+ spaceFirstLastParagraph?: boolean;
219
+ }
220
+ interface ImageNode extends BaseSlideNode {
221
+ type: 'image';
222
+ assetId: string;
223
+ crop?: {
224
+ top: number;
225
+ right: number;
226
+ bottom: number;
227
+ left: number;
228
+ };
229
+ preserveAspectRatio?: boolean;
230
+ effects?: ImageEffects;
231
+ }
232
+ interface GroupNode extends BaseSlideNode {
233
+ type: 'group';
234
+ children: SlideNode[];
235
+ childTransform?: Transform;
236
+ }
237
+ interface TableCell {
238
+ rowSpan?: number;
239
+ colSpan?: number;
240
+ fill?: FillStyle;
241
+ borders?: Partial<Record<'top' | 'right' | 'bottom' | 'left', LineStyle>>;
242
+ paragraphs: TextParagraph[];
243
+ textInsets?: {
244
+ top: number;
245
+ right: number;
246
+ bottom: number;
247
+ left: number;
248
+ };
249
+ verticalAlignment?: 'top' | 'middle' | 'bottom';
250
+ textRotation?: number;
251
+ }
252
+ interface TableNode extends BaseSlideNode {
253
+ type: 'table';
254
+ rows: TableCell[][];
255
+ columnWidths?: number[];
256
+ rowHeights?: number[];
257
+ }
258
+ interface ChartSeries {
259
+ name?: string;
260
+ categories?: Array<string | number>;
261
+ values: Array<number | null>;
262
+ color?: ColorValue;
263
+ }
264
+ interface ChartNode extends BaseSlideNode {
265
+ type: 'chart';
266
+ chartType: string;
267
+ title?: string;
268
+ series: ChartSeries[];
269
+ hasLegend?: boolean;
270
+ /**
271
+ * Raw DrawingML chart part XML (`c:chartSpace` or `cx:chartSpace`).
272
+ * Viewers use this for full-fidelity chart rendering; the parsed summary
273
+ * fields above remain available for search and fallbacks.
274
+ */
275
+ chartXml?: string;
276
+ /** Companion Microsoft chart style part (`style*.xml`), when present. */
277
+ chartStyleXml?: string;
278
+ /** Companion Microsoft chart color style part (`colors*.xml`), when present. */
279
+ chartColorsXml?: string;
280
+ }
281
+ interface MediaNode extends BaseSlideNode {
282
+ type: 'media';
283
+ mediaType: 'audio' | 'video' | 'ole' | 'unknown';
284
+ assetId?: string;
285
+ posterAssetId?: string;
286
+ }
287
+ interface UnknownNode extends BaseSlideNode {
288
+ type: 'unknown';
289
+ feature: string;
290
+ fallbackAssetId?: string;
291
+ }
292
+ type SlideNode = ShapeNode | ImageNode | GroupNode | TableNode | ChartNode | MediaNode | UnknownNode;
293
+ interface PresentationTheme {
294
+ id: string;
295
+ name?: string;
296
+ colors: Record<string, string>;
297
+ majorFonts?: Partial<Record<'latin' | 'eastAsia' | 'complexScript', string>>;
298
+ minorFonts?: Partial<Record<'latin' | 'eastAsia' | 'complexScript', string>>;
299
+ }
300
+ interface SlideMaster {
301
+ id: string;
302
+ name?: string;
303
+ themeId?: string;
304
+ nodes: SlideNode[];
305
+ }
306
+ interface SlideLayout {
307
+ id: string;
308
+ name?: string;
309
+ masterId?: string;
310
+ nodes: SlideNode[];
311
+ }
312
+ interface SlideNote {
313
+ text: string;
314
+ }
315
+ interface SlideComment {
316
+ id: string;
317
+ author?: string;
318
+ text: string;
319
+ createdAt?: string;
320
+ x?: number;
321
+ y?: number;
322
+ }
323
+ interface PresentationSlide {
324
+ id: string;
325
+ index: number;
326
+ name?: string;
327
+ hidden?: boolean;
328
+ masterId?: string;
329
+ layoutId?: string;
330
+ background?: FillStyle;
331
+ nodes: SlideNode[];
332
+ notes?: SlideNote[];
333
+ comments?: SlideComment[];
334
+ warnings?: PresentationWarning[];
335
+ sourcePart?: string;
336
+ }
337
+ interface PresentationMetadata {
338
+ title?: string;
339
+ subject?: string;
340
+ creator?: string;
341
+ company?: string;
342
+ createdAt?: string;
343
+ modifiedAt?: string;
344
+ }
345
+ interface PresentationDocument {
346
+ format: PresentationFormat;
347
+ size: PresentationSize;
348
+ slides: PresentationSlide[];
349
+ masters: SlideMaster[];
350
+ layouts: SlideLayout[];
351
+ themes: PresentationTheme[];
352
+ assets: Record<string, PresentationAsset>;
353
+ /** Fonts embedded in the package and decoded by the native parser. */
354
+ embeddedFonts?: PresentationEmbeddedFont[];
355
+ warnings: PresentationWarning[];
356
+ metadata?: PresentationMetadata;
357
+ }
358
+ type Slide = PresentationSlide;
359
+ interface PresentationSearchResult {
360
+ slideIndex: number;
361
+ nodeId: string;
362
+ nodeType: SlideNode['type'];
363
+ text: string;
364
+ matchStart: number;
365
+ matchEnd: number;
366
+ snippet: string;
367
+ bounds?: Rect;
368
+ }
369
+
370
+ type BinaryPresentationSource = ArrayBuffer | Uint8Array | Blob | string | URL;
371
+ interface ParsedPresentation {
372
+ readonly kind: 'parsed-presentation';
373
+ readonly document: PresentationDocument;
374
+ readonly warnings: readonly PresentationWarning[];
375
+ }
376
+ type PresentationSource = BinaryPresentationSource | PresentationDocument | ParsedPresentation;
377
+ type ViewerMode = 'slide' | 'continuous';
378
+ type FitMode = 'contain' | 'none';
379
+ interface ParsePresentationOptions {
380
+ signal?: AbortSignal;
381
+ formatHint?: PresentationFormat;
382
+ maxInputBytes?: number;
383
+ fetchInit?: Omit<RequestInit, 'signal'>;
384
+ }
385
+ interface VirtualizationOptions {
386
+ /**
387
+ * Mount only slides near the viewport in continuous mode, windowed with
388
+ * TanStack Virtual at fixed offsets so scrolling never shifts layout.
389
+ * Default `true`.
390
+ */
391
+ enabled?: boolean;
392
+ /**
393
+ * @deprecated The virtualized window is viewport-driven; this option is
394
+ * ignored and kept only for API compatibility.
395
+ */
396
+ initialSlides?: number;
397
+ /** Overscan measured in viewport heights. Default `1.5`. */
398
+ overscanViewport?: number;
399
+ /** Slides rendered per cooperative batch. Default `3`. */
400
+ batchSize?: number;
401
+ /**
402
+ * Scroll viewport owned by the host application. Pass the viewport element
403
+ * from Radix, Base UI, coss, or another custom scroll-area implementation.
404
+ */
405
+ scrollElement?: HTMLElement | null;
406
+ }
407
+ interface PptxFontSource {
408
+ /** Font family used by PowerPoint text runs. */
409
+ family: string;
410
+ /** URL/CSS font source or font bytes. */
411
+ source: string | ArrayBuffer | Uint8Array | Blob;
412
+ descriptors?: FontFaceDescriptors;
413
+ }
414
+ interface PptxFontOptions {
415
+ /** Host-provided web fonts. Embedded PPTX fonts are loaded automatically. */
416
+ sources?: readonly PptxFontSource[];
417
+ /** Per-family fallback overrides, keyed case-sensitively or in lowercase. */
418
+ fallbacks?: Readonly<Record<string, string | readonly string[]>>;
419
+ /** Extra script-complete families appended to every stack. */
420
+ fallbackFamilies?: readonly string[];
421
+ /** Apply built-in Office/CJK/RTL fallback stacks. Default `true`. */
422
+ useOfficeFallbacks?: boolean;
423
+ /** Load supported fonts embedded in the PPTX. Default `true`. */
424
+ loadEmbeddedFonts?: boolean;
425
+ /** Wait for registered fonts before rendering slides. Default `true`. */
426
+ waitForFonts?: boolean;
427
+ /** Report unavailable requested families through `onWarning`. Default `true`. */
428
+ reportMissingFonts?: boolean;
429
+ /** Maximum wait for each font and `document.fonts.ready`. Default `5000`. */
430
+ loadTimeoutMs?: number;
431
+ onFontLoaded?: (family: string, face: FontFace) => void;
432
+ onFontsReady?: () => void;
433
+ }
434
+ interface ViewerSearchOptions {
435
+ matchCase?: boolean;
436
+ wholeWord?: boolean;
437
+ useRegex?: boolean;
438
+ snippetRadius?: number;
439
+ includeShapes?: boolean;
440
+ includeTables?: boolean;
441
+ includeGroups?: boolean;
442
+ }
443
+ interface SearchHighlightOptions {
444
+ className?: string;
445
+ borderColor?: string;
446
+ backgroundColor?: string;
447
+ boxShadow?: string;
448
+ borderRadius?: number | string;
449
+ borderWidth?: number | string;
450
+ padding?: number;
451
+ zIndex?: number;
452
+ style?: Record<string, string | number | undefined>;
453
+ scrollIntoView?: boolean | ScrollIntoViewOptions;
454
+ }
455
+ interface ThumbnailRenderContext {
456
+ slideIndex: number;
457
+ slideCount: number;
458
+ isCurrent: boolean;
459
+ goToSlide: () => void;
460
+ }
461
+ type PptxSlideThumbnailResolution = number | {
462
+ maxHeight?: number;
463
+ maxWidth?: number;
464
+ };
465
+ interface PptxSlideThumbnailRenderOptions {
466
+ /** Rendered thumbnail width in CSS pixels. */
467
+ width?: number;
468
+ }
469
+ interface PptxSlideThumbnailRenderWindow {
470
+ /**
471
+ * Slide indexes whose attached thumbnail containers should render first.
472
+ *
473
+ * Use this for the thumbnails currently mounted in a virtualized rail.
474
+ */
475
+ visibleSlideIndexes?: readonly number[];
476
+ /**
477
+ * Slide indexes to render into a detached cache after visible thumbnails.
478
+ * Prefetched slides are adopted when their container mounts.
479
+ */
480
+ prefetchSlideIndexes?: readonly number[];
481
+ }
482
+ interface UsePptxViewerThumbnailsOptions {
483
+ /** Desired thumbnail bounds. A number constrains both dimensions. Default `160`. */
484
+ resolution?: PptxSlideThumbnailResolution;
485
+ /** Prioritizes and prefetches slides for consumer-owned virtualized thumbnail rails. */
486
+ renderWindow?: PptxSlideThumbnailRenderWindow;
487
+ /** Prevent rendering while preserving stable thumbnail metadata. Default `false`. */
488
+ disabled?: boolean;
489
+ }
490
+ type PptxSlideThumbnailStatus = 'idle' | 'rendering' | 'ready' | 'error';
491
+ interface PptxSlideThumbnailItem {
492
+ /** Source slide aspect ratio. */
493
+ aspectRatio: number;
494
+ /** Natural slide height in CSS pixels. */
495
+ contentHeight: number;
496
+ /** Natural slide width in CSS pixels. */
497
+ contentWidth: number;
498
+ /** Stable ref callback that renders into an attached consumer-owned element. */
499
+ containerRef: (element: HTMLElement | null) => void;
500
+ /** Last thumbnail rendering error, if any. */
501
+ error?: Error;
502
+ /** Rendered thumbnail height in CSS pixels. */
503
+ height: number;
504
+ /** Normalized source slide represented by this thumbnail. */
505
+ slide: PresentationDocument['slides'][number];
506
+ /** Zero-based slide index. */
507
+ slideIndex: number;
508
+ /** One-based slide number for display. */
509
+ slideNumber: number;
510
+ /** Current thumbnail render status. */
511
+ status: PptxSlideThumbnailStatus;
512
+ /** Renders this thumbnail into a consumer-owned element. */
513
+ renderToContainer: (element: HTMLElement) => Promise<void>;
514
+ /** Rendered thumbnail width in CSS pixels. */
515
+ width: number;
516
+ }
517
+ interface PptxViewerThumbnails {
518
+ /** Renders the requested slide into a consumer-owned element. */
519
+ renderThumbnail: (slideIndex: number, element: HTMLElement) => Promise<void>;
520
+ /** Re-renders every thumbnail currently attached through `containerRef`. */
521
+ rerenderAttachedThumbnails: () => Promise<void>;
522
+ /** Thumbnail metadata and render helpers for each slide. */
523
+ thumbnails: PptxSlideThumbnailItem[];
524
+ }
525
+ interface PptxViewerController {
526
+ goToSlide(index: number, scrollOptions?: ScrollIntoViewOptions): Promise<void>;
527
+ next(): Promise<void>;
528
+ previous(): Promise<void>;
529
+ setZoom(percent: number): Promise<void>;
530
+ setFitMode(mode: FitMode): Promise<void>;
531
+ search(query: string | RegExp, options?: ViewerSearchOptions): PresentationSearchResult[];
532
+ highlightSearchResult(result: PresentationSearchResult, options?: SearchHighlightOptions): Promise<void>;
533
+ clearSearchHighlights(): void;
534
+ /** True after the slide renderer is ready to service thumbnail requests. */
535
+ isReady(): boolean;
536
+ /** Renders a detached slide thumbnail and returns its cleanup function. */
537
+ renderThumbnail(index: number, target: HTMLElement, options?: PptxSlideThumbnailRenderOptions): Promise<() => void>;
538
+ getDocument(): PresentationDocument | null;
539
+ getSlideIndex(): number;
540
+ getZoom(): number;
541
+ }
542
+ interface ReactPptxViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onError' | 'onLoad'> {
543
+ source: PresentationSource;
544
+ mode?: ViewerMode;
545
+ /** Controlled zero-based slide index. */
546
+ slideIndex?: number;
547
+ /** Initial zero-based slide index for uncontrolled usage. */
548
+ initialSlide?: number;
549
+ /** Controlled zoom percentage. */
550
+ zoom?: number;
551
+ defaultZoom?: number;
552
+ fitMode?: FitMode;
553
+ width?: number;
554
+ height?: number | string;
555
+ showToolbar?: boolean;
556
+ showThumbnails?: boolean;
557
+ showNotes?: boolean;
558
+ showDiagnostics?: boolean;
559
+ showSlideLabels?: boolean;
560
+ virtualization?: boolean | VirtualizationOptions;
561
+ /** Font loading, substitution, and missing-font diagnostics. */
562
+ fonts?: PptxFontOptions;
563
+ parseOptions?: ParsePresentationOptions;
564
+ searchQuery?: string | RegExp;
565
+ searchOptions?: ViewerSearchOptions;
566
+ activeSearchResult?: number | PresentationSearchResult | null;
567
+ searchHighlightOptions?: SearchHighlightOptions;
568
+ renderThumbnail?: (context: ThumbnailRenderContext) => ReactNode;
569
+ renderLoading?: () => ReactNode;
570
+ renderError?: (error: PptxViewerError) => ReactNode;
571
+ emptyState?: ReactNode;
572
+ toolbarClassName?: string;
573
+ viewportClassName?: string;
574
+ toolbarStyle?: CSSProperties;
575
+ viewportStyle?: CSSProperties;
576
+ onReady?: (controller: PptxViewerController) => void;
577
+ onLoad?: (presentation: ParsedPresentation) => void;
578
+ onError?: (error: PptxViewerError) => void;
579
+ onWarning?: (warning: PresentationWarning) => void;
580
+ onSlideChange?: (index: number) => void;
581
+ onSlideRendered?: (index: number, element: HTMLElement) => void;
582
+ onSlideUnmounted?: (index: number) => void;
583
+ onSearchResults?: (results: readonly PresentationSearchResult[]) => void;
584
+ onThumbnailRendered?: (index: number, element: HTMLElement) => void;
585
+ /** Supplies the internal slide surface to host integrations and test harnesses. */
586
+ onViewportReady?: (element: HTMLDivElement) => void;
587
+ ref?: Ref<PptxViewerController>;
588
+ }
589
+
590
+ declare const ReactPptxViewer: react.ForwardRefExoticComponent<Omit<ReactPptxViewerProps, "ref"> & react.RefAttributes<PptxViewerController>>;
591
+
592
+ /**
593
+ * Parse a PowerPoint source into the format-neutral public model used by the
594
+ * package-owned renderer.
595
+ */
596
+ declare function parsePresentation(source: PresentationSource, options?: ParsePresentationOptions): Promise<ParsedPresentation>;
597
+ declare const presentationParsingDefaults: Readonly<{
598
+ maxInputBytes: number;
599
+ }>;
600
+
601
+ type WasmSource = string | URL | Request | Response | BufferSource | WebAssembly.Module;
602
+ type WorkerWasmSource = string | ArrayBuffer | WebAssembly.Module;
603
+ declare function setWasmSource(source: WasmSource): void;
604
+ declare function initWasm(source?: WasmSource): Promise<void>;
605
+
606
+ interface UsePptxPresentationState {
607
+ presentation: ParsedPresentation | null;
608
+ document: ParsedPresentation['document'] | null;
609
+ isLoading: boolean;
610
+ error: PptxViewerError | null;
611
+ }
612
+ /** Parse a presentation independently from the viewer, mirroring `useDocxModel`. */
613
+ declare function usePptxPresentation(source?: PresentationSource | null, options?: ParsePresentationOptions): UsePptxPresentationState;
614
+ /** Backwards-friendly model-oriented alias. */
615
+ declare const usePptxModel: typeof usePptxPresentation;
616
+ interface UsePptxViewerResult {
617
+ controller: PptxViewerController | null;
618
+ ref: RefCallback<PptxViewerController>;
619
+ }
620
+ /** Reactive access to the imperative viewer controller. */
621
+ declare function usePptxViewer(): UsePptxViewerResult;
622
+
623
+ /**
624
+ * Exposes detached slide previews for consumer-owned thumbnail rails.
625
+ *
626
+ * PPTX slides remain live DOM/SVG surfaces to preserve the main viewer's
627
+ * rendering fidelity. Attach `thumbnail.containerRef` to a sized element.
628
+ */
629
+ declare function usePptxViewerThumbnails(controller: PptxViewerController | null | undefined, options?: UsePptxViewerThumbnailsOptions): PptxViewerThumbnails;
630
+
631
+ /** Cross-platform, metrically similar substitutions for common Office typefaces. */
632
+ declare const OFFICE_FONT_FALLBACKS: Readonly<Record<string, readonly string[]>>;
633
+ declare function resolvePptxFontFamily(fontFamily: string, options?: Pick<PptxFontOptions, 'fallbacks' | 'fallbackFamilies' | 'useOfficeFallbacks'>): string;
634
+
635
+ export { type BinaryPresentationSource, type FitMode, OFFICE_FONT_FALLBACKS, type ParsePresentationOptions, type ParsedPresentation, type PptxFontOptions, type PptxFontSource, type PptxSlideThumbnailItem, type PptxSlideThumbnailRenderOptions, type PptxSlideThumbnailRenderWindow, type PptxSlideThumbnailResolution, type PptxSlideThumbnailStatus, 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, initWasm, parsePresentation, presentationParsingDefaults, resolvePptxFontFamily, setWasmSource, usePptxModel, usePptxPresentation, usePptxViewer, usePptxViewerThumbnails };