@pdf-viewer/react 1.11.0-beta.0 → 1.11.0-beta.2

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 (116) hide show
  1. package/dist/RotateTool.module-03987eba.js +6 -0
  2. package/dist/ToolbarLayout.module-082ff242.js +3405 -0
  3. package/dist/assets/ToolbarLayout.css +1 -1
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +2 -2
  6. package/dist/components/layout/LayoutContainer.js +2 -2
  7. package/dist/components/layout/RPDefaultLayout.js +2 -3
  8. package/dist/components/layout/RPLayout.js +2 -2
  9. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnail.js +2 -2
  11. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  12. package/dist/components/layout/toolbar/DocumentDialog.js +2 -2
  13. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  14. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  15. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  16. package/dist/components/layout/toolbar/MostPageTool.js +3 -3
  17. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  18. package/dist/components/layout/toolbar/Paginate.js +1 -1
  19. package/dist/components/layout/toolbar/PrintTool.js +2 -2
  20. package/dist/components/layout/toolbar/RPMenuItem.js +23 -0
  21. package/dist/components/layout/toolbar/RPMoreOptions.js +147 -0
  22. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  23. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  24. package/dist/components/layout/toolbar/RotateTool.js +20 -21
  25. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  26. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  27. package/dist/components/layout/toolbar/SearchTool.js +3 -3
  28. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  29. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  30. package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
  31. package/dist/components/layout/toolbar/ToolbarDefault.js +6 -3
  32. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  33. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  34. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +28 -0
  35. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/NextPageTool.js +2 -2
  38. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +17 -0
  41. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +25 -0
  42. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  43. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
  44. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +6 -3
  45. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +16 -0
  46. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +20 -0
  47. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +69 -0
  48. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +20 -0
  49. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +78 -0
  50. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +20 -0
  51. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +26 -0
  52. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +43 -0
  53. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +30 -0
  54. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +32 -0
  55. package/dist/components/page/AnnotationLayer.js +2 -2
  56. package/dist/components/page/CanvasLayer.js +2 -2
  57. package/dist/components/page/DualPage.js +1 -1
  58. package/dist/components/page/RPPage.js +2 -2
  59. package/dist/components/page/SinglePage.js +1 -1
  60. package/dist/components/page/TextHighlightLayer.js +2 -2
  61. package/dist/components/page/TextLayer.js +2 -2
  62. package/dist/components/ui/Checkbox.js +13 -14
  63. package/dist/components/ui/DropDown.js +1 -1
  64. package/dist/components/ui/LoadingIndicator.js +1 -1
  65. package/dist/components/ui/RPTooltip.js +329 -687
  66. package/dist/contexts/PaginationContext.js +1 -1
  67. package/dist/contexts/PrintContext.js +1 -1
  68. package/dist/contexts/RenderQueueProvider.js +1 -1
  69. package/dist/contexts/SearchContext.js +1 -1
  70. package/dist/contexts/ThumbnailsContext.js +1 -1
  71. package/dist/floating-ui.react-dom-88a86594.js +1447 -0
  72. package/dist/index-48ca3f30.js +307 -0
  73. package/dist/index-4ba3ab9a.js +1877 -0
  74. package/dist/main.js +29 -23
  75. package/dist/types/components/layout/toolbar/RPMenuItem.d.ts +11 -0
  76. package/dist/types/components/layout/toolbar/RPMoreOptions.d.ts +3 -0
  77. package/dist/types/components/layout/toolbar/tools/DocumentPropertiesTool.d.ts +3 -0
  78. package/dist/types/components/layout/toolbar/tools/RotateClockwiseTool.d.ts +3 -0
  79. package/dist/types/components/layout/toolbar/tools/RotateCounterclockwiseTool.d.ts +3 -0
  80. package/dist/types/components/layout/toolbar/tools/more-options/DocumentProperties.d.ts +3 -0
  81. package/dist/types/components/layout/toolbar/tools/more-options/FileDownloadTool.d.ts +3 -0
  82. package/dist/types/components/layout/toolbar/tools/more-options/FileUploadTool.d.ts +3 -0
  83. package/dist/types/components/layout/toolbar/tools/more-options/FullScreenTool.d.ts +3 -0
  84. package/dist/types/components/layout/toolbar/tools/more-options/MostPageTool.d.ts +3 -0
  85. package/dist/types/components/layout/toolbar/tools/more-options/PrintTool.d.ts +3 -0
  86. package/dist/types/components/layout/toolbar/tools/more-options/RotateTool.d.ts +3 -0
  87. package/dist/types/components/layout/toolbar/tools/more-options/ScrollModeTool.d.ts +3 -0
  88. package/dist/types/components/layout/toolbar/tools/more-options/SelectionModeTool.d.ts +3 -0
  89. package/dist/types/components/layout/toolbar/tools/more-options/ViewModeTool.d.ts +3 -0
  90. package/dist/types/contexts/SelectionModeContext.d.ts +2 -2
  91. package/dist/types/main.d.ts +4 -1
  92. package/dist/types/utils/calculatePage.d.ts +7 -0
  93. package/dist/types/utils/elementPagePosition.d.ts +17 -0
  94. package/dist/types/utils/getWordPositionInPage.d.ts +3 -6
  95. package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +8 -0
  96. package/dist/types/utils/types.d.ts +85 -7
  97. package/dist/utils/calculatePage.js +12 -5
  98. package/dist/utils/elementPagePosition.js +11 -0
  99. package/dist/utils/getScrollDistance.js +2 -2
  100. package/dist/utils/getWordPositionInPage.js +20 -21
  101. package/dist/utils/getZoomLevel.js +7 -7
  102. package/dist/utils/hooks/useFileDownload.js +2 -2
  103. package/dist/utils/hooks/useLicense.js +1 -1
  104. package/dist/utils/hooks/usePaginate.js +2 -2
  105. package/dist/utils/hooks/usePresentPage.js +2 -2
  106. package/dist/utils/hooks/usePrint.js +2 -2
  107. package/dist/utils/hooks/useScrollToPage.js +4 -3
  108. package/dist/utils/hooks/useSearch.js +2 -2
  109. package/dist/utils/hooks/useThumbnail.js +2 -2
  110. package/dist/utils/hooks/useVirtualReactWindow.js +4 -3
  111. package/package.json +1 -1
  112. package/dist/ToolbarLayout.module-310f3470.js +0 -3368
  113. package/dist/floating-ui.react-dom-bbd2b1a7.js +0 -1330
  114. package/dist/index-54351a14.js +0 -1995
  115. package/dist/index-94df4e25.js +0 -139
  116. package/dist/index-e620205e.js +0 -172
