@pdf-viewer/react 1.14.0-beta.2 → 1.14.0-beta.3

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 (66) hide show
  1. package/dist/{ToolbarLayout.module-c133fcc0.js → ToolbarLayout.module-f62490d8.js} +31 -31
  2. package/dist/components/RPConfig.js +10 -1489
  3. package/dist/components/RPController.js +3 -6
  4. package/dist/components/RPPages.js +5 -8
  5. package/dist/components/RPProvider.js +3 -6
  6. package/dist/components/layout/LayoutContainer.js +4 -7
  7. package/dist/components/layout/RPDefaultLayout.js +2 -5
  8. package/dist/components/layout/RPLayout.js +5 -8
  9. package/dist/components/layout/sidebar/RPSidebar.js +2 -5
  10. package/dist/components/layout/sidebar/Thumbnail.js +5 -8
  11. package/dist/components/layout/sidebar/Thumbnails.js +2 -5
  12. package/dist/components/layout/toolbar/DocumentDialog.js +5 -8
  13. package/dist/components/layout/toolbar/FileDownloadTool.js +2 -5
  14. package/dist/components/layout/toolbar/MostPageTool.js +5 -8
  15. package/dist/components/layout/toolbar/OtherTool.js +2 -5
  16. package/dist/components/layout/toolbar/Paginate.js +2 -5
  17. package/dist/components/layout/toolbar/PrintTool.js +2 -5
  18. package/dist/components/layout/toolbar/RPMoreOptions.js +9 -12
  19. package/dist/components/layout/toolbar/RPToolbar.js +2 -5
  20. package/dist/components/layout/toolbar/RPToolbarEnd.js +2 -5
  21. package/dist/components/layout/toolbar/SearchResultNavigator.js +2 -5
  22. package/dist/components/layout/toolbar/SearchTool.js +5 -8
  23. package/dist/components/layout/toolbar/ThumbnailTool.js +3 -6
  24. package/dist/components/layout/toolbar/ToolbarCustom.js +6 -9
  25. package/dist/components/layout/toolbar/ToolbarDefault.js +6 -9
  26. package/dist/components/layout/toolbar/ToolbarLayout.js +3 -6
  27. package/dist/components/layout/toolbar/ZoomTool.js +2 -5
  28. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +3 -6
  29. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +3 -6
  30. package/dist/components/layout/toolbar/tools/InputPageTool.js +3 -6
  31. package/dist/components/layout/toolbar/tools/NextPageTool.js +6 -9
  32. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +3 -6
  33. package/dist/components/layout/toolbar/tools/PrintTool.js +3 -6
  34. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +3 -6
  35. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +5 -8
  36. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +3 -6
  37. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +6 -9
  38. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +3 -6
  39. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +3 -6
  40. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +6 -9
  41. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +6 -9
  42. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +3 -6
  43. package/dist/components/page/AnnotationLayer.js +5 -8
  44. package/dist/components/page/CanvasLayer.js +5 -8
  45. package/dist/components/page/DualPage.js +2 -5
  46. package/dist/components/page/RPPage.js +5 -8
  47. package/dist/components/page/SinglePage.js +2 -5
  48. package/dist/components/page/TextHighlightLayer.js +5 -8
  49. package/dist/components/page/TextLayer.js +5 -8
  50. package/dist/components/ui/LoadingIndicator.js +2 -5
  51. package/dist/contexts/PaginationContext.js +4 -7
  52. package/dist/contexts/PrintContext.js +4 -7
  53. package/dist/contexts/RenderQueueProvider.js +4 -7
  54. package/dist/contexts/SearchContext.js +4 -7
  55. package/dist/contexts/ThumbnailsContext.js +4 -7
  56. package/dist/main.js +3 -3
  57. package/dist/utils/hooks/useFileDownload.js +5 -8
  58. package/dist/utils/hooks/useLicense.js +1 -1
  59. package/dist/utils/hooks/usePaginate.js +5 -8
  60. package/dist/utils/hooks/usePresentPage.js +5 -8
  61. package/dist/utils/hooks/usePrint.js +5 -8
  62. package/dist/utils/hooks/useScrollToPage.js +5 -8
  63. package/dist/utils/hooks/useSearch.js +5 -8
  64. package/dist/utils/hooks/useThumbnail.js +5 -8
  65. package/dist/utils/hooks/useVirtualReactWindow.js +5 -8
  66. package/package.json +1 -3
@@ -38,33 +38,33 @@ import { useToolComponentContext as Ie } from "./contexts/ToolComponentContext.j
38
38
  import { useIconToolContext as me } from "./contexts/IconToolContext.js";
39
39
  import { useOtherToolContext as Lo } from "./contexts/OtherToolContext.js";
