@anaralabs/lector 3.5.14 → 3.6.0

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.
@@ -1,5 +1,4 @@
1
1
  import { ComponentPropsWithoutRef } from 'react';
2
- import { Context } from 'react';
3
2
  import type { DocumentInitParameters } from 'pdfjs-dist/types/src/display/api';
4
3
  import { ForwardRefExoticComponent } from 'react';
5
4
  import { FunctionComponent } from 'react';
@@ -203,6 +202,7 @@ declare type HighlightRect = {
203
202
  height: number;
204
203
  width: number;
205
204
  type?: "pixels" | "percent";
205
+ style?: (rect: HighlightRect) => React_2.CSSProperties;
206
206
  };
207
207
  export { HighlightRect }
208
208
  export { HighlightRect as HighlightRect_alias_1 }
@@ -299,7 +299,7 @@ declare interface PDFState {
299
299
  currentPage: number;
300
300
  setCurrentPage: (pageNumber: number) => void;
301
301
  viewports: Array<PageViewport>;
302
- viewportRef: React.MutableRefObject<HTMLDivElement | null>;
302
+ viewportRef: React_2.MutableRefObject<HTMLDivElement | null>;
303
303
  pageProxies: PDFPageProxy[];
304
304
  textContent: TextContent[];
305
305
  setTextContent: (textContents: TextContent[]) => void;
@@ -318,9 +318,9 @@ declare interface PDFState {
318
318
 
319
319
  export declare const PDFStore: {
320
320
  useContext: () => StoreApi<PDFState>;
321
- Context: Context<StoreApi<PDFState>>;
321
+ Context: React_2.Context<StoreApi<PDFState>>;
322
322
  Provider: (props: {
323
- children?: React.ReactNode;
323
+ children?: React_2.ReactNode;
324
324
  initialValue: InitialPDFState;
325
325
  }) => JSX.Element;
326
326
  };
package/dist/index.js CHANGED
@@ -1880,11 +1880,12 @@ var HighlightLayer = forwardRef(({ asChild, className, style, ...props }, ref) =
1880
1880
  const rects = highlights.filter((area) => area.pageNumber === pageNumber);
1881
1881
  if (!rects?.length) return null;
1882
1882
  return /* @__PURE__ */ jsx(Fragment, { children: rects.map((rect, index) => {
1883
- const { pageNumber: pageNumber2, type, ...coordinates } = rect;
1883
+ const { pageNumber: pageNumber2, type, style: customStyle, ...coordinates } = rect;
1884
1884
  let dimensions = coordinates;
1885
1885
  if (type === "percent") {
1886
1886
  dimensions = convertToPercentString(rect);
1887
1887
  }
1888
+ const customStyles = customStyle ? customStyle(rect) : {};
1888
1889
  return /* @__PURE__ */ jsx(
1889
1890
  Comp,
1890
1891
  {
@@ -1895,7 +1896,8 @@ var HighlightLayer = forwardRef(({ asChild, className, style, ...props }, ref) =
1895
1896
  ...dimensions,
1896
1897
  pointerEvents: "none",
1897
1898
  zIndex: 30,
1898
- ...style
1899
+ ...style,
1900
+ ...customStyles
1899
1901
  },
1900
1902
  ...props,
1901
1903
  children: props.children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anaralabs/lector",
3
- "version": "3.5.14",
3
+ "version": "3.6.0",
4
4
  "description": "Headless PDF viewer for React",
5
5
  "author": "andrewdr (https://github.com/andrewdoro)",
6
6
  "license": "MIT",