@anaralabs/lector 3.8.0 → 3.9.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 CHANGED
@@ -102,6 +102,8 @@ We welcome contributions! Key areas we're focusing on:
102
102
  3. Mobile/touch interactions
103
103
  4. Documentation and examples
104
104
 
105
+
106
+
105
107
  ## Thanks
106
108
 
107
109
  Special thanks to these open-source projects that provided inspiration:
package/dist/index.js CHANGED
@@ -1076,14 +1076,14 @@ var AnnotationLayer2 = ({
1076
1076
  };
1077
1077
  var useDpr = () => {
1078
1078
  const [dpr, setDPR] = useState(
1079
- !window ? 1 : Math.min(window.devicePixelRatio, 2)
1079
+ typeof window === "undefined" ? 1 : Math.min(window.devicePixelRatio, 2)
1080
1080
  );
1081
1081
  useEffect(() => {
1082
- if (!window) {
1082
+ if (typeof window === "undefined") {
1083
1083
  return;
1084
1084
  }
1085
1085
  const handleDPRChange = () => {
1086
- setDPR(window.devicePixelRatio);
1086
+ setDPR(Math.min(window.devicePixelRatio, 2));
1087
1087
  };
1088
1088
  const windowMatch = window.matchMedia(
1089
1089
  `screen and (min-resolution: ${dpr}dppx)`
@@ -2530,8 +2530,9 @@ var Page = ({
2530
2530
  ...props
2531
2531
  }) => {
2532
2532
  const pdfPageProxy = usePdf((state) => state.getPdfPageProxy(pageNumber));
2533
- const width = (pdfPageProxy.view[2] ?? 0) - (pdfPageProxy.view[0] ?? 0);
2534
- const height = (pdfPageProxy.view[3] ?? 0) - (pdfPageProxy.view[1] ?? 0);
2533
+ const viewport = usePdf((state) => state.viewports[pageNumber - 1]);
2534
+ const width = viewport?.width ?? (pdfPageProxy.view[2] ?? 0) - (pdfPageProxy.view[0] ?? 0);
2535
+ const height = viewport?.height ?? (pdfPageProxy.view[3] ?? 0) - (pdfPageProxy.view[1] ?? 0);
2535
2536
  return /* @__PURE__ */ jsx(PDFPageNumberContext.Provider, { value: pdfPageProxy.pageNumber, children: /* @__PURE__ */ jsx(
2536
2537
  Primitive.div,
2537
2538
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anaralabs/lector",
3
- "version": "3.8.0",
3
+ "version": "3.9.1",
4
4
  "description": "Headless PDF viewer for React",
5
5
  "author": "andrewdr (https://github.com/andrewdoro)",
6
6
  "license": "MIT",
@@ -84,7 +84,7 @@
84
84
  "repository": {
85
85
  "type": "git",
86
86
  "url": "git+https://github.com/anaralabs/lector.git",
87
- "directory": "packages/nuqs"
87
+ "directory": "packages/lector"
88
88
  },
89
89
  "bugs": {
90
90
  "url": "https://github.com/anaralabs/lector/issues"