@anaralabs/lector 3.5.7 → 3.5.8
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/dist/_tsup-dts-rollup.d.ts +9 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -8
- package/package.json +1 -1
|
@@ -46,10 +46,7 @@ export declare const AnnotationHighlightLayer: ({ className, style, renderToolti
|
|
|
46
46
|
declare interface AnnotationHighlightLayerProps {
|
|
47
47
|
className?: string;
|
|
48
48
|
style?: React.CSSProperties;
|
|
49
|
-
renderTooltipContent: (props:
|
|
50
|
-
annotation: Annotation;
|
|
51
|
-
onClose: () => void;
|
|
52
|
-
}) => React.ReactNode;
|
|
49
|
+
renderTooltipContent: (props: AnnotationTooltipContentProps) => React.ReactNode;
|
|
53
50
|
renderHoverTooltipContent: (props: {
|
|
54
51
|
annotation: Annotation;
|
|
55
52
|
onClose: () => void;
|
|
@@ -100,12 +97,18 @@ declare interface AnnotationState {
|
|
|
100
97
|
setAnnotations: (annotations: Annotation[]) => void;
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
export declare const AnnotationTooltip: ({ annotation, children,
|
|
100
|
+
export declare const AnnotationTooltip: ({ annotation, children, renderTooltipContent, hoverTooltipContent, onOpenChange, className, hoverClassName, isOpen: controlledIsOpen, tooltipBubbleSize, hoverIsOpen: controlledHoverIsOpen, }: AnnotationTooltipProps) => JSX.Element;
|
|
101
|
+
|
|
102
|
+
export declare type AnnotationTooltipContentProps = {
|
|
103
|
+
annotation: Annotation;
|
|
104
|
+
onClose: () => void;
|
|
105
|
+
setPosition?: (position: 'top' | 'bottom' | undefined) => void;
|
|
106
|
+
};
|
|
104
107
|
|
|
105
108
|
declare interface AnnotationTooltipProps {
|
|
106
109
|
annotation: Annotation;
|
|
107
110
|
children: React.ReactNode;
|
|
108
|
-
|
|
111
|
+
renderTooltipContent: (props: AnnotationTooltipContentProps) => React.ReactNode;
|
|
109
112
|
hoverTooltipContent?: React.ReactNode;
|
|
110
113
|
onOpenChange?: (open: boolean) => void;
|
|
111
114
|
isOpen?: boolean;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { createContext, forwardRef, useRef, useCallback, useContext,
|
|
3
|
+
import React, { createContext, forwardRef, useRef, useState, useCallback, useContext, useEffect, cloneElement, createRef, useLayoutEffect } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { useFloating, autoUpdate, offset, shift, useDismiss, useInteractions, inline, flip } from '@floating-ui/react';
|
|
6
6
|
import { useVirtualizer, elementScroll, debounce } from '@tanstack/react-virtual';
|
|
@@ -270,7 +270,7 @@ var useAnnotationTooltip = ({
|
|
|
270
270
|
var AnnotationTooltip = ({
|
|
271
271
|
annotation,
|
|
272
272
|
children,
|
|
273
|
-
|
|
273
|
+
renderTooltipContent,
|
|
274
274
|
hoverTooltipContent,
|
|
275
275
|
onOpenChange,
|
|
276
276
|
className,
|
|
@@ -282,6 +282,7 @@ var AnnotationTooltip = ({
|
|
|
282
282
|
const viewportRef = usePdf((state) => state.viewportRef);
|
|
283
283
|
const closeTimeoutRef = useRef(null);
|
|
284
284
|
const isMouseInTooltipRef = useRef(false);
|
|
285
|
+
const [triggeredPosition, setTriggeredPosition] = useState();
|
|
285
286
|
const {
|
|
286
287
|
isOpen: uncontrolledIsOpen,
|
|
287
288
|
setIsOpen,
|
|
@@ -292,6 +293,7 @@ var AnnotationTooltip = ({
|
|
|
292
293
|
} = useAnnotationTooltip({
|
|
293
294
|
annotation,
|
|
294
295
|
onOpenChange,
|
|
296
|
+
position: triggeredPosition,
|
|
295
297
|
isOpen: controlledIsOpen
|
|
296
298
|
});
|
|
297
299
|
const {
|
|
@@ -383,7 +385,11 @@ var AnnotationTooltip = ({
|
|
|
383
385
|
zIndex: 50
|
|
384
386
|
},
|
|
385
387
|
...getFloatingProps(),
|
|
386
|
-
children:
|
|
388
|
+
children: renderTooltipContent({
|
|
389
|
+
annotation,
|
|
390
|
+
onClose: () => setIsOpen(false),
|
|
391
|
+
setPosition: (position) => setTriggeredPosition(position)
|
|
392
|
+
})
|
|
387
393
|
}
|
|
388
394
|
),
|
|
389
395
|
viewportRef.current
|
|
@@ -468,11 +474,7 @@ var AnnotationHighlightLayer = ({
|
|
|
468
474
|
onAnnotationClick(annotation);
|
|
469
475
|
}
|
|
470
476
|
},
|
|
471
|
-
|
|
472
|
-
annotation,
|
|
473
|
-
onClose: () => {
|
|
474
|
-
}
|
|
475
|
-
}),
|
|
477
|
+
renderTooltipContent,
|
|
476
478
|
hoverTooltipContent: renderHoverTooltipContent({
|
|
477
479
|
annotation,
|
|
478
480
|
onClose: () => {
|