react-pdf-highlighter-plus 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +235 -52
- package/dist/esm/export-pdf-W2QGWADM.js +403 -0
- package/dist/esm/export-pdf-W2QGWADM.js.map +1 -0
- package/dist/esm/index.d.ts +309 -86
- package/dist/esm/index.js +2417 -820
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pdf.worker.min.mjs +21 -0
- package/dist/esm/style/AreaHighlight.css +9 -2
- package/dist/esm/style/DrawingHighlight.css +10 -0
- package/dist/esm/style/FreetextHighlight.css +60 -0
- package/dist/esm/style/ImageHighlight.css +2 -1
- package/dist/esm/style/PdfHighlighter.css +103 -12
- package/dist/esm/style/TextHighlight.css +9 -2
- package/package.json +1 -1
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
position: absolute;
|
|
8
8
|
background: rgba(255, 226, 143, 1);
|
|
9
|
-
transition: background 0.3s;
|
|
9
|
+
transition: background 0.3s, box-shadow 0.2s ease;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.AreaHighlight--scrolledTo .AreaHighlight__part {
|
|
13
|
-
|
|
13
|
+
box-shadow:
|
|
14
|
+
0 0 0 2px #ff4141,
|
|
15
|
+
0 0 0 4px rgba(255, 65, 65, 0.2);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
/* Toolbar wrapper - creates hover bridge between toolbar and highlight */
|
|
@@ -37,6 +39,7 @@
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
.AreaHighlight__style-button,
|
|
42
|
+
.AreaHighlight__copy-button,
|
|
40
43
|
.AreaHighlight__delete-button {
|
|
41
44
|
display: flex;
|
|
42
45
|
align-items: center;
|
|
@@ -56,6 +59,10 @@
|
|
|
56
59
|
background: rgba(255, 255, 255, 0.2);
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
.AreaHighlight__copy-button:hover {
|
|
63
|
+
background: rgba(255, 255, 255, 0.2);
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
.AreaHighlight__delete-button:hover {
|
|
60
67
|
background: rgba(255, 100, 100, 0.6);
|
|
61
68
|
}
|
|
@@ -31,6 +31,16 @@
|
|
|
31
31
|
transition: opacity 0.2s ease;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.DrawingHighlight__toolbar--floating {
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: auto;
|
|
37
|
+
left: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.DrawingHighlight__toolbar--visible {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
.DrawingHighlight__container:hover .DrawingHighlight__toolbar {
|
|
35
45
|
opacity: 1;
|
|
36
46
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
.FreetextHighlight {
|
|
2
2
|
position: absolute;
|
|
3
|
+
z-index: 30;
|
|
4
|
+
isolation: isolate;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.FreetextHighlight--editing,
|
|
8
|
+
.FreetextHighlight:hover {
|
|
9
|
+
z-index: 40;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.FreetextHighlight--collapsed {
|
|
13
|
+
z-index: 35;
|
|
3
14
|
}
|
|
4
15
|
|
|
5
16
|
.FreetextHighlight__container {
|
|
@@ -13,6 +24,10 @@
|
|
|
13
24
|
transition: box-shadow 0.2s ease;
|
|
14
25
|
}
|
|
15
26
|
|
|
27
|
+
.FreetextHighlight__rnd {
|
|
28
|
+
z-index: inherit;
|
|
29
|
+
}
|
|
30
|
+
|
|
16
31
|
.FreetextHighlight__container:hover {
|
|
17
32
|
box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.3);
|
|
18
33
|
}
|
|
@@ -247,3 +262,48 @@
|
|
|
247
262
|
.FreetextHighlight__delete-button:hover {
|
|
248
263
|
background: rgba(255, 100, 100, 0.6);
|
|
249
264
|
}
|
|
265
|
+
|
|
266
|
+
.FreetextHighlight__collapse-button {
|
|
267
|
+
display: flex;
|
|
268
|
+
align-items: center;
|
|
269
|
+
justify-content: center;
|
|
270
|
+
width: 20px;
|
|
271
|
+
height: 20px;
|
|
272
|
+
border: none;
|
|
273
|
+
background: transparent;
|
|
274
|
+
cursor: pointer;
|
|
275
|
+
color: white;
|
|
276
|
+
border-radius: 3px;
|
|
277
|
+
padding: 0;
|
|
278
|
+
transition: background 0.2s;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.FreetextHighlight__collapse-button:hover {
|
|
282
|
+
background: rgba(255, 255, 255, 0.2);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.FreetextHighlight--collapsed .FreetextHighlight__container {
|
|
286
|
+
align-items: center;
|
|
287
|
+
justify-content: center;
|
|
288
|
+
border-radius: 999px;
|
|
289
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
|
|
290
|
+
overflow: hidden;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.FreetextHighlight__compact-button {
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
justify-content: center;
|
|
297
|
+
width: 100%;
|
|
298
|
+
height: 100%;
|
|
299
|
+
border: none;
|
|
300
|
+
border-radius: inherit;
|
|
301
|
+
background: transparent;
|
|
302
|
+
color: inherit;
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
padding: 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.FreetextHighlight__compact-button:hover {
|
|
308
|
+
background: rgba(0, 0, 0, 0.08);
|
|
309
|
+
}
|
|
@@ -35,6 +35,53 @@
|
|
|
35
35
|
position: absolute;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
.PdfHighlighter__highlight-layer {
|
|
39
|
+
position: absolute;
|
|
40
|
+
inset: 0;
|
|
41
|
+
z-index: 4;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.textLayer > .PdfHighlighter__highlight-layer {
|
|
46
|
+
z-index: 4;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.PdfHighlighter__note-layer {
|
|
50
|
+
position: absolute;
|
|
51
|
+
inset: 0;
|
|
52
|
+
z-index: 5;
|
|
53
|
+
mix-blend-mode: normal;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.PdfHighlighter__config-layer {
|
|
58
|
+
position: absolute;
|
|
59
|
+
inset: 0;
|
|
60
|
+
z-index: 6;
|
|
61
|
+
mix-blend-mode: normal;
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.PdfHighlighter__highlight-layer > div,
|
|
66
|
+
.PdfHighlighter__highlight-layer .MonitoredHighlightContainer,
|
|
67
|
+
.PdfHighlighter__highlight-layer .TextHighlight,
|
|
68
|
+
.PdfHighlighter__highlight-layer .AreaHighlight,
|
|
69
|
+
.PdfHighlighter__highlight-layer .FreetextHighlight,
|
|
70
|
+
.PdfHighlighter__highlight-layer .ImageHighlight,
|
|
71
|
+
.PdfHighlighter__highlight-layer .DrawingHighlight,
|
|
72
|
+
.PdfHighlighter__highlight-layer .ShapeHighlight {
|
|
73
|
+
pointer-events: auto;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.PdfHighlighter__note-layer > div,
|
|
77
|
+
.PdfHighlighter__note-layer .FreetextHighlight {
|
|
78
|
+
pointer-events: auto;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.PdfHighlighter__config-layer > * {
|
|
82
|
+
pointer-events: auto;
|
|
83
|
+
}
|
|
84
|
+
|
|
38
85
|
.PdfHighlighter--disable-selection {
|
|
39
86
|
user-select: none;
|
|
40
87
|
pointer-events: none;
|
|
@@ -76,16 +123,60 @@
|
|
|
76
123
|
cursor: crosshair;
|
|
77
124
|
}
|
|
78
125
|
|
|
79
|
-
/* Dark mode
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.
|
|
90
|
-
|
|
126
|
+
/* Dark mode recolors each page at draw time (OKLab map from theme.darkModeColors,
|
|
127
|
+
wired in PdfHighlighter). No CSS invert filter: inverting distorted photos and
|
|
128
|
+
colored text. Highlight/note/config layers render normally — they sit on
|
|
129
|
+
already-recolored pages, so no counter-inversion is needed. */
|
|
130
|
+
|
|
131
|
+
/* Dark mode: give every highlight a persistent red border so they stay legible
|
|
132
|
+
against the recolored dark page (light mode keeps the ring on scrolled-to
|
|
133
|
+
only). :not(--scrolledTo) so the active highlight keeps its stronger double
|
|
134
|
+
ring (equal-specificity rules would otherwise clobber it by load order). */
|
|
135
|
+
.PdfHighlighter--dark
|
|
136
|
+
.TextHighlight:not(.TextHighlight--scrolledTo)
|
|
137
|
+
.TextHighlight__part,
|
|
138
|
+
.PdfHighlighter--dark
|
|
139
|
+
.AreaHighlight:not(.AreaHighlight--scrolledTo)
|
|
140
|
+
.AreaHighlight__part {
|
|
141
|
+
box-shadow: 0 0 0 1px #ff4141;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* The text/highlight layer blends with the page canvas via `multiply`
|
|
145
|
+
(pdf_viewer.css). Over the dark recolored page that crushes highlights to
|
|
146
|
+
near-black, and `screen` washes them out (recolored text is already light, so
|
|
147
|
+
light highlight + light text = no contrast). Instead: normal blend, and make
|
|
148
|
+
the highlight FILLS translucent via --hl-fill-alpha (TextHighlight /
|
|
149
|
+
AreaHighlight read it through color-mix). Translucency comes from the fill
|
|
150
|
+
color, not element opacity, so the red border ring stays crisp. The light text
|
|
151
|
+
then reads on a muted colored tint — a proper dark-mode highlight. */
|
|
152
|
+
.PdfHighlighter--dark {
|
|
153
|
+
--hl-fill-alpha: 42%;
|
|
154
|
+
}
|
|
155
|
+
.PdfHighlighter--dark .textLayer {
|
|
156
|
+
mix-blend-mode: normal;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Live text selection: the default opaque blue + multiply/screen makes selected
|
|
160
|
+
text unreadable on dark. Force a translucent selection with normal blend so
|
|
161
|
+
the light text shows through the highlight. */
|
|
162
|
+
.PdfHighlighter--dark .textLayer ::selection {
|
|
163
|
+
background: rgba(120, 162, 247, 0.4) !important;
|
|
164
|
+
mix-blend-mode: normal;
|
|
165
|
+
}
|
|
166
|
+
.PdfHighlighter--dark .MouseSelection {
|
|
167
|
+
mix-blend-mode: normal;
|
|
168
|
+
opacity: 0.4;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* Respect the OS "reduce motion" setting within the viewer (scoped so the
|
|
172
|
+
library doesn't override a consumer's whole app). */
|
|
173
|
+
@media (prefers-reduced-motion: reduce) {
|
|
174
|
+
.PdfHighlighter,
|
|
175
|
+
.PdfHighlighter *,
|
|
176
|
+
.PdfHighlighter *::before,
|
|
177
|
+
.PdfHighlighter *::after {
|
|
178
|
+
animation-duration: 0.01ms !important;
|
|
179
|
+
animation-iteration-count: 1 !important;
|
|
180
|
+
transition-duration: 0.01ms !important;
|
|
181
|
+
}
|
|
91
182
|
}
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
cursor: pointer;
|
|
11
11
|
position: absolute;
|
|
12
12
|
background: rgba(255, 226, 143, 1);
|
|
13
|
-
transition: background 0.3s;
|
|
13
|
+
transition: background 0.3s, box-shadow 0.2s ease;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.TextHighlight--scrolledTo .TextHighlight__part {
|
|
17
|
-
|
|
17
|
+
box-shadow:
|
|
18
|
+
0 0 0 2px #ff4141,
|
|
19
|
+
0 0 0 4px rgba(255, 65, 65, 0.2);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
/* Toolbar wrapper - creates hover bridge between toolbar and highlight */
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
.TextHighlight__style-button,
|
|
46
|
+
.TextHighlight__copy-button,
|
|
44
47
|
.TextHighlight__delete-button {
|
|
45
48
|
display: flex;
|
|
46
49
|
align-items: center;
|
|
@@ -60,6 +63,10 @@
|
|
|
60
63
|
background: rgba(255, 255, 255, 0.2);
|
|
61
64
|
}
|
|
62
65
|
|
|
66
|
+
.TextHighlight__copy-button:hover {
|
|
67
|
+
background: rgba(255, 255, 255, 0.2);
|
|
68
|
+
}
|
|
69
|
+
|
|
63
70
|
.TextHighlight__delete-button:hover {
|
|
64
71
|
background: rgba(255, 100, 100, 0.6);
|
|
65
72
|
}
|
package/package.json
CHANGED