@annotorious/react 3.1.1 → 3.1.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/annotorious-react.es10.js +5 -5
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js +8 -6
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js +266 -8
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js +7 -264
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js +195 -7
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +379 -185
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +13 -390
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js +127 -12
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js +7 -2
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +2 -33
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +19 -19
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es20.js +10 -405
- package/dist/annotorious-react.es20.js.map +1 -1
- package/dist/annotorious-react.es21.js +120 -123
- package/dist/annotorious-react.es21.js.map +1 -1
- package/dist/annotorious-react.es22.js +466 -2
- package/dist/annotorious-react.es22.js.map +1 -1
- package/dist/annotorious-react.es4.js +33 -33
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es5.js +22 -22
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es8.js +14 -14
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js +43 -43
- package/dist/annotorious-react.es9.js.map +1 -1
- package/package.json +4 -4
- package/dist/annotorious-react.es23.js +0 -5
- package/dist/annotorious-react.es23.js.map +0 -1
- package/dist/annotorious-react.es24.js +0 -10
- package/dist/annotorious-react.es24.js.map +0 -1
- package/dist/annotorious-react.es25.js +0 -5
- package/dist/annotorious-react.es25.js.map +0 -1
- package/dist/annotorious-react.es26.js +0 -14
- package/dist/annotorious-react.es26.js.map +0 -1
- package/dist/annotorious-react.es27.js +0 -129
- package/dist/annotorious-react.es27.js.map +0 -1
- package/dist/annotorious-react.es28.js +0 -469
- package/dist/annotorious-react.es28.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as m, useRef as u, useContext as p, useLayoutEffect as c, useImperativeHandle as d } from "react";
|
|
3
3
|
import l from "openseadragon";
|
|
4
|
-
import { OpenSeadragonAnnotatorContext as
|
|
5
|
-
const S = m((o,
|
|
6
|
-
const { className:
|
|
4
|
+
import { OpenSeadragonAnnotatorContext as g } from "./annotorious-react.es8.js";
|
|
5
|
+
const S = m((o, i) => {
|
|
6
|
+
const { className: s, options: t } = o, r = u(null), { viewer: f, setViewer: e } = p(g);
|
|
7
7
|
return c(() => {
|
|
8
8
|
if (r.current) {
|
|
9
9
|
const n = l({ ...t, element: r.current });
|
|
@@ -11,7 +11,7 @@ const S = m((o, s) => {
|
|
|
11
11
|
e && e(void 0), n.destroy();
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
}, [JSON.stringify(t)]), d(
|
|
14
|
+
}, [JSON.stringify(t)]), d(i, () => f), /* @__PURE__ */ a("div", { className: s, ref: r });
|
|
15
15
|
});
|
|
16
16
|
export {
|
|
17
17
|
S as OpenSeadragonViewer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es10.js","sources":["../src/openseadragon/OpenSeadragonViewer.tsx"],"sourcesContent":["import { forwardRef, useContext, useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { OpenSeadragonAnnotatorContext } from './OpenSeadragonAnnotator';\n\nexport interface OpenSeadragonViewerProps {\n\n className?: string;\n\n options: OpenSeadragon.Options;\n\n}\n\nexport const OpenSeadragonViewer = forwardRef<OpenSeadragon.Viewer, OpenSeadragonViewerProps>((props: OpenSeadragonViewerProps, ref) => {\n\n const { className, options } = props;\n\n const element = useRef<HTMLDivElement>(null);\n\n const { viewer, setViewer } = useContext(OpenSeadragonAnnotatorContext);\n\n useLayoutEffect(() => { \n if (element.current) {\n const v = OpenSeadragon({...options, element: element.current });\n\n // Checking for setViewer is just a convenience so we can\n // use this component also without an OpenSeadragonAnnotator\n if (setViewer)\n setViewer(v);\n\n return () => {\n if (setViewer)\n setViewer(undefined);\n\n v.destroy();\n }\n }\n }, [JSON.stringify(options)]);\n\n useImperativeHandle(ref, () => viewer);\n\n return (\n <div className={className} ref={element} />\n );\n\n});"],"names":["OpenSeadragonViewer","forwardRef","props","ref","className","options","element","useRef","viewer","setViewer","useContext","OpenSeadragonAnnotatorContext","useLayoutEffect","v","OpenSeadragon","useImperativeHandle","jsx"],"mappings":";;;;AAYO,MAAMA,IAAsBC,EAA2D,CAACC,GAAiCC,MAAQ;AAEhI,QAAA,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYH,GAEzBI,IAAUC,EAAuB,IAAI,GAErC,EAAE,QAAAC,GAAQ,WAAAC,MAAcC,EAAWC,CAA6B;AAEtE,SAAAC,EAAgB,MAAM;AACpB,QAAIN,EAAQ,SAAS;AACb,YAAAO,IAAIC,EAAc,EAAC,GAAGT,GAAS,SAASC,EAAQ,SAAS;AAI3D,aAAAG,KACFA,EAAUI,CAAC,GAEN,MAAM;AACP,QAAAJ,KACFA,EAAU,MAAS,GAErBI,EAAE,QAAQ;AAAA,MACZ;AAAA,IAAA;AAAA,KAED,CAAC,KAAK,UAAUR,CAAO,CAAC,CAAC,GAERU,EAAAZ,GAAK,MAAMK,CAAM,
|
|
1
|
+
{"version":3,"file":"annotorious-react.es10.js","sources":["../src/openseadragon/OpenSeadragonViewer.tsx"],"sourcesContent":["import { forwardRef, useContext, useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { OpenSeadragonAnnotatorContext } from './OpenSeadragonAnnotator';\n\nexport interface OpenSeadragonViewerProps {\n\n className?: string;\n\n options: OpenSeadragon.Options;\n\n}\n\nexport const OpenSeadragonViewer = forwardRef<OpenSeadragon.Viewer, OpenSeadragonViewerProps>((props: OpenSeadragonViewerProps, ref) => {\n\n const { className, options } = props;\n\n const element = useRef<HTMLDivElement>(null);\n\n const { viewer, setViewer } = useContext(OpenSeadragonAnnotatorContext);\n\n useLayoutEffect(() => { \n if (element.current) {\n const v = OpenSeadragon({...options, element: element.current });\n\n // Checking for setViewer is just a convenience so we can\n // use this component also without an OpenSeadragonAnnotator\n if (setViewer)\n setViewer(v);\n\n return () => {\n if (setViewer)\n setViewer(undefined);\n\n v.destroy();\n }\n }\n }, [JSON.stringify(options)]);\n\n useImperativeHandle(ref, () => viewer);\n\n return (\n <div className={className} ref={element} />\n );\n\n});"],"names":["OpenSeadragonViewer","forwardRef","props","ref","className","options","element","useRef","viewer","setViewer","useContext","OpenSeadragonAnnotatorContext","useLayoutEffect","v","OpenSeadragon","useImperativeHandle","jsx"],"mappings":";;;;AAYO,MAAMA,IAAsBC,EAA2D,CAACC,GAAiCC,MAAQ;AAEhI,QAAA,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYH,GAEzBI,IAAUC,EAAuB,IAAI,GAErC,EAAE,QAAAC,GAAQ,WAAAC,MAAcC,EAAWC,CAA6B;AAEtE,SAAAC,EAAgB,MAAM;AACpB,QAAIN,EAAQ,SAAS;AACb,YAAAO,IAAIC,EAAc,EAAC,GAAGT,GAAS,SAASC,EAAQ,SAAS;AAI3D,aAAAG,KACFA,EAAUI,CAAC,GAEN,MAAM;AACP,QAAAJ,KACFA,EAAU,MAAS,GAErBI,EAAE,QAAQ;AAAA,MACZ;AAAA,IAAA;AAAA,KAED,CAAC,KAAK,UAAUR,CAAO,CAAC,CAAC,GAERU,EAAAZ,GAAK,MAAMK,CAAM,GAGlC,gBAAAQ,EAAA,OAAA,EAAI,WAAAZ,GAAsB,KAAKE,EAAS,CAAA;AAG7C,CAAC;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useState as o, useRef as c, useEffect as s } from "react";
|
|
2
|
+
const i = (e, t) => {
|
|
3
|
+
const [r, n] = o(e), u = c(void 0);
|
|
4
|
+
return s(() => (u.current = setTimeout(() => n(e), t), () => {
|
|
5
|
+
clearTimeout(u.current);
|
|
6
|
+
}), [e, t]), r;
|
|
7
|
+
};
|
|
6
8
|
export {
|
|
7
|
-
|
|
9
|
+
i as useDebounce
|
|
8
10
|
};
|
|
9
11
|
//# sourceMappingURL=annotorious-react.es11.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es11.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es11.js","sources":["../src/useDebounce.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nexport const useDebounce = (value: any, delay: number) => {\n const [debouncedValue, setDebouncedValue] = useState<any>(value);\n\n const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n useEffect(() => {\n timerRef.current = \n setTimeout(() => setDebouncedValue(value), delay);\n\n return () => {\n clearTimeout(timerRef.current);\n };\n }, [value, delay]);\n\n return debouncedValue;\n}"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","useState","timerRef","useRef","useEffect"],"mappings":";AAEa,MAAAA,IAAc,CAACC,GAAYC,MAAkB;AACxD,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAcJ,CAAK,GAEzDK,IAAWC,EAAsC,MAAS;AAEhE,SAAAC,EAAU,OACRF,EAAS,UACP,WAAW,MAAMF,EAAkBH,CAAK,GAAGC,CAAK,GAE3C,MAAM;AACX,iBAAaI,EAAS,OAAO;AAAA,EAC/B,IACC,CAACL,GAAOC,CAAK,CAAC,GAEVC;AACT;"}
|
|
@@ -1,11 +1,269 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import { useLayoutEffect as k, useEffect as q } from "react";
|
|
3
|
+
import { jsxs as Q, jsx as O } from "react/jsx-runtime";
|
|
4
|
+
import { getComputedStyle as Z, isElement as F } from "./annotorious-react.es17.js";
|
|
5
|
+
import { getOverflowAncestors as Ce } from "./annotorious-react.es17.js";
|
|
6
|
+
import "react-dom";
|
|
7
|
+
import { useFloating as z } from "./annotorious-react.es14.js";
|
|
8
|
+
import { arrow as we, flip as Ee, inline as Se, offset as Ie, shift as Fe } from "./annotorious-react.es14.js";
|
|
9
|
+
const $ = {
|
|
10
|
+
...s
|
|
11
|
+
}, G = $.useInsertionEffect, J = G || ((t) => t());
|
|
12
|
+
function K(t) {
|
|
13
|
+
const n = s.useRef(() => {
|
|
14
|
+
if (process.env.NODE_ENV !== "production")
|
|
15
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
16
|
+
});
|
|
17
|
+
return J(() => {
|
|
18
|
+
n.current = t;
|
|
19
|
+
}), s.useCallback(function() {
|
|
20
|
+
for (var c = arguments.length, e = new Array(c), o = 0; o < c; o++)
|
|
21
|
+
e[o] = arguments[o];
|
|
22
|
+
return n.current == null ? void 0 : n.current(...e);
|
|
23
|
+
}, []);
|
|
24
|
+
}
|
|
25
|
+
var M = typeof document < "u" ? k : q;
|
|
26
|
+
let y = !1, _ = 0;
|
|
27
|
+
const W = () => (
|
|
28
|
+
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
29
|
+
// on <React 18
|
|
30
|
+
"floating-ui-" + Math.random().toString(36).slice(2, 6) + _++
|
|
31
|
+
);
|
|
32
|
+
function ee() {
|
|
33
|
+
const [t, n] = s.useState(() => y ? W() : void 0);
|
|
34
|
+
return M(() => {
|
|
35
|
+
t == null && n(W());
|
|
36
|
+
}, []), s.useEffect(() => {
|
|
37
|
+
y = !0;
|
|
38
|
+
}, []), t;
|
|
39
|
+
}
|
|
40
|
+
const te = $.useId, B = te || ee;
|
|
41
|
+
let P;
|
|
42
|
+
process.env.NODE_ENV !== "production" && (P = /* @__PURE__ */ new Set());
|
|
43
|
+
function ne() {
|
|
44
|
+
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++)
|
|
45
|
+
c[e] = arguments[e];
|
|
46
|
+
const o = "Floating UI: " + c.join(" ");
|
|
47
|
+
if (!((t = P) != null && t.has(o))) {
|
|
48
|
+
var i;
|
|
49
|
+
(i = P) == null || i.add(o), console.warn(o);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function oe() {
|
|
53
|
+
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++)
|
|
54
|
+
c[e] = arguments[e];
|
|
55
|
+
const o = "Floating UI: " + c.join(" ");
|
|
56
|
+
if (!((t = P) != null && t.has(o))) {
|
|
57
|
+
var i;
|
|
58
|
+
(i = P) == null || i.add(o), console.error(o);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const pe = /* @__PURE__ */ s.forwardRef(function(n, c) {
|
|
62
|
+
const {
|
|
63
|
+
context: {
|
|
64
|
+
placement: e,
|
|
65
|
+
elements: {
|
|
66
|
+
floating: o
|
|
67
|
+
},
|
|
68
|
+
middlewareData: {
|
|
69
|
+
arrow: i,
|
|
70
|
+
shift: a
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
width: l = 14,
|
|
74
|
+
height: u = 7,
|
|
75
|
+
tipRadius: I = 0,
|
|
76
|
+
strokeWidth: d = 0,
|
|
77
|
+
staticOffset: g,
|
|
78
|
+
stroke: h,
|
|
79
|
+
d: r,
|
|
80
|
+
style: {
|
|
81
|
+
transform: p,
|
|
82
|
+
...R
|
|
83
|
+
} = {},
|
|
84
|
+
...x
|
|
85
|
+
} = n;
|
|
86
|
+
process.env.NODE_ENV !== "production" && (c || ne("The `ref` prop is required for `FloatingArrow`."));
|
|
87
|
+
const C = B(), [E, f] = s.useState(!1);
|
|
88
|
+
if (M(() => {
|
|
89
|
+
if (!o) return;
|
|
90
|
+
Z(o).direction === "rtl" && f(!0);
|
|
91
|
+
}, [o]), !o)
|
|
92
|
+
return null;
|
|
93
|
+
const [m, b] = e.split("-"), D = m === "top" || m === "bottom";
|
|
94
|
+
let S = g;
|
|
95
|
+
(D && a != null && a.x || !D && a != null && a.y) && (S = null);
|
|
96
|
+
const v = d * 2, N = v / 2, A = l / 2 * (I / -8 + 1), T = u / 2 * I / 4, w = !!r, U = S && b === "end" ? "bottom" : "top";
|
|
97
|
+
let L = S && b === "end" ? "right" : "left";
|
|
98
|
+
S && E && (L = b === "end" ? "left" : "right");
|
|
99
|
+
const H = (i == null ? void 0 : i.x) != null ? S || i.x : "", X = (i == null ? void 0 : i.y) != null ? S || i.y : "", V = r || "M0,0" + (" H" + l) + (" L" + (l - A) + "," + (u - T)) + (" Q" + l / 2 + "," + u + " " + A + "," + (u - T)) + " Z", Y = {
|
|
100
|
+
top: w ? "rotate(180deg)" : "",
|
|
101
|
+
left: w ? "rotate(90deg)" : "rotate(-90deg)",
|
|
102
|
+
bottom: w ? "" : "rotate(180deg)",
|
|
103
|
+
right: w ? "rotate(-90deg)" : "rotate(90deg)"
|
|
104
|
+
}[m];
|
|
105
|
+
return /* @__PURE__ */ Q("svg", {
|
|
106
|
+
...x,
|
|
107
|
+
"aria-hidden": !0,
|
|
108
|
+
ref: c,
|
|
109
|
+
width: w ? l : l + v,
|
|
110
|
+
height: l,
|
|
111
|
+
viewBox: "0 0 " + l + " " + (u > l ? u : l),
|
|
112
|
+
style: {
|
|
113
|
+
position: "absolute",
|
|
114
|
+
pointerEvents: "none",
|
|
115
|
+
[L]: H,
|
|
116
|
+
[U]: X,
|
|
117
|
+
[m]: D || w ? "100%" : "calc(100% - " + v / 2 + "px)",
|
|
118
|
+
transform: [Y, p].filter((j) => !!j).join(" "),
|
|
119
|
+
...R
|
|
120
|
+
},
|
|
121
|
+
children: [v > 0 && /* @__PURE__ */ O("path", {
|
|
122
|
+
clipPath: "url(#" + C + ")",
|
|
123
|
+
fill: "none",
|
|
124
|
+
stroke: h,
|
|
125
|
+
strokeWidth: v + (r ? 0 : 1),
|
|
126
|
+
d: V
|
|
127
|
+
}), /* @__PURE__ */ O("path", {
|
|
128
|
+
stroke: v && !r ? x.fill : "none",
|
|
129
|
+
d: V
|
|
130
|
+
}), /* @__PURE__ */ O("clipPath", {
|
|
131
|
+
id: C,
|
|
132
|
+
children: /* @__PURE__ */ O("rect", {
|
|
133
|
+
x: -N,
|
|
134
|
+
y: N * (w ? -1 : 1),
|
|
135
|
+
width: l + v,
|
|
136
|
+
height: l
|
|
137
|
+
})
|
|
138
|
+
})]
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
function re() {
|
|
142
|
+
const t = /* @__PURE__ */ new Map();
|
|
143
|
+
return {
|
|
144
|
+
emit(n, c) {
|
|
145
|
+
var e;
|
|
146
|
+
(e = t.get(n)) == null || e.forEach((o) => o(c));
|
|
147
|
+
},
|
|
148
|
+
on(n, c) {
|
|
149
|
+
t.set(n, [...t.get(n) || [], c]);
|
|
150
|
+
},
|
|
151
|
+
off(n, c) {
|
|
152
|
+
var e;
|
|
153
|
+
t.set(n, ((e = t.get(n)) == null ? void 0 : e.filter((o) => o !== c)) || []);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const se = /* @__PURE__ */ s.createContext(null), ce = /* @__PURE__ */ s.createContext(null), ie = () => {
|
|
158
|
+
var t;
|
|
159
|
+
return ((t = s.useContext(se)) == null ? void 0 : t.id) || null;
|
|
160
|
+
}, le = () => s.useContext(ce);
|
|
161
|
+
function fe(t) {
|
|
162
|
+
const {
|
|
163
|
+
open: n = !1,
|
|
164
|
+
onOpenChange: c,
|
|
165
|
+
elements: e
|
|
166
|
+
} = t, o = B(), i = s.useRef({}), [a] = s.useState(() => re()), l = ie() != null;
|
|
167
|
+
if (process.env.NODE_ENV !== "production") {
|
|
168
|
+
const r = e.reference;
|
|
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
|
+
}
|
|
171
|
+
const [u, I] = s.useState(e.reference), d = K((r, p, R) => {
|
|
172
|
+
i.current.openEvent = r ? p : void 0, a.emit("openchange", {
|
|
173
|
+
open: r,
|
|
174
|
+
event: p,
|
|
175
|
+
reason: R,
|
|
176
|
+
nested: l
|
|
177
|
+
}), c == null || c(r, p, R);
|
|
178
|
+
}), g = s.useMemo(() => ({
|
|
179
|
+
setPositionReference: I
|
|
180
|
+
}), []), h = s.useMemo(() => ({
|
|
181
|
+
reference: u || e.reference || null,
|
|
182
|
+
floating: e.floating || null,
|
|
183
|
+
domReference: e.reference
|
|
184
|
+
}), [u, e.reference, e.floating]);
|
|
185
|
+
return s.useMemo(() => ({
|
|
186
|
+
dataRef: i,
|
|
187
|
+
open: n,
|
|
188
|
+
onOpenChange: d,
|
|
189
|
+
elements: h,
|
|
190
|
+
events: a,
|
|
191
|
+
floatingId: o,
|
|
192
|
+
refs: g
|
|
193
|
+
}), [n, d, h, a, o, g]);
|
|
194
|
+
}
|
|
195
|
+
function he(t) {
|
|
196
|
+
t === void 0 && (t = {});
|
|
197
|
+
const {
|
|
198
|
+
nodeId: n
|
|
199
|
+
} = t, c = fe({
|
|
200
|
+
...t,
|
|
201
|
+
elements: {
|
|
202
|
+
reference: null,
|
|
203
|
+
floating: null,
|
|
204
|
+
...t.elements
|
|
205
|
+
}
|
|
206
|
+
}), e = t.rootContext || c, o = e.elements, [i, a] = s.useState(null), [l, u] = s.useState(null), d = (o == null ? void 0 : o.domReference) || i, g = s.useRef(null), h = le();
|
|
207
|
+
M(() => {
|
|
208
|
+
d && (g.current = d);
|
|
209
|
+
}, [d]);
|
|
210
|
+
const r = z({
|
|
211
|
+
...t,
|
|
212
|
+
elements: {
|
|
213
|
+
...o,
|
|
214
|
+
...l && {
|
|
215
|
+
reference: l
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}), p = s.useCallback((f) => {
|
|
219
|
+
const m = F(f) ? {
|
|
220
|
+
getBoundingClientRect: () => f.getBoundingClientRect(),
|
|
221
|
+
contextElement: f
|
|
222
|
+
} : f;
|
|
223
|
+
u(m), r.refs.setReference(m);
|
|
224
|
+
}, [r.refs]), R = s.useCallback((f) => {
|
|
225
|
+
(F(f) || f === null) && (g.current = f, a(f)), (F(r.refs.reference.current) || r.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
226
|
+
// `null` to support `positionReference` + an unstable `reference`
|
|
227
|
+
// callback ref.
|
|
228
|
+
f !== null && !F(f)) && r.refs.setReference(f);
|
|
229
|
+
}, [r.refs]), x = s.useMemo(() => ({
|
|
230
|
+
...r.refs,
|
|
231
|
+
setReference: R,
|
|
232
|
+
setPositionReference: p,
|
|
233
|
+
domReference: g
|
|
234
|
+
}), [r.refs, R, p]), C = s.useMemo(() => ({
|
|
235
|
+
...r.elements,
|
|
236
|
+
domReference: d
|
|
237
|
+
}), [r.elements, d]), E = s.useMemo(() => ({
|
|
238
|
+
...r,
|
|
239
|
+
...e,
|
|
240
|
+
refs: x,
|
|
241
|
+
elements: C,
|
|
242
|
+
nodeId: n
|
|
243
|
+
}), [r, x, C, n, e]);
|
|
244
|
+
return M(() => {
|
|
245
|
+
e.dataRef.current.floatingContext = E;
|
|
246
|
+
const f = h == null ? void 0 : h.nodesRef.current.find((m) => m.id === n);
|
|
247
|
+
f && (f.context = E);
|
|
248
|
+
}), s.useMemo(() => ({
|
|
249
|
+
...r,
|
|
250
|
+
context: E,
|
|
251
|
+
refs: x,
|
|
252
|
+
elements: C
|
|
253
|
+
}), [r, x, C, E]);
|
|
254
|
+
}
|
|
8
255
|
export {
|
|
9
|
-
|
|
256
|
+
pe as FloatingArrow,
|
|
257
|
+
we as arrow,
|
|
258
|
+
Ee as flip,
|
|
259
|
+
Ce as getOverflowAncestors,
|
|
260
|
+
Se as inline,
|
|
261
|
+
Ie as offset,
|
|
262
|
+
Fe as shift,
|
|
263
|
+
he as useFloating,
|
|
264
|
+
ie as useFloatingParentNodeId,
|
|
265
|
+
fe as useFloatingRootContext,
|
|
266
|
+
le as useFloatingTree,
|
|
267
|
+
B as useId
|
|
10
268
|
};
|
|
11
269
|
//# sourceMappingURL=annotorious-react.es12.js.map
|