react-pdf-highlighter-plus 1.0.3 → 1.0.5

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.
Files changed (85) hide show
  1. package/dist/esm/index.d.ts +1348 -19
  2. package/dist/esm/index.js +3557 -18
  3. package/dist/esm/index.js.map +1 -1
  4. package/package.json +3 -2
  5. package/dist/esm/components/AreaHighlight.d.ts +0 -82
  6. package/dist/esm/components/AreaHighlight.js +0 -109
  7. package/dist/esm/components/AreaHighlight.js.map +0 -1
  8. package/dist/esm/components/DrawingCanvas.d.ts +0 -48
  9. package/dist/esm/components/DrawingCanvas.js +0 -277
  10. package/dist/esm/components/DrawingCanvas.js.map +0 -1
  11. package/dist/esm/components/DrawingHighlight.d.ts +0 -70
  12. package/dist/esm/components/DrawingHighlight.js +0 -164
  13. package/dist/esm/components/DrawingHighlight.js.map +0 -1
  14. package/dist/esm/components/FreetextHighlight.d.ts +0 -112
  15. package/dist/esm/components/FreetextHighlight.js +0 -193
  16. package/dist/esm/components/FreetextHighlight.js.map +0 -1
  17. package/dist/esm/components/HighlightLayer.d.ts +0 -49
  18. package/dist/esm/components/HighlightLayer.js +0 -37
  19. package/dist/esm/components/HighlightLayer.js.map +0 -1
  20. package/dist/esm/components/ImageHighlight.d.ts +0 -63
  21. package/dist/esm/components/ImageHighlight.js +0 -65
  22. package/dist/esm/components/ImageHighlight.js.map +0 -1
  23. package/dist/esm/components/MonitoredHighlightContainer.d.ts +0 -37
  24. package/dist/esm/components/MonitoredHighlightContainer.js +0 -42
  25. package/dist/esm/components/MonitoredHighlightContainer.js.map +0 -1
  26. package/dist/esm/components/MouseMonitor.d.ts +0 -34
  27. package/dist/esm/components/MouseMonitor.js +0 -30
  28. package/dist/esm/components/MouseMonitor.js.map +0 -1
  29. package/dist/esm/components/MouseSelection.d.ts +0 -66
  30. package/dist/esm/components/MouseSelection.js +0 -122
  31. package/dist/esm/components/MouseSelection.js.map +0 -1
  32. package/dist/esm/components/PdfHighlighter.d.ts +0 -184
  33. package/dist/esm/components/PdfHighlighter.js +0 -410
  34. package/dist/esm/components/PdfHighlighter.js.map +0 -1
  35. package/dist/esm/components/PdfLoader.d.ts +0 -55
  36. package/dist/esm/components/PdfLoader.js +0 -57
  37. package/dist/esm/components/PdfLoader.js.map +0 -1
  38. package/dist/esm/components/ShapeCanvas.d.ts +0 -51
  39. package/dist/esm/components/ShapeCanvas.js +0 -205
  40. package/dist/esm/components/ShapeCanvas.js.map +0 -1
  41. package/dist/esm/components/ShapeHighlight.d.ts +0 -107
  42. package/dist/esm/components/ShapeHighlight.js +0 -140
  43. package/dist/esm/components/ShapeHighlight.js.map +0 -1
  44. package/dist/esm/components/SignaturePad.d.ts +0 -40
  45. package/dist/esm/components/SignaturePad.js +0 -138
  46. package/dist/esm/components/SignaturePad.js.map +0 -1
  47. package/dist/esm/components/TextHighlight.d.ts +0 -93
  48. package/dist/esm/components/TextHighlight.js +0 -115
  49. package/dist/esm/components/TextHighlight.js.map +0 -1
  50. package/dist/esm/components/TipContainer.d.ts +0 -27
  51. package/dist/esm/components/TipContainer.js +0 -58
  52. package/dist/esm/components/TipContainer.js.map +0 -1
  53. package/dist/esm/contexts/HighlightContext.d.ts +0 -44
  54. package/dist/esm/contexts/HighlightContext.js +0 -16
  55. package/dist/esm/contexts/HighlightContext.js.map +0 -1
  56. package/dist/esm/contexts/PdfHighlighterContext.d.ts +0 -89
  57. package/dist/esm/contexts/PdfHighlighterContext.js +0 -16
  58. package/dist/esm/contexts/PdfHighlighterContext.js.map +0 -1
  59. package/dist/esm/lib/coordinates.d.ts +0 -16
  60. package/dist/esm/lib/coordinates.js +0 -69
  61. package/dist/esm/lib/coordinates.js.map +0 -1
  62. package/dist/esm/lib/export-pdf.d.ts +0 -81
  63. package/dist/esm/lib/export-pdf.js +0 -511
  64. package/dist/esm/lib/export-pdf.js.map +0 -1
  65. package/dist/esm/lib/get-bounding-rect.d.ts +0 -3
  66. package/dist/esm/lib/get-bounding-rect.js +0 -35
  67. package/dist/esm/lib/get-bounding-rect.js.map +0 -1
  68. package/dist/esm/lib/get-client-rects.d.ts +0 -3
  69. package/dist/esm/lib/get-client-rects.js +0 -43
  70. package/dist/esm/lib/get-client-rects.js.map +0 -1
  71. package/dist/esm/lib/group-highlights-by-page.d.ts +0 -6
  72. package/dist/esm/lib/group-highlights-by-page.js +0 -23
  73. package/dist/esm/lib/group-highlights-by-page.js.map +0 -1
  74. package/dist/esm/lib/optimize-client-rects.d.ts +0 -3
  75. package/dist/esm/lib/optimize-client-rects.js +0 -65
  76. package/dist/esm/lib/optimize-client-rects.js.map +0 -1
  77. package/dist/esm/lib/pdfjs-dom.d.ts +0 -9
  78. package/dist/esm/lib/pdfjs-dom.js +0 -55
  79. package/dist/esm/lib/pdfjs-dom.js.map +0 -1
  80. package/dist/esm/lib/screenshot.d.ts +0 -4
  81. package/dist/esm/lib/screenshot.js +0 -24
  82. package/dist/esm/lib/screenshot.js.map +0 -1
  83. package/dist/esm/types.d.ts +0 -213
  84. package/dist/esm/types.js +0 -2
  85. package/dist/esm/types.js.map +0 -1