40
40
  import { useEventCallbackContext as Eo } from "./contexts/EventCallbackContext.js";
41
- import "./components/RPConfig.js";
42
- import { ThumbnailIcon as No } from "./components/icons/Thumbnail.js";
41
+ import { useThemeContext as No } from "./contexts/ThemeContext.js";
42
+ import "./contexts/ConfigContext.js";
43
+ import * as Oo from "pdfjs-dist";
44
+ import { PixelsPerInch as Do, AnnotationMode as zo, RenderingCancelledException as Ao, AnnotationLayer as Fo } from "pdfjs-dist";
45
+ import { ThumbnailIcon as ko } from "./components/icons/Thumbnail.js";
43
46
  import { c as se } from "./clsx-0c6e471a.js";
44
47
  import { LoaderIcon as mn } from "./components/icons/LoaderIcon.js";
45
- import { Container as Oo } from "./components/layout/Container.js";
46
- import { useViewportContext as Se, ViewportProvider as Do } from "./contexts/ViewportContext.js";
47
- import { useToolbarComponentContext as Ce, ToolbarComponentProvider as zo } from "./contexts/ToolbarComponentContext.js";
48
- import { RPSplitter as Ao } from "./components/layout/sidebar/RPSplitter.js";
49
- import { WrapperLayout as Fo } from "./components/layout/WrapperLayout.js";
50
- import { c as Pe, L as ko } from "./LayoutWrapper-6224491f.js";
51
- import { useThemeContext as Wo } from "./contexts/ThemeContext.js";
52
- import { RPDropFileZone as Mo } from "./components/RPDropFileZone.js";
48
+ import { Container as Wo } from "./components/layout/Container.js";
49
+ import { useViewportContext as Se, ViewportProvider as Mo } from "./contexts/ViewportContext.js";
50
+ import { useToolbarComponentContext as Ce, ToolbarComponentProvider as Ho } from "./contexts/ToolbarComponentContext.js";
51
+ import { RPSplitter as $o } from "./components/layout/sidebar/RPSplitter.js";
52
+ import { WrapperLayout as Go } from "./components/layout/WrapperLayout.js";
53
+ import { c as Pe, L as qo } from "./LayoutWrapper-6224491f.js";
54
+ import { RPDropFileZone as Uo } from "./components/RPDropFileZone.js";
53
55
  import { c as ne, S as Mt } from "./SearchCloseButton-08d57275.js";
54
56
  import { UICheckbox as Ht } from "./components/ui/Checkbox.js";
55
- import { useIconContext as ge, IconProvider as Ho } from "./contexts/IconContext.js";
57
+ import { useIconContext as ge, IconProvider as Vo } from "./contexts/IconContext.js";
56
58
  import K from "./components/ui/RPTooltip.js";
57
59
  import { UIDropDown as yt } from "./components/ui/DropDown.js";
58
60
  import { MenuItem as ye } from "./components/layout/toolbar/MenuItem.js";
59
61
  import { MenuSeparator as It } from "./components/layout/toolbar/MenuSeparator.js";
60
62
  import { dateFormatter as $t } from "./utils/dateFormatter.js";
61
- import { PropertyItem as $o } from "./components/layout/toolbar/PropertyItem.js";
63
+ import { PropertyItem as Bo } from "./components/layout/toolbar/PropertyItem.js";
62
64
  import "./RotateTool.module-67946714.js";
63
65
  import { withRef as rt } from "./utils/withRef.js";
64
- import { useInfiniteScroll as Go } from "./utils/hooks/useInfiniteScroll.js";
65
- import { MAX_ZOOM_SCALE as Gt, THUMBNAIL_MIN_WIDTH as qo } from "./utils/constants.js";
66
- import * as Uo from "pdfjs-dist";
67
- import { PixelsPerInch as Vo, AnnotationMode as Bo, RenderingCancelledException as Zo, AnnotationLayer as jo } from "pdfjs-dist";
66
+ import { useInfiniteScroll as Zo } from "./utils/hooks/useInfiniteScroll.js";
67
+ import { MAX_ZOOM_SCALE as Gt, THUMBNAIL_MIN_WIDTH as jo } from "./utils/constants.js";
68
68
  import { SimpleLinkService as Ko } from "./utils/link_service.js";
69
69
  import { annotationsEvents as Xo, annotationEventsHandler as Qo, handleClick as qt, handleAnnotationWidget as Yo, handleAnnotationLink as Jo, bindLayerEvents as er, unbindLayerEvents as Ut } from "./utils/annotations.js";
70
70
  import { normalizeSingleKeyword as tr, sortHighlightPosition as nr, unwrap as or } from "./components/page/searchHighlight.js";
