@pdf-viewer/react 1.7.1 → 1.7.2-rc.1

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 (51) hide show
  1. package/dist/{RPDefaultLayout-83caa88c.js → RPDefaultLayout-1d7613d6.js} +167 -168
  2. package/dist/assets/RPDefaultLayout.css +1 -1
  3. package/dist/components/RPController.js +1 -1
  4. package/dist/components/RPPages.js +1 -1
  5. package/dist/components/RPProvider.js +1 -1
  6. package/dist/components/layout/LayoutContainer.js +1 -1
  7. package/dist/components/layout/RPDefaultLayout.js +1 -1
  8. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  9. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  11. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  12. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  13. package/dist/components/layout/toolbar/MostPageTool.js +1 -1
  14. package/dist/components/layout/toolbar/OtherTool.js +1 -1
  15. package/dist/components/layout/toolbar/Paginate.js +1 -1
  16. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  17. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  18. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  19. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  20. package/dist/components/layout/toolbar/SearchTool.js +1 -1
  21. package/dist/components/layout/toolbar/ViewModeTool.js +27 -25
  22. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  23. package/dist/components/page/AnnotationLayer.js +1 -1
  24. package/dist/components/page/CanvasLayer.js +1 -1
  25. package/dist/components/page/DualPage.js +1 -1
  26. package/dist/components/page/RPPage.js +1 -1
  27. package/dist/components/page/SinglePage.js +1 -1
  28. package/dist/components/page/TextHighlightLayer.js +1 -1
  29. package/dist/components/page/TextLayer.js +1 -1
  30. package/dist/components/ui/LoadingIndicator.js +1 -1
  31. package/dist/components/ui/PasswordModal.js +11 -11
  32. package/dist/contexts/PaginationContext.js +1 -1
  33. package/dist/contexts/PrintContext.js +1 -1
  34. package/dist/contexts/SearchContext.js +1 -1
  35. package/dist/contexts/ThumbnailsContext.js +1 -1
  36. package/dist/main.js +1 -1
  37. package/dist/{th_TH-2c4015a5.js → th_TH-4af60d36.js} +1 -1
  38. package/dist/types/locales/it_IT.json.d.ts +2 -2
  39. package/dist/utils/hooks/useFileDownload.js +1 -1
  40. package/dist/utils/hooks/useLicense.js +1 -1
  41. package/dist/utils/hooks/useLoadPdf.js +32 -31
  42. package/dist/utils/hooks/useLocalization.js +1 -1
  43. package/dist/utils/hooks/usePaginate.js +1 -1
  44. package/dist/utils/hooks/usePresentPage.js +1 -1
  45. package/dist/utils/hooks/usePrint.js +1 -1
  46. package/dist/utils/hooks/useScrollToPage.js +1 -1
  47. package/dist/utils/hooks/useSearch.js +1 -1
  48. package/dist/utils/hooks/useThumbnail.js +1 -1
  49. package/dist/utils/hooks/useVirtualReactWindow.js +1 -1
  50. package/dist/utils/types.js +1 -1
  51. package/package.json +1 -1