@@ -1,55 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import { OnProgressParameters, type PDFDocumentProxy } from "pdfjs-dist";
3
- import { DocumentInitParameters, TypedArray } from "pdfjs-dist/types/src/display/api";
4
- /**
5
- * The props type for {@link PdfLoader}.
6
- *
7
- * @category Component Properties
8
- */
9
- export interface PdfLoaderProps {
10
- /**
11
- * The document to be loaded by PDF.js.
12
- * If you need to pass HTTP headers, auth parameters,
13
- * or other pdf settings, do it through here.
14
- */
15
- document: string | URL | TypedArray | DocumentInitParameters;
16
- /**
17
- * Callback to render content before the PDF document is loaded.
18
- *
19
- * @param progress - PDF.js progress status.
20
- * @returns - Component to be rendered in space of the PDF document while loading.
21
- */
22
- beforeLoad?(progress: OnProgressParameters): ReactNode;
23
- /**
24
- * Component to render in the case of any PDF loading errors.
25
- *
26
- * @param error - PDF loading error.
27
- * @returns - Component to be rendered in space of the PDF document.
28
- */
29
- errorMessage?(error: Error): ReactNode;
30
- /**
31
- * Child components to use/render the loaded PDF document.
32
- *
33
- * @param pdfDocument - The loaded PDF document.
34
- * @returns - Component to render once PDF document is loaded.
35
- */
36
- children(pdfDocument: PDFDocumentProxy): ReactNode;
37
- /**
38
- * Callback triggered whenever an error occurs.
39
- *
40
- * @param error - PDF Loading error triggering the event.
41
- * @returns - Component to be rendered in space of the PDF document.
42
- */
43
- onError?(error: Error): void;
44
- /**
45
- * NOTE: This will be applied to all PdfLoader instances.
46
- * If you want to only apply a source to this instance, use the document parameters.
47
- */
48
- workerSrc?: string;
49
- }
50
- /**
51
- * A component for loading a PDF document and passing it to a child.
52
- *
53
- * @category Component
54
- */
55
- export declare const PdfLoader: ({ document, beforeLoad, errorMessage, children, onError, workerSrc, }: PdfLoaderProps) => React.ReactNode;
@@ -1,57 +0,0 @@
1
- import React, { useEffect, useRef, useState } from "react";
2
- import { GlobalWorkerOptions, getDocument } from "pdfjs-dist";
3
- const DEFAULT_BEFORE_LOAD = (progress) => (React.createElement("div", { style: { color: "black" } },
4
- "Loading ",
5
- Math.floor((progress.loaded / progress.total) * 100),
6
- "%"));
7
- const DEFAULT_ERROR_MESSAGE = (error) => (React.createElement("div", { style: { color: "black" } }, error.message));
8
- const DEFAULT_ON_ERROR = (error) => {
9
- throw new Error(`Error loading PDF document: ${error.message}!`);
10
- };
11
- const DEFAULT_WORKER_SRC = "https://unpkg.com/pdfjs-dist@4.4.168/build/pdf.worker.min.mjs";
12
- /**
13
- * A component for loading a PDF document and passing it to a child.
14
- *
15
- * @category Component
16
- */
17
- export const PdfLoader = ({ document, beforeLoad = DEFAULT_BEFORE_LOAD, errorMessage = DEFAULT_ERROR_MESSAGE, children, onError = DEFAULT_ON_ERROR, workerSrc = DEFAULT_WORKER_SRC, }) => {
18
- const pdfLoadingTaskRef = useRef(null);
19
- const pdfDocumentRef = useRef(null);
20
- const [error, setError] = useState(null);
21
- const [loadingProgress, setLoadingProgress] = useState(null);
22
- // Intitialise document
23
- useEffect(() => {
24
- GlobalWorkerOptions.workerSrc = workerSrc;
25
- pdfLoadingTaskRef.current = getDocument(document);
26
- pdfLoadingTaskRef.current.onProgress = (progress) => {
27
- setLoadingProgress(progress.loaded > progress.total ? null : progress);
28
- };
29
- pdfLoadingTaskRef.current.promise
30
- .then((pdfDocument) => {
31
- pdfDocumentRef.current = pdfDocument;
32
- })
33
- .catch((error) => {
34
- if (error.message != "Worker was destroyed") {
35
- setError(error);
36
- onError(error);
37
- }
38
- })
39
- .finally(() => {
40
- setLoadingProgress(null);
41
- });
42
- return () => {
43
- if (pdfLoadingTaskRef.current) {
44
- pdfLoadingTaskRef.current.destroy();
45
- }
46
- if (pdfDocumentRef.current) {
47
- pdfDocumentRef.current.destroy();
48
- }
49
- };
50
- }, [document]);
51
- return error
52
- ? errorMessage(error)
53
- : loadingProgress
54
- ? beforeLoad(loadingProgress)
55
- : pdfDocumentRef.current && children(pdfDocumentRef.current);
56
- };
57
- //# sourceMappingURL=PdfLoader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PdfLoader.js","sourceRoot":"","sources":["../../../src/components/PdfLoader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAwB,WAAW,EAAsD,MAAM,YAAY,CAAC;AAGxI,MAAM,mBAAmB,GAAG,CAAC,QAA8B,EAAE,EAAE,CAAC,CAC9D,6BAAK,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;;IACnB,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;QACzD,CACP,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,CAC9C,6BAAK,KAAK,EAAE,EAAE,KAAK,EAAE,OA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aACD,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;YACtB,IAAI,KAAK,CAAC,OAAO,IAAI,sBAAsB,EAAE,CAAC;gBAC5C,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAChB,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;QACH,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,IAAI,iBAAiB,CAAC,OAAO,EAAE,CAAC;gBAC9B,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACtC,CAAC;YAED,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;gBAC3B,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,KAAK;QACV,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC;QACrB,CAAC,CAAC,eAAe;YACf,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC;YAC7B,CAAC,CAAC,cAAc,CAAC,OAAO,IAAI,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACnE,CAAC,CAAC"}
@@ -1,51 +0,0 @@
1
- import React from "react";
2
- import { ShapeType, ShapeData, ScaledPosition } from "../types";
3
- import "../style/ShapeCanvas.css";
4
- import type { PDFViewer as TPDFViewer } from "pdfjs-dist/web/pdf_viewer.mjs";
5
- /**
6
- * The props type for {@link ShapeCanvas}.
7
- *
8
- * @category Component Properties
9
- */
10
- export interface ShapeCanvasProps {
11
- /**
12
- * Whether shape mode is active.
13
- */
14
- isActive: boolean;
15
- /**
16
- * The type of shape to create.
17
- */
18
- shapeType: ShapeType;
19
- /**
20
- * Stroke color for the shape.
21
- * @default "#000000"
22
- */
23
- strokeColor?: string;
24
- /**
25
- * Stroke width for the shape.
26
- * @default 2
27
- */
28
- strokeWidth?: number;
29
- /**
30
- * The PDF viewer instance.
31
- */
32
- viewer: InstanceType<typeof TPDFViewer>;
33
- /**
34
- * Callback when shape creation is complete.
35
- *
36
- * @param position - Scaled position of the shape on the page.
37
- * @param shape - The shape data.
38
- */
39
- onComplete: (position: ScaledPosition, shape: ShapeData) => void;
40
- /**
41
- * Callback when shape creation is cancelled.
42
- */
43
- onCancel: () => void;
44
- }
45
- /**
46
- * A transparent overlay for creating shape annotations on PDF pages.
47
- * Supports mouse and touch input with click-and-drag to define shape bounds.
48
- *
49
- * @category Component
50
- */
51
- export declare const ShapeCanvas: ({ isActive, shapeType, strokeColor, strokeWidth, viewer, onComplete, onCancel, }: ShapeCanvasProps) => React.JSX.Element | null;
@@ -1,205 +0,0 @@
1
- import React, { useRef, useEffect, useCallback, useState, } from "react";
2
- import { viewportPositionToScaled } from "../lib/coordinates";
3
- import "../style/ShapeCanvas.css";
4
- /**
5
- * A transparent overlay for creating shape annotations on PDF pages.
6
- * Supports mouse and touch input with click-and-drag to define shape bounds.
7
- *
8
- * @category Component
9
- */
10
- export const ShapeCanvas = ({ isActive, shapeType, strokeColor = "#000000", strokeWidth = 2, viewer, onComplete, onCancel, }) => {
11
- const containerRef = useRef(null);
12
- const [startPoint, setStartPoint] = useState(null);
13
- const [currentPoint, setCurrentPoint] = useState(null);
14
- const [pageNumber, setPageNumber] = useState(null);
15
- const [pageRect, setPageRect] = useState(null);
16
- const isDrawingRef = useRef(false);
17
- // Find which page the user is drawing on
18
- const findPageFromPoint = useCallback((clientX, clientY) => {
19
- if (!viewer)
20
- return null;
21
- for (let i = 0; i < viewer.pagesCount; i++) {
22
- const pageView = viewer.getPageView(i);
23
- if (!pageView?.div)
24
- continue;
25
- const rect = pageView.div.getBoundingClientRect();
26
- if (clientX >= rect.left &&
27
- clientX <= rect.right &&
28
- clientY >= rect.top &&
29
- clientY <= rect.bottom) {
30
- return {
31
- pageNumber: i + 1,
32
- element: pageView.div,
33
- rect,
34
- };
35
- }
36
- }
37
- return null;
38
- }, [viewer]);
39
- // Handle mouse/touch down
40
- const handleStart = useCallback((clientX, clientY) => {
41
- const pageInfo = findPageFromPoint(clientX, clientY);
42
- if (!pageInfo)
43
- return;
44
- console.log("ShapeCanvas: Started drawing on page", pageInfo.pageNumber);
45
- setPageNumber(pageInfo.pageNumber);
46
- setPageRect(pageInfo.rect);
47
- isDrawingRef.current = true;
48
- const pos = {
49
- x: clientX - pageInfo.rect.left,
50
- y: clientY - pageInfo.rect.top,
51
- };
52
- setStartPoint(pos);
53
- setCurrentPoint(pos);
54
- }, [findPageFromPoint]);
55
- // Handle mouse/touch move
56
- const handleMove = useCallback((clientX, clientY) => {
57
- if (!isDrawingRef.current || !pageRect)
58
- return;
59
- const pos = {
60
- x: clientX - pageRect.left,
61
- y: clientY - pageRect.top,
62
- };
63
- setCurrentPoint(pos);
64
- }, [pageRect]);
65
- // Handle mouse/touch end
66
- const handleEnd = useCallback(() => {
67
- if (!isDrawingRef.current || !startPoint || !currentPoint || pageNumber === null || !viewer) {
68
- isDrawingRef.current = false;
69
- setStartPoint(null);
70
- setCurrentPoint(null);
71
- return;
72
- }
73
- isDrawingRef.current = false;
74
- // Calculate bounding box
75
- const minX = Math.min(startPoint.x, currentPoint.x);
76
- const minY = Math.min(startPoint.y, currentPoint.y);
77
- const maxX = Math.max(startPoint.x, currentPoint.x);
78
- const maxY = Math.max(startPoint.y, currentPoint.y);
79
- const width = maxX - minX;
80
- const height = maxY - minY;
81
- // Minimum size check
82
- if (width < 10 || height < 10) {
83
- console.log("ShapeCanvas: Shape too small, ignoring");
84
- setStartPoint(null);
85
- setCurrentPoint(null);
86
- return;
87
- }
88
- console.log("ShapeCanvas: Creating shape", shapeType, "at", { minX, minY, width, height });
89
- // Create viewport position
90
- const viewportPosition = {
91
- boundingRect: {
92
- left: minX,
93
- top: minY,
94
- width: width,
95
- height: height,
96
- pageNumber: pageNumber,
97
- },
98
- rects: [],
99
- };
100
- const scaledPosition = viewportPositionToScaled(viewportPosition, viewer);
101
- // For arrows, calculate start/end points as percentages within the bounding box
102
- let shapeData = {
103
- shapeType,
104
- strokeColor,
105
- strokeWidth,
106
- };
107
- if (shapeType === "arrow") {
108
- // Calculate start and end points relative to bounding box (0-1 range)
109
- shapeData.startPoint = {
110
- x: (startPoint.x - minX) / width,
111
- y: (startPoint.y - minY) / height,
112
- };
113
- shapeData.endPoint = {
114
- x: (currentPoint.x - minX) / width,
115
- y: (currentPoint.y - minY) / height,
116
- };
117
- console.log("ShapeCanvas: Arrow points", shapeData.startPoint, "->", shapeData.endPoint);
118
- }
119
- console.log("ShapeCanvas: Created shape at position", scaledPosition);
120
- onComplete(scaledPosition, shapeData);
121
- // Reset state
122
- setStartPoint(null);
123
- setCurrentPoint(null);
124
- setPageNumber(null);
125
- setPageRect(null);
126
- }, [startPoint, currentPoint, pageNumber, viewer, shapeType, strokeColor, strokeWidth, onComplete]);
127
- // Mouse event handlers
128
- const handleMouseDown = useCallback((e) => {
129
- e.preventDefault();
130
- handleStart(e.clientX, e.clientY);
131
- }, [handleStart]);
132
- const handleMouseMove = useCallback((e) => {
133
- handleMove(e.clientX, e.clientY);
134
- }, [handleMove]);
135
- const handleMouseUp = useCallback(() => {
136
- handleEnd();
137
- }, [handleEnd]);
138
- // Touch event handlers
139
- const handleTouchStart = useCallback((e) => {
140
- e.preventDefault();
141
- if (e.touches.length > 0) {
142
- handleStart(e.touches[0].clientX, e.touches[0].clientY);
143
- }
144
- }, [handleStart]);
145
- const handleTouchMove = useCallback((e) => {
146
- e.preventDefault();
147
- if (e.touches.length > 0) {
148
- handleMove(e.touches[0].clientX, e.touches[0].clientY);
149
- }
150
- }, [handleMove]);
151
- const handleTouchEnd = useCallback(() => {
152
- handleEnd();
153
- }, [handleEnd]);
154
- // Handle keyboard events
155
- useEffect(() => {
156
- if (!isActive)
157
- return;
158
- const handleKeyDown = (e) => {
159
- if (e.code === "Escape") {
160
- console.log("ShapeCanvas: Cancelled via Escape");
161
- onCancel();
162
- }
163
- };
164
- document.addEventListener("keydown", handleKeyDown);
165
- return () => document.removeEventListener("keydown", handleKeyDown);
166
- }, [isActive, onCancel]);
167
- // Render shape preview
168
- const renderShapePreview = () => {
169
- if (!startPoint || !currentPoint || !pageRect)
170
- return null;
171
- const minX = Math.min(startPoint.x, currentPoint.x);
172
- const minY = Math.min(startPoint.y, currentPoint.y);
173
- const width = Math.abs(currentPoint.x - startPoint.x);
174
- const height = Math.abs(currentPoint.y - startPoint.y);
175
- const svgStyle = {
176
- position: "fixed",
177
- left: pageRect.left,
178
- top: pageRect.top,
179
- width: pageRect.width,
180
- height: pageRect.height,
181
- pointerEvents: "none",
182
- zIndex: 1001,
183
- };
184
- return (React.createElement("svg", { style: svgStyle },
185
- shapeType === "rectangle" && (React.createElement("rect", { x: minX, y: minY, width: width, height: height, stroke: strokeColor, strokeWidth: strokeWidth, fill: "none" })),
186
- shapeType === "circle" && (React.createElement("ellipse", { cx: minX + width / 2, cy: minY + height / 2, rx: width / 2, ry: height / 2, stroke: strokeColor, strokeWidth: strokeWidth, fill: "none" })),
187
- shapeType === "arrow" && (React.createElement(React.Fragment, null,
188
- React.createElement("defs", null,
189
- React.createElement("marker", { id: "shape-canvas-arrowhead", markerWidth: "10", markerHeight: "7", refX: "9", refY: "3.5", orient: "auto" },
190
- React.createElement("polygon", { points: "0 0, 10 3.5, 0 7", fill: strokeColor }))),
191
- React.createElement("line", { x1: startPoint.x, y1: startPoint.y, x2: currentPoint.x, y2: currentPoint.y, stroke: strokeColor, strokeWidth: strokeWidth, markerEnd: "url(#shape-canvas-arrowhead)" })))));
192
- };
193
- if (!isActive)
194
- return null;
195
- return (React.createElement(React.Fragment, null,
196
- React.createElement("div", { ref: containerRef, className: "ShapeCanvas", onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd }),
197
- renderShapePreview(),
198
- React.createElement("div", { className: "ShapeCanvas__controls" },
199
- React.createElement("div", { className: "ShapeCanvas__hint" },
200
- "Click and drag to draw a ",
201
- shapeType,
202
- ". Press Escape to cancel."),
203
- React.createElement("button", { type: "button", className: "ShapeCanvas__cancelButton", onClick: onCancel }, "Cancel"))));
204
- };
205
- //# sourceMappingURL=ShapeCanvas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShapeCanvas.js","sourceRoot":"","sources":["../../../src/components/ShapeCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,MAAM,EACN,SAAS,EACT,WAAW,EACX,QAAQ,GAGT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,0BAA0B,CAAC;AAwDlC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,WAAW,GAAG,SAAS,EACvB,WAAW,GAAG,CAAC,EACf,MAAM,EACN,UAAU,EACV,QAAQ,GACS,EAAE,EAAE;IACrB,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACjE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACrE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAClE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAC/D,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEnC,yCAAyC;IACzC,MAAM,iBAAiB,GAAG,WAAW,CACnC,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE;QACnC,IAAI,CA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,QAAQ,aAGV,CACL,CACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,107 +0,0 @@
1
- import React, { CSSProperties, MouseEvent, ReactNode } from "react";
2
- import "../style/ShapeHighlight.css";
3
- import type { LTWHP, ShapeType, ViewportHighlight } from "../types";
4
- /**
5
- * Style options for shape highlight appearance.
6
- */
7
- export interface ShapeStyle {
8
- strokeColor?: string;
9
- strokeWidth?: number;
10
- }
11
- /**
12
- * The props type for {@link ShapeHighlight}.
13
- *
14
- * @category Component Properties
15
- */
16
- export interface ShapeHighlightProps {
17
- /**
18
- * The highlight to be rendered as a {@link ShapeHighlight}.
19
- */
20
- highlight: ViewportHighlight;
21
- /**
22
- * A callback triggered whenever the highlight position or size changes.
23
- *
24
- * @param rect - The updated highlight area.
25
- */
26
- onChange?(rect: LTWHP): void;
27
- /**
28
- * Has the highlight been auto-scrolled into view?
29
- */
30
- isScrolledTo?: boolean;
31
- /**
32
- * react-rnd bounds on the highlight area.
33
- */
34
- bounds?: string | Element;
35
- /**
36
- * A callback triggered on context menu.
37
- */
38
- onContextMenu?(event: MouseEvent<HTMLDivElement>): void;
39
- /**
40
- * Event called when editing begins (drag or resize).
41
- */
42
- onEditStart?(): void;
43
- /**
44
- * Event called when editing ends.
45
- */
46
- onEditEnd?(): void;
47
- /**
48
- * Custom styling for the container.
49
- */
50
- style?: CSSProperties;
51
- /**
52
- * The type of shape to render.
53
- * @default "rectangle"
54
- */
55
- shapeType?: ShapeType;
56
- /**
57
- * Stroke color for the shape.
58
- * @default "#000000"
59
- */
60
- strokeColor?: string;
61
- /**
62
- * Stroke width for the shape.
63
- * @default 2
64
- */
65
- strokeWidth?: number;
66
- /**
67
- * Callback triggered when the style changes.
68
- */
69
- onStyleChange?(style: ShapeStyle): void;
70
- /**
71
- * Callback triggered when the delete button is clicked.
72
- */
73
- onDelete?(): void;
74
- /**
75
- * Custom style icon. Replaces the default palette icon.
76
- */
77
- styleIcon?: ReactNode;
78
- /**
79
- * Custom delete icon. Replaces the default trash icon.
80
- */
81
- deleteIcon?: ReactNode;
82
- /**
83
- * Custom color presets for the style panel.
84
- */
85
- colorPresets?: string[];
86
- /**
87
- * For arrows: start point as percentage of bounding box (0-1).
88
- */
89
- startPoint?: {
90
- x: number;
91
- y: number;
92
- };
93
- /**
94
- * For arrows: end point as percentage of bounding box (0-1).
95
- */
96
- endPoint?: {
97
- x: number;
98
- y: number;
99
- };
100
- }
101
- /**
102
- * Renders a draggable, resizable shape annotation.
103
- * Supports rectangle, circle/ellipse, and arrow shapes.
104
- *
105
- * @category Component
106
- */
107
- export declare const ShapeHighlight: ({ highlight, onChange, isScrolledTo, bounds, onContextMenu, onEditStart, onEditEnd, style, shapeType, strokeColor, strokeWidth, onStyleChange, onDelete, styleIcon, deleteIcon, colorPresets, startPoint, endPoint, }: ShapeHighlightProps) => React.JSX.Element;
@@ -1,140 +0,0 @@
1
- import React, { useState, useRef, useEffect, } from "react";
2
- import { Rnd } from "react-rnd";
3
- import { getPageFromElement } from "../lib/pdfjs-dom";
4
- import "../style/ShapeHighlight.css";
5
- // Default icons
6
- const DefaultStyleIcon = () => (React.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor" },
7
- React.createElement("path", { d: "M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z" })));
8
- const DefaultDeleteIcon = () => (React.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor" },
9
- React.createElement("path", { d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" })));
10
- // Default color presets for shapes
11
- const DEFAULT_COLOR_PRESETS = [
12
- "#000000", // Black
13
- "#FF0000", // Red
14
- "#0000FF", // Blue
15
- "#00AA00", // Green
16
- "#FF6600", // Orange
17
- ];
18
- // Stroke width options
19
- const STROKE_WIDTHS = [
20
- { label: "Thin", value: 1 },
21
- { label: "Medium", value: 2 },
22
- { label: "Thick", value: 4 },
23
- ];
24
- /**
25
- * Renders a draggable, resizable shape annotation.
26
- * Supports rectangle, circle/ellipse, and arrow shapes.
27
- *
28
- * @category Component
29
- */
30
- export const ShapeHighlight = ({ highlight, onChange, isScrolledTo, bounds, onContextMenu, onEditStart, onEditEnd, style, shapeType = "rectangle", strokeColor = "#000000", strokeWidth = 2, onStyleChange, onDelete, styleIcon, deleteIcon, colorPresets = DEFAULT_COLOR_PRESETS, startPoint, endPoint, }) => {
31
- const [isStylePanelOpen, setIsStylePanelOpen] = useState(false);
32
- const [isHovered, setIsHovered] = useState(false);
33
- const stylePanelRef = useRef(null);
34
- // Close style panel when clicking outside
35
- useEffect(() => {
36
- if (!isStylePanelOpen)
37
- return;
38
- const handleClickOutside = (e) => {
39
- if (stylePanelRef.current &&
40
- !stylePanelRef.current.contains(e.target)) {
41
- setIsStylePanelOpen(false);
42
- }
43
- };
44
- // Delay adding listener to avoid immediate close
45
- const timeoutId = setTimeout(() => {
46
- document.addEventListener("mousedown", handleClickOutside);
47
- }, 0);
48
- return () => {
49
- clearTimeout(timeoutId);
50
- document.removeEventListener("mousedown", handleClickOutside);
51
- };
52
- }, [isStylePanelOpen]);
53
- const highlightClass = isScrolledTo ? "ShapeHighlight--scrolledTo" : "";
54
- // Generate key based on position for Rnd remount on position changes
55
- const key = `${highlight.position.boundingRect.width}${highlight.position.boundingRect.height}${highlight.position.boundingRect.left}${highlight.position.boundingRect.top}`;
56
- // Generate unique ID for SVG markers
57
- const markerId = `arrowhead-${highlight.id}`;
58
- // Render the shape SVG
59
- const renderShape = (width, height) => {
60
- switch (shapeType) {
61
- case "rectangle":
62
- return (React.createElement("svg", { className: "ShapeHighlight__svg", width: width, height: height, viewBox: `0 0 ${width} ${height}` },
63
- React.createElement("rect", { x: strokeWidth / 2, y: strokeWidth / 2, width: width - strokeWidth, height: height - strokeWidth, stroke: strokeColor, strokeWidth: strokeWidth, fill: "none" })));
64
- case "circle":
65
- return (React.createElement("svg", { className: "ShapeHighlight__svg", width: width, height: height, viewBox: `0 0 ${width} ${height}` },
66
- React.createElement("ellipse", { cx: width / 2, cy: height / 2, rx: width / 2 - strokeWidth / 2, ry: height / 2 - strokeWidth / 2, stroke: strokeColor, strokeWidth: strokeWidth, fill: "none" })));
67
- case "arrow": {
68
- // Use stored start/end points if available, otherwise default to left-to-right
69
- const x1 = startPoint ? startPoint.x * width : strokeWidth;
70
- const y1 = startPoint ? startPoint.y * height : height / 2;
71
- const x2 = endPoint ? endPoint.x * width : width - strokeWidth - 10;
72
- const y2 = endPoint ? endPoint.y * height : height / 2;
73
- return (React.createElement("svg", { className: "ShapeHighlight__svg", width: width, height: height, viewBox: `0 0 ${width} ${height}` },
74
- React.createElement("defs", null,
75
- React.createElement("marker", { id: markerId, markerWidth: "10", markerHeight: "7", refX: "9", refY: "3.5", orient: "auto" },
76
- React.createElement("polygon", { points: "0 0, 10 3.5, 0 7", fill: strokeColor }))),
77
- React.createElement("line", { x1: x1, y1: y1, x2: x2, y2: y2, stroke: strokeColor, strokeWidth: strokeWidth, markerEnd: `url(#${markerId})` })));
78
- }
79
- default:
80
- return null;
81
- }
82
- };
83
- return (React.createElement("div", { className: `ShapeHighlight ${highlightClass}`, onContextMenu: onContextMenu },
84
- (onStyleChange || onDelete) && (React.createElement("div", { className: "ShapeHighlight__toolbar-wrapper", style: {
85
- position: "absolute",
86
- left: highlight.position.boundingRect.left,
87
- top: highlight.position.boundingRect.top - 28,
88
- paddingBottom: 12,
89
- }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) },
90
- React.createElement("div", { className: `ShapeHighlight__toolbar ${isHovered || isStylePanelOpen ? "ShapeHighlight__toolbar--visible" : ""}` },
91
- onStyleChange && (React.createElement("button", { className: "ShapeHighlight__style-button", onClick: (e) => {
92
- e.stopPropagation();
93
- setIsStylePanelOpen(!isStylePanelOpen);
94
- }, title: "Change style", type: "button" }, styleIcon || React.createElement(DefaultStyleIcon, null))),
95
- onDelete && (React.createElement("button", { className: "ShapeHighlight__delete-button", onClick: (e) => {
96
- e.stopPropagation();
97
- onDelete();
98
- }, title: "Delete", type: "button" }, deleteIcon || React.createElement(DefaultDeleteIcon, null)))),
99
- isStylePanelOpen && onStyleChange && (React.createElement("div", { className: "ShapeHighlight__style-panel", ref: stylePanelRef, onClick: (e) => e.stopPropagation() },
100
- React.createElement("div", { className: "ShapeHighlight__style-row" },
101
- React.createElement("label", null, "Color"),
102
- React.createElement("div", { className: "ShapeHighlight__color-options" },
103
- React.createElement("div", { className: "ShapeHighlight__color-presets" }, colorPresets.map((c) => (React.createElement("button", { key: c, type: "button", className: `ShapeHighlight__color-preset ${strokeColor === c ? "active" : ""}`, style: { backgroundColor: c }, onClick: () => onStyleChange({ strokeColor: c }), title: c })))),
104
- React.createElement("input", { type: "color", value: strokeColor, onChange: (e) => {
105
- onStyleChange({ strokeColor: e.target.value });
106
- } }))),
107
- React.createElement("div", { className: "ShapeHighlight__style-row" },
108
- React.createElement("label", null, "Width"),
109
- React.createElement("div", { className: "ShapeHighlight__width-options" }, STROKE_WIDTHS.map((w) => (React.createElement("button", { key: w.value, type: "button", className: `ShapeHighlight__width-button ${strokeWidth === w.value ? "active" : ""}`, onClick: () => onStyleChange({ strokeWidth: w.value }), title: w.label }, w.label))))))))),
110
- React.createElement(Rnd, { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), className: "ShapeHighlight__rnd", onDragStop: (_, data) => {
111
- const boundingRect = {
112
- ...highlight.position.boundingRect,
113
- top: data.y,
114
- left: data.x,
115
- };
116
- onChange?.(boundingRect);
117
- onEditEnd?.();
118
- }, onDragStart: onEditStart, onResizeStop: (_e, _direction, ref, _delta, position) => {
119
- const boundingRect = {
120
- top: position.y,
121
- left: position.x,
122
- width: ref.offsetWidth,
123
- height: ref.offsetHeight,
124
- pageNumber: getPageFromElement(ref)?.number ||
125
- highlight.position.boundingRect.pageNumber,
126
- };
127
- onChange?.(boundingRect);
128
- onEditEnd?.();
129
- }, onResizeStart: onEditStart, default: {
130
- x: highlight.position.boundingRect.left,
131
- y: highlight.position.boundingRect.top,
132
- width: highlight.position.boundingRect.width || 100,
133
- height: highlight.position.boundingRect.height || 100,
134
- }, minWidth: 20, minHeight: 20, key: key, bounds: bounds, lockAspectRatio: shapeType === "circle", onClick: (event) => {
135
- event.stopPropagation();
136
- event.preventDefault();
137
- }, style: style },
138
- React.createElement("div", { className: "ShapeHighlight__container" }, renderShape(highlight.position.boundingRect.width || 100, highlight.position.boundingRect.height || 100)))));
139
- };
140
- //# sourceMappingURL=ShapeHighlight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShapeHighlight.js","sourceRoot":"","sources":["../../../src/components/ShapeHighlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAIZ,QAAQ,EACR,MAAM,EACN,SAAS,GACV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,6BAA6B,CAAC;AAiHrC,gBAAgB;AAChB,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAC7B,6BAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,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