@annotorious/react 3.3.3 → 3.3.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/annotorious-react.es.js +37 -31
- package/dist/annotorious-react.es12.js +51 -50
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +10 -10
|
@@ -1,43 +1,49 @@
|
|
|
1
|
-
import { Annotorious as r, AnnotoriousContext as a, useAnnotation as
|
|
2
|
-
import { AnnotoriousPlugin as
|
|
1
|
+
import { Annotorious as r, AnnotoriousContext as a, useAnnotation as i, useAnnotationSelectAction as p, useAnnotationStore as s, useAnnotations as m, useAnnotator as u, useAnnotatorUser as A, useHover as S, useSelection as l, useViewportState as c } from "./annotorious-react.es2.js";
|
|
2
|
+
import { AnnotoriousPlugin as x } from "./annotorious-react.es3.js";
|
|
3
3
|
import { ImageAnnotationPopup as d } from "./annotorious-react.es4.js";
|
|
4
|
-
import { ImageAnnotator as
|
|
4
|
+
import { ImageAnnotator as I } from "./annotorious-react.es5.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
|
-
import { Origin as
|
|
8
|
-
import { ShapeType as
|
|
9
|
-
import { OpenSeadragonAnnotator as
|
|
10
|
-
import { OpenSeadragonAnnotationPopup as
|
|
11
|
-
import { OpenSeadragonViewer as
|
|
7
|
+
import { Origin as O, UserSelectAction as V, createAnonymousGuest as P, createBody as w, defaultColorProvider as z } from "@annotorious/core";
|
|
8
|
+
import { ShapeType as G, W3CImageFormat as W, chainStyles as h, computeStyle as v, createImageAnnotator as U, parseFragmentSelector as B, parseSVGSelector as H, parseW3CImageAnnotation as T, serializeFragmentSelector as b, serializeSVGSelector as j, serializeW3CImageAnnotation as k } from "@annotorious/annotorious";
|
|
9
|
+
import { OpenSeadragonAnnotator as D, OpenSeadragonAnnotatorContext as E, useViewer as J } from "./annotorious-react.es8.js";
|
|
10
|
+
import { OpenSeadragonAnnotationPopup as L } from "./annotorious-react.es9.js";
|
|
11
|
+
import { OpenSeadragonViewer as N } from "./annotorious-react.es10.js";
|
|
12
12
|
export {
|
|
13
13
|
r as Annotorious,
|
|
14
14
|
a as AnnotoriousContext,
|
|
15
|
-
|
|
15
|
+
x as AnnotoriousPlugin,
|
|
16
16
|
d as ImageAnnotationPopup,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
I as ImageAnnotator,
|
|
18
|
+
L as OpenSeadragonAnnotationPopup,
|
|
19
|
+
D as OpenSeadragonAnnotator,
|
|
20
|
+
E as OpenSeadragonAnnotatorContext,
|
|
21
|
+
N as OpenSeadragonViewer,
|
|
22
|
+
O as Origin,
|
|
23
|
+
G as ShapeType,
|
|
24
|
+
V as UserSelectAction,
|
|
25
|
+
W as W3CImageFormat,
|
|
26
|
+
h as chainStyles,
|
|
27
|
+
v as computeStyle,
|
|
28
|
+
P as createAnonymousGuest,
|
|
29
|
+
w as createBody,
|
|
30
|
+
U as createImageAnnotator,
|
|
31
|
+
z as defaultColorProvider,
|
|
32
|
+
B as parseFragmentSelector,
|
|
33
|
+
H as parseSVGSelector,
|
|
34
|
+
T as parseW3CImageAnnotation,
|
|
35
|
+
b as serializeFragmentSelector,
|
|
36
|
+
j as serializeSVGSelector,
|
|
37
|
+
k as serializeW3CImageAnnotation,
|
|
38
|
+
i as useAnnotation,
|
|
39
|
+
p as useAnnotationSelectAction,
|
|
40
|
+
s as useAnnotationStore,
|
|
41
|
+
m as useAnnotations,
|
|
42
|
+
u as useAnnotator,
|
|
37
43
|
A as useAnnotatorUser,
|
|
38
44
|
S as useHover,
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
l as useSelection,
|
|
46
|
+
J as useViewer,
|
|
41
47
|
c as useViewportState
|
|
42
48
|
};
|
|
43
49
|
//# sourceMappingURL=annotorious-react.es.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as s from "react";
|
|
2
2
|
import { useLayoutEffect as k, useEffect as q } from "react";
|
|
3
|
-
import { jsxs as Q, jsx as
|
|
3
|
+
import { jsxs as Q, jsx as P } from "react/jsx-runtime";
|
|
4
4
|
import { isElement as F, getComputedStyle as Z } from "./annotorious-react.es17.js";
|
|
5
5
|
import { getOverflowAncestors as xe } from "./annotorious-react.es17.js";
|
|
6
6
|
import "react-dom";
|
|
@@ -38,24 +38,24 @@ function ee() {
|
|
|
38
38
|
}, []), t;
|
|
39
39
|
}
|
|
40
40
|
const te = $.useId, B = te || ee;
|
|
41
|
-
let
|
|
42
|
-
process.env.NODE_ENV !== "production" && (
|
|
41
|
+
let O;
|
|
42
|
+
process.env.NODE_ENV !== "production" && (O = /* @__PURE__ */ new Set());
|
|
43
43
|
function ne() {
|
|
44
44
|
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++)
|
|
45
45
|
c[e] = arguments[e];
|
|
46
46
|
const o = "Floating UI: " + c.join(" ");
|
|
47
|
-
if (!((t =
|
|
48
|
-
var
|
|
49
|
-
(
|
|
47
|
+
if (!((t = O) != null && t.has(o))) {
|
|
48
|
+
var l;
|
|
49
|
+
(l = O) == null || l.add(o), console.warn(o);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function oe() {
|
|
53
53
|
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++)
|
|
54
54
|
c[e] = arguments[e];
|
|
55
55
|
const o = "Floating UI: " + c.join(" ");
|
|
56
|
-
if (!((t =
|
|
57
|
-
var
|
|
58
|
-
(
|
|
56
|
+
if (!((t = O) != null && t.has(o))) {
|
|
57
|
+
var l;
|
|
58
|
+
(l = O) == null || l.add(o), console.error(o);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
const pe = /* @__PURE__ */ s.forwardRef(function(n, c) {
|
|
@@ -66,11 +66,11 @@ const pe = /* @__PURE__ */ s.forwardRef(function(n, c) {
|
|
|
66
66
|
floating: o
|
|
67
67
|
},
|
|
68
68
|
middlewareData: {
|
|
69
|
-
arrow:
|
|
69
|
+
arrow: l,
|
|
70
70
|
shift: u
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
width:
|
|
73
|
+
width: f = 14,
|
|
74
74
|
height: a = 7,
|
|
75
75
|
tipRadius: I = 0,
|
|
76
76
|
strokeWidth: d = 0,
|
|
@@ -84,19 +84,19 @@ const pe = /* @__PURE__ */ s.forwardRef(function(n, c) {
|
|
|
84
84
|
...v
|
|
85
85
|
} = n;
|
|
86
86
|
process.env.NODE_ENV !== "production" && (c || ne("The `ref` prop is required for `FloatingArrow`."));
|
|
87
|
-
const x = B(), [E,
|
|
87
|
+
const x = B(), [E, i] = s.useState(!1);
|
|
88
88
|
if (M(() => {
|
|
89
89
|
if (!o) return;
|
|
90
|
-
Z(o).direction === "rtl" &&
|
|
90
|
+
Z(o).direction === "rtl" && i(!0);
|
|
91
91
|
}, [o]), !o)
|
|
92
92
|
return null;
|
|
93
|
-
const [m,
|
|
93
|
+
const [m, D] = e.split("-"), N = m === "top" || m === "bottom";
|
|
94
94
|
let S = g;
|
|
95
|
-
(
|
|
96
|
-
const C = d * 2,
|
|
97
|
-
let L = S &&
|
|
98
|
-
S && E && (L =
|
|
99
|
-
const H = (
|
|
95
|
+
(N && u != null && u.x || !N && u != null && u.y) && (S = null);
|
|
96
|
+
const C = d * 2, b = C / 2, A = f / 2 * (I / -8 + 1), T = a / 2 * I / 4, w = !!r, U = S && D === "end" ? "bottom" : "top";
|
|
97
|
+
let L = S && D === "end" ? "right" : "left";
|
|
98
|
+
S && E && (L = D === "end" ? "left" : "right");
|
|
99
|
+
const H = (l == null ? void 0 : l.x) != null ? S || l.x : "", X = (l == null ? void 0 : l.y) != null ? S || l.y : "", V = r || "M0,0" + (" H" + f) + (" L" + (f - A) + "," + (a - T)) + (" Q" + f / 2 + "," + a + " " + A + "," + (a - T)) + " Z", Y = {
|
|
100
100
|
top: w ? "rotate(180deg)" : "",
|
|
101
101
|
left: w ? "rotate(90deg)" : "rotate(-90deg)",
|
|
102
102
|
bottom: w ? "" : "rotate(180deg)",
|
|
@@ -106,34 +106,34 @@ const pe = /* @__PURE__ */ s.forwardRef(function(n, c) {
|
|
|
106
106
|
...v,
|
|
107
107
|
"aria-hidden": !0,
|
|
108
108
|
ref: c,
|
|
109
|
-
width: w ?
|
|
110
|
-
height:
|
|
111
|
-
viewBox: "0 0 " +
|
|
109
|
+
width: w ? f : f + C,
|
|
110
|
+
height: f,
|
|
111
|
+
viewBox: "0 0 " + f + " " + (a > f ? a : f),
|
|
112
112
|
style: {
|
|
113
113
|
position: "absolute",
|
|
114
114
|
pointerEvents: "none",
|
|
115
115
|
[L]: H,
|
|
116
116
|
[U]: X,
|
|
117
|
-
[m]:
|
|
117
|
+
[m]: N || w ? "100%" : "calc(100% - " + C / 2 + "px)",
|
|
118
118
|
transform: [Y, p].filter((j) => !!j).join(" "),
|
|
119
119
|
...R
|
|
120
120
|
},
|
|
121
|
-
children: [C > 0 && /* @__PURE__ */
|
|
121
|
+
children: [C > 0 && /* @__PURE__ */ P("path", {
|
|
122
122
|
clipPath: "url(#" + x + ")",
|
|
123
123
|
fill: "none",
|
|
124
124
|
stroke: h,
|
|
125
125
|
strokeWidth: C + (r ? 0 : 1),
|
|
126
126
|
d: V
|
|
127
|
-
}), /* @__PURE__ */
|
|
127
|
+
}), /* @__PURE__ */ P("path", {
|
|
128
128
|
stroke: C && !r ? v.fill : "none",
|
|
129
129
|
d: V
|
|
130
|
-
}), /* @__PURE__ */
|
|
130
|
+
}), /* @__PURE__ */ P("clipPath", {
|
|
131
131
|
id: x,
|
|
132
|
-
children: /* @__PURE__ */
|
|
133
|
-
x: -
|
|
134
|
-
y:
|
|
135
|
-
width:
|
|
136
|
-
height:
|
|
132
|
+
children: /* @__PURE__ */ P("rect", {
|
|
133
|
+
x: -b,
|
|
134
|
+
y: b * (w ? -1 : 1),
|
|
135
|
+
width: f + C,
|
|
136
|
+
height: f
|
|
137
137
|
})
|
|
138
138
|
})]
|
|
139
139
|
});
|
|
@@ -146,11 +146,11 @@ function re() {
|
|
|
146
146
|
(e = t.get(n)) == null || e.forEach((o) => o(c));
|
|
147
147
|
},
|
|
148
148
|
on(n, c) {
|
|
149
|
-
t.set(n,
|
|
149
|
+
t.has(n) || t.set(n, /* @__PURE__ */ new Set()), t.get(n).add(c);
|
|
150
150
|
},
|
|
151
151
|
off(n, c) {
|
|
152
152
|
var e;
|
|
153
|
-
|
|
153
|
+
(e = t.get(n)) == null || e.delete(c);
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
}
|
|
@@ -163,17 +163,17 @@ function fe(t) {
|
|
|
163
163
|
open: n = !1,
|
|
164
164
|
onOpenChange: c,
|
|
165
165
|
elements: e
|
|
166
|
-
} = t, o = B(),
|
|
166
|
+
} = t, o = B(), l = s.useRef({}), [u] = s.useState(() => re()), f = ie() != null;
|
|
167
167
|
if (process.env.NODE_ENV !== "production") {
|
|
168
168
|
const r = e.reference;
|
|
169
169
|
r && !F(r) && oe("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
|
170
170
|
}
|
|
171
171
|
const [a, I] = s.useState(e.reference), d = K((r, p, R) => {
|
|
172
|
-
|
|
172
|
+
l.current.openEvent = r ? p : void 0, u.emit("openchange", {
|
|
173
173
|
open: r,
|
|
174
174
|
event: p,
|
|
175
175
|
reason: R,
|
|
176
|
-
nested:
|
|
176
|
+
nested: f
|
|
177
177
|
}), c == null || c(r, p, R);
|
|
178
178
|
}), g = s.useMemo(() => ({
|
|
179
179
|
setPositionReference: I
|
|
@@ -183,7 +183,7 @@ function fe(t) {
|
|
|
183
183
|
domReference: e.reference
|
|
184
184
|
}), [a, e.reference, e.floating]);
|
|
185
185
|
return s.useMemo(() => ({
|
|
186
|
-
dataRef:
|
|
186
|
+
dataRef: l,
|
|
187
187
|
open: n,
|
|
188
188
|
onOpenChange: d,
|
|
189
189
|
elements: h,
|
|
@@ -203,7 +203,7 @@ function he(t) {
|
|
|
203
203
|
floating: null,
|
|
204
204
|
...t.elements
|
|
205
205
|
}
|
|
206
|
-
}), e = t.rootContext || c, o = e.elements, [
|
|
206
|
+
}), e = t.rootContext || c, o = e.elements, [l, u] = s.useState(null), [f, a] = s.useState(null), d = (o == null ? void 0 : o.domReference) || l, g = s.useRef(null), h = le();
|
|
207
207
|
M(() => {
|
|
208
208
|
d && (g.current = d);
|
|
209
209
|
}, [d]);
|
|
@@ -211,21 +211,22 @@ function he(t) {
|
|
|
211
211
|
...t,
|
|
212
212
|
elements: {
|
|
213
213
|
...o,
|
|
214
|
-
...
|
|
215
|
-
reference:
|
|
214
|
+
...f && {
|
|
215
|
+
reference: f
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
}), p = s.useCallback((
|
|
219
|
-
const m = F(
|
|
220
|
-
getBoundingClientRect: () =>
|
|
221
|
-
|
|
222
|
-
|
|
218
|
+
}), p = s.useCallback((i) => {
|
|
219
|
+
const m = F(i) ? {
|
|
220
|
+
getBoundingClientRect: () => i.getBoundingClientRect(),
|
|
221
|
+
getClientRects: () => i.getClientRects(),
|
|
222
|
+
contextElement: i
|
|
223
|
+
} : i;
|
|
223
224
|
a(m), r.refs.setReference(m);
|
|
224
|
-
}, [r.refs]), R = s.useCallback((
|
|
225
|
-
(F(
|
|
225
|
+
}, [r.refs]), R = s.useCallback((i) => {
|
|
226
|
+
(F(i) || i === null) && (g.current = i, u(i)), (F(r.refs.reference.current) || r.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
226
227
|
// `null` to support `positionReference` + an unstable `reference`
|
|
227
228
|
// callback ref.
|
|
228
|
-
|
|
229
|
+
i !== null && !F(i)) && r.refs.setReference(i);
|
|
229
230
|
}, [r.refs]), v = s.useMemo(() => ({
|
|
230
231
|
...r.refs,
|
|
231
232
|
setReference: R,
|
|
@@ -243,8 +244,8 @@ function he(t) {
|
|
|
243
244
|
}), [r, v, x, n, e]);
|
|
244
245
|
return M(() => {
|
|
245
246
|
e.dataRef.current.floatingContext = E;
|
|
246
|
-
const
|
|
247
|
-
|
|
247
|
+
const i = h == null ? void 0 : h.nodesRef.current.find((m) => m.id === n);
|
|
248
|
+
i && (i.context = E);
|
|
248
249
|
}), s.useMemo(() => ({
|
|
249
250
|
...r,
|
|
250
251
|
context: E,
|