@bitux/review-layer-react 0.1.2 → 0.1.4
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/CommentModal.d.ts +2 -1
- package/dist/CommentPin.d.ts +5 -1
- package/dist/ElementHighlight.d.ts +7 -1
- package/dist/Overlay.d.ts +2 -1
- package/dist/review-layer-react.js +1490 -1010
- package/dist/review-layer-react.js.map +1 -1
- package/dist/review-layer-react.umd.cjs +347 -10
- package/dist/review-layer-react.umd.cjs.map +1 -1
- package/dist/utils/api.d.ts +7 -0
- package/dist/utils/positioning.d.ts +19 -2
- package/package.json +1 -1
package/dist/utils/api.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ export interface Reviewer {
|
|
|
2
2
|
id: number;
|
|
3
3
|
name: string;
|
|
4
4
|
email?: string;
|
|
5
|
+
/** URL de avatar (p. ej. Supabase Storage). Opcional; si no hay, se muestran iniciales. */
|
|
6
|
+
image_url?: string | null;
|
|
7
|
+
job_title?: string | null;
|
|
5
8
|
}
|
|
6
9
|
export interface Comment {
|
|
7
10
|
id: number;
|
|
@@ -9,8 +12,12 @@ export interface Comment {
|
|
|
9
12
|
selector: string | null;
|
|
10
13
|
x: number | null;
|
|
11
14
|
y: number | null;
|
|
15
|
+
/** Frontend camelCase */
|
|
12
16
|
relativeX?: number | null;
|
|
13
17
|
relativeY?: number | null;
|
|
18
|
+
/** API snake_case (Laravel devuelve así) */
|
|
19
|
+
relative_x?: number | null;
|
|
20
|
+
relative_y?: number | null;
|
|
14
21
|
width: number | null;
|
|
15
22
|
height: number | null;
|
|
16
23
|
url: string | null;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { Comment } from './api';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Recorta la posición al viewport con un margen de radio (mitad del círculo)
|
|
5
|
+
* para que el pin no se corte en esquinas. Si hay varios, los offsets se aplican sobre esto.
|
|
6
|
+
*/
|
|
7
|
+
export declare function clampPinToViewport(x: number, y: number, radius?: number): {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* Get the element's bounding rect if it exists in the DOM.
|
|
13
|
+
* No devuelve posición si el elemento es parte del UI del review layer (pins, popover, iconos).
|
|
5
14
|
*/
|
|
6
15
|
export declare function getElementPosition(selector: string | null): DOMRect | null;
|
|
7
16
|
/**
|
|
@@ -13,14 +22,22 @@ export declare function getRelativePosition(rect: DOMRect): {
|
|
|
13
22
|
};
|
|
14
23
|
/**
|
|
15
24
|
* Fallback position when selector does not find an element.
|
|
16
|
-
* Priority: relative coordinates (relativeX, relativeY) then absolute (x, y).
|
|
25
|
+
* Priority: relative coordinates (relativeX/relative_x, relativeY/relative_y) then absolute (x, y).
|
|
26
|
+
* Acepta snake_case (API) y camelCase (frontend).
|
|
17
27
|
*/
|
|
18
28
|
export declare function getFallbackPosition(comment: Comment): {
|
|
19
29
|
x: number;
|
|
20
30
|
y: number;
|
|
21
31
|
};
|
|
22
32
|
/**
|
|
23
|
-
*
|
|
33
|
+
* Rectángulo de respaldo para el highlight cuando el selector no encuentra el elemento
|
|
34
|
+
* (p. ej. DOM cambiado, SPA). Usa coordenadas guardadas del comentario.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getFallbackRect(comment: Comment): DOMRect | null;
|
|
37
|
+
/**
|
|
38
|
+
* Pin position: prioriza coordenadas guardadas (relative_x/y o x/y) para que cada pin
|
|
39
|
+
* quede donde se creó. Si no hay coords guardadas, usa el selector.
|
|
40
|
+
* Así evitamos que dos comentarios con selector ambiguo compartan la misma posición.
|
|
24
41
|
*/
|
|
25
42
|
export declare function getCommentPinPosition(comment: Comment): {
|
|
26
43
|
x: number;
|