@annotorious/react 3.0.5 → 3.0.7
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/README.md +17 -0
- package/dist/Annotorious.d.ts +1 -1
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/ImageAnnotator.d.ts.map +1 -1
- package/dist/annotorious-react.es.js +25 -23
- package/dist/annotorious-react.es13.js +65 -65
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es15.js +69 -65
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +149 -137
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es21.js +70 -67
- package/dist/annotorious-react.es21.js.map +1 -1
- package/dist/annotorious-react.es28.js +171 -168
- package/dist/annotorious-react.es28.js.map +1 -1
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es5.js +21 -19
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es8.js +13 -11
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
- package/package.json +10 -9
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# @annotorious/react
|
|
4
|
+
|
|
5
|
+
Add image annotation functionality to any web page with a few lines of JavaScript. Visit the
|
|
6
|
+
[project website](https://annotorious.dev) for documentation and live demos.
|
|
7
|
+
|
|
8
|
+
## Community
|
|
9
|
+
|
|
10
|
+
Visit the [Discussion Forum](https://github.com/annotorious/annotorious/discussions) for community support, or file an
|
|
11
|
+
issue on the [Issue Tracker](https://github.com/annotorious/annotorious/issues).
|
|
12
|
+
|
|
13
|
+
## Become a Sponsor
|
|
14
|
+
|
|
15
|
+
Using Annotorious at work? Become a sponsor! Your support helps me cover hosting costs, spend more
|
|
16
|
+
time supporting the community, and make Annotorious better for everyone. [Make a one-time or monthly
|
|
17
|
+
donation via my SteadyHQ account](https://steadyhq.com/rainer-simon).
|
package/dist/Annotorious.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare const useAnnotator: <T extends unknown = Annotator<any, unknown>>
|
|
|
22
22
|
export declare const useAnnotationStore: <T extends unknown = Store<Annotation>>() => T | undefined;
|
|
23
23
|
export declare const useAnnotations: <T extends Annotation = ImageAnnotation>(debounce?: number) => T[];
|
|
24
24
|
export declare const useAnnotation: <T extends Annotation = ImageAnnotation>(id: string, options?: Omit<StoreObserveOptions, "annotations">) => T;
|
|
25
|
-
export declare const useAnnotationSelectAction: <
|
|
25
|
+
export declare const useAnnotationSelectAction: <I extends Annotation = ImageAnnotation, E extends unknown = ImageAnnotation>(id: string, action: UserSelectActionExpression<E>) => import('@annotorious/core').UserSelectAction;
|
|
26
26
|
export declare const useSelection: <T extends Annotation = ImageAnnotation>() => Selection<T>;
|
|
27
27
|
export declare const useAnnotatorUser: () => User;
|
|
28
28
|
export declare const useViewportState: <T extends Annotation = ImageAnnotation>(debounce?: number) => T[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Annotorious.d.ts","sourceRoot":"","sources":["../src/Annotorious.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,0BAA0B,EAAC,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAGL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,SAAS,IAAI,aAAa,EAC1B,eAAe,EACf,KAAK,EAEL,IAAI,EACL,MAAM,0BAA0B,CAAC;AAElC,UAAU,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IAE5F,QAAQ,EAAE;QAAE,UAAU,EAAE,CAAC,CAAC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AAC,eAAe,CAAC,CAAC;IAEjC,IAAI,CAAC,EAAE,WAAW,CAAC;CAEpB;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,OAAO,SAAS,mBAAmB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ImageAnnotator.d.ts","sourceRoot":"","sources":["../src/ImageAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAuC,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGrF,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC;IAEjG,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAEzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,MAAM,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAEjC,IAAI,CAAC,EAAE,WAAW,CAAC;CAEpB;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,OAAO,SAAS,mBAAmB,CAAC,CAAC,CAAC,4CA4C9E,CAAA"}
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { Annotorious as r, AnnotoriousContext as a, useAnnotation as i, useAnnotationSelectAction as p, useAnnotationStore as u, useAnnotations as m, useAnnotator as s, useAnnotatorUser as A, useSelection as
|
|
2
|
-
import { AnnotoriousPlugin as
|
|
3
|
-
import { ImageAnnotationPopup as
|
|
4
|
-
import { ImageAnnotator as
|
|
1
|
+
import { Annotorious as r, AnnotoriousContext as a, useAnnotation as i, useAnnotationSelectAction as p, useAnnotationStore as u, useAnnotations as m, useAnnotator as s, useAnnotatorUser as A, useSelection as S, useViewportState as c } from "./annotorious-react.es2.js";
|
|
2
|
+
import { AnnotoriousPlugin as x } from "./annotorious-react.es3.js";
|
|
3
|
+
import { ImageAnnotationPopup as l } from "./annotorious-react.es4.js";
|
|
4
|
+
import { ImageAnnotator as y } 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 P, createAnonymousGuest as w, createBody as C, defaultColorProvider as V } from "@annotorious/core";
|
|
8
|
+
import { ShapeType as U, W3CImageFormat as v, chainStyles as B, computeStyle as F, createImageAnnotator as G } from "@annotorious/annotorious";
|
|
9
|
+
import { OpenSeadragonAnnotator as W, useViewer as b } from "./annotorious-react.es8.js";
|
|
10
|
+
import { OpenSeadragonAnnotationPopup as k } from "./annotorious-react.es9.js";
|
|
11
|
+
import { OpenSeadragonViewer as z } from "./annotorious-react.es10.js";
|
|
12
12
|
export {
|
|
13
13
|
r as Annotorious,
|
|
14
14
|
a as AnnotoriousContext,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
x as AnnotoriousPlugin,
|
|
16
|
+
l as ImageAnnotationPopup,
|
|
17
|
+
y as ImageAnnotator,
|
|
18
|
+
k as OpenSeadragonAnnotationPopup,
|
|
19
|
+
W as OpenSeadragonAnnotator,
|
|
20
|
+
z as OpenSeadragonViewer,
|
|
21
|
+
O as Origin,
|
|
22
|
+
U as ShapeType,
|
|
23
|
+
P as UserSelectAction,
|
|
24
24
|
v as W3CImageFormat,
|
|
25
|
-
|
|
25
|
+
B as chainStyles,
|
|
26
|
+
F as computeStyle,
|
|
27
|
+
w as createAnonymousGuest,
|
|
26
28
|
C as createBody,
|
|
27
|
-
|
|
29
|
+
G as createImageAnnotator,
|
|
28
30
|
V as defaultColorProvider,
|
|
29
31
|
i as useAnnotation,
|
|
30
32
|
p as useAnnotationSelectAction,
|
|
@@ -32,8 +34,8 @@ export {
|
|
|
32
34
|
m as useAnnotations,
|
|
33
35
|
s as useAnnotator,
|
|
34
36
|
A as useAnnotatorUser,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
S as useSelection,
|
|
38
|
+
b as useViewer,
|
|
39
|
+
c as useViewportState
|
|
38
40
|
};
|
|
39
41
|
//# sourceMappingURL=annotorious-react.es.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as o from "react";
|
|
2
|
-
import { useLayoutEffect as
|
|
3
|
-
import { getComputedStyle as
|
|
2
|
+
import { useLayoutEffect as q, useEffect as Q } from "react";
|
|
3
|
+
import { getComputedStyle as Z, isElement as I } from "./annotorious-react.es21.js";
|
|
4
4
|
import { getOverflowAncestors as Re } from "./annotorious-react.es21.js";
|
|
5
5
|
import "react-dom";
|
|
6
|
-
import { useFloating as
|
|
6
|
+
import { useFloating as z } from "./annotorious-react.es15.js";
|
|
7
7
|
import { arrow as xe, flip as Ee, inline as we, offset as Ce, shift as Se } from "./annotorious-react.es15.js";
|
|
8
|
-
const
|
|
8
|
+
const $ = {
|
|
9
9
|
...o
|
|
10
|
-
},
|
|
11
|
-
function
|
|
10
|
+
}, G = $.useInsertionEffect, J = G || ((t) => t());
|
|
11
|
+
function K(t) {
|
|
12
12
|
const n = o.useRef(() => {
|
|
13
13
|
if (process.env.NODE_ENV !== "production")
|
|
14
14
|
throw new Error("Cannot call an event handler while rendering.");
|
|
15
15
|
});
|
|
16
|
-
return
|
|
16
|
+
return J(() => {
|
|
17
17
|
n.current = t;
|
|
18
18
|
}), o.useCallback(function() {
|
|
19
19
|
for (var s = arguments.length, e = new Array(s), r = 0; r < s; r++)
|
|
@@ -21,7 +21,7 @@ function J(t) {
|
|
|
21
21
|
return n.current == null ? void 0 : n.current(...e);
|
|
22
22
|
}, []);
|
|
23
23
|
}
|
|
24
|
-
var b = typeof document < "u" ?
|
|
24
|
+
var b = typeof document < "u" ? q : Q;
|
|
25
25
|
function D() {
|
|
26
26
|
return D = Object.assign ? Object.assign.bind() : function(t) {
|
|
27
27
|
for (var n = 1; n < arguments.length; n++) {
|
|
@@ -32,24 +32,24 @@ function D() {
|
|
|
32
32
|
return t;
|
|
33
33
|
}, D.apply(this, arguments);
|
|
34
34
|
}
|
|
35
|
-
let V = !1,
|
|
36
|
-
const
|
|
35
|
+
let V = !1, k = 0;
|
|
36
|
+
const W = () => (
|
|
37
37
|
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
38
38
|
// on <React 18
|
|
39
|
-
"floating-ui-" + Math.random().toString(36).slice(2, 6) +
|
|
39
|
+
"floating-ui-" + Math.random().toString(36).slice(2, 6) + k++
|
|
40
40
|
);
|
|
41
|
-
function
|
|
42
|
-
const [t, n] = o.useState(() => V ?
|
|
41
|
+
function _() {
|
|
42
|
+
const [t, n] = o.useState(() => V ? W() : void 0);
|
|
43
43
|
return b(() => {
|
|
44
|
-
t == null && n(
|
|
44
|
+
t == null && n(W());
|
|
45
45
|
}, []), o.useEffect(() => {
|
|
46
46
|
V = !0;
|
|
47
47
|
}, []), t;
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const ee = $.useId, B = ee || _;
|
|
50
50
|
let P;
|
|
51
51
|
process.env.NODE_ENV !== "production" && (P = /* @__PURE__ */ new Set());
|
|
52
|
-
function
|
|
52
|
+
function te() {
|
|
53
53
|
for (var t, n = arguments.length, s = new Array(n), e = 0; e < n; e++)
|
|
54
54
|
s[e] = arguments[e];
|
|
55
55
|
const r = "Floating UI: " + s.join(" ");
|
|
@@ -58,7 +58,7 @@ function ee() {
|
|
|
58
58
|
(l = P) == null || l.add(r), console.warn(r);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function ne() {
|
|
62
62
|
for (var t, n = arguments.length, s = new Array(n), e = 0; e < n; e++)
|
|
63
63
|
s[e] = arguments[e];
|
|
64
64
|
const r = "Floating UI: " + s.join(" ");
|
|
@@ -83,34 +83,34 @@ const me = /* @__PURE__ */ o.forwardRef(function(n, s) {
|
|
|
83
83
|
height: a = 7,
|
|
84
84
|
tipRadius: O = 0,
|
|
85
85
|
strokeWidth: d = 0,
|
|
86
|
-
staticOffset:
|
|
86
|
+
staticOffset: g,
|
|
87
87
|
stroke: h,
|
|
88
88
|
d: c,
|
|
89
89
|
style: {
|
|
90
|
-
transform:
|
|
90
|
+
transform: p,
|
|
91
91
|
...R
|
|
92
92
|
} = {},
|
|
93
93
|
...v
|
|
94
94
|
} = n;
|
|
95
|
-
process.env.NODE_ENV !== "production" && (s ||
|
|
96
|
-
const x =
|
|
95
|
+
process.env.NODE_ENV !== "production" && (s || te("The `ref` prop is required for `FloatingArrow`."));
|
|
96
|
+
const x = B(), [C, f] = o.useState(!1);
|
|
97
97
|
if (b(() => {
|
|
98
98
|
if (!r) return;
|
|
99
|
-
|
|
99
|
+
Z(r).direction === "rtl" && f(!0);
|
|
100
100
|
}, [r]), !r)
|
|
101
101
|
return null;
|
|
102
|
-
const [
|
|
103
|
-
let S =
|
|
102
|
+
const [m, F] = e.split("-"), M = m === "top" || m === "bottom";
|
|
103
|
+
let S = g;
|
|
104
104
|
(M && u != null && u.x || !M && u != null && u.y) && (S = null);
|
|
105
|
-
const E = d * 2, N = E / 2, A = i / 2 * (O / -8 + 1), T = a / 2 * O / 4, w = !!c,
|
|
106
|
-
let
|
|
107
|
-
S && C && (
|
|
108
|
-
const
|
|
105
|
+
const E = d * 2, N = E / 2, A = i / 2 * (O / -8 + 1), T = a / 2 * O / 4, w = !!c, U = S && F === "end" ? "bottom" : "top";
|
|
106
|
+
let j = S && F === "end" ? "right" : "left";
|
|
107
|
+
S && C && (j = F === "end" ? "left" : "right");
|
|
108
|
+
const H = (l == null ? void 0 : l.x) != null ? S || l.x : "", X = (l == null ? void 0 : l.y) != null ? S || l.y : "", y = c || "M0,0" + (" H" + i) + (" L" + (i - A) + "," + (a - T)) + (" Q" + i / 2 + "," + a + " " + A + "," + (a - T)) + " Z", Y = {
|
|
109
109
|
top: w ? "rotate(180deg)" : "",
|
|
110
110
|
left: w ? "rotate(90deg)" : "rotate(-90deg)",
|
|
111
111
|
bottom: w ? "" : "rotate(180deg)",
|
|
112
112
|
right: w ? "rotate(-90deg)" : "rotate(90deg)"
|
|
113
|
-
}[
|
|
113
|
+
}[m];
|
|
114
114
|
return /* @__PURE__ */ o.createElement("svg", D({}, v, {
|
|
115
115
|
"aria-hidden": !0,
|
|
116
116
|
ref: s,
|
|
@@ -120,10 +120,10 @@ const me = /* @__PURE__ */ o.forwardRef(function(n, s) {
|
|
|
120
120
|
style: {
|
|
121
121
|
position: "absolute",
|
|
122
122
|
pointerEvents: "none",
|
|
123
|
-
[
|
|
124
|
-
[
|
|
125
|
-
[
|
|
126
|
-
transform:
|
|
123
|
+
[j]: H,
|
|
124
|
+
[U]: X,
|
|
125
|
+
[m]: M || w ? "100%" : "calc(100% - " + E / 2 + "px)",
|
|
126
|
+
transform: [Y, p].filter((L) => !!L).join(" "),
|
|
127
127
|
...R
|
|
128
128
|
}
|
|
129
129
|
}), E > 0 && /* @__PURE__ */ o.createElement("path", {
|
|
@@ -131,10 +131,10 @@ const me = /* @__PURE__ */ o.forwardRef(function(n, s) {
|
|
|
131
131
|
fill: "none",
|
|
132
132
|
stroke: h,
|
|
133
133
|
strokeWidth: E + (c ? 0 : 1),
|
|
134
|
-
d:
|
|
134
|
+
d: y
|
|
135
135
|
}), /* @__PURE__ */ o.createElement("path", {
|
|
136
136
|
stroke: E && !c ? v.fill : "none",
|
|
137
|
-
d:
|
|
137
|
+
d: y
|
|
138
138
|
}), /* @__PURE__ */ o.createElement("clipPath", {
|
|
139
139
|
id: x
|
|
140
140
|
}, /* @__PURE__ */ o.createElement("rect", {
|
|
@@ -144,7 +144,7 @@ const me = /* @__PURE__ */ o.forwardRef(function(n, s) {
|
|
|
144
144
|
height: i
|
|
145
145
|
})));
|
|
146
146
|
});
|
|
147
|
-
function
|
|
147
|
+
function oe() {
|
|
148
148
|
const t = /* @__PURE__ */ new Map();
|
|
149
149
|
return {
|
|
150
150
|
emit(n, s) {
|
|
@@ -160,28 +160,28 @@ function ne() {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
const
|
|
163
|
+
const re = /* @__PURE__ */ o.createContext(null), se = /* @__PURE__ */ o.createContext(null), ce = () => {
|
|
164
164
|
var t;
|
|
165
|
-
return ((t = o.useContext(
|
|
166
|
-
},
|
|
167
|
-
function
|
|
165
|
+
return ((t = o.useContext(re)) == null ? void 0 : t.id) || null;
|
|
166
|
+
}, le = () => o.useContext(se);
|
|
167
|
+
function ie(t) {
|
|
168
168
|
const {
|
|
169
169
|
open: n = !1,
|
|
170
170
|
onOpenChange: s,
|
|
171
171
|
elements: e
|
|
172
|
-
} = t, r =
|
|
172
|
+
} = t, r = B(), l = o.useRef({}), [u] = o.useState(() => oe()), i = ce() != null;
|
|
173
173
|
if (process.env.NODE_ENV !== "production") {
|
|
174
174
|
const c = e.reference;
|
|
175
|
-
c && !I(c) &&
|
|
175
|
+
c && !I(c) && ne("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
|
176
176
|
}
|
|
177
|
-
const [a, O] = o.useState(e.reference), d =
|
|
178
|
-
l.current.openEvent = c ?
|
|
177
|
+
const [a, O] = o.useState(e.reference), d = K((c, p, R) => {
|
|
178
|
+
l.current.openEvent = c ? p : void 0, u.emit("openchange", {
|
|
179
179
|
open: c,
|
|
180
|
-
event:
|
|
180
|
+
event: p,
|
|
181
181
|
reason: R,
|
|
182
182
|
nested: i
|
|
183
|
-
}), s == null || s(c,
|
|
184
|
-
}),
|
|
183
|
+
}), s == null || s(c, p, R);
|
|
184
|
+
}), g = o.useMemo(() => ({
|
|
185
185
|
setPositionReference: O
|
|
186
186
|
}), []), h = o.useMemo(() => ({
|
|
187
187
|
reference: a || e.reference || null,
|
|
@@ -195,25 +195,25 @@ function le(t) {
|
|
|
195
195
|
elements: h,
|
|
196
196
|
events: u,
|
|
197
197
|
floatingId: r,
|
|
198
|
-
refs:
|
|
199
|
-
}), [n, d, h, u, r,
|
|
198
|
+
refs: g
|
|
199
|
+
}), [n, d, h, u, r, g]);
|
|
200
200
|
}
|
|
201
201
|
function ge(t) {
|
|
202
202
|
t === void 0 && (t = {});
|
|
203
203
|
const {
|
|
204
204
|
nodeId: n
|
|
205
|
-
} = t, s =
|
|
205
|
+
} = t, s = ie({
|
|
206
206
|
...t,
|
|
207
207
|
elements: {
|
|
208
208
|
reference: null,
|
|
209
209
|
floating: null,
|
|
210
210
|
...t.elements
|
|
211
211
|
}
|
|
212
|
-
}), e = t.rootContext || s, r = e.elements, [l, u] = o.useState(null), [i, a] = o.useState(null), d = (r == null ? void 0 : r.reference) || l,
|
|
212
|
+
}), e = t.rootContext || s, r = e.elements, [l, u] = o.useState(null), [i, a] = o.useState(null), d = (r == null ? void 0 : r.reference) || l, g = o.useRef(null), h = le();
|
|
213
213
|
b(() => {
|
|
214
|
-
d && (
|
|
214
|
+
d && (g.current = d);
|
|
215
215
|
}, [d]);
|
|
216
|
-
const c =
|
|
216
|
+
const c = z({
|
|
217
217
|
...t,
|
|
218
218
|
elements: {
|
|
219
219
|
...r,
|
|
@@ -221,23 +221,23 @@ function ge(t) {
|
|
|
221
221
|
reference: i
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
}),
|
|
225
|
-
const
|
|
224
|
+
}), p = o.useCallback((f) => {
|
|
225
|
+
const m = I(f) ? {
|
|
226
226
|
getBoundingClientRect: () => f.getBoundingClientRect(),
|
|
227
227
|
contextElement: f
|
|
228
228
|
} : f;
|
|
229
|
-
a(
|
|
229
|
+
a(m), c.refs.setReference(m);
|
|
230
230
|
}, [c.refs]), R = o.useCallback((f) => {
|
|
231
|
-
(I(f) || f === null) && (
|
|
231
|
+
(I(f) || f === null) && (g.current = f, u(f)), (I(c.refs.reference.current) || c.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
232
232
|
// `null` to support `positionReference` + an unstable `reference`
|
|
233
233
|
// callback ref.
|
|
234
234
|
f !== null && !I(f)) && c.refs.setReference(f);
|
|
235
235
|
}, [c.refs]), v = o.useMemo(() => ({
|
|
236
236
|
...c.refs,
|
|
237
237
|
setReference: R,
|
|
238
|
-
setPositionReference:
|
|
239
|
-
domReference:
|
|
240
|
-
}), [c.refs, R,
|
|
238
|
+
setPositionReference: p,
|
|
239
|
+
domReference: g
|
|
240
|
+
}), [c.refs, R, p]), x = o.useMemo(() => ({
|
|
241
241
|
...c.elements,
|
|
242
242
|
domReference: d
|
|
243
243
|
}), [c.elements, d]), C = o.useMemo(() => ({
|
|
@@ -249,7 +249,7 @@ function ge(t) {
|
|
|
249
249
|
}), [c, v, x, n, e]);
|
|
250
250
|
return b(() => {
|
|
251
251
|
e.dataRef.current.floatingContext = C;
|
|
252
|
-
const f = h == null ? void 0 : h.nodesRef.current.find((
|
|
252
|
+
const f = h == null ? void 0 : h.nodesRef.current.find((m) => m.id === n);
|
|
253
253
|
f && (f.context = C);
|
|
254
254
|
}), o.useMemo(() => ({
|
|
255
255
|
...c,
|
|
@@ -267,9 +267,9 @@ export {
|
|
|
267
267
|
Ce as offset,
|
|
268
268
|
Se as shift,
|
|
269
269
|
ge as useFloating,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
270
|
+
ce as useFloatingParentNodeId,
|
|
271
|
+
ie as useFloatingRootContext,
|
|
272
|
+
le as useFloatingTree,
|
|
273
|
+
B as useId
|
|
274
274
|
};
|
|
275
275
|
//# sourceMappingURL=annotorious-react.es13.js.map
|