@@ -1,139 +0,0 @@
1
- import * as i from "react";
2
- import { jsx as C } from "react/jsx-runtime";
3
- function m(e, n) {
4
- const t = i.createContext(n), r = (s) => {
5
- const { children: o, ...c } = s, a = i.useMemo(() => c, Object.values(c));
6
- return /* @__PURE__ */ C(t.Provider, { value: a, children: o });
7
- };
8
- r.displayName = e + "Provider";
9
- function u(s) {
10
- const o = i.useContext(t);
11
- if (o)
12
- return o;
13
- if (n !== void 0)
14
- return n;
15
- throw new Error(`\`${s}\` must be used within \`${e}\``);
16
- }
17
- return [r, u];
18
- }
19
- function E(e, n = []) {
20
- let t = [];
21
- function r(s, o) {
22
- const c = i.createContext(o), a = t.length;
23
- t = [...t, o];
24
- const f = (d) => {
25
- var b;
26
- const { scope: l, children: S, ...v } = d, h = ((b = l == null ? void 0 : l[e]) == null ? void 0 : b[a]) || c, z = i.useMemo(() => v, Object.values(v));
27
- return /* @__PURE__ */ C(h.Provider, { value: z, children: S });
28
- };
29
- f.displayName = s + "Provider";
30
- function x(d, l) {
31
- var h;
32
- const S = ((h = l == null ? void 0 : l[e]) == null ? void 0 : h[a]) || c, v = i.useContext(S);
33
- if (v)
34
- return v;
35
- if (o !== void 0)
36
- return o;
37
- throw new Error(`\`${d}\` must be used within \`${s}\``);
38
- }
39
- return [f, x];
40
- }
41
- const u = () => {
42
- const s = t.map((o) => i.createContext(o));
43
- return function(c) {
44
- const a = (c == null ? void 0 : c[e]) || s;
45
- return i.useMemo(
46
- () => ({ [`__scope${e}`]: { ...c, [e]: a } }),
47
- [c, a]
48
- );
49
- };
50
- };
51
- return u.scopeName = e, [r, P(u, ...n)];
52
- }
53
- function P(...e) {
54
- const n = e[0];
55
- if (e.length === 1)
56
- return n;
57
- const t = () => {
58
- const r = e.map((u) => ({
59
- useScope: u(),
60
- scopeName: u.scopeName
61
- }));
62
- return function(s) {
63
- const o = r.reduce((c, { useScope: a, scopeName: f }) => {
64
- const d = a(s)[`__scope${f}`];
65
- return { ...c, ...d };
66
- }, {});
67
- return i.useMemo(() => ({ [`__scope${n.scopeName}`]: o }), [o]);
68
- };
69
- };
70
- return t.scopeName = n.scopeName, t;
71
- }
72
- function y(e) {
73
- const n = i.useRef(e);
74
- return i.useEffect(() => {
75
- n.current = e;
76
- }), i.useMemo(() => (...t) => {
77
- var r;
78
- return (r = n.current) == null ? void 0 : r.call(n, ...t);
79
- }, []);
80
- }
81
- var g = globalThis != null && globalThis.document ? i.useLayoutEffect : () => {
82
- };
83
- function $(e) {
84
- const [n, t] = i.useState(void 0);
85
- return g(() => {
86
- if (e) {
87
- t({ width: e.offsetWidth, height: e.offsetHeight });
88
- const r = new ResizeObserver((u) => {
89
- if (!Array.isArray(u) || !u.length)
90
- return;
91
- const s = u[0];
92
- let o, c;
93
- if ("borderBoxSize" in s) {
94
- const a = s.borderBoxSize, f = Array.isArray(a) ? a[0] : a;
95
- o = f.inlineSize, c = f.blockSize;
96
- } else
97
- o = e.offsetWidth, c = e.offsetHeight;
98
- t({ width: o, height: c });
99
- });
100
- return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
101
- } else
102
- t(void 0);
103
- }, [e]), n;
104
- }
105
- function _({
106
- prop: e,
107
- defaultProp: n,
108
- onChange: t = () => {
109
- }
110
- }) {
111
- const [r, u] = p({ defaultProp: n, onChange: t }), s = e !== void 0, o = s ? e : r, c = y(t), a = i.useCallback(
112
- (f) => {
113
- if (s) {
114
- const d = typeof f == "function" ? f(e) : f;
115
- d !== e && c(d);
116
- } else
117
- u(f);
118
- },
119
- [s, e, u, c]
120
- );
121
- return [o, a];
122
- }
123
- function p({
124
- defaultProp: e,
125
- onChange: n
126
- }) {
127
- const t = i.useState(e), [r] = t, u = i.useRef(r), s = y(n);
128
- return i.useEffect(() => {
129
- u.current !== r && (s(r), u.current = r);
130
- }, [r, u, s]), t;
131
- }
132
- export {
133
- $ as a,
134
- g as b,
135
- E as c,
136
- y as d,
137
- m as e,
138
- _ as u
139
- };
@@ -1,172 +0,0 @@
1
- import * as s from "react";
2
- import * as C from "react-dom";
3
- import { jsx as h, Fragment as M } from "react/jsx-runtime";
4
- import { b as g } from "./index-94df4e25.js";
5
- function x(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
6
- return function(r) {
7
- if (e == null || e(r), t === !1 || !r.defaultPrevented)
8
- return n == null ? void 0 : n(r);
9
- };
10
- }
11
- function A(e, n) {
12
- if (typeof e == "function")
13
- return e(n);
14
- e != null && (e.current = n);
15
- }
16
- function R(...e) {
17
- return (n) => {
18
- let t = !1;
19
- const i = e.map((r) => {
20
- const o = A(r, n);
21
- return !t && typeof o == "function" && (t = !0), o;
22
- });
23
- if (t)
24
- return () => {
25
- for (let r = 0; r < i.length; r++) {
26
- const o = i[r];
27
- typeof o == "function" ? o() : A(e[r], null);
28
- }
29
- };
30
- };
31
- }
32
- function S(...e) {
33
- return s.useCallback(R(...e), e);
34
- }
35
- var O = s.forwardRef((e, n) => {
36
- const { children: t, ...i } = e, r = s.Children.toArray(t), o = r.find(T);
37
- if (o) {
38
- const c = o.props.children, l = r.map((u) => u === o ? s.Children.count(c) > 1 ? s.Children.only(null) : s.isValidElement(c) ? c.props.children : null : u);
39
- return /* @__PURE__ */ h(y, { ...i, ref: n, children: s.isValidElement(c) ? s.cloneElement(c, void 0, l) : null });
40
- }
41
- return /* @__PURE__ */ h(y, { ...i, ref: n, children: t });
42
- });
43
- O.displayName = "Slot";
44
- var y = s.forwardRef((e, n) => {
45
- const { children: t, ...i } = e;
46
- if (s.isValidElement(t)) {
47
- const r = D(t), o = b(i, t.props);
48
- return t.type !== s.Fragment && (o.ref = n ? R(n, r) : r), s.cloneElement(t, o);
49
- }
50
- return s.Children.count(t) > 1 ? s.Children.only(null) : null;
51
- });
52
- y.displayName = "SlotClone";
53
- var E = ({ children: e }) => /* @__PURE__ */ h(M, { children: e });
54
- function T(e) {
55
- return s.isValidElement(e) && e.type === E;
56
- }
57
- function b(e, n) {
58
- const t = { ...n };
59
- for (const i in n) {
60
- const r = e[i], o = n[i];
61
- /^on[A-Z]/.test(i) ? r && o ? t[i] = (...l) => {
62
- o(...l), r(...l);
63
- } : r && (t[i] = r) : i === "style" ? t[i] = { ...r, ...o } : i === "className" && (t[i] = [r, o].filter(Boolean).join(" "));
64
- }
65
- return { ...e, ...t };
66
- }
67
- function D(e) {
68
- var i, r;
69
- let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, t = n && "isReactWarning" in n && n.isReactWarning;
70
- return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
71
- }
72
- var I = [
73
- "a",
74
- "button",
75
- "div",
76
- "form",
77
- "h2",
78
- "h3",
79
- "img",
80
- "input",
81
- "label",
82
- "li",
83
- "nav",
84
- "ol",
85
- "p",
86
- "span",
87
- "svg",
88
- "ul"
89
- ], _ = I.reduce((e, n) => {
90
- const t = s.forwardRef((i, r) => {
91
- const { asChild: o, ...c } = i, l = o ? O : n;
92
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ h(l, { ...c, ref: r });
93
- });
94
- return t.displayName = `Primitive.${n}`, { ...e, [n]: t };
95
- }, {});
96
- function k(e, n) {
97
- e && C.flushSync(() => e.dispatchEvent(n));
98
- }
99
- function U(e, n) {
100
- return s.useReducer((t, i) => n[t][i] ?? t, e);
101
- }
102
- var W = (e) => {
103
- const { present: n, children: t } = e, i = F(n), r = typeof t == "function" ? t({ present: i.isPresent }) : s.Children.only(t), o = S(i.ref, L(r));
104
- return typeof t == "function" || i.isPresent ? s.cloneElement(r, { ref: o }) : null;
105
- };
106
- W.displayName = "Presence";
107
- function F(e) {
108
- const [n, t] = s.useState(), i = s.useRef({}), r = s.useRef(e), o = s.useRef("none"), c = e ? "mounted" : "unmounted", [l, u] = U(c, {
109
- mounted: {
110
- UNMOUNT: "unmounted",
111
- ANIMATION_OUT: "unmountSuspended"
112
- },
113
- unmountSuspended: {
114
- MOUNT: "mounted",
115
- ANIMATION_END: "unmounted"
116
- },
117
- unmounted: {
118
- MOUNT: "mounted"
119
- }
120
- });
121
- return s.useEffect(() => {
122
- const a = N(i.current);
123
- o.current = l === "mounted" ? a : "none";
124
- }, [l]), g(() => {
125
- const a = i.current, m = r.current;
126
- if (m !== e) {
127
- const p = o.current, f = N(a);
128
- e ? u("MOUNT") : f === "none" || (a == null ? void 0 : a.display) === "none" ? u("UNMOUNT") : u(m && p !== f ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
129
- }
130
- }, [e, u]), g(() => {
131
- if (n) {
132
- let a;
133
- const m = n.ownerDocument.defaultView ?? window, d = (f) => {
134
- const v = N(i.current).includes(f.animationName);
135
- if (f.target === n && v && (u("ANIMATION_END"), !r.current)) {
136
- const w = n.style.animationFillMode;
137
- n.style.animationFillMode = "forwards", a = m.setTimeout(() => {
138
- n.style.animationFillMode === "forwards" && (n.style.animationFillMode = w);
139
- });
140
- }
141
- }, p = (f) => {
142
- f.target === n && (o.current = N(i.current));
143
- };
144
- return n.addEventListener("animationstart", p), n.addEventListener("animationcancel", d), n.addEventListener("animationend", d), () => {
145
- m.clearTimeout(a), n.removeEventListener("animationstart", p), n.removeEventListener("animationcancel", d), n.removeEventListener("animationend", d);
146
- };
147
- } else
148
- u("ANIMATION_END");
149
- }, [n, u]), {
150
- isPresent: ["mounted", "unmountSuspended"].includes(l),
151
- ref: s.useCallback((a) => {
152
- a && (i.current = getComputedStyle(a)), t(a);
153
- }, [])
154
- };
155
- }
156
- function N(e) {
157
- return (e == null ? void 0 : e.animationName) || "none";
158
- }
159
- function L(e) {
160
- var i, r;
161
- let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, t = n && "isReactWarning" in n && n.isReactWarning;
162
- return t ? e.ref : (n = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
163
- }
164
- export {
165
- _ as P,
166
- O as S,
167
- W as a,
168
- R as b,
169
- x as c,
170
- k as d,
171
- S as u
172
- };