@react-pdf-kit/viewer 2.7.3 → 2.7.4-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 (54) hide show
  1. package/dist/{AnnotationLayer-SQbmx6wX.js → AnnotationLayer-C_Sk3ZMg.js} +1 -1
  2. package/dist/{PaginationContext-B3qzCYJu.js → PaginationContext-BmPajxlU.js} +24 -16
  3. package/dist/{RPPage-BdoE0RrK.js → RPPage-B1UMGNSI.js} +1 -1
  4. package/dist/{RPPages-Dw7lGXzM.js → RPPages-Dh4RWlPS.js} +346 -341
  5. package/dist/{Thumbnail-BVjnCNxv.js → Thumbnail-BOvkeGXM.js} +1 -1
  6. package/dist/{Thumbnails-CrKLESh3.js → Thumbnails-jteSWSw9.js} +2 -2
  7. package/dist/components/RPController.js +1 -1
  8. package/dist/components/RPPages.js +1 -1
  9. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  11. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  12. package/dist/components/layout/toolbar/MostPageTool.js +1 -1
  13. package/dist/components/layout/toolbar/Paginate.js +1 -1
  14. package/dist/components/layout/toolbar/ScrollModeTool.js +4 -4
  15. package/dist/components/layout/toolbar/ToolbarCustom.js +1 -1
  16. package/dist/components/layout/toolbar/ToolbarDefault.js +1 -1
  17. package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
  18. package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
  19. package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +2 -2
  20. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  21. package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
  22. package/dist/components/layout/toolbar/tools/NextPageTool.js +1 -1
  23. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  24. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +1 -1
  25. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +5 -5
  26. package/dist/components/page/AnnotationLayer.js +1 -1
  27. package/dist/components/page/DualPage.js +2 -2
  28. package/dist/components/page/DualPageWithCover.js +2 -2
  29. package/dist/components/page/RPPage.js +1 -1
  30. package/dist/components/page/SinglePage.js +2 -2
  31. package/dist/contexts/ElementThumbnailContext.js +1 -1
  32. package/dist/contexts/PaginationContext.js +1 -1
  33. package/dist/contexts/RenderQueueProvider.js +1 -1
  34. package/dist/{de_DE-C1OrwQKj.js → de_DE-x4Z-jQrz.js} +12 -0
  35. package/dist/{main-CdlJS0xf.js → main-ByQlDC9E.js} +1 -1
  36. package/dist/main.js +3 -3
  37. package/dist/types/locales/de_DE.json.d.ts +2 -0
  38. package/dist/types/locales/en_US.json.d.ts +2 -0
  39. package/dist/types/locales/it_IT.json.d.ts +2 -0
  40. package/dist/types/locales/pt_PT.json.d.ts +2 -0
  41. package/dist/types/locales/th_TH.json.d.ts +2 -0
  42. package/dist/types/locales/zh_CN.json.d.ts +2 -0
  43. package/dist/types/utils/const.d.ts +3 -0
  44. package/dist/types/utils/types.d.ts +4 -1
  45. package/dist/utils/const.js +2 -2
  46. package/dist/utils/hooks/useLicense.js +1 -1
  47. package/dist/utils/hooks/useLoadPdf.js +73 -63
  48. package/dist/utils/hooks/useLocalization.js +1 -1
  49. package/dist/utils/hooks/usePaginate.js +1 -1
  50. package/dist/utils/hooks/usePresentPage.js +1 -1
  51. package/dist/utils/hooks/useScrollToPage.js +1 -1
  52. package/dist/utils/hooks/useSearch.js +1 -1
  53. package/dist/utils/types.js +2 -2
  54. package/package.json +1 -1
@@ -2,7 +2,7 @@ import { AnnotationSubType as e } from "./utils/types.js";
2
2
  import { useDocumentContext as t } from "./contexts/RPDocumentContext.js";
3
3
  import { useInitialStateContext as n } from "./contexts/InitialStateContext.js";
4
4
  import { useScrollModeContext as r } from "./contexts/ScrollModeContext.js";
5
- import { r as i } from "./PaginationContext-B3qzCYJu.js";
5
+ import { r as i } from "./PaginationContext-BmPajxlU.js";
6
6
  import { usePrintContext as a } from "./contexts/PrintContext.js";
7
7
  import { SimpleLinkService as o } from "./utils/link_service.js";
8
8
  import { annotationEventsHandler as s, bindLayerEvents as c, enhanceLinkAccessibility as l, fixTabIndexAccessibility as u, handleAnnotationWidget as d, insertDateText as f, unbindLayerEvents as p } from "./utils/annotations.js";
@@ -202,31 +202,39 @@ var T = () => {
202
202
  let e = b(D);
203
203
  return e?.focusedPage === void 0 && n.error("Please use this hooks inside children component of RPProvider"), e;
204
204
  }, k = ({ children: e }) => {
205
- let { pdf: t } = r(), { setCurrentPage: n } = d(), { initialPage: a = 1 } = i(), { focusedPage: o, totalPages: s, setFocusedPage: c, resetPage: l, setTotalPages: u, goToPage: f, nextPage: p, prevPage: m } = E(a), h = S(!0);
205
+ let { pdf: t, pages: n } = r(), { setCurrentPage: a } = d(), { initialPage: o = 1 } = i(), { focusedPage: s, totalPages: c, setFocusedPage: l, resetPage: u, setTotalPages: f, goToPage: p, nextPage: m, prevPage: h } = E(o), g = S(!0);
206
206
  return x(() => {
207
207
  if (!t) {
208
- h.current || (u(0), l(1));
208
+ g.current || (f(0), u(1));
209
209
  return;
210
210
  }
211
211
  if (!t.numPages) return;
212
- u(t.numPages);
213
- let e = h.current ? a : 1;
214
- l(Math.min(Math.max(e, 1), t.numPages)), h.current = !1;
212
+ f(t.numPages);
213
+ let e = g.current ? o : 1;
214
+ u(Math.min(Math.max(e, 1), t.numPages)), g.current = !1;
215
215
  }, [
216
216
  t,
217
- u,
218
- l
217
+ f,
218
+ u
219
+ ]), x(() => {
220
+ !t || !n.size || (f(n.size), s > n.size && u(n.size));
221
+ }, [
222
+ t,
223
+ n,
224
+ s,
225
+ f,
226
+ u
219
227
  ]), x(() => {
220
- n(o);
221
- }, [o, n]), /* @__PURE__ */ w(D.Provider, {
228
+ a(s);
229
+ }, [s, a]), /* @__PURE__ */ w(D.Provider, {
222
230
  value: {
223
- focusedPage: o,
224
- totalPages: s,
225
- setFocusedPage: c,
226
- setTotalPages: u,
227
- nextPage: p,
228
- prevPage: m,
229
- goToPage: f
231
+ focusedPage: s,
232
+ totalPages: c,
233
+ setFocusedPage: l,
234
+ setTotalPages: f,
235
+ nextPage: m,
236
+ prevPage: h,
237
+ goToPage: p
230
238
  },
231
239
  children: e
232
240
  });
@@ -5,7 +5,7 @@ import { useLayerContext as r } from "./contexts/LayerContext.js";
5
5
  import { useLoaderContext as i } from "./contexts/LoaderContext.js";
6
6
  import { CanvasLayer as a } from "./components/page/CanvasLayer.js";
7
7
  import { t as o } from "./TextLayer-DWGFN9SF.js";
8
- import { t as s } from "./AnnotationLayer-SQbmx6wX.js";
8
+ import { t as s } from "./AnnotationLayer-C_Sk3ZMg.js";
9
9
  import { t as c } from "./TextHighlightLayer-BSVgBxR3.js";
10
10
  import { CustomElement as l } from "./components/page/CustomElement.js";
11
11
  import { withRef as u } from "./utils/withRef.js";