react-pdf-highlighter-plus 1.0.7 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,6 +39,7 @@
39
39
  | **Images & Signatures** | Upload images or draw signatures directly on PDFs |
40
40
  | **Freehand Drawing** | Draw freehand annotations with customizable stroke |
41
41
  | **PDF Export** | Export annotated PDF with all highlights embedded |
42
+ | **Light/Dark Theme** | Eye-friendly dark mode with customizable intensity |
42
43
  | **Zoom Support** | Full zoom functionality with position-independent data |
43
44
  | **Fully Customizable** | Exposed styling on all components |
44
45
 
@@ -237,6 +238,55 @@ import { DrawingHighlight } from "react-pdf-highlighter-plus";
237
238
 
238
239
  ---
239
240
 
241
+ ## Light/Dark Theme
242
+
243
+ Toggle between light and dark modes with customizable styling for comfortable reading.
244
+
245
+ ```tsx
246
+ // Enable dark mode
247
+ <PdfHighlighter
248
+ pdfDocument={pdfDocument}
249
+ theme={{ mode: "dark" }}
250
+ highlights={highlights}
251
+ >
252
+ <HighlightContainer />
253
+ </PdfHighlighter>
254
+
255
+ // Customize dark mode intensity and colors
256
+ <PdfHighlighter
257
+ pdfDocument={pdfDocument}
258
+ theme={{
259
+ mode: "dark",
260
+ darkModeInvertIntensity: 0.85, // Softer (0.8-1.0)
261
+ containerBackgroundColor: "#3a3a3a",
262
+ scrollbarThumbColor: "#6b6b6b",
263
+ scrollbarTrackColor: "#2c2c2c",
264
+ }}
265
+ highlights={highlights}
266
+ >
267
+ <HighlightContainer />
268
+ </PdfHighlighter>
269
+ ```
270
+
271
+ **Features:**
272
+ - Eye-friendly dark mode using CSS filter inversion
273
+ - Customizable inversion intensity (0.8-1.0)
274
+ - Preserve original highlight colors in dark mode
275
+ - Custom scrollbar styling
276
+ - Full theming control for container background
277
+
278
+ **Inversion Intensity Guide:**
279
+ | Value | Result | Use Case |
280
+ |-------|--------|----------|
281
+ | `1.0` | Pure black | High contrast |
282
+ | `0.9` | Dark gray (~#1a1a1a) | **Recommended** |
283
+ | `0.85` | Softer gray (~#262626) | Long reading sessions |
284
+ | `0.8` | Medium gray (~#333333) | Maximum comfort |
285
+
286
+ [Full Documentation →](docs/theming.md)
287
+
288
+ ---
289
+
240
290
  ## PDF Export
241
291
 
242
292
  Export your annotated PDF with all highlights embedded.
@@ -1,8 +1,8 @@
1
1
  import { PDFDocumentProxy, OnProgressParameters } from 'pdfjs-dist';
2
2
  import React, { ReactNode, CSSProperties, MouseEvent as MouseEvent$1 } from 'react';
3
3
  import { Root } from 'react-dom/client';
4
- import { PDFViewer } from 'pdfjs-dist/types/web/pdf_viewer';
5
- import { PDFViewer as PDFViewer$1 } from 'pdfjs-dist/web/pdf_viewer.mjs';
4
+ import { PDFViewer as PDFViewer$2 } from 'pdfjs-dist/types/web/pdf_viewer';
5
+ import { PDFViewer as PDFViewer$3 } from 'pdfjs-dist/web/pdf_viewer.mjs';
6
6
  import { TypedArray, DocumentInitParameters } from 'pdfjs-dist/types/src/display/api';
7
7
 
8
8
  /**
@@ -216,6 +216,38 @@ type Tip = {
216
216
  * @category Type
217
217
  */
218
218
  type PdfScaleValue = "page-actual" | "page-width" | "page-height" | "page-fit" | "auto" | number;
219
+ /**
220
+ * Processed outline item with page number resolved
221
+ *
222
+ * @category Type
223
+ */
224
+ interface ProcessedOutlineItem {
225
+ id: string;
226
+ title: string;
227
+ pageNumber: number;
228
+ dest: string | unknown[] | null;
229
+ level: number;
230
+ bold: boolean;
231
+ italic: boolean;
232
+ children: ProcessedOutlineItem[];
233
+ }
234
+ /**
235
+ * Thumbnail data for a single page
236
+ *
237
+ * @category Type
238
+ */
239
+ interface ThumbnailData {
240
+ pageNumber: number;
241
+ dataUrl: string | null;
242
+ isLoading: boolean;
243
+ error?: string;
244
+ }
245
+ /**
246
+ * Left panel tab options
247
+ *
248
+ * @category Type
249
+ */
250
+ type LeftPanelTab = 'outline' | 'thumbnails';
219
251
 
220
252
  /**
221
253
  * A set of utilities for to control the behaviour of {@link PdfHighlighter}.
@@ -276,7 +308,7 @@ type PdfHighlighterUtils = {
276
308
  *
277
309
  * @returns - The currently active PDF Viewer.
278
310
  */
279
- getViewer(): PDFViewer | null;
311
+ getViewer(): PDFViewer$2 | null;
280
312
  /**
281
313
  * Get the currently active tip, if any.
282
314
  *
@@ -294,6 +326,24 @@ type PdfHighlighterUtils = {
294
326
  * the tip is visible above/below its highlight.
295
327
  */
296
328
  updateTipPosition(): void;
329
+ /**
330
+ * Get the PDF link service instance for navigation.
331
+ *
332
+ * @returns - The currently active PDF link service or null.
333
+ */
334
+ getLinkService(): unknown | null;
335
+ /**
336
+ * Get the event bus instance for page events.
337
+ *
338
+ * @returns - The currently active event bus or null.
339
+ */
340
+ getEventBus(): unknown | null;
341
+ /**
342
+ * Navigate to a specific page number.
343
+ *
344
+ * @param pageNumber - 1-indexed page number to navigate to.
345
+ */
346
+ goToPage(pageNumber: number): void;
297
347
  };
298
348
  /**
299
349
  * Custom hook for providing {@link PdfHighlighterUtils}. Must be used
@@ -303,6 +353,45 @@ type PdfHighlighterUtils = {
303
353
  */
304
354
  declare const usePdfHighlighterContext: () => PdfHighlighterUtils;
305
355
 
356
+ /**
357
+ * Theme configuration for PdfHighlighter styling.
358
+ * Controls the appearance of the PDF viewer including dark mode support.
359
+ *
360
+ * @category Type
361
+ */
362
+ interface PdfHighlighterTheme {
363
+ /**
364
+ * Theme mode - controls PDF page color inversion.
365
+ * In dark mode, PDF pages are inverted for comfortable reading.
366
+ * @default "light"
367
+ */
368
+ mode?: "light" | "dark";
369
+ /**
370
+ * Background color of the viewer container.
371
+ * @default "#e5e5e5" for light mode, "#1e1e1e" for dark mode
372
+ */
373
+ containerBackgroundColor?: string;
374
+ /**
375
+ * Scrollbar thumb color.
376
+ * @default "#9f9f9f" for light mode, "#6b6b6b" for dark mode
377
+ */
378
+ scrollbarThumbColor?: string;
379
+ /**
380
+ * Scrollbar track color.
381
+ * @default "#d1d1d1" for light mode, "#2c2c2c" for dark mode
382
+ */
383
+ scrollbarTrackColor?: string;
384
+ /**
385
+ * Inversion intensity for dark mode (0-1).
386
+ * Lower values create softer dark backgrounds that are easier on the eyes.
387
+ * - 1.0 = Pure black background (harsh)
388
+ * - 0.9 = Dark gray ~#1a1a1a (recommended)
389
+ * - 0.85 = Softer gray ~#262626 (very comfortable)
390
+ * - 0.8 = Medium gray ~#333333 (maximum softness)
391
+ * @default 0.9
392
+ */
393
+ darkModeInvertIntensity?: number;
394
+ }
306
395
  /**
307
396
  * The props type for {@link PdfHighlighter}.
308
397
  *
@@ -468,6 +557,13 @@ interface PdfHighlighterProps {
468
557
  * @default 2
469
558
  */
470
559
  shapeStrokeWidth?: number;
560
+ /**
561
+ * Theme configuration for the PDF viewer.
562
+ * Controls container background color and PDF page color inversion for dark mode.
563
+ *
564
+ * @default { mode: "light" }
565
+ */
566
+ theme?: PdfHighlighterTheme;
471
567
  }
472
568
  /**
473
569
  * This is a large-scale PDF viewer component designed to facilitate
@@ -479,7 +575,7 @@ interface PdfHighlighterProps {
479
575
  *
480
576
  * @category Component
481
577
  */
482
- declare const PdfHighlighter: ({ highlights, onScrollAway, pdfScaleValue, onSelection: onSelectionFinished, onCreateGhostHighlight, onRemoveGhostHighlight, selectionTip, enableAreaSelection, areaSelectionMode, mouseSelectionStyle, pdfDocument, children, textSelectionColor, utilsRef, style, enableFreetextCreation, onFreetextClick, enableImageCreation, onImageClick, enableDrawingMode, onDrawingComplete, onDrawingCancel, drawingStrokeColor, drawingStrokeWidth, enableShapeMode, onShapeComplete, onShapeCancel, shapeStrokeColor, shapeStrokeWidth, }: PdfHighlighterProps) => React.JSX.Element;
578
+ declare const PdfHighlighter: ({ highlights, onScrollAway, pdfScaleValue, onSelection: onSelectionFinished, onCreateGhostHighlight, onRemoveGhostHighlight, selectionTip, enableAreaSelection, areaSelectionMode, mouseSelectionStyle, pdfDocument, children, textSelectionColor, utilsRef, style, enableFreetextCreation, onFreetextClick, enableImageCreation, onImageClick, enableDrawingMode, onDrawingComplete, onDrawingCancel, drawingStrokeColor, drawingStrokeWidth, enableShapeMode, onShapeComplete, onShapeCancel, shapeStrokeColor, shapeStrokeWidth, theme: userTheme, }: PdfHighlighterProps) => React.JSX.Element;
483
579
 
484
580
  /**
485
581
  * Style options for text highlight appearance.
@@ -921,7 +1017,7 @@ interface DrawingCanvasProps {
921
1017
  /**
922
1018
  * The PDF viewer instance.
923
1019
  */
924
- viewer: InstanceType<typeof PDFViewer$1>;
1020
+ viewer: InstanceType<typeof PDFViewer$3>;
925
1021
  /**
926
1022
  * Callback when drawing is complete.
927
1023
  *
@@ -1038,7 +1134,7 @@ interface ShapeCanvasProps {
1038
1134
  /**
1039
1135
  * The PDF viewer instance.
1040
1136
  */
1041
- viewer: InstanceType<typeof PDFViewer$1>;
1137
+ viewer: InstanceType<typeof PDFViewer$3>;
1042
1138
  /**
1043
1139
  * Callback when shape creation is complete.
1044
1140
  *
@@ -1260,9 +1356,9 @@ type HighlightContainerUtils<T extends Highlight = Highlight> = {
1260
1356
  declare const useHighlightContainerContext: <T extends Highlight = Highlight>() => HighlightContainerUtils<T>;
1261
1357
 
1262
1358
  /** @category Utilities */
1263
- declare const viewportPositionToScaled: ({ boundingRect, rects }: ViewportPosition, viewer: PDFViewer) => ScaledPosition;
1359
+ declare const viewportPositionToScaled: ({ boundingRect, rects }: ViewportPosition, viewer: PDFViewer$2) => ScaledPosition;
1264
1360
  /** @category Utilities */
1265
- declare const scaledPositionToViewport: ({ boundingRect, rects, usePdfCoordinates }: ScaledPosition, viewer: PDFViewer) => ViewportPosition;
1361
+ declare const scaledPositionToViewport: ({ boundingRect, rects, usePdfCoordinates }: ScaledPosition, viewer: PDFViewer$2) => ViewportPosition;
1266
1362
 
1267
1363
  /**
1268
1364
  * Options for the PDF export function.
@@ -1345,4 +1441,457 @@ interface ExportableHighlight {
1345
1441
  */
1346
1442
  declare function exportPdf(pdfSource: string | Uint8Array | ArrayBuffer, highlights: ExportableHighlight[], options?: ExportPdfOptions): Promise<Uint8Array>;
1347
1443
 
1348
- export { AreaHighlight, type AreaHighlightProps, type AreaHighlightStyle, type Content, DrawingCanvas, type DrawingCanvasProps, DrawingHighlight, type DrawingHighlightProps, type DrawingPoint, type DrawingStroke, type ExportPdfOptions, type ExportableHighlight, FreetextHighlight, type FreetextHighlightProps, type FreetextStyle, type GhostHighlight, type Highlight, type HighlightBindings, type HighlightContainerUtils, type HighlightType, ImageHighlight, type ImageHighlightProps, type LTWH, type LTWHP, MonitoredHighlightContainer, type MonitoredHighlightContainerProps, type Page, PdfHighlighter, type PdfHighlighterProps, type PdfHighlighterUtils, PdfLoader, type PdfLoaderProps, type PdfScaleValue, type PdfSelection, type Scaled, type ScaledPosition, ShapeCanvas, type ShapeCanvasProps, type ShapeData, ShapeHighlight, type ShapeHighlightProps, type ShapeStyle, type ShapeType, SignaturePad, type SignaturePadProps, TextHighlight, type TextHighlightProps, type TextHighlightStyle, type Tip, type ViewportHighlight, type ViewportPosition, exportPdf, scaledPositionToViewport, useHighlightContainerContext, usePdfHighlighterContext, viewportPositionToScaled };
1444
+ /** Style configuration for outline items */
1445
+ interface OutlineItemStyles {
1446
+ /** Container styles for the item row */
1447
+ container?: React.CSSProperties;
1448
+ /** Container styles when item is hovered */
1449
+ containerHover?: React.CSSProperties;
1450
+ /** Container styles when item is active */
1451
+ containerActive?: React.CSSProperties;
1452
+ /** Expand/collapse button styles */
1453
+ expandButton?: React.CSSProperties;
1454
+ /** Expand/collapse icon styles */
1455
+ expandIcon?: React.CSSProperties;
1456
+ /** Active indicator dot styles */
1457
+ activeIndicator?: React.CSSProperties;
1458
+ /** Title text styles */
1459
+ title?: React.CSSProperties;
1460
+ /** Title text styles when active */
1461
+ titleActive?: React.CSSProperties;
1462
+ /** Page number styles */
1463
+ pageNumber?: React.CSSProperties;
1464
+ /** Page number styles when active */
1465
+ pageNumberActive?: React.CSSProperties;
1466
+ /** Children container styles */
1467
+ childrenContainer?: React.CSSProperties;
1468
+ }
1469
+ /** Class name configuration for outline items (Tailwind-friendly) */
1470
+ interface OutlineItemClassNames {
1471
+ /** Container class for the item row */
1472
+ container?: string;
1473
+ /** Container class when item is hovered */
1474
+ containerHover?: string;
1475
+ /** Container class when item is active */
1476
+ containerActive?: string;
1477
+ /** Expand/collapse button class */
1478
+ expandButton?: string;
1479
+ /** Expand/collapse icon class */
1480
+ expandIcon?: string;
1481
+ /** Active indicator dot class */
1482
+ activeIndicator?: string;
1483
+ /** Title text class */
1484
+ title?: string;
1485
+ /** Title text class when active */
1486
+ titleActive?: string;
1487
+ /** Page number class */
1488
+ pageNumber?: string;
1489
+ /** Page number class when active */
1490
+ pageNumberActive?: string;
1491
+ /** Children container class */
1492
+ childrenContainer?: string;
1493
+ }
1494
+ interface OutlineItemProps {
1495
+ item: ProcessedOutlineItem;
1496
+ currentPage: number;
1497
+ onNavigate: (item: ProcessedOutlineItem) => void;
1498
+ defaultExpanded?: boolean;
1499
+ showExpandIcons?: boolean;
1500
+ maxDepth?: number;
1501
+ /** Custom styles for the item */
1502
+ styles?: OutlineItemStyles;
1503
+ /** Custom class names for the item (Tailwind-friendly) */
1504
+ classNames?: OutlineItemClassNames;
1505
+ renderItem?: (item: ProcessedOutlineItem, props: OutlineItemRenderProps) => React.ReactNode;
1506
+ }
1507
+ interface OutlineItemRenderProps {
1508
+ isExpanded: boolean;
1509
+ isActive: boolean;
1510
+ level: number;
1511
+ hasChildren: boolean;
1512
+ onToggle: () => void;
1513
+ onNavigate: () => void;
1514
+ }
1515
+ /**
1516
+ * Recursive outline item component with collapsible children.
1517
+ * Clean, modern design with visual hierarchy and smooth interactions.
1518
+ */
1519
+ declare const OutlineItem: React.FC<OutlineItemProps>;
1520
+
1521
+ /** Style configuration for DocumentOutline */
1522
+ interface DocumentOutlineStyles {
1523
+ /** Container styles */
1524
+ container?: React.CSSProperties;
1525
+ /** Loading state container styles */
1526
+ loadingContainer?: React.CSSProperties;
1527
+ /** Loading spinner styles */
1528
+ loadingSpinner?: React.CSSProperties;
1529
+ /** Loading text styles */
1530
+ loadingText?: React.CSSProperties;
1531
+ /** Empty state container styles */
1532
+ emptyContainer?: React.CSSProperties;
1533
+ /** Empty state icon container styles */
1534
+ emptyIconContainer?: React.CSSProperties;
1535
+ /** Empty state icon styles */
1536
+ emptyIcon?: React.CSSProperties;
1537
+ /** Empty state title styles */
1538
+ emptyTitle?: React.CSSProperties;
1539
+ /** Empty state description styles */
1540
+ emptyDescription?: React.CSSProperties;
1541
+ }
1542
+ /** Class name configuration for DocumentOutline (Tailwind-friendly) */
1543
+ interface DocumentOutlineClassNames {
1544
+ /** Container class */
1545
+ container?: string;
1546
+ /** Loading state container class */
1547
+ loadingContainer?: string;
1548
+ /** Loading spinner class */
1549
+ loadingSpinner?: string;
1550
+ /** Loading text class */
1551
+ loadingText?: string;
1552
+ /** Empty state container class */
1553
+ emptyContainer?: string;
1554
+ /** Empty state icon container class */
1555
+ emptyIconContainer?: string;
1556
+ /** Empty state icon class */
1557
+ emptyIcon?: string;
1558
+ /** Empty state title class */
1559
+ emptyTitle?: string;
1560
+ /** Empty state description class */
1561
+ emptyDescription?: string;
1562
+ }
1563
+ interface DocumentOutlineProps {
1564
+ /** Processed outline data */
1565
+ outline: ProcessedOutlineItem[] | null;
1566
+ /** Whether outline is still loading */
1567
+ isLoading?: boolean;
1568
+ /** Current page number for highlighting */
1569
+ currentPage?: number;
1570
+ /** Callback when outline item is clicked */
1571
+ onNavigate: (item: ProcessedOutlineItem) => void;
1572
+ /** Show expand/collapse icons */
1573
+ showExpandIcons?: boolean;
1574
+ /** Default expanded state for all items */
1575
+ defaultExpanded?: boolean;
1576
+ /** Maximum depth to render */
1577
+ maxDepth?: number;
1578
+ /** Custom class name */
1579
+ className?: string;
1580
+ /** Custom styles for the outline */
1581
+ styles?: DocumentOutlineStyles;
1582
+ /** Custom class names for the outline (Tailwind-friendly) */
1583
+ classNames?: DocumentOutlineClassNames;
1584
+ /** Custom styles for outline items */
1585
+ itemStyles?: OutlineItemStyles;
1586
+ /** Custom class names for outline items (Tailwind-friendly) */
1587
+ itemClassNames?: OutlineItemClassNames;
1588
+ /** Custom item renderer */
1589
+ renderItem?: (item: ProcessedOutlineItem, props: OutlineItemRenderProps) => React.ReactNode;
1590
+ /** Empty state content */
1591
+ emptyContent?: React.ReactNode;
1592
+ /** Loading content */
1593
+ loadingContent?: React.ReactNode;
1594
+ }
1595
+ /**
1596
+ * Document outline (table of contents) component.
1597
+ * Displays a hierarchical, navigable table of contents for the PDF.
1598
+ */
1599
+ declare const DocumentOutline: React.FC<DocumentOutlineProps>;
1600
+
1601
+ interface PDFViewer$1 {
1602
+ scrollPageIntoView: (params: {
1603
+ pageNumber: number;
1604
+ }) => void;
1605
+ pagesCount: number;
1606
+ currentPageNumber?: number;
1607
+ }
1608
+ interface PDFLinkService {
1609
+ goToDestination: (dest: unknown) => void;
1610
+ }
1611
+ interface EventBus$1 {
1612
+ on: (event: string, callback: (evt: {
1613
+ pageNumber: number;
1614
+ }) => void) => void;
1615
+ off: (event: string, callback: (evt: {
1616
+ pageNumber: number;
1617
+ }) => void) => void;
1618
+ }
1619
+ /** Theme configuration for LeftPanel styling */
1620
+ interface LeftPanelTheme {
1621
+ /** Background color of the panel */
1622
+ backgroundColor?: string;
1623
+ /** Border color */
1624
+ borderColor?: string;
1625
+ /** Active tab/item accent color */
1626
+ accentColor?: string;
1627
+ /** Text color */
1628
+ textColor?: string;
1629
+ /** Muted text color */
1630
+ mutedTextColor?: string;
1631
+ /** Hover background color */
1632
+ hoverBackgroundColor?: string;
1633
+ }
1634
+ /** Style configuration for tab buttons */
1635
+ interface TabStyles {
1636
+ /** Container styles for the tab bar */
1637
+ container?: React.CSSProperties;
1638
+ /** Tab button styles */
1639
+ tab?: React.CSSProperties;
1640
+ /** Tab button styles when active */
1641
+ tabActive?: React.CSSProperties;
1642
+ /** Tab icon styles */
1643
+ tabIcon?: React.CSSProperties;
1644
+ /** Tab text styles */
1645
+ tabText?: React.CSSProperties;
1646
+ }
1647
+ /** Class name configuration for tab buttons (Tailwind-friendly) */
1648
+ interface TabClassNames {
1649
+ /** Container class for the tab bar */
1650
+ container?: string;
1651
+ /** Tab button class */
1652
+ tab?: string;
1653
+ /** Tab button class when active */
1654
+ tabActive?: string;
1655
+ /** Tab icon class */
1656
+ tabIcon?: string;
1657
+ /** Tab text class */
1658
+ tabText?: string;
1659
+ }
1660
+ /** Style configuration for the footer */
1661
+ interface FooterStyles {
1662
+ /** Footer container styles */
1663
+ container?: React.CSSProperties;
1664
+ /** Footer text styles */
1665
+ text?: React.CSSProperties;
1666
+ }
1667
+ /** Class name configuration for the footer (Tailwind-friendly) */
1668
+ interface FooterClassNames {
1669
+ /** Footer container class */
1670
+ container?: string;
1671
+ /** Footer text class */
1672
+ text?: string;
1673
+ }
1674
+ /** Style configuration for the toggle button */
1675
+ interface ToggleButtonStyles {
1676
+ /** Button container styles */
1677
+ button?: React.CSSProperties;
1678
+ /** Button icon styles */
1679
+ icon?: React.CSSProperties;
1680
+ }
1681
+ /** Class name configuration for the toggle button (Tailwind-friendly) */
1682
+ interface ToggleButtonClassNames {
1683
+ /** Button container class */
1684
+ button?: string;
1685
+ /** Button icon class */
1686
+ icon?: string;
1687
+ }
1688
+ interface LeftPanelProps {
1689
+ /** PDF document from PdfLoader */
1690
+ pdfDocument: PDFDocumentProxy;
1691
+ /** PDF viewer instance */
1692
+ viewer?: PDFViewer$1 | unknown | null;
1693
+ /** PDF link service for navigation */
1694
+ linkService?: PDFLinkService | unknown | null;
1695
+ /** Event bus for page change events */
1696
+ eventBus?: EventBus$1 | unknown | null;
1697
+ /** Whether panel is open */
1698
+ isOpen?: boolean;
1699
+ /** Callback when open state changes */
1700
+ onOpenChange?: (isOpen: boolean) => void;
1701
+ /** Initial active tab */
1702
+ defaultTab?: LeftPanelTab;
1703
+ /** Which tabs to show */
1704
+ tabs?: LeftPanelTab[];
1705
+ /** Panel width when open */
1706
+ width?: number | string;
1707
+ /** Custom class name */
1708
+ className?: string;
1709
+ /** Custom styles */
1710
+ style?: React.CSSProperties;
1711
+ /** Custom outline item renderer */
1712
+ renderOutlineItem?: (item: ProcessedOutlineItem, props: OutlineItemRenderProps) => React.ReactNode;
1713
+ /** Custom thumbnail renderer */
1714
+ renderThumbnail?: (pageNumber: number, thumbnail: ThumbnailData, isActive: boolean) => React.ReactNode;
1715
+ /** Callback when page is selected */
1716
+ onPageSelect?: (pageNumber: number) => void;
1717
+ /** Thumbnail width */
1718
+ thumbnailWidth?: number;
1719
+ /** Children for custom content */
1720
+ children?: React.ReactNode;
1721
+ /** Theme customization */
1722
+ theme?: LeftPanelTheme;
1723
+ /** Show page count in footer */
1724
+ showFooter?: boolean;
1725
+ /** Show toggle button */
1726
+ showToggleButton?: boolean;
1727
+ /** Custom styles for tabs */
1728
+ tabStyles?: TabStyles;
1729
+ /** Custom class names for tabs (Tailwind-friendly) */
1730
+ tabClassNames?: TabClassNames;
1731
+ /** Custom styles for footer */
1732
+ footerStyles?: FooterStyles;
1733
+ /** Custom class names for footer (Tailwind-friendly) */
1734
+ footerClassNames?: FooterClassNames;
1735
+ /** Custom styles for toggle button */
1736
+ toggleButtonStyles?: ToggleButtonStyles;
1737
+ /** Custom class names for toggle button (Tailwind-friendly) */
1738
+ toggleButtonClassNames?: ToggleButtonClassNames;
1739
+ /** Custom styles for document outline */
1740
+ outlineStyles?: DocumentOutlineStyles;
1741
+ /** Custom class names for document outline (Tailwind-friendly) */
1742
+ outlineClassNames?: DocumentOutlineClassNames;
1743
+ /** Custom styles for outline items */
1744
+ outlineItemStyles?: OutlineItemStyles;
1745
+ /** Custom class names for outline items (Tailwind-friendly) */
1746
+ outlineItemClassNames?: OutlineItemClassNames;
1747
+ }
1748
+ /**
1749
+ * Left panel component with Outline and Thumbnails tabs.
1750
+ * Provides a customizable sidebar for PDF navigation with page thumbnails and document outline.
1751
+ */
1752
+ declare const LeftPanel: React.FC<LeftPanelProps>;
1753
+
1754
+ interface ThumbnailPanelProps {
1755
+ /** Total number of pages */
1756
+ totalPages: number;
1757
+ /** Current page number for highlighting */
1758
+ currentPage: number;
1759
+ /** Function to get thumbnail data for a page */
1760
+ getThumbnail: (pageNumber: number) => ThumbnailData;
1761
+ /** Function to load a thumbnail */
1762
+ loadThumbnail: (pageNumber: number) => Promise<void>;
1763
+ /** Callback when thumbnail is clicked */
1764
+ onPageSelect: (pageNumber: number) => void;
1765
+ /** Show page numbers under thumbnails */
1766
+ showPageNumbers?: boolean;
1767
+ /** Custom class name */
1768
+ className?: string;
1769
+ /** Custom thumbnail renderer */
1770
+ renderThumbnail?: (pageNumber: number, thumbnail: ThumbnailData, isActive: boolean) => React.ReactNode;
1771
+ }
1772
+ /**
1773
+ * Panel displaying page thumbnails in a clean, single-column grid layout.
1774
+ * Optimized for easy page navigation with visual feedback.
1775
+ */
1776
+ declare const ThumbnailPanel: React.FC<ThumbnailPanelProps>;
1777
+
1778
+ interface ThumbnailItemProps {
1779
+ pageNumber: number;
1780
+ thumbnail: ThumbnailData;
1781
+ isActive: boolean;
1782
+ onLoad: (pageNumber: number) => void;
1783
+ onClick: (pageNumber: number) => void;
1784
+ showPageNumber?: boolean;
1785
+ className?: string;
1786
+ }
1787
+ /**
1788
+ * Single thumbnail item with lazy loading via IntersectionObserver.
1789
+ * Clean, minimal design with smooth hover and active states.
1790
+ */
1791
+ declare const ThumbnailItem: React.FC<ThumbnailItemProps>;
1792
+
1793
+ /**
1794
+ * Utilities and state available within the LeftPanel context
1795
+ */
1796
+ interface LeftPanelUtils {
1797
+ currentPage: number;
1798
+ totalPages: number;
1799
+ goToPage: (pageNumber: number) => void;
1800
+ goToOutlineItem: (item: ProcessedOutlineItem) => void;
1801
+ pdfDocument: PDFDocumentProxy | null;
1802
+ outline: ProcessedOutlineItem[] | null;
1803
+ hasOutline: boolean;
1804
+ isOutlineLoading: boolean;
1805
+ getThumbnail: (pageNumber: number) => ThumbnailData;
1806
+ loadThumbnail: (pageNumber: number) => Promise<void>;
1807
+ activeTab: LeftPanelTab;
1808
+ setActiveTab: (tab: LeftPanelTab) => void;
1809
+ isOpen: boolean;
1810
+ setIsOpen: (open: boolean) => void;
1811
+ }
1812
+ /**
1813
+ * Hook to access LeftPanel context utilities
1814
+ *
1815
+ * @throws Error if used outside of LeftPanel
1816
+ * @returns LeftPanel utilities
1817
+ */
1818
+ declare const useLeftPanelContext: () => LeftPanelUtils;
1819
+
1820
+ interface UseDocumentOutlineOptions {
1821
+ pdfDocument: PDFDocumentProxy;
1822
+ linkService?: {
1823
+ goToDestination: (dest: unknown) => void;
1824
+ } | unknown | null;
1825
+ }
1826
+ interface UseDocumentOutlineResult {
1827
+ outline: ProcessedOutlineItem[] | null;
1828
+ isLoading: boolean;
1829
+ error: Error | null;
1830
+ navigateToItem: (item: ProcessedOutlineItem) => void;
1831
+ flatOutline: ProcessedOutlineItem[];
1832
+ hasOutline: boolean;
1833
+ }
1834
+ /**
1835
+ * Hook to fetch and process PDF document outline (table of contents)
1836
+ *
1837
+ * @param options - Configuration options
1838
+ * @returns Outline data and navigation utilities
1839
+ */
1840
+ declare function useDocumentOutline(options: UseDocumentOutlineOptions): UseDocumentOutlineResult;
1841
+
1842
+ interface UseThumbnailsOptions {
1843
+ pdfDocument: PDFDocumentProxy;
1844
+ thumbnailWidth?: number;
1845
+ cacheSize?: number;
1846
+ /** If true, preload all thumbnails on mount */
1847
+ preloadAll?: boolean;
1848
+ }
1849
+ interface UseThumbnailsResult {
1850
+ getThumbnail: (pageNumber: number) => ThumbnailData;
1851
+ loadThumbnail: (pageNumber: number) => Promise<void>;
1852
+ preloadThumbnails: (pageNumbers: number[]) => void;
1853
+ clearCache: () => void;
1854
+ totalPages: number;
1855
+ thumbnails: Map<number, ThumbnailData>;
1856
+ }
1857
+ /**
1858
+ * Hook for generating and caching PDF page thumbnails
1859
+ *
1860
+ * @param options - Configuration options
1861
+ * @returns Thumbnail utilities and data
1862
+ */
1863
+ declare function useThumbnails(options: UseThumbnailsOptions): UseThumbnailsResult;
1864
+
1865
+ interface PDFViewer {
1866
+ scrollPageIntoView: (params: {
1867
+ pageNumber: number;
1868
+ }) => void;
1869
+ pagesCount: number;
1870
+ currentPageNumber?: number;
1871
+ }
1872
+ interface EventBus {
1873
+ on: (event: string, callback: (evt: {
1874
+ pageNumber: number;
1875
+ }) => void) => void;
1876
+ off: (event: string, callback: (evt: {
1877
+ pageNumber: number;
1878
+ }) => void) => void;
1879
+ }
1880
+ interface UsePageNavigationOptions {
1881
+ viewer: PDFViewer | unknown | null;
1882
+ eventBus?: EventBus | unknown | null;
1883
+ }
1884
+ interface UsePageNavigationResult {
1885
+ currentPage: number;
1886
+ totalPages: number;
1887
+ goToPage: (pageNumber: number) => void;
1888
+ }
1889
+ /**
1890
+ * Hook for tracking current page and navigating to pages
1891
+ *
1892
+ * @param options - Configuration options
1893
+ * @returns Page navigation utilities
1894
+ */
1895
+ declare function usePageNavigation(options: UsePageNavigationOptions): UsePageNavigationResult;
1896
+
1897
+ export { AreaHighlight, type AreaHighlightProps, type AreaHighlightStyle, type Content, DocumentOutline, type DocumentOutlineClassNames, type DocumentOutlineProps, type DocumentOutlineStyles, DrawingCanvas, type DrawingCanvasProps, DrawingHighlight, type DrawingHighlightProps, type DrawingPoint, type DrawingStroke, type ExportPdfOptions, type ExportableHighlight, type FooterClassNames, type FooterStyles, FreetextHighlight, type FreetextHighlightProps, type FreetextStyle, type GhostHighlight, type Highlight, type HighlightBindings, type HighlightContainerUtils, type HighlightType, ImageHighlight, type ImageHighlightProps, type LTWH, type LTWHP, LeftPanel, type LeftPanelProps, type LeftPanelTab, type LeftPanelTheme, type LeftPanelUtils, MonitoredHighlightContainer, type MonitoredHighlightContainerProps, OutlineItem, type OutlineItemClassNames, type OutlineItemProps, type OutlineItemRenderProps, type OutlineItemStyles, type Page, PdfHighlighter, type PdfHighlighterProps, type PdfHighlighterTheme, type PdfHighlighterUtils, PdfLoader, type PdfLoaderProps, type PdfScaleValue, type PdfSelection, type ProcessedOutlineItem, type Scaled, type ScaledPosition, ShapeCanvas, type ShapeCanvasProps, type ShapeData, ShapeHighlight, type ShapeHighlightProps, type ShapeStyle, type ShapeType, SignaturePad, type SignaturePadProps, type TabClassNames, type TabStyles, TextHighlight, type TextHighlightProps, type TextHighlightStyle, type ThumbnailData, ThumbnailItem, type ThumbnailItemProps, ThumbnailPanel, type ThumbnailPanelProps, type Tip, type ToggleButtonClassNames, type ToggleButtonStyles, type ViewportHighlight, type ViewportPosition, exportPdf, scaledPositionToViewport, useDocumentOutline, useHighlightContainerContext, useLeftPanelContext, usePageNavigation, usePdfHighlighterContext, useThumbnails, viewportPositionToScaled };