@react-pdf-kit/viewer 0.0.0-experimental.8 → 0.0.0-experimental.9
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/RPLayout.module-7766e0b4.js +14 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +15 -15
- package/dist/components/RPConfig.js +11 -12
- package/dist/components/RPController.js +26 -21
- package/dist/components/RPDropFileZone.js +8 -7
- package/dist/components/RPPages.js +360 -351
- package/dist/components/RPProvider.js +24 -20
- package/dist/components/layout/LayoutContainer.js +1 -1
- package/dist/components/layout/LayoutWrapper.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +7 -4
- package/dist/components/layout/RPLayout.js +7 -4
- package/dist/components/layout/WrapperLayout.js +4 -3
- package/dist/components/layout/sidebar/RPSidebar.js +4 -3
- package/dist/components/layout/sidebar/Thumbnail.js +4 -3
- package/dist/components/layout/sidebar/Thumbnails.js +4 -3
- package/dist/components/layout/toolbar/DocumentDialog.js +6 -5
- package/dist/components/layout/toolbar/FileDownloadTool.js +4 -3
- package/dist/components/layout/toolbar/FileUploadTool.js +4 -3
- package/dist/components/layout/toolbar/MostPageTool.js +4 -3
- package/dist/components/layout/toolbar/OtherTool.js +4 -3
- package/dist/components/layout/toolbar/Paginate.js +4 -3
- package/dist/components/layout/toolbar/PrintTool.js +4 -3
- package/dist/components/layout/toolbar/RPMoreOptions.js +4 -3
- package/dist/components/layout/toolbar/RPToolbar.js +6 -3
- package/dist/components/layout/toolbar/RPToolbarEnd.js +4 -3
- package/dist/components/layout/toolbar/RotateTool.js +4 -3
- package/dist/components/layout/toolbar/SearchResultNavigator.js +6 -3
- package/dist/components/layout/toolbar/SearchTool.js +6 -3
- package/dist/components/layout/toolbar/ThumbnailTool.js +4 -3
- package/dist/components/layout/toolbar/ToolbarCustom.js +4 -3
- package/dist/components/layout/toolbar/ToolbarDefault.js +6 -3
- package/dist/components/layout/toolbar/ToolbarLayout.js +6 -3
- package/dist/components/layout/toolbar/ZoomTool.js +4 -3
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +4 -3
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +9 -5
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +9 -5
- package/dist/components/layout/toolbar/tools/InputPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/LastPageTool.js +9 -5
- package/dist/components/layout/toolbar/tools/NextPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/PrintTool.js +4 -3
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +4 -3
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +4 -3
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +4 -3
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +4 -3
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +14 -13
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +4 -3
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +6 -3
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +4 -3
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -3
- package/dist/components/page/AnnotationLayer.js +69 -72
- package/dist/components/page/CanvasLayer.js +4 -3
- package/dist/components/page/CustomElement.js +4 -3
- package/dist/components/page/DualPage.js +11 -5
- package/dist/components/page/DualPageWithCover.js +11 -5
- package/dist/components/page/RPPage.js +12 -6
- package/dist/components/page/SinglePage.js +11 -5
- package/dist/components/page/TextHighlightLayer.js +86 -178
- package/dist/components/page/TextLayer.js +125 -170
- package/dist/components/ui/LoadingIndicator.js +8 -7
- package/dist/contexts/DimensionPagesContext.js +6 -5
- package/dist/contexts/DropFileZoneContext.js +5 -4
- package/dist/contexts/ElementPageContext.js +6 -5
- package/dist/contexts/FileInputContext.js +6 -5
- package/dist/contexts/HighlightContext.js +10 -7
- package/dist/contexts/PagesRotateContext.js +6 -5
- package/dist/contexts/PaginationContext.js +6 -5
- package/dist/contexts/PrintContext.js +17 -16
- package/dist/contexts/RPDocumentContext.js +14 -13
- package/dist/contexts/RenderQueueProvider.js +6 -5
- package/dist/contexts/RotationContext.js +9 -8
- package/dist/contexts/SearchContext.js +8 -5
- package/dist/contexts/TextSelectionContext.js +191 -0
- package/dist/contexts/ThumbnailsContext.js +5 -4
- package/dist/contexts/ZoomContext.js +6 -5
- package/dist/main.js +116 -113
- package/dist/types/components/layout/sidebar/Thumbnail.d.ts +2 -2
- package/dist/types/contexts/RPDocumentContext.d.ts +1 -1
- package/dist/types/contexts/RenderQueueProvider.d.ts +1 -1
- package/dist/types/contexts/RenderedPagesCache.d.ts +2 -2
- package/dist/types/contexts/TextSelectionContext.d.ts +14 -0
- package/dist/types/main.d.ts +1 -1
- package/dist/types/utils/annotations.d.ts +2 -2
- package/dist/types/utils/geometryCache.d.ts +15 -0
- package/dist/types/utils/getThumbnailViewport.d.ts +2 -2
- package/dist/types/utils/glyphHitTest.d.ts +12 -0
- package/dist/types/utils/highlight.d.ts +5 -5
- package/dist/types/utils/hooks/useHighlight.d.ts +1 -1
- package/dist/types/utils/hooks/useLoadPdf.d.ts +2 -2
- package/dist/types/utils/hooks/useLoadWorker.d.ts +5 -1
- package/dist/types/utils/hooks/usePdfProperties.d.ts +1 -1
- package/dist/types/utils/hooks/useTextSelection.d.ts +12 -3
- package/dist/types/utils/link_service.d.ts +2 -3
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/selectionUtils.d.ts +30 -0
- package/dist/types/utils/types.d.ts +5 -7
- package/dist/utils/geometryCache.js +32 -0
- package/dist/utils/glyphHitTest.js +29 -0
- package/dist/utils/highlight.js +184 -158
- package/dist/utils/hooks/useCopyText.js +60 -22
- package/dist/utils/hooks/useFileDownload.js +6 -5
- package/dist/utils/hooks/useHighlight.js +35 -33
- package/dist/utils/hooks/useLicense.js +62 -62
- package/dist/utils/hooks/useLoadPdf.js +102 -70
- package/dist/utils/hooks/useLoadWorker.js +4 -14
- package/dist/utils/hooks/usePageRotateContext.js +8 -7
- package/dist/utils/hooks/usePaginate.js +4 -3
- package/dist/utils/hooks/usePinch.js +11 -10
- package/dist/utils/hooks/usePresentPage.js +4 -3
- package/dist/utils/hooks/usePrint.js +74 -78
- package/dist/utils/hooks/useRotate.js +4 -3
- package/dist/utils/hooks/useScrollToPage.js +4 -3
- package/dist/utils/hooks/useSearch.js +18 -15
- package/dist/utils/hooks/useTextSelection.js +2 -73
- package/dist/utils/hooks/useThumbnail.js +18 -17
- package/dist/utils/hooks/useVirtualReactWindow.js +4 -3
- package/dist/utils/link_service.js +18 -19
- package/dist/utils/renderPage.js +1 -1
- package/dist/utils/selectionUtils.js +96 -0
- package/package.json +2 -3
- package/dist/RPLayout.module-b4b23e29.js +0 -14
- package/dist/types/utils/hooks/useFlickerSelectText.d.ts +0 -1
- package/dist/utils/hooks/useFlickerSelectText.js +0 -25
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useState as f, useMemo as d, useCallback as
|
|
1
|
+
import { useState as f, useMemo as d, useCallback as u, useEffect as b } from "react";
|
|
2
2
|
import { useDocumentContext as h } from "../../contexts/RPDocumentContext.js";
|
|
3
3
|
import { getThumbnailViewport as P } from "../getThumbnailViewport.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "./useLoadPdf.js";
|
|
6
|
-
import "
|
|
6
|
+
import "@pdf-viewer/pdfium";
|
|
7
|
+
import "@pdf-viewer/pdfium/compat";
|
|
7
8
|
import "../types.js";
|
|
8
9
|
import "../../de_DE-a553b162.js";
|
|
9
10
|
import "../../contexts/ConfigContext.js";
|
|
@@ -12,21 +13,21 @@ import "../appConsole.js";
|
|
|
12
13
|
import "./usePdfProperties.js";
|
|
13
14
|
import "../convertPdfDate.js";
|
|
14
15
|
import "../formatFileSize.js";
|
|
15
|
-
const
|
|
16
|
-
const [
|
|
17
|
-
(
|
|
16
|
+
const E = () => {
|
|
17
|
+
const [a, s] = f({}), { pages: t } = h(), p = d(() => Object.keys(a).length, [a]), n = u(
|
|
18
|
+
(i) => {
|
|
18
19
|
if (!t.size)
|
|
19
20
|
return;
|
|
20
|
-
const e =
|
|
21
|
-
const { thumbnailViewport:
|
|
21
|
+
const e = i > t.size ? t.size : i, c = Array.from(t.values()).slice(0, e).map((o) => {
|
|
22
|
+
const { thumbnailViewport: r, scale: g } = P(o.page, o.defaultRotation);
|
|
22
23
|
return {
|
|
23
24
|
scale: g,
|
|
24
25
|
page: o.page,
|
|
25
26
|
loading: !0,
|
|
26
|
-
viewport:
|
|
27
|
+
viewport: r,
|
|
27
28
|
defaultRotation: o.defaultRotation
|
|
28
29
|
};
|
|
29
|
-
}).reduce((o,
|
|
30
|
+
}).reduce((o, r) => (o[r.page.pageNumber] = r, o), {});
|
|
30
31
|
s(c);
|
|
31
32
|
},
|
|
32
33
|
[t]
|
|
@@ -34,14 +35,14 @@ const D = () => {
|
|
|
34
35
|
b(() => {
|
|
35
36
|
n(10);
|
|
36
37
|
}, [n]);
|
|
37
|
-
const l =
|
|
38
|
-
(
|
|
38
|
+
const l = u(
|
|
39
|
+
(i) => {
|
|
39
40
|
if (!t)
|
|
40
41
|
return;
|
|
41
|
-
const e = t.get(
|
|
42
|
-
e && s((
|
|
43
|
-
...
|
|
44
|
-
[
|
|
42
|
+
const e = t.get(i);
|
|
43
|
+
e && s((m) => ({
|
|
44
|
+
...m,
|
|
45
|
+
[i]: {
|
|
45
46
|
loading: !0,
|
|
46
47
|
page: e.page,
|
|
47
48
|
viewport: e.thumbnailViewport,
|
|
@@ -52,8 +53,8 @@ const D = () => {
|
|
|
52
53
|
},
|
|
53
54
|
[t]
|
|
54
55
|
);
|
|
55
|
-
return { thumbnailPages:
|
|
56
|
+
return { thumbnailPages: a, addPage: l, addToPage: n, thumbnailLength: p };
|
|
56
57
|
};
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
+
E as useThumbnail
|
|
59
60
|
};
|
|
@@ -12,7 +12,8 @@ import "../appConsole.js";
|
|
|
12
12
|
import "../../contexts/InitialStateContext.js";
|
|
13
13
|
import "../../contexts/RPDocumentContext.js";
|
|
14
14
|
import "./useLoadPdf.js";
|
|
15
|
-
import "
|
|
15
|
+
import "@pdf-viewer/pdfium";
|
|
16
|
+
import "@pdf-viewer/pdfium/compat";
|
|
16
17
|
import "../getThumbnailViewport.js";
|
|
17
18
|
import "../../contexts/ConfigContext.js";
|
|
18
19
|
import "../../contexts/DocumentPasswordContext.js";
|
|
@@ -28,7 +29,7 @@ import "../../contexts/GlobalCurrentPage.js";
|
|
|
28
29
|
import "../../contexts/EventCallbackContext.js";
|
|
29
30
|
import "./useDebounce.js";
|
|
30
31
|
import "../../contexts/PagesRotateContext.js";
|
|
31
|
-
const
|
|
32
|
+
const lt = () => {
|
|
32
33
|
const { viewMode: n } = G(), { scrollMode: c } = x(), { setColumnCount: f } = H(), { virtualScrollableElementRef: w } = M(), t = O(), l = m(() => t.heights.length, [t.heights]), o = m(() => c === C.HORIZONTAL_SCROLLING ? l : n === g.DUAL_PAGE || n === g.DUAL_PAGE_WITH_COVER ? 2 : 1, [n, c, c, l, w]), d = m(() => {
|
|
33
34
|
if (n === g.DUAL_PAGE_WITH_COVER && t.widths.length > 0) {
|
|
34
35
|
const i = [0, 0];
|
|
@@ -92,5 +93,5 @@ const ct = () => {
|
|
|
92
93
|
};
|
|
93
94
|
};
|
|
94
95
|
export {
|
|
95
|
-
|
|
96
|
+
lt as useVirtualReactWindow
|
|
96
97
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var u = (n, e, t) => e in n ? g(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var a = (n, e, t) => (u(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
class f {
|
|
5
5
|
constructor(e, t) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
a(this, "externalLinkEnabled");
|
|
7
|
+
a(this, "pdfDocument");
|
|
8
8
|
this.externalLinkEnabled = !0, this.pdfDocument = e, this.goToPage = t;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
@@ -46,7 +46,7 @@ class p {
|
|
|
46
46
|
* @param {string|Array} _dest - The named, or explicit, PDF destination.
|
|
47
47
|
*/
|
|
48
48
|
async goToDestination(e) {
|
|
49
|
-
var i, s
|
|
49
|
+
var i, s;
|
|
50
50
|
let t, r;
|
|
51
51
|
if (typeof e == "string" ? t = await ((i = this.pdfDocument) == null ? void 0 : i.getDestination(e)) : t = await e, !Array.isArray(t)) {
|
|
52
52
|
console.error(
|
|
@@ -55,17 +55,16 @@ class p {
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
const [o] = t;
|
|
58
|
-
if (o && typeof o == "object")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} else
|
|
58
|
+
if (o && typeof o == "object")
|
|
59
|
+
try {
|
|
60
|
+
r = (await ((s = this.pdfDocument) == null ? void 0 : s.getPageIndex(o)) || 0) + 1;
|
|
61
|
+
} catch {
|
|
62
|
+
console.error(
|
|
63
|
+
`goToDestination: "${o}" is not a valid page reference, for dest="${e}".`
|
|
64
|
+
);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
else
|
|
69
68
|
Number.isInteger(o) && (r = o + 1);
|
|
70
69
|
if (!r || r < 1 || r > this.pagesCount) {
|
|
71
70
|
console.error(
|
|
@@ -134,5 +133,5 @@ class p {
|
|
|
134
133
|
}
|
|
135
134
|
}
|
|
136
135
|
export {
|
|
137
|
-
|
|
136
|
+
f as SimpleLinkService
|
|
138
137
|
};
|
package/dist/utils/renderPage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnnotationMode as h } from "
|
|
1
|
+
import { AnnotationMode as h } from "@pdf-viewer/pdfium/compat";
|
|
2
2
|
const x = (e, t, s = {}) => {
|
|
3
3
|
const { scale: i = 1, rotate: r = 0, renderForms: w = !1, interactiveForm: a = !0 } = s, c = t.getContext("2d", {
|
|
4
4
|
desynchronized: !1
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function M(l) {
|
|
2
|
+
const e = [];
|
|
3
|
+
for (const h of l.runs)
|
|
4
|
+
for (const i of h.glyphs)
|
|
5
|
+
e.push(i);
|
|
6
|
+
return e;
|
|
7
|
+
}
|
|
8
|
+
function w(l, e) {
|
|
9
|
+
const h = M(l);
|
|
10
|
+
if (h.length === 0)
|
|
11
|
+
return { start: e, end: e };
|
|
12
|
+
const i = Math.max(0, Math.min(e, h.length - 1));
|
|
13
|
+
let o = i;
|
|
14
|
+
for (; o > 0 && h[o - 1].flags === 0; )
|
|
15
|
+
o--;
|
|
16
|
+
let r = i;
|
|
17
|
+
for (; r < h.length - 1 && h[r + 1].flags === 0; )
|
|
18
|
+
r++;
|
|
19
|
+
return { start: o, end: r };
|
|
20
|
+
}
|
|
21
|
+
function R(l, e) {
|
|
22
|
+
let h = -1, i = 0;
|
|
23
|
+
for (let t = 0; t < l.runs.length; t++) {
|
|
24
|
+
const a = l.runs[t].glyphs.length;
|
|
25
|
+
if (e < i + a) {
|
|
26
|
+
h = t;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
i += a;
|
|
30
|
+
}
|
|
31
|
+
if (h === -1)
|
|
32
|
+
return { start: e, end: e };
|
|
33
|
+
const o = l.runs[h].rect, r = o.height;
|
|
34
|
+
let s = 1 / 0, n = -1 / 0, c = 0;
|
|
35
|
+
for (let t = 0; t < l.runs.length; t++) {
|
|
36
|
+
const a = l.runs[t], g = a.rect, x = Math.max(g.y, o.y), y = Math.min(g.y + g.height, o.y + o.height), p = Math.max(0, y - x), u = Math.min(g.height, r);
|
|
37
|
+
if (u > 0 && p / u >= 0.5) {
|
|
38
|
+
const f = c, m = c + a.glyphs.length - 1;
|
|
39
|
+
f < s && (s = f), m > n && (n = m);
|
|
40
|
+
}
|
|
41
|
+
c += a.glyphs.length;
|
|
42
|
+
}
|
|
43
|
+
return s === 1 / 0 ? { start: e, end: e } : { start: s, end: n };
|
|
44
|
+
}
|
|
45
|
+
function v(l, e, h) {
|
|
46
|
+
const i = M(l);
|
|
47
|
+
if (i.length === 0)
|
|
48
|
+
return [];
|
|
49
|
+
const o = Math.max(0, Math.min(e, h)), r = Math.min(i.length - 1, Math.max(e, h)), s = [];
|
|
50
|
+
let n = null;
|
|
51
|
+
for (let c = o; c <= r; c++) {
|
|
52
|
+
const t = i[c];
|
|
53
|
+
if (t.flags === 2)
|
|
54
|
+
continue;
|
|
55
|
+
if (!n) {
|
|
56
|
+
n = { x: t.x, y: t.y, width: t.width, height: t.height };
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const a = Math.max(n.y, t.y), g = Math.min(
|
|
60
|
+
n.y + n.height,
|
|
61
|
+
t.y + t.height
|
|
62
|
+
), x = Math.max(0, g - a), y = Math.min(n.height, t.height);
|
|
63
|
+
if (y > 0 && x / y >= 0.5) {
|
|
64
|
+
const u = Math.min(n.x, t.x), f = Math.min(n.y, t.y), m = Math.max(n.x + n.width, t.x + t.width), d = Math.max(
|
|
65
|
+
n.y + n.height,
|
|
66
|
+
t.y + t.height
|
|
67
|
+
);
|
|
68
|
+
n = {
|
|
69
|
+
x: u,
|
|
70
|
+
y: f,
|
|
71
|
+
width: m - u,
|
|
72
|
+
height: d - f
|
|
73
|
+
};
|
|
74
|
+
} else
|
|
75
|
+
s.push(n), n = { x: t.x, y: t.y, width: t.width, height: t.height };
|
|
76
|
+
}
|
|
77
|
+
return n && s.push(n), s;
|
|
78
|
+
}
|
|
79
|
+
function B(l, e, h) {
|
|
80
|
+
const i = Math.min(e, h), o = Math.max(e, h);
|
|
81
|
+
let r = "", s = 0;
|
|
82
|
+
for (const n of l.runs) {
|
|
83
|
+
if (s + n.text.length - 1 >= i && s <= o) {
|
|
84
|
+
const t = Math.max(0, i - s), a = Math.min(n.text.length, o - s + 1);
|
|
85
|
+
r += n.text.slice(t, a);
|
|
86
|
+
}
|
|
87
|
+
s += n.glyphs.length;
|
|
88
|
+
}
|
|
89
|
+
return r;
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
R as expandToLineBoundary,
|
|
93
|
+
w as expandToWordBoundary,
|
|
94
|
+
v as rectsForRange,
|
|
95
|
+
B as textForRange
|
|
96
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-pdf-kit/viewer",
|
|
3
|
-
"version": "0.0.0-experimental.
|
|
3
|
+
"version": "0.0.0-experimental.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.",
|
|
6
6
|
"keywords": [
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"prepare": "husky"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@pdf-viewer/pdfium": "0.0.0-experimental.6",
|
|
40
41
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
41
42
|
"@radix-ui/react-popover": "^1.1.15",
|
|
42
43
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
43
|
-
"pdfjs-dist": "5.4.530",
|
|
44
44
|
"react-virtualized-auto-sizer": "^1.0.24",
|
|
45
45
|
"react-window": "^1.8.10"
|
|
46
46
|
},
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
"vite-plugin-lib-inject-css": "^2.1.1"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"pdfjs-dist": "5.4.530",
|
|
79
78
|
"react": "^18.2.0 || ^19.0.0",
|
|
80
79
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
81
80
|
},
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const r = {
|
|
2
|
-
"rp-layout": "_rp-layout_dptrm_1",
|
|
3
|
-
"rp-layout-wrapper": "_rp-layout-wrapper_dptrm_5",
|
|
4
|
-
"rp-content": "_rp-content_dptrm_11",
|
|
5
|
-
"rp-sidebar": "_rp-sidebar_dptrm_18",
|
|
6
|
-
"rp-pages": "_rp-pages_dptrm_23",
|
|
7
|
-
"rp-container": "_rp-container_dptrm_29",
|
|
8
|
-
"rp-loader": "_rp-loader_dptrm_33",
|
|
9
|
-
"rp-theme-variables": "_rp-theme-variables_dptrm_37",
|
|
10
|
-
"rp-dark-mode": "_rp-dark-mode_dptrm_153"
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
r as c
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useFlickerSelectText: () => void;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useRef as u, useCallback as g, useEffect as f } from "react";
|
|
2
|
-
const m = () => {
|
|
3
|
-
const i = u(null), a = u(/firefox/i.test(navigator.userAgent)), o = g(() => {
|
|
4
|
-
var c, d;
|
|
5
|
-
const s = document.getSelection();
|
|
6
|
-
if (!s || s.rangeCount === 0 || a.current)
|
|
7
|
-
return;
|
|
8
|
-
const t = s.getRangeAt(0), l = i.current && (t.compareBoundaryPoints(Range.END_TO_END, i.current) === 0 || t.compareBoundaryPoints(Range.START_TO_END, i.current) === 0);
|
|
9
|
-
let e = l ? t.startContainer : t.endContainer;
|
|
10
|
-
if ((e == null ? void 0 : e.nodeType) === Node.TEXT_NODE && (e = e.parentNode), !l && t.endOffset === 0)
|
|
11
|
-
do {
|
|
12
|
-
for (; !(e != null && e.previousSibling); )
|
|
13
|
-
e = e == null ? void 0 : e.parentNode;
|
|
14
|
-
e = e.previousSibling;
|
|
15
|
-
} while (!e.childNodes.length);
|
|
16
|
-
const n = (c = e == null ? void 0 : e.parentElement) == null ? void 0 : c.closest("[data-rp-text-layer]"), r = n == null ? void 0 : n.querySelector(".endOfContent");
|
|
17
|
-
r && (r.style.width = n.style.width, r.style.height = n.style.height, (d = e == null ? void 0 : e.parentElement) == null || d.insertBefore(r, l ? e : e.nextSibling)), i.current = t.cloneRange();
|
|
18
|
-
}, []);
|
|
19
|
-
f(() => (document == null || document.addEventListener("selectionchange", o), () => {
|
|
20
|
-
document == null || document.removeEventListener("selectionchange", o);
|
|
21
|
-
}), [o]);
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
m as useFlickerSelectText
|
|
25
|
-
};
|