@files-preview-app/preview-file 1.3.2 → 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/README.md CHANGED
@@ -490,16 +490,34 @@ Use directly with any build tool (Vite, Webpack, Rollup) or via `<script type="m
490
490
  |---|---|---|---|
491
491
  | `preview()` | `container: HTMLElement`, `source: FileSource`, `options?: PreviewViewerOptions` | `Promise<PreviewInstance>` | Renders any supported file into the target DOM element. Cleans up previous renders automatically. |
492
492
  | `getInstance()` | None | `PreviewInstance \| null` | Returns the active preview instance, exposing zoom, navigation, export, and rotation methods. |
493
- | `setToolbarConfig()` | `config: ToolbarConfig` | `void` | Dynamically reconfigures which toolbar buttons/actions are shown. |
493
+ | `openInSeparateWindow()` | None | `Window \| null` | Clones current file buffer and opens it in a full-screen isolated browser tab. |
494
+ | `setShowFileName(show)` | `show: boolean` | `void` | Dynamically toggles the file name and format badge title bar above the toolbar. |
495
+ | `setFileName(name)` | `name: string` | `void` | Dynamically updates the displayed file title in the preview panel. |
496
+ | `setToolbarConfig(config)` | `config: ToolbarConfig` | `void` | Dynamically reconfigures which toolbar buttons/actions are shown. |
494
497
  | `getToolbarConfig()` | None | `ToolbarConfig` | Returns the active toolbar configuration. |
495
- | `hideToolbarAction()` | `actionId: string` | `void` | Hides a specific toolbar action by ID or alias (e.g. `'zoomIn'`, `'print'`, `'download'`). |
496
- | `showToolbarAction()` | `actionId: string` | `void` | Shows a previously hidden toolbar action. |
497
- | `enableToolbarAction()` | `actionId: string` | `void` | Enables a disabled toolbar action button. |
498
- | `disableToolbarAction()` | `actionId: string` | `void` | Disables a toolbar action button. |
499
- | `fitToPage()` | None | `void` | Scales document page so it fills the frame width with minimal side margins. |
500
- | `on()` | `event: string`, `handler: (data: any) => void` | `Unsubscribe: () => void` | Subscribes to lifecycle events. Returns an unsubscribe cleanup function. |
501
- | `registerPlugin()` | `plugin: PreviewPlugin` | `this` | Registers a custom renderer plugin. |
502
- | `registerPlugins()` | `plugins: PreviewPlugin[]` | `this` | Registers multiple renderer plugins at once. |
498
+ | `hideToolbarAction(id)` | `actionId: string` | `void` | Hides a specific toolbar action by ID or alias (e.g. `'zoomIn'`, `'print'`, `'download'`). |
499
+ | `showToolbarAction(id)` | `actionId: string` | `void` | Shows a previously hidden toolbar action. |
500
+ | `enableToolbarAction(id)` | `actionId: string` | `void` | Enables a disabled toolbar action button. |
501
+ | `disableToolbarAction(id)` | `actionId: string` | `void` | Disables a toolbar action button. |
502
+ | `toggleThumbnails()` | None | `void` | Toggles the page/sheet thumbnail sidebar panel. |
503
+ | `toggleFullscreen()` | None | `void` | Toggles browser fullscreen on the viewer container. |
504
+ | `fitToPage()` | None | `void` | Scales document page or table so it fits the frame width with minimal margins. |
505
+ | `zoomIn()` | None | `void` | Programmatically zooms in. |
506
+ | `zoomOut()` | None | `void` | Programmatically zooms out. |
507
+ | `setZoom(level)` | `level: number` | `void` | Programmatically sets exact zoom scale (e.g. `1.5` = 150%). |
508
+ | `getZoom()` | None | `number` | Returns current zoom level. |
509
+ | `rotateCW()` | None | `void` | Rotates document or image 90° clockwise. |
510
+ | `rotateCCW()` | None | `void` | Rotates document or image 90° counter-clockwise. |
511
+ | `goToPage(page)` | `page: number` | `void` | Navigates to a specific page or sheet (1-based index). |
512
+ | `nextPage()` | None | `void` | Navigates to next page or sheet. |
513
+ | `prevPage()` | None | `void` | Navigates to previous page or sheet. |
514
+ | `getPageCount()` | None | `number` | Returns total page/sheet count. |
515
+ | `getCurrentPage()` | None | `number` | Returns current active page number (1-based). |
516
+ | `download()` | None | `void` | Downloads current file with original name and detected MIME type. |
517
+ | `print()` | None | `void` | Triggers browser print dialog for document. |
518
+ | `on(event, handler)` | `event: string`, `handler: (data: any) => void` | `Unsubscribe: () => void` | Subscribes to lifecycle events. Returns an unsubscribe cleanup function. |
519
+ | `registerPlugin(plugin)` | `plugin: PreviewPlugin` | `this` | Registers a custom renderer plugin. |
520
+ | `registerPlugins(list)` | `plugins: PreviewPlugin[]` | `this` | Registers multiple renderer plugins at once. |
503
521
  | `destroy()` | None | `void` | Destroys the active instance, removes toolbar DOM, cancels network abort controllers, and clears listeners. |
504
522
 
505
523
  ---
@@ -661,14 +679,23 @@ Passed to `options` prop in React/Angular/Vue or third argument to `viewer.previ
661
679
  |---|---|---|---|
662
680
  | `theme` | `'light' \| 'dark' \| 'auto'` | `'light'` | UI theme. `'auto'` adapts to system dark mode preferences. |
663
681
  | `showToolbar` | `boolean` | `true` | Set `false` to hide built-in toolbar (e.g. when using your own custom buttons). |
682
+ | `toolbar` | `boolean \| ToolbarConfig` | `true` | Fine-grained button visibility flags (`zoomIn`, `print`, `download`, `pageNav`, etc.). |
664
683
  | `toolbarPosition` | `'top' \| 'bottom'` | `'top'` | Positions toolbar at the top or bottom of the viewer container. |
684
+ | `showFileName` | `boolean` | `true` | When `true`, displays file name and format badge in title bar above toolbar. |
685
+ | `fileName` | `string` | `undefined` | Custom file title override displayed in title bar. |
686
+ | `fitMode` | `'page' \| 'width'` | `'page'` | Preferred fit calculation strategy. |
665
687
  | `showThumbnails` | `boolean` | `false` | Opens page thumbnails sidebar panel automatically on load. |
666
688
  | `className` | `string` | `''` | Custom CSS class attached to the root viewer container element. |
667
689
  | `zoom` | `number` | `1.0` | Initial zoom multiplier (`1.0` = 100%, `1.5` = 150%). |
668
690
  | `page` | `number` | `1` | Initial page, slide, or sheet number to display on load (1-based). |
669
691
  | `locale` | `string` | `'en'` | UI label language localization. |
692
+ | `metadata` | `FileMetadata` | `undefined` | Manual override object for file attributes (`name`, `extension`, `mimeType`, `size`). |
693
+ | `standaloneViewerUrl` | `string` | `undefined` | Custom URL opened when user clicks "Open in Separate Full Window". |
694
+ | `onOpenSeparateWindow` | `function` | `undefined` | Custom callback hook to handle opening preview in separate window. |
670
695
  | `pluginOptions` | `Record<string, unknown>` | `{}` | Custom options passed directly to underlying format renderer plugins. |
671
696
 
697
+ > 📖 **For exhaustive details and TypeScript interfaces, see the full [API Reference Documentation](../../docs/API_REFERENCE.md).**
698
+
672
699
  ---
673
700
 
674
701
  ## 🎨 CSS Variables (Theming & Custom Styling)