@annotorious/react 3.0.1 → 3.0.3
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/ImageAnnotationPopup.d.ts +2 -2
- package/dist/ImageAnnotationPopup.d.ts.map +1 -1
- package/dist/PopupProps.d.ts +10 -0
- package/dist/PopupProps.d.ts.map +1 -0
- package/dist/annotorious-react.es.js.map +1 -1
- package/dist/annotorious-react.es4.js +66 -60
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es9.js +63 -61
- package/dist/annotorious-react.es9.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotationPopup.d.ts +2 -2
- package/dist/openseadragon/OpenSeadragonAnnotationPopup.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/AnnotoriousPopupProps.d.ts +0 -10
- package/dist/AnnotoriousPopupProps.d.ts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PopupProps } from './PopupProps';
|
|
3
3
|
interface ImageAnnotationPopupProps {
|
|
4
4
|
arrow?: boolean;
|
|
5
|
-
popup: (props:
|
|
5
|
+
popup: (props: PopupProps) => ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const ImageAnnotationPopup: (props: ImageAnnotationPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageAnnotationPopup.d.ts","sourceRoot":"","sources":["../src/ImageAnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAc/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ImageAnnotationPopup.d.ts","sourceRoot":"","sources":["../src/ImageAnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAc/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsB1C,UAAU,yBAAyB;IAEjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,SAAS,CAAC;CAEzC;AAED,eAAO,MAAM,oBAAoB,UAAW,yBAAyB,4CA+GpE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Annotation, AnnotationBody, ImageAnnotation } from '@annotorious/annotorious';
|
|
2
|
+
export interface PopupProps<T extends Annotation = ImageAnnotation> {
|
|
3
|
+
annotation: T;
|
|
4
|
+
editable?: boolean;
|
|
5
|
+
event?: PointerEvent;
|
|
6
|
+
onCreateBody(body: AnnotationBody): void;
|
|
7
|
+
onDeleteBody(id: string): void;
|
|
8
|
+
onUpdateBody(current: AnnotationBody, next: AnnotationBody): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=PopupProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopupProps.d.ts","sourceRoot":"","sources":["../src/PopupProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEvF,MAAM,WAAW,UAAU,CAAE,CAAC,SAAS,UAAU,GAAG,eAAe;IAEjE,UAAU,EAAE,CAAC,CAAC;IAEd,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAEzC,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;CAEnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es.js","sources":["../src/index.ts"],"sourcesContent":["export * from './Annotorious';\nexport * from './AnnotoriousPlugin';\nexport * from './
|
|
1
|
+
{"version":3,"file":"annotorious-react.es.js","sources":["../src/index.ts"],"sourcesContent":["export * from './Annotorious';\nexport * from './AnnotoriousPlugin';\nexport * from './ImageAnnotationPopup';\nexport * from './ImageAnnotator';\nexport * from './PopupProps';\n\nexport * from './openseadragon';\n\n// This ensures the Annotorious stylesheet gets packaged into annotorious-react\nimport '@annotorious/annotorious/annotorious.css';\nimport '@annotorious/openseadragon/annotorious-openseadragon.css';\n\n// Essential re-exports from @annotorious/core\nexport type {\n Annotation,\n AnnotationBody,\n AnnotationState,\n AnnotationTarget,\n Annotator,\n AnnotatorState,\n Appearance,\n AppearanceProvider,\n Color,\n DrawingStyle,\n DrawingStyleExpression,\n Filter,\n FormatAdapter,\n HoverState,\n LifecycleEvents,\n ParseResult,\n PresentUser,\n Selection,\n SelectionState,\n Store,\n StoreChangeEvent,\n StoreObserver,\n User,\n W3CAnnotation,\n W3CAnnotationBody,\n W3CAnnotationTarget\n} from '@annotorious/core';\n\nimport {\n createAnonymousGuest as _createAnonymousGuest, \n createBody as _createBody,\n defaultColorProvider as _defaultColorProvider,\n Origin as _Origin,\n UserSelectAction as _UserSelectAction\n} from '@annotorious/core';\n\nexport { _createAnonymousGuest as createAnonymousGuest };\nexport { _createBody as createBody };\nexport { _defaultColorProvider as defaultColorProvider };\nexport { _Origin as Origin };\nexport { _UserSelectAction as UserSelectAction };\n\n// Essential re-exports from @annotorious/annotorious \nexport type {\n AnnotoriousOpts,\n DrawingMode,\n DrawingTool,\n FragmentSelector,\n ImageAnnotator as AnnotoriousImageAnnotator,\n ImageAnnotation,\n ImageAnnotatorState,\n Polygon,\n PolygonGeometry,\n Rectangle,\n RectangleGeometry,\n Shape,\n SVGSelector,\n W3CImageAnnotation,\n W3CImageAnnotationTarget,\n W3CImageFormatAdapter, \n W3CImageFormatAdapterOpts\n} from '@annotorious/annotorious';\n\nimport { \n createImageAnnotator as _createImageAnnotator,\n ShapeType as _ShapeType,\n W3CImageFormat as _W3CImageFormat\n} from '@annotorious/annotorious';\n\nexport const createImageAnnotator = _createImageAnnotator;\nexport const ShapeType = _ShapeType;\nexport const W3CImageFormat = _W3CImageFormat;\n\n// Essential re-exports from @annotorious/openseadragon \nexport type {\n OpenSeadragonAnnotator as AnnotoriousOpenSeadragonAnnotator\n} from '@annotorious/openseadragon';\n\nexport type { Viewer } from 'openseadragon';\n"],"names":["createImageAnnotator","_createImageAnnotator","ShapeType","_ShapeType","W3CImageFormat","_W3CImageFormat"],"mappings":";;;;;;;;;;;AAmFO,MAAMA,IAAuBC,GACvBC,IAAYC,GACZC,IAAiBC;"}
|
|
@@ -1,97 +1,103 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useFloating as
|
|
4
|
-
import { useAnnotator as
|
|
5
|
-
import { toClientRects as
|
|
6
|
-
import { inline as
|
|
7
|
-
import { autoUpdate as
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
const { minX:
|
|
1
|
+
import { j as g } from "./annotorious-react.es11.js";
|
|
2
|
+
import { useState as E, useRef as C, useEffect as A } from "react";
|
|
3
|
+
import { useFloating as D, FloatingArrow as O } from "./annotorious-react.es13.js";
|
|
4
|
+
import { useAnnotator as j, useSelection as L } from "./annotorious-react.es2.js";
|
|
5
|
+
import { toClientRects as S } from "./annotorious-react.es14.js";
|
|
6
|
+
import { inline as U, offset as F, flip as M, shift as b, arrow as k } from "./annotorious-react.es15.js";
|
|
7
|
+
import { autoUpdate as z } from "./annotorious-react.es16.js";
|
|
8
|
+
import w from "./annotorious-react.es17.js";
|
|
9
|
+
const H = (a, t) => {
|
|
10
|
+
const n = t.querySelector("img"), { left: i, top: d } = n.getBoundingClientRect(), s = n.offsetWidth / n.naturalWidth, c = n.offsetHeight / n.naturalHeight, { minX: o, minY: l, maxX: p, maxY: m } = a.bounds;
|
|
11
11
|
return new DOMRect(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
i + s * o,
|
|
13
|
+
d + c * l,
|
|
14
|
+
s * (p - o),
|
|
15
|
+
c * (m - l)
|
|
16
16
|
);
|
|
17
|
-
},
|
|
18
|
-
var
|
|
19
|
-
const t =
|
|
20
|
-
open:
|
|
21
|
-
onOpenChange:
|
|
17
|
+
}, K = (a) => {
|
|
18
|
+
var u, f;
|
|
19
|
+
const t = j(), [n, i] = E(!1), d = C(null), { selected: s, event: c } = L(), o = (u = s[0]) == null ? void 0 : u.annotation, l = (f = s[0]) == null ? void 0 : f.editable, { refs: p, floatingStyles: m, context: h, update: I } = D({
|
|
20
|
+
open: n,
|
|
21
|
+
onOpenChange: i,
|
|
22
22
|
middleware: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
U(),
|
|
24
|
+
F(10),
|
|
25
|
+
M({ crossAxis: !0 }),
|
|
26
26
|
b({
|
|
27
27
|
crossAxis: !0,
|
|
28
28
|
padding: { right: 5, left: 5, top: 10, bottom: 10 }
|
|
29
29
|
}),
|
|
30
|
-
|
|
31
|
-
element:
|
|
30
|
+
k({
|
|
31
|
+
element: d,
|
|
32
32
|
padding: 5
|
|
33
33
|
})
|
|
34
34
|
],
|
|
35
|
-
whileElementsMounted:
|
|
35
|
+
whileElementsMounted: z
|
|
36
36
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
A(() => {
|
|
38
|
+
if (s.length === 0)
|
|
39
|
+
i(!1);
|
|
40
|
+
else {
|
|
41
|
+
const e = () => {
|
|
42
|
+
const r = H(o.target.selector.geometry, t.element);
|
|
43
|
+
p.setReference({
|
|
44
|
+
getBoundingClientRect: () => r,
|
|
45
|
+
getClientRects: () => S(r)
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), e(), i(!0), () => {
|
|
49
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}, [t, a.popup, s]);
|
|
53
|
+
const x = (e) => {
|
|
54
|
+
const r = e.id || w();
|
|
48
55
|
t.state.store.addBody({
|
|
49
56
|
...e,
|
|
50
|
-
id:
|
|
51
|
-
annotation:
|
|
57
|
+
id: r,
|
|
58
|
+
annotation: o.id,
|
|
52
59
|
created: e.created || /* @__PURE__ */ new Date(),
|
|
53
60
|
creator: t.getUser()
|
|
54
61
|
});
|
|
55
62
|
}, y = (e) => {
|
|
56
|
-
t.state.store.deleteBody({ id: e, annotation:
|
|
57
|
-
},
|
|
58
|
-
const
|
|
63
|
+
t.state.store.deleteBody({ id: e, annotation: o.id });
|
|
64
|
+
}, R = (e, r) => {
|
|
65
|
+
const v = r.id || w(), B = {
|
|
59
66
|
updated: /* @__PURE__ */ new Date(),
|
|
60
67
|
updatedBy: t.getUser(),
|
|
61
|
-
...
|
|
62
|
-
id:
|
|
63
|
-
annotation:
|
|
68
|
+
...r,
|
|
69
|
+
id: v,
|
|
70
|
+
annotation: o.id
|
|
64
71
|
};
|
|
65
|
-
t.state.store.updateBody(e,
|
|
72
|
+
t.state.store.updateBody(e, B);
|
|
66
73
|
};
|
|
67
|
-
return
|
|
74
|
+
return n && o && /* @__PURE__ */ g.jsxs(
|
|
68
75
|
"div",
|
|
69
76
|
{
|
|
70
77
|
className: "a9s-popup a9s-image-popup",
|
|
71
|
-
ref:
|
|
72
|
-
style:
|
|
78
|
+
ref: p.setFloating,
|
|
79
|
+
style: m,
|
|
73
80
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
81
|
+
/* @__PURE__ */ g.jsx(
|
|
82
|
+
O,
|
|
76
83
|
{
|
|
77
|
-
ref:
|
|
78
|
-
context:
|
|
79
|
-
fill: "currentColor"
|
|
84
|
+
ref: d,
|
|
85
|
+
context: h
|
|
80
86
|
}
|
|
81
87
|
),
|
|
82
|
-
|
|
83
|
-
annotation:
|
|
84
|
-
editable:
|
|
85
|
-
event:
|
|
86
|
-
onCreateBody:
|
|
88
|
+
a.popup({
|
|
89
|
+
annotation: o,
|
|
90
|
+
editable: l,
|
|
91
|
+
event: c,
|
|
92
|
+
onCreateBody: x,
|
|
87
93
|
onDeleteBody: y,
|
|
88
|
-
onUpdateBody:
|
|
94
|
+
onUpdateBody: R
|
|
89
95
|
})
|
|
90
96
|
]
|
|
91
97
|
}
|
|
92
98
|
);
|
|
93
99
|
};
|
|
94
100
|
export {
|
|
95
|
-
|
|
101
|
+
K as ImageAnnotationPopup
|
|
96
102
|
};
|
|
97
103
|
//# sourceMappingURL=annotorious-react.es4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es4.js","sources":["../src/ImageAnnotationPopup.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { AnnotationBody,
|
|
1
|
+
{"version":3,"file":"annotorious-react.es4.js","sources":["../src/ImageAnnotationPopup.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { AnnotationBody, Geometry } from '@annotorious/annotorious';\nimport {\n useFloating,\n arrow,\n shift,\n inline,\n autoUpdate,\n flip,\n offset,\n FloatingArrow\n} from '@floating-ui/react';\nimport { useAnnotator, useSelection } from './Annotorious';\nimport { PopupProps } from './PopupProps';\nimport { toClientRects } from './utils/toClientRects';\nimport { AnnotoriousImageAnnotator } from '@annotorious/openseadragon';\n\nconst toDOMRect = (geometry: Geometry, container: HTMLDivElement) => {\n const img = container.querySelector('img');\n\n const { left, top } = img.getBoundingClientRect();\n\n const kx = img.offsetWidth / img.naturalWidth;\n const ky = img.offsetHeight / img.naturalHeight;\n\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n return new DOMRect(\n left + kx * minX,\n top + ky * minY,\n kx * (maxX - minX),\n ky * (maxY - minY)\n );\n}\n\ninterface ImageAnnotationPopupProps {\n\n arrow?: boolean;\n\n popup: (props: PopupProps) => ReactNode;\n\n}\n\nexport const ImageAnnotationPopup = (props: ImageAnnotationPopupProps) => {\n\n const anno = useAnnotator<AnnotoriousImageAnnotator>();\n\n const [isOpen, setIsOpen] = useState(false);\n\n const arrowRef = useRef(null);\n\n const { selected, event } = useSelection();\n\n const annotation = selected[0]?.annotation;\n\n const editable = selected[0]?.editable;\n\n const { refs, floatingStyles, context, update } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n middleware: [\n inline(), \n offset(10),\n flip({ crossAxis: true }),\n shift({ \n crossAxis: true,\n padding: { right: 5, left: 5, top: 10, bottom: 10 }\n }),\n arrow({\n element: arrowRef,\n padding: 5\n })\n ],\n whileElementsMounted: autoUpdate\n });\n\n useEffect(() => {\n if (selected.length === 0) {\n setIsOpen(false);\n } else {\n const setPosition = () => { \n const rect = toDOMRect(annotation.target.selector.geometry, anno.element);\n\n refs.setReference({\n getBoundingClientRect: () => rect,\n getClientRects: () => toClientRects(rect)\n });\n }\n\n window.addEventListener('scroll', setPosition, true);\n window.addEventListener('resize', setPosition);\n\n setPosition();\n\n setIsOpen(true);\n\n return () => {\n window.removeEventListener('scroll', setPosition, true);\n window.removeEventListener('resize', setPosition);\n };\n }\n }, [anno, props.popup, selected]);\n\n const onCreateBody = (body: Partial<AnnotationBody>) => {\n const id = body.id || uuidv4();\n \n anno.state.store.addBody({\n ...body,\n id,\n annotation: annotation.id,\n created: body.created || new Date(),\n creator: anno.getUser()\n });\n }\n\n const onDeleteBody = (id: string) => {\n anno.state.store.deleteBody({ id, annotation: annotation.id });\n }\n\n const onUpdateBody = (current: AnnotationBody, next: AnnotationBody) => {\n const id = next.id || uuidv4();\n\n const updated: AnnotationBody = {\n updated: new Date(),\n updatedBy: anno.getUser(),\n ...next,\n id,\n annotation: annotation.id\n }\n\n anno.state.store.updateBody(current, updated);\n }\n\n return isOpen && annotation && (\n <div\n className=\"a9s-popup a9s-image-popup\"\n ref={refs.setFloating}\n style={floatingStyles}>\n\n <FloatingArrow \n ref={arrowRef} \n context={context} />\n\n {props.popup({ \n annotation, \n editable, \n event,\n onCreateBody,\n onDeleteBody,\n onUpdateBody\n })}\n </div>\n )\n\n}"],"names":["toDOMRect","geometry","container","img","left","top","kx","ky","minX","minY","maxX","maxY","ImageAnnotationPopup","props","anno","useAnnotator","isOpen","setIsOpen","useState","arrowRef","useRef","selected","event","useSelection","annotation","_a","editable","_b","refs","floatingStyles","context","update","useFloating","inline","offset","flip","shift","arrow","autoUpdate","useEffect","setPosition","rect","toClientRects","onCreateBody","body","id","uuidv4","onDeleteBody","onUpdateBody","current","next","updated","jsxs","jsx","FloatingArrow"],"mappings":";;;;;;;;AAkBA,MAAMA,IAAY,CAACC,GAAoBC,MAA8B;AAC7D,QAAAC,IAAMD,EAAU,cAAc,KAAK,GAEnC,EAAE,MAAAE,GAAM,KAAAC,EAAI,IAAIF,EAAI,sBAAsB,GAE1CG,IAAKH,EAAI,cAAcA,EAAI,cAC3BI,IAAKJ,EAAI,eAAeA,EAAI,eAE5B,EAAE,MAAAK,GAAM,MAAAC,GAAM,MAAAC,GAAM,MAAAC,MAASV,EAAS;AAE5C,SAAO,IAAI;AAAA,IACTG,IAAOE,IAAKE;AAAA,IACZH,IAAME,IAAKE;AAAA,IACXH,KAAMI,IAAOF;AAAA,IACbD,KAAMI,IAAOF;AAAA,EAAA;AAEjB,GAUaG,IAAuB,CAACC,MAAqC;;AAExE,QAAMC,IAAOC,KAEP,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpCC,IAAWC,EAAO,IAAI,GAEtB,EAAE,UAAAC,GAAU,OAAAC,EAAM,IAAIC,EAAa,GAEnCC,KAAaC,IAAAJ,EAAS,CAAC,MAAV,gBAAAI,EAAa,YAE1BC,KAAWC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C;AAAA,MACA,YAAYrB,EAAW;AAAA,MACvB,SAASoB,EAAK,WAAW,oBAAI,KAAK;AAAA,MAClC,SAAS9B,EAAK,QAAQ;AAAA,IAAA,CACvB;AAAA,EAAA,GAGGiC,IAAe,CAACF,MAAe;AAC9B,IAAA/B,EAAA,MAAM,MAAM,WAAW,EAAE,IAAA+B,GAAI,YAAYrB,EAAW,IAAI;AAAA,EAAA,GAGzDwB,IAAe,CAACC,GAAyBC,MAAyB;AAChE,UAAAL,IAAKK,EAAK,MAAMJ,EAAO,GAEvBK,IAA0B;AAAA,MAC9B,6BAAa,KAAK;AAAA,MAClB,WAAWrC,EAAK,QAAQ;AAAA,MACxB,GAAGoC;AAAA,MACH,IAAAL;AAAA,MACA,YAAYrB,EAAW;AAAA,IAAA;AAGzB,IAAAV,EAAK,MAAM,MAAM,WAAWmC,GAASE,CAAO;AAAA,EAAA;AAG9C,SAAOnC,KAAUQ,KACf4B,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,KAAKxB,EAAK;AAAA,MACV,OAAOC;AAAA,MAEP,UAAA;AAAA,QAAAwB,gBAAAA,EAAA;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAKnC;AAAA,YACL,SAAAW;AAAA,UAAA;AAAA,QAAkB;AAAA,QAEnBjB,EAAM,MAAM;AAAA,UACX,YAAAW;AAAA,UACA,UAAAE;AAAA,UACA,OAAAJ;AAAA,UACA,cAAAqB;AAAA,UACA,cAAAI;AAAA,UACA,cAAAC;AAAA,QAAA,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIP;"}
|
|
@@ -1,109 +1,111 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { useAnnotator as
|
|
1
|
+
import { j as g } from "./annotorious-react.es11.js";
|
|
2
|
+
import { useState as O, useRef as A, useEffect as D } from "react";
|
|
3
|
+
import w from "openseadragon";
|
|
4
|
+
import { useAnnotator as L, useSelection as S } from "./annotorious-react.es2.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
7
|
import "@annotorious/core";
|
|
8
8
|
import "@annotorious/annotorious";
|
|
9
|
-
import { toClientRects as
|
|
10
|
-
import { useFloating as
|
|
11
|
-
import { useViewer as
|
|
12
|
-
import { inline as
|
|
13
|
-
import { autoUpdate as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
const { minX: d, minY: a, maxX: o, maxY: p } = n.bounds,
|
|
9
|
+
import { toClientRects as b } from "./annotorious-react.es14.js";
|
|
10
|
+
import { useFloating as j, FloatingArrow as P } from "./annotorious-react.es13.js";
|
|
11
|
+
import { useViewer as U } from "./annotorious-react.es8.js";
|
|
12
|
+
import { inline as F, offset as M, flip as V, shift as z, arrow as H } from "./annotorious-react.es15.js";
|
|
13
|
+
import { autoUpdate as T } from "./annotorious-react.es16.js";
|
|
14
|
+
import x from "./annotorious-react.es17.js";
|
|
15
|
+
const X = (i, n) => {
|
|
16
|
+
const { minX: d, minY: a, maxX: o, maxY: p } = n.bounds, { top: s, left: l } = i.element.getBoundingClientRect(), t = i.viewport.imageToViewerElementCoordinates(new w.Point(d, a)), m = i.viewport.imageToViewerElementCoordinates(new w.Point(o, p));
|
|
17
17
|
return new DOMRect(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
t.x + l,
|
|
19
|
+
t.y + s,
|
|
20
|
+
m.x - t.x,
|
|
21
|
+
m.y - t.y
|
|
22
22
|
);
|
|
23
|
-
},
|
|
24
|
-
var
|
|
25
|
-
const n =
|
|
23
|
+
}, te = (i) => {
|
|
24
|
+
var u, f;
|
|
25
|
+
const n = L(), [d, a] = O(!1), o = U(), p = A(null), { selected: s, event: l } = S(), t = (u = s[0]) == null ? void 0 : u.annotation, m = (f = s[0]) == null ? void 0 : f.editable, { refs: c, floatingStyles: y, context: v } = j({
|
|
26
26
|
open: d,
|
|
27
27
|
onOpenChange: a,
|
|
28
28
|
middleware: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
F(),
|
|
30
|
+
M(10),
|
|
31
|
+
V({ crossAxis: !0 }),
|
|
32
|
+
z({
|
|
33
33
|
crossAxis: !0,
|
|
34
34
|
boundary: o == null ? void 0 : o.element,
|
|
35
35
|
padding: { right: 5, left: 5, top: 10, bottom: 10 }
|
|
36
36
|
}),
|
|
37
|
-
|
|
37
|
+
H({
|
|
38
38
|
element: p,
|
|
39
39
|
padding: 5
|
|
40
40
|
})
|
|
41
41
|
],
|
|
42
|
-
whileElementsMounted:
|
|
42
|
+
whileElementsMounted: T
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
if (
|
|
44
|
+
D(() => {
|
|
45
|
+
if (s.length === 0)
|
|
46
46
|
a(!1);
|
|
47
47
|
else {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
getBoundingClientRect: () =>
|
|
52
|
-
getClientRects: () =>
|
|
48
|
+
const e = () => {
|
|
49
|
+
const r = X(o, t.target.selector.geometry);
|
|
50
|
+
c.setReference({
|
|
51
|
+
getBoundingClientRect: () => r,
|
|
52
|
+
getClientRects: () => b(r)
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), o.addHandler("update-viewport", e), e(), a(!0), () => {
|
|
56
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e), o.removeHandler("update-viewport", e);
|
|
57
|
+
};
|
|
56
58
|
}
|
|
57
|
-
}, [
|
|
58
|
-
const
|
|
59
|
-
const
|
|
59
|
+
}, [i.popup, s, o]);
|
|
60
|
+
const R = (e) => {
|
|
61
|
+
const r = e.id || x();
|
|
60
62
|
n.state.store.addBody({
|
|
61
|
-
...
|
|
62
|
-
id:
|
|
63
|
-
annotation:
|
|
64
|
-
created:
|
|
63
|
+
...e,
|
|
64
|
+
id: r,
|
|
65
|
+
annotation: t.id,
|
|
66
|
+
created: e.created || /* @__PURE__ */ new Date(),
|
|
65
67
|
creator: n.getUser()
|
|
66
68
|
});
|
|
67
|
-
},
|
|
68
|
-
n.state.store.deleteBody({ id:
|
|
69
|
-
},
|
|
70
|
-
const
|
|
69
|
+
}, B = (e) => {
|
|
70
|
+
n.state.store.deleteBody({ id: e, annotation: t.id });
|
|
71
|
+
}, E = (e, r) => {
|
|
72
|
+
const C = r.id || x(), h = {
|
|
71
73
|
updated: /* @__PURE__ */ new Date(),
|
|
72
74
|
updatedBy: n.getUser(),
|
|
73
|
-
...
|
|
74
|
-
id:
|
|
75
|
-
annotation:
|
|
75
|
+
...r,
|
|
76
|
+
id: C,
|
|
77
|
+
annotation: t.id
|
|
76
78
|
};
|
|
77
|
-
n.state.store.updateBody(
|
|
79
|
+
n.state.store.updateBody(e, h);
|
|
78
80
|
};
|
|
79
|
-
return d &&
|
|
81
|
+
return d && t && /* @__PURE__ */ g.jsxs(
|
|
80
82
|
"div",
|
|
81
83
|
{
|
|
82
84
|
className: "a9s-popup a9s-image-popup",
|
|
83
|
-
ref:
|
|
85
|
+
ref: c.setFloating,
|
|
84
86
|
style: y,
|
|
85
87
|
children: [
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
|
|
88
|
+
/* @__PURE__ */ g.jsx(
|
|
89
|
+
P,
|
|
88
90
|
{
|
|
89
91
|
ref: p,
|
|
90
|
-
context:
|
|
92
|
+
context: v,
|
|
91
93
|
fill: "#fff"
|
|
92
94
|
}
|
|
93
95
|
),
|
|
94
|
-
|
|
95
|
-
annotation:
|
|
96
|
-
editable:
|
|
97
|
-
event:
|
|
98
|
-
onCreateBody:
|
|
99
|
-
onDeleteBody:
|
|
100
|
-
onUpdateBody:
|
|
96
|
+
i.popup({
|
|
97
|
+
annotation: t,
|
|
98
|
+
editable: m,
|
|
99
|
+
event: l,
|
|
100
|
+
onCreateBody: R,
|
|
101
|
+
onDeleteBody: B,
|
|
102
|
+
onUpdateBody: E
|
|
101
103
|
})
|
|
102
104
|
]
|
|
103
105
|
}
|
|
104
106
|
);
|
|
105
107
|
};
|
|
106
108
|
export {
|
|
107
|
-
|
|
109
|
+
te as OpenSeadragonAnnotationPopup
|
|
108
110
|
};
|
|
109
111
|
//# sourceMappingURL=annotorious-react.es9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es9.js","sources":["../src/openseadragon/OpenSeadragonAnnotationPopup.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState } from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useAnnotator, useSelection, useViewer} from '@annotorious/react';\nimport type {
|
|
1
|
+
{"version":3,"file":"annotorious-react.es9.js","sources":["../src/openseadragon/OpenSeadragonAnnotationPopup.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState } from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useAnnotator, useSelection, useViewer} from '@annotorious/react';\nimport type { PopupProps } from '@annotorious/react';\nimport type { AnnotationBody, Annotator, Geometry, ImageAnnotation } from '@annotorious/annotorious';\nimport { toClientRects } from '../utils/toClientRects';\nimport {\n useFloating,\n arrow,\n shift,\n inline,\n autoUpdate,\n flip,\n offset,\n FloatingArrow\n} from '@floating-ui/react';\n\nconst toDOMRect = (viewer: OpenSeadragon.Viewer, geometry: Geometry) => {\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n const { top, left } = viewer.element.getBoundingClientRect();\n\n const topLeft = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(minX, minY));\n const bottomRight = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(maxX, maxY));\n\n return new DOMRect(\n topLeft.x + left,\n topLeft.y + top,\n bottomRight.x - topLeft.x,\n bottomRight.y - topLeft.y\n );\n}\n\ninterface OpenSeadragonAnnotationPopupProps {\n\n arrow?: boolean;\n\n popup: (props: PopupProps) => ReactNode;\n\n}\n\nexport const OpenSeadragonAnnotationPopup = (props: OpenSeadragonAnnotationPopupProps) => {\n \n const anno = useAnnotator<Annotator<ImageAnnotation>>();\n\n const [isOpen, setIsOpen] = useState(false);\n\n const viewer = useViewer();\n\n const arrowRef = useRef(null);\n\n const { selected, event } = useSelection();\n\n const annotation = selected[0]?.annotation;\n\n const editable = selected[0]?.editable;\n\n const { refs, floatingStyles, context } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n middleware: [\n inline(), \n offset(10),\n flip({ crossAxis: true }),\n shift({ \n crossAxis: true,\n boundary: viewer?.element,\n padding: { right: 5, left: 5, top: 10, bottom: 10 }\n }),\n arrow({\n element: arrowRef,\n padding: 5\n })\n ],\n whileElementsMounted: autoUpdate\n });\n\n useEffect(() => {\n if (selected.length === 0) {\n setIsOpen(false);\n } else { \n const setPosition = () => { \n const rect = toDOMRect(viewer, annotation.target.selector.geometry);\n \n refs.setReference({\n getBoundingClientRect: () => rect,\n getClientRects: () => toClientRects(rect)\n });\n }\n\n window.addEventListener('scroll', setPosition, true);\n window.addEventListener('resize', setPosition);\n viewer.addHandler('update-viewport', setPosition);\n\n setPosition();\n\n setIsOpen(true);\n\n return () => {\n window.removeEventListener('scroll', setPosition, true);\n window.removeEventListener('resize', setPosition);\n viewer.removeHandler('update-viewport', setPosition);\n };\n }\n }, [props.popup, selected, viewer]);\n\n const onCreateBody = (body: Partial<AnnotationBody>) => {\n const id = body.id || uuidv4();\n \n anno.state.store.addBody({\n ...body,\n id,\n annotation: annotation.id,\n created: body.created || new Date(),\n creator: anno.getUser()\n });\n }\n\n const onDeleteBody = (id: string) => {\n anno.state.store.deleteBody({ id, annotation: annotation.id });\n }\n\n const onUpdateBody = (current: AnnotationBody, next: AnnotationBody) => {\n const id = next.id || uuidv4();\n\n const updated: AnnotationBody = {\n updated: new Date(),\n updatedBy: anno.getUser(),\n ...next,\n id,\n annotation: annotation.id\n }\n\n anno.state.store.updateBody(current, updated);\n }\n\n return isOpen && annotation && (\n <div\n className=\"a9s-popup a9s-image-popup\"\n ref={refs.setFloating}\n style={floatingStyles}>\n\n <FloatingArrow \n ref={arrowRef} \n context={context} \n fill=\"#fff\" />\n\n {props.popup({ \n annotation, \n editable, \n event,\n onCreateBody,\n onDeleteBody,\n onUpdateBody\n })}\n </div>\n )\n\n}"],"names":["toDOMRect","viewer","geometry","minX","minY","maxX","maxY","top","left","topLeft","OpenSeadragon","bottomRight","OpenSeadragonAnnotationPopup","props","anno","useAnnotator","isOpen","setIsOpen","useState","useViewer","arrowRef","useRef","selected","event","useSelection","annotation","_a","editable","_b","refs","floatingStyles","context","useFloating","inline","offset","flip","shift","arrow","autoUpdate","useEffect","setPosition","rect","toClientRects","onCreateBody","body","id","uuidv4","onDeleteBody","onUpdateBody","current","next","updated","jsxs","jsx","FloatingArrow"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAMA,IAAY,CAACC,GAA8BC,MAAuB;AACtE,QAAM,EAAE,MAAAC,GAAM,MAAAC,GAAM,MAAAC,GAAM,MAAAC,MAASJ,EAAS,QAEtC,EAAE,KAAAK,GAAK,MAAAC,EAAA,IAASP,EAAO,QAAQ,yBAE/BQ,IAAUR,EAAO,SAAS,gCAAgC,IAAIS,EAAc,MAAMP,GAAMC,CAAI,CAAC,GAC7FO,IAAcV,EAAO,SAAS,gCAAgC,IAAIS,EAAc,MAAML,GAAMC,CAAI,CAAC;AAEvG,SAAO,IAAI;AAAA,IACTG,EAAQ,IAAID;AAAA,IACZC,EAAQ,IAAIF;AAAA,IACZI,EAAY,IAAKF,EAAQ;AAAA,IACzBE,EAAY,IAAIF,EAAQ;AAAA,EAAA;AAE5B,GAUaG,KAA+B,CAACC,MAA6C;;AAExF,QAAMC,IAAOC,KAEP,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpCjB,IAASkB,KAETC,IAAWC,EAAO,IAAI,GAEtB,EAAE,UAAAC,GAAU,OAAAC,EAAM,IA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@ -2,9 +2,9 @@ import { createAnonymousGuest as _createAnonymousGuest, createBody as _createBod
|
|
|
2
2
|
import { ShapeType as _ShapeType } from '@annotorious/annotorious';
|
|
3
3
|
export * from './Annotorious';
|
|
4
4
|
export * from './AnnotoriousPlugin';
|
|
5
|
-
export * from './AnnotoriousPopupProps';
|
|
6
5
|
export * from './ImageAnnotationPopup';
|
|
7
6
|
export * from './ImageAnnotator';
|
|
7
|
+
export * from './PopupProps';
|
|
8
8
|
export * from './openseadragon';
|
|
9
9
|
export type { Annotation, AnnotationBody, AnnotationState, AnnotationTarget, Annotator, AnnotatorState, Appearance, AppearanceProvider, Color, DrawingStyle, DrawingStyleExpression, Filter, FormatAdapter, HoverState, LifecycleEvents, ParseResult, PresentUser, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, User, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core';
|
|
10
10
|
export { _createAnonymousGuest as createAnonymousGuest };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAE7B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,0CAA0C,CAAC;AAClD,OAAO,0DAA0D,CAAC;AAGlE,YAAY,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,KAAK,EACL,YAAY,EACZ,sBAAsB,EACtB,MAAM,EACN,aAAa,EACb,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
2
|
-
import {
|
|
2
|
+
import { PopupProps } from '../index.ts';
|
|
3
3
|
interface OpenSeadragonAnnotationPopupProps {
|
|
4
4
|
arrow?: boolean;
|
|
5
|
-
popup: (props:
|
|
5
|
+
popup: (props: PopupProps) => ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const OpenSeadragonAnnotationPopup: (props: OpenSeadragonAnnotationPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenSeadragonAnnotationPopup.d.ts","sourceRoot":"","sources":["../../src/openseadragon/OpenSeadragonAnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAI/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"OpenSeadragonAnnotationPopup.d.ts","sourceRoot":"","sources":["../../src/openseadragon/OpenSeadragonAnnotationPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAI/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AA8BrD,UAAU,iCAAiC;IAEzC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,SAAS,CAAC;CAEzC;AAED,eAAO,MAAM,4BAA4B,UAAW,iCAAiC,4CAqHpF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annotorious/react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Annotorious React bindings",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@vitejs/plugin-react": "^4.3.1",
|
|
30
30
|
"typescript": "5.5.4",
|
|
31
31
|
"vite": "^5.4.2",
|
|
32
|
-
"vite-plugin-dts": "^4.0
|
|
32
|
+
"vite-plugin-dts": "^4.1.0",
|
|
33
33
|
"vite-tsconfig-paths": "^5.0.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@annotorious/annotorious": "3.0.
|
|
47
|
-
"@annotorious/core": "3.0.
|
|
48
|
-
"@annotorious/openseadragon": "3.0.
|
|
46
|
+
"@annotorious/annotorious": "3.0.3",
|
|
47
|
+
"@annotorious/core": "3.0.3",
|
|
48
|
+
"@annotorious/openseadragon": "3.0.3",
|
|
49
49
|
"@floating-ui/react": "^0.26.23"
|
|
50
50
|
},
|
|
51
51
|
"sideEffects": false
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AnnotationBody, ImageAnnotation } from '@annotorious/annotorious';
|
|
2
|
-
export interface AnnotoriousPopupProps {
|
|
3
|
-
annotation: ImageAnnotation;
|
|
4
|
-
editable?: boolean;
|
|
5
|
-
event?: PointerEvent;
|
|
6
|
-
onCreateBody(body: AnnotationBody): void;
|
|
7
|
-
onDeleteBody(id: string): void;
|
|
8
|
-
onUpdateBody(current: AnnotationBody, next: AnnotationBody): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=AnnotoriousPopupProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotoriousPopupProps.d.ts","sourceRoot":"","sources":["../src/AnnotoriousPopupProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IAEpC,UAAU,EAAE,eAAe,CAAC;IAE5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAEzC,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;CAEnE"}
|