@files-preview-app/preview-file 1.3.1 → 1.3.3

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/dist/index.d.cts CHANGED
@@ -1,20 +1,3228 @@
1
- import { FilePreviewViewer as FilePreviewViewer$1, PreviewPlugin } from '@patel.sumit51/core';
2
- export * from '@patel.sumit51/core';
3
- export { pdfPlugin } from '@patel.sumit51/plugin-pdf';
4
- export { mediaPlugin } from '@patel.sumit51/plugin-media';
5
- export { docxPlugin } from '@patel.sumit51/plugin-docx';
6
- export { excelPlugin } from '@patel.sumit51/plugin-excel';
7
- export { csvPlugin } from '@patel.sumit51/plugin-csv';
8
- export { codePlugin } from '@patel.sumit51/plugin-code';
9
- export { archivePlugin } from '@patel.sumit51/plugin-archive';
10
- export { markdownPlugin } from '@patel.sumit51/plugin-markdown';
11
- export { pptxPlugin } from '@patel.sumit51/plugin-pptx';
12
- export { threeDPlugin } from '@patel.sumit51/plugin-3d';
13
- export { rtfPlugin } from '@patel.sumit51/plugin-rtf';
14
- export { htmlPreviewPlugin } from '@patel.sumit51/plugin-html-preview';
15
- export { openDocumentPlugin } from '@patel.sumit51/plugin-opendocument';
16
- export { docPlugin } from '@patel.sumit51/plugin-doc';
17
- export { pptPlugin } from '@patel.sumit51/plugin-ppt';
1
+ import { c as FilePreviewViewer$1, P as PreviewPlugin$f } from './index.d-B79v0jxi.cjs';
2
+ export { C as CfbfEntry, d as CfbfReader, E as EventEmitter, e as EventHandler, f as FileInfo, g as FileMetadata, F as FileSource, h as PreviewEvent, b as PreviewInstance, a as PreviewViewerOptions, R as RenderContext, T as Thumbnail, i as ThumbnailPanel, j as ToolbarAction, k as ToolbarActionType, l as ToolbarConfig, m as ToolbarController, n as ToolbarGroup, o as TransferPayload, U as Unsubscribe, p as clamp, q as createElement, r as debounce, s as detectMagicBytes, t as detectOoxmlType, u as downloadFile, v as extractExtension, w as formatFileSize, x as getTransferPayload, y as mimeFromExtension, z as printElement, A as sanitizeHTML, B as sanitizeSVG, D as saveTransferPayload, G as sourceToArrayBuffer } from './index.d-B79v0jxi.cjs';
3
+
4
+ /**
5
+ * Supported file input sources.
6
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
7
+ */
8
+ type FileSource$e = string | File | Blob | ArrayBuffer | Uint8Array;
9
+ /** Metadata extracted from a file source */
10
+ interface FileMetadata$e {
11
+ /** Original filename (if available) */
12
+ name?: string;
13
+ /** File size in bytes */
14
+ size?: number;
15
+ /** Detected MIME type */
16
+ mimeType?: string;
17
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
18
+ extension?: string;
19
+ }
20
+ /** Information about a resolved file, ready for plugin matching */
21
+ interface FileInfo$e {
22
+ metadata: FileMetadata$e;
23
+ buffer: ArrayBuffer;
24
+ }
25
+ /** Toolbar action types */
26
+ type ToolbarActionType$e = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
27
+ /** Toolbar action group names for visual grouping */
28
+ type ToolbarGroup$e = 'navigation' | 'zoom' | 'view' | 'actions';
29
+ /** Represents a single toolbar action/control */
30
+ interface ToolbarAction$e {
31
+ /** Unique action identifier */
32
+ id: string;
33
+ /** SVG icon markup string */
34
+ icon: string;
35
+ /** Accessible label */
36
+ label: string;
37
+ /** Type of control to render */
38
+ type: ToolbarActionType$e;
39
+ /** Visual group placement */
40
+ group: ToolbarGroup$e;
41
+ /** Whether the action is currently enabled */
42
+ enabled?: boolean;
43
+ /** Whether a toggle is currently active */
44
+ active?: boolean;
45
+ /** Execute the action */
46
+ execute: (...args: unknown[]) => void;
47
+ /** For 'range' type: min/max/step/value */
48
+ min?: number;
49
+ max?: number;
50
+ step?: number;
51
+ value?: number;
52
+ }
53
+ /** Represents a thumbnail in the sidebar */
54
+ interface Thumbnail$e {
55
+ /** Page/sheet/frame index */
56
+ index: number;
57
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
58
+ label: string;
59
+ /** Renders the thumbnail into a canvas element */
60
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
61
+ }
62
+ /** Instance returned after a file is rendered — exposes controls */
63
+ interface PreviewInstance$e {
64
+ /** Clean up all resources */
65
+ destroy(): void;
66
+ zoomIn?(): void;
67
+ zoomOut?(): void;
68
+ getZoom?(): number;
69
+ setZoom?(level: number): void;
70
+ fitToPage?(): void;
71
+ fitToWidth?(): void;
72
+ goToPage?(page: number): void;
73
+ getPageCount?(): number;
74
+ getCurrentPage?(): number;
75
+ rotateCW?(): void;
76
+ rotateCCW?(): void;
77
+ getRotation?(): number;
78
+ play?(): void;
79
+ pause?(): void;
80
+ isPlaying?(): boolean;
81
+ fastForward?(seconds?: number): void;
82
+ rewind?(seconds?: number): void;
83
+ setPlaybackRate?(rate: number): void;
84
+ getPlaybackRate?(): number;
85
+ getThumbnails?(): Thumbnail$e[] | Promise<Thumbnail$e[]>;
86
+ toggleThumbnails?(): void;
87
+ download?(): void;
88
+ print?(): void;
89
+ [key: string]: unknown;
90
+ }
91
+ /** Context passed to a plugin's render function */
92
+ interface RenderContext$e {
93
+ /** The container DOM element to render into */
94
+ container: HTMLElement;
95
+ /** Original file source */
96
+ source: FileSource$e;
97
+ /** Resolved file metadata */
98
+ metadata: FileMetadata$e;
99
+ /** File content as ArrayBuffer */
100
+ buffer: ArrayBuffer;
101
+ /** Viewer options */
102
+ options: PreviewViewerOptions$e;
103
+ /** AbortSignal for cancellation */
104
+ signal: AbortSignal;
105
+ /** Emit an event to the viewer */
106
+ emit: (event: string, payload?: unknown) => void;
107
+ }
108
+ /** Plugin interface — each file format renderer implements this */
109
+ interface PreviewPlugin$e {
110
+ /** Unique plugin identifier */
111
+ id: string;
112
+ /** Human-readable plugin name */
113
+ name: string;
114
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
115
+ extensions: string[];
116
+ /** MIME types this plugin handles */
117
+ mimeTypes: string[];
118
+ /** Priority when multiple plugins match (higher = preferred) */
119
+ weight?: number;
120
+ /** Check if this plugin can handle the given file */
121
+ supports(file: FileInfo$e): boolean | Promise<boolean>;
122
+ /** Return toolbar actions for the rendered instance */
123
+ getToolbarActions(instance: PreviewInstance$e): ToolbarAction$e[];
124
+ /** Render the file into the container */
125
+ render(ctx: RenderContext$e): Promise<PreviewInstance$e>;
126
+ }
127
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
128
+ interface ToolbarConfig$e {
129
+ /** Page navigation (< [1] / N >) */
130
+ pageNav?: boolean;
131
+ pagination?: boolean;
132
+ prevPage?: boolean;
133
+ nextPage?: boolean;
134
+ /** Zoom controls */
135
+ zoomIn?: boolean;
136
+ zoomOut?: boolean;
137
+ fitPage?: boolean;
138
+ fitToPage?: boolean;
139
+ fitWidth?: boolean;
140
+ zoomReset?: boolean;
141
+ /** View controls */
142
+ rotate?: boolean;
143
+ rotateCW?: boolean;
144
+ rotateCCW?: boolean;
145
+ fullscreen?: boolean;
146
+ thumbnails?: boolean;
147
+ /** Action controls */
148
+ download?: boolean;
149
+ print?: boolean;
150
+ openWindow?: boolean;
151
+ openSeparateWindow?: boolean;
152
+ copy?: boolean;
153
+ /** Media controls */
154
+ play?: boolean;
155
+ pause?: boolean;
156
+ fastForward?: boolean;
157
+ rewind?: boolean;
158
+ speed?: boolean;
159
+ }
160
+ /** Viewer configuration options */
161
+ interface PreviewViewerOptions$e extends ToolbarConfig$e {
162
+ /** Color theme */
163
+ theme?: 'light' | 'dark' | 'auto';
164
+ /** Locale for UI labels */
165
+ locale?: string;
166
+ /** Initial zoom level (1.0 = 100%) */
167
+ zoom?: number;
168
+ /** Initial page number (1-based) */
169
+ page?: number;
170
+ /** Show the toolbar */
171
+ showToolbar?: boolean;
172
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
173
+ toolbar?: boolean | (ToolbarConfig$e & Record<string, boolean | undefined>);
174
+ /** Toolbar position */
175
+ toolbarPosition?: 'top' | 'bottom';
176
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
177
+ fitMode?: 'page' | 'width';
178
+ /** Show thumbnail sidebar initially */
179
+ showThumbnails?: boolean;
180
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
181
+ showFileName?: boolean;
182
+ /** Custom file name / title override to display */
183
+ fileName?: string;
184
+ /** Custom CSS class for the container */
185
+ className?: string;
186
+ /** Plugin-specific options */
187
+ pluginOptions?: Record<string, unknown>;
188
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
189
+ metadata?: FileMetadata$e;
190
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
191
+ standaloneViewerUrl?: string;
192
+ /** Custom handler for opening preview in a separate window */
193
+ onOpenSeparateWindow?: (payload: {
194
+ buffer: ArrayBuffer;
195
+ metadata: FileMetadata$e;
196
+ options: PreviewViewerOptions$e;
197
+ }) => Window | null;
198
+ /** Internal flag: true when viewer is rendered inside separate full window */
199
+ _isSeparateWindow?: boolean;
200
+ /** Allow custom/plugin-specific options */
201
+ [key: string]: unknown;
202
+ }
203
+
204
+ declare class PdfPlugin implements PreviewPlugin$e {
205
+ id: string;
206
+ name: string;
207
+ extensions: string[];
208
+ mimeTypes: string[];
209
+ weight: number;
210
+ supports(file: FileInfo$e): boolean;
211
+ getToolbarActions(instance: PreviewInstance$e): ToolbarAction$e[];
212
+ render(ctx: RenderContext$e): Promise<PreviewInstance$e>;
213
+ }
214
+ declare function pdfPlugin(): PdfPlugin;
215
+
216
+ /**
217
+ * Supported file input sources.
218
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
219
+ */
220
+ type FileSource$d = string | File | Blob | ArrayBuffer | Uint8Array;
221
+ /** Metadata extracted from a file source */
222
+ interface FileMetadata$d {
223
+ /** Original filename (if available) */
224
+ name?: string;
225
+ /** File size in bytes */
226
+ size?: number;
227
+ /** Detected MIME type */
228
+ mimeType?: string;
229
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
230
+ extension?: string;
231
+ }
232
+ /** Information about a resolved file, ready for plugin matching */
233
+ interface FileInfo$d {
234
+ metadata: FileMetadata$d;
235
+ buffer: ArrayBuffer;
236
+ }
237
+ /** Toolbar action types */
238
+ type ToolbarActionType$d = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
239
+ /** Toolbar action group names for visual grouping */
240
+ type ToolbarGroup$d = 'navigation' | 'zoom' | 'view' | 'actions';
241
+ /** Represents a single toolbar action/control */
242
+ interface ToolbarAction$d {
243
+ /** Unique action identifier */
244
+ id: string;
245
+ /** SVG icon markup string */
246
+ icon: string;
247
+ /** Accessible label */
248
+ label: string;
249
+ /** Type of control to render */
250
+ type: ToolbarActionType$d;
251
+ /** Visual group placement */
252
+ group: ToolbarGroup$d;
253
+ /** Whether the action is currently enabled */
254
+ enabled?: boolean;
255
+ /** Whether a toggle is currently active */
256
+ active?: boolean;
257
+ /** Execute the action */
258
+ execute: (...args: unknown[]) => void;
259
+ /** For 'range' type: min/max/step/value */
260
+ min?: number;
261
+ max?: number;
262
+ step?: number;
263
+ value?: number;
264
+ }
265
+ /** Represents a thumbnail in the sidebar */
266
+ interface Thumbnail$d {
267
+ /** Page/sheet/frame index */
268
+ index: number;
269
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
270
+ label: string;
271
+ /** Renders the thumbnail into a canvas element */
272
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
273
+ }
274
+ /** Instance returned after a file is rendered — exposes controls */
275
+ interface PreviewInstance$d {
276
+ /** Clean up all resources */
277
+ destroy(): void;
278
+ zoomIn?(): void;
279
+ zoomOut?(): void;
280
+ getZoom?(): number;
281
+ setZoom?(level: number): void;
282
+ fitToPage?(): void;
283
+ fitToWidth?(): void;
284
+ goToPage?(page: number): void;
285
+ getPageCount?(): number;
286
+ getCurrentPage?(): number;
287
+ rotateCW?(): void;
288
+ rotateCCW?(): void;
289
+ getRotation?(): number;
290
+ play?(): void;
291
+ pause?(): void;
292
+ isPlaying?(): boolean;
293
+ fastForward?(seconds?: number): void;
294
+ rewind?(seconds?: number): void;
295
+ setPlaybackRate?(rate: number): void;
296
+ getPlaybackRate?(): number;
297
+ getThumbnails?(): Thumbnail$d[] | Promise<Thumbnail$d[]>;
298
+ toggleThumbnails?(): void;
299
+ download?(): void;
300
+ print?(): void;
301
+ [key: string]: unknown;
302
+ }
303
+ /** Context passed to a plugin's render function */
304
+ interface RenderContext$d {
305
+ /** The container DOM element to render into */
306
+ container: HTMLElement;
307
+ /** Original file source */
308
+ source: FileSource$d;
309
+ /** Resolved file metadata */
310
+ metadata: FileMetadata$d;
311
+ /** File content as ArrayBuffer */
312
+ buffer: ArrayBuffer;
313
+ /** Viewer options */
314
+ options: PreviewViewerOptions$d;
315
+ /** AbortSignal for cancellation */
316
+ signal: AbortSignal;
317
+ /** Emit an event to the viewer */
318
+ emit: (event: string, payload?: unknown) => void;
319
+ }
320
+ /** Plugin interface — each file format renderer implements this */
321
+ interface PreviewPlugin$d {
322
+ /** Unique plugin identifier */
323
+ id: string;
324
+ /** Human-readable plugin name */
325
+ name: string;
326
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
327
+ extensions: string[];
328
+ /** MIME types this plugin handles */
329
+ mimeTypes: string[];
330
+ /** Priority when multiple plugins match (higher = preferred) */
331
+ weight?: number;
332
+ /** Check if this plugin can handle the given file */
333
+ supports(file: FileInfo$d): boolean | Promise<boolean>;
334
+ /** Return toolbar actions for the rendered instance */
335
+ getToolbarActions(instance: PreviewInstance$d): ToolbarAction$d[];
336
+ /** Render the file into the container */
337
+ render(ctx: RenderContext$d): Promise<PreviewInstance$d>;
338
+ }
339
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
340
+ interface ToolbarConfig$d {
341
+ /** Page navigation (< [1] / N >) */
342
+ pageNav?: boolean;
343
+ pagination?: boolean;
344
+ prevPage?: boolean;
345
+ nextPage?: boolean;
346
+ /** Zoom controls */
347
+ zoomIn?: boolean;
348
+ zoomOut?: boolean;
349
+ fitPage?: boolean;
350
+ fitToPage?: boolean;
351
+ fitWidth?: boolean;
352
+ zoomReset?: boolean;
353
+ /** View controls */
354
+ rotate?: boolean;
355
+ rotateCW?: boolean;
356
+ rotateCCW?: boolean;
357
+ fullscreen?: boolean;
358
+ thumbnails?: boolean;
359
+ /** Action controls */
360
+ download?: boolean;
361
+ print?: boolean;
362
+ openWindow?: boolean;
363
+ openSeparateWindow?: boolean;
364
+ copy?: boolean;
365
+ /** Media controls */
366
+ play?: boolean;
367
+ pause?: boolean;
368
+ fastForward?: boolean;
369
+ rewind?: boolean;
370
+ speed?: boolean;
371
+ }
372
+ /** Viewer configuration options */
373
+ interface PreviewViewerOptions$d extends ToolbarConfig$d {
374
+ /** Color theme */
375
+ theme?: 'light' | 'dark' | 'auto';
376
+ /** Locale for UI labels */
377
+ locale?: string;
378
+ /** Initial zoom level (1.0 = 100%) */
379
+ zoom?: number;
380
+ /** Initial page number (1-based) */
381
+ page?: number;
382
+ /** Show the toolbar */
383
+ showToolbar?: boolean;
384
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
385
+ toolbar?: boolean | (ToolbarConfig$d & Record<string, boolean | undefined>);
386
+ /** Toolbar position */
387
+ toolbarPosition?: 'top' | 'bottom';
388
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
389
+ fitMode?: 'page' | 'width';
390
+ /** Show thumbnail sidebar initially */
391
+ showThumbnails?: boolean;
392
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
393
+ showFileName?: boolean;
394
+ /** Custom file name / title override to display */
395
+ fileName?: string;
396
+ /** Custom CSS class for the container */
397
+ className?: string;
398
+ /** Plugin-specific options */
399
+ pluginOptions?: Record<string, unknown>;
400
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
401
+ metadata?: FileMetadata$d;
402
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
403
+ standaloneViewerUrl?: string;
404
+ /** Custom handler for opening preview in a separate window */
405
+ onOpenSeparateWindow?: (payload: {
406
+ buffer: ArrayBuffer;
407
+ metadata: FileMetadata$d;
408
+ options: PreviewViewerOptions$d;
409
+ }) => Window | null;
410
+ /** Internal flag: true when viewer is rendered inside separate full window */
411
+ _isSeparateWindow?: boolean;
412
+ /** Allow custom/plugin-specific options */
413
+ [key: string]: unknown;
414
+ }
415
+
416
+ declare class MediaPlugin implements PreviewPlugin$d {
417
+ id: string;
418
+ name: string;
419
+ extensions: string[];
420
+ mimeTypes: string[];
421
+ weight: number;
422
+ supports(file: FileInfo$d): boolean;
423
+ getToolbarActions(instance: PreviewInstance$d): ToolbarAction$d[];
424
+ render(ctx: RenderContext$d): Promise<PreviewInstance$d>;
425
+ }
426
+ declare function mediaPlugin(): MediaPlugin;
427
+
428
+ /**
429
+ * Supported file input sources.
430
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
431
+ */
432
+ type FileSource$c = string | File | Blob | ArrayBuffer | Uint8Array;
433
+ /** Metadata extracted from a file source */
434
+ interface FileMetadata$c {
435
+ /** Original filename (if available) */
436
+ name?: string;
437
+ /** File size in bytes */
438
+ size?: number;
439
+ /** Detected MIME type */
440
+ mimeType?: string;
441
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
442
+ extension?: string;
443
+ }
444
+ /** Information about a resolved file, ready for plugin matching */
445
+ interface FileInfo$c {
446
+ metadata: FileMetadata$c;
447
+ buffer: ArrayBuffer;
448
+ }
449
+ /** Toolbar action types */
450
+ type ToolbarActionType$c = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
451
+ /** Toolbar action group names for visual grouping */
452
+ type ToolbarGroup$c = 'navigation' | 'zoom' | 'view' | 'actions';
453
+ /** Represents a single toolbar action/control */
454
+ interface ToolbarAction$c {
455
+ /** Unique action identifier */
456
+ id: string;
457
+ /** SVG icon markup string */
458
+ icon: string;
459
+ /** Accessible label */
460
+ label: string;
461
+ /** Type of control to render */
462
+ type: ToolbarActionType$c;
463
+ /** Visual group placement */
464
+ group: ToolbarGroup$c;
465
+ /** Whether the action is currently enabled */
466
+ enabled?: boolean;
467
+ /** Whether a toggle is currently active */
468
+ active?: boolean;
469
+ /** Execute the action */
470
+ execute: (...args: unknown[]) => void;
471
+ /** For 'range' type: min/max/step/value */
472
+ min?: number;
473
+ max?: number;
474
+ step?: number;
475
+ value?: number;
476
+ }
477
+ /** Represents a thumbnail in the sidebar */
478
+ interface Thumbnail$c {
479
+ /** Page/sheet/frame index */
480
+ index: number;
481
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
482
+ label: string;
483
+ /** Renders the thumbnail into a canvas element */
484
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
485
+ }
486
+ /** Instance returned after a file is rendered — exposes controls */
487
+ interface PreviewInstance$c {
488
+ /** Clean up all resources */
489
+ destroy(): void;
490
+ zoomIn?(): void;
491
+ zoomOut?(): void;
492
+ getZoom?(): number;
493
+ setZoom?(level: number): void;
494
+ fitToPage?(): void;
495
+ fitToWidth?(): void;
496
+ goToPage?(page: number): void;
497
+ getPageCount?(): number;
498
+ getCurrentPage?(): number;
499
+ rotateCW?(): void;
500
+ rotateCCW?(): void;
501
+ getRotation?(): number;
502
+ play?(): void;
503
+ pause?(): void;
504
+ isPlaying?(): boolean;
505
+ fastForward?(seconds?: number): void;
506
+ rewind?(seconds?: number): void;
507
+ setPlaybackRate?(rate: number): void;
508
+ getPlaybackRate?(): number;
509
+ getThumbnails?(): Thumbnail$c[] | Promise<Thumbnail$c[]>;
510
+ toggleThumbnails?(): void;
511
+ download?(): void;
512
+ print?(): void;
513
+ [key: string]: unknown;
514
+ }
515
+ /** Context passed to a plugin's render function */
516
+ interface RenderContext$c {
517
+ /** The container DOM element to render into */
518
+ container: HTMLElement;
519
+ /** Original file source */
520
+ source: FileSource$c;
521
+ /** Resolved file metadata */
522
+ metadata: FileMetadata$c;
523
+ /** File content as ArrayBuffer */
524
+ buffer: ArrayBuffer;
525
+ /** Viewer options */
526
+ options: PreviewViewerOptions$c;
527
+ /** AbortSignal for cancellation */
528
+ signal: AbortSignal;
529
+ /** Emit an event to the viewer */
530
+ emit: (event: string, payload?: unknown) => void;
531
+ }
532
+ /** Plugin interface — each file format renderer implements this */
533
+ interface PreviewPlugin$c {
534
+ /** Unique plugin identifier */
535
+ id: string;
536
+ /** Human-readable plugin name */
537
+ name: string;
538
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
539
+ extensions: string[];
540
+ /** MIME types this plugin handles */
541
+ mimeTypes: string[];
542
+ /** Priority when multiple plugins match (higher = preferred) */
543
+ weight?: number;
544
+ /** Check if this plugin can handle the given file */
545
+ supports(file: FileInfo$c): boolean | Promise<boolean>;
546
+ /** Return toolbar actions for the rendered instance */
547
+ getToolbarActions(instance: PreviewInstance$c): ToolbarAction$c[];
548
+ /** Render the file into the container */
549
+ render(ctx: RenderContext$c): Promise<PreviewInstance$c>;
550
+ }
551
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
552
+ interface ToolbarConfig$c {
553
+ /** Page navigation (< [1] / N >) */
554
+ pageNav?: boolean;
555
+ pagination?: boolean;
556
+ prevPage?: boolean;
557
+ nextPage?: boolean;
558
+ /** Zoom controls */
559
+ zoomIn?: boolean;
560
+ zoomOut?: boolean;
561
+ fitPage?: boolean;
562
+ fitToPage?: boolean;
563
+ fitWidth?: boolean;
564
+ zoomReset?: boolean;
565
+ /** View controls */
566
+ rotate?: boolean;
567
+ rotateCW?: boolean;
568
+ rotateCCW?: boolean;
569
+ fullscreen?: boolean;
570
+ thumbnails?: boolean;
571
+ /** Action controls */
572
+ download?: boolean;
573
+ print?: boolean;
574
+ openWindow?: boolean;
575
+ openSeparateWindow?: boolean;
576
+ copy?: boolean;
577
+ /** Media controls */
578
+ play?: boolean;
579
+ pause?: boolean;
580
+ fastForward?: boolean;
581
+ rewind?: boolean;
582
+ speed?: boolean;
583
+ }
584
+ /** Viewer configuration options */
585
+ interface PreviewViewerOptions$c extends ToolbarConfig$c {
586
+ /** Color theme */
587
+ theme?: 'light' | 'dark' | 'auto';
588
+ /** Locale for UI labels */
589
+ locale?: string;
590
+ /** Initial zoom level (1.0 = 100%) */
591
+ zoom?: number;
592
+ /** Initial page number (1-based) */
593
+ page?: number;
594
+ /** Show the toolbar */
595
+ showToolbar?: boolean;
596
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
597
+ toolbar?: boolean | (ToolbarConfig$c & Record<string, boolean | undefined>);
598
+ /** Toolbar position */
599
+ toolbarPosition?: 'top' | 'bottom';
600
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
601
+ fitMode?: 'page' | 'width';
602
+ /** Show thumbnail sidebar initially */
603
+ showThumbnails?: boolean;
604
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
605
+ showFileName?: boolean;
606
+ /** Custom file name / title override to display */
607
+ fileName?: string;
608
+ /** Custom CSS class for the container */
609
+ className?: string;
610
+ /** Plugin-specific options */
611
+ pluginOptions?: Record<string, unknown>;
612
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
613
+ metadata?: FileMetadata$c;
614
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
615
+ standaloneViewerUrl?: string;
616
+ /** Custom handler for opening preview in a separate window */
617
+ onOpenSeparateWindow?: (payload: {
618
+ buffer: ArrayBuffer;
619
+ metadata: FileMetadata$c;
620
+ options: PreviewViewerOptions$c;
621
+ }) => Window | null;
622
+ /** Internal flag: true when viewer is rendered inside separate full window */
623
+ _isSeparateWindow?: boolean;
624
+ /** Allow custom/plugin-specific options */
625
+ [key: string]: unknown;
626
+ }
627
+
628
+ declare class DocxPlugin implements PreviewPlugin$c {
629
+ id: string;
630
+ name: string;
631
+ extensions: string[];
632
+ mimeTypes: string[];
633
+ weight: number;
634
+ supports(file: FileInfo$c): boolean;
635
+ getToolbarActions(instance: PreviewInstance$c): ToolbarAction$c[];
636
+ render(ctx: RenderContext$c): Promise<PreviewInstance$c>;
637
+ private renderXmlFallback;
638
+ private extractParagraphHtml;
639
+ private extractParagraphChunks;
640
+ private renderBinaryDocFallback;
641
+ private extractReadableStrings;
642
+ private parseAndRenderChartSvg;
643
+ }
644
+ declare function docxPlugin(): DocxPlugin;
645
+
646
+ /**
647
+ * Supported file input sources.
648
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
649
+ */
650
+ type FileSource$b = string | File | Blob | ArrayBuffer | Uint8Array;
651
+ /** Metadata extracted from a file source */
652
+ interface FileMetadata$b {
653
+ /** Original filename (if available) */
654
+ name?: string;
655
+ /** File size in bytes */
656
+ size?: number;
657
+ /** Detected MIME type */
658
+ mimeType?: string;
659
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
660
+ extension?: string;
661
+ }
662
+ /** Information about a resolved file, ready for plugin matching */
663
+ interface FileInfo$b {
664
+ metadata: FileMetadata$b;
665
+ buffer: ArrayBuffer;
666
+ }
667
+ /** Toolbar action types */
668
+ type ToolbarActionType$b = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
669
+ /** Toolbar action group names for visual grouping */
670
+ type ToolbarGroup$b = 'navigation' | 'zoom' | 'view' | 'actions';
671
+ /** Represents a single toolbar action/control */
672
+ interface ToolbarAction$b {
673
+ /** Unique action identifier */
674
+ id: string;
675
+ /** SVG icon markup string */
676
+ icon: string;
677
+ /** Accessible label */
678
+ label: string;
679
+ /** Type of control to render */
680
+ type: ToolbarActionType$b;
681
+ /** Visual group placement */
682
+ group: ToolbarGroup$b;
683
+ /** Whether the action is currently enabled */
684
+ enabled?: boolean;
685
+ /** Whether a toggle is currently active */
686
+ active?: boolean;
687
+ /** Execute the action */
688
+ execute: (...args: unknown[]) => void;
689
+ /** For 'range' type: min/max/step/value */
690
+ min?: number;
691
+ max?: number;
692
+ step?: number;
693
+ value?: number;
694
+ }
695
+ /** Represents a thumbnail in the sidebar */
696
+ interface Thumbnail$b {
697
+ /** Page/sheet/frame index */
698
+ index: number;
699
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
700
+ label: string;
701
+ /** Renders the thumbnail into a canvas element */
702
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
703
+ }
704
+ /** Instance returned after a file is rendered — exposes controls */
705
+ interface PreviewInstance$b {
706
+ /** Clean up all resources */
707
+ destroy(): void;
708
+ zoomIn?(): void;
709
+ zoomOut?(): void;
710
+ getZoom?(): number;
711
+ setZoom?(level: number): void;
712
+ fitToPage?(): void;
713
+ fitToWidth?(): void;
714
+ goToPage?(page: number): void;
715
+ getPageCount?(): number;
716
+ getCurrentPage?(): number;
717
+ rotateCW?(): void;
718
+ rotateCCW?(): void;
719
+ getRotation?(): number;
720
+ play?(): void;
721
+ pause?(): void;
722
+ isPlaying?(): boolean;
723
+ fastForward?(seconds?: number): void;
724
+ rewind?(seconds?: number): void;
725
+ setPlaybackRate?(rate: number): void;
726
+ getPlaybackRate?(): number;
727
+ getThumbnails?(): Thumbnail$b[] | Promise<Thumbnail$b[]>;
728
+ toggleThumbnails?(): void;
729
+ download?(): void;
730
+ print?(): void;
731
+ [key: string]: unknown;
732
+ }
733
+ /** Context passed to a plugin's render function */
734
+ interface RenderContext$b {
735
+ /** The container DOM element to render into */
736
+ container: HTMLElement;
737
+ /** Original file source */
738
+ source: FileSource$b;
739
+ /** Resolved file metadata */
740
+ metadata: FileMetadata$b;
741
+ /** File content as ArrayBuffer */
742
+ buffer: ArrayBuffer;
743
+ /** Viewer options */
744
+ options: PreviewViewerOptions$b;
745
+ /** AbortSignal for cancellation */
746
+ signal: AbortSignal;
747
+ /** Emit an event to the viewer */
748
+ emit: (event: string, payload?: unknown) => void;
749
+ }
750
+ /** Plugin interface — each file format renderer implements this */
751
+ interface PreviewPlugin$b {
752
+ /** Unique plugin identifier */
753
+ id: string;
754
+ /** Human-readable plugin name */
755
+ name: string;
756
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
757
+ extensions: string[];
758
+ /** MIME types this plugin handles */
759
+ mimeTypes: string[];
760
+ /** Priority when multiple plugins match (higher = preferred) */
761
+ weight?: number;
762
+ /** Check if this plugin can handle the given file */
763
+ supports(file: FileInfo$b): boolean | Promise<boolean>;
764
+ /** Return toolbar actions for the rendered instance */
765
+ getToolbarActions(instance: PreviewInstance$b): ToolbarAction$b[];
766
+ /** Render the file into the container */
767
+ render(ctx: RenderContext$b): Promise<PreviewInstance$b>;
768
+ }
769
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
770
+ interface ToolbarConfig$b {
771
+ /** Page navigation (< [1] / N >) */
772
+ pageNav?: boolean;
773
+ pagination?: boolean;
774
+ prevPage?: boolean;
775
+ nextPage?: boolean;
776
+ /** Zoom controls */
777
+ zoomIn?: boolean;
778
+ zoomOut?: boolean;
779
+ fitPage?: boolean;
780
+ fitToPage?: boolean;
781
+ fitWidth?: boolean;
782
+ zoomReset?: boolean;
783
+ /** View controls */
784
+ rotate?: boolean;
785
+ rotateCW?: boolean;
786
+ rotateCCW?: boolean;
787
+ fullscreen?: boolean;
788
+ thumbnails?: boolean;
789
+ /** Action controls */
790
+ download?: boolean;
791
+ print?: boolean;
792
+ openWindow?: boolean;
793
+ openSeparateWindow?: boolean;
794
+ copy?: boolean;
795
+ /** Media controls */
796
+ play?: boolean;
797
+ pause?: boolean;
798
+ fastForward?: boolean;
799
+ rewind?: boolean;
800
+ speed?: boolean;
801
+ }
802
+ /** Viewer configuration options */
803
+ interface PreviewViewerOptions$b extends ToolbarConfig$b {
804
+ /** Color theme */
805
+ theme?: 'light' | 'dark' | 'auto';
806
+ /** Locale for UI labels */
807
+ locale?: string;
808
+ /** Initial zoom level (1.0 = 100%) */
809
+ zoom?: number;
810
+ /** Initial page number (1-based) */
811
+ page?: number;
812
+ /** Show the toolbar */
813
+ showToolbar?: boolean;
814
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
815
+ toolbar?: boolean | (ToolbarConfig$b & Record<string, boolean | undefined>);
816
+ /** Toolbar position */
817
+ toolbarPosition?: 'top' | 'bottom';
818
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
819
+ fitMode?: 'page' | 'width';
820
+ /** Show thumbnail sidebar initially */
821
+ showThumbnails?: boolean;
822
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
823
+ showFileName?: boolean;
824
+ /** Custom file name / title override to display */
825
+ fileName?: string;
826
+ /** Custom CSS class for the container */
827
+ className?: string;
828
+ /** Plugin-specific options */
829
+ pluginOptions?: Record<string, unknown>;
830
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
831
+ metadata?: FileMetadata$b;
832
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
833
+ standaloneViewerUrl?: string;
834
+ /** Custom handler for opening preview in a separate window */
835
+ onOpenSeparateWindow?: (payload: {
836
+ buffer: ArrayBuffer;
837
+ metadata: FileMetadata$b;
838
+ options: PreviewViewerOptions$b;
839
+ }) => Window | null;
840
+ /** Internal flag: true when viewer is rendered inside separate full window */
841
+ _isSeparateWindow?: boolean;
842
+ /** Allow custom/plugin-specific options */
843
+ [key: string]: unknown;
844
+ }
845
+
846
+ declare class ExcelPlugin implements PreviewPlugin$b {
847
+ id: string;
848
+ name: string;
849
+ extensions: string[];
850
+ mimeTypes: string[];
851
+ weight: number;
852
+ supports(file: FileInfo$b): boolean;
853
+ getToolbarActions(instance: PreviewInstance$b): ToolbarAction$b[];
854
+ render(ctx: RenderContext$b): Promise<PreviewInstance$b>;
855
+ }
856
+ declare function excelPlugin(): ExcelPlugin;
857
+
858
+ /**
859
+ * Supported file input sources.
860
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
861
+ */
862
+ type FileSource$a = string | File | Blob | ArrayBuffer | Uint8Array;
863
+ /** Metadata extracted from a file source */
864
+ interface FileMetadata$a {
865
+ /** Original filename (if available) */
866
+ name?: string;
867
+ /** File size in bytes */
868
+ size?: number;
869
+ /** Detected MIME type */
870
+ mimeType?: string;
871
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
872
+ extension?: string;
873
+ }
874
+ /** Information about a resolved file, ready for plugin matching */
875
+ interface FileInfo$a {
876
+ metadata: FileMetadata$a;
877
+ buffer: ArrayBuffer;
878
+ }
879
+ /** Toolbar action types */
880
+ type ToolbarActionType$a = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
881
+ /** Toolbar action group names for visual grouping */
882
+ type ToolbarGroup$a = 'navigation' | 'zoom' | 'view' | 'actions';
883
+ /** Represents a single toolbar action/control */
884
+ interface ToolbarAction$a {
885
+ /** Unique action identifier */
886
+ id: string;
887
+ /** SVG icon markup string */
888
+ icon: string;
889
+ /** Accessible label */
890
+ label: string;
891
+ /** Type of control to render */
892
+ type: ToolbarActionType$a;
893
+ /** Visual group placement */
894
+ group: ToolbarGroup$a;
895
+ /** Whether the action is currently enabled */
896
+ enabled?: boolean;
897
+ /** Whether a toggle is currently active */
898
+ active?: boolean;
899
+ /** Execute the action */
900
+ execute: (...args: unknown[]) => void;
901
+ /** For 'range' type: min/max/step/value */
902
+ min?: number;
903
+ max?: number;
904
+ step?: number;
905
+ value?: number;
906
+ }
907
+ /** Represents a thumbnail in the sidebar */
908
+ interface Thumbnail$a {
909
+ /** Page/sheet/frame index */
910
+ index: number;
911
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
912
+ label: string;
913
+ /** Renders the thumbnail into a canvas element */
914
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
915
+ }
916
+ /** Instance returned after a file is rendered — exposes controls */
917
+ interface PreviewInstance$a {
918
+ /** Clean up all resources */
919
+ destroy(): void;
920
+ zoomIn?(): void;
921
+ zoomOut?(): void;
922
+ getZoom?(): number;
923
+ setZoom?(level: number): void;
924
+ fitToPage?(): void;
925
+ fitToWidth?(): void;
926
+ goToPage?(page: number): void;
927
+ getPageCount?(): number;
928
+ getCurrentPage?(): number;
929
+ rotateCW?(): void;
930
+ rotateCCW?(): void;
931
+ getRotation?(): number;
932
+ play?(): void;
933
+ pause?(): void;
934
+ isPlaying?(): boolean;
935
+ fastForward?(seconds?: number): void;
936
+ rewind?(seconds?: number): void;
937
+ setPlaybackRate?(rate: number): void;
938
+ getPlaybackRate?(): number;
939
+ getThumbnails?(): Thumbnail$a[] | Promise<Thumbnail$a[]>;
940
+ toggleThumbnails?(): void;
941
+ download?(): void;
942
+ print?(): void;
943
+ [key: string]: unknown;
944
+ }
945
+ /** Context passed to a plugin's render function */
946
+ interface RenderContext$a {
947
+ /** The container DOM element to render into */
948
+ container: HTMLElement;
949
+ /** Original file source */
950
+ source: FileSource$a;
951
+ /** Resolved file metadata */
952
+ metadata: FileMetadata$a;
953
+ /** File content as ArrayBuffer */
954
+ buffer: ArrayBuffer;
955
+ /** Viewer options */
956
+ options: PreviewViewerOptions$a;
957
+ /** AbortSignal for cancellation */
958
+ signal: AbortSignal;
959
+ /** Emit an event to the viewer */
960
+ emit: (event: string, payload?: unknown) => void;
961
+ }
962
+ /** Plugin interface — each file format renderer implements this */
963
+ interface PreviewPlugin$a {
964
+ /** Unique plugin identifier */
965
+ id: string;
966
+ /** Human-readable plugin name */
967
+ name: string;
968
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
969
+ extensions: string[];
970
+ /** MIME types this plugin handles */
971
+ mimeTypes: string[];
972
+ /** Priority when multiple plugins match (higher = preferred) */
973
+ weight?: number;
974
+ /** Check if this plugin can handle the given file */
975
+ supports(file: FileInfo$a): boolean | Promise<boolean>;
976
+ /** Return toolbar actions for the rendered instance */
977
+ getToolbarActions(instance: PreviewInstance$a): ToolbarAction$a[];
978
+ /** Render the file into the container */
979
+ render(ctx: RenderContext$a): Promise<PreviewInstance$a>;
980
+ }
981
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
982
+ interface ToolbarConfig$a {
983
+ /** Page navigation (< [1] / N >) */
984
+ pageNav?: boolean;
985
+ pagination?: boolean;
986
+ prevPage?: boolean;
987
+ nextPage?: boolean;
988
+ /** Zoom controls */
989
+ zoomIn?: boolean;
990
+ zoomOut?: boolean;
991
+ fitPage?: boolean;
992
+ fitToPage?: boolean;
993
+ fitWidth?: boolean;
994
+ zoomReset?: boolean;
995
+ /** View controls */
996
+ rotate?: boolean;
997
+ rotateCW?: boolean;
998
+ rotateCCW?: boolean;
999
+ fullscreen?: boolean;
1000
+ thumbnails?: boolean;
1001
+ /** Action controls */
1002
+ download?: boolean;
1003
+ print?: boolean;
1004
+ openWindow?: boolean;
1005
+ openSeparateWindow?: boolean;
1006
+ copy?: boolean;
1007
+ /** Media controls */
1008
+ play?: boolean;
1009
+ pause?: boolean;
1010
+ fastForward?: boolean;
1011
+ rewind?: boolean;
1012
+ speed?: boolean;
1013
+ }
1014
+ /** Viewer configuration options */
1015
+ interface PreviewViewerOptions$a extends ToolbarConfig$a {
1016
+ /** Color theme */
1017
+ theme?: 'light' | 'dark' | 'auto';
1018
+ /** Locale for UI labels */
1019
+ locale?: string;
1020
+ /** Initial zoom level (1.0 = 100%) */
1021
+ zoom?: number;
1022
+ /** Initial page number (1-based) */
1023
+ page?: number;
1024
+ /** Show the toolbar */
1025
+ showToolbar?: boolean;
1026
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
1027
+ toolbar?: boolean | (ToolbarConfig$a & Record<string, boolean | undefined>);
1028
+ /** Toolbar position */
1029
+ toolbarPosition?: 'top' | 'bottom';
1030
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
1031
+ fitMode?: 'page' | 'width';
1032
+ /** Show thumbnail sidebar initially */
1033
+ showThumbnails?: boolean;
1034
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
1035
+ showFileName?: boolean;
1036
+ /** Custom file name / title override to display */
1037
+ fileName?: string;
1038
+ /** Custom CSS class for the container */
1039
+ className?: string;
1040
+ /** Plugin-specific options */
1041
+ pluginOptions?: Record<string, unknown>;
1042
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
1043
+ metadata?: FileMetadata$a;
1044
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
1045
+ standaloneViewerUrl?: string;
1046
+ /** Custom handler for opening preview in a separate window */
1047
+ onOpenSeparateWindow?: (payload: {
1048
+ buffer: ArrayBuffer;
1049
+ metadata: FileMetadata$a;
1050
+ options: PreviewViewerOptions$a;
1051
+ }) => Window | null;
1052
+ /** Internal flag: true when viewer is rendered inside separate full window */
1053
+ _isSeparateWindow?: boolean;
1054
+ /** Allow custom/plugin-specific options */
1055
+ [key: string]: unknown;
1056
+ }
1057
+
1058
+ declare class CsvPlugin implements PreviewPlugin$a {
1059
+ id: string;
1060
+ name: string;
1061
+ extensions: string[];
1062
+ mimeTypes: string[];
1063
+ weight: number;
1064
+ supports(file: FileInfo$a): boolean;
1065
+ getToolbarActions(instance: PreviewInstance$a): ToolbarAction$a[];
1066
+ render(ctx: RenderContext$a): Promise<PreviewInstance$a>;
1067
+ }
1068
+ declare function csvPlugin(): CsvPlugin;
1069
+
1070
+ /**
1071
+ * Supported file input sources.
1072
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
1073
+ */
1074
+ type FileSource$9 = string | File | Blob | ArrayBuffer | Uint8Array;
1075
+ /** Metadata extracted from a file source */
1076
+ interface FileMetadata$9 {
1077
+ /** Original filename (if available) */
1078
+ name?: string;
1079
+ /** File size in bytes */
1080
+ size?: number;
1081
+ /** Detected MIME type */
1082
+ mimeType?: string;
1083
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
1084
+ extension?: string;
1085
+ }
1086
+ /** Information about a resolved file, ready for plugin matching */
1087
+ interface FileInfo$9 {
1088
+ metadata: FileMetadata$9;
1089
+ buffer: ArrayBuffer;
1090
+ }
1091
+ /** Toolbar action types */
1092
+ type ToolbarActionType$9 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
1093
+ /** Toolbar action group names for visual grouping */
1094
+ type ToolbarGroup$9 = 'navigation' | 'zoom' | 'view' | 'actions';
1095
+ /** Represents a single toolbar action/control */
1096
+ interface ToolbarAction$9 {
1097
+ /** Unique action identifier */
1098
+ id: string;
1099
+ /** SVG icon markup string */
1100
+ icon: string;
1101
+ /** Accessible label */
1102
+ label: string;
1103
+ /** Type of control to render */
1104
+ type: ToolbarActionType$9;
1105
+ /** Visual group placement */
1106
+ group: ToolbarGroup$9;
1107
+ /** Whether the action is currently enabled */
1108
+ enabled?: boolean;
1109
+ /** Whether a toggle is currently active */
1110
+ active?: boolean;
1111
+ /** Execute the action */
1112
+ execute: (...args: unknown[]) => void;
1113
+ /** For 'range' type: min/max/step/value */
1114
+ min?: number;
1115
+ max?: number;
1116
+ step?: number;
1117
+ value?: number;
1118
+ }
1119
+ /** Represents a thumbnail in the sidebar */
1120
+ interface Thumbnail$9 {
1121
+ /** Page/sheet/frame index */
1122
+ index: number;
1123
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
1124
+ label: string;
1125
+ /** Renders the thumbnail into a canvas element */
1126
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
1127
+ }
1128
+ /** Instance returned after a file is rendered — exposes controls */
1129
+ interface PreviewInstance$9 {
1130
+ /** Clean up all resources */
1131
+ destroy(): void;
1132
+ zoomIn?(): void;
1133
+ zoomOut?(): void;
1134
+ getZoom?(): number;
1135
+ setZoom?(level: number): void;
1136
+ fitToPage?(): void;
1137
+ fitToWidth?(): void;
1138
+ goToPage?(page: number): void;
1139
+ getPageCount?(): number;
1140
+ getCurrentPage?(): number;
1141
+ rotateCW?(): void;
1142
+ rotateCCW?(): void;
1143
+ getRotation?(): number;
1144
+ play?(): void;
1145
+ pause?(): void;
1146
+ isPlaying?(): boolean;
1147
+ fastForward?(seconds?: number): void;
1148
+ rewind?(seconds?: number): void;
1149
+ setPlaybackRate?(rate: number): void;
1150
+ getPlaybackRate?(): number;
1151
+ getThumbnails?(): Thumbnail$9[] | Promise<Thumbnail$9[]>;
1152
+ toggleThumbnails?(): void;
1153
+ download?(): void;
1154
+ print?(): void;
1155
+ [key: string]: unknown;
1156
+ }
1157
+ /** Context passed to a plugin's render function */
1158
+ interface RenderContext$9 {
1159
+ /** The container DOM element to render into */
1160
+ container: HTMLElement;
1161
+ /** Original file source */
1162
+ source: FileSource$9;
1163
+ /** Resolved file metadata */
1164
+ metadata: FileMetadata$9;
1165
+ /** File content as ArrayBuffer */
1166
+ buffer: ArrayBuffer;
1167
+ /** Viewer options */
1168
+ options: PreviewViewerOptions$9;
1169
+ /** AbortSignal for cancellation */
1170
+ signal: AbortSignal;
1171
+ /** Emit an event to the viewer */
1172
+ emit: (event: string, payload?: unknown) => void;
1173
+ }
1174
+ /** Plugin interface — each file format renderer implements this */
1175
+ interface PreviewPlugin$9 {
1176
+ /** Unique plugin identifier */
1177
+ id: string;
1178
+ /** Human-readable plugin name */
1179
+ name: string;
1180
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
1181
+ extensions: string[];
1182
+ /** MIME types this plugin handles */
1183
+ mimeTypes: string[];
1184
+ /** Priority when multiple plugins match (higher = preferred) */
1185
+ weight?: number;
1186
+ /** Check if this plugin can handle the given file */
1187
+ supports(file: FileInfo$9): boolean | Promise<boolean>;
1188
+ /** Return toolbar actions for the rendered instance */
1189
+ getToolbarActions(instance: PreviewInstance$9): ToolbarAction$9[];
1190
+ /** Render the file into the container */
1191
+ render(ctx: RenderContext$9): Promise<PreviewInstance$9>;
1192
+ }
1193
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
1194
+ interface ToolbarConfig$9 {
1195
+ /** Page navigation (< [1] / N >) */
1196
+ pageNav?: boolean;
1197
+ pagination?: boolean;
1198
+ prevPage?: boolean;
1199
+ nextPage?: boolean;
1200
+ /** Zoom controls */
1201
+ zoomIn?: boolean;
1202
+ zoomOut?: boolean;
1203
+ fitPage?: boolean;
1204
+ fitToPage?: boolean;
1205
+ fitWidth?: boolean;
1206
+ zoomReset?: boolean;
1207
+ /** View controls */
1208
+ rotate?: boolean;
1209
+ rotateCW?: boolean;
1210
+ rotateCCW?: boolean;
1211
+ fullscreen?: boolean;
1212
+ thumbnails?: boolean;
1213
+ /** Action controls */
1214
+ download?: boolean;
1215
+ print?: boolean;
1216
+ openWindow?: boolean;
1217
+ openSeparateWindow?: boolean;
1218
+ copy?: boolean;
1219
+ /** Media controls */
1220
+ play?: boolean;
1221
+ pause?: boolean;
1222
+ fastForward?: boolean;
1223
+ rewind?: boolean;
1224
+ speed?: boolean;
1225
+ }
1226
+ /** Viewer configuration options */
1227
+ interface PreviewViewerOptions$9 extends ToolbarConfig$9 {
1228
+ /** Color theme */
1229
+ theme?: 'light' | 'dark' | 'auto';
1230
+ /** Locale for UI labels */
1231
+ locale?: string;
1232
+ /** Initial zoom level (1.0 = 100%) */
1233
+ zoom?: number;
1234
+ /** Initial page number (1-based) */
1235
+ page?: number;
1236
+ /** Show the toolbar */
1237
+ showToolbar?: boolean;
1238
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
1239
+ toolbar?: boolean | (ToolbarConfig$9 & Record<string, boolean | undefined>);
1240
+ /** Toolbar position */
1241
+ toolbarPosition?: 'top' | 'bottom';
1242
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
1243
+ fitMode?: 'page' | 'width';
1244
+ /** Show thumbnail sidebar initially */
1245
+ showThumbnails?: boolean;
1246
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
1247
+ showFileName?: boolean;
1248
+ /** Custom file name / title override to display */
1249
+ fileName?: string;
1250
+ /** Custom CSS class for the container */
1251
+ className?: string;
1252
+ /** Plugin-specific options */
1253
+ pluginOptions?: Record<string, unknown>;
1254
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
1255
+ metadata?: FileMetadata$9;
1256
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
1257
+ standaloneViewerUrl?: string;
1258
+ /** Custom handler for opening preview in a separate window */
1259
+ onOpenSeparateWindow?: (payload: {
1260
+ buffer: ArrayBuffer;
1261
+ metadata: FileMetadata$9;
1262
+ options: PreviewViewerOptions$9;
1263
+ }) => Window | null;
1264
+ /** Internal flag: true when viewer is rendered inside separate full window */
1265
+ _isSeparateWindow?: boolean;
1266
+ /** Allow custom/plugin-specific options */
1267
+ [key: string]: unknown;
1268
+ }
1269
+
1270
+ declare class CodePlugin implements PreviewPlugin$9 {
1271
+ id: string;
1272
+ name: string;
1273
+ extensions: string[];
1274
+ mimeTypes: string[];
1275
+ weight: number;
1276
+ supports(file: FileInfo$9): boolean;
1277
+ getToolbarActions(instance: PreviewInstance$9): ToolbarAction$9[];
1278
+ render(ctx: RenderContext$9): Promise<PreviewInstance$9>;
1279
+ }
1280
+ declare function codePlugin(): CodePlugin;
1281
+
1282
+ /**
1283
+ * Supported file input sources.
1284
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
1285
+ */
1286
+ type FileSource$8 = string | File | Blob | ArrayBuffer | Uint8Array;
1287
+ /** Metadata extracted from a file source */
1288
+ interface FileMetadata$8 {
1289
+ /** Original filename (if available) */
1290
+ name?: string;
1291
+ /** File size in bytes */
1292
+ size?: number;
1293
+ /** Detected MIME type */
1294
+ mimeType?: string;
1295
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
1296
+ extension?: string;
1297
+ }
1298
+ /** Information about a resolved file, ready for plugin matching */
1299
+ interface FileInfo$8 {
1300
+ metadata: FileMetadata$8;
1301
+ buffer: ArrayBuffer;
1302
+ }
1303
+ /** Toolbar action types */
1304
+ type ToolbarActionType$8 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
1305
+ /** Toolbar action group names for visual grouping */
1306
+ type ToolbarGroup$8 = 'navigation' | 'zoom' | 'view' | 'actions';
1307
+ /** Represents a single toolbar action/control */
1308
+ interface ToolbarAction$8 {
1309
+ /** Unique action identifier */
1310
+ id: string;
1311
+ /** SVG icon markup string */
1312
+ icon: string;
1313
+ /** Accessible label */
1314
+ label: string;
1315
+ /** Type of control to render */
1316
+ type: ToolbarActionType$8;
1317
+ /** Visual group placement */
1318
+ group: ToolbarGroup$8;
1319
+ /** Whether the action is currently enabled */
1320
+ enabled?: boolean;
1321
+ /** Whether a toggle is currently active */
1322
+ active?: boolean;
1323
+ /** Execute the action */
1324
+ execute: (...args: unknown[]) => void;
1325
+ /** For 'range' type: min/max/step/value */
1326
+ min?: number;
1327
+ max?: number;
1328
+ step?: number;
1329
+ value?: number;
1330
+ }
1331
+ /** Represents a thumbnail in the sidebar */
1332
+ interface Thumbnail$8 {
1333
+ /** Page/sheet/frame index */
1334
+ index: number;
1335
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
1336
+ label: string;
1337
+ /** Renders the thumbnail into a canvas element */
1338
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
1339
+ }
1340
+ /** Instance returned after a file is rendered — exposes controls */
1341
+ interface PreviewInstance$8 {
1342
+ /** Clean up all resources */
1343
+ destroy(): void;
1344
+ zoomIn?(): void;
1345
+ zoomOut?(): void;
1346
+ getZoom?(): number;
1347
+ setZoom?(level: number): void;
1348
+ fitToPage?(): void;
1349
+ fitToWidth?(): void;
1350
+ goToPage?(page: number): void;
1351
+ getPageCount?(): number;
1352
+ getCurrentPage?(): number;
1353
+ rotateCW?(): void;
1354
+ rotateCCW?(): void;
1355
+ getRotation?(): number;
1356
+ play?(): void;
1357
+ pause?(): void;
1358
+ isPlaying?(): boolean;
1359
+ fastForward?(seconds?: number): void;
1360
+ rewind?(seconds?: number): void;
1361
+ setPlaybackRate?(rate: number): void;
1362
+ getPlaybackRate?(): number;
1363
+ getThumbnails?(): Thumbnail$8[] | Promise<Thumbnail$8[]>;
1364
+ toggleThumbnails?(): void;
1365
+ download?(): void;
1366
+ print?(): void;
1367
+ [key: string]: unknown;
1368
+ }
1369
+ /** Context passed to a plugin's render function */
1370
+ interface RenderContext$8 {
1371
+ /** The container DOM element to render into */
1372
+ container: HTMLElement;
1373
+ /** Original file source */
1374
+ source: FileSource$8;
1375
+ /** Resolved file metadata */
1376
+ metadata: FileMetadata$8;
1377
+ /** File content as ArrayBuffer */
1378
+ buffer: ArrayBuffer;
1379
+ /** Viewer options */
1380
+ options: PreviewViewerOptions$8;
1381
+ /** AbortSignal for cancellation */
1382
+ signal: AbortSignal;
1383
+ /** Emit an event to the viewer */
1384
+ emit: (event: string, payload?: unknown) => void;
1385
+ }
1386
+ /** Plugin interface — each file format renderer implements this */
1387
+ interface PreviewPlugin$8 {
1388
+ /** Unique plugin identifier */
1389
+ id: string;
1390
+ /** Human-readable plugin name */
1391
+ name: string;
1392
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
1393
+ extensions: string[];
1394
+ /** MIME types this plugin handles */
1395
+ mimeTypes: string[];
1396
+ /** Priority when multiple plugins match (higher = preferred) */
1397
+ weight?: number;
1398
+ /** Check if this plugin can handle the given file */
1399
+ supports(file: FileInfo$8): boolean | Promise<boolean>;
1400
+ /** Return toolbar actions for the rendered instance */
1401
+ getToolbarActions(instance: PreviewInstance$8): ToolbarAction$8[];
1402
+ /** Render the file into the container */
1403
+ render(ctx: RenderContext$8): Promise<PreviewInstance$8>;
1404
+ }
1405
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
1406
+ interface ToolbarConfig$8 {
1407
+ /** Page navigation (< [1] / N >) */
1408
+ pageNav?: boolean;
1409
+ pagination?: boolean;
1410
+ prevPage?: boolean;
1411
+ nextPage?: boolean;
1412
+ /** Zoom controls */
1413
+ zoomIn?: boolean;
1414
+ zoomOut?: boolean;
1415
+ fitPage?: boolean;
1416
+ fitToPage?: boolean;
1417
+ fitWidth?: boolean;
1418
+ zoomReset?: boolean;
1419
+ /** View controls */
1420
+ rotate?: boolean;
1421
+ rotateCW?: boolean;
1422
+ rotateCCW?: boolean;
1423
+ fullscreen?: boolean;
1424
+ thumbnails?: boolean;
1425
+ /** Action controls */
1426
+ download?: boolean;
1427
+ print?: boolean;
1428
+ openWindow?: boolean;
1429
+ openSeparateWindow?: boolean;
1430
+ copy?: boolean;
1431
+ /** Media controls */
1432
+ play?: boolean;
1433
+ pause?: boolean;
1434
+ fastForward?: boolean;
1435
+ rewind?: boolean;
1436
+ speed?: boolean;
1437
+ }
1438
+ /** Viewer configuration options */
1439
+ interface PreviewViewerOptions$8 extends ToolbarConfig$8 {
1440
+ /** Color theme */
1441
+ theme?: 'light' | 'dark' | 'auto';
1442
+ /** Locale for UI labels */
1443
+ locale?: string;
1444
+ /** Initial zoom level (1.0 = 100%) */
1445
+ zoom?: number;
1446
+ /** Initial page number (1-based) */
1447
+ page?: number;
1448
+ /** Show the toolbar */
1449
+ showToolbar?: boolean;
1450
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
1451
+ toolbar?: boolean | (ToolbarConfig$8 & Record<string, boolean | undefined>);
1452
+ /** Toolbar position */
1453
+ toolbarPosition?: 'top' | 'bottom';
1454
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
1455
+ fitMode?: 'page' | 'width';
1456
+ /** Show thumbnail sidebar initially */
1457
+ showThumbnails?: boolean;
1458
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
1459
+ showFileName?: boolean;
1460
+ /** Custom file name / title override to display */
1461
+ fileName?: string;
1462
+ /** Custom CSS class for the container */
1463
+ className?: string;
1464
+ /** Plugin-specific options */
1465
+ pluginOptions?: Record<string, unknown>;
1466
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
1467
+ metadata?: FileMetadata$8;
1468
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
1469
+ standaloneViewerUrl?: string;
1470
+ /** Custom handler for opening preview in a separate window */
1471
+ onOpenSeparateWindow?: (payload: {
1472
+ buffer: ArrayBuffer;
1473
+ metadata: FileMetadata$8;
1474
+ options: PreviewViewerOptions$8;
1475
+ }) => Window | null;
1476
+ /** Internal flag: true when viewer is rendered inside separate full window */
1477
+ _isSeparateWindow?: boolean;
1478
+ /** Allow custom/plugin-specific options */
1479
+ [key: string]: unknown;
1480
+ }
1481
+
1482
+ declare class ArchivePlugin implements PreviewPlugin$8 {
1483
+ id: string;
1484
+ name: string;
1485
+ extensions: string[];
1486
+ mimeTypes: string[];
1487
+ weight: number;
1488
+ supports(file: FileInfo$8): boolean;
1489
+ getToolbarActions(instance: PreviewInstance$8): ToolbarAction$8[];
1490
+ render(ctx: RenderContext$8): Promise<PreviewInstance$8>;
1491
+ }
1492
+ declare function archivePlugin(): ArchivePlugin;
1493
+
1494
+ /**
1495
+ * Supported file input sources.
1496
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
1497
+ */
1498
+ type FileSource$7 = string | File | Blob | ArrayBuffer | Uint8Array;
1499
+ /** Metadata extracted from a file source */
1500
+ interface FileMetadata$7 {
1501
+ /** Original filename (if available) */
1502
+ name?: string;
1503
+ /** File size in bytes */
1504
+ size?: number;
1505
+ /** Detected MIME type */
1506
+ mimeType?: string;
1507
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
1508
+ extension?: string;
1509
+ }
1510
+ /** Information about a resolved file, ready for plugin matching */
1511
+ interface FileInfo$7 {
1512
+ metadata: FileMetadata$7;
1513
+ buffer: ArrayBuffer;
1514
+ }
1515
+ /** Toolbar action types */
1516
+ type ToolbarActionType$7 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
1517
+ /** Toolbar action group names for visual grouping */
1518
+ type ToolbarGroup$7 = 'navigation' | 'zoom' | 'view' | 'actions';
1519
+ /** Represents a single toolbar action/control */
1520
+ interface ToolbarAction$7 {
1521
+ /** Unique action identifier */
1522
+ id: string;
1523
+ /** SVG icon markup string */
1524
+ icon: string;
1525
+ /** Accessible label */
1526
+ label: string;
1527
+ /** Type of control to render */
1528
+ type: ToolbarActionType$7;
1529
+ /** Visual group placement */
1530
+ group: ToolbarGroup$7;
1531
+ /** Whether the action is currently enabled */
1532
+ enabled?: boolean;
1533
+ /** Whether a toggle is currently active */
1534
+ active?: boolean;
1535
+ /** Execute the action */
1536
+ execute: (...args: unknown[]) => void;
1537
+ /** For 'range' type: min/max/step/value */
1538
+ min?: number;
1539
+ max?: number;
1540
+ step?: number;
1541
+ value?: number;
1542
+ }
1543
+ /** Represents a thumbnail in the sidebar */
1544
+ interface Thumbnail$7 {
1545
+ /** Page/sheet/frame index */
1546
+ index: number;
1547
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
1548
+ label: string;
1549
+ /** Renders the thumbnail into a canvas element */
1550
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
1551
+ }
1552
+ /** Instance returned after a file is rendered — exposes controls */
1553
+ interface PreviewInstance$7 {
1554
+ /** Clean up all resources */
1555
+ destroy(): void;
1556
+ zoomIn?(): void;
1557
+ zoomOut?(): void;
1558
+ getZoom?(): number;
1559
+ setZoom?(level: number): void;
1560
+ fitToPage?(): void;
1561
+ fitToWidth?(): void;
1562
+ goToPage?(page: number): void;
1563
+ getPageCount?(): number;
1564
+ getCurrentPage?(): number;
1565
+ rotateCW?(): void;
1566
+ rotateCCW?(): void;
1567
+ getRotation?(): number;
1568
+ play?(): void;
1569
+ pause?(): void;
1570
+ isPlaying?(): boolean;
1571
+ fastForward?(seconds?: number): void;
1572
+ rewind?(seconds?: number): void;
1573
+ setPlaybackRate?(rate: number): void;
1574
+ getPlaybackRate?(): number;
1575
+ getThumbnails?(): Thumbnail$7[] | Promise<Thumbnail$7[]>;
1576
+ toggleThumbnails?(): void;
1577
+ download?(): void;
1578
+ print?(): void;
1579
+ [key: string]: unknown;
1580
+ }
1581
+ /** Context passed to a plugin's render function */
1582
+ interface RenderContext$7 {
1583
+ /** The container DOM element to render into */
1584
+ container: HTMLElement;
1585
+ /** Original file source */
1586
+ source: FileSource$7;
1587
+ /** Resolved file metadata */
1588
+ metadata: FileMetadata$7;
1589
+ /** File content as ArrayBuffer */
1590
+ buffer: ArrayBuffer;
1591
+ /** Viewer options */
1592
+ options: PreviewViewerOptions$7;
1593
+ /** AbortSignal for cancellation */
1594
+ signal: AbortSignal;
1595
+ /** Emit an event to the viewer */
1596
+ emit: (event: string, payload?: unknown) => void;
1597
+ }
1598
+ /** Plugin interface — each file format renderer implements this */
1599
+ interface PreviewPlugin$7 {
1600
+ /** Unique plugin identifier */
1601
+ id: string;
1602
+ /** Human-readable plugin name */
1603
+ name: string;
1604
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
1605
+ extensions: string[];
1606
+ /** MIME types this plugin handles */
1607
+ mimeTypes: string[];
1608
+ /** Priority when multiple plugins match (higher = preferred) */
1609
+ weight?: number;
1610
+ /** Check if this plugin can handle the given file */
1611
+ supports(file: FileInfo$7): boolean | Promise<boolean>;
1612
+ /** Return toolbar actions for the rendered instance */
1613
+ getToolbarActions(instance: PreviewInstance$7): ToolbarAction$7[];
1614
+ /** Render the file into the container */
1615
+ render(ctx: RenderContext$7): Promise<PreviewInstance$7>;
1616
+ }
1617
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
1618
+ interface ToolbarConfig$7 {
1619
+ /** Page navigation (< [1] / N >) */
1620
+ pageNav?: boolean;
1621
+ pagination?: boolean;
1622
+ prevPage?: boolean;
1623
+ nextPage?: boolean;
1624
+ /** Zoom controls */
1625
+ zoomIn?: boolean;
1626
+ zoomOut?: boolean;
1627
+ fitPage?: boolean;
1628
+ fitToPage?: boolean;
1629
+ fitWidth?: boolean;
1630
+ zoomReset?: boolean;
1631
+ /** View controls */
1632
+ rotate?: boolean;
1633
+ rotateCW?: boolean;
1634
+ rotateCCW?: boolean;
1635
+ fullscreen?: boolean;
1636
+ thumbnails?: boolean;
1637
+ /** Action controls */
1638
+ download?: boolean;
1639
+ print?: boolean;
1640
+ openWindow?: boolean;
1641
+ openSeparateWindow?: boolean;
1642
+ copy?: boolean;
1643
+ /** Media controls */
1644
+ play?: boolean;
1645
+ pause?: boolean;
1646
+ fastForward?: boolean;
1647
+ rewind?: boolean;
1648
+ speed?: boolean;
1649
+ }
1650
+ /** Viewer configuration options */
1651
+ interface PreviewViewerOptions$7 extends ToolbarConfig$7 {
1652
+ /** Color theme */
1653
+ theme?: 'light' | 'dark' | 'auto';
1654
+ /** Locale for UI labels */
1655
+ locale?: string;
1656
+ /** Initial zoom level (1.0 = 100%) */
1657
+ zoom?: number;
1658
+ /** Initial page number (1-based) */
1659
+ page?: number;
1660
+ /** Show the toolbar */
1661
+ showToolbar?: boolean;
1662
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
1663
+ toolbar?: boolean | (ToolbarConfig$7 & Record<string, boolean | undefined>);
1664
+ /** Toolbar position */
1665
+ toolbarPosition?: 'top' | 'bottom';
1666
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
1667
+ fitMode?: 'page' | 'width';
1668
+ /** Show thumbnail sidebar initially */
1669
+ showThumbnails?: boolean;
1670
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
1671
+ showFileName?: boolean;
1672
+ /** Custom file name / title override to display */
1673
+ fileName?: string;
1674
+ /** Custom CSS class for the container */
1675
+ className?: string;
1676
+ /** Plugin-specific options */
1677
+ pluginOptions?: Record<string, unknown>;
1678
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
1679
+ metadata?: FileMetadata$7;
1680
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
1681
+ standaloneViewerUrl?: string;
1682
+ /** Custom handler for opening preview in a separate window */
1683
+ onOpenSeparateWindow?: (payload: {
1684
+ buffer: ArrayBuffer;
1685
+ metadata: FileMetadata$7;
1686
+ options: PreviewViewerOptions$7;
1687
+ }) => Window | null;
1688
+ /** Internal flag: true when viewer is rendered inside separate full window */
1689
+ _isSeparateWindow?: boolean;
1690
+ /** Allow custom/plugin-specific options */
1691
+ [key: string]: unknown;
1692
+ }
1693
+
1694
+ declare class MarkdownPlugin implements PreviewPlugin$7 {
1695
+ id: string;
1696
+ name: string;
1697
+ extensions: string[];
1698
+ mimeTypes: string[];
1699
+ weight: number;
1700
+ supports(file: FileInfo$7): boolean;
1701
+ getToolbarActions(instance: PreviewInstance$7): ToolbarAction$7[];
1702
+ render(ctx: RenderContext$7): Promise<PreviewInstance$7>;
1703
+ }
1704
+ declare function markdownPlugin(): MarkdownPlugin;
1705
+
1706
+ /**
1707
+ * Supported file input sources.
1708
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
1709
+ */
1710
+ type FileSource$6 = string | File | Blob | ArrayBuffer | Uint8Array;
1711
+ /** Metadata extracted from a file source */
1712
+ interface FileMetadata$6 {
1713
+ /** Original filename (if available) */
1714
+ name?: string;
1715
+ /** File size in bytes */
1716
+ size?: number;
1717
+ /** Detected MIME type */
1718
+ mimeType?: string;
1719
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
1720
+ extension?: string;
1721
+ }
1722
+ /** Information about a resolved file, ready for plugin matching */
1723
+ interface FileInfo$6 {
1724
+ metadata: FileMetadata$6;
1725
+ buffer: ArrayBuffer;
1726
+ }
1727
+ /** Toolbar action types */
1728
+ type ToolbarActionType$6 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
1729
+ /** Toolbar action group names for visual grouping */
1730
+ type ToolbarGroup$6 = 'navigation' | 'zoom' | 'view' | 'actions';
1731
+ /** Represents a single toolbar action/control */
1732
+ interface ToolbarAction$6 {
1733
+ /** Unique action identifier */
1734
+ id: string;
1735
+ /** SVG icon markup string */
1736
+ icon: string;
1737
+ /** Accessible label */
1738
+ label: string;
1739
+ /** Type of control to render */
1740
+ type: ToolbarActionType$6;
1741
+ /** Visual group placement */
1742
+ group: ToolbarGroup$6;
1743
+ /** Whether the action is currently enabled */
1744
+ enabled?: boolean;
1745
+ /** Whether a toggle is currently active */
1746
+ active?: boolean;
1747
+ /** Execute the action */
1748
+ execute: (...args: unknown[]) => void;
1749
+ /** For 'range' type: min/max/step/value */
1750
+ min?: number;
1751
+ max?: number;
1752
+ step?: number;
1753
+ value?: number;
1754
+ }
1755
+ /** Represents a thumbnail in the sidebar */
1756
+ interface Thumbnail$6 {
1757
+ /** Page/sheet/frame index */
1758
+ index: number;
1759
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
1760
+ label: string;
1761
+ /** Renders the thumbnail into a canvas element */
1762
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
1763
+ }
1764
+ /** Instance returned after a file is rendered — exposes controls */
1765
+ interface PreviewInstance$6 {
1766
+ /** Clean up all resources */
1767
+ destroy(): void;
1768
+ zoomIn?(): void;
1769
+ zoomOut?(): void;
1770
+ getZoom?(): number;
1771
+ setZoom?(level: number): void;
1772
+ fitToPage?(): void;
1773
+ fitToWidth?(): void;
1774
+ goToPage?(page: number): void;
1775
+ getPageCount?(): number;
1776
+ getCurrentPage?(): number;
1777
+ rotateCW?(): void;
1778
+ rotateCCW?(): void;
1779
+ getRotation?(): number;
1780
+ play?(): void;
1781
+ pause?(): void;
1782
+ isPlaying?(): boolean;
1783
+ fastForward?(seconds?: number): void;
1784
+ rewind?(seconds?: number): void;
1785
+ setPlaybackRate?(rate: number): void;
1786
+ getPlaybackRate?(): number;
1787
+ getThumbnails?(): Thumbnail$6[] | Promise<Thumbnail$6[]>;
1788
+ toggleThumbnails?(): void;
1789
+ download?(): void;
1790
+ print?(): void;
1791
+ [key: string]: unknown;
1792
+ }
1793
+ /** Context passed to a plugin's render function */
1794
+ interface RenderContext$6 {
1795
+ /** The container DOM element to render into */
1796
+ container: HTMLElement;
1797
+ /** Original file source */
1798
+ source: FileSource$6;
1799
+ /** Resolved file metadata */
1800
+ metadata: FileMetadata$6;
1801
+ /** File content as ArrayBuffer */
1802
+ buffer: ArrayBuffer;
1803
+ /** Viewer options */
1804
+ options: PreviewViewerOptions$6;
1805
+ /** AbortSignal for cancellation */
1806
+ signal: AbortSignal;
1807
+ /** Emit an event to the viewer */
1808
+ emit: (event: string, payload?: unknown) => void;
1809
+ }
1810
+ /** Plugin interface — each file format renderer implements this */
1811
+ interface PreviewPlugin$6 {
1812
+ /** Unique plugin identifier */
1813
+ id: string;
1814
+ /** Human-readable plugin name */
1815
+ name: string;
1816
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
1817
+ extensions: string[];
1818
+ /** MIME types this plugin handles */
1819
+ mimeTypes: string[];
1820
+ /** Priority when multiple plugins match (higher = preferred) */
1821
+ weight?: number;
1822
+ /** Check if this plugin can handle the given file */
1823
+ supports(file: FileInfo$6): boolean | Promise<boolean>;
1824
+ /** Return toolbar actions for the rendered instance */
1825
+ getToolbarActions(instance: PreviewInstance$6): ToolbarAction$6[];
1826
+ /** Render the file into the container */
1827
+ render(ctx: RenderContext$6): Promise<PreviewInstance$6>;
1828
+ }
1829
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
1830
+ interface ToolbarConfig$6 {
1831
+ /** Page navigation (< [1] / N >) */
1832
+ pageNav?: boolean;
1833
+ pagination?: boolean;
1834
+ prevPage?: boolean;
1835
+ nextPage?: boolean;
1836
+ /** Zoom controls */
1837
+ zoomIn?: boolean;
1838
+ zoomOut?: boolean;
1839
+ fitPage?: boolean;
1840
+ fitToPage?: boolean;
1841
+ fitWidth?: boolean;
1842
+ zoomReset?: boolean;
1843
+ /** View controls */
1844
+ rotate?: boolean;
1845
+ rotateCW?: boolean;
1846
+ rotateCCW?: boolean;
1847
+ fullscreen?: boolean;
1848
+ thumbnails?: boolean;
1849
+ /** Action controls */
1850
+ download?: boolean;
1851
+ print?: boolean;
1852
+ openWindow?: boolean;
1853
+ openSeparateWindow?: boolean;
1854
+ copy?: boolean;
1855
+ /** Media controls */
1856
+ play?: boolean;
1857
+ pause?: boolean;
1858
+ fastForward?: boolean;
1859
+ rewind?: boolean;
1860
+ speed?: boolean;
1861
+ }
1862
+ /** Viewer configuration options */
1863
+ interface PreviewViewerOptions$6 extends ToolbarConfig$6 {
1864
+ /** Color theme */
1865
+ theme?: 'light' | 'dark' | 'auto';
1866
+ /** Locale for UI labels */
1867
+ locale?: string;
1868
+ /** Initial zoom level (1.0 = 100%) */
1869
+ zoom?: number;
1870
+ /** Initial page number (1-based) */
1871
+ page?: number;
1872
+ /** Show the toolbar */
1873
+ showToolbar?: boolean;
1874
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
1875
+ toolbar?: boolean | (ToolbarConfig$6 & Record<string, boolean | undefined>);
1876
+ /** Toolbar position */
1877
+ toolbarPosition?: 'top' | 'bottom';
1878
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
1879
+ fitMode?: 'page' | 'width';
1880
+ /** Show thumbnail sidebar initially */
1881
+ showThumbnails?: boolean;
1882
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
1883
+ showFileName?: boolean;
1884
+ /** Custom file name / title override to display */
1885
+ fileName?: string;
1886
+ /** Custom CSS class for the container */
1887
+ className?: string;
1888
+ /** Plugin-specific options */
1889
+ pluginOptions?: Record<string, unknown>;
1890
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
1891
+ metadata?: FileMetadata$6;
1892
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
1893
+ standaloneViewerUrl?: string;
1894
+ /** Custom handler for opening preview in a separate window */
1895
+ onOpenSeparateWindow?: (payload: {
1896
+ buffer: ArrayBuffer;
1897
+ metadata: FileMetadata$6;
1898
+ options: PreviewViewerOptions$6;
1899
+ }) => Window | null;
1900
+ /** Internal flag: true when viewer is rendered inside separate full window */
1901
+ _isSeparateWindow?: boolean;
1902
+ /** Allow custom/plugin-specific options */
1903
+ [key: string]: unknown;
1904
+ }
1905
+
1906
+ declare class PptxPlugin implements PreviewPlugin$6 {
1907
+ id: string;
1908
+ name: string;
1909
+ extensions: string[];
1910
+ mimeTypes: string[];
1911
+ weight: number;
1912
+ supports(file: FileInfo$6): boolean;
1913
+ getToolbarActions(instance: PreviewInstance$6): ToolbarAction$6[];
1914
+ render(ctx: RenderContext$6): Promise<PreviewInstance$6>;
1915
+ }
1916
+ declare function pptxPlugin(): PptxPlugin;
1917
+
1918
+ /**
1919
+ * Supported file input sources.
1920
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
1921
+ */
1922
+ type FileSource$5 = string | File | Blob | ArrayBuffer | Uint8Array;
1923
+ /** Metadata extracted from a file source */
1924
+ interface FileMetadata$5 {
1925
+ /** Original filename (if available) */
1926
+ name?: string;
1927
+ /** File size in bytes */
1928
+ size?: number;
1929
+ /** Detected MIME type */
1930
+ mimeType?: string;
1931
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
1932
+ extension?: string;
1933
+ }
1934
+ /** Information about a resolved file, ready for plugin matching */
1935
+ interface FileInfo$5 {
1936
+ metadata: FileMetadata$5;
1937
+ buffer: ArrayBuffer;
1938
+ }
1939
+ /** Toolbar action types */
1940
+ type ToolbarActionType$5 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
1941
+ /** Toolbar action group names for visual grouping */
1942
+ type ToolbarGroup$5 = 'navigation' | 'zoom' | 'view' | 'actions';
1943
+ /** Represents a single toolbar action/control */
1944
+ interface ToolbarAction$5 {
1945
+ /** Unique action identifier */
1946
+ id: string;
1947
+ /** SVG icon markup string */
1948
+ icon: string;
1949
+ /** Accessible label */
1950
+ label: string;
1951
+ /** Type of control to render */
1952
+ type: ToolbarActionType$5;
1953
+ /** Visual group placement */
1954
+ group: ToolbarGroup$5;
1955
+ /** Whether the action is currently enabled */
1956
+ enabled?: boolean;
1957
+ /** Whether a toggle is currently active */
1958
+ active?: boolean;
1959
+ /** Execute the action */
1960
+ execute: (...args: unknown[]) => void;
1961
+ /** For 'range' type: min/max/step/value */
1962
+ min?: number;
1963
+ max?: number;
1964
+ step?: number;
1965
+ value?: number;
1966
+ }
1967
+ /** Represents a thumbnail in the sidebar */
1968
+ interface Thumbnail$5 {
1969
+ /** Page/sheet/frame index */
1970
+ index: number;
1971
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
1972
+ label: string;
1973
+ /** Renders the thumbnail into a canvas element */
1974
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
1975
+ }
1976
+ /** Instance returned after a file is rendered — exposes controls */
1977
+ interface PreviewInstance$5 {
1978
+ /** Clean up all resources */
1979
+ destroy(): void;
1980
+ zoomIn?(): void;
1981
+ zoomOut?(): void;
1982
+ getZoom?(): number;
1983
+ setZoom?(level: number): void;
1984
+ fitToPage?(): void;
1985
+ fitToWidth?(): void;
1986
+ goToPage?(page: number): void;
1987
+ getPageCount?(): number;
1988
+ getCurrentPage?(): number;
1989
+ rotateCW?(): void;
1990
+ rotateCCW?(): void;
1991
+ getRotation?(): number;
1992
+ play?(): void;
1993
+ pause?(): void;
1994
+ isPlaying?(): boolean;
1995
+ fastForward?(seconds?: number): void;
1996
+ rewind?(seconds?: number): void;
1997
+ setPlaybackRate?(rate: number): void;
1998
+ getPlaybackRate?(): number;
1999
+ getThumbnails?(): Thumbnail$5[] | Promise<Thumbnail$5[]>;
2000
+ toggleThumbnails?(): void;
2001
+ download?(): void;
2002
+ print?(): void;
2003
+ [key: string]: unknown;
2004
+ }
2005
+ /** Context passed to a plugin's render function */
2006
+ interface RenderContext$5 {
2007
+ /** The container DOM element to render into */
2008
+ container: HTMLElement;
2009
+ /** Original file source */
2010
+ source: FileSource$5;
2011
+ /** Resolved file metadata */
2012
+ metadata: FileMetadata$5;
2013
+ /** File content as ArrayBuffer */
2014
+ buffer: ArrayBuffer;
2015
+ /** Viewer options */
2016
+ options: PreviewViewerOptions$5;
2017
+ /** AbortSignal for cancellation */
2018
+ signal: AbortSignal;
2019
+ /** Emit an event to the viewer */
2020
+ emit: (event: string, payload?: unknown) => void;
2021
+ }
2022
+ /** Plugin interface — each file format renderer implements this */
2023
+ interface PreviewPlugin$5 {
2024
+ /** Unique plugin identifier */
2025
+ id: string;
2026
+ /** Human-readable plugin name */
2027
+ name: string;
2028
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
2029
+ extensions: string[];
2030
+ /** MIME types this plugin handles */
2031
+ mimeTypes: string[];
2032
+ /** Priority when multiple plugins match (higher = preferred) */
2033
+ weight?: number;
2034
+ /** Check if this plugin can handle the given file */
2035
+ supports(file: FileInfo$5): boolean | Promise<boolean>;
2036
+ /** Return toolbar actions for the rendered instance */
2037
+ getToolbarActions(instance: PreviewInstance$5): ToolbarAction$5[];
2038
+ /** Render the file into the container */
2039
+ render(ctx: RenderContext$5): Promise<PreviewInstance$5>;
2040
+ }
2041
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
2042
+ interface ToolbarConfig$5 {
2043
+ /** Page navigation (< [1] / N >) */
2044
+ pageNav?: boolean;
2045
+ pagination?: boolean;
2046
+ prevPage?: boolean;
2047
+ nextPage?: boolean;
2048
+ /** Zoom controls */
2049
+ zoomIn?: boolean;
2050
+ zoomOut?: boolean;
2051
+ fitPage?: boolean;
2052
+ fitToPage?: boolean;
2053
+ fitWidth?: boolean;
2054
+ zoomReset?: boolean;
2055
+ /** View controls */
2056
+ rotate?: boolean;
2057
+ rotateCW?: boolean;
2058
+ rotateCCW?: boolean;
2059
+ fullscreen?: boolean;
2060
+ thumbnails?: boolean;
2061
+ /** Action controls */
2062
+ download?: boolean;
2063
+ print?: boolean;
2064
+ openWindow?: boolean;
2065
+ openSeparateWindow?: boolean;
2066
+ copy?: boolean;
2067
+ /** Media controls */
2068
+ play?: boolean;
2069
+ pause?: boolean;
2070
+ fastForward?: boolean;
2071
+ rewind?: boolean;
2072
+ speed?: boolean;
2073
+ }
2074
+ /** Viewer configuration options */
2075
+ interface PreviewViewerOptions$5 extends ToolbarConfig$5 {
2076
+ /** Color theme */
2077
+ theme?: 'light' | 'dark' | 'auto';
2078
+ /** Locale for UI labels */
2079
+ locale?: string;
2080
+ /** Initial zoom level (1.0 = 100%) */
2081
+ zoom?: number;
2082
+ /** Initial page number (1-based) */
2083
+ page?: number;
2084
+ /** Show the toolbar */
2085
+ showToolbar?: boolean;
2086
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
2087
+ toolbar?: boolean | (ToolbarConfig$5 & Record<string, boolean | undefined>);
2088
+ /** Toolbar position */
2089
+ toolbarPosition?: 'top' | 'bottom';
2090
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
2091
+ fitMode?: 'page' | 'width';
2092
+ /** Show thumbnail sidebar initially */
2093
+ showThumbnails?: boolean;
2094
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
2095
+ showFileName?: boolean;
2096
+ /** Custom file name / title override to display */
2097
+ fileName?: string;
2098
+ /** Custom CSS class for the container */
2099
+ className?: string;
2100
+ /** Plugin-specific options */
2101
+ pluginOptions?: Record<string, unknown>;
2102
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
2103
+ metadata?: FileMetadata$5;
2104
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
2105
+ standaloneViewerUrl?: string;
2106
+ /** Custom handler for opening preview in a separate window */
2107
+ onOpenSeparateWindow?: (payload: {
2108
+ buffer: ArrayBuffer;
2109
+ metadata: FileMetadata$5;
2110
+ options: PreviewViewerOptions$5;
2111
+ }) => Window | null;
2112
+ /** Internal flag: true when viewer is rendered inside separate full window */
2113
+ _isSeparateWindow?: boolean;
2114
+ /** Allow custom/plugin-specific options */
2115
+ [key: string]: unknown;
2116
+ }
2117
+
2118
+ declare class ThreeDPlugin implements PreviewPlugin$5 {
2119
+ id: string;
2120
+ name: string;
2121
+ extensions: string[];
2122
+ mimeTypes: string[];
2123
+ weight: number;
2124
+ supports(file: FileInfo$5): boolean;
2125
+ getToolbarActions(instance: PreviewInstance$5): ToolbarAction$5[];
2126
+ render(ctx: RenderContext$5): Promise<PreviewInstance$5>;
2127
+ }
2128
+ declare function threeDPlugin(): ThreeDPlugin;
2129
+
2130
+ /**
2131
+ * Supported file input sources.
2132
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
2133
+ */
2134
+ type FileSource$4 = string | File | Blob | ArrayBuffer | Uint8Array;
2135
+ /** Metadata extracted from a file source */
2136
+ interface FileMetadata$4 {
2137
+ /** Original filename (if available) */
2138
+ name?: string;
2139
+ /** File size in bytes */
2140
+ size?: number;
2141
+ /** Detected MIME type */
2142
+ mimeType?: string;
2143
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
2144
+ extension?: string;
2145
+ }
2146
+ /** Information about a resolved file, ready for plugin matching */
2147
+ interface FileInfo$4 {
2148
+ metadata: FileMetadata$4;
2149
+ buffer: ArrayBuffer;
2150
+ }
2151
+ /** Toolbar action types */
2152
+ type ToolbarActionType$4 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
2153
+ /** Toolbar action group names for visual grouping */
2154
+ type ToolbarGroup$4 = 'navigation' | 'zoom' | 'view' | 'actions';
2155
+ /** Represents a single toolbar action/control */
2156
+ interface ToolbarAction$4 {
2157
+ /** Unique action identifier */
2158
+ id: string;
2159
+ /** SVG icon markup string */
2160
+ icon: string;
2161
+ /** Accessible label */
2162
+ label: string;
2163
+ /** Type of control to render */
2164
+ type: ToolbarActionType$4;
2165
+ /** Visual group placement */
2166
+ group: ToolbarGroup$4;
2167
+ /** Whether the action is currently enabled */
2168
+ enabled?: boolean;
2169
+ /** Whether a toggle is currently active */
2170
+ active?: boolean;
2171
+ /** Execute the action */
2172
+ execute: (...args: unknown[]) => void;
2173
+ /** For 'range' type: min/max/step/value */
2174
+ min?: number;
2175
+ max?: number;
2176
+ step?: number;
2177
+ value?: number;
2178
+ }
2179
+ /** Represents a thumbnail in the sidebar */
2180
+ interface Thumbnail$4 {
2181
+ /** Page/sheet/frame index */
2182
+ index: number;
2183
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
2184
+ label: string;
2185
+ /** Renders the thumbnail into a canvas element */
2186
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
2187
+ }
2188
+ /** Instance returned after a file is rendered — exposes controls */
2189
+ interface PreviewInstance$4 {
2190
+ /** Clean up all resources */
2191
+ destroy(): void;
2192
+ zoomIn?(): void;
2193
+ zoomOut?(): void;
2194
+ getZoom?(): number;
2195
+ setZoom?(level: number): void;
2196
+ fitToPage?(): void;
2197
+ fitToWidth?(): void;
2198
+ goToPage?(page: number): void;
2199
+ getPageCount?(): number;
2200
+ getCurrentPage?(): number;
2201
+ rotateCW?(): void;
2202
+ rotateCCW?(): void;
2203
+ getRotation?(): number;
2204
+ play?(): void;
2205
+ pause?(): void;
2206
+ isPlaying?(): boolean;
2207
+ fastForward?(seconds?: number): void;
2208
+ rewind?(seconds?: number): void;
2209
+ setPlaybackRate?(rate: number): void;
2210
+ getPlaybackRate?(): number;
2211
+ getThumbnails?(): Thumbnail$4[] | Promise<Thumbnail$4[]>;
2212
+ toggleThumbnails?(): void;
2213
+ download?(): void;
2214
+ print?(): void;
2215
+ [key: string]: unknown;
2216
+ }
2217
+ /** Context passed to a plugin's render function */
2218
+ interface RenderContext$4 {
2219
+ /** The container DOM element to render into */
2220
+ container: HTMLElement;
2221
+ /** Original file source */
2222
+ source: FileSource$4;
2223
+ /** Resolved file metadata */
2224
+ metadata: FileMetadata$4;
2225
+ /** File content as ArrayBuffer */
2226
+ buffer: ArrayBuffer;
2227
+ /** Viewer options */
2228
+ options: PreviewViewerOptions$4;
2229
+ /** AbortSignal for cancellation */
2230
+ signal: AbortSignal;
2231
+ /** Emit an event to the viewer */
2232
+ emit: (event: string, payload?: unknown) => void;
2233
+ }
2234
+ /** Plugin interface — each file format renderer implements this */
2235
+ interface PreviewPlugin$4 {
2236
+ /** Unique plugin identifier */
2237
+ id: string;
2238
+ /** Human-readable plugin name */
2239
+ name: string;
2240
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
2241
+ extensions: string[];
2242
+ /** MIME types this plugin handles */
2243
+ mimeTypes: string[];
2244
+ /** Priority when multiple plugins match (higher = preferred) */
2245
+ weight?: number;
2246
+ /** Check if this plugin can handle the given file */
2247
+ supports(file: FileInfo$4): boolean | Promise<boolean>;
2248
+ /** Return toolbar actions for the rendered instance */
2249
+ getToolbarActions(instance: PreviewInstance$4): ToolbarAction$4[];
2250
+ /** Render the file into the container */
2251
+ render(ctx: RenderContext$4): Promise<PreviewInstance$4>;
2252
+ }
2253
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
2254
+ interface ToolbarConfig$4 {
2255
+ /** Page navigation (< [1] / N >) */
2256
+ pageNav?: boolean;
2257
+ pagination?: boolean;
2258
+ prevPage?: boolean;
2259
+ nextPage?: boolean;
2260
+ /** Zoom controls */
2261
+ zoomIn?: boolean;
2262
+ zoomOut?: boolean;
2263
+ fitPage?: boolean;
2264
+ fitToPage?: boolean;
2265
+ fitWidth?: boolean;
2266
+ zoomReset?: boolean;
2267
+ /** View controls */
2268
+ rotate?: boolean;
2269
+ rotateCW?: boolean;
2270
+ rotateCCW?: boolean;
2271
+ fullscreen?: boolean;
2272
+ thumbnails?: boolean;
2273
+ /** Action controls */
2274
+ download?: boolean;
2275
+ print?: boolean;
2276
+ openWindow?: boolean;
2277
+ openSeparateWindow?: boolean;
2278
+ copy?: boolean;
2279
+ /** Media controls */
2280
+ play?: boolean;
2281
+ pause?: boolean;
2282
+ fastForward?: boolean;
2283
+ rewind?: boolean;
2284
+ speed?: boolean;
2285
+ }
2286
+ /** Viewer configuration options */
2287
+ interface PreviewViewerOptions$4 extends ToolbarConfig$4 {
2288
+ /** Color theme */
2289
+ theme?: 'light' | 'dark' | 'auto';
2290
+ /** Locale for UI labels */
2291
+ locale?: string;
2292
+ /** Initial zoom level (1.0 = 100%) */
2293
+ zoom?: number;
2294
+ /** Initial page number (1-based) */
2295
+ page?: number;
2296
+ /** Show the toolbar */
2297
+ showToolbar?: boolean;
2298
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
2299
+ toolbar?: boolean | (ToolbarConfig$4 & Record<string, boolean | undefined>);
2300
+ /** Toolbar position */
2301
+ toolbarPosition?: 'top' | 'bottom';
2302
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
2303
+ fitMode?: 'page' | 'width';
2304
+ /** Show thumbnail sidebar initially */
2305
+ showThumbnails?: boolean;
2306
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
2307
+ showFileName?: boolean;
2308
+ /** Custom file name / title override to display */
2309
+ fileName?: string;
2310
+ /** Custom CSS class for the container */
2311
+ className?: string;
2312
+ /** Plugin-specific options */
2313
+ pluginOptions?: Record<string, unknown>;
2314
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
2315
+ metadata?: FileMetadata$4;
2316
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
2317
+ standaloneViewerUrl?: string;
2318
+ /** Custom handler for opening preview in a separate window */
2319
+ onOpenSeparateWindow?: (payload: {
2320
+ buffer: ArrayBuffer;
2321
+ metadata: FileMetadata$4;
2322
+ options: PreviewViewerOptions$4;
2323
+ }) => Window | null;
2324
+ /** Internal flag: true when viewer is rendered inside separate full window */
2325
+ _isSeparateWindow?: boolean;
2326
+ /** Allow custom/plugin-specific options */
2327
+ [key: string]: unknown;
2328
+ }
2329
+
2330
+ declare class RtfPlugin implements PreviewPlugin$4 {
2331
+ id: string;
2332
+ name: string;
2333
+ extensions: string[];
2334
+ mimeTypes: string[];
2335
+ weight: number;
2336
+ supports(file: FileInfo$4): boolean;
2337
+ getToolbarActions(instance: PreviewInstance$4): ToolbarAction$4[];
2338
+ render(ctx: RenderContext$4): Promise<PreviewInstance$4>;
2339
+ }
2340
+ declare function rtfPlugin(): RtfPlugin;
2341
+
2342
+ /**
2343
+ * Supported file input sources.
2344
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
2345
+ */
2346
+ type FileSource$3 = string | File | Blob | ArrayBuffer | Uint8Array;
2347
+ /** Metadata extracted from a file source */
2348
+ interface FileMetadata$3 {
2349
+ /** Original filename (if available) */
2350
+ name?: string;
2351
+ /** File size in bytes */
2352
+ size?: number;
2353
+ /** Detected MIME type */
2354
+ mimeType?: string;
2355
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
2356
+ extension?: string;
2357
+ }
2358
+ /** Information about a resolved file, ready for plugin matching */
2359
+ interface FileInfo$3 {
2360
+ metadata: FileMetadata$3;
2361
+ buffer: ArrayBuffer;
2362
+ }
2363
+ /** Toolbar action types */
2364
+ type ToolbarActionType$3 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
2365
+ /** Toolbar action group names for visual grouping */
2366
+ type ToolbarGroup$3 = 'navigation' | 'zoom' | 'view' | 'actions';
2367
+ /** Represents a single toolbar action/control */
2368
+ interface ToolbarAction$3 {
2369
+ /** Unique action identifier */
2370
+ id: string;
2371
+ /** SVG icon markup string */
2372
+ icon: string;
2373
+ /** Accessible label */
2374
+ label: string;
2375
+ /** Type of control to render */
2376
+ type: ToolbarActionType$3;
2377
+ /** Visual group placement */
2378
+ group: ToolbarGroup$3;
2379
+ /** Whether the action is currently enabled */
2380
+ enabled?: boolean;
2381
+ /** Whether a toggle is currently active */
2382
+ active?: boolean;
2383
+ /** Execute the action */
2384
+ execute: (...args: unknown[]) => void;
2385
+ /** For 'range' type: min/max/step/value */
2386
+ min?: number;
2387
+ max?: number;
2388
+ step?: number;
2389
+ value?: number;
2390
+ }
2391
+ /** Represents a thumbnail in the sidebar */
2392
+ interface Thumbnail$3 {
2393
+ /** Page/sheet/frame index */
2394
+ index: number;
2395
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
2396
+ label: string;
2397
+ /** Renders the thumbnail into a canvas element */
2398
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
2399
+ }
2400
+ /** Instance returned after a file is rendered — exposes controls */
2401
+ interface PreviewInstance$3 {
2402
+ /** Clean up all resources */
2403
+ destroy(): void;
2404
+ zoomIn?(): void;
2405
+ zoomOut?(): void;
2406
+ getZoom?(): number;
2407
+ setZoom?(level: number): void;
2408
+ fitToPage?(): void;
2409
+ fitToWidth?(): void;
2410
+ goToPage?(page: number): void;
2411
+ getPageCount?(): number;
2412
+ getCurrentPage?(): number;
2413
+ rotateCW?(): void;
2414
+ rotateCCW?(): void;
2415
+ getRotation?(): number;
2416
+ play?(): void;
2417
+ pause?(): void;
2418
+ isPlaying?(): boolean;
2419
+ fastForward?(seconds?: number): void;
2420
+ rewind?(seconds?: number): void;
2421
+ setPlaybackRate?(rate: number): void;
2422
+ getPlaybackRate?(): number;
2423
+ getThumbnails?(): Thumbnail$3[] | Promise<Thumbnail$3[]>;
2424
+ toggleThumbnails?(): void;
2425
+ download?(): void;
2426
+ print?(): void;
2427
+ [key: string]: unknown;
2428
+ }
2429
+ /** Context passed to a plugin's render function */
2430
+ interface RenderContext$3 {
2431
+ /** The container DOM element to render into */
2432
+ container: HTMLElement;
2433
+ /** Original file source */
2434
+ source: FileSource$3;
2435
+ /** Resolved file metadata */
2436
+ metadata: FileMetadata$3;
2437
+ /** File content as ArrayBuffer */
2438
+ buffer: ArrayBuffer;
2439
+ /** Viewer options */
2440
+ options: PreviewViewerOptions$3;
2441
+ /** AbortSignal for cancellation */
2442
+ signal: AbortSignal;
2443
+ /** Emit an event to the viewer */
2444
+ emit: (event: string, payload?: unknown) => void;
2445
+ }
2446
+ /** Plugin interface — each file format renderer implements this */
2447
+ interface PreviewPlugin$3 {
2448
+ /** Unique plugin identifier */
2449
+ id: string;
2450
+ /** Human-readable plugin name */
2451
+ name: string;
2452
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
2453
+ extensions: string[];
2454
+ /** MIME types this plugin handles */
2455
+ mimeTypes: string[];
2456
+ /** Priority when multiple plugins match (higher = preferred) */
2457
+ weight?: number;
2458
+ /** Check if this plugin can handle the given file */
2459
+ supports(file: FileInfo$3): boolean | Promise<boolean>;
2460
+ /** Return toolbar actions for the rendered instance */
2461
+ getToolbarActions(instance: PreviewInstance$3): ToolbarAction$3[];
2462
+ /** Render the file into the container */
2463
+ render(ctx: RenderContext$3): Promise<PreviewInstance$3>;
2464
+ }
2465
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
2466
+ interface ToolbarConfig$3 {
2467
+ /** Page navigation (< [1] / N >) */
2468
+ pageNav?: boolean;
2469
+ pagination?: boolean;
2470
+ prevPage?: boolean;
2471
+ nextPage?: boolean;
2472
+ /** Zoom controls */
2473
+ zoomIn?: boolean;
2474
+ zoomOut?: boolean;
2475
+ fitPage?: boolean;
2476
+ fitToPage?: boolean;
2477
+ fitWidth?: boolean;
2478
+ zoomReset?: boolean;
2479
+ /** View controls */
2480
+ rotate?: boolean;
2481
+ rotateCW?: boolean;
2482
+ rotateCCW?: boolean;
2483
+ fullscreen?: boolean;
2484
+ thumbnails?: boolean;
2485
+ /** Action controls */
2486
+ download?: boolean;
2487
+ print?: boolean;
2488
+ openWindow?: boolean;
2489
+ openSeparateWindow?: boolean;
2490
+ copy?: boolean;
2491
+ /** Media controls */
2492
+ play?: boolean;
2493
+ pause?: boolean;
2494
+ fastForward?: boolean;
2495
+ rewind?: boolean;
2496
+ speed?: boolean;
2497
+ }
2498
+ /** Viewer configuration options */
2499
+ interface PreviewViewerOptions$3 extends ToolbarConfig$3 {
2500
+ /** Color theme */
2501
+ theme?: 'light' | 'dark' | 'auto';
2502
+ /** Locale for UI labels */
2503
+ locale?: string;
2504
+ /** Initial zoom level (1.0 = 100%) */
2505
+ zoom?: number;
2506
+ /** Initial page number (1-based) */
2507
+ page?: number;
2508
+ /** Show the toolbar */
2509
+ showToolbar?: boolean;
2510
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
2511
+ toolbar?: boolean | (ToolbarConfig$3 & Record<string, boolean | undefined>);
2512
+ /** Toolbar position */
2513
+ toolbarPosition?: 'top' | 'bottom';
2514
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
2515
+ fitMode?: 'page' | 'width';
2516
+ /** Show thumbnail sidebar initially */
2517
+ showThumbnails?: boolean;
2518
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
2519
+ showFileName?: boolean;
2520
+ /** Custom file name / title override to display */
2521
+ fileName?: string;
2522
+ /** Custom CSS class for the container */
2523
+ className?: string;
2524
+ /** Plugin-specific options */
2525
+ pluginOptions?: Record<string, unknown>;
2526
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
2527
+ metadata?: FileMetadata$3;
2528
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
2529
+ standaloneViewerUrl?: string;
2530
+ /** Custom handler for opening preview in a separate window */
2531
+ onOpenSeparateWindow?: (payload: {
2532
+ buffer: ArrayBuffer;
2533
+ metadata: FileMetadata$3;
2534
+ options: PreviewViewerOptions$3;
2535
+ }) => Window | null;
2536
+ /** Internal flag: true when viewer is rendered inside separate full window */
2537
+ _isSeparateWindow?: boolean;
2538
+ /** Allow custom/plugin-specific options */
2539
+ [key: string]: unknown;
2540
+ }
2541
+
2542
+ declare class HtmlPreviewPlugin implements PreviewPlugin$3 {
2543
+ id: string;
2544
+ name: string;
2545
+ extensions: string[];
2546
+ mimeTypes: string[];
2547
+ weight: number;
2548
+ supports(file: FileInfo$3): boolean;
2549
+ getToolbarActions(instance: PreviewInstance$3): ToolbarAction$3[];
2550
+ render(ctx: RenderContext$3): Promise<PreviewInstance$3>;
2551
+ }
2552
+ declare function htmlPreviewPlugin(): HtmlPreviewPlugin;
2553
+
2554
+ /**
2555
+ * Supported file input sources.
2556
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
2557
+ */
2558
+ type FileSource$2 = string | File | Blob | ArrayBuffer | Uint8Array;
2559
+ /** Metadata extracted from a file source */
2560
+ interface FileMetadata$2 {
2561
+ /** Original filename (if available) */
2562
+ name?: string;
2563
+ /** File size in bytes */
2564
+ size?: number;
2565
+ /** Detected MIME type */
2566
+ mimeType?: string;
2567
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
2568
+ extension?: string;
2569
+ }
2570
+ /** Information about a resolved file, ready for plugin matching */
2571
+ interface FileInfo$2 {
2572
+ metadata: FileMetadata$2;
2573
+ buffer: ArrayBuffer;
2574
+ }
2575
+ /** Toolbar action types */
2576
+ type ToolbarActionType$2 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
2577
+ /** Toolbar action group names for visual grouping */
2578
+ type ToolbarGroup$2 = 'navigation' | 'zoom' | 'view' | 'actions';
2579
+ /** Represents a single toolbar action/control */
2580
+ interface ToolbarAction$2 {
2581
+ /** Unique action identifier */
2582
+ id: string;
2583
+ /** SVG icon markup string */
2584
+ icon: string;
2585
+ /** Accessible label */
2586
+ label: string;
2587
+ /** Type of control to render */
2588
+ type: ToolbarActionType$2;
2589
+ /** Visual group placement */
2590
+ group: ToolbarGroup$2;
2591
+ /** Whether the action is currently enabled */
2592
+ enabled?: boolean;
2593
+ /** Whether a toggle is currently active */
2594
+ active?: boolean;
2595
+ /** Execute the action */
2596
+ execute: (...args: unknown[]) => void;
2597
+ /** For 'range' type: min/max/step/value */
2598
+ min?: number;
2599
+ max?: number;
2600
+ step?: number;
2601
+ value?: number;
2602
+ }
2603
+ /** Represents a thumbnail in the sidebar */
2604
+ interface Thumbnail$2 {
2605
+ /** Page/sheet/frame index */
2606
+ index: number;
2607
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
2608
+ label: string;
2609
+ /** Renders the thumbnail into a canvas element */
2610
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
2611
+ }
2612
+ /** Instance returned after a file is rendered — exposes controls */
2613
+ interface PreviewInstance$2 {
2614
+ /** Clean up all resources */
2615
+ destroy(): void;
2616
+ zoomIn?(): void;
2617
+ zoomOut?(): void;
2618
+ getZoom?(): number;
2619
+ setZoom?(level: number): void;
2620
+ fitToPage?(): void;
2621
+ fitToWidth?(): void;
2622
+ goToPage?(page: number): void;
2623
+ getPageCount?(): number;
2624
+ getCurrentPage?(): number;
2625
+ rotateCW?(): void;
2626
+ rotateCCW?(): void;
2627
+ getRotation?(): number;
2628
+ play?(): void;
2629
+ pause?(): void;
2630
+ isPlaying?(): boolean;
2631
+ fastForward?(seconds?: number): void;
2632
+ rewind?(seconds?: number): void;
2633
+ setPlaybackRate?(rate: number): void;
2634
+ getPlaybackRate?(): number;
2635
+ getThumbnails?(): Thumbnail$2[] | Promise<Thumbnail$2[]>;
2636
+ toggleThumbnails?(): void;
2637
+ download?(): void;
2638
+ print?(): void;
2639
+ [key: string]: unknown;
2640
+ }
2641
+ /** Context passed to a plugin's render function */
2642
+ interface RenderContext$2 {
2643
+ /** The container DOM element to render into */
2644
+ container: HTMLElement;
2645
+ /** Original file source */
2646
+ source: FileSource$2;
2647
+ /** Resolved file metadata */
2648
+ metadata: FileMetadata$2;
2649
+ /** File content as ArrayBuffer */
2650
+ buffer: ArrayBuffer;
2651
+ /** Viewer options */
2652
+ options: PreviewViewerOptions$2;
2653
+ /** AbortSignal for cancellation */
2654
+ signal: AbortSignal;
2655
+ /** Emit an event to the viewer */
2656
+ emit: (event: string, payload?: unknown) => void;
2657
+ }
2658
+ /** Plugin interface — each file format renderer implements this */
2659
+ interface PreviewPlugin$2 {
2660
+ /** Unique plugin identifier */
2661
+ id: string;
2662
+ /** Human-readable plugin name */
2663
+ name: string;
2664
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
2665
+ extensions: string[];
2666
+ /** MIME types this plugin handles */
2667
+ mimeTypes: string[];
2668
+ /** Priority when multiple plugins match (higher = preferred) */
2669
+ weight?: number;
2670
+ /** Check if this plugin can handle the given file */
2671
+ supports(file: FileInfo$2): boolean | Promise<boolean>;
2672
+ /** Return toolbar actions for the rendered instance */
2673
+ getToolbarActions(instance: PreviewInstance$2): ToolbarAction$2[];
2674
+ /** Render the file into the container */
2675
+ render(ctx: RenderContext$2): Promise<PreviewInstance$2>;
2676
+ }
2677
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
2678
+ interface ToolbarConfig$2 {
2679
+ /** Page navigation (< [1] / N >) */
2680
+ pageNav?: boolean;
2681
+ pagination?: boolean;
2682
+ prevPage?: boolean;
2683
+ nextPage?: boolean;
2684
+ /** Zoom controls */
2685
+ zoomIn?: boolean;
2686
+ zoomOut?: boolean;
2687
+ fitPage?: boolean;
2688
+ fitToPage?: boolean;
2689
+ fitWidth?: boolean;
2690
+ zoomReset?: boolean;
2691
+ /** View controls */
2692
+ rotate?: boolean;
2693
+ rotateCW?: boolean;
2694
+ rotateCCW?: boolean;
2695
+ fullscreen?: boolean;
2696
+ thumbnails?: boolean;
2697
+ /** Action controls */
2698
+ download?: boolean;
2699
+ print?: boolean;
2700
+ openWindow?: boolean;
2701
+ openSeparateWindow?: boolean;
2702
+ copy?: boolean;
2703
+ /** Media controls */
2704
+ play?: boolean;
2705
+ pause?: boolean;
2706
+ fastForward?: boolean;
2707
+ rewind?: boolean;
2708
+ speed?: boolean;
2709
+ }
2710
+ /** Viewer configuration options */
2711
+ interface PreviewViewerOptions$2 extends ToolbarConfig$2 {
2712
+ /** Color theme */
2713
+ theme?: 'light' | 'dark' | 'auto';
2714
+ /** Locale for UI labels */
2715
+ locale?: string;
2716
+ /** Initial zoom level (1.0 = 100%) */
2717
+ zoom?: number;
2718
+ /** Initial page number (1-based) */
2719
+ page?: number;
2720
+ /** Show the toolbar */
2721
+ showToolbar?: boolean;
2722
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
2723
+ toolbar?: boolean | (ToolbarConfig$2 & Record<string, boolean | undefined>);
2724
+ /** Toolbar position */
2725
+ toolbarPosition?: 'top' | 'bottom';
2726
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
2727
+ fitMode?: 'page' | 'width';
2728
+ /** Show thumbnail sidebar initially */
2729
+ showThumbnails?: boolean;
2730
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
2731
+ showFileName?: boolean;
2732
+ /** Custom file name / title override to display */
2733
+ fileName?: string;
2734
+ /** Custom CSS class for the container */
2735
+ className?: string;
2736
+ /** Plugin-specific options */
2737
+ pluginOptions?: Record<string, unknown>;
2738
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
2739
+ metadata?: FileMetadata$2;
2740
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
2741
+ standaloneViewerUrl?: string;
2742
+ /** Custom handler for opening preview in a separate window */
2743
+ onOpenSeparateWindow?: (payload: {
2744
+ buffer: ArrayBuffer;
2745
+ metadata: FileMetadata$2;
2746
+ options: PreviewViewerOptions$2;
2747
+ }) => Window | null;
2748
+ /** Internal flag: true when viewer is rendered inside separate full window */
2749
+ _isSeparateWindow?: boolean;
2750
+ /** Allow custom/plugin-specific options */
2751
+ [key: string]: unknown;
2752
+ }
2753
+
2754
+ declare class OpenDocumentPlugin implements PreviewPlugin$2 {
2755
+ id: string;
2756
+ name: string;
2757
+ extensions: string[];
2758
+ mimeTypes: string[];
2759
+ weight: number;
2760
+ supports(file: FileInfo$2): boolean;
2761
+ getToolbarActions(instance: PreviewInstance$2): ToolbarAction$2[];
2762
+ render(ctx: RenderContext$2): Promise<PreviewInstance$2>;
2763
+ private getPageDimensions;
2764
+ private extractStyles;
2765
+ private renderOdfBody;
2766
+ private renderSpans;
2767
+ private renderSlides;
2768
+ }
2769
+ declare function openDocumentPlugin(): OpenDocumentPlugin;
2770
+
2771
+ /**
2772
+ * Supported file input sources.
2773
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
2774
+ */
2775
+ type FileSource$1 = string | File | Blob | ArrayBuffer | Uint8Array;
2776
+ /** Metadata extracted from a file source */
2777
+ interface FileMetadata$1 {
2778
+ /** Original filename (if available) */
2779
+ name?: string;
2780
+ /** File size in bytes */
2781
+ size?: number;
2782
+ /** Detected MIME type */
2783
+ mimeType?: string;
2784
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
2785
+ extension?: string;
2786
+ }
2787
+ /** Information about a resolved file, ready for plugin matching */
2788
+ interface FileInfo$1 {
2789
+ metadata: FileMetadata$1;
2790
+ buffer: ArrayBuffer;
2791
+ }
2792
+ /** Toolbar action types */
2793
+ type ToolbarActionType$1 = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
2794
+ /** Toolbar action group names for visual grouping */
2795
+ type ToolbarGroup$1 = 'navigation' | 'zoom' | 'view' | 'actions';
2796
+ /** Represents a single toolbar action/control */
2797
+ interface ToolbarAction$1 {
2798
+ /** Unique action identifier */
2799
+ id: string;
2800
+ /** SVG icon markup string */
2801
+ icon: string;
2802
+ /** Accessible label */
2803
+ label: string;
2804
+ /** Type of control to render */
2805
+ type: ToolbarActionType$1;
2806
+ /** Visual group placement */
2807
+ group: ToolbarGroup$1;
2808
+ /** Whether the action is currently enabled */
2809
+ enabled?: boolean;
2810
+ /** Whether a toggle is currently active */
2811
+ active?: boolean;
2812
+ /** Execute the action */
2813
+ execute: (...args: unknown[]) => void;
2814
+ /** For 'range' type: min/max/step/value */
2815
+ min?: number;
2816
+ max?: number;
2817
+ step?: number;
2818
+ value?: number;
2819
+ }
2820
+ /** Represents a thumbnail in the sidebar */
2821
+ interface Thumbnail$1 {
2822
+ /** Page/sheet/frame index */
2823
+ index: number;
2824
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
2825
+ label: string;
2826
+ /** Renders the thumbnail into a canvas element */
2827
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
2828
+ }
2829
+ /** Instance returned after a file is rendered — exposes controls */
2830
+ interface PreviewInstance$1 {
2831
+ /** Clean up all resources */
2832
+ destroy(): void;
2833
+ zoomIn?(): void;
2834
+ zoomOut?(): void;
2835
+ getZoom?(): number;
2836
+ setZoom?(level: number): void;
2837
+ fitToPage?(): void;
2838
+ fitToWidth?(): void;
2839
+ goToPage?(page: number): void;
2840
+ getPageCount?(): number;
2841
+ getCurrentPage?(): number;
2842
+ rotateCW?(): void;
2843
+ rotateCCW?(): void;
2844
+ getRotation?(): number;
2845
+ play?(): void;
2846
+ pause?(): void;
2847
+ isPlaying?(): boolean;
2848
+ fastForward?(seconds?: number): void;
2849
+ rewind?(seconds?: number): void;
2850
+ setPlaybackRate?(rate: number): void;
2851
+ getPlaybackRate?(): number;
2852
+ getThumbnails?(): Thumbnail$1[] | Promise<Thumbnail$1[]>;
2853
+ toggleThumbnails?(): void;
2854
+ download?(): void;
2855
+ print?(): void;
2856
+ [key: string]: unknown;
2857
+ }
2858
+ /** Context passed to a plugin's render function */
2859
+ interface RenderContext$1 {
2860
+ /** The container DOM element to render into */
2861
+ container: HTMLElement;
2862
+ /** Original file source */
2863
+ source: FileSource$1;
2864
+ /** Resolved file metadata */
2865
+ metadata: FileMetadata$1;
2866
+ /** File content as ArrayBuffer */
2867
+ buffer: ArrayBuffer;
2868
+ /** Viewer options */
2869
+ options: PreviewViewerOptions$1;
2870
+ /** AbortSignal for cancellation */
2871
+ signal: AbortSignal;
2872
+ /** Emit an event to the viewer */
2873
+ emit: (event: string, payload?: unknown) => void;
2874
+ }
2875
+ /** Plugin interface — each file format renderer implements this */
2876
+ interface PreviewPlugin$1 {
2877
+ /** Unique plugin identifier */
2878
+ id: string;
2879
+ /** Human-readable plugin name */
2880
+ name: string;
2881
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
2882
+ extensions: string[];
2883
+ /** MIME types this plugin handles */
2884
+ mimeTypes: string[];
2885
+ /** Priority when multiple plugins match (higher = preferred) */
2886
+ weight?: number;
2887
+ /** Check if this plugin can handle the given file */
2888
+ supports(file: FileInfo$1): boolean | Promise<boolean>;
2889
+ /** Return toolbar actions for the rendered instance */
2890
+ getToolbarActions(instance: PreviewInstance$1): ToolbarAction$1[];
2891
+ /** Render the file into the container */
2892
+ render(ctx: RenderContext$1): Promise<PreviewInstance$1>;
2893
+ }
2894
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
2895
+ interface ToolbarConfig$1 {
2896
+ /** Page navigation (< [1] / N >) */
2897
+ pageNav?: boolean;
2898
+ pagination?: boolean;
2899
+ prevPage?: boolean;
2900
+ nextPage?: boolean;
2901
+ /** Zoom controls */
2902
+ zoomIn?: boolean;
2903
+ zoomOut?: boolean;
2904
+ fitPage?: boolean;
2905
+ fitToPage?: boolean;
2906
+ fitWidth?: boolean;
2907
+ zoomReset?: boolean;
2908
+ /** View controls */
2909
+ rotate?: boolean;
2910
+ rotateCW?: boolean;
2911
+ rotateCCW?: boolean;
2912
+ fullscreen?: boolean;
2913
+ thumbnails?: boolean;
2914
+ /** Action controls */
2915
+ download?: boolean;
2916
+ print?: boolean;
2917
+ openWindow?: boolean;
2918
+ openSeparateWindow?: boolean;
2919
+ copy?: boolean;
2920
+ /** Media controls */
2921
+ play?: boolean;
2922
+ pause?: boolean;
2923
+ fastForward?: boolean;
2924
+ rewind?: boolean;
2925
+ speed?: boolean;
2926
+ }
2927
+ /** Viewer configuration options */
2928
+ interface PreviewViewerOptions$1 extends ToolbarConfig$1 {
2929
+ /** Color theme */
2930
+ theme?: 'light' | 'dark' | 'auto';
2931
+ /** Locale for UI labels */
2932
+ locale?: string;
2933
+ /** Initial zoom level (1.0 = 100%) */
2934
+ zoom?: number;
2935
+ /** Initial page number (1-based) */
2936
+ page?: number;
2937
+ /** Show the toolbar */
2938
+ showToolbar?: boolean;
2939
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
2940
+ toolbar?: boolean | (ToolbarConfig$1 & Record<string, boolean | undefined>);
2941
+ /** Toolbar position */
2942
+ toolbarPosition?: 'top' | 'bottom';
2943
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
2944
+ fitMode?: 'page' | 'width';
2945
+ /** Show thumbnail sidebar initially */
2946
+ showThumbnails?: boolean;
2947
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
2948
+ showFileName?: boolean;
2949
+ /** Custom file name / title override to display */
2950
+ fileName?: string;
2951
+ /** Custom CSS class for the container */
2952
+ className?: string;
2953
+ /** Plugin-specific options */
2954
+ pluginOptions?: Record<string, unknown>;
2955
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
2956
+ metadata?: FileMetadata$1;
2957
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
2958
+ standaloneViewerUrl?: string;
2959
+ /** Custom handler for opening preview in a separate window */
2960
+ onOpenSeparateWindow?: (payload: {
2961
+ buffer: ArrayBuffer;
2962
+ metadata: FileMetadata$1;
2963
+ options: PreviewViewerOptions$1;
2964
+ }) => Window | null;
2965
+ /** Internal flag: true when viewer is rendered inside separate full window */
2966
+ _isSeparateWindow?: boolean;
2967
+ /** Allow custom/plugin-specific options */
2968
+ [key: string]: unknown;
2969
+ }
2970
+
2971
+ declare class DocPlugin implements PreviewPlugin$1 {
2972
+ id: string;
2973
+ name: string;
2974
+ extensions: string[];
2975
+ mimeTypes: string[];
2976
+ weight: number;
2977
+ supports(file: FileInfo$1): boolean;
2978
+ getToolbarActions(instance: PreviewInstance$1): ToolbarAction$1[];
2979
+ render(ctx: RenderContext$1): Promise<PreviewInstance$1>;
2980
+ /**
2981
+ * Extract document text from WordDocument stream and Table stream
2982
+ */
2983
+ private extractDocText;
2984
+ /**
2985
+ * Parse the CLX and Piece Table (Plcfpcd) according to [MS-DOC]
2986
+ */
2987
+ private parsePieceTable;
2988
+ private readPlcfpcd;
2989
+ /**
2990
+ * Scans a byte array for continuous sequences of readable characters (ANSI and UTF-16LE)
2991
+ */
2992
+ private extractStringsFromBytes;
2993
+ private heuristicTextExtraction;
2994
+ /**
2995
+ * Parses an embedded OpenDocument Chart package into a vector SVG bar/column chart
2996
+ */
2997
+ private parseOdfChartToSvg;
2998
+ private cleanWordDocFields;
2999
+ private splitIntoPages;
3000
+ /**
3001
+ * Format cleaned extracted text into attractive HTML paragraphs, headings, and lists
3002
+ */
3003
+ private formatDocToHtml;
3004
+ }
3005
+ declare function docPlugin(): DocPlugin;
3006
+
3007
+ /**
3008
+ * Supported file input sources.
3009
+ * Accepts URL strings, File objects, Blobs, ArrayBuffers, or Uint8Arrays.
3010
+ */
3011
+ type FileSource = string | File | Blob | ArrayBuffer | Uint8Array;
3012
+ /** Metadata extracted from a file source */
3013
+ interface FileMetadata {
3014
+ /** Original filename (if available) */
3015
+ name?: string;
3016
+ /** File size in bytes */
3017
+ size?: number;
3018
+ /** Detected MIME type */
3019
+ mimeType?: string;
3020
+ /** File extension (lowercase, with dot, e.g. '.pdf') */
3021
+ extension?: string;
3022
+ }
3023
+ /** Information about a resolved file, ready for plugin matching */
3024
+ interface FileInfo {
3025
+ metadata: FileMetadata;
3026
+ buffer: ArrayBuffer;
3027
+ }
3028
+ /** Toolbar action types */
3029
+ type ToolbarActionType = 'button' | 'toggle' | 'range' | 'input' | 'separator' | 'page-nav';
3030
+ /** Toolbar action group names for visual grouping */
3031
+ type ToolbarGroup = 'navigation' | 'zoom' | 'view' | 'actions';
3032
+ /** Represents a single toolbar action/control */
3033
+ interface ToolbarAction {
3034
+ /** Unique action identifier */
3035
+ id: string;
3036
+ /** SVG icon markup string */
3037
+ icon: string;
3038
+ /** Accessible label */
3039
+ label: string;
3040
+ /** Type of control to render */
3041
+ type: ToolbarActionType;
3042
+ /** Visual group placement */
3043
+ group: ToolbarGroup;
3044
+ /** Whether the action is currently enabled */
3045
+ enabled?: boolean;
3046
+ /** Whether a toggle is currently active */
3047
+ active?: boolean;
3048
+ /** Execute the action */
3049
+ execute: (...args: unknown[]) => void;
3050
+ /** For 'range' type: min/max/step/value */
3051
+ min?: number;
3052
+ max?: number;
3053
+ step?: number;
3054
+ value?: number;
3055
+ }
3056
+ /** Represents a thumbnail in the sidebar */
3057
+ interface Thumbnail {
3058
+ /** Page/sheet/frame index */
3059
+ index: number;
3060
+ /** Display label (e.g., "Page 1", "Sheet: Revenue") */
3061
+ label: string;
3062
+ /** Renders the thumbnail into a canvas element */
3063
+ render: (canvas: HTMLCanvasElement) => Promise<void>;
3064
+ }
3065
+ /** Instance returned after a file is rendered — exposes controls */
3066
+ interface PreviewInstance {
3067
+ /** Clean up all resources */
3068
+ destroy(): void;
3069
+ zoomIn?(): void;
3070
+ zoomOut?(): void;
3071
+ getZoom?(): number;
3072
+ setZoom?(level: number): void;
3073
+ fitToPage?(): void;
3074
+ fitToWidth?(): void;
3075
+ goToPage?(page: number): void;
3076
+ getPageCount?(): number;
3077
+ getCurrentPage?(): number;
3078
+ rotateCW?(): void;
3079
+ rotateCCW?(): void;
3080
+ getRotation?(): number;
3081
+ play?(): void;
3082
+ pause?(): void;
3083
+ isPlaying?(): boolean;
3084
+ fastForward?(seconds?: number): void;
3085
+ rewind?(seconds?: number): void;
3086
+ setPlaybackRate?(rate: number): void;
3087
+ getPlaybackRate?(): number;
3088
+ getThumbnails?(): Thumbnail[] | Promise<Thumbnail[]>;
3089
+ toggleThumbnails?(): void;
3090
+ download?(): void;
3091
+ print?(): void;
3092
+ [key: string]: unknown;
3093
+ }
3094
+ /** Context passed to a plugin's render function */
3095
+ interface RenderContext {
3096
+ /** The container DOM element to render into */
3097
+ container: HTMLElement;
3098
+ /** Original file source */
3099
+ source: FileSource;
3100
+ /** Resolved file metadata */
3101
+ metadata: FileMetadata;
3102
+ /** File content as ArrayBuffer */
3103
+ buffer: ArrayBuffer;
3104
+ /** Viewer options */
3105
+ options: PreviewViewerOptions;
3106
+ /** AbortSignal for cancellation */
3107
+ signal: AbortSignal;
3108
+ /** Emit an event to the viewer */
3109
+ emit: (event: string, payload?: unknown) => void;
3110
+ }
3111
+ /** Plugin interface — each file format renderer implements this */
3112
+ interface PreviewPlugin {
3113
+ /** Unique plugin identifier */
3114
+ id: string;
3115
+ /** Human-readable plugin name */
3116
+ name: string;
3117
+ /** File extensions this plugin handles (e.g., ['.pdf']) */
3118
+ extensions: string[];
3119
+ /** MIME types this plugin handles */
3120
+ mimeTypes: string[];
3121
+ /** Priority when multiple plugins match (higher = preferred) */
3122
+ weight?: number;
3123
+ /** Check if this plugin can handle the given file */
3124
+ supports(file: FileInfo): boolean | Promise<boolean>;
3125
+ /** Return toolbar actions for the rendered instance */
3126
+ getToolbarActions(instance: PreviewInstance): ToolbarAction[];
3127
+ /** Render the file into the container */
3128
+ render(ctx: RenderContext): Promise<PreviewInstance>;
3129
+ }
3130
+ /** Configuration to selectively enable or disable individual toolbar functions/buttons */
3131
+ interface ToolbarConfig {
3132
+ /** Page navigation (< [1] / N >) */
3133
+ pageNav?: boolean;
3134
+ pagination?: boolean;
3135
+ prevPage?: boolean;
3136
+ nextPage?: boolean;
3137
+ /** Zoom controls */
3138
+ zoomIn?: boolean;
3139
+ zoomOut?: boolean;
3140
+ fitPage?: boolean;
3141
+ fitToPage?: boolean;
3142
+ fitWidth?: boolean;
3143
+ zoomReset?: boolean;
3144
+ /** View controls */
3145
+ rotate?: boolean;
3146
+ rotateCW?: boolean;
3147
+ rotateCCW?: boolean;
3148
+ fullscreen?: boolean;
3149
+ thumbnails?: boolean;
3150
+ /** Action controls */
3151
+ download?: boolean;
3152
+ print?: boolean;
3153
+ openWindow?: boolean;
3154
+ openSeparateWindow?: boolean;
3155
+ copy?: boolean;
3156
+ /** Media controls */
3157
+ play?: boolean;
3158
+ pause?: boolean;
3159
+ fastForward?: boolean;
3160
+ rewind?: boolean;
3161
+ speed?: boolean;
3162
+ }
3163
+ /** Viewer configuration options */
3164
+ interface PreviewViewerOptions extends ToolbarConfig {
3165
+ /** Color theme */
3166
+ theme?: 'light' | 'dark' | 'auto';
3167
+ /** Locale for UI labels */
3168
+ locale?: string;
3169
+ /** Initial zoom level (1.0 = 100%) */
3170
+ zoom?: number;
3171
+ /** Initial page number (1-based) */
3172
+ page?: number;
3173
+ /** Show the toolbar */
3174
+ showToolbar?: boolean;
3175
+ /** Detailed toolbar configuration (or boolean to show/hide entire toolbar) */
3176
+ toolbar?: boolean | (ToolbarConfig & Record<string, boolean | undefined>);
3177
+ /** Toolbar position */
3178
+ toolbarPosition?: 'top' | 'bottom';
3179
+ /** Fit mode: 'page' (fill frame width with minimal margins) or 'width' */
3180
+ fitMode?: 'page' | 'width';
3181
+ /** Show thumbnail sidebar initially */
3182
+ showThumbnails?: boolean;
3183
+ /** Whether to display the file name / title bar above the toolbar in the preview panel (defaults to true) */
3184
+ showFileName?: boolean;
3185
+ /** Custom file name / title override to display */
3186
+ fileName?: string;
3187
+ /** Custom CSS class for the container */
3188
+ className?: string;
3189
+ /** Plugin-specific options */
3190
+ pluginOptions?: Record<string, unknown>;
3191
+ /** Optional file metadata overrides (name, extension, mimeType, etc.) */
3192
+ metadata?: FileMetadata;
3193
+ /** Custom URL to navigate when "Open in Separate Full Window" is clicked */
3194
+ standaloneViewerUrl?: string;
3195
+ /** Custom handler for opening preview in a separate window */
3196
+ onOpenSeparateWindow?: (payload: {
3197
+ buffer: ArrayBuffer;
3198
+ metadata: FileMetadata;
3199
+ options: PreviewViewerOptions;
3200
+ }) => Window | null;
3201
+ /** Internal flag: true when viewer is rendered inside separate full window */
3202
+ _isSeparateWindow?: boolean;
3203
+ /** Allow custom/plugin-specific options */
3204
+ [key: string]: unknown;
3205
+ }
3206
+
3207
+ declare class PptPlugin implements PreviewPlugin {
3208
+ id: string;
3209
+ name: string;
3210
+ extensions: string[];
3211
+ mimeTypes: string[];
3212
+ weight: number;
3213
+ supports(file: FileInfo): boolean;
3214
+ getToolbarActions(instance: PreviewInstance): ToolbarAction[];
3215
+ render(ctx: RenderContext): Promise<PreviewInstance>;
3216
+ /**
3217
+ * Extract PNG and JPEG images from the Pictures stream
3218
+ */
3219
+ private extractPictures;
3220
+ /**
3221
+ * Traverse PowerPoint binary stream records ([MS-PPT]) and extract text chunks per slide
3222
+ */
3223
+ private extractSlides;
3224
+ }
3225
+ declare function pptPlugin(): PptPlugin;
18
3226
 
