@anaralabs/lector 3.5.4 → 3.5.5
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 +7 -3
- package/dist/index.js +13 -8
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ declare interface Annotation {
|
|
|
40
40
|
export { Annotation }
|
|
41
41
|
export { Annotation as Annotation_alias_1 }
|
|
42
42
|
|
|
43
|
-
export declare const AnnotationHighlightLayer: ({ className, style, renderTooltipContent, renderHoverTooltipContent, tooltipClassName, focusedAnnotationId, onAnnotationClick, hoverTooltipClassName }: AnnotationHighlightLayerProps) => JSX.Element;
|
|
43
|
+
export declare const AnnotationHighlightLayer: ({ className, style, renderTooltipContent, renderHoverTooltipContent, tooltipClassName, highlightClassName, focusedAnnotationId, focusedHoverAnnotationId, onAnnotationClick, hoverTooltipClassName }: AnnotationHighlightLayerProps) => JSX.Element;
|
|
44
44
|
|
|
45
45
|
declare interface AnnotationHighlightLayerProps {
|
|
46
46
|
className?: string;
|
|
@@ -54,9 +54,11 @@ declare interface AnnotationHighlightLayerProps {
|
|
|
54
54
|
onClose: () => void;
|
|
55
55
|
}) => React.ReactNode;
|
|
56
56
|
focusedAnnotationId?: string;
|
|
57
|
+
focusedHoverAnnotationId?: string;
|
|
57
58
|
onAnnotationClick?: (annotation: Annotation) => void;
|
|
58
59
|
tooltipClassName?: string;
|
|
59
60
|
hoverTooltipClassName?: string;
|
|
61
|
+
highlightClassName?: string;
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
/**
|
|
@@ -96,7 +98,7 @@ declare interface AnnotationState {
|
|
|
96
98
|
setAnnotations: (annotations: Annotation[]) => void;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
export declare const AnnotationTooltip: ({ annotation, children, tooltipContent, hoverTooltipContent, onOpenChange, className, hoverClassName, isOpen: controlledIsOpen, }: AnnotationTooltipProps) => JSX.Element;
|
|
101
|
+
export declare const AnnotationTooltip: ({ annotation, children, tooltipContent, hoverTooltipContent, onOpenChange, className, hoverClassName, isOpen: controlledIsOpen, hoverIsOpen: controlledHoverIsOpen, }: AnnotationTooltipProps) => JSX.Element;
|
|
100
102
|
|
|
101
103
|
declare interface AnnotationTooltipProps {
|
|
102
104
|
annotation: Annotation;
|
|
@@ -107,6 +109,7 @@ declare interface AnnotationTooltipProps {
|
|
|
107
109
|
isOpen?: boolean;
|
|
108
110
|
className?: string;
|
|
109
111
|
hoverClassName?: string;
|
|
112
|
+
hoverIsOpen?: boolean;
|
|
110
113
|
renderHoverTooltipContent?: (props: {
|
|
111
114
|
annotation: Annotation;
|
|
112
115
|
onClose: () => void;
|
|
@@ -378,11 +381,12 @@ declare const useAnnotations: UseBoundStore<StoreApi<AnnotationState>>;
|
|
|
378
381
|
export { useAnnotations }
|
|
379
382
|
export { useAnnotations as useAnnotations_alias_1 }
|
|
380
383
|
|
|
381
|
-
export declare const useAnnotationTooltip: ({ annotation, onOpenChange, }: UseAnnotationTooltipProps) => UseAnnotationTooltipReturn;
|
|
384
|
+
export declare const useAnnotationTooltip: ({ annotation, onOpenChange, position, }: UseAnnotationTooltipProps) => UseAnnotationTooltipReturn;
|
|
382
385
|
|
|
383
386
|
declare interface UseAnnotationTooltipProps {
|
|
384
387
|
annotation: Annotation;
|
|
385
388
|
onOpenChange?: (open: boolean) => void;
|
|
389
|
+
position?: "top" | "bottom" | "left" | "right";
|
|
386
390
|
}
|
|
387
391
|
|
|
388
392
|
declare interface UseAnnotationTooltipReturn {
|
package/dist/index.js
CHANGED
|
@@ -146,7 +146,8 @@ var defaultRect = {
|
|
|
146
146
|
};
|
|
147
147
|
var useAnnotationTooltip = ({
|
|
148
148
|
annotation,
|
|
149
|
-
onOpenChange
|
|
149
|
+
onOpenChange,
|
|
150
|
+
position = "top"
|
|
150
151
|
}) => {
|
|
151
152
|
const isNewAnnotation = Date.now() - new Date(annotation.createdAt).getTime() < 1e3;
|
|
152
153
|
const [isOpen, setIsOpen] = useState(isNewAnnotation);
|
|
@@ -157,7 +158,7 @@ var useAnnotationTooltip = ({
|
|
|
157
158
|
floatingStyles,
|
|
158
159
|
context
|
|
159
160
|
} = useFloating({
|
|
160
|
-
placement:
|
|
161
|
+
placement: position,
|
|
161
162
|
open: isOpen,
|
|
162
163
|
onOpenChange: (open) => {
|
|
163
164
|
setIsOpen(open);
|
|
@@ -265,7 +266,8 @@ var AnnotationTooltip = ({
|
|
|
265
266
|
onOpenChange,
|
|
266
267
|
className,
|
|
267
268
|
hoverClassName,
|
|
268
|
-
isOpen: controlledIsOpen
|
|
269
|
+
isOpen: controlledIsOpen,
|
|
270
|
+
hoverIsOpen: controlledHoverIsOpen
|
|
269
271
|
}) => {
|
|
270
272
|
const viewportRef = usePdf((state) => state.viewportRef);
|
|
271
273
|
const closeTimeoutRef = useRef(null);
|
|
@@ -282,16 +284,18 @@ var AnnotationTooltip = ({
|
|
|
282
284
|
onOpenChange
|
|
283
285
|
});
|
|
284
286
|
const {
|
|
285
|
-
isOpen:
|
|
287
|
+
isOpen: uncontrolledHoverIsOpen,
|
|
286
288
|
setIsOpen: setHoverIsOpen,
|
|
287
289
|
refs: hoverRefs,
|
|
288
290
|
floatingStyles: hoverFloatingStyles,
|
|
289
291
|
getFloatingProps: getHoverFloatingProps,
|
|
290
292
|
getReferenceProps: getHoverReferenceProps
|
|
291
293
|
} = useAnnotationTooltip({
|
|
294
|
+
position: "bottom",
|
|
292
295
|
annotation
|
|
293
296
|
});
|
|
294
297
|
const isOpen = controlledIsOpen ?? uncontrolledIsOpen;
|
|
298
|
+
const hoverIsOpen = controlledHoverIsOpen || uncontrolledHoverIsOpen;
|
|
295
299
|
const handleClick = useCallback(() => {
|
|
296
300
|
if (controlledIsOpen === void 0) {
|
|
297
301
|
setIsOpen(!isOpen);
|
|
@@ -415,7 +419,9 @@ var AnnotationHighlightLayer = ({
|
|
|
415
419
|
renderTooltipContent,
|
|
416
420
|
renderHoverTooltipContent,
|
|
417
421
|
tooltipClassName,
|
|
422
|
+
highlightClassName,
|
|
418
423
|
focusedAnnotationId,
|
|
424
|
+
focusedHoverAnnotationId,
|
|
419
425
|
onAnnotationClick,
|
|
420
426
|
hoverTooltipClassName
|
|
421
427
|
}) => {
|
|
@@ -431,6 +437,7 @@ var AnnotationHighlightLayer = ({
|
|
|
431
437
|
className: tooltipClassName,
|
|
432
438
|
hoverClassName: hoverTooltipClassName,
|
|
433
439
|
isOpen: focusedAnnotationId === annotation.id,
|
|
440
|
+
hoverIsOpen: focusedHoverAnnotationId === annotation.id,
|
|
434
441
|
onOpenChange: (open) => {
|
|
435
442
|
if (open && onAnnotationClick) {
|
|
436
443
|
onAnnotationClick(annotation);
|
|
@@ -454,16 +461,14 @@ var AnnotationHighlightLayer = ({
|
|
|
454
461
|
children: annotation.highlights.map((highlight, index) => /* @__PURE__ */ jsx(
|
|
455
462
|
"div",
|
|
456
463
|
{
|
|
464
|
+
className: highlightClassName,
|
|
457
465
|
style: {
|
|
458
466
|
position: "absolute",
|
|
459
467
|
top: highlight.top,
|
|
460
468
|
left: highlight.left,
|
|
461
469
|
width: highlight.width,
|
|
462
470
|
height: highlight.height,
|
|
463
|
-
backgroundColor: annotation.color
|
|
464
|
-
mixBlendMode: "multiply",
|
|
465
|
-
transition: "all 0.2s ease",
|
|
466
|
-
cursor: "pointer"
|
|
471
|
+
backgroundColor: annotation.color
|
|
467
472
|
},
|
|
468
473
|
"data-highlight-id": annotation.id
|
|
469
474
|
},
|