@pdf-viewer/react 1.11.0-rc.2 → 1.12.0-beta.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.
Files changed (85) hide show
  1. package/dist/{ToolbarLayout.module-e774f3e1.js → ToolbarLayout.module-e03c451b.js} +1066 -1060
  2. package/dist/components/RPController.js +1 -1
  3. package/dist/components/RPPages.js +3 -2
  4. package/dist/components/RPProvider.js +31 -17
  5. package/dist/components/layout/LayoutContainer.js +3 -2
  6. package/dist/components/layout/RPDefaultLayout.js +1 -1
  7. package/dist/components/layout/RPLayout.js +4 -3
  8. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  9. package/dist/components/layout/sidebar/Thumbnail.js +3 -2
  10. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  11. package/dist/components/layout/toolbar/DocumentDialog.js +3 -2
  12. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  13. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  14. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  15. package/dist/components/layout/toolbar/MostPageTool.js +4 -3
  16. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  17. package/dist/components/layout/toolbar/Paginate.js +1 -1
  18. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  19. package/dist/components/layout/toolbar/RPMoreOptions.js +2 -2
  20. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  21. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  22. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  23. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  24. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  25. package/dist/components/layout/toolbar/SearchTool.js +3 -2
  26. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  28. package/dist/components/layout/toolbar/ToolbarCustom.js +4 -3
  29. package/dist/components/layout/toolbar/ToolbarDefault.js +4 -3
  30. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  31. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  32. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
  33. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  34. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  35. package/dist/components/layout/toolbar/tools/NextPageTool.js +4 -3
  36. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  38. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +4 -3
  41. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +1 -1
  42. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +4 -3
  43. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -4
  44. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +1 -1
  45. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +1 -1
  46. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +1 -1
  47. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +1 -1
  48. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +1 -1
  49. package/dist/components/page/AnnotationLayer.js +3 -2
  50. package/dist/components/page/CanvasLayer.js +3 -2
  51. package/dist/components/page/DualPage.js +1 -1
  52. package/dist/components/page/RPPage.js +3 -2
  53. package/dist/components/page/SinglePage.js +1 -1
  54. package/dist/components/page/TextHighlightLayer.js +3 -2
  55. package/dist/components/page/TextLayer.js +3 -2
  56. package/dist/components/ui/DropDown.js +1 -1
  57. package/dist/components/ui/LoadingIndicator.js +1 -1
  58. package/dist/components/ui/RPTooltip.js +430 -200
  59. package/dist/contexts/EventCallbackContext.js +30 -0
  60. package/dist/contexts/GlobalCurrentPage.js +13 -10
  61. package/dist/contexts/PagesRotateContext.js +23 -17
  62. package/dist/contexts/PaginationContext.js +1 -1
  63. package/dist/contexts/PrintContext.js +1 -1
  64. package/dist/contexts/RPDocumentContext.js +21 -19
  65. package/dist/contexts/RenderQueueProvider.js +1 -1
  66. package/dist/contexts/SearchContext.js +1 -1
  67. package/dist/contexts/ThumbnailsContext.js +1 -1
  68. package/dist/floating-ui.react-dom-d22a10b4.js +1474 -0
  69. package/dist/index-3bf64864.js +1886 -0
  70. package/dist/main.js +1 -1
  71. package/dist/types/contexts/EventCallbackContext.d.ts +5 -0
  72. package/dist/types/utils/types.d.ts +7 -1
  73. package/dist/utils/hooks/useFileDownload.js +3 -2
  74. package/dist/utils/hooks/useLicense.js +1 -1
  75. package/dist/utils/hooks/useLoadPdf.js +43 -41
  76. package/dist/utils/hooks/usePaginate.js +3 -2
  77. package/dist/utils/hooks/usePresentPage.js +3 -2
  78. package/dist/utils/hooks/usePrint.js +3 -2
  79. package/dist/utils/hooks/useScrollToPage.js +3 -2
  80. package/dist/utils/hooks/useSearch.js +3 -2
  81. package/dist/utils/hooks/useThumbnail.js +3 -2
  82. package/dist/utils/hooks/useVirtualReactWindow.js +3 -2
  83. package/package.json +1 -1
  84. package/dist/index-808ea7bf.js +0 -1685
  85. package/dist/index-a48ec088.js +0 -1672
@@ -0,0 +1,30 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { createContext as l, useContext as c } from "react";
3
+ const t = l({
4
+ onPageChange: () => {
5
+ },
6
+ onRotate: () => {
7
+ },
8
+ onScroll: () => {
9
+ }
10
+ }), v = () => c(t), x = ({
11
+ children: e,
12
+ onPageChange: o,
13
+ onRotate: n,
14
+ onScroll: r
15
+ }) => /* @__PURE__ */ a(
16
+ t.Provider,
17
+ {
18
+ value: {
19
+ onPageChange: o,
20
+ onRotate: n,
21
+ onScroll: r
22
+ },
23
+ children: e
24
+ }
25
+ );
26
+ export {
27
+ t as EventCallbackContext,
28
+ x as EventCallbackProvider,
29
+ v as useEventCallbackContext
30
+ };
@@ -1,16 +1,19 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { createContext as u, useContext as s, useState as c } from "react";
3
- import { useInitialStateContext as i } from "./InitialStateContext.js";
4
- const e = u({
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { createContext as s, useContext as c, useState as i, useEffect as l } from "react";
3
+ import { useInitialStateContext as C } from "./InitialStateContext.js";
4
+ import { useEventCallbackContext as P } from "./EventCallbackContext.js";
5
+ const n = s({
5
6
  currentPage: 1,
6
7
  setCurrentPage: () => {
7
8
  }
8
- }), C = () => s(e), x = ({ children: t }) => {
9
- const { initialPage: r = 1 } = i(), [o, n] = c(r);
10
- return /* @__PURE__ */ a(e.Provider, { value: { currentPage: o, setCurrentPage: n }, children: t });
9
+ }), p = () => c(n), b = ({ children: r }) => {
10
+ const { initialPage: o = 1 } = C(), [t, a] = i(o), { onPageChange: e } = P();
11
+ return l(() => {
12
+ e && e(t);
13
+ }, [t, e]), /* @__PURE__ */ u(n.Provider, { value: { currentPage: t, setCurrentPage: a }, children: r });
11
14
  };
12
15
  export {
13
- e as GlobalCurrentPage,
14
- x as GlobalCurrentPageProvider,
15
- C as useGlobalCurrentPage
16
+ n as GlobalCurrentPage,
17
+ b as GlobalCurrentPageProvider,
18
+ p as useGlobalCurrentPage
16
19
  };
@@ -1,25 +1,31 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { createContext as R, useContext as m, useState as f, useEffect as p, useMemo as P } from "react";
3
- import { useDocumentContext as c } from "./RPDocumentContext.js";
4
- import { useRotationContext as l } from "./RotationContext.js";
5
- const g = R({
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { createContext as c, useContext as f, useState as l, useEffect as p, useMemo as P } from "react";
3
+ import { useDocumentContext as x } from "./RPDocumentContext.js";
4
+ import { useRotationContext as C } from "./RotationContext.js";
5
+ import { useEventCallbackContext as d } from "./EventCallbackContext.js";
6
+ const i = c({
6
7
  singlePageRotate: {},
7
8
  setSinglePageRotate: () => {
8
9
  },
9
10
  pageRotate: {}
10
- }), S = () => {
11
- const { singlePageRotate: r, setSinglePageRotate: e, pageRotate: a } = m(g);
12
- return { singlePageRotate: r, setSinglePageRotate: e, pageRotate: a };
13
- }, b = ({ children: r }) => {
14
- const [e, a] = f({}), { rotate: n } = l(), { pages: t } = c();
11
+ }), j = () => {
12
+ const { singlePageRotate: n, setSinglePageRotate: t, pageRotate: a } = f(i);
13
+ return { singlePageRotate: n, setSinglePageRotate: t, pageRotate: a };
14
+ }, k = ({ children: n }) => {
15
+ const [t, a] = l({}), { rotate: r } = C(), { pages: e } = x(), { onRotate: s } = d();
15
16
  p(() => {
16
- t && a({});
17
- }, [t]);
18
- const u = P(() => t ? Array.from(t.values()).reduce((s, o) => (s[o.page.pageNumber] = e[o.page.pageNumber] ? (n + e[o.page.pageNumber] + o.defaultRotation) % 360 : (n + o.defaultRotation) % 360, s), {}) : {}, [n, t, e]);
19
- return /* @__PURE__ */ i(g.Provider, { value: { singlePageRotate: e, setSinglePageRotate: a, pageRotate: u }, children: r });
17
+ e && a({});
18
+ }, [e]);
19
+ const R = P(() => {
20
+ if (!e)
21
+ return {};
22
+ const g = Array.from(e.values()).reduce((u, o) => (u[o.page.pageNumber] = t[o.page.pageNumber] ? (r + t[o.page.pageNumber] + o.defaultRotation) % 360 : (r + o.defaultRotation) % 360, u), {});
23
+ return s && s(g), g;
24
+ }, [r, e, t, s]);
25
+ return /* @__PURE__ */ m(i.Provider, { value: { singlePageRotate: t, setSinglePageRotate: a, pageRotate: R }, children: n });
20
26
  };
21
27
  export {
22
- g as PagesRotateContext,
23
- b as PagesRotateProvider,
24
- S as usePagesRotateContext
28
+ i as PagesRotateContext,
29
+ k as PagesRotateProvider,
30
+ j as usePagesRotateContext
25
31
  };
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { t as p, P as e, u as P } from "../ToolbarLayout.module-e774f3e1.js";
3
+ import { t as p, P as e, u as P } from "../ToolbarLayout.module-e03c451b.js";
4
4
  import "./RPDocumentContext.js";
5
5
  import "../utils/appConsole.js";
6
6
  import "./GlobalCurrentPage.js";
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { w as e, g as n, c as s } from "../ToolbarLayout.module-e774f3e1.js";
3
+ import { w as e, g as n, c as s } from "../ToolbarLayout.module-e03c451b.js";
4
4
  export {
5
5
  e as PrintContext,
6
6
  n as PrintProvider,
@@ -1,9 +1,9 @@
1
- import { jsx as C } from "react/jsx-runtime";
2
- import { createContext as h, useState as m, useEffect as v, useMemo as S, useContext as D } from "react";
3
- import { useLoadPdf as F } from "../utils/hooks/useLoadPdf.js";
4
- import { usePdfProperties as M } from "../utils/hooks/usePdfProperties.js";
5
- import { appConsole as j } from "../utils/appConsole.js";
6
- const u = h({
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { createContext as v, useState as m, useEffect as S, useMemo as D, useContext as F } from "react";
3
+ import { useLoadPdf as M } from "../utils/hooks/useLoadPdf.js";
4
+ import { usePdfProperties as j } from "../utils/hooks/usePdfProperties.js";
5
+ import { appConsole as k } from "../utils/appConsole.js";
6
+ const u = v({
7
7
  pdf: void 0,
8
8
  pages: /* @__PURE__ */ new Map(),
9
9
  setPdfSrc: () => {
@@ -13,21 +13,23 @@ const u = h({
13
13
  loading: !1,
14
14
  loaderProgress: 0,
15
15
  error: void 0
16
- }), b = ({
16
+ }), q = ({
17
17
  children: t,
18
18
  src: e,
19
19
  characterMap: c,
20
20
  onLoadError: P,
21
- onLoaded: g
21
+ onLoaded: g,
22
+ onLoadProgress: x
22
23
  }) => {
23
- const [o, n] = m(e), [s, i] = m(), { pdf: r, pages: d, loading: p, loadingProgress: f, error: a } = F(o, c, {
24
+ const [o, n] = m(e), [s, i] = m(), { pdf: r, pages: d, loading: p, loadingProgress: f, error: a } = M(o, c, {
24
25
  onLoadError: P,
25
- onLoaded: g
26
- }), l = M(o, r, s);
27
- v(() => {
26
+ onLoaded: g,
27
+ onLoadProgress: x
28
+ }), l = j(o, r, s);
29
+ S(() => {
28
30
  i(e == null ? void 0 : e.split("/").pop()), n(e);
29
31
  }, [e]);
30
- const x = S(() => ({
32
+ const C = D(() => ({
31
33
  pdf: r,
32
34
  pages: d,
33
35
  pdfSrc: o,
@@ -39,13 +41,13 @@ const u = h({
39
41
  loaderProgress: f,
40
42
  error: a
41
43
  }), [r, d, o, l, p, f, a]);
42
- return /* @__PURE__ */ C(u.Provider, { value: x, children: o ? t : null });
43
- }, q = () => {
44
- const t = D(u);
45
- return t.pdfSrc || j.error("Please use this hooks inside children component of RPDocument"), t;
44
+ return /* @__PURE__ */ h(u.Provider, { value: C, children: o ? t : null });
45
+ }, y = () => {
46
+ const t = F(u);
47
+ return t.pdfSrc || k.error("Please use this hooks inside children component of RPDocument"), t;
46
48
  };
47
49
  export {
48
- b as DocumentProvider,
50
+ q as DocumentProvider,
49
51
  u as default,
50
- q as useDocumentContext
52
+ y as useDocumentContext
51
53
  };
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../utils/Queue.js";
4
4
  import "../utils/renderPage.js";
5
- import { B as m, f as p, C as d } from "../ToolbarLayout.module-e774f3e1.js";
5
+ import { B as m, f as p, C as d } from "../ToolbarLayout.module-e03c451b.js";
6
6
  export {
7
7
  m as RenderQueueContext,
8
8
  p as RenderQueueProvider,
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { A as a, e as s, d as c } from "../ToolbarLayout.module-e774f3e1.js";
3
+ import { A as a, e as s, d as c } from "../ToolbarLayout.module-e03c451b.js";
4
4
  export {
5
5
  a as SearchContext,
6
6
  s as SearchProvider,
@@ -1,6 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { y as m, T as r, h as e } from "../ToolbarLayout.module-e774f3e1.js";
3
+ import { y as m, T as r, h as e } from "../ToolbarLayout.module-e03c451b.js";
4
4
  export {
5
5
  m as ThumbnailContext,
6
6
  r as ThumbnailProvider,