@@ -309,7 +309,7 @@ const bn = () => {
309
309
  T();
310
310
  return;
311
311
  }
312
- const O = x / Vo.PDF;
312
+ const O = x / Do.PDF;
313
313
  l.width = Math.floor(I.width * O), l.height = Math.floor(I.height * O);
314
314
  const D = l.getContext("2d");
315
315
  D.save(), D.fillStyle = "rgb(255, 255, 255)", D.fillRect(0, 0, l.width, l.height), D.restore();
@@ -326,14 +326,14 @@ const bn = () => {
326
326
  transform: [O, 0, 0, O, 0, 0],
327
327
  viewport: F.getViewport({ scale: 1, rotation: I.rotation }),
328
328
  intent: "print",
329
- annotationMode: Bo.ENABLE_STORAGE,
329
+ annotationMode: zo.ENABLE_STORAGE,
330
330
  optionalContentConfigPromise: S,
331
331
  printAnnotationStorage: E
332
332
  };
333
333
  try {
334
334
  return F.render(R).promise;
335
335
  } catch (A) {
336
- throw A instanceof Zo || console.error(A), A;
336
+ throw A instanceof Ao || console.error(A), A;
337
337
  }
338
338
  }, y = N(() => {
339
339
  const l = window.print;
@@ -912,7 +912,7 @@ const bn = () => {
912
912
  const f = r.current;
913
913
  return a.current && a.current.cancel(), p.page.getTextContent().then((h) => {
914
914
  const l = p.page.getViewport({ scale: 1 });
915
- return a.current = new Uo.TextLayer({
915
+ return a.current = new Oo.TextLayer({
916
916
  viewport: l,
917
917
  textContentSource: h,
918
918
  container: f
@@ -996,7 +996,7 @@ const Kr = (t) => {
996
996
  const p = new AbortController();
997
997
  return (async () => {
998
998
  var v;
999
- s.current && (s.current.div.replaceChildren(), s.current = void 0), n.current && (n.current.innerText = ""), s.current = new jo({
999
+ s.current && (s.current.div.replaceChildren(), s.current = void 0), n.current && (n.current.innerText = ""), s.current = new Fo({
1000
1000
  div: n.current,
1001
1001
  accessibilityManager: void 0,
1002
1002
  annotationCanvasMap: void 0,
@@ -2074,7 +2074,7 @@ const gi = un(({ widths: t, heights: e }) => {
2074
2074
  };
2075
2075
  }, [n, b]);
2076
2076
  }, Nn = rt((t, e) => {
2077
- const { children: n, toolbarRef: r, style: o, className: s, ...c } = t, { customVariables: d, customDarkVariables: a } = Wo(), { darkMode: m } = mo();
2077
+ const { children: n, toolbarRef: r, style: o, className: s, ...c } = t, { customVariables: d, customDarkVariables: a } = No(), { darkMode: m } = mo();
2078
2078
  return /* @__PURE__ */ i(
2079
2079
  "div",
2080
2080
  {
@@ -2256,7 +2256,7 @@ const gi = un(({ widths: t, heights: e }) => {
2256
2256
  p,
2257
2257
  q
2258
2258
  ]), /* @__PURE__ */ W(he, { children: [
2259
- /* @__PURE__ */ i(ko, { ref: s, children: /* @__PURE__ */ i(
2259
+ /* @__PURE__ */ i(qo, { ref: s, children: /* @__PURE__ */ i(
2260
2260
  Nn,
2261
2261
  {
2262
2262
  id: n,
@@ -2699,7 +2699,7 @@ const Ee = {
2699
2699
  /* @__PURE__ */ i(Fi, { className: Ee["rp-dialog-overlay"] }),
2700
2700
  /* @__PURE__ */ W(ki, { className: Ee["rp-document-dialog"], children: [
2701
2701
  /* @__PURE__ */ i(Wi, { className: Ee["rp-dialog-title"], children: o == null ? void 0 : o.documentPropertiesLabel }),
2702
- /* @__PURE__ */ i("div", { className: Ee["rp-document-properties"], children: s.map((c, d) => /* @__PURE__ */ i("div", { children: c.separate ? /* @__PURE__ */ i("div", { className: Ee["rp-properties-divider"] }) : /* @__PURE__ */ i($o, { label: c.label, value: c.value }) }, d)) }),
2702
+ /* @__PURE__ */ i("div", { className: Ee["rp-document-properties"], children: s.map((c, d) => /* @__PURE__ */ i("div", { children: c.separate ? /* @__PURE__ */ i("div", { className: Ee["rp-properties-divider"] }) : /* @__PURE__ */ i(Bo, { label: c.label, value: c.value }) }, d)) }),
2703
2703
  /* @__PURE__ */ i(Mi, { asChild: !0, className: Ee["rp-dialog-close"], children: /* @__PURE__ */ i(Sr, {}) })
2704
2704
  ] })
2705
2705
  ] }) }) });
@@ -3357,7 +3357,7 @@ const Ee = {
3357
3357
  }, [d, s, a]);
3358
3358
  return z(() => {
3359
3359
  o > a && s > a ? m(o) : n && C.current !== o && (hs(g.current, o), C.current = o);
3360
- }, [o, a, m, n, u]), Go(g.current, b), /* @__PURE__ */ i("div", { ref: g, className: ln["rp-thumbnails-container"], style: { width: r }, children: /* @__PURE__ */ i("div", { className: ln["rp-thumbnails"], children: n ? u.map((T, P) => {
3360
+ }, [o, a, m, n, u]), Zo(g.current, b), /* @__PURE__ */ i("div", { ref: g, className: ln["rp-thumbnails-container"], style: { width: r }, children: /* @__PURE__ */ i("div", { className: ln["rp-thumbnails"], children: n ? u.map((T, P) => {
3361
3361
  var w, y;
3362
3362
  return /* @__PURE__ */ i(
3363
3363
  us,
@@ -3373,9 +3373,9 @@ const Ee = {
3373
3373
  }) : null }) });
3374
3374
  }), ms = () => {
3375
3375
  const { thumbnailIcon: t } = ge(), { thumbnailIcon: e } = me();
3376
- return t || e || /* @__PURE__ */ i(No, {});
3376
+ return t || e || /* @__PURE__ */ i(ko, {});
3377
3377
  }, gs = () => {
3378
- const { active: t, setActive: e } = yn(), [n, r] = $(qo), o = M(null), s = M(null), { thumbnailTool: c, sidebarEnable: d } = Ce(), { localeMessages: a } = de(), m = N(() => {
3378
+ const { active: t, setActive: e } = yn(), [n, r] = $(jo), o = M(null), s = M(null), { thumbnailTool: c, sidebarEnable: d } = Ce(), { localeMessages: a } = de(), m = N(() => {
3379
3379
  e((C) => !C);
3380
3380
  }, []), g = k(() => typeof c != "boolean" && c ? /* @__PURE__ */ i(c, { onClick: m, active: t }) : c ? /* @__PURE__ */ i(K, { content: a == null ? void 0 : a.thumbnailTooltip, children: /* @__PURE__ */ i(
3381
3381
  ce,
@@ -3403,7 +3403,7 @@ const Ee = {
3403
3403
  children: [
3404
3404
  /* @__PURE__ */ i(fs, { show: t, ref: o }),
3405
3405
  /* @__PURE__ */ i(
3406
- Ao,
3406
+ $o,
3407
3407
  {
3408
3408
  onWidthChange: r,
3409
3409
  thumbnailRef: o,
@@ -3431,8 +3431,8 @@ const Ee = {
3431
3431
  return z(() => (a && a(), () => {
3432
3432
  m && m();
3433
3433
  }), [a, m]), // TODO: deprecated in v2.0.0, remove later ~
3434
- /* @__PURE__ */ i(Nn, { toolbarRef: C, ref: e, children: /* @__PURE__ */ i(Do, { mobileWidth: d, onLayoutWidthChange: g, children: /* @__PURE__ */ i(zo, { slots: r, children: /* @__PURE__ */ i(Ho, { icons: o, children: /* @__PURE__ */ W(Oo, { getContainerRef: b, style: s, className: c, children: [
3435
- /* @__PURE__ */ W(Fo, { children: [
3434
+ /* @__PURE__ */ i(Nn, { toolbarRef: C, ref: e, children: /* @__PURE__ */ i(Mo, { mobileWidth: d, onLayoutWidthChange: g, children: /* @__PURE__ */ i(Ho, { slots: r, children: /* @__PURE__ */ i(Vo, { icons: o, children: /* @__PURE__ */ W(Wo, { getContainerRef: b, style: s, className: c, children: [
3435
+ /* @__PURE__ */ W(Go, { children: [
3436
3436
  /* @__PURE__ */ W("div", { className: Pe["rp-layout"], children: [
3437
3437
  /* @__PURE__ */ i(
3438
3438
  ds,
@@ -3445,7 +3445,7 @@ const Ee = {
3445
3445
  /* @__PURE__ */ i("div", { ref: T, className: Pe["rp-pages"], children: n })
3446
3446
  ] })
3447
3447
  ] }),
3448
- /* @__PURE__ */ i(Mo, {})
3448
+ /* @__PURE__ */ i(Uo, {})
3449
3449
  ] }),
3450
3450
  P ? /* @__PURE__ */ i(
3451
3451
  "div",