pdfjs-reader-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7777 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1292 -0
- package/dist/index.d.ts +1292 -0
- package/dist/index.js +7669 -0
- package/dist/index.js.map +1 -0
- package/package.json +82 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1292 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { Component, ReactNode, ErrorInfo } from 'react';
|
|
3
|
+
import { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist';
|
|
4
|
+
import * as pdfjsDist from 'pdfjs-dist';
|
|
5
|
+
export { pdfjsDist as pdfjsLib };
|
|
6
|
+
import * as zustand from 'zustand';
|
|
7
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
+
import * as pdfjs_dist_types_src_display_api from 'pdfjs-dist/types/src/display/api';
|
|
9
|
+
import { ClassValue } from 'clsx';
|
|
10
|
+
import * as pdfjs_dist_types_src_display_metadata from 'pdfjs-dist/types/src/display/metadata';
|
|
11
|
+
|
|
12
|
+
interface PDFViewerProps {
|
|
13
|
+
/** URL or ArrayBuffer of the PDF file */
|
|
14
|
+
src: string | ArrayBuffer | Uint8Array;
|
|
15
|
+
/** Initial page number (1-indexed) */
|
|
16
|
+
initialPage?: number;
|
|
17
|
+
/** Initial scale/zoom level */
|
|
18
|
+
initialScale?: number | 'page-fit' | 'page-width' | 'auto';
|
|
19
|
+
/** Theme mode */
|
|
20
|
+
theme?: 'light' | 'dark' | 'sepia';
|
|
21
|
+
/** Custom class name */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Whether to show the toolbar */
|
|
24
|
+
showToolbar?: boolean;
|
|
25
|
+
/** Whether to show the sidebar */
|
|
26
|
+
showSidebar?: boolean;
|
|
27
|
+
/** Whether to show the annotation toolbar */
|
|
28
|
+
showAnnotationToolbar?: boolean;
|
|
29
|
+
/** Default sidebar panel */
|
|
30
|
+
defaultSidebarPanel?: SidebarPanel;
|
|
31
|
+
/** View mode for the document */
|
|
32
|
+
viewMode?: ViewMode;
|
|
33
|
+
/** Callback when document is loaded */
|
|
34
|
+
onDocumentLoad?: (document: PDFDocumentLoadedEvent) => void;
|
|
35
|
+
/** Callback when page changes */
|
|
36
|
+
onPageChange?: (page: number) => void;
|
|
37
|
+
/** Callback when scale/zoom changes */
|
|
38
|
+
onScaleChange?: (scale: number) => void;
|
|
39
|
+
/** Callback when text is selected */
|
|
40
|
+
onTextSelect?: (selection: TextSelection) => void;
|
|
41
|
+
/** Callback on error */
|
|
42
|
+
onError?: (error: Error) => void;
|
|
43
|
+
/** Worker source URL for pdf.js */
|
|
44
|
+
workerSrc?: string;
|
|
45
|
+
}
|
|
46
|
+
interface PDFDocumentLoadedEvent {
|
|
47
|
+
numPages: number;
|
|
48
|
+
document: PDFDocumentProxy;
|
|
49
|
+
}
|
|
50
|
+
interface TextSelection {
|
|
51
|
+
text: string;
|
|
52
|
+
pageNumber: number;
|
|
53
|
+
rects: DOMRect[];
|
|
54
|
+
}
|
|
55
|
+
interface PDFPageState {
|
|
56
|
+
pageNumber: number;
|
|
57
|
+
page: PDFPageProxy | null;
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
scale: number;
|
|
61
|
+
rotation: number;
|
|
62
|
+
isRendering: boolean;
|
|
63
|
+
isRendered: boolean;
|
|
64
|
+
error: Error | null;
|
|
65
|
+
}
|
|
66
|
+
interface PageDimensions {
|
|
67
|
+
width: number;
|
|
68
|
+
height: number;
|
|
69
|
+
scale: number;
|
|
70
|
+
}
|
|
71
|
+
type ViewMode = 'single' | 'dual' | 'continuous';
|
|
72
|
+
type ScrollMode = 'single' | 'continuous';
|
|
73
|
+
type SidebarPanel = 'thumbnails' | 'outline' | 'search' | 'annotations' | null;
|
|
74
|
+
type Theme = 'light' | 'dark' | 'sepia';
|
|
75
|
+
interface ViewerState {
|
|
76
|
+
document: PDFDocumentProxy | null;
|
|
77
|
+
numPages: number;
|
|
78
|
+
isLoading: boolean;
|
|
79
|
+
error: Error | null;
|
|
80
|
+
currentPage: number;
|
|
81
|
+
scale: number;
|
|
82
|
+
rotation: number;
|
|
83
|
+
viewMode: ViewMode;
|
|
84
|
+
scrollMode: ScrollMode;
|
|
85
|
+
theme: Theme;
|
|
86
|
+
sidebarOpen: boolean;
|
|
87
|
+
sidebarPanel: SidebarPanel;
|
|
88
|
+
isFullscreen: boolean;
|
|
89
|
+
isPresentationMode: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface ViewerActions {
|
|
92
|
+
setDocument: (doc: PDFDocumentProxy) => void;
|
|
93
|
+
setLoading: (loading: boolean) => void;
|
|
94
|
+
setError: (error: Error | null) => void;
|
|
95
|
+
setCurrentPage: (page: number) => void;
|
|
96
|
+
goToPage: (page: number) => void;
|
|
97
|
+
nextPage: () => void;
|
|
98
|
+
previousPage: () => void;
|
|
99
|
+
setScale: (scale: number) => void;
|
|
100
|
+
zoomIn: () => void;
|
|
101
|
+
zoomOut: () => void;
|
|
102
|
+
fitToWidth: () => void;
|
|
103
|
+
fitToPage: () => void;
|
|
104
|
+
setRotation: (rotation: number) => void;
|
|
105
|
+
rotateClockwise: () => void;
|
|
106
|
+
rotateCounterClockwise: () => void;
|
|
107
|
+
setViewMode: (mode: ViewMode) => void;
|
|
108
|
+
setScrollMode: (mode: ScrollMode) => void;
|
|
109
|
+
setTheme: (theme: Theme) => void;
|
|
110
|
+
toggleSidebar: () => void;
|
|
111
|
+
setSidebarPanel: (panel: SidebarPanel) => void;
|
|
112
|
+
setFullscreen: (fullscreen: boolean) => void;
|
|
113
|
+
reset: () => void;
|
|
114
|
+
}
|
|
115
|
+
interface Highlight {
|
|
116
|
+
id: string;
|
|
117
|
+
pageNumber: number;
|
|
118
|
+
rects: HighlightRect[];
|
|
119
|
+
color: HighlightColor;
|
|
120
|
+
text: string;
|
|
121
|
+
comment?: string;
|
|
122
|
+
createdAt: Date;
|
|
123
|
+
updatedAt: Date;
|
|
124
|
+
}
|
|
125
|
+
interface HighlightRect {
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
width: number;
|
|
129
|
+
height: number;
|
|
130
|
+
}
|
|
131
|
+
type HighlightColor = 'yellow' | 'green' | 'blue' | 'pink' | 'orange';
|
|
132
|
+
type AnnotationType = 'note' | 'drawing' | 'shape' | 'stamp';
|
|
133
|
+
interface BaseAnnotation {
|
|
134
|
+
id: string;
|
|
135
|
+
type: AnnotationType;
|
|
136
|
+
pageNumber: number;
|
|
137
|
+
createdAt: Date;
|
|
138
|
+
updatedAt: Date;
|
|
139
|
+
}
|
|
140
|
+
interface NoteAnnotation extends BaseAnnotation {
|
|
141
|
+
type: 'note';
|
|
142
|
+
x: number;
|
|
143
|
+
y: number;
|
|
144
|
+
content: string;
|
|
145
|
+
color: string;
|
|
146
|
+
}
|
|
147
|
+
interface DrawingAnnotation extends BaseAnnotation {
|
|
148
|
+
type: 'drawing';
|
|
149
|
+
paths: DrawingPath[];
|
|
150
|
+
color: string;
|
|
151
|
+
strokeWidth: number;
|
|
152
|
+
}
|
|
153
|
+
interface DrawingPath {
|
|
154
|
+
points: {
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
}[];
|
|
158
|
+
}
|
|
159
|
+
interface ShapeAnnotation extends BaseAnnotation {
|
|
160
|
+
type: 'shape';
|
|
161
|
+
shapeType: 'rect' | 'circle' | 'arrow' | 'line';
|
|
162
|
+
x: number;
|
|
163
|
+
y: number;
|
|
164
|
+
width: number;
|
|
165
|
+
height: number;
|
|
166
|
+
color: string;
|
|
167
|
+
strokeWidth: number;
|
|
168
|
+
}
|
|
169
|
+
type Annotation = NoteAnnotation | DrawingAnnotation | ShapeAnnotation;
|
|
170
|
+
interface SearchResult {
|
|
171
|
+
pageNumber: number;
|
|
172
|
+
matchIndex: number;
|
|
173
|
+
text: string;
|
|
174
|
+
rects: HighlightRect[];
|
|
175
|
+
}
|
|
176
|
+
interface SearchState {
|
|
177
|
+
query: string;
|
|
178
|
+
results: SearchResult[];
|
|
179
|
+
currentResultIndex: number;
|
|
180
|
+
isSearching: boolean;
|
|
181
|
+
caseSensitive: boolean;
|
|
182
|
+
wholeWord: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface OutlineItem {
|
|
185
|
+
title: string;
|
|
186
|
+
pageNumber: number;
|
|
187
|
+
children: OutlineItem[];
|
|
188
|
+
expanded?: boolean;
|
|
189
|
+
}
|
|
190
|
+
interface Plugin {
|
|
191
|
+
name: string;
|
|
192
|
+
version: string;
|
|
193
|
+
initialize?: (api: PluginAPI) => void | Promise<void>;
|
|
194
|
+
destroy?: () => void | Promise<void>;
|
|
195
|
+
}
|
|
196
|
+
interface PluginAPI {
|
|
197
|
+
viewer: ViewerState & ViewerActions;
|
|
198
|
+
registerToolbarItem: (item: ToolbarItem) => void;
|
|
199
|
+
registerSidebarPanel: (panel: SidebarPanelConfig) => void;
|
|
200
|
+
registerContextMenuItem: (item: ContextMenuItem) => void;
|
|
201
|
+
}
|
|
202
|
+
interface ToolbarItem {
|
|
203
|
+
id: string;
|
|
204
|
+
position: 'left' | 'center' | 'right';
|
|
205
|
+
render: () => React.ReactNode;
|
|
206
|
+
order?: number;
|
|
207
|
+
}
|
|
208
|
+
interface SidebarPanelConfig {
|
|
209
|
+
id: string;
|
|
210
|
+
title: string;
|
|
211
|
+
icon: React.ReactNode;
|
|
212
|
+
render: () => React.ReactNode;
|
|
213
|
+
}
|
|
214
|
+
interface ContextMenuItem {
|
|
215
|
+
id: string;
|
|
216
|
+
label: string;
|
|
217
|
+
icon?: React.ReactNode;
|
|
218
|
+
onClick: () => void;
|
|
219
|
+
condition?: () => boolean;
|
|
220
|
+
}
|
|
221
|
+
interface PDFViewerEventMap {
|
|
222
|
+
pagechange: {
|
|
223
|
+
pageNumber: number;
|
|
224
|
+
};
|
|
225
|
+
scalechange: {
|
|
226
|
+
scale: number;
|
|
227
|
+
};
|
|
228
|
+
documentload: PDFDocumentLoadedEvent;
|
|
229
|
+
textselect: TextSelection;
|
|
230
|
+
error: Error;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Main PDF Viewer component.
|
|
235
|
+
*
|
|
236
|
+
* This component is SSR-safe and will only render on the client side.
|
|
237
|
+
* It uses React.lazy and Suspense to defer loading of the PDF viewer
|
|
238
|
+
* which depends on browser APIs.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```tsx
|
|
242
|
+
* import { PDFViewer } from '@pdf-reader/core';
|
|
243
|
+
*
|
|
244
|
+
* function App() {
|
|
245
|
+
* return (
|
|
246
|
+
* <PDFViewer
|
|
247
|
+
* src="/document.pdf"
|
|
248
|
+
* showToolbar
|
|
249
|
+
* showSidebar
|
|
250
|
+
* onDocumentLoad={(doc) => console.log('Loaded', doc.numPages, 'pages')}
|
|
251
|
+
* />
|
|
252
|
+
* );
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare const PDFViewer: react.NamedExoticComponent<PDFViewerProps>;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* SSR-safe PDF Viewer component.
|
|
260
|
+
* Wraps the inner viewer with the context provider.
|
|
261
|
+
*/
|
|
262
|
+
declare const PDFViewerClient: react.NamedExoticComponent<PDFViewerProps>;
|
|
263
|
+
|
|
264
|
+
interface DocumentContainerProps {
|
|
265
|
+
className?: string;
|
|
266
|
+
/** Enable touch gestures for mobile */
|
|
267
|
+
enableTouchGestures?: boolean;
|
|
268
|
+
}
|
|
269
|
+
declare const DocumentContainer: react.NamedExoticComponent<DocumentContainerProps>;
|
|
270
|
+
|
|
271
|
+
interface VirtualizedDocumentContainerProps {
|
|
272
|
+
/** Number of pages to render above/below viewport */
|
|
273
|
+
overscan?: number;
|
|
274
|
+
/** Gap between pages in pixels */
|
|
275
|
+
pageGap?: number;
|
|
276
|
+
/** Enable touch gestures */
|
|
277
|
+
enableTouchGestures?: boolean;
|
|
278
|
+
className?: string;
|
|
279
|
+
}
|
|
280
|
+
declare const VirtualizedDocumentContainer: react.NamedExoticComponent<VirtualizedDocumentContainerProps>;
|
|
281
|
+
|
|
282
|
+
interface ContinuousScrollContainerProps extends VirtualizedDocumentContainerProps {
|
|
283
|
+
/** Scroll to page smoothly */
|
|
284
|
+
smoothScroll?: boolean;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* ContinuousScrollContainer is a convenience wrapper around VirtualizedDocumentContainer
|
|
288
|
+
* that provides continuous scrolling behavior with all pages visible in a single
|
|
289
|
+
* scrollable view.
|
|
290
|
+
*
|
|
291
|
+
* Features:
|
|
292
|
+
* - All pages rendered in a continuous scroll view
|
|
293
|
+
* - Virtualized rendering for performance (only visible pages + buffer are rendered)
|
|
294
|
+
* - Automatic page tracking based on scroll position
|
|
295
|
+
* - Scroll-to-page functionality
|
|
296
|
+
* - Memory management (unloads distant pages)
|
|
297
|
+
*/
|
|
298
|
+
declare const ContinuousScrollContainer: react.NamedExoticComponent<ContinuousScrollContainerProps>;
|
|
299
|
+
|
|
300
|
+
interface DualPageContainerProps {
|
|
301
|
+
/** Show the first page alone (like a book cover) */
|
|
302
|
+
showCover?: boolean;
|
|
303
|
+
/** Book spread mode: odd pages on right side */
|
|
304
|
+
bookSpread?: boolean;
|
|
305
|
+
/** Gap between the two pages */
|
|
306
|
+
pageGap?: number;
|
|
307
|
+
/** Enable touch gestures */
|
|
308
|
+
enableTouchGestures?: boolean;
|
|
309
|
+
className?: string;
|
|
310
|
+
}
|
|
311
|
+
declare const DualPageContainer: react.NamedExoticComponent<DualPageContainerProps>;
|
|
312
|
+
|
|
313
|
+
interface PDFPageProps {
|
|
314
|
+
pageNumber: number;
|
|
315
|
+
page: PDFPageProxy | null;
|
|
316
|
+
scale: number;
|
|
317
|
+
rotation: number;
|
|
318
|
+
className?: string;
|
|
319
|
+
showTextLayer?: boolean;
|
|
320
|
+
showHighlightLayer?: boolean;
|
|
321
|
+
showAnnotationLayer?: boolean;
|
|
322
|
+
onPageLoad?: (page: PDFPageProxy) => void;
|
|
323
|
+
onRenderComplete?: () => void;
|
|
324
|
+
onRenderError?: (error: Error) => void;
|
|
325
|
+
onAnnotationClick?: (annotation: Annotation) => void;
|
|
326
|
+
onPageClick?: (pageNumber: number, point: {
|
|
327
|
+
x: number;
|
|
328
|
+
y: number;
|
|
329
|
+
}) => void;
|
|
330
|
+
}
|
|
331
|
+
declare const PDFPage: react.NamedExoticComponent<PDFPageProps>;
|
|
332
|
+
|
|
333
|
+
interface CanvasLayerProps {
|
|
334
|
+
page: PDFPageProxy;
|
|
335
|
+
scale: number;
|
|
336
|
+
rotation: number;
|
|
337
|
+
className?: string;
|
|
338
|
+
onRenderStart?: () => void;
|
|
339
|
+
onRenderComplete?: () => void;
|
|
340
|
+
onRenderError?: (error: Error) => void;
|
|
341
|
+
}
|
|
342
|
+
declare const CanvasLayer: react.NamedExoticComponent<CanvasLayerProps>;
|
|
343
|
+
|
|
344
|
+
interface TextLayerProps {
|
|
345
|
+
page: PDFPageProxy;
|
|
346
|
+
scale: number;
|
|
347
|
+
rotation: number;
|
|
348
|
+
className?: string;
|
|
349
|
+
}
|
|
350
|
+
declare const TextLayer: react.NamedExoticComponent<TextLayerProps>;
|
|
351
|
+
|
|
352
|
+
interface HighlightLayerProps {
|
|
353
|
+
highlights: Highlight[];
|
|
354
|
+
scale: number;
|
|
355
|
+
selectedId?: string | null;
|
|
356
|
+
onHighlightClick?: (highlight: Highlight) => void;
|
|
357
|
+
className?: string;
|
|
358
|
+
}
|
|
359
|
+
declare const HighlightLayer: react.NamedExoticComponent<HighlightLayerProps>;
|
|
360
|
+
|
|
361
|
+
interface AnnotationLayerProps {
|
|
362
|
+
pageNumber: number;
|
|
363
|
+
annotations: Annotation[];
|
|
364
|
+
scale: number;
|
|
365
|
+
selectedId?: string | null;
|
|
366
|
+
isDrawing?: boolean;
|
|
367
|
+
currentDrawingPath?: DrawingPath | null;
|
|
368
|
+
drawingColor?: string;
|
|
369
|
+
drawingStrokeWidth?: number;
|
|
370
|
+
activeAnnotationTool?: 'note' | 'draw' | 'shape' | null;
|
|
371
|
+
onAnnotationClick?: (annotation: Annotation) => void;
|
|
372
|
+
onNoteClick?: (annotation: Annotation, event: {
|
|
373
|
+
x: number;
|
|
374
|
+
y: number;
|
|
375
|
+
}) => void;
|
|
376
|
+
onDrawStart?: (point: {
|
|
377
|
+
x: number;
|
|
378
|
+
y: number;
|
|
379
|
+
}) => void;
|
|
380
|
+
onDrawMove?: (point: {
|
|
381
|
+
x: number;
|
|
382
|
+
y: number;
|
|
383
|
+
}) => void;
|
|
384
|
+
onDrawEnd?: () => void;
|
|
385
|
+
onPageClick?: (point: {
|
|
386
|
+
x: number;
|
|
387
|
+
y: number;
|
|
388
|
+
}) => void;
|
|
389
|
+
className?: string;
|
|
390
|
+
}
|
|
391
|
+
declare const AnnotationLayer: react.NamedExoticComponent<AnnotationLayerProps>;
|
|
392
|
+
|
|
393
|
+
interface ToolbarProps {
|
|
394
|
+
className?: string;
|
|
395
|
+
showNavigation?: boolean;
|
|
396
|
+
showZoom?: boolean;
|
|
397
|
+
showRotation?: boolean;
|
|
398
|
+
showTheme?: boolean;
|
|
399
|
+
showSidebar?: boolean;
|
|
400
|
+
showFullscreen?: boolean;
|
|
401
|
+
}
|
|
402
|
+
declare const Toolbar: react.NamedExoticComponent<ToolbarProps>;
|
|
403
|
+
|
|
404
|
+
interface MobileToolbarProps {
|
|
405
|
+
currentPage: number;
|
|
406
|
+
totalPages: number;
|
|
407
|
+
onPreviousPage: () => void;
|
|
408
|
+
onNextPage: () => void;
|
|
409
|
+
onGoToPage: (page: number) => void;
|
|
410
|
+
scale: number;
|
|
411
|
+
onZoomIn: () => void;
|
|
412
|
+
onZoomOut: () => void;
|
|
413
|
+
onToggleSidebar: () => void;
|
|
414
|
+
sidebarOpen: boolean;
|
|
415
|
+
theme: 'light' | 'dark' | 'sepia';
|
|
416
|
+
onThemeChange: (theme: 'light' | 'dark' | 'sepia') => void;
|
|
417
|
+
position?: 'top' | 'bottom';
|
|
418
|
+
className?: string;
|
|
419
|
+
}
|
|
420
|
+
declare const MobileToolbar: react.NamedExoticComponent<MobileToolbarProps>;
|
|
421
|
+
|
|
422
|
+
interface SidebarProps {
|
|
423
|
+
className?: string;
|
|
424
|
+
width?: number;
|
|
425
|
+
}
|
|
426
|
+
declare const Sidebar: react.NamedExoticComponent<SidebarProps>;
|
|
427
|
+
|
|
428
|
+
interface MobileSidebarProps {
|
|
429
|
+
isOpen: boolean;
|
|
430
|
+
onClose: () => void;
|
|
431
|
+
activePanel: SidebarPanel;
|
|
432
|
+
onPanelChange: (panel: SidebarPanel) => void;
|
|
433
|
+
children: React.ReactNode;
|
|
434
|
+
className?: string;
|
|
435
|
+
}
|
|
436
|
+
declare const MobileSidebar: react.NamedExoticComponent<MobileSidebarProps>;
|
|
437
|
+
|
|
438
|
+
interface ThumbnailPanelProps {
|
|
439
|
+
className?: string;
|
|
440
|
+
thumbnailScale?: number;
|
|
441
|
+
}
|
|
442
|
+
declare const ThumbnailPanel: react.NamedExoticComponent<ThumbnailPanelProps>;
|
|
443
|
+
|
|
444
|
+
interface SearchPanelProps {
|
|
445
|
+
className?: string;
|
|
446
|
+
}
|
|
447
|
+
declare const SearchPanel: react.NamedExoticComponent<SearchPanelProps>;
|
|
448
|
+
|
|
449
|
+
interface OutlinePanelProps {
|
|
450
|
+
className?: string;
|
|
451
|
+
}
|
|
452
|
+
declare const OutlinePanel: react.NamedExoticComponent<OutlinePanelProps>;
|
|
453
|
+
|
|
454
|
+
interface HighlightsPanelProps {
|
|
455
|
+
className?: string;
|
|
456
|
+
/** Callback when a highlight item is clicked */
|
|
457
|
+
onHighlightClick?: (highlight: Highlight) => void;
|
|
458
|
+
}
|
|
459
|
+
declare const HighlightsPanel: react.NamedExoticComponent<HighlightsPanelProps>;
|
|
460
|
+
|
|
461
|
+
interface SelectionToolbarProps {
|
|
462
|
+
/** Current text selection */
|
|
463
|
+
selection: TextSelection | null;
|
|
464
|
+
/** Callback when a color is clicked to create highlight */
|
|
465
|
+
onCreateHighlight: (color: HighlightColor) => void;
|
|
466
|
+
/** Callback when copy button is clicked */
|
|
467
|
+
onCopy?: () => void;
|
|
468
|
+
/** Active/default highlight color */
|
|
469
|
+
activeColor?: HighlightColor;
|
|
470
|
+
/** Additional class name */
|
|
471
|
+
className?: string;
|
|
472
|
+
}
|
|
473
|
+
declare const SelectionToolbar: react.NamedExoticComponent<SelectionToolbarProps>;
|
|
474
|
+
|
|
475
|
+
interface HighlightPopoverProps {
|
|
476
|
+
/** The highlight to show the popover for */
|
|
477
|
+
highlight: Highlight | null;
|
|
478
|
+
/** The scale of the PDF page */
|
|
479
|
+
scale: number;
|
|
480
|
+
/** The page element containing the highlight */
|
|
481
|
+
pageElement: HTMLElement | null;
|
|
482
|
+
/** Callback when color is changed */
|
|
483
|
+
onColorChange: (id: string, color: HighlightColor) => void;
|
|
484
|
+
/** Callback when comment is updated */
|
|
485
|
+
onCommentChange: (id: string, comment: string) => void;
|
|
486
|
+
/** Callback when delete is clicked */
|
|
487
|
+
onDelete: (id: string) => void;
|
|
488
|
+
/** Callback when copy is clicked */
|
|
489
|
+
onCopy?: (text: string) => void;
|
|
490
|
+
/** Callback when popover is closed */
|
|
491
|
+
onClose: () => void;
|
|
492
|
+
/** Additional class name */
|
|
493
|
+
className?: string;
|
|
494
|
+
}
|
|
495
|
+
declare const HighlightPopover: react.NamedExoticComponent<HighlightPopoverProps>;
|
|
496
|
+
|
|
497
|
+
type AnnotationTool = 'note' | 'draw' | 'shape' | null;
|
|
498
|
+
type ShapeType = 'rect' | 'circle' | 'arrow' | 'line';
|
|
499
|
+
interface AnnotationState {
|
|
500
|
+
highlights: Highlight[];
|
|
501
|
+
annotations: Annotation[];
|
|
502
|
+
selectedHighlightId: string | null;
|
|
503
|
+
selectedAnnotationId: string | null;
|
|
504
|
+
activeHighlightColor: HighlightColor;
|
|
505
|
+
isHighlightMode: boolean;
|
|
506
|
+
isAnnotationMode: boolean;
|
|
507
|
+
activeAnnotationTool: AnnotationTool;
|
|
508
|
+
activeShapeType: ShapeType;
|
|
509
|
+
drawingColor: string;
|
|
510
|
+
drawingStrokeWidth: number;
|
|
511
|
+
currentDrawingPath: DrawingPath | null;
|
|
512
|
+
currentDrawingPage: number | null;
|
|
513
|
+
}
|
|
514
|
+
interface AnnotationActions {
|
|
515
|
+
addHighlight: (highlight: Omit<Highlight, 'id' | 'createdAt' | 'updatedAt'>) => Highlight;
|
|
516
|
+
updateHighlight: (id: string, updates: Partial<Highlight>) => void;
|
|
517
|
+
removeHighlight: (id: string) => void;
|
|
518
|
+
selectHighlight: (id: string | null) => void;
|
|
519
|
+
setActiveHighlightColor: (color: HighlightColor) => void;
|
|
520
|
+
getHighlightsByPage: (pageNumber: number) => Highlight[];
|
|
521
|
+
addAnnotation: (annotation: Omit<Annotation, 'id' | 'createdAt' | 'updatedAt'>) => Annotation;
|
|
522
|
+
updateAnnotation: (id: string, updates: Partial<Annotation>) => void;
|
|
523
|
+
removeAnnotation: (id: string) => void;
|
|
524
|
+
selectAnnotation: (id: string | null) => void;
|
|
525
|
+
getAnnotationsByPage: (pageNumber: number) => Annotation[];
|
|
526
|
+
setHighlightMode: (enabled: boolean) => void;
|
|
527
|
+
setAnnotationMode: (enabled: boolean) => void;
|
|
528
|
+
setActiveAnnotationTool: (tool: AnnotationTool) => void;
|
|
529
|
+
setActiveShapeType: (shapeType: ShapeType) => void;
|
|
530
|
+
setDrawingColor: (color: string) => void;
|
|
531
|
+
setDrawingStrokeWidth: (width: number) => void;
|
|
532
|
+
startDrawing: (pageNumber: number, point: {
|
|
533
|
+
x: number;
|
|
534
|
+
y: number;
|
|
535
|
+
}) => void;
|
|
536
|
+
addDrawingPoint: (point: {
|
|
537
|
+
x: number;
|
|
538
|
+
y: number;
|
|
539
|
+
}) => void;
|
|
540
|
+
finishDrawing: () => Annotation | null;
|
|
541
|
+
cancelDrawing: () => void;
|
|
542
|
+
exportHighlights: () => string;
|
|
543
|
+
importHighlights: (json: string) => void;
|
|
544
|
+
exportAnnotations: () => string;
|
|
545
|
+
importAnnotations: (json: string) => void;
|
|
546
|
+
clearAll: () => void;
|
|
547
|
+
}
|
|
548
|
+
type AnnotationStore = AnnotationState & AnnotationActions;
|
|
549
|
+
declare function createAnnotationStore(initialOverrides?: Partial<AnnotationState>): zustand.StoreApi<AnnotationStore>;
|
|
550
|
+
type AnnotationStoreApi = ReturnType<typeof createAnnotationStore>;
|
|
551
|
+
|
|
552
|
+
interface AnnotationToolbarProps {
|
|
553
|
+
/** Override the active tool from store */
|
|
554
|
+
activeTool?: AnnotationTool;
|
|
555
|
+
/** Override the active shape type from store */
|
|
556
|
+
activeShapeType?: ShapeType;
|
|
557
|
+
/** Override the drawing color from store */
|
|
558
|
+
drawingColor?: string;
|
|
559
|
+
/** Override the stroke width from store */
|
|
560
|
+
strokeWidth?: number;
|
|
561
|
+
/** Custom tool change handler */
|
|
562
|
+
onToolChange?: (tool: AnnotationTool) => void;
|
|
563
|
+
/** Custom shape type change handler */
|
|
564
|
+
onShapeTypeChange?: (shapeType: ShapeType) => void;
|
|
565
|
+
/** Custom color change handler */
|
|
566
|
+
onColorChange?: (color: string) => void;
|
|
567
|
+
/** Custom stroke width change handler */
|
|
568
|
+
onStrokeWidthChange?: (width: number) => void;
|
|
569
|
+
/** Position of the toolbar */
|
|
570
|
+
position?: 'top' | 'bottom' | 'floating';
|
|
571
|
+
/** Additional class name */
|
|
572
|
+
className?: string;
|
|
573
|
+
}
|
|
574
|
+
declare const AnnotationToolbar: react.NamedExoticComponent<AnnotationToolbarProps>;
|
|
575
|
+
|
|
576
|
+
interface StickyNoteProps {
|
|
577
|
+
note: NoteAnnotation;
|
|
578
|
+
scale: number;
|
|
579
|
+
isSelected?: boolean;
|
|
580
|
+
isEditing?: boolean;
|
|
581
|
+
onSelect?: () => void;
|
|
582
|
+
onUpdate?: (updates: Partial<NoteAnnotation>) => void;
|
|
583
|
+
onDelete?: () => void;
|
|
584
|
+
onStartEdit?: () => void;
|
|
585
|
+
onEndEdit?: () => void;
|
|
586
|
+
onDragStart?: (e: React.MouseEvent | React.TouchEvent) => void;
|
|
587
|
+
className?: string;
|
|
588
|
+
}
|
|
589
|
+
declare const StickyNote: react.NamedExoticComponent<StickyNoteProps>;
|
|
590
|
+
|
|
591
|
+
interface DrawingCanvasProps {
|
|
592
|
+
width: number;
|
|
593
|
+
height: number;
|
|
594
|
+
scale: number;
|
|
595
|
+
color?: string;
|
|
596
|
+
strokeWidth?: number;
|
|
597
|
+
isActive?: boolean;
|
|
598
|
+
onDrawingComplete?: (path: DrawingPath) => void;
|
|
599
|
+
className?: string;
|
|
600
|
+
}
|
|
601
|
+
declare const DrawingCanvas: react.NamedExoticComponent<DrawingCanvasProps>;
|
|
602
|
+
|
|
603
|
+
interface ShapeRendererProps {
|
|
604
|
+
shape: ShapeAnnotation;
|
|
605
|
+
scale: number;
|
|
606
|
+
isSelected?: boolean;
|
|
607
|
+
isEditing?: boolean;
|
|
608
|
+
onSelect?: () => void;
|
|
609
|
+
onUpdate?: (updates: Partial<ShapeAnnotation>) => void;
|
|
610
|
+
onDelete?: () => void;
|
|
611
|
+
className?: string;
|
|
612
|
+
}
|
|
613
|
+
declare const ShapeRenderer: react.NamedExoticComponent<ShapeRendererProps>;
|
|
614
|
+
interface ShapePreviewProps {
|
|
615
|
+
shapeType: 'rect' | 'circle' | 'arrow' | 'line';
|
|
616
|
+
startPoint: {
|
|
617
|
+
x: number;
|
|
618
|
+
y: number;
|
|
619
|
+
};
|
|
620
|
+
endPoint: {
|
|
621
|
+
x: number;
|
|
622
|
+
y: number;
|
|
623
|
+
};
|
|
624
|
+
scale: number;
|
|
625
|
+
color: string;
|
|
626
|
+
strokeWidth: number;
|
|
627
|
+
}
|
|
628
|
+
declare const ShapePreview: react.NamedExoticComponent<ShapePreviewProps>;
|
|
629
|
+
|
|
630
|
+
interface PDFErrorBoundaryProps {
|
|
631
|
+
/** Child components to render */
|
|
632
|
+
children: ReactNode;
|
|
633
|
+
/** Custom fallback UI */
|
|
634
|
+
fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
|
|
635
|
+
/** Callback when an error is caught */
|
|
636
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
637
|
+
/** Whether to show the default error UI */
|
|
638
|
+
showDefaultUI?: boolean;
|
|
639
|
+
className?: string;
|
|
640
|
+
}
|
|
641
|
+
interface PDFErrorBoundaryState {
|
|
642
|
+
hasError: boolean;
|
|
643
|
+
error: Error | null;
|
|
644
|
+
}
|
|
645
|
+
declare class PDFErrorBoundary extends Component<PDFErrorBoundaryProps, PDFErrorBoundaryState> {
|
|
646
|
+
constructor(props: PDFErrorBoundaryProps);
|
|
647
|
+
static getDerivedStateFromError(error: Error): PDFErrorBoundaryState;
|
|
648
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
649
|
+
handleReset: () => void;
|
|
650
|
+
render(): ReactNode;
|
|
651
|
+
}
|
|
652
|
+
interface WithErrorBoundaryProps extends Omit<PDFErrorBoundaryProps, 'children'> {
|
|
653
|
+
component: ReactNode;
|
|
654
|
+
}
|
|
655
|
+
declare function withErrorBoundary({ component, ...props }: WithErrorBoundaryProps): ReactNode;
|
|
656
|
+
|
|
657
|
+
type ViewerStore = ViewerState & ViewerActions;
|
|
658
|
+
declare function createViewerStore(initialOverrides?: Partial<ViewerState>): zustand.StoreApi<ViewerStore>;
|
|
659
|
+
type ViewerStoreApi = ReturnType<typeof createViewerStore>;
|
|
660
|
+
|
|
661
|
+
interface SearchActions {
|
|
662
|
+
setQuery: (query: string) => void;
|
|
663
|
+
search: (document: PDFDocumentProxy) => Promise<void>;
|
|
664
|
+
clearSearch: () => void;
|
|
665
|
+
nextResult: () => void;
|
|
666
|
+
previousResult: () => void;
|
|
667
|
+
goToResult: (index: number) => void;
|
|
668
|
+
toggleCaseSensitive: () => void;
|
|
669
|
+
toggleWholeWord: () => void;
|
|
670
|
+
getCurrentResult: () => SearchResult | null;
|
|
671
|
+
}
|
|
672
|
+
type SearchStore = SearchState & SearchActions;
|
|
673
|
+
declare function createSearchStore(initialOverrides?: Partial<SearchState>): zustand.StoreApi<SearchStore>;
|
|
674
|
+
type SearchStoreApi = ReturnType<typeof createSearchStore>;
|
|
675
|
+
|
|
676
|
+
interface PDFViewerContextValue {
|
|
677
|
+
viewerStore: ViewerStoreApi;
|
|
678
|
+
annotationStore: AnnotationStoreApi;
|
|
679
|
+
searchStore: SearchStoreApi;
|
|
680
|
+
}
|
|
681
|
+
interface PDFViewerProviderProps {
|
|
682
|
+
children: ReactNode;
|
|
683
|
+
initialState?: {
|
|
684
|
+
viewer?: Partial<ViewerState>;
|
|
685
|
+
annotation?: Partial<AnnotationState>;
|
|
686
|
+
search?: Partial<SearchState>;
|
|
687
|
+
};
|
|
688
|
+
theme?: Theme;
|
|
689
|
+
defaultSidebarPanel?: SidebarPanel;
|
|
690
|
+
}
|
|
691
|
+
declare const PDFViewerContext: react.Context<PDFViewerContextValue | null>;
|
|
692
|
+
declare function PDFViewerProvider({ children, initialState, theme, defaultSidebarPanel, }: PDFViewerProviderProps): react_jsx_runtime.JSX.Element;
|
|
693
|
+
/**
|
|
694
|
+
* Hook to access the viewer store.
|
|
695
|
+
* Optionally pass a selector to subscribe to specific state.
|
|
696
|
+
*/
|
|
697
|
+
declare function useViewerStore<T>(selector: (state: ViewerStore) => T): T;
|
|
698
|
+
/**
|
|
699
|
+
* Hook to access the annotation store.
|
|
700
|
+
* Optionally pass a selector to subscribe to specific state.
|
|
701
|
+
*/
|
|
702
|
+
declare function useAnnotationStore<T>(selector: (state: AnnotationStore) => T): T;
|
|
703
|
+
/**
|
|
704
|
+
* Hook to access the search store.
|
|
705
|
+
* Optionally pass a selector to subscribe to specific state.
|
|
706
|
+
*/
|
|
707
|
+
declare function useSearchStore<T>(selector: (state: SearchStore) => T): T;
|
|
708
|
+
/**
|
|
709
|
+
* Hook to access all stores directly (for actions).
|
|
710
|
+
*/
|
|
711
|
+
declare function usePDFViewerStores(): PDFViewerContextValue;
|
|
712
|
+
|
|
713
|
+
type AddHighlightParams = Omit<Highlight, 'id' | 'createdAt' | 'updatedAt'>;
|
|
714
|
+
/**
|
|
715
|
+
* Main unified hook for accessing PDF viewer state and actions.
|
|
716
|
+
* This is the primary API for controlling the viewer.
|
|
717
|
+
*/
|
|
718
|
+
declare function usePDFViewer(): {
|
|
719
|
+
document: pdfjs_dist_types_src_display_api.PDFDocumentProxy | null;
|
|
720
|
+
numPages: number;
|
|
721
|
+
isLoading: boolean;
|
|
722
|
+
error: Error | null;
|
|
723
|
+
currentPage: number;
|
|
724
|
+
goToPage: (page: number) => void;
|
|
725
|
+
nextPage: () => void;
|
|
726
|
+
previousPage: () => void;
|
|
727
|
+
scale: number;
|
|
728
|
+
setScale: (newScale: number) => void;
|
|
729
|
+
zoomIn: () => void;
|
|
730
|
+
zoomOut: () => void;
|
|
731
|
+
fitToWidth: () => void;
|
|
732
|
+
fitToPage: () => void;
|
|
733
|
+
rotation: number;
|
|
734
|
+
rotateClockwise: () => void;
|
|
735
|
+
rotateCounterClockwise: () => void;
|
|
736
|
+
theme: Theme;
|
|
737
|
+
setTheme: (newTheme: Theme) => void;
|
|
738
|
+
viewMode: ViewMode;
|
|
739
|
+
setViewMode: (mode: ViewMode) => void;
|
|
740
|
+
sidebarOpen: boolean;
|
|
741
|
+
toggleSidebar: () => void;
|
|
742
|
+
sidebarPanel: SidebarPanel;
|
|
743
|
+
setSidebarPanel: (panel: SidebarPanel) => void;
|
|
744
|
+
isFullscreen: boolean;
|
|
745
|
+
setFullscreen: (fullscreen: boolean) => void;
|
|
746
|
+
highlights: Highlight[];
|
|
747
|
+
selectedHighlightId: string | null;
|
|
748
|
+
activeHighlightColor: HighlightColor;
|
|
749
|
+
isHighlightMode: boolean;
|
|
750
|
+
addHighlight: (highlight: AddHighlightParams) => Highlight;
|
|
751
|
+
removeHighlight: (id: string) => void;
|
|
752
|
+
setActiveHighlightColor: (color: HighlightColor) => void;
|
|
753
|
+
setHighlightMode: (enabled: boolean) => void;
|
|
754
|
+
annotations: Annotation[];
|
|
755
|
+
searchQuery: string;
|
|
756
|
+
searchResults: SearchResult[];
|
|
757
|
+
currentSearchResult: number;
|
|
758
|
+
isSearching: boolean;
|
|
759
|
+
search: (query: string) => Promise<void>;
|
|
760
|
+
clearSearch: () => void;
|
|
761
|
+
nextSearchResult: () => void;
|
|
762
|
+
previousSearchResult: () => void;
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
interface UsePageNavigationOptions {
|
|
766
|
+
enableKeyboardNavigation?: boolean;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Hook for page navigation functionality.
|
|
770
|
+
*/
|
|
771
|
+
declare function usePageNavigation(options?: UsePageNavigationOptions): {
|
|
772
|
+
currentPage: number;
|
|
773
|
+
numPages: number;
|
|
774
|
+
goToPage: (page: number) => void;
|
|
775
|
+
nextPage: () => void;
|
|
776
|
+
previousPage: () => void;
|
|
777
|
+
goToFirstPage: () => void;
|
|
778
|
+
goToLastPage: () => void;
|
|
779
|
+
canGoNext: boolean;
|
|
780
|
+
canGoPrevious: boolean;
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
interface UseZoomOptions {
|
|
784
|
+
enableWheelZoom?: boolean;
|
|
785
|
+
minScale?: number;
|
|
786
|
+
maxScale?: number;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Hook for zoom functionality.
|
|
790
|
+
*/
|
|
791
|
+
declare function useZoom(options?: UseZoomOptions): {
|
|
792
|
+
scale: number;
|
|
793
|
+
setScale: (newScale: number) => void;
|
|
794
|
+
zoomIn: () => void;
|
|
795
|
+
zoomOut: () => void;
|
|
796
|
+
fitToWidth: () => void;
|
|
797
|
+
fitToPage: () => void;
|
|
798
|
+
resetZoom: () => void;
|
|
799
|
+
setContainerRef: (el: HTMLElement | null) => void;
|
|
800
|
+
scalePercentage: number;
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
interface UseTextSelectionOptions {
|
|
804
|
+
onSelect?: (selection: TextSelection) => void;
|
|
805
|
+
onCopy?: (text: string) => void;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Hook for handling text selection in the PDF viewer.
|
|
809
|
+
*/
|
|
810
|
+
declare function useTextSelection(options?: UseTextSelectionOptions): {
|
|
811
|
+
selection: TextSelection | null;
|
|
812
|
+
isSelecting: boolean;
|
|
813
|
+
clearSelection: () => void;
|
|
814
|
+
copySelection: () => void;
|
|
815
|
+
hasSelection: boolean;
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
interface UseHighlightsOptions {
|
|
819
|
+
/** Callback when a highlight is created */
|
|
820
|
+
onHighlightCreate?: (highlight: Highlight) => void;
|
|
821
|
+
/** Callback when a highlight is updated */
|
|
822
|
+
onHighlightUpdate?: (highlight: Highlight) => void;
|
|
823
|
+
/** Callback when a highlight is deleted */
|
|
824
|
+
onHighlightDelete?: (id: string) => void;
|
|
825
|
+
}
|
|
826
|
+
interface UseHighlightsReturn {
|
|
827
|
+
/** Create a highlight from the current text selection */
|
|
828
|
+
createHighlightFromSelection: (selection: TextSelection, pageElement: HTMLElement, scale: number, color?: HighlightColor) => Highlight | null;
|
|
829
|
+
/**
|
|
830
|
+
* Add a highlight programmatically with coordinates.
|
|
831
|
+
* Coordinates should be in PDF points (not scaled).
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* ```tsx
|
|
835
|
+
* addHighlight({
|
|
836
|
+
* pageNumber: 1,
|
|
837
|
+
* rects: [{ x: 100, y: 200, width: 150, height: 20 }],
|
|
838
|
+
* text: "Highlighted text",
|
|
839
|
+
* color: "yellow"
|
|
840
|
+
* });
|
|
841
|
+
* ```
|
|
842
|
+
*/
|
|
843
|
+
addHighlight: (highlight: {
|
|
844
|
+
pageNumber: number;
|
|
845
|
+
rects: HighlightRect[];
|
|
846
|
+
text: string;
|
|
847
|
+
color?: HighlightColor;
|
|
848
|
+
comment?: string;
|
|
849
|
+
}) => Highlight;
|
|
850
|
+
/** Update an existing highlight */
|
|
851
|
+
updateHighlight: (id: string, updates: Partial<Pick<Highlight, 'color' | 'comment'>>) => void;
|
|
852
|
+
/** Delete a highlight */
|
|
853
|
+
deleteHighlight: (id: string) => void;
|
|
854
|
+
/** Get highlights for a specific page */
|
|
855
|
+
highlightsForPage: (pageNumber: number) => Highlight[];
|
|
856
|
+
/** Get all highlights */
|
|
857
|
+
allHighlights: Highlight[];
|
|
858
|
+
/** Get the currently selected highlight */
|
|
859
|
+
selectedHighlight: Highlight | null;
|
|
860
|
+
/** Select a highlight by ID */
|
|
861
|
+
selectHighlight: (id: string | null) => void;
|
|
862
|
+
/** Get the active highlight color */
|
|
863
|
+
activeColor: HighlightColor;
|
|
864
|
+
/** Set the active highlight color */
|
|
865
|
+
setActiveColor: (color: HighlightColor) => void;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Hook for creating and managing highlights from text selections.
|
|
869
|
+
*/
|
|
870
|
+
declare function useHighlights(options?: UseHighlightsOptions): UseHighlightsReturn;
|
|
871
|
+
|
|
872
|
+
interface UseAnnotationsOptions {
|
|
873
|
+
onAnnotationCreate?: (annotation: Annotation) => void;
|
|
874
|
+
onAnnotationUpdate?: (annotation: Annotation) => void;
|
|
875
|
+
onAnnotationDelete?: (id: string) => void;
|
|
876
|
+
}
|
|
877
|
+
interface UseAnnotationsReturn {
|
|
878
|
+
annotations: Annotation[];
|
|
879
|
+
selectedAnnotation: Annotation | undefined;
|
|
880
|
+
selectedAnnotationId: string | null;
|
|
881
|
+
activeTool: AnnotationTool;
|
|
882
|
+
activeShapeType: ShapeType;
|
|
883
|
+
drawingColor: string;
|
|
884
|
+
drawingStrokeWidth: number;
|
|
885
|
+
isDrawing: boolean;
|
|
886
|
+
currentDrawingPath: {
|
|
887
|
+
points: {
|
|
888
|
+
x: number;
|
|
889
|
+
y: number;
|
|
890
|
+
}[];
|
|
891
|
+
} | null;
|
|
892
|
+
currentDrawingPage: number | null;
|
|
893
|
+
setActiveTool: (tool: AnnotationTool) => void;
|
|
894
|
+
setActiveShapeType: (shapeType: ShapeType) => void;
|
|
895
|
+
setDrawingColor: (color: string) => void;
|
|
896
|
+
setDrawingStrokeWidth: (width: number) => void;
|
|
897
|
+
createNote: (pageNumber: number, x: number, y: number, content?: string, color?: string) => NoteAnnotation;
|
|
898
|
+
updateNote: (id: string, updates: Partial<NoteAnnotation>) => void;
|
|
899
|
+
startDrawing: (pageNumber: number, point: {
|
|
900
|
+
x: number;
|
|
901
|
+
y: number;
|
|
902
|
+
}) => void;
|
|
903
|
+
continueDrawing: (point: {
|
|
904
|
+
x: number;
|
|
905
|
+
y: number;
|
|
906
|
+
}) => void;
|
|
907
|
+
finishDrawing: () => Annotation | null;
|
|
908
|
+
cancelDrawing: () => void;
|
|
909
|
+
/**
|
|
910
|
+
* Create a shape annotation programmatically.
|
|
911
|
+
* Coordinates should be in PDF points (not scaled).
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* ```tsx
|
|
915
|
+
* // Create a red rectangle box annotation
|
|
916
|
+
* createShape({
|
|
917
|
+
* pageNumber: 1,
|
|
918
|
+
* shapeType: 'rect',
|
|
919
|
+
* x: 100,
|
|
920
|
+
* y: 200,
|
|
921
|
+
* width: 150,
|
|
922
|
+
* height: 80,
|
|
923
|
+
* color: '#ef4444',
|
|
924
|
+
* strokeWidth: 2
|
|
925
|
+
* });
|
|
926
|
+
* ```
|
|
927
|
+
*/
|
|
928
|
+
createShape: (options: {
|
|
929
|
+
pageNumber: number;
|
|
930
|
+
shapeType: ShapeType;
|
|
931
|
+
x: number;
|
|
932
|
+
y: number;
|
|
933
|
+
width: number;
|
|
934
|
+
height: number;
|
|
935
|
+
color?: string;
|
|
936
|
+
strokeWidth?: number;
|
|
937
|
+
}) => ShapeAnnotation;
|
|
938
|
+
updateShape: (id: string, updates: Partial<ShapeAnnotation>) => void;
|
|
939
|
+
selectAnnotation: (id: string | null) => void;
|
|
940
|
+
deleteAnnotation: (id: string) => void;
|
|
941
|
+
getAnnotationsByPage: (pageNumber: number) => Annotation[];
|
|
942
|
+
exportAnnotations: () => string;
|
|
943
|
+
importAnnotations: (json: string) => void;
|
|
944
|
+
}
|
|
945
|
+
declare function useAnnotations(options?: UseAnnotationsOptions): UseAnnotationsReturn;
|
|
946
|
+
|
|
947
|
+
interface UseTouchGesturesOptions {
|
|
948
|
+
/** Callback when pinch-to-zoom is detected */
|
|
949
|
+
onPinchZoom?: (scale: number, center: {
|
|
950
|
+
x: number;
|
|
951
|
+
y: number;
|
|
952
|
+
}) => void;
|
|
953
|
+
/** Callback when swipe left is detected */
|
|
954
|
+
onSwipeLeft?: () => void;
|
|
955
|
+
/** Callback when swipe right is detected */
|
|
956
|
+
onSwipeRight?: () => void;
|
|
957
|
+
/** Callback when long press is detected */
|
|
958
|
+
onLongPress?: (position: {
|
|
959
|
+
x: number;
|
|
960
|
+
y: number;
|
|
961
|
+
}) => void;
|
|
962
|
+
/** Callback when double tap is detected */
|
|
963
|
+
onDoubleTap?: (position: {
|
|
964
|
+
x: number;
|
|
965
|
+
y: number;
|
|
966
|
+
}) => void;
|
|
967
|
+
/** Minimum swipe distance in pixels */
|
|
968
|
+
swipeThreshold?: number;
|
|
969
|
+
/** Long press duration in milliseconds */
|
|
970
|
+
longPressDuration?: number;
|
|
971
|
+
/** Double tap max interval in milliseconds */
|
|
972
|
+
doubleTapInterval?: number;
|
|
973
|
+
/** Whether gestures are enabled */
|
|
974
|
+
enabled?: boolean;
|
|
975
|
+
}
|
|
976
|
+
declare function useTouchGestures<T extends HTMLElement = HTMLElement>(options?: UseTouchGesturesOptions): {
|
|
977
|
+
ref: (element: T | null) => void;
|
|
978
|
+
elementRef: react.MutableRefObject<T | null>;
|
|
979
|
+
};
|
|
980
|
+
declare function useIsTouchDevice(): boolean;
|
|
981
|
+
declare function useIsMobile(): boolean;
|
|
982
|
+
|
|
983
|
+
interface PluginManagerOptions {
|
|
984
|
+
/** Callback when a plugin is registered */
|
|
985
|
+
onPluginRegistered?: (plugin: Plugin) => void;
|
|
986
|
+
/** Callback when a plugin is unregistered */
|
|
987
|
+
onPluginUnregistered?: (name: string) => void;
|
|
988
|
+
/** Callback when toolbar items change */
|
|
989
|
+
onToolbarItemsChanged?: (items: ToolbarItem[]) => void;
|
|
990
|
+
/** Callback when sidebar panels change */
|
|
991
|
+
onSidebarPanelsChanged?: (panels: SidebarPanelConfig[]) => void;
|
|
992
|
+
/** Callback when context menu items change */
|
|
993
|
+
onContextMenuItemsChanged?: (items: ContextMenuItem[]) => void;
|
|
994
|
+
}
|
|
995
|
+
declare class PluginManager {
|
|
996
|
+
private plugins;
|
|
997
|
+
private toolbarItems;
|
|
998
|
+
private sidebarPanels;
|
|
999
|
+
private contextMenuItems;
|
|
1000
|
+
private viewerStateGetter;
|
|
1001
|
+
private options;
|
|
1002
|
+
constructor(options?: PluginManagerOptions);
|
|
1003
|
+
/**
|
|
1004
|
+
* Set the getter function for viewer state
|
|
1005
|
+
*/
|
|
1006
|
+
setViewerStateGetter(getter: () => ViewerState & ViewerActions): void;
|
|
1007
|
+
/**
|
|
1008
|
+
* Create the plugin API for a specific plugin
|
|
1009
|
+
*/
|
|
1010
|
+
private createPluginAPI;
|
|
1011
|
+
/**
|
|
1012
|
+
* Register a plugin
|
|
1013
|
+
*/
|
|
1014
|
+
register(plugin: Plugin): Promise<void>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Unregister a plugin
|
|
1017
|
+
*/
|
|
1018
|
+
unregister(name: string): Promise<void>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Get a registered plugin by name
|
|
1021
|
+
*/
|
|
1022
|
+
getPlugin(name: string): Plugin | undefined;
|
|
1023
|
+
/**
|
|
1024
|
+
* Get all registered plugins
|
|
1025
|
+
*/
|
|
1026
|
+
getAllPlugins(): Plugin[];
|
|
1027
|
+
/**
|
|
1028
|
+
* Check if a plugin is registered
|
|
1029
|
+
*/
|
|
1030
|
+
hasPlugin(name: string): boolean;
|
|
1031
|
+
/**
|
|
1032
|
+
* Get all toolbar items from all plugins
|
|
1033
|
+
*/
|
|
1034
|
+
getToolbarItems(): ToolbarItem[];
|
|
1035
|
+
/**
|
|
1036
|
+
* Get toolbar items by position
|
|
1037
|
+
*/
|
|
1038
|
+
getToolbarItemsByPosition(position: 'left' | 'center' | 'right'): ToolbarItem[];
|
|
1039
|
+
/**
|
|
1040
|
+
* Get all sidebar panels from all plugins
|
|
1041
|
+
*/
|
|
1042
|
+
getSidebarPanels(): SidebarPanelConfig[];
|
|
1043
|
+
/**
|
|
1044
|
+
* Get all context menu items from all plugins
|
|
1045
|
+
*/
|
|
1046
|
+
getContextMenuItems(): ContextMenuItem[];
|
|
1047
|
+
/**
|
|
1048
|
+
* Destroy all plugins and clean up
|
|
1049
|
+
*/
|
|
1050
|
+
destroy(): Promise<void>;
|
|
1051
|
+
private notifyToolbarItemsChanged;
|
|
1052
|
+
private notifySidebarPanelsChanged;
|
|
1053
|
+
private notifyContextMenuItemsChanged;
|
|
1054
|
+
}
|
|
1055
|
+
declare function getPluginManager(): PluginManager;
|
|
1056
|
+
declare function createPluginManager(options?: PluginManagerOptions): PluginManager;
|
|
1057
|
+
|
|
1058
|
+
interface UsePluginsOptions extends PluginManagerOptions {
|
|
1059
|
+
/** Initial plugins to register */
|
|
1060
|
+
initialPlugins?: Plugin[];
|
|
1061
|
+
}
|
|
1062
|
+
interface UsePluginsReturn {
|
|
1063
|
+
/** The plugin manager instance */
|
|
1064
|
+
pluginManager: PluginManager;
|
|
1065
|
+
/** All registered plugins */
|
|
1066
|
+
plugins: Plugin[];
|
|
1067
|
+
/** Toolbar items from plugins */
|
|
1068
|
+
toolbarItems: ToolbarItem[];
|
|
1069
|
+
/** Sidebar panels from plugins */
|
|
1070
|
+
sidebarPanels: SidebarPanelConfig[];
|
|
1071
|
+
/** Context menu items from plugins */
|
|
1072
|
+
contextMenuItems: ContextMenuItem[];
|
|
1073
|
+
/** Register a plugin */
|
|
1074
|
+
registerPlugin: (plugin: Plugin) => Promise<void>;
|
|
1075
|
+
/** Unregister a plugin by name */
|
|
1076
|
+
unregisterPlugin: (name: string) => Promise<void>;
|
|
1077
|
+
/** Check if a plugin is registered */
|
|
1078
|
+
hasPlugin: (name: string) => boolean;
|
|
1079
|
+
}
|
|
1080
|
+
declare function usePlugins(options?: UsePluginsOptions): UsePluginsReturn;
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Utility for merging class names with support for conditionals.
|
|
1084
|
+
* Uses clsx under the hood.
|
|
1085
|
+
*/
|
|
1086
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
1087
|
+
|
|
1088
|
+
interface PDFJSInitOptions {
|
|
1089
|
+
/** Custom worker source URL */
|
|
1090
|
+
workerSrc?: string;
|
|
1091
|
+
/** Whether to use the fake worker (for testing) */
|
|
1092
|
+
useFakeWorker?: boolean;
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Initialize pdf.js with the worker.
|
|
1096
|
+
* This should be called before loading any PDFs.
|
|
1097
|
+
*/
|
|
1098
|
+
declare function initializePDFJS(options?: PDFJSInitOptions): Promise<void>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Check if pdf.js is initialized
|
|
1101
|
+
*/
|
|
1102
|
+
declare function isPDFJSInitialized(): boolean;
|
|
1103
|
+
|
|
1104
|
+
interface LoadDocumentOptions {
|
|
1105
|
+
/** URL or data of the PDF */
|
|
1106
|
+
src: string | ArrayBuffer | Uint8Array;
|
|
1107
|
+
/** Custom worker source */
|
|
1108
|
+
workerSrc?: string;
|
|
1109
|
+
/** Password for encrypted PDFs */
|
|
1110
|
+
password?: string;
|
|
1111
|
+
/** Callback for loading progress */
|
|
1112
|
+
onProgress?: (progress: {
|
|
1113
|
+
loaded: number;
|
|
1114
|
+
total: number;
|
|
1115
|
+
}) => void;
|
|
1116
|
+
}
|
|
1117
|
+
interface LoadDocumentResult {
|
|
1118
|
+
document: PDFDocumentProxy;
|
|
1119
|
+
numPages: number;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Load a PDF document from a URL or data buffer.
|
|
1123
|
+
*/
|
|
1124
|
+
declare function loadDocument(options: LoadDocumentOptions): Promise<LoadDocumentResult>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Get a specific page from a PDF document.
|
|
1127
|
+
*/
|
|
1128
|
+
declare function getPage(document: PDFDocumentProxy, pageNumber: number): Promise<PDFPageProxy>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Get text content from a PDF page.
|
|
1131
|
+
*/
|
|
1132
|
+
declare function getPageTextContent(page: PDFPageProxy): Promise<pdfjs_dist_types_src_display_api.TextContent>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Get the outline (table of contents) from a PDF document.
|
|
1135
|
+
*/
|
|
1136
|
+
declare function getOutline(document: PDFDocumentProxy): Promise<{
|
|
1137
|
+
title: string;
|
|
1138
|
+
bold: boolean;
|
|
1139
|
+
italic: boolean;
|
|
1140
|
+
color: Uint8ClampedArray;
|
|
1141
|
+
dest: string | Array<any> | null;
|
|
1142
|
+
url: string | null;
|
|
1143
|
+
unsafeUrl: string | undefined;
|
|
1144
|
+
newWindow: boolean | undefined;
|
|
1145
|
+
count: number | undefined;
|
|
1146
|
+
items: Array<any>;
|
|
1147
|
+
}[]>;
|
|
1148
|
+
/**
|
|
1149
|
+
* Get metadata from a PDF document.
|
|
1150
|
+
*/
|
|
1151
|
+
declare function getMetadata(document: PDFDocumentProxy): Promise<{
|
|
1152
|
+
info: Object;
|
|
1153
|
+
metadata: pdfjs_dist_types_src_display_metadata.Metadata;
|
|
1154
|
+
}>;
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* Save highlights to localStorage for a specific document.
|
|
1158
|
+
*
|
|
1159
|
+
* @param documentId - Unique identifier for the document (e.g., URL hash, filename)
|
|
1160
|
+
* @param highlights - Array of highlights to save
|
|
1161
|
+
* @returns true if save succeeded, false otherwise
|
|
1162
|
+
*/
|
|
1163
|
+
declare function saveHighlights(documentId: string, highlights: Highlight[]): boolean;
|
|
1164
|
+
/**
|
|
1165
|
+
* Load highlights from localStorage for a specific document.
|
|
1166
|
+
*
|
|
1167
|
+
* @param documentId - Unique identifier for the document
|
|
1168
|
+
* @returns Array of highlights, empty array if none found or error
|
|
1169
|
+
*/
|
|
1170
|
+
declare function loadHighlights(documentId: string): Highlight[];
|
|
1171
|
+
/**
|
|
1172
|
+
* Remove all highlights for a specific document from localStorage.
|
|
1173
|
+
*
|
|
1174
|
+
* @param documentId - Unique identifier for the document
|
|
1175
|
+
* @returns true if removal succeeded, false otherwise
|
|
1176
|
+
*/
|
|
1177
|
+
declare function clearHighlights(documentId: string): boolean;
|
|
1178
|
+
/**
|
|
1179
|
+
* Get all document IDs that have stored highlights.
|
|
1180
|
+
*
|
|
1181
|
+
* @returns Array of document IDs
|
|
1182
|
+
*/
|
|
1183
|
+
declare function getAllDocumentIds(): string[];
|
|
1184
|
+
/**
|
|
1185
|
+
* Export highlights as a JSON string.
|
|
1186
|
+
* Includes metadata for import/export portability.
|
|
1187
|
+
*
|
|
1188
|
+
* @param highlights - Array of highlights to export
|
|
1189
|
+
* @returns JSON string representation
|
|
1190
|
+
*/
|
|
1191
|
+
declare function exportHighlightsAsJSON(highlights: Highlight[]): string;
|
|
1192
|
+
/**
|
|
1193
|
+
* Import highlights from a JSON string.
|
|
1194
|
+
*
|
|
1195
|
+
* @param json - JSON string to import
|
|
1196
|
+
* @returns Array of highlights, or null if invalid
|
|
1197
|
+
*/
|
|
1198
|
+
declare function importHighlightsFromJSON(json: string): Highlight[] | null;
|
|
1199
|
+
/**
|
|
1200
|
+
* Export highlights as Markdown format.
|
|
1201
|
+
* Groups by page and includes text, comments, and metadata.
|
|
1202
|
+
*
|
|
1203
|
+
* @param highlights - Array of highlights to export
|
|
1204
|
+
* @param documentTitle - Optional document title for the header
|
|
1205
|
+
* @returns Markdown string representation
|
|
1206
|
+
*/
|
|
1207
|
+
declare function exportHighlightsAsMarkdown(highlights: Highlight[], documentTitle?: string): string;
|
|
1208
|
+
/**
|
|
1209
|
+
* Generate a document ID from a URL or file path.
|
|
1210
|
+
* Creates a consistent hash for the same document.
|
|
1211
|
+
*
|
|
1212
|
+
* @param source - URL or file path
|
|
1213
|
+
* @returns Document ID string
|
|
1214
|
+
*/
|
|
1215
|
+
declare function generateDocumentId(source: string | ArrayBuffer | Uint8Array): string;
|
|
1216
|
+
|
|
1217
|
+
interface PDFViewerControllerOptions {
|
|
1218
|
+
/** Initial page number */
|
|
1219
|
+
initialPage?: number;
|
|
1220
|
+
/** Initial scale/zoom level */
|
|
1221
|
+
initialScale?: number;
|
|
1222
|
+
/** Theme mode */
|
|
1223
|
+
theme?: Theme;
|
|
1224
|
+
/** Whether to show the toolbar */
|
|
1225
|
+
showToolbar?: boolean;
|
|
1226
|
+
/** Whether to show the sidebar */
|
|
1227
|
+
showSidebar?: boolean;
|
|
1228
|
+
/** Custom onDocumentLoad callback */
|
|
1229
|
+
onDocumentLoad?: (doc: PDFDocumentProxy) => void;
|
|
1230
|
+
/** Custom onPageChange callback */
|
|
1231
|
+
onPageChange?: (page: number) => void;
|
|
1232
|
+
/** Custom onScaleChange callback */
|
|
1233
|
+
onScaleChange?: (scale: number) => void;
|
|
1234
|
+
/** Custom onError callback */
|
|
1235
|
+
onError?: (error: Error) => void;
|
|
1236
|
+
/** PDF source - URL, ArrayBuffer, or Uint8Array */
|
|
1237
|
+
src?: string | ArrayBuffer | Uint8Array;
|
|
1238
|
+
}
|
|
1239
|
+
interface PDFViewerController {
|
|
1240
|
+
loadDocument(src: string | ArrayBuffer | Uint8Array): Promise<void>;
|
|
1241
|
+
getDocument(): PDFDocumentProxy | null;
|
|
1242
|
+
goToPage(page: number): void;
|
|
1243
|
+
nextPage(): void;
|
|
1244
|
+
previousPage(): void;
|
|
1245
|
+
getCurrentPage(): number;
|
|
1246
|
+
getTotalPages(): number;
|
|
1247
|
+
setZoom(scale: number): void;
|
|
1248
|
+
zoomIn(): void;
|
|
1249
|
+
zoomOut(): void;
|
|
1250
|
+
fitToWidth(): void;
|
|
1251
|
+
fitToPage(): void;
|
|
1252
|
+
getZoom(): number;
|
|
1253
|
+
setRotation(rotation: number): void;
|
|
1254
|
+
rotateClockwise(): void;
|
|
1255
|
+
rotateCounterClockwise(): void;
|
|
1256
|
+
getRotation(): number;
|
|
1257
|
+
setTheme(theme: Theme): void;
|
|
1258
|
+
getTheme(): Theme;
|
|
1259
|
+
setViewMode(mode: ViewMode): void;
|
|
1260
|
+
getViewMode(): ViewMode;
|
|
1261
|
+
toggleSidebar(): void;
|
|
1262
|
+
setSidebarPanel(panel: SidebarPanel): void;
|
|
1263
|
+
isSidebarOpen(): boolean;
|
|
1264
|
+
getHighlights(): Highlight[];
|
|
1265
|
+
addHighlight(highlight: Omit<Highlight, 'id' | 'createdAt' | 'updatedAt'>): Highlight;
|
|
1266
|
+
removeHighlight(id: string): void;
|
|
1267
|
+
exportHighlights(): string;
|
|
1268
|
+
importHighlights(json: string): void;
|
|
1269
|
+
getAnnotations(): Annotation[];
|
|
1270
|
+
addAnnotation(annotation: Omit<Annotation, 'id' | 'createdAt' | 'updatedAt'>): Annotation;
|
|
1271
|
+
removeAnnotation(id: string): void;
|
|
1272
|
+
exportAnnotations(): string;
|
|
1273
|
+
importAnnotations(json: string): void;
|
|
1274
|
+
on<K extends keyof PDFViewerEventHandlers>(event: K, handler: PDFViewerEventHandlers[K]): () => void;
|
|
1275
|
+
destroy(): void;
|
|
1276
|
+
}
|
|
1277
|
+
interface PDFViewerEventHandlers {
|
|
1278
|
+
pagechange: (page: number) => void;
|
|
1279
|
+
scalechange: (scale: number) => void;
|
|
1280
|
+
documentload: (doc: PDFDocumentProxy) => void;
|
|
1281
|
+
error: (error: Error) => void;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Create a PDF viewer instance for non-React usage
|
|
1285
|
+
*/
|
|
1286
|
+
declare function createPDFViewer(container: HTMLElement, options?: PDFViewerControllerOptions): PDFViewerController;
|
|
1287
|
+
/**
|
|
1288
|
+
* Initialize a PDF viewer with minimal configuration
|
|
1289
|
+
*/
|
|
1290
|
+
declare function quickViewer(container: HTMLElement | string, src: string | ArrayBuffer | Uint8Array, options?: Partial<PDFViewerControllerOptions>): Promise<PDFViewerController>;
|
|
1291
|
+
|
|
1292
|
+
export { type Annotation, type AnnotationActions, AnnotationLayer, type AnnotationLayerProps, type AnnotationState, type AnnotationStore, type AnnotationStoreApi, type AnnotationTool, AnnotationToolbar, type AnnotationToolbarProps, type AnnotationType, CanvasLayer, type CanvasLayerProps, type ContextMenuItem, ContinuousScrollContainer, type ContinuousScrollContainerProps, DocumentContainer, type DocumentContainerProps, type DrawingAnnotation, DrawingCanvas, type DrawingCanvasProps, type DrawingPath, DualPageContainer, type DualPageContainerProps, type Highlight, type HighlightColor, HighlightLayer, type HighlightLayerProps, HighlightPopover, type HighlightPopoverProps, type HighlightRect, HighlightsPanel, type HighlightsPanelProps, type LoadDocumentOptions, type LoadDocumentResult, MobileSidebar, type MobileSidebarProps, MobileToolbar, type MobileToolbarProps, type NoteAnnotation, type OutlineItem, OutlinePanel, type OutlinePanelProps, type PDFDocumentLoadedEvent, PDFErrorBoundary, type PDFErrorBoundaryProps, PDFPage, type PDFPageProps, type PDFPageState, PDFViewer, PDFViewerClient, PDFViewerContext, type PDFViewerContextValue, type PDFViewerController, type PDFViewerControllerOptions, type PDFViewerEventMap, type PDFViewerProps, PDFViewerProvider, type PDFViewerProviderProps, type PageDimensions, type Plugin, type PluginAPI, PluginManager, type PluginManagerOptions, type ScrollMode, type SearchActions, SearchPanel, type SearchPanelProps, type SearchResult, type SearchState, type SearchStore, type SearchStoreApi, SelectionToolbar, type SelectionToolbarProps, type ShapeAnnotation, ShapePreview, type ShapePreviewProps, ShapeRenderer, type ShapeRendererProps, type ShapeType, Sidebar, type SidebarPanel, type SidebarPanelConfig, type SidebarProps, StickyNote, type StickyNoteProps, TextLayer, type TextLayerProps, type TextSelection, type Theme, ThumbnailPanel, type ThumbnailPanelProps, Toolbar, type ToolbarItem, type ToolbarProps, type UseAnnotationsOptions, type UseAnnotationsReturn, type UseHighlightsOptions, type UseHighlightsReturn, type UsePageNavigationOptions, type UsePluginsOptions, type UsePluginsReturn, type UseTextSelectionOptions, type UseTouchGesturesOptions, type UseZoomOptions, type ViewMode, type ViewerActions, type ViewerState, type ViewerStore, type ViewerStoreApi, VirtualizedDocumentContainer, type VirtualizedDocumentContainerProps, type WithErrorBoundaryProps, clearHighlights, cn, createAnnotationStore, createPDFViewer, createPluginManager, createSearchStore, createViewerStore, exportHighlightsAsJSON, exportHighlightsAsMarkdown, generateDocumentId, getAllDocumentIds, getMetadata, getOutline, getPage, getPageTextContent, getPluginManager, importHighlightsFromJSON, initializePDFJS, isPDFJSInitialized, loadDocument, loadHighlights, quickViewer, saveHighlights, useAnnotationStore, useAnnotations, useHighlights, useIsMobile, useIsTouchDevice, usePDFViewer, usePDFViewerStores, usePageNavigation, usePlugins, useSearchStore, useTextSelection, useTouchGestures, useViewerStore, useZoom, withErrorBoundary };
|