19
3227
  /**
20
3228
  * Returns all built-in default preview plugins:
@@ -25,7 +3233,7 @@ export { pptPlugin } from '@patel.sumit51/plugin-ppt';
25
3233
  * Sandboxed HTML, CSV/TSV, ZIP Archives, Markdown, 3D Models (STL/OBJ),
26
3234
  * Media (Images/Video/Audio/SVG), and Code/Text (190+ languages).
27
3235
  */
28
- declare function getDefaultPlugins(): PreviewPlugin[];
3236
+ declare function getDefaultPlugins(): PreviewPlugin$f[];
29
3237
  /**
30
3238
  * Universal File Preview Viewer.
31
3239
  * Pre-loads all format plugins by default so 50+ file formats can be previewed immediately.
@@ -36,4 +3244,4 @@ declare class FilePreviewViewer extends FilePreviewViewer$1 {
36
3244
  });
37
3245
  }
38
3246
 
39
- export { FilePreviewViewer, getDefaultPlugins };
3247
+ export { FilePreviewViewer, PreviewPlugin$f as PreviewPlugin, archivePlugin, codePlugin, csvPlugin, docPlugin, docxPlugin, excelPlugin, getDefaultPlugins, htmlPreviewPlugin, markdownPlugin, mediaPlugin, openDocumentPlugin, pdfPlugin, pptPlugin, pptxPlugin, rtfPlugin, threeDPlugin };