@sandeepmvn/react-pdf-annotator-v2 1.0.1
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/LICENSE +21 -0
- package/README.md +194 -0
- package/dist/components/AnnotationLayer.d.ts +23 -0
- package/dist/components/AnnotationLayer.d.ts.map +1 -0
- package/dist/components/Icons.d.ts +22 -0
- package/dist/components/Icons.d.ts.map +1 -0
- package/dist/components/PdfPage.d.ts +24 -0
- package/dist/components/PdfPage.d.ts.map +1 -0
- package/dist/components/PdfViewer.d.ts +8 -0
- package/dist/components/PdfViewer.d.ts.map +1 -0
- package/dist/components/Toolbar.d.ts +34 -0
- package/dist/components/Toolbar.d.ts.map +1 -0
- package/dist/components/modals/SignatureModal.d.ts +9 -0
- package/dist/components/modals/SignatureModal.d.ts.map +1 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/hooks/useAnnotationHistory.d.ts +13 -0
- package/dist/hooks/useAnnotationHistory.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/react-pdf-annotator.es.js +11716 -0
- package/dist/react-pdf-annotator.es.js.map +1 -0
- package/dist/react-pdf-annotator.umd.js +52 -0
- package/dist/react-pdf-annotator.umd.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 [Your Name]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# React PDF Annotator v2
|
|
2
|
+
|
|
3
|
+
A feature-rich, fully customizable PDF viewer and annotator component for React applications. Built with TypeScript, this package provides comprehensive annotation tools including drawing, highlighting, text, shapes, stamps, and digital signatures.
|
|
4
|
+
|
|
5
|
+
## ⨠Features
|
|
6
|
+
|
|
7
|
+
- đ **PDF Viewing**: Smooth PDF rendering with zoom controls and page navigation
|
|
8
|
+
- đ¨ **Drawing Tools**: Pen and highlighter with customizable colors and stroke widths
|
|
9
|
+
- âī¸ **Text Annotation**: Add text boxes with custom colors and font sizes
|
|
10
|
+
- đ **Shapes**: Rectangle and circle annotations
|
|
11
|
+
- đī¸ **Text Markup**: Underline, strikethrough, and squiggly line tools
|
|
12
|
+
- đ **Stamps**: Pre-defined stamps (Approved, Confidential, etc.)
|
|
13
|
+
- âī¸ **Digital Signatures**: Draw and add signatures and initials
|
|
14
|
+
- âŠī¸ **Undo/Redo**: Full history management for all annotations
|
|
15
|
+
- đž **Export**: Download annotated PDFs with all annotations embedded
|
|
16
|
+
- đ¯ **TypeScript**: Fully typed for better development experience
|
|
17
|
+
|
|
18
|
+
## đĻ Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install react-pdf-annotator-v2
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add react-pdf-annotator-v2
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
or
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add react-pdf-annotator-v2
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## đ Quick Start
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import React from 'react';
|
|
40
|
+
import { PdfViewer } from 'react-pdf-annotator-v2';
|
|
41
|
+
import 'react-pdf-annotator-v2/dist/style.css';
|
|
42
|
+
|
|
43
|
+
function App() {
|
|
44
|
+
return (
|
|
45
|
+
<div style={{ height: '100vh' }}>
|
|
46
|
+
<PdfViewer
|
|
47
|
+
fileUrl="https://example.com/sample.pdf"
|
|
48
|
+
fileName="sample.pdf"
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default App;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## đ API Reference
|
|
58
|
+
|
|
59
|
+
### PdfViewer Props
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Required | Description |
|
|
62
|
+
|------|------|----------|-------------|
|
|
63
|
+
| `fileUrl` | `string` | Yes | URL of the PDF file to display |
|
|
64
|
+
| `fileName` | `string` | Yes | Name of the PDF file (used for downloads) |
|
|
65
|
+
|
|
66
|
+
### Available Exports
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
// Main Component
|
|
70
|
+
import { PdfViewer } from 'react-pdf-annotator-v2';
|
|
71
|
+
|
|
72
|
+
// Sub-components (for custom layouts)
|
|
73
|
+
import {
|
|
74
|
+
PdfPage,
|
|
75
|
+
Toolbar,
|
|
76
|
+
AnnotationLayer,
|
|
77
|
+
SignatureModal
|
|
78
|
+
} from 'react-pdf-annotator-v2';
|
|
79
|
+
|
|
80
|
+
// Hooks
|
|
81
|
+
import { useAnnotationHistory } from 'react-pdf-annotator-v2';
|
|
82
|
+
|
|
83
|
+
// Types
|
|
84
|
+
import type {
|
|
85
|
+
AnnotationTool,
|
|
86
|
+
Annotation,
|
|
87
|
+
PenAnnotation,
|
|
88
|
+
TextAnnotation,
|
|
89
|
+
// ... other types
|
|
90
|
+
} from 'react-pdf-annotator-v2';
|
|
91
|
+
|
|
92
|
+
// Constants
|
|
93
|
+
import {
|
|
94
|
+
DEFAULT_COLOR,
|
|
95
|
+
DEFAULT_STROKE_WIDTH,
|
|
96
|
+
COLORS
|
|
97
|
+
} from 'react-pdf-annotator-v2';
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## đ¨ Customization
|
|
101
|
+
|
|
102
|
+
The package includes pre-built styles that use Tailwind CSS. The CSS is already bundled, so you don't need Tailwind CSS in your project.
|
|
103
|
+
|
|
104
|
+
Simply import the CSS file:
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import 'react-pdf-annotator-v2/dist/style.css';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The styles will work out of the box without any additional configuration.
|
|
111
|
+
|
|
112
|
+
## đ ī¸ Advanced Usage
|
|
113
|
+
|
|
114
|
+
### Using the Annotation Hook
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { useAnnotationHistory } from 'react-pdf-annotator-v2';
|
|
118
|
+
|
|
119
|
+
function CustomAnnotator() {
|
|
120
|
+
const {
|
|
121
|
+
annotations,
|
|
122
|
+
addAnnotation,
|
|
123
|
+
undo,
|
|
124
|
+
redo,
|
|
125
|
+
canUndo,
|
|
126
|
+
canRedo
|
|
127
|
+
} = useAnnotationHistory();
|
|
128
|
+
|
|
129
|
+
// Your custom implementation
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### TypeScript Support
|
|
134
|
+
|
|
135
|
+
The package is fully typed. Import types as needed:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import type {
|
|
139
|
+
AnnotationTool,
|
|
140
|
+
Annotation,
|
|
141
|
+
PenAnnotation
|
|
142
|
+
} from 'react-pdf-annotator-v2';
|
|
143
|
+
|
|
144
|
+
const tool: AnnotationTool = 'PEN';
|
|
145
|
+
const annotation: Annotation = {
|
|
146
|
+
// ...
|
|
147
|
+
};
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## đ Requirements
|
|
151
|
+
|
|
152
|
+
- React 18.0.0 or higher
|
|
153
|
+
- React DOM 18.0.0 or higher
|
|
154
|
+
|
|
155
|
+
## đ§ Peer Dependencies
|
|
156
|
+
|
|
157
|
+
This package requires the following peer dependencies:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"react": "^18.0.0",
|
|
162
|
+
"react-dom": "^18.0.0"
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Make sure these are installed in your project.
|
|
167
|
+
|
|
168
|
+
## đ License
|
|
169
|
+
|
|
170
|
+
MIT
|
|
171
|
+
|
|
172
|
+
## đ¤ Contributing
|
|
173
|
+
|
|
174
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
175
|
+
|
|
176
|
+
## đŽ Issues
|
|
177
|
+
|
|
178
|
+
If you encounter any issues or have suggestions, please file an issue on the [GitHub repository](https://github.com/yourusername/react-pdf-annotator-v2/issues).
|
|
179
|
+
|
|
180
|
+
## đ Acknowledgments
|
|
181
|
+
|
|
182
|
+
Built with:
|
|
183
|
+
- [pdf-lib](https://github.com/Hopding/pdf-lib) - PDF manipulation
|
|
184
|
+
- [PDF.js](https://mozilla.github.io/pdf.js/) - PDF rendering
|
|
185
|
+
- React & TypeScript
|
|
186
|
+
- Tailwind CSS
|
|
187
|
+
|
|
188
|
+
## đ Documentation
|
|
189
|
+
|
|
190
|
+
For more detailed documentation and examples, visit the [documentation site](https://github.com/yourusername/react-pdf-annotator-v2).
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
Made with â¤ī¸ for the React community
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Annotation, AnnotationTool } from '../types';
|
|
3
|
+
interface AnnotationLayerProps {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
zoom: number;
|
|
7
|
+
activeTool: AnnotationTool;
|
|
8
|
+
toolColor: string;
|
|
9
|
+
strokeWidth: number;
|
|
10
|
+
fontSize: number;
|
|
11
|
+
addAnnotation: (annotation: Omit<Annotation, 'id' | 'page'>) => void;
|
|
12
|
+
annotations: Annotation[];
|
|
13
|
+
deleteAnnotation: (annotationId: string) => void;
|
|
14
|
+
updateAnnotation: (annotation: Annotation) => void;
|
|
15
|
+
selectedAnnotationId: string | null;
|
|
16
|
+
setSelectedAnnotationId: (id: string | null) => void;
|
|
17
|
+
signatureData: string | null;
|
|
18
|
+
initialsData: string | null;
|
|
19
|
+
activeStamp: string;
|
|
20
|
+
}
|
|
21
|
+
declare const AnnotationLayer: React.FC<AnnotationLayerProps>;
|
|
22
|
+
export default AnnotationLayer;
|
|
23
|
+
//# sourceMappingURL=AnnotationLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationLayer.d.ts","sourceRoot":"","sources":["../../components/AnnotationLayer.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0D,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAS,MAAM,UAAU,CAAC;AAK7D,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,cAAc,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC;IACrE,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,gBAAgB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,gBAAgB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IACnD,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgMnD,CAAC;AA8IF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const SelectIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const PenIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const HighlighterIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const FreeTextIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const RectangleIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const CircleIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const EraserIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const TrashIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const ZoomInIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const ZoomOutIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const DownloadIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const PrintIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const UploadIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const UnderlineIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const StrikeoutIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const SquigglyIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const StampIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const SignatureIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const InitialsIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const UndoIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const RedoIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=Icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icons.d.ts","sourceRoot":"","sources":["../../components/Icons.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,+CAEtB,CAAC;AAEF,eAAO,MAAM,OAAO,+CAEnB,CAAC;AAEF,eAAO,MAAM,eAAe,+CAE3B,CAAC;AAEF,eAAO,MAAM,YAAY,+CAExB,CAAC;AAEF,eAAO,MAAM,aAAa,+CAEzB,CAAC;AAEF,eAAO,MAAM,UAAU,+CAEtB,CAAC;AAEF,eAAO,MAAM,UAAU,+CAEtB,CAAC;AAEF,eAAO,MAAM,SAAS,+CAErB,CAAC;AAEF,eAAO,MAAM,UAAU,+CAEtB,CAAC;AAEF,eAAO,MAAM,WAAW,+CAEvB,CAAC;AAEF,eAAO,MAAM,YAAY,+CAExB,CAAC;AAEF,eAAO,MAAM,SAAS,+CAErB,CAAC;AAEF,eAAO,MAAM,UAAU,+CAEtB,CAAC;AAEF,eAAO,MAAM,aAAa,+CAEzB,CAAC;AAEF,eAAO,MAAM,aAAa,+CAEzB,CAAC;AAEF,eAAO,MAAM,YAAY,+CAExB,CAAC;AAEF,eAAO,MAAM,SAAS,+CAErB,CAAC;AAEF,eAAO,MAAM,aAAa,+CAEzB,CAAC;AAEF,eAAO,MAAM,YAAY,+CAExB,CAAC;AAEF,eAAO,MAAM,QAAQ,+CAEpB,CAAC;AAEF,eAAO,MAAM,QAAQ,+CAEpB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PDFDocumentProxy } from 'pdfjs-dist/types/src/display/api';
|
|
3
|
+
import { Annotation, AnnotationTool } from '../types';
|
|
4
|
+
interface PdfPageProps {
|
|
5
|
+
pdf: PDFDocumentProxy;
|
|
6
|
+
pageNumber: number;
|
|
7
|
+
zoom: number;
|
|
8
|
+
activeTool: AnnotationTool;
|
|
9
|
+
toolColor: string;
|
|
10
|
+
strokeWidth: number;
|
|
11
|
+
fontSize: number;
|
|
12
|
+
annotations: Annotation[];
|
|
13
|
+
addAnnotation: (annotation: Omit<Annotation, 'id' | 'page'>) => void;
|
|
14
|
+
deleteAnnotation: (annotationId: string) => void;
|
|
15
|
+
updateAnnotation: (annotation: Annotation) => void;
|
|
16
|
+
selectedAnnotationId: string | null;
|
|
17
|
+
setSelectedAnnotationId: (id: string | null) => void;
|
|
18
|
+
signatureData: string | null;
|
|
19
|
+
initialsData: string | null;
|
|
20
|
+
activeStamp: string;
|
|
21
|
+
}
|
|
22
|
+
declare const PdfPage: React.FC<PdfPageProps>;
|
|
23
|
+
export default PdfPage;
|
|
24
|
+
//# sourceMappingURL=PdfPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfPage.d.ts","sourceRoot":"","sources":["../../components/PdfPage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsC,MAAM,OAA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,KAAK,CAAC,EAAE,CAAC,cAAc,CA4UvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AnnotationTool } from '../types';
|
|
3
|
+
interface ToolbarProps {
|
|
4
|
+
fileName: string;
|
|
5
|
+
currentPage: number;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
zoom: number;
|
|
8
|
+
setZoom: (zoom: number) => void;
|
|
9
|
+
setCurrentPage: (page: number) => void;
|
|
10
|
+
activeTool: AnnotationTool;
|
|
11
|
+
setActiveTool: (tool: AnnotationTool) => void;
|
|
12
|
+
toolColor: string;
|
|
13
|
+
setToolColor: (color: string) => void;
|
|
14
|
+
strokeWidth: number;
|
|
15
|
+
setStrokeWidth: (width: number) => void;
|
|
16
|
+
fontSize: number;
|
|
17
|
+
setFontSize: (size: number) => void;
|
|
18
|
+
onDownload: () => void;
|
|
19
|
+
onPrint: () => void;
|
|
20
|
+
isProcessing: boolean;
|
|
21
|
+
onDelete: () => void;
|
|
22
|
+
selectedAnnotationId: string | null;
|
|
23
|
+
undo: () => void;
|
|
24
|
+
redo: () => void;
|
|
25
|
+
canUndo: boolean;
|
|
26
|
+
canRedo: boolean;
|
|
27
|
+
onSignatureClick: () => void;
|
|
28
|
+
onInitialsClick: () => void;
|
|
29
|
+
activeStamp: string;
|
|
30
|
+
setActiveStamp: (stamp: string) => void;
|
|
31
|
+
}
|
|
32
|
+
declare const Toolbar: React.FC<ToolbarProps>;
|
|
33
|
+
export default Toolbar;
|
|
34
|
+
//# sourceMappingURL=Toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../components/Toolbar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAQ1C,UAAU,YAAY;IACpB,QA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React } from 'react';
|
|
2
|
+
interface SignatureModalProps {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onSave: (dataUrl: string) => void;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
declare const SignatureModal: React.FC<SignatureModalProps>;
|
|
8
|
+
export default SignatureModal;
|
|
9
|
+
//# sourceMappingURL=SignatureModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignatureModal.d.ts","sourceRoot":"","sources":["../../../components/modals/SignatureModal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqE,MAAM,OAAO,CAAC;AAE1F,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAwFjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const FONT_SIZES: number[];
|
|
2
|
+
export declare const STROKE_WIDTHS: number[];
|
|
3
|
+
export declare const DEFAULT_COLOR = "#ef4444";
|
|
4
|
+
export declare const DEFAULT_FONT_SIZE = 16;
|
|
5
|
+
export declare const DEFAULT_STROKE_WIDTH = 2;
|
|
6
|
+
export declare const STAMPS: string[];
|
|
7
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,UAA0C,CAAC;AAClE,eAAO,MAAM,aAAa,UAAmB,CAAC;AAC9C,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,MAAM,UASlB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Annotations, Annotation } from '../types';
|
|
2
|
+
export declare const useAnnotationHistory: () => {
|
|
3
|
+
annotations: Annotations;
|
|
4
|
+
addAnnotation: (page: number, annotationData: Omit<Annotation, "id" | "page">) => void;
|
|
5
|
+
deleteAnnotation: (page: number, annotationId: string) => void;
|
|
6
|
+
updateAnnotation: (updatedAnnotation: Annotation) => void;
|
|
7
|
+
clearAnnotations: () => void;
|
|
8
|
+
undo: () => void;
|
|
9
|
+
redo: () => void;
|
|
10
|
+
canUndo: boolean;
|
|
11
|
+
canRedo: boolean;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useAnnotationHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnnotationHistory.d.ts","sourceRoot":"","sources":["../../hooks/useAnnotationHistory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOnD,eAAO,MAAM,oBAAoB;;0BAwBU,MAAM,kBAAkB,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;6BAcpD,MAAM,gBAAgB,MAAM;0CASf,UAAU;;;;;;CA8CpE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as PdfViewer } from '../components/PdfViewer';
|
|
2
|
+
export { default as PdfPage } from '../components/PdfPage';
|
|
3
|
+
export { default as Toolbar } from '../components/Toolbar';
|
|
4
|
+
export { default as AnnotationLayer } from '../components/AnnotationLayer';
|
|
5
|
+
export { default as SignatureModal } from '../components/modals/SignatureModal';
|
|
6
|
+
export { useAnnotationHistory } from '../hooks/useAnnotationHistory';
|
|
7
|
+
export type { AnnotationTool, Point, BaseAnnotation, PenAnnotation, HighlighterAnnotation, TextAnnotation, RectangleAnnotation, CircleAnnotation, UnderlineAnnotation, StrikeoutAnnotation, SquigglyAnnotation, StampAnnotation, ImageAnnotation, Annotation, Annotations, } from '../types';
|
|
8
|
+
export { DEFAULT_COLOR, DEFAULT_STROKE_WIDTH, DEFAULT_FONT_SIZE, STAMPS, FONT_SIZES, STROKE_WIDTHS, } from '../constants';
|
|
9
|
+
export * from '../components/Icons';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAGrE,YAAY,EACV,cAAc,EACd,KAAK,EACL,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,UAAU,EACV,WAAW,GACZ,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,MAAM,EACN,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,cAAc,qBAAqB,CAAC"}
|