@@ -1,64 +1,65 @@
1
- import { useState as a, useRef as N, useEffect as C } from "react";
2
- import * as S from "pdfjs-dist";
3
- import { getThumbnailViewport as U } from "../getThumbnailViewport.js";
4
- import { useConfigContext as V } from "../../contexts/ConfigContext.js";
5
- import { useDocumentPasswordContext as j } from "../../contexts/DocumentPasswordContext.js";
6
- const z = (l, o, I = {}) => {
7
- const [r, q] = a(), { workerUrlAdded: k } = V(), [y, x] = a(/* @__PURE__ */ new Map()), i = N(), [R, f] = a(0), [m, L] = a(!1), { password: d, passwordError: T, setPasswordError: g, passwordRequired: P, setPasswordRequired: c } = j(), { onLoadError: p, onLoaded: w } = I;
8
- return C(() => {
9
- if (!k || !l)
1
+ import { useState as a, useRef as V, useEffect as x } from "react";
2
+ import * as y from "pdfjs-dist";
3
+ import { getThumbnailViewport as D } from "../getThumbnailViewport.js";
4
+ import { useConfigContext as N } from "../../contexts/ConfigContext.js";
5
+ import { useDocumentPasswordContext as U } from "../../contexts/DocumentPasswordContext.js";
6
+ const h = (l, e, C = {}) => {
7
+ const [r, I] = a(), { workerUrlAdded: L } = N(), [q, R] = a(/* @__PURE__ */ new Map()), i = V(), [v, f] = a(0), [m, k] = a(!1), { password: d, passwordError: S, setPasswordError: g, passwordRequired: P, setPasswordRequired: c } = U(), { onLoadError: p, onLoaded: w } = C;
8
+ return x(() => {
9
+ if (!L || !l)
10
10
  return;
11
11
  f(0), i.current = Date.now();
12
12
  const t = i.current, E = {
13
13
  url: l,
14
- cMapPacked: (o == null ? void 0 : o.isCompressed) ?? !0,
15
- ...(o == null ? void 0 : o.url) && { cMapUrl: o.url },
16
- ...d && { password: d }
17
- }, n = S.getDocument(E);
14
+ cMapPacked: (e == null ? void 0 : e.isCompressed) ?? !0,
15
+ ...(e == null ? void 0 : e.url) && { cMapUrl: e.url },
16
+ ...d && { password: d },
17
+ verbosity: y.VerbosityLevel.ERRORS
18
+ }, n = y.getDocument(E);
18
19
  n.onProgress = (s) => {
19
20
  if (t === i.current) {
20
- const { loaded: b, total: u } = s, D = u ? Math.min(100, Math.round(b / u * 100)) : 0;
21
- f(D);
21
+ const { loaded: b, total: u } = s, T = u ? Math.min(100, Math.round(b / u * 100)) : 0;
22
+ f(T);
22
23
  }
23
- }, L(!0);
24
- const e = n.promise.then((s) => (t === i.current && (q(s), f(100)), w && w(s), c(!1), g(""), s)).catch((s) => {
24
+ }, k(!0);
25
+ const o = n.promise.then((s) => (t === i.current && (I(s), f(100)), w && w(s), c(!1), g(""), s)).catch((s) => {
25
26
  s instanceof Error && s.name === "PasswordException" ? (c(!0), g(s.message || "Password required")) : s instanceof Error && s.name === "InvalidPDFException" && d ? (c(!0), g("Incorrect password")) : p && p(s);
26
27
  }).finally(() => {
27
- L(!1);
28
+ k(!1);
28
29
  });
29
30
  return () => {
30
- e.finally(() => {
31
+ o.finally(() => {
31
32
  n.destroy();
32
33
  });
33
34
  };
34
- }, [l, k, d, p, w]), C(() => {
35
+ }, [l, L, d, p, w]), x(() => {
35
36
  if (P)
36
37
  return;
37
38
  const t = /* @__PURE__ */ new Map();
38
39
  if (!r || m) {
39
- x(t);
40
+ R(t);
40
41
  return;
41
42
  }
42
43
  const E = r.numPages, n = [];
43
- for (let e = 1; e <= E; e++) {
44
- const s = r.getPage(e);
44
+ for (let o = 1; o <= E; o++) {
45
+ const s = r.getPage(o);
45
46
  n.push(s);
46
47
  }
47
- Promise.all(n).then((e) => {
48
- e.map((s) => {
49
- const { thumbnailViewport: b, scale: u } = U(s);
48
+ Promise.all(n).then((o) => {
49
+ o.map((s) => {
50
+ const { thumbnailViewport: b, scale: u } = D(s);
50
51
  t.set(s.pageNumber, { page: s, thumbnailViewport: b, thumbnailScale: u });
51
- }), x(t);
52
+ }), R(t);
52
53
  });
53
54
  }, [r, m, P]), {
54
55
  pdf: r,
55
- pages: y,
56
+ pages: q,
56
57
  loading: m,
57
- loadingProgress: R,
58
+ loadingProgress: v,
58
59
  passwordRequired: P,
59
- passwordError: T
60
+ passwordError: S
60
61
  };
61
62
  };
62
63
  export {
63
- z as useLoadPdf
64
+ h as useLoadPdf
64
65
  };
@@ -1,5 +1,5 @@
1
1
  import { useState as a, useMemo as m } from "react";
2
- import { e as s, t as p, z as u, i as _, p as L } from "../../th_TH-2c4015a5.js";
2
+ import { e as s, t as p, z as u, i as _, p as L } from "../../th_TH-4af60d36.js";
3
3
  const f = (e) => {
4
4
  const [o, c] = a(e), [t, i] = a({
5
5
  en_US: s,
@@ -1,6 +1,6 @@
1
1
  import "react";
2
2
  import "../types.js";
3
- import { g as G } from "../../RPDefaultLayout-83caa88c.js";
3
+ import { g as G } from "../../RPDefaultLayout-1d7613d6.js";
4
4
  import "react/jsx-runtime";
5
5
  import "../../contexts/RPDocumentContext.js";
6
6
  import "../../contexts/DocumentPasswordContext.js";
@@ -5,7 +5,7 @@ import "../calculatePage.js";
5
5
  import "react/jsx-runtime";
6
6
  import "../../contexts/RPDocumentContext.js";
7
7
  import "../../contexts/DocumentPasswordContext.js";
8
- import { v as G } from "../../RPDefaultLayout-83caa88c.js";
8
+ import { v as G } from "../../RPDefaultLayout-1d7613d6.js";
9
9
  import "../../contexts/DarkModeContext.js";
10
10
  import "../../contexts/RotationContext.js";
11
11
  import "../../contexts/LayerContext.js";
@@ -2,7 +2,7 @@ import "react";
2
2
  import "react/jsx-runtime";
3
3
  import "../../contexts/RPDocumentContext.js";
4
4
  import "../../contexts/DocumentPasswordContext.js";
5
- import { i as F } from "../../RPDefaultLayout-83caa88c.js";
5
+ import { i as F } from "../../RPDefaultLayout-1d7613d6.js";
6
6
  import "../../contexts/DarkModeContext.js";
7
7
  import "../../contexts/RotationContext.js";
8
8
  import "../../contexts/LayerContext.js";
@@ -3,7 +3,7 @@ import "../../contexts/ScrollModeContext.js";
3
3
  import "react/jsx-runtime";
4
4
  import "../../contexts/RPDocumentContext.js";
5
5
  import "../../contexts/DocumentPasswordContext.js";
6
- import { f as F } from "../../RPDefaultLayout-83caa88c.js";
6
+ import { f as F } from "../../RPDefaultLayout-1d7613d6.js";
7
7
  import "../../contexts/DarkModeContext.js";
8
8
  import "../types.js";
9
9
  import "../../contexts/RotationContext.js";
@@ -7,7 +7,7 @@ import "../../contexts/RPDocumentContext.js";
7
7
  import "../../contexts/ZoomContext.js";
8
8
  import "react/jsx-runtime";
9
9
  import "../../contexts/DocumentPasswordContext.js";
10
- import { n as I } from "../../RPDefaultLayout-83caa88c.js";
10
+ import { n as I } from "../../RPDefaultLayout-1d7613d6.js";
11
11
  import "../../contexts/DarkModeContext.js";
12
12
  import "../../contexts/RotationContext.js";
13
13
  import "../../contexts/LayerContext.js";
@@ -3,7 +3,7 @@ import "../renderPage.js";
3
3
  import "react/jsx-runtime";
4
4
  import "../../contexts/RPDocumentContext.js";
5
5
  import "../../contexts/DocumentPasswordContext.js";
6
- import { k as G } from "../../RPDefaultLayout-83caa88c.js";
6
+ import { k as G } from "../../RPDefaultLayout-1d7613d6.js";
7
7
  import "../../contexts/DarkModeContext.js";
8
8
  import "../../contexts/RotationContext.js";
9
9
  import "../../contexts/LayerContext.js";
@@ -4,7 +4,7 @@ import "../../contexts/ScrollModeContext.js";
4
4
  import "react/jsx-runtime";
5
5
  import "../../contexts/RPDocumentContext.js";
6
6
  import "../../contexts/DocumentPasswordContext.js";
7
- import { s as D } from "../../RPDefaultLayout-83caa88c.js";
7
+ import { s as D } from "../../RPDefaultLayout-1d7613d6.js";
8
8
  import "../../contexts/DarkModeContext.js";
9
9
  import "../../contexts/RotationContext.js";
10
10
  import "../../contexts/LayerContext.js";
@@ -1,4 +1,4 @@
1
- import { e as r, z as _, i as R, p as o, t as p } from "../th_TH-2c4015a5.js";
1
+ import { e as r, z as _, i as R, p as o, t as p } from "../th_TH-4af60d36.js";
2
2
  var D = /* @__PURE__ */ ((O) => (O[O.Text = 1] = "Text", O[O.Link = 2] = "Link", O[O.FreeText = 3] = "FreeText", O[O.Line = 4] = "Line", O[O.Square = 5] = "Square", O[O.Circle = 6] = "Circle", O[O.Polygon = 7] = "Polygon", O[O.Polyline = 8] = "Polyline", O[O.Highlight = 9] = "Highlight", O[O.Underline = 10] = "Underline", O[O.Squiggly = 11] = "Squiggly", O[O.StrikeOut = 12] = "StrikeOut", O[O.Stamp = 13] = "Stamp", O[O.Caret = 14] = "Caret", O[O.Ink = 15] = "Ink", O[O.Popup = 16] = "Popup", O[O.FileAttachment = 17] = "FileAttachment", O[O.Widget = 20] = "Widget", O))(D || {}), N = /* @__PURE__ */ ((O) => (O.INTERNAL_LINK = "internal-link", O.LINK = "link", O.FILE_ATTACHMENT = "file-attachment", O.FORM_TEXT = "form-text", O.FORM_SELECT = "form-select", O.FORM_CHECKBOX = "form-checkbox", O.FORM_RADIO = "form-radio", O.FORM_BUTTON = "form-button", O.BUTTON = "button", O))(N || {}), L = /* @__PURE__ */ ((O) => (O.ACTUAL = "Actual", O.PAGE_FIT = "Fit", O.PAGE_WIDTH = "Width", O))(L || {}), E = /* @__PURE__ */ ((O) => (O.Organization = "organization", O.Developer = "developer", O))(E || {}), I = /* @__PURE__ */ ((O) => (O.SINGLE_PAGE = "Single", O.DUAL_PAGE = "Dual", O))(I || {}), d = /* @__PURE__ */ ((O) => (O.FONT_FAMILY = "--rp-font-family", O.PRIMARY_COLOR = "--rp-primary-color", O.BORDER_RADIUS = "--rp-border-radius", O.TEXT_COLOR = "--rp-text-color", O.OUTLINE_COLOR = "--rp-outline-color", O.FONT_SIZE = "--rp-font-size", O.DROP_MASK_BACKGROUND_COLOR = "--rp-drop-mask-background-color", O.LOADER_BACKDROP_COLOR = "--rp-loader-backdrop-color", O.ICON_DISABLED = "--rp-icon-disabled", O.ICON_FONT_SIZE = "--rp-icon-font-size", O.TOOLBAR_BACKGROUND = "--rp-toolbar-background", O.TOOLBAR_BORDER_COLOR = "--rp-toolbar-border-color", O.TOOLBAR_PADDING = "--rp-toolbar-padding", O.TOOLBAR_GAP = "--rp-toolbar-gap", O.TOOLBAR_SIZE = "--rp-toolbar-size", O.SIDEBAR_WIDTH = "--rp-sidebar-width", O.THUMBNAIL_BORDER_COLOR = "--rp-thumbnail-border-color", O.THUMBNAIL_BACKGROUND_COLOR = "--rp-thumbnail-background-color", O.THUMBNAIL_ACTIVE_COLOR = "--rp-thumbnail-active-color", O.THUMBNAIL_PADDING_Y = "--rp-thumbnail-padding-y", O.BUTTON_HOVER_BACKGROUND = "--rp-button-hover-background", O.BUTTON_PADDING = "--rp-button-padding", O.INPUT_PADDING = "--rp-input-padding", O.INPUT_BORDER_RADIUS = "--rp-input-border-radius", O.INPUT_BACKGROUND_COLOR = "--rp-input-background-color", O.INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color", O.PAGES_BACKGROUND_COLOR = "--rp-pages-background-color", O.ANNOTATION_LAYER_LINK_HOVER_BACKGROUND = "--rp-annotation-layer__link-hover-background", O.DROPDOWN_BACKGROUND_COLOR = "--rp-dropdown-background-color", O.DROPDOWN_PADDING = "--rp-dropdown-padding", O.DROPDOWN_HOVER_BACKGROUND_COLOR = "--rp-dropdown-hover-background-color", O.DROPDOWN_SEPARATOR_COLOR = "--rp-dropdown-separator-color", O.DROPDOWN_SEPARATOR_MARGIN = "--rp-dropdown-separator-margin", O.DROPDOWN_PADDING_MENU_ITEM = "--rp-dropdown-padding-menu-item", O.DROPDOWN_FONT_SIZE = "--rp-dropdown-font-size", O.DROPDOWN_BORDER_RADIUS = "--rp-dropdown-border-radius", O.SEARCH_TOOL_DROPDOWN_PADDING = "--rp-search-tool-dropdown-padding", O.POPOVER_FONT_SIZE = "--rp-popover-font-size", O.POPOVER_BACKGROUND_COLOR = "--rp-popover-background-color", O.POPOVER_COLOR = "--rp-popover-color", O.POPOVER_BORDER_COLOR = "--rp-popover-border-color", O.POPOVER_BORDER_RADIUS = "--rp-popover-border-radius", O.OVERLAY_BACKGROUND_COLOR = "--rp-overlay-background-color", O.DIALOG_BACKGROUND_COLOR = "--rp-dialog-background-color", O.PROPERTIES_DIVIDER_COLOR = "--rp-properties-divider-color", O.PROPERTIES_DIVIDER_MARGIN = "--rp-properties-divider-margin", O.PROPERTY_ITEM_GAP = "--rp-property-item-gap", O.DIALOG_TITLE_COLOR = "--rp-dialog-title-color", O.PROPERTY_ITEM_LABEL_COLOR = "--rp-property-item-label-color", O.PROPERTY_CLOSE_ICON_SIZE = "--rp-property-close-icon-size", O.PROPERTY_ITEM_FONT_SIZE = "--rp-property-item-font-size", O.PROPERTY_ITEM_FONT_WEIGHT = "--rp-property-item-font-weight", O.DIALOG_TITLE_FONT_SIZE = "--rp-dialog-title-font-size", O.DIALOG_TITLE_FONT_WEIGHT = "--rp-dialog-title-font-weight", O.MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size", O.PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background", O.PRINT_PROGRESS_COLOR = "--rp-print-progress-color", O.DROP_ZONE_BORDER = "--rp-drop-zone-border", O.DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color", O.DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size", O.DROP_ZONE_BACKGROUND_COLOR = "--rp-drop-zone-background-color", O.CHECKBOX_BORDER_RADIUS = "--rp-checkbox-border-radius", O.CHECKBOX_BORDER_COLOR = "--rp-checkbox-border-color", O.CHECKBOX_INDICATOR_COLOR = "--rp-checkbox-indicator-color", O.HIGHLIGHT_BACKGROUND_COLOR = "--rp-highlight-background-color", O.TEXT_LAYER_HIGHLIGHT_BORDER_RADIUS = "--rp-text-layer-highlight-border-radius", O.CURRENT_HIGHLIGHT_BACKGROUND_COLOR = "--rp-current-highlight-background-color", O.TOOLTIP_BACKGROUND_COLOR = "--rp-tooltip-background-color", O.TOOLTIP_BORDER_RADIUS = "--rp-tooltip-border-radius", O.TOOLTIP_FONT_COLOR = "--rp-tooltip-font-color", O.TOOLTIP_FONT_SIZE = "--rp-tooltip-font-size", O.TOOLTIP_PADDING = "--rp-tooltip-padding", O.PASSWORD_MODAL_BACKGROUND_COLOR = "--rp-password-background-color", O.PASSWORD_MODAL_TITLE_FONT_COLOR = "--rp-password-title-font-color", O.PASSWORD_MODAL_CONTENT_FONT_COLOR = "--rp-password-content-font-color", O.PASSWORD_MODAL_INPUT_PLACEHOLDER_COLOR = "--rp-password-input-placeholder-color", O.PASSWORD_MODAL_INPUT_BORDER_COLOR = "--rp-password-input-border-color", O.PASSWORD_MODAL_INPUT_FONT_COLOR = "--rp-password-input-font-color", O.PASSWORD_MODAL_BUTTON_FONT_COLOR = "--rp-password-button-font-color", O.PASSWORD_MODAL_BUTTON_BACKGROUND_COLOR = "--rp-password-button-background-color", O.PASSWORD_MODAL_BUTTON_BORDER_COLOR = "--rp-password-button-border-color", O.PASSWORD_MODAL_BORDER_COLOR = "--rp-password-border-color", O.CONTAINER_FOCUS_OUTLINE_WIDTH = "--rp-container-focus-outline-width", O.CONTAINER_FOCUS_OUTLINE_COLOR = "--rp-container-focus-outline-color", O.CONTAINER_FOCUS_OUTLINE_OFFSET = "--rp-container-focus-outline-offset", O.BUTTON_BORDER_RADIUS = "--rp-button-border-radius", O))(d || {}), C = /* @__PURE__ */ ((O) => (O.PAGE_SCROLLING = "PAGE", O.VERTICAL_SCROLLING = "VERTICAL", O.HORIZONTAL_SCROLLING = "HORIZONTAL", O))(C || {}), P = /* @__PURE__ */ ((O) => (O.TEXT = "TEXT", O.HAND = "HAND", O))(P || {});
3
3
  const A = {
4
4
  en_US: r,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pdf-viewer/react",
3
3
  "private": false,
4
4
  "description": "The PDF Viewer component for React and Next.js",
5
- "version": "1.7.1",
5
+ "version": "1.7.2-rc.1",
6
6
  "keywords": [
7
7
  "component",
8
8
  "frontend",