@rzymek/react-pdf-highlighter 8.0.1-rc.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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/components/AreaHighlight.d.ts +8 -0
- package/dist/components/Highlight.d.ts +17 -0
- package/dist/components/HighlightLayer.d.ts +26 -0
- package/dist/components/MouseMonitor.d.ts +15 -0
- package/dist/components/MouseSelection.d.ts +10 -0
- package/dist/components/PdfHighlighter.d.ts +92 -0
- package/dist/components/PdfLoader.d.ts +32 -0
- package/dist/components/Popup.d.ts +8 -0
- package/dist/components/Tip.d.ts +20 -0
- package/dist/components/TipContainer.d.ts +13 -0
- package/dist/index.d.ts +7 -0
- package/dist/lib/coordinates.d.ts +8 -0
- package/dist/lib/get-area-as-png.d.ts +2 -0
- package/dist/lib/get-bounding-rect.d.ts +2 -0
- package/dist/lib/get-client-rects.d.ts +2 -0
- package/dist/lib/optimize-client-rects.d.ts +2 -0
- package/dist/lib/pdfjs-dom.d.ts +8 -0
- package/dist/node_modules/.pnpm/pdfjs-dist@4.4.168/node_modules/pdfjs-dist/web/pdf_viewer.js +8022 -0
- package/dist/node_modules/.pnpm/ts-debounce@4.0.0/node_modules/ts-debounce/dist/src/index.esm.js +38 -0
- package/dist/src/components/AreaHighlight.js +58 -0
- package/dist/src/components/Highlight.js +45 -0
- package/dist/src/components/HighlightLayer.js +47 -0
- package/dist/src/components/MouseMonitor.js +45 -0
- package/dist/src/components/MouseSelection.js +119 -0
- package/dist/src/components/PdfHighlighter.js +543 -0
- package/dist/src/components/PdfLoader.js +81 -0
- package/dist/src/components/Popup.js +42 -0
- package/dist/src/components/Tip.js +82 -0
- package/dist/src/components/TipContainer.js +62 -0
- package/dist/src/index.js +15 -0
- package/dist/src/lib/coordinates.js +50 -0
- package/dist/src/lib/get-area-as-png.js +31 -0
- package/dist/src/lib/get-bounding-rect.js +40 -0
- package/dist/src/lib/get-client-rects.js +39 -0
- package/dist/src/lib/optimize-client-rects.js +54 -0
- package/dist/src/lib/pdfjs-dom.js +64 -0
- package/dist/src/style/AreaHighlight.module.css.js +14 -0
- package/dist/src/style/Highlight.module.css.js +20 -0
- package/dist/src/style/MouseSelection.module.css.js +8 -0
- package/dist/src/style/PdfHighlighter.module.css.js +14 -0
- package/dist/src/style/Tip.module.css.js +11 -0
- package/dist/src/style/TipContainer.module.css.js +8 -0
- package/dist/style.css +2903 -0
- package/dist/types.d.ts +62 -0
- package/package.json +69 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface LTWH {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
export interface LTWHP extends LTWH {
|
|
8
|
+
pageNumber?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Scaled {
|
|
11
|
+
x1: number;
|
|
12
|
+
y1: number;
|
|
13
|
+
x2: number;
|
|
14
|
+
y2: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
pageNumber?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface Position {
|
|
20
|
+
boundingRect: LTWHP;
|
|
21
|
+
rects: Array<LTWHP>;
|
|
22
|
+
pageNumber: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ScaledPosition {
|
|
25
|
+
boundingRect: Scaled;
|
|
26
|
+
rects: Array<Scaled>;
|
|
27
|
+
pageNumber: number;
|
|
28
|
+
usePdfCoordinates?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface Content {
|
|
31
|
+
text?: string;
|
|
32
|
+
image?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface HighlightContent {
|
|
35
|
+
content: Content;
|
|
36
|
+
}
|
|
37
|
+
export interface Comment {
|
|
38
|
+
text: string;
|
|
39
|
+
emoji: string;
|
|
40
|
+
}
|
|
41
|
+
export interface HighlightComment {
|
|
42
|
+
comment: Comment;
|
|
43
|
+
}
|
|
44
|
+
export interface NewHighlight extends HighlightContent, HighlightComment {
|
|
45
|
+
position: ScaledPosition;
|
|
46
|
+
}
|
|
47
|
+
export interface IHighlight extends NewHighlight {
|
|
48
|
+
id: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ViewportHighlight extends HighlightContent, HighlightComment {
|
|
51
|
+
position: Position;
|
|
52
|
+
}
|
|
53
|
+
export interface Viewport {
|
|
54
|
+
convertToPdfPoint: (x: number, y: number) => Array<number>;
|
|
55
|
+
convertToViewportRectangle: (pdfRectangle: Array<number>) => Array<number>;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
}
|
|
59
|
+
export interface Page {
|
|
60
|
+
node: HTMLElement;
|
|
61
|
+
number: number;
|
|
62
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rzymek/react-pdf-highlighter",
|
|
3
|
+
"version": "8.0.1-rc.0",
|
|
4
|
+
"description": "Set of React components for PDF annotation",
|
|
5
|
+
"author": "Artem Tyurin <artem.tyurin@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"provenance": true
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"pdf",
|
|
13
|
+
"highlight",
|
|
14
|
+
"annotator",
|
|
15
|
+
"react-component"
|
|
16
|
+
],
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"main": "./dist/src/index.js",
|
|
25
|
+
"style": "./dist/style.css",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"start": "npm run dev",
|
|
28
|
+
"dev": "vite build && (cd ./example && vite)",
|
|
29
|
+
"build": "npm run clean && npm run compile && vite build && npm run build:example",
|
|
30
|
+
"compile": "tsc --noEmit && (cd ./example && tsc --noEmit)",
|
|
31
|
+
"build:example": "vite build && (cd ./example && vite build)",
|
|
32
|
+
"test": "npm run build && npm run lint && npm run test:e2e",
|
|
33
|
+
"test:e2e": "playwright test",
|
|
34
|
+
"format": "biome format --write",
|
|
35
|
+
"lint": "biome check",
|
|
36
|
+
"clean": "rm -rf dist",
|
|
37
|
+
"prepublishOnly": "npm run build"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": ">=18.0.0",
|
|
41
|
+
"react-dom": ">=18.0.0"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"pdfjs-dist": "4.4.168",
|
|
45
|
+
"react-rnd": "^10.4.11",
|
|
46
|
+
"ts-debounce": "^4.0.0"
|
|
47
|
+
},
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/agentcooper/react-pdf-highlighter.git"
|
|
51
|
+
},
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/agentcooper/react-pdf-highlighter/issues"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@biomejs/biome": "1.9.0",
|
|
57
|
+
"@playwright/test": "^1.45.1",
|
|
58
|
+
"@types/node": "^20.14.10",
|
|
59
|
+
"@types/react": "^18.3.3",
|
|
60
|
+
"@types/react-dom": "^18.3.0",
|
|
61
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
62
|
+
"playwright": "^1.45.1",
|
|
63
|
+
"postcss-import": "^16.1.0",
|
|
64
|
+
"typescript": "^5.6.2",
|
|
65
|
+
"vite": "^5.3.3",
|
|
66
|
+
"vite-plugin-dts": "^4.1.1"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://github.com/agentcooper/react-pdf-highlighter#readme"
|
|
69
|
+
}
|