@pdf-viewer/react 0.4.0-beta.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.
- package/README.md +3 -0
- package/dist/Container.module-cb7b45b9.js +14 -0
- package/dist/RPSplitter.module-13d612c4.js +7 -0
- package/dist/RPTheme.module-f756e5cd.js +7 -0
- package/dist/Thumbnails-06fa1aa5.js +2657 -0
- package/dist/WrapperLayout.module-147bc943.js +6 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/Checkbox.css +1 -0
- package/dist/assets/Container.css +1 -0
- package/dist/assets/DropDown.css +1 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/LoaderIcon.css +1 -0
- package/dist/assets/MenuItem.css +1 -0
- package/dist/assets/MenuSeparator.css +1 -0
- package/dist/assets/PropertyItem.css +1 -0
- package/dist/assets/RPSplitter.css +1 -0
- package/dist/assets/RPTheme.css +1 -0
- package/dist/assets/RotateTool.css +1 -0
- package/dist/assets/Thumbnails.css +1 -0
- package/dist/assets/WrapperLayout.css +1 -0
- package/dist/clsx-0c6e471a.js +22 -0
- package/dist/components/RPConfig.js +1347 -0
- package/dist/components/RPController.js +49 -0
- package/dist/components/RPDocument.js +9 -0
- package/dist/components/RPDropFileZone.js +33 -0
- package/dist/components/RPTheme.js +21 -0
- package/dist/components/RPViewer.js +37 -0
- package/dist/components/icons/CheckIcon.js +22 -0
- package/dist/components/icons/ChevronUpIcon.js +22 -0
- package/dist/components/icons/ClearIcon.js +25 -0
- package/dist/components/icons/ClockwiseIcon.js +22 -0
- package/dist/components/icons/CloseIcon.js +22 -0
- package/dist/components/icons/DarkPdfIcon.js +15 -0
- package/dist/components/icons/DualPageIcon.js +22 -0
- package/dist/components/icons/FileDownloadDefaultIcon.js +23 -0
- package/dist/components/icons/FileUploadDefaultIcon.js +23 -0
- package/dist/components/icons/FullScreenIcon.js +22 -0
- package/dist/components/icons/GoToDownIcon.js +22 -0
- package/dist/components/icons/HandModeDefaultIcon.js +22 -0
- package/dist/components/icons/HorizontalScrollingIcon.js +24 -0
- package/dist/components/icons/InfoIcon.js +22 -0
- package/dist/components/icons/LightPdfIcon.js +15 -0
- package/dist/components/icons/LoaderIcon.js +17 -0
- package/dist/components/icons/MoonIcon.js +22 -0
- package/dist/components/icons/PageScrollingIcon.js +24 -0
- package/dist/components/icons/PrintDefaultIcon.js +23 -0
- package/dist/components/icons/SearchIcon.js +22 -0
- package/dist/components/icons/SinglePageIcon.js +22 -0
- package/dist/components/icons/SunIcon.js +25 -0
- package/dist/components/icons/TextSelectionDefaultIcon.js +23 -0
- package/dist/components/icons/ThreeDotIcon.js +22 -0
- package/dist/components/icons/Thumbnail.js +54 -0
- package/dist/components/icons/VerticalScrollingIcon.js +24 -0
- package/dist/components/icons/WrappedScrollingIcon.js +24 -0
- package/dist/components/icons/ZoomInIcon.js +22 -0
- package/dist/components/icons/ZoomOutIcon.js +22 -0
- package/dist/components/layout/Container.js +28 -0
- package/dist/components/layout/RPLayout.js +59 -0
- package/dist/components/layout/WrapperLayout.js +11 -0
- package/dist/components/layout/sidebar/RPSidebar.js +34 -0
- package/dist/components/layout/sidebar/RPSplitter.js +10 -0
- package/dist/components/layout/sidebar/Thumbnail.js +8 -0
- package/dist/components/layout/sidebar/Thumbnails.js +7 -0
- package/dist/components/layout/toolbar/DarkModeTool.js +23 -0
- package/dist/components/layout/toolbar/DocumentDialog.js +36 -0
- package/dist/components/layout/toolbar/DocumentProperties.js +19 -0
- package/dist/components/layout/toolbar/FileDownloadTool.js +11 -0
- package/dist/components/layout/toolbar/FileUploadTool.js +21 -0
- package/dist/components/layout/toolbar/FullScreenTool.js +46 -0
- package/dist/components/layout/toolbar/MenuItem.js +12 -0
- package/dist/components/layout/toolbar/MenuSeparator.js +8 -0
- package/dist/components/layout/toolbar/MostPageTool.js +36 -0
- package/dist/components/layout/toolbar/OtherTool.js +21 -0
- package/dist/components/layout/toolbar/Paginate.js +12 -0
- package/dist/components/layout/toolbar/PrintTool.js +11 -0
- package/dist/components/layout/toolbar/PropertyItem.js +12 -0
- package/dist/components/layout/toolbar/RPToolbar.js +8 -0
- package/dist/components/layout/toolbar/RPToolbarEnd.js +9 -0
- package/dist/components/layout/toolbar/RotateTool.js +33 -0
- package/dist/components/layout/toolbar/ScrollModeTool.js +54 -0
- package/dist/components/layout/toolbar/SearchTool.js +40 -0
- package/dist/components/layout/toolbar/SelectionModeTool.js +36 -0
- package/dist/components/layout/toolbar/ViewModeTool.js +31 -0
- package/dist/components/layout/toolbar/ZoomTool.js +41 -0
- package/dist/components/page/AnnotationLayer.js +37 -0
- package/dist/components/page/CanvasLayer.js +33 -0
- package/dist/components/page/DualPage.js +6 -0
- package/dist/components/page/RPPage.js +33 -0
- package/dist/components/page/SinglePage.js +6 -0
- package/dist/components/page/TextLayer.js +34 -0
- package/dist/components/ui/Button.js +22 -0
- package/dist/components/ui/Checkbox.js +301 -0
- package/dist/components/ui/DropDown.js +29 -0
- package/dist/components/ui/Input.js +26 -0
- package/dist/components/ui/LoadingIndicator.js +6 -0
- package/dist/contexts/ConfigContext.js +13 -0
- package/dist/contexts/DarkModeContext.js +28 -0
- package/dist/contexts/DropFileZoneContext.js +50 -0
- package/dist/contexts/FileInputContext.js +38 -0
- package/dist/contexts/FullScreenContext.js +18 -0
- package/dist/contexts/IconContext.js +11 -0
- package/dist/contexts/InitialStateContext.js +11 -0
- package/dist/contexts/LayerContext.js +8 -0
- package/dist/contexts/LayoutContainerContext.js +10 -0
- package/dist/contexts/LicenseContext.js +15 -0
- package/dist/contexts/OtherToolContext.js +18 -0
- package/dist/contexts/PageViewportContext.js +8 -0
- package/dist/contexts/PaginateContext.js +11 -0
- package/dist/contexts/PrintContext.js +8 -0
- package/dist/contexts/RPDocumentContext.js +49 -0
- package/dist/contexts/RenderedPagesCache.js +14 -0
- package/dist/contexts/RotateContext.js +23 -0
- package/dist/contexts/ScrollModeContext.js +21 -0
- package/dist/contexts/ScrollStateContext.js +13 -0
- package/dist/contexts/SearchContext.js +8 -0
- package/dist/contexts/SelectionModeContext.js +23 -0
- package/dist/contexts/ThemeContext.js +7 -0
- package/dist/contexts/ThumbnailsContext.js +8 -0
- package/dist/contexts/ToolbarComponentContext.js +41 -0
- package/dist/contexts/ViewModeContext.js +28 -0
- package/dist/contexts/ViewportContext.js +62 -0
- package/dist/contexts/VirtualGridContext.js +15 -0
- package/dist/contexts/VirtualScrollContext.js +53 -0
- package/dist/contexts/ZoomContext.js +46 -0
- package/dist/index-3459164c.js +3609 -0
- package/dist/index-743c36f0.js +139 -0
- package/dist/main.js +37 -0
- package/dist/types/components/RPConfig.d.ts +3 -0
- package/dist/types/components/RPController.d.ts +3 -0
- package/dist/types/components/RPDocument.d.ts +3 -0
- package/dist/types/components/RPDropFileZone.d.ts +2 -0
- package/dist/types/components/RPTheme.d.ts +3 -0
- package/dist/types/components/RPViewer.d.ts +2 -0
- package/dist/types/components/icons/CheckIcon.d.ts +2 -0
- package/dist/types/components/icons/ChevronUpIcon.d.ts +2 -0
- package/dist/types/components/icons/ClearIcon.d.ts +2 -0
- package/dist/types/components/icons/ClockwiseIcon.d.ts +2 -0
- package/dist/types/components/icons/CloseIcon.d.ts +2 -0
- package/dist/types/components/icons/DarkPdfIcon.d.ts +2 -0
- package/dist/types/components/icons/DualPageIcon.d.ts +2 -0
- package/dist/types/components/icons/FileDownloadDefaultIcon.d.ts +2 -0
- package/dist/types/components/icons/FileUploadDefaultIcon.d.ts +2 -0
- package/dist/types/components/icons/FullScreenIcon.d.ts +2 -0
- package/dist/types/components/icons/GoToDownIcon.d.ts +2 -0
- package/dist/types/components/icons/HandModeDefaultIcon.d.ts +2 -0
- package/dist/types/components/icons/HorizontalScrollingIcon.d.ts +2 -0
- package/dist/types/components/icons/InfoIcon.d.ts +2 -0
- package/dist/types/components/icons/LightPdfIcon.d.ts +2 -0
- package/dist/types/components/icons/LoaderIcon.d.ts +2 -0
- package/dist/types/components/icons/MoonIcon.d.ts +2 -0
- package/dist/types/components/icons/PageScrollingIcon.d.ts +2 -0
- package/dist/types/components/icons/PrintDefaultIcon.d.ts +2 -0
- package/dist/types/components/icons/SearchIcon.d.ts +2 -0
- package/dist/types/components/icons/SinglePageIcon.d.ts +2 -0
- package/dist/types/components/icons/SunIcon.d.ts +2 -0
- package/dist/types/components/icons/TextSelectionDefaultIcon.d.ts +2 -0
- package/dist/types/components/icons/ThreeDotIcon.d.ts +2 -0
- package/dist/types/components/icons/Thumbnail.d.ts +2 -0
- package/dist/types/components/icons/VerticalScrollingIcon.d.ts +2 -0
- package/dist/types/components/icons/WrappedScrollingIcon.d.ts +2 -0
- package/dist/types/components/icons/ZoomInIcon.d.ts +2 -0
- package/dist/types/components/icons/ZoomOutIcon.d.ts +2 -0
- package/dist/types/components/layout/Container.d.ts +9 -0
- package/dist/types/components/layout/RPLayout.d.ts +3 -0
- package/dist/types/components/layout/WrapperLayout.d.ts +2 -0
- package/dist/types/components/layout/sidebar/RPSidebar.d.ts +1 -0
- package/dist/types/components/layout/sidebar/RPSplitter.d.ts +7 -0
- package/dist/types/components/layout/sidebar/Thumbnail.d.ts +11 -0
- package/dist/types/components/layout/sidebar/Thumbnails.d.ts +5 -0
- package/dist/types/components/layout/toolbar/DarkModeTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/DocumentDialog.d.ts +2 -0
- package/dist/types/components/layout/toolbar/DocumentProperties.d.ts +1 -0
- package/dist/types/components/layout/toolbar/FileDownloadTool.d.ts +2 -0
- package/dist/types/components/layout/toolbar/FileUploadTool.d.ts +2 -0
- package/dist/types/components/layout/toolbar/FullScreenTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/MenuItem.d.ts +6 -0
- package/dist/types/components/layout/toolbar/MenuSeparator.d.ts +1 -0
- package/dist/types/components/layout/toolbar/MostPageTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/OtherTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/Paginate.d.ts +1 -0
- package/dist/types/components/layout/toolbar/PrintTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/PropertyItem.d.ts +7 -0
- package/dist/types/components/layout/toolbar/RPToolbar.d.ts +1 -0
- package/dist/types/components/layout/toolbar/RPToolbarEnd.d.ts +1 -0
- package/dist/types/components/layout/toolbar/RotateTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/ScrollModeTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/SearchTool.d.ts +2 -0
- package/dist/types/components/layout/toolbar/SelectionModeTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/ViewModeTool.d.ts +1 -0
- package/dist/types/components/layout/toolbar/ZoomTool.d.ts +1 -0
- package/dist/types/components/page/AnnotationLayer.d.ts +6 -0
- package/dist/types/components/page/CanvasLayer.d.ts +8 -0
- package/dist/types/components/page/DualPage.d.ts +5 -0
- package/dist/types/components/page/RPPage.d.ts +6 -0
- package/dist/types/components/page/SinglePage.d.ts +5 -0
- package/dist/types/components/page/TextLayer.d.ts +6 -0
- package/dist/types/components/ui/Button.d.ts +6 -0
- package/dist/types/components/ui/Checkbox.d.ts +8 -0
- package/dist/types/components/ui/DropDown.d.ts +9 -0
- package/dist/types/components/ui/Input.d.ts +6 -0
- package/dist/types/components/ui/LoadingIndicator.d.ts +6 -0
- package/dist/types/contexts/ConfigContext.d.ts +5 -0
- package/dist/types/contexts/DarkModeContext.d.ts +5 -0
- package/dist/types/contexts/DropFileZoneContext.d.ts +5 -0
- package/dist/types/contexts/FileInputContext.d.ts +7 -0
- package/dist/types/contexts/FullScreenContext.d.ts +7 -0
- package/dist/types/contexts/IconContext.d.ts +7 -0
- package/dist/types/contexts/InitialStateContext.d.ts +5 -0
- package/dist/types/contexts/LayerContext.d.ts +5 -0
- package/dist/types/contexts/LayoutContainerContext.d.ts +8 -0
- package/dist/types/contexts/LicenseContext.d.ts +7 -0
- package/dist/types/contexts/OtherToolContext.d.ts +9 -0
- package/dist/types/contexts/PageViewportContext.d.ts +4 -0
- package/dist/types/contexts/PaginateContext.d.ts +5 -0
- package/dist/types/contexts/PrintContext.d.ts +7 -0
- package/dist/types/contexts/RPDocumentContext.d.ts +10 -0
- package/dist/types/contexts/RenderedPagesCache.d.ts +10 -0
- package/dist/types/contexts/RotateContext.d.ts +5 -0
- package/dist/types/contexts/ScrollModeContext.d.ts +5 -0
- package/dist/types/contexts/ScrollStateContext.d.ts +8 -0
- package/dist/types/contexts/SearchContext.d.ts +7 -0
- package/dist/types/contexts/SelectionModeContext.d.ts +5 -0
- package/dist/types/contexts/ThemeContext.d.ts +4 -0
- package/dist/types/contexts/ThumbnailsContext.d.ts +7 -0
- package/dist/types/contexts/ToolbarComponentContext.d.ts +9 -0
- package/dist/types/contexts/ViewModeContext.d.ts +5 -0
- package/dist/types/contexts/ViewportContext.d.ts +28 -0
- package/dist/types/contexts/VirtualGridContext.d.ts +9 -0
- package/dist/types/contexts/VirtualScrollContext.d.ts +30 -0
- package/dist/types/contexts/ZoomContext.d.ts +5 -0
- package/dist/types/main.d.ts +20 -0
- package/dist/types/utils/appConsole.d.ts +24 -0
- package/dist/types/utils/charators.d.ts +12 -0
- package/dist/types/utils/constants.d.ts +2 -0
- package/dist/types/utils/convertPdfDate.d.ts +1 -0
- package/dist/types/utils/dateFormatter.d.ts +1 -0
- package/dist/types/utils/formatFileSize.d.ts +1 -0
- package/dist/types/utils/getThumbnailViewport.d.ts +5 -0
- package/dist/types/utils/getZoomLevel.d.ts +2 -0
- package/dist/types/utils/highlight.d.ts +8 -0
- package/dist/types/utils/hooks/useDarkMode.d.ts +2 -0
- package/dist/types/utils/hooks/useDarkModeProps.d.ts +2 -0
- package/dist/types/utils/hooks/useDebounce.d.ts +1 -0
- package/dist/types/utils/hooks/useElementSize.d.ts +8 -0
- package/dist/types/utils/hooks/useFileDownload.d.ts +3 -0
- package/dist/types/utils/hooks/useFullScreen.d.ts +6 -0
- package/dist/types/utils/hooks/useGrabScroll.d.ts +10 -0
- package/dist/types/utils/hooks/useInfiniteScroll.d.ts +6 -0
- package/dist/types/utils/hooks/useLicense.d.ts +2 -0
- package/dist/types/utils/hooks/useLoadPdf.d.ts +7 -0
- package/dist/types/utils/hooks/useLoadWorker.d.ts +3 -0
- package/dist/types/utils/hooks/useMousePressed.d.ts +7 -0
- package/dist/types/utils/hooks/usePageDimension.d.ts +4 -0
- package/dist/types/utils/hooks/usePaginate.d.ts +2 -0
- package/dist/types/utils/hooks/usePdfProperties.d.ts +9 -0
- package/dist/types/utils/hooks/usePrint.d.ts +11 -0
- package/dist/types/utils/hooks/useRequestAnimationFrame.d.ts +5 -0
- package/dist/types/utils/hooks/useResizeObserver.d.ts +6 -0
- package/dist/types/utils/hooks/useRotate.d.ts +4 -0
- package/dist/types/utils/hooks/useScrollToPage.d.ts +4 -0
- package/dist/types/utils/hooks/useSearch.d.ts +14 -0
- package/dist/types/utils/hooks/useThumbnail.d.ts +7 -0
- package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +12 -0
- package/dist/types/utils/hooks/useWatermark.d.ts +4 -0
- package/dist/types/utils/link_service.d.ts +71 -0
- package/dist/types/utils/renderPage.d.ts +2 -0
- package/dist/types/utils/sanitizeExternalUrl.d.ts +1 -0
- package/dist/types/utils/types.d.ts +562 -0
- package/dist/utils/appConsole.js +42 -0
- package/dist/utils/charators.js +48 -0
- package/dist/utils/constants.js +5 -0
- package/dist/utils/convertPdfDate.js +25 -0
- package/dist/utils/dateFormatter.js +7 -0
- package/dist/utils/formatFileSize.js +9 -0
- package/dist/utils/getThumbnailViewport.js +7 -0
- package/dist/utils/getZoomLevel.js +18 -0
- package/dist/utils/highlight.js +145 -0
- package/dist/utils/hooks/useDarkMode.js +11 -0
- package/dist/utils/hooks/useDarkModeProps.js +12 -0
- package/dist/utils/hooks/useDebounce.js +15 -0
- package/dist/utils/hooks/useElementSize.js +21 -0
- package/dist/utils/hooks/useFileDownload.js +32 -0
- package/dist/utils/hooks/useFullScreen.js +29 -0
- package/dist/utils/hooks/useGrabScroll.js +45 -0
- package/dist/utils/hooks/useInfiniteScroll.js +19 -0
- package/dist/utils/hooks/useLicense.js +102 -0
- package/dist/utils/hooks/useLoadPdf.js +50 -0
- package/dist/utils/hooks/useLoadWorker.js +13 -0
- package/dist/utils/hooks/useMousePressed.js +20 -0
- package/dist/utils/hooks/usePageDimension.js +24 -0
- package/dist/utils/hooks/usePaginate.js +33 -0
- package/dist/utils/hooks/usePdfProperties.js +40 -0
- package/dist/utils/hooks/usePrint.js +33 -0
- package/dist/utils/hooks/useRequestAnimationFrame.js +17 -0
- package/dist/utils/hooks/useResizeObserver.js +22 -0
- package/dist/utils/hooks/useRotate.js +13 -0
- package/dist/utils/hooks/useScrollToPage.js +34 -0
- package/dist/utils/hooks/useSearch.js +33 -0
- package/dist/utils/hooks/useThumbnail.js +34 -0
- package/dist/utils/hooks/useVirtualReactWindow.js +34 -0
- package/dist/utils/hooks/useWatermark.js +62 -0
- package/dist/utils/link_service.js +98 -0
- package/dist/utils/renderPage.js +15 -0
- package/dist/utils/sanitizeExternalUrl.js +16 -0
- package/dist/utils/types.js +10 -0
- package/package.json +90 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as s, useContext as a } from "react";
|
|
3
|
+
const e = s({
|
|
4
|
+
viewports: /* @__PURE__ */ new Map(),
|
|
5
|
+
pages: /* @__PURE__ */ new Map()
|
|
6
|
+
}), d = () => a(e), i = ({ children: r }) => {
|
|
7
|
+
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
8
|
+
return /* @__PURE__ */ o(e.Provider, { value: { viewports: t, pages: n }, children: r });
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
e as RenderedPagesCacheContext,
|
|
12
|
+
i as RenderedPagesCacheProvider,
|
|
13
|
+
d as useRenderedPagesCache
|
|
14
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as i, useContext as u, useState as c, useMemo as m } from "react";
|
|
3
|
+
import { appConsole as l } from "../utils/appConsole.js";
|
|
4
|
+
import { useInitialStateContext as p } from "./InitialStateContext.js";
|
|
5
|
+
const r = i({
|
|
6
|
+
rotate: 0,
|
|
7
|
+
setRotate: () => {
|
|
8
|
+
}
|
|
9
|
+
}), x = () => {
|
|
10
|
+
const t = u(r);
|
|
11
|
+
return typeof (t == null ? void 0 : t.rotate) > "u" && l.error("Please use this hooks inside children component of RPController or RPLayout"), t;
|
|
12
|
+
}, P = ({ children: t }) => {
|
|
13
|
+
const { initialRotate: n = 0 } = p(), [o, e] = c(n), s = m(() => ({
|
|
14
|
+
rotate: o,
|
|
15
|
+
setRotate: e
|
|
16
|
+
}), [o, e]);
|
|
17
|
+
return /* @__PURE__ */ a(r.Provider, { value: s, children: t });
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
r as RotateContext,
|
|
21
|
+
P as RotateProvider,
|
|
22
|
+
x as useRotateContext
|
|
23
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as c, useContext as i, useState as d } from "react";
|
|
3
|
+
import { appConsole as m } from "../utils/appConsole.js";
|
|
4
|
+
import { ScrollMode as e } from "../utils/types.js";
|
|
5
|
+
import { useInitialStateContext as C } from "./InitialStateContext.js";
|
|
6
|
+
const t = c({
|
|
7
|
+
scrollMode: e.VERTICAL_SCROLLING,
|
|
8
|
+
setScrollMode: () => {
|
|
9
|
+
}
|
|
10
|
+
}), f = () => {
|
|
11
|
+
const o = i(t);
|
|
12
|
+
return typeof o.scrollMode > "u" && m.error("Please use this hooks inside children component of RPController or RPLayout"), o;
|
|
13
|
+
}, x = ({ children: o }) => {
|
|
14
|
+
const { initialScrollMode: r = e.VERTICAL_SCROLLING } = C(), [l, n] = d(r);
|
|
15
|
+
return /* @__PURE__ */ s(t.Provider, { value: { scrollMode: l, setScrollMode: n }, children: o });
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
t as ScrollModeContext,
|
|
19
|
+
x as ScrollModeProvider,
|
|
20
|
+
f as useScrollModeContext
|
|
21
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as l, useContext as n, useRef as s } from "react";
|
|
3
|
+
const t = l({
|
|
4
|
+
isScrolling: { current: !1 }
|
|
5
|
+
}), S = () => n(t), a = ({ children: e }) => {
|
|
6
|
+
const r = s(!1);
|
|
7
|
+
return /* @__PURE__ */ o(t.Provider, { value: { isScrolling: r }, children: e });
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
t as ScrollStateContext,
|
|
11
|
+
a as ScrollStateProvider,
|
|
12
|
+
S as useScrollStateContext
|
|
13
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as c, useContext as d, useState as l } from "react";
|
|
3
|
+
import { appConsole as m } from "../utils/appConsole.js";
|
|
4
|
+
import { SelectionMode as o } from "../utils/types.js";
|
|
5
|
+
const t = c({
|
|
6
|
+
selectionMode: o.TEXT,
|
|
7
|
+
setSelectionMode: () => {
|
|
8
|
+
}
|
|
9
|
+
}), x = () => {
|
|
10
|
+
const e = d(t);
|
|
11
|
+
return typeof e.selectionMode > "u" && m.error("Please use this hooks inside children component of RPController or RPLayout"), e;
|
|
12
|
+
}, S = ({
|
|
13
|
+
children: e,
|
|
14
|
+
initialSelectionMode: n = o.TEXT
|
|
15
|
+
}) => {
|
|
16
|
+
const [r, i] = l(n);
|
|
17
|
+
return /* @__PURE__ */ s(t.Provider, { value: { selectionMode: r, setSelectionMode: i }, children: e });
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
t as SelectionModeContext,
|
|
21
|
+
S as SelectionModeProvider,
|
|
22
|
+
x as useSelectionModeContext
|
|
23
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as u, useContext as n, useMemo as i } from "react";
|
|
3
|
+
const e = u({
|
|
4
|
+
themeSwitcher: !0,
|
|
5
|
+
documentProperties: !0,
|
|
6
|
+
rotateTool: !0,
|
|
7
|
+
fullscreenTool: !0,
|
|
8
|
+
openFileTool: !0,
|
|
9
|
+
dropFileZone: !0,
|
|
10
|
+
downloadTool: !0,
|
|
11
|
+
viewModeTool: !0,
|
|
12
|
+
scrollModeTool: !0,
|
|
13
|
+
printTool: !0,
|
|
14
|
+
showPrintProgress: !0,
|
|
15
|
+
selectionModeTool: !0
|
|
16
|
+
}), c = () => n(e), s = {
|
|
17
|
+
themeSwitcher: !0,
|
|
18
|
+
documentProperties: !0,
|
|
19
|
+
rotateTool: !0,
|
|
20
|
+
fullscreenTool: !0,
|
|
21
|
+
openFileTool: !0,
|
|
22
|
+
dropFileZone: !0,
|
|
23
|
+
downloadTool: !0,
|
|
24
|
+
viewModeTool: !0,
|
|
25
|
+
scrollModeTool: !0,
|
|
26
|
+
printTool: !0,
|
|
27
|
+
thumbnailTool: !0,
|
|
28
|
+
showPrintProgress: !0,
|
|
29
|
+
selectionModeTool: !0
|
|
30
|
+
}, p = ({ children: r, slots: o }) => {
|
|
31
|
+
const t = i(() => ({
|
|
32
|
+
...s,
|
|
33
|
+
...o
|
|
34
|
+
}), [o]);
|
|
35
|
+
return /* @__PURE__ */ l(e.Provider, { value: t, children: r });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
e as ToolbarComponentContext,
|
|
39
|
+
p as ToolbarComponentProvider,
|
|
40
|
+
c as useToolbarComponentContext
|
|
41
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as m, useContext as P, useState as d, useCallback as r, useMemo as C } from "react";
|
|
3
|
+
import { appConsole as p } from "../utils/appConsole.js";
|
|
4
|
+
import { ViewMode as e } from "../utils/types.js";
|
|
5
|
+
import { useInitialStateContext as f } from "./InitialStateContext.js";
|
|
6
|
+
const i = m({
|
|
7
|
+
columnCount: 1,
|
|
8
|
+
setSinglePage: () => {
|
|
9
|
+
},
|
|
10
|
+
setDualPage: () => {
|
|
11
|
+
},
|
|
12
|
+
viewMode: e.SINGLE_PAGE
|
|
13
|
+
}), w = () => {
|
|
14
|
+
const o = P(i);
|
|
15
|
+
return typeof o.columnCount > "u" && p.error("Please use this hooks inside children component of RPController or RPLayout"), o;
|
|
16
|
+
}, g = ({ children: o }) => {
|
|
17
|
+
const { initialViewMode: s = e.SINGLE_PAGE } = f(), [t, n] = d(s === e.SINGLE_PAGE ? 1 : 2), u = r(() => {
|
|
18
|
+
n(1);
|
|
19
|
+
}, []), l = r(() => {
|
|
20
|
+
n(2);
|
|
21
|
+
}, []), a = C(() => t === 1 ? e.SINGLE_PAGE : e.DUAL_PAGE, [t]);
|
|
22
|
+
return /* @__PURE__ */ c(i.Provider, { value: { columnCount: t, setSinglePage: u, setDualPage: l, viewMode: a }, children: o });
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
i as ViewModeContext,
|
|
26
|
+
g as ViewModeProvider,
|
|
27
|
+
w as useViewModeContext
|
|
28
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as h, useState as m, useEffect as b, useContext as x } from "react";
|
|
3
|
+
const v = {
|
|
4
|
+
xs: 320,
|
|
5
|
+
sm: 640,
|
|
6
|
+
md: 768,
|
|
7
|
+
lg: 1024,
|
|
8
|
+
xl: 1280,
|
|
9
|
+
"2xl": 1536
|
|
10
|
+
}, s = h(void 0), E = ({ children: n, mobileWidth: a = 768 }) => {
|
|
11
|
+
const [o, d] = m({
|
|
12
|
+
width: window.innerWidth,
|
|
13
|
+
height: window.innerHeight,
|
|
14
|
+
isMobile: !1,
|
|
15
|
+
currentBreakpoint: "xs",
|
|
16
|
+
orientation: "portrait"
|
|
17
|
+
}), r = {
|
|
18
|
+
...v,
|
|
19
|
+
md: a
|
|
20
|
+
}, c = () => o.width < r.md, w = (e) => {
|
|
21
|
+
const i = Object.entries(r);
|
|
22
|
+
for (let t = i.length - 1; t >= 0; t--)
|
|
23
|
+
if (e >= i[t][1])
|
|
24
|
+
return i[t][0];
|
|
25
|
+
return "xs";
|
|
26
|
+
}, p = () => {
|
|
27
|
+
const e = navigator.userAgent.toLowerCase();
|
|
28
|
+
return ["iphone", "ipod", "ipad", "android", "mobile", "phone", "tablet"].some((t) => e.includes(t));
|
|
29
|
+
};
|
|
30
|
+
b(() => {
|
|
31
|
+
const e = () => {
|
|
32
|
+
const i = window.innerWidth, t = window.innerHeight;
|
|
33
|
+
d({
|
|
34
|
+
width: i,
|
|
35
|
+
height: t,
|
|
36
|
+
isMobile: p(),
|
|
37
|
+
currentBreakpoint: w(i),
|
|
38
|
+
orientation: t > i ? "portrait" : "landscape"
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
42
|
+
}, []);
|
|
43
|
+
const l = {
|
|
44
|
+
...o,
|
|
45
|
+
breakpoints: r,
|
|
46
|
+
isBreakpoint: (e) => o.width >= r[e],
|
|
47
|
+
isMobileDevice: o.isMobile,
|
|
48
|
+
isPortrait: o.orientation === "portrait",
|
|
49
|
+
isLandscape: o.orientation === "landscape",
|
|
50
|
+
isSmallScreen: c()
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ u(s.Provider, { value: l, children: n });
|
|
53
|
+
}, B = () => {
|
|
54
|
+
const n = x(s);
|
|
55
|
+
if (n === void 0)
|
|
56
|
+
throw new Error("useViewportContext must be used within a ViewportProvider");
|
|
57
|
+
return n;
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
E as ViewportProvider,
|
|
61
|
+
B as useViewportContext
|
|
62
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as u, useContext as i, useState as s } from "react";
|
|
3
|
+
const t = u({
|
|
4
|
+
columnCount: 1,
|
|
5
|
+
setColumnCount: () => {
|
|
6
|
+
}
|
|
7
|
+
}), m = () => i(t), c = ({ children: o }) => {
|
|
8
|
+
const [r, e] = s(1);
|
|
9
|
+
return /* @__PURE__ */ n(t.Provider, { value: { columnCount: r, setColumnCount: e }, children: o });
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
t as VirtualGridContext,
|
|
13
|
+
c as VirtualGridProvider,
|
|
14
|
+
m as useVirtualGridContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as g, useContext as R, useState as e } from "react";
|
|
3
|
+
const l = g({
|
|
4
|
+
getVirtualScrollRef: () => {
|
|
5
|
+
},
|
|
6
|
+
getPageScrollElementRef: () => {
|
|
7
|
+
},
|
|
8
|
+
getVirtualScrollableElementRef: () => {
|
|
9
|
+
},
|
|
10
|
+
scrollPosition: {
|
|
11
|
+
scrollTop: 0,
|
|
12
|
+
scrollLeft: 0
|
|
13
|
+
},
|
|
14
|
+
setScrollPosition: () => {
|
|
15
|
+
},
|
|
16
|
+
totalInnerDimensions: {
|
|
17
|
+
height: 0,
|
|
18
|
+
width: 0
|
|
19
|
+
},
|
|
20
|
+
setTotalInnerDimensions: () => {
|
|
21
|
+
}
|
|
22
|
+
}), E = () => R(l), h = ({ children: t }) => {
|
|
23
|
+
const [o, r] = e(), [n, s] = e(), [i, c] = e(), [a, S] = e({
|
|
24
|
+
scrollTop: 0,
|
|
25
|
+
scrollLeft: 0
|
|
26
|
+
}), [u, f] = e({
|
|
27
|
+
height: 0,
|
|
28
|
+
width: 0
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ m(
|
|
31
|
+
l.Provider,
|
|
32
|
+
{
|
|
33
|
+
value: {
|
|
34
|
+
virtualScrollRef: o,
|
|
35
|
+
getVirtualScrollRef: r,
|
|
36
|
+
pageScrollElementRef: i,
|
|
37
|
+
getPageScrollElementRef: c,
|
|
38
|
+
virtualScrollableElementRef: n,
|
|
39
|
+
getVirtualScrollableElementRef: s,
|
|
40
|
+
scrollPosition: a,
|
|
41
|
+
setScrollPosition: S,
|
|
42
|
+
totalInnerDimensions: u,
|
|
43
|
+
setTotalInnerDimensions: f
|
|
44
|
+
},
|
|
45
|
+
children: t
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
l as VirtualScrollContext,
|
|
51
|
+
h as VirtualScrollProvider,
|
|
52
|
+
E as useVirtualScrollContext
|
|
53
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as P, useContext as d, useState as v, useMemo as s, useEffect as y } from "react";
|
|
3
|
+
import { ZoomLevel as S } from "../utils/types.js";
|
|
4
|
+
import { appConsole as b } from "../utils/appConsole.js";
|
|
5
|
+
import { useInitialStateContext as A } from "./InitialStateContext.js";
|
|
6
|
+
import { useDocumentContext as D } from "./RPDocumentContext.js";
|
|
7
|
+
import { PAGE_PADDING as f } from "../utils/constants.js";
|
|
8
|
+
import { getZoomLevel as E } from "../utils/getZoomLevel.js";
|
|
9
|
+
import { useLayoutContainer as G } from "./LayoutContainerContext.js";
|
|
10
|
+
const g = P({
|
|
11
|
+
zoomLevel: 100,
|
|
12
|
+
currentZoom: 1,
|
|
13
|
+
setZoomLevel: () => {
|
|
14
|
+
}
|
|
15
|
+
}), M = () => {
|
|
16
|
+
const e = d(g);
|
|
17
|
+
return typeof e.currentZoom != "number" && b.warn("Please use this hooks inside children component of RPController or RPLayout"), e;
|
|
18
|
+
}, N = ({ children: e }) => {
|
|
19
|
+
const {
|
|
20
|
+
initialScale: r = S.PAGE_FIT,
|
|
21
|
+
initialPage: c = 1,
|
|
22
|
+
initialRotate: u = 0
|
|
23
|
+
} = A(), [n, a] = v(typeof r == "number" ? r : 100), { pages: l } = D(), { contentRef: o } = G(), p = s(() => n / 100, [n]), t = s(() => {
|
|
24
|
+
var m;
|
|
25
|
+
return (m = l.get(c)) == null ? void 0 : m.page.getViewport({ scale: 1, rotation: u });
|
|
26
|
+
}, [l, c, u]), i = s(() => {
|
|
27
|
+
if (!t)
|
|
28
|
+
return 0;
|
|
29
|
+
const m = ((t == null ? void 0 : t.width) || 0) + 2 * f, x = ((t == null ? void 0 : t.height) || 0) + 2 * f, Z = (o == null ? void 0 : o.clientWidth) || 0, C = (o == null ? void 0 : o.clientHeight) || 0;
|
|
30
|
+
return E(r, Z, C, m, x);
|
|
31
|
+
}, [t, r, o]);
|
|
32
|
+
y(() => {
|
|
33
|
+
typeof i == "number" && i && a(i);
|
|
34
|
+
}, [i]);
|
|
35
|
+
const h = s(() => ({
|
|
36
|
+
zoomLevel: n,
|
|
37
|
+
currentZoom: p,
|
|
38
|
+
setZoomLevel: a
|
|
39
|
+
}), [p, n]);
|
|
40
|
+
return /* @__PURE__ */ L(g.Provider, { value: h, children: e });
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
g as ZoomContext,
|
|
44
|
+
N as ZoomProvider,
|
|
45
|
+
M as useZoomContext
|
|
46
|
+
};
|