@annotorious/react
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -1,7 +0,7 @@ | ||
import { j as a } from "./annotorious-react.es11.js"; | ||
import { jsx as a } from "react/jsx-runtime"; | ||
import { forwardRef as m, useRef as u, useContext as p, useLayoutEffect as c, useImperativeHandle as d } from "react"; | ||
import l from "openseadragon"; | ||
import { OpenSeadragonAnnotatorContext as x } from "./annotorious-react.es8.js"; | ||
const S = m((o, s) => { | ||
const { className: i, options: t } = o, r = u(null), { viewer: f, setViewer: e } = p(x); | ||
import { OpenSeadragonAnnotatorContext as g } from "./annotorious-react.es8.js"; | ||
const S = m((o, i) => { | ||
const { className: s, options: t } = o, r = u(null), { viewer: f, setViewer: e } = p(g); | ||
return c(() => { | ||
@@ -14,3 +14,3 @@ if (r.current) { | ||
} | ||
}, [JSON.stringify(t)]), d(s, () => f), /* @__PURE__ */ a.jsx("div", { className: i, ref: r }); | ||
}, [JSON.stringify(t)]), d(i, () => f), /* @__PURE__ */ a("div", { className: s, ref: r }); | ||
}); | ||
@@ -17,0 +17,0 @@ export { |
@@ -1,9 +0,11 @@ | ||
import { __module as e } from "./annotorious-react.es18.js"; | ||
import { __require as r } from "./annotorious-react.es19.js"; | ||
import { __require as o } from "./annotorious-react.es20.js"; | ||
process.env.NODE_ENV === "production" ? e.exports = r() : e.exports = o(); | ||
var m = e.exports; | ||
import { useState as o, useRef as c, useEffect as s } from "react"; | ||
const i = (e, t) => { | ||
const [r, n] = o(e), u = c(void 0); | ||
return s(() => (u.current = setTimeout(() => n(e), t), () => { | ||
clearTimeout(u.current); | ||
}), [e, t]), r; | ||
}; | ||
export { | ||
m as j | ||
i as useDebounce | ||
}; | ||
//# sourceMappingURL=annotorious-react.es11.js.map |
@@ -1,11 +0,269 @@ | ||
import { useState as o, useRef as c, useEffect as s } from "react"; | ||
const i = (e, t) => { | ||
const [r, n] = o(e), u = c(void 0); | ||
return s(() => (u.current = setTimeout(() => n(e), t), () => { | ||
clearTimeout(u.current); | ||
}), [e, t]), r; | ||
}; | ||
import * as s from "react"; | ||
import { useLayoutEffect as k, useEffect as q } from "react"; | ||
import { jsxs as Q, jsx as O } from "react/jsx-runtime"; | ||
import { getComputedStyle as Z, isElement as F } from "./annotorious-react.es17.js"; | ||
import { getOverflowAncestors as Ce } from "./annotorious-react.es17.js"; | ||
import "react-dom"; | ||
import { useFloating as z } from "./annotorious-react.es14.js"; | ||
import { arrow as we, flip as Ee, inline as Se, offset as Ie, shift as Fe } from "./annotorious-react.es14.js"; | ||
const $ = { | ||
...s | ||
}, G = $.useInsertionEffect, J = G || ((t) => t()); | ||
function K(t) { | ||
const n = s.useRef(() => { | ||
if (process.env.NODE_ENV !== "production") | ||
throw new Error("Cannot call an event handler while rendering."); | ||
}); | ||
return J(() => { | ||
n.current = t; | ||
}), s.useCallback(function() { | ||
for (var c = arguments.length, e = new Array(c), o = 0; o < c; o++) | ||
e[o] = arguments[o]; | ||
return n.current == null ? void 0 : n.current(...e); | ||
}, []); | ||
} | ||
var M = typeof document < "u" ? k : q; | ||
let y = !1, _ = 0; | ||
const W = () => ( | ||
// Ensure the id is unique with multiple independent versions of Floating UI | ||
// on <React 18 | ||
"floating-ui-" + Math.random().toString(36).slice(2, 6) + _++ | ||
); | ||
function ee() { | ||
const [t, n] = s.useState(() => y ? W() : void 0); | ||
return M(() => { | ||
t == null && n(W()); | ||
}, []), s.useEffect(() => { | ||
y = !0; | ||
}, []), t; | ||
} | ||
const te = $.useId, B = te || ee; | ||
let P; | ||
process.env.NODE_ENV !== "production" && (P = /* @__PURE__ */ new Set()); | ||
function ne() { | ||
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++) | ||
c[e] = arguments[e]; | ||
const o = "Floating UI: " + c.join(" "); | ||
if (!((t = P) != null && t.has(o))) { | ||
var i; | ||
(i = P) == null || i.add(o), console.warn(o); | ||
} | ||
} | ||
function oe() { | ||
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++) | ||
c[e] = arguments[e]; | ||
const o = "Floating UI: " + c.join(" "); | ||
if (!((t = P) != null && t.has(o))) { | ||
var i; | ||
(i = P) == null || i.add(o), console.error(o); | ||
} | ||
} | ||
const pe = /* @__PURE__ */ s.forwardRef(function(n, c) { | ||
const { | ||
context: { | ||
placement: e, | ||
elements: { | ||
floating: o | ||
}, | ||
middlewareData: { | ||
arrow: i, | ||
shift: a | ||
} | ||
}, | ||
width: l = 14, | ||
height: u = 7, | ||
tipRadius: I = 0, | ||
strokeWidth: d = 0, | ||
staticOffset: g, | ||
stroke: h, | ||
d: r, | ||
style: { | ||
transform: p, | ||
...R | ||
} = {}, | ||
...x | ||
} = n; | ||
process.env.NODE_ENV !== "production" && (c || ne("The `ref` prop is required for `FloatingArrow`.")); | ||
const C = B(), [E, f] = s.useState(!1); | ||
if (M(() => { | ||
if (!o) return; | ||
Z(o).direction === "rtl" && f(!0); | ||
}, [o]), !o) | ||
return null; | ||
const [m, b] = e.split("-"), D = m === "top" || m === "bottom"; | ||
let S = g; | ||
(D && a != null && a.x || !D && a != null && a.y) && (S = null); | ||
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"; | ||
let L = S && b === "end" ? "right" : "left"; | ||
S && E && (L = b === "end" ? "left" : "right"); | ||
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 = { | ||
top: w ? "rotate(180deg)" : "", | ||
left: w ? "rotate(90deg)" : "rotate(-90deg)", | ||
bottom: w ? "" : "rotate(180deg)", | ||
right: w ? "rotate(-90deg)" : "rotate(90deg)" | ||
}[m]; | ||
return /* @__PURE__ */ Q("svg", { | ||
...x, | ||
"aria-hidden": !0, | ||
ref: c, | ||
width: w ? l : l + v, | ||
height: l, | ||
viewBox: "0 0 " + l + " " + (u > l ? u : l), | ||
style: { | ||
position: "absolute", | ||
pointerEvents: "none", | ||
[L]: H, | ||
[U]: X, | ||
[m]: D || w ? "100%" : "calc(100% - " + v / 2 + "px)", | ||
transform: [Y, p].filter((j) => !!j).join(" "), | ||
...R | ||
}, | ||
children: [v > 0 && /* @__PURE__ */ O("path", { | ||
clipPath: "url(#" + C + ")", | ||
fill: "none", | ||
stroke: h, | ||
strokeWidth: v + (r ? 0 : 1), | ||
d: V | ||
}), /* @__PURE__ */ O("path", { | ||
stroke: v && !r ? x.fill : "none", | ||
d: V | ||
}), /* @__PURE__ */ O("clipPath", { | ||
id: C, | ||
children: /* @__PURE__ */ O("rect", { | ||
x: -N, | ||
y: N * (w ? -1 : 1), | ||
width: l + v, | ||
height: l | ||
}) | ||
})] | ||
}); | ||
}); | ||
function re() { | ||
const t = /* @__PURE__ */ new Map(); | ||
return { | ||
emit(n, c) { | ||
var e; | ||
(e = t.get(n)) == null || e.forEach((o) => o(c)); | ||
}, | ||
on(n, c) { | ||
t.set(n, [...t.get(n) || [], c]); | ||
}, | ||
off(n, c) { | ||
var e; | ||
t.set(n, ((e = t.get(n)) == null ? void 0 : e.filter((o) => o !== c)) || []); | ||
} | ||
}; | ||
} | ||
const se = /* @__PURE__ */ s.createContext(null), ce = /* @__PURE__ */ s.createContext(null), ie = () => { | ||
var t; | ||
return ((t = s.useContext(se)) == null ? void 0 : t.id) || null; | ||
}, le = () => s.useContext(ce); | ||
function fe(t) { | ||
const { | ||
open: n = !1, | ||
onOpenChange: c, | ||
elements: e | ||
} = t, o = B(), i = s.useRef({}), [a] = s.useState(() => re()), l = ie() != null; | ||
if (process.env.NODE_ENV !== "production") { | ||
const r = e.reference; | ||
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."); | ||
} | ||
const [u, I] = s.useState(e.reference), d = K((r, p, R) => { | ||
i.current.openEvent = r ? p : void 0, a.emit("openchange", { | ||
open: r, | ||
event: p, | ||
reason: R, | ||
nested: l | ||
}), c == null || c(r, p, R); | ||
}), g = s.useMemo(() => ({ | ||
setPositionReference: I | ||
}), []), h = s.useMemo(() => ({ | ||
reference: u || e.reference || null, | ||
floating: e.floating || null, | ||
domReference: e.reference | ||
}), [u, e.reference, e.floating]); | ||
return s.useMemo(() => ({ | ||
dataRef: i, | ||
open: n, | ||
onOpenChange: d, | ||
elements: h, | ||
events: a, | ||
floatingId: o, | ||
refs: g | ||
}), [n, d, h, a, o, g]); | ||
} | ||
function he(t) { | ||
t === void 0 && (t = {}); | ||
const { | ||
nodeId: n | ||
} = t, c = fe({ | ||
...t, | ||
elements: { | ||
reference: null, | ||
floating: null, | ||
...t.elements | ||
} | ||
}), 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(); | ||
M(() => { | ||
d && (g.current = d); | ||
}, [d]); | ||
const r = z({ | ||
...t, | ||
elements: { | ||
...o, | ||
...l && { | ||
reference: l | ||
} | ||
} | ||
}), p = s.useCallback((f) => { | ||
const m = F(f) ? { | ||
getBoundingClientRect: () => f.getBoundingClientRect(), | ||
contextElement: f | ||
} : f; | ||
u(m), r.refs.setReference(m); | ||
}, [r.refs]), R = s.useCallback((f) => { | ||
(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 | ||
// `null` to support `positionReference` + an unstable `reference` | ||
// callback ref. | ||
f !== null && !F(f)) && r.refs.setReference(f); | ||
}, [r.refs]), x = s.useMemo(() => ({ | ||
...r.refs, | ||
setReference: R, | ||
setPositionReference: p, | ||
domReference: g | ||
}), [r.refs, R, p]), C = s.useMemo(() => ({ | ||
...r.elements, | ||
domReference: d | ||
}), [r.elements, d]), E = s.useMemo(() => ({ | ||
...r, | ||
...e, | ||
refs: x, | ||
elements: C, | ||
nodeId: n | ||
}), [r, x, C, n, e]); | ||
return M(() => { | ||
e.dataRef.current.floatingContext = E; | ||
const f = h == null ? void 0 : h.nodesRef.current.find((m) => m.id === n); | ||
f && (f.context = E); | ||
}), s.useMemo(() => ({ | ||
...r, | ||
context: E, | ||
refs: x, | ||
elements: C | ||
}), [r, x, C, E]); | ||
} | ||
export { | ||
i as useDebounce | ||
pe as FloatingArrow, | ||
we as arrow, | ||
Ee as flip, | ||
Ce as getOverflowAncestors, | ||
Se as inline, | ||
Ie as offset, | ||
Fe as shift, | ||
he as useFloating, | ||
ie as useFloatingParentNodeId, | ||
fe as useFloatingRootContext, | ||
le as useFloatingTree, | ||
B as useId | ||
}; | ||
//# sourceMappingURL=annotorious-react.es12.js.map |
@@ -1,269 +0,12 @@ | ||
import * as s from "react"; | ||
import { useLayoutEffect as k, useEffect as q } from "react"; | ||
import { j as F } from "./annotorious-react.es11.js"; | ||
import { getComputedStyle as Q, isElement as P } from "./annotorious-react.es21.js"; | ||
import { getOverflowAncestors as xe } from "./annotorious-react.es21.js"; | ||
import "react-dom"; | ||
import { useFloating as Z } from "./annotorious-react.es15.js"; | ||
import { arrow as ve, flip as we, inline as Ee, offset as Se, shift as Ie } from "./annotorious-react.es15.js"; | ||
const $ = { | ||
...s | ||
}, z = $.useInsertionEffect, G = z || ((t) => t()); | ||
function J(t) { | ||
const n = s.useRef(() => { | ||
if (process.env.NODE_ENV !== "production") | ||
throw new Error("Cannot call an event handler while rendering."); | ||
}); | ||
return G(() => { | ||
n.current = t; | ||
}), s.useCallback(function() { | ||
for (var c = arguments.length, e = new Array(c), o = 0; o < c; o++) | ||
e[o] = arguments[o]; | ||
return n.current == null ? void 0 : n.current(...e); | ||
}, []); | ||
} | ||
var M = typeof document < "u" ? k : q; | ||
let y = !1, K = 0; | ||
const W = () => ( | ||
// Ensure the id is unique with multiple independent versions of Floating UI | ||
// on <React 18 | ||
"floating-ui-" + Math.random().toString(36).slice(2, 6) + K++ | ||
); | ||
function _() { | ||
const [t, n] = s.useState(() => y ? W() : void 0); | ||
return M(() => { | ||
t == null && n(W()); | ||
}, []), s.useEffect(() => { | ||
y = !0; | ||
}, []), t; | ||
} | ||
const ee = $.useId, B = ee || _; | ||
let O; | ||
process.env.NODE_ENV !== "production" && (O = /* @__PURE__ */ new Set()); | ||
function te() { | ||
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++) | ||
c[e] = arguments[e]; | ||
const o = "Floating UI: " + c.join(" "); | ||
if (!((t = O) != null && t.has(o))) { | ||
var i; | ||
(i = O) == null || i.add(o), console.warn(o); | ||
const i = (e) => ({ | ||
length: 1, | ||
item: (t) => t === 0 ? e : void 0, | ||
[Symbol.iterator]: function* () { | ||
for (let t = 0; t < this.length; t++) | ||
yield this.item(t); | ||
} | ||
} | ||
function ne() { | ||
for (var t, n = arguments.length, c = new Array(n), e = 0; e < n; e++) | ||
c[e] = arguments[e]; | ||
const o = "Floating UI: " + c.join(" "); | ||
if (!((t = O) != null && t.has(o))) { | ||
var i; | ||
(i = O) == null || i.add(o), console.error(o); | ||
} | ||
} | ||
const ge = /* @__PURE__ */ s.forwardRef(function(n, c) { | ||
const { | ||
context: { | ||
placement: e, | ||
elements: { | ||
floating: o | ||
}, | ||
middlewareData: { | ||
arrow: i, | ||
shift: a | ||
} | ||
}, | ||
width: l = 14, | ||
height: u = 7, | ||
tipRadius: I = 0, | ||
strokeWidth: d = 0, | ||
staticOffset: g, | ||
stroke: h, | ||
d: r, | ||
style: { | ||
transform: p, | ||
...R | ||
} = {}, | ||
...x | ||
} = n; | ||
process.env.NODE_ENV !== "production" && (c || te("The `ref` prop is required for `FloatingArrow`.")); | ||
const C = B(), [E, f] = s.useState(!1); | ||
if (M(() => { | ||
if (!o) return; | ||
Q(o).direction === "rtl" && f(!0); | ||
}, [o]), !o) | ||
return null; | ||
const [m, b] = e.split("-"), j = m === "top" || m === "bottom"; | ||
let S = g; | ||
(j && a != null && a.x || !j && a != null && a.y) && (S = null); | ||
const v = d * 2, D = v / 2, N = l / 2 * (I / -8 + 1), A = u / 2 * I / 4, w = !!r, U = S && b === "end" ? "bottom" : "top"; | ||
let T = S && b === "end" ? "right" : "left"; | ||
S && E && (T = b === "end" ? "left" : "right"); | ||
const H = (i == null ? void 0 : i.x) != null ? S || i.x : "", X = (i == null ? void 0 : i.y) != null ? S || i.y : "", L = r || "M0,0" + (" H" + l) + (" L" + (l - N) + "," + (u - A)) + (" Q" + l / 2 + "," + u + " " + N + "," + (u - A)) + " Z", Y = { | ||
top: w ? "rotate(180deg)" : "", | ||
left: w ? "rotate(90deg)" : "rotate(-90deg)", | ||
bottom: w ? "" : "rotate(180deg)", | ||
right: w ? "rotate(-90deg)" : "rotate(90deg)" | ||
}[m]; | ||
return /* @__PURE__ */ F.jsxs("svg", { | ||
...x, | ||
"aria-hidden": !0, | ||
ref: c, | ||
width: w ? l : l + v, | ||
height: l, | ||
viewBox: "0 0 " + l + " " + (u > l ? u : l), | ||
style: { | ||
position: "absolute", | ||
pointerEvents: "none", | ||
[T]: H, | ||
[U]: X, | ||
[m]: j || w ? "100%" : "calc(100% - " + v / 2 + "px)", | ||
transform: [Y, p].filter((V) => !!V).join(" "), | ||
...R | ||
}, | ||
children: [v > 0 && /* @__PURE__ */ F.jsx("path", { | ||
clipPath: "url(#" + C + ")", | ||
fill: "none", | ||
stroke: h, | ||
strokeWidth: v + (r ? 0 : 1), | ||
d: L | ||
}), /* @__PURE__ */ F.jsx("path", { | ||
stroke: v && !r ? x.fill : "none", | ||
d: L | ||
}), /* @__PURE__ */ F.jsx("clipPath", { | ||
id: C, | ||
children: /* @__PURE__ */ F.jsx("rect", { | ||
x: -D, | ||
y: D * (w ? -1 : 1), | ||
width: l + v, | ||
height: l | ||
}) | ||
})] | ||
}); | ||
}); | ||
function oe() { | ||
const t = /* @__PURE__ */ new Map(); | ||
return { | ||
emit(n, c) { | ||
var e; | ||
(e = t.get(n)) == null || e.forEach((o) => o(c)); | ||
}, | ||
on(n, c) { | ||
t.set(n, [...t.get(n) || [], c]); | ||
}, | ||
off(n, c) { | ||
var e; | ||
t.set(n, ((e = t.get(n)) == null ? void 0 : e.filter((o) => o !== c)) || []); | ||
} | ||
}; | ||
} | ||
const re = /* @__PURE__ */ s.createContext(null), se = /* @__PURE__ */ s.createContext(null), ce = () => { | ||
var t; | ||
return ((t = s.useContext(re)) == null ? void 0 : t.id) || null; | ||
}, ie = () => s.useContext(se); | ||
function le(t) { | ||
const { | ||
open: n = !1, | ||
onOpenChange: c, | ||
elements: e | ||
} = t, o = B(), i = s.useRef({}), [a] = s.useState(() => oe()), l = ce() != null; | ||
if (process.env.NODE_ENV !== "production") { | ||
const r = e.reference; | ||
r && !P(r) && ne("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead."); | ||
} | ||
const [u, I] = s.useState(e.reference), d = J((r, p, R) => { | ||
i.current.openEvent = r ? p : void 0, a.emit("openchange", { | ||
open: r, | ||
event: p, | ||
reason: R, | ||
nested: l | ||
}), c == null || c(r, p, R); | ||
}), g = s.useMemo(() => ({ | ||
setPositionReference: I | ||
}), []), h = s.useMemo(() => ({ | ||
reference: u || e.reference || null, | ||
floating: e.floating || null, | ||
domReference: e.reference | ||
}), [u, e.reference, e.floating]); | ||
return s.useMemo(() => ({ | ||
dataRef: i, | ||
open: n, | ||
onOpenChange: d, | ||
elements: h, | ||
events: a, | ||
floatingId: o, | ||
refs: g | ||
}), [n, d, h, a, o, g]); | ||
} | ||
function pe(t) { | ||
t === void 0 && (t = {}); | ||
const { | ||
nodeId: n | ||
} = t, c = le({ | ||
...t, | ||
elements: { | ||
reference: null, | ||
floating: null, | ||
...t.elements | ||
} | ||
}), 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 = ie(); | ||
M(() => { | ||
d && (g.current = d); | ||
}, [d]); | ||
const r = Z({ | ||
...t, | ||
elements: { | ||
...o, | ||
...l && { | ||
reference: l | ||
} | ||
} | ||
}), p = s.useCallback((f) => { | ||
const m = P(f) ? { | ||
getBoundingClientRect: () => f.getBoundingClientRect(), | ||
contextElement: f | ||
} : f; | ||
u(m), r.refs.setReference(m); | ||
}, [r.refs]), R = s.useCallback((f) => { | ||
(P(f) || f === null) && (g.current = f, a(f)), (P(r.refs.reference.current) || r.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to | ||
// `null` to support `positionReference` + an unstable `reference` | ||
// callback ref. | ||
f !== null && !P(f)) && r.refs.setReference(f); | ||
}, [r.refs]), x = s.useMemo(() => ({ | ||
...r.refs, | ||
setReference: R, | ||
setPositionReference: p, | ||
domReference: g | ||
}), [r.refs, R, p]), C = s.useMemo(() => ({ | ||
...r.elements, | ||
domReference: d | ||
}), [r.elements, d]), E = s.useMemo(() => ({ | ||
...r, | ||
...e, | ||
refs: x, | ||
elements: C, | ||
nodeId: n | ||
}), [r, x, C, n, e]); | ||
return M(() => { | ||
e.dataRef.current.floatingContext = E; | ||
const f = h == null ? void 0 : h.nodesRef.current.find((m) => m.id === n); | ||
f && (f.context = E); | ||
}), s.useMemo(() => ({ | ||
...r, | ||
context: E, | ||
refs: x, | ||
elements: C | ||
}), [r, x, C, E]); | ||
} | ||
export { | ||
ge as FloatingArrow, | ||
ve as arrow, | ||
we as flip, | ||
xe as getOverflowAncestors, | ||
Ee as inline, | ||
Se as offset, | ||
Ie as shift, | ||
pe as useFloating, | ||
ce as useFloatingParentNodeId, | ||
le as useFloatingRootContext, | ||
ie as useFloatingTree, | ||
B as useId | ||
i as toClientRects | ||
}; | ||
//# sourceMappingURL=annotorious-react.es13.js.map |
@@ -1,12 +0,200 @@ | ||
const i = (e) => ({ | ||
length: 1, | ||
item: (t) => t === 0 ? e : void 0, | ||
[Symbol.iterator]: function* () { | ||
for (let t = 0; t < this.length; t++) | ||
yield this.item(t); | ||
import { offset as I, shift as J, flip as K, inline as N, computePosition as Q, arrow as A } from "./annotorious-react.es15.js"; | ||
import { autoUpdate as le, platform as ce } from "./annotorious-react.es15.js"; | ||
import * as f from "react"; | ||
import { useLayoutEffect as T, useEffect as X } from "react"; | ||
import * as Y from "react-dom"; | ||
var R = typeof document < "u" ? T : X; | ||
function h(e, t) { | ||
if (e === t) | ||
return !0; | ||
if (typeof e != typeof t) | ||
return !1; | ||
if (typeof e == "function" && e.toString() === t.toString()) | ||
return !0; | ||
let n, r, s; | ||
if (e && t && typeof e == "object") { | ||
if (Array.isArray(e)) { | ||
if (n = e.length, n !== t.length) return !1; | ||
for (r = n; r-- !== 0; ) | ||
if (!h(e[r], t[r])) | ||
return !1; | ||
return !0; | ||
} | ||
if (s = Object.keys(e), n = s.length, n !== Object.keys(t).length) | ||
return !1; | ||
for (r = n; r-- !== 0; ) | ||
if (!{}.hasOwnProperty.call(t, s[r])) | ||
return !1; | ||
for (r = n; r-- !== 0; ) { | ||
const p = s[r]; | ||
if (!(p === "_owner" && e.$$typeof) && !h(e[p], t[p])) | ||
return !1; | ||
} | ||
return !0; | ||
} | ||
return e !== e && t !== t; | ||
} | ||
function v(e) { | ||
return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1; | ||
} | ||
function q(e, t) { | ||
const n = v(e); | ||
return Math.round(t * n) / n; | ||
} | ||
function $(e) { | ||
const t = f.useRef(e); | ||
return R(() => { | ||
t.current = e; | ||
}), t; | ||
} | ||
function te(e) { | ||
e === void 0 && (e = {}); | ||
const { | ||
placement: t = "bottom", | ||
strategy: n = "absolute", | ||
middleware: r = [], | ||
platform: s, | ||
elements: { | ||
reference: p, | ||
floating: B | ||
} = {}, | ||
transform: k = !0, | ||
whileElementsMounted: D, | ||
open: x | ||
} = e, [i, O] = f.useState({ | ||
x: 0, | ||
y: 0, | ||
strategy: n, | ||
placement: t, | ||
middlewareData: {}, | ||
isPositioned: !1 | ||
}), [M, U] = f.useState(r); | ||
h(M, r) || U(r); | ||
const [V, W] = f.useState(null), [z, G] = f.useState(null), _ = f.useCallback((o) => { | ||
o !== a.current && (a.current = o, W(o)); | ||
}, []), C = f.useCallback((o) => { | ||
o !== d.current && (d.current = o, G(o)); | ||
}, []), u = p || V, l = B || z, a = f.useRef(null), d = f.useRef(null), y = f.useRef(i), H = D != null, P = $(D), S = $(s), F = $(x), g = f.useCallback(() => { | ||
if (!a.current || !d.current) | ||
return; | ||
const o = { | ||
placement: t, | ||
strategy: n, | ||
middleware: M | ||
}; | ||
S.current && (o.platform = S.current), Q(a.current, d.current, o).then((w) => { | ||
const m = { | ||
...w, | ||
// The floating element's position may be recomputed while it's closed | ||
// but still mounted (such as when transitioning out). To ensure | ||
// `isPositioned` will be `false` initially on the next open, avoid | ||
// setting it to `true` when `open === false` (must be specified). | ||
isPositioned: F.current !== !1 | ||
}; | ||
E.current && !h(y.current, m) && (y.current = m, Y.flushSync(() => { | ||
O(m); | ||
})); | ||
}); | ||
}, [M, t, n, S, F]); | ||
R(() => { | ||
x === !1 && y.current.isPositioned && (y.current.isPositioned = !1, O((o) => ({ | ||
...o, | ||
isPositioned: !1 | ||
}))); | ||
}, [x]); | ||
const E = f.useRef(!1); | ||
R(() => (E.current = !0, () => { | ||
E.current = !1; | ||
}), []), R(() => { | ||
if (u && (a.current = u), l && (d.current = l), u && l) { | ||
if (P.current) | ||
return P.current(u, l, g); | ||
g(); | ||
} | ||
}, [u, l, g, P, H]); | ||
const j = f.useMemo(() => ({ | ||
reference: a, | ||
floating: d, | ||
setReference: _, | ||
setFloating: C | ||
}), [_, C]), c = f.useMemo(() => ({ | ||
reference: u, | ||
floating: l | ||
}), [u, l]), L = f.useMemo(() => { | ||
const o = { | ||
position: n, | ||
left: 0, | ||
top: 0 | ||
}; | ||
if (!c.floating) | ||
return o; | ||
const w = q(c.floating, i.x), m = q(c.floating, i.y); | ||
return k ? { | ||
...o, | ||
transform: "translate(" + w + "px, " + m + "px)", | ||
...v(c.floating) >= 1.5 && { | ||
willChange: "transform" | ||
} | ||
} : { | ||
position: n, | ||
left: w, | ||
top: m | ||
}; | ||
}, [n, k, c.floating, i.x, i.y]); | ||
return f.useMemo(() => ({ | ||
...i, | ||
update: g, | ||
refs: j, | ||
elements: c, | ||
floatingStyles: L | ||
}), [i, g, j, c, L]); | ||
} | ||
const Z = (e) => { | ||
function t(n) { | ||
return {}.hasOwnProperty.call(n, "current"); | ||
} | ||
return { | ||
name: "arrow", | ||
options: e, | ||
fn(n) { | ||
const { | ||
element: r, | ||
padding: s | ||
} = typeof e == "function" ? e(n) : e; | ||
return r && t(r) ? r.current != null ? A({ | ||
element: r.current, | ||
padding: s | ||
}).fn(n) : {} : r ? A({ | ||
element: r, | ||
padding: s | ||
}).fn(n) : {}; | ||
} | ||
}; | ||
}, ne = (e, t) => ({ | ||
...I(e), | ||
options: [e, t] | ||
}), re = (e, t) => ({ | ||
...J(e), | ||
options: [e, t] | ||
}), fe = (e, t) => ({ | ||
...K(e), | ||
options: [e, t] | ||
}), oe = (e, t) => ({ | ||
...N(e), | ||
options: [e, t] | ||
}), se = (e, t) => ({ | ||
...Z(e), | ||
options: [e, t] | ||
}); | ||
export { | ||
i as toClientRects | ||
se as arrow, | ||
le as autoUpdate, | ||
Q as computePosition, | ||
fe as flip, | ||
oe as inline, | ||
ne as offset, | ||
ce as platform, | ||
re as shift, | ||
te as useFloating | ||
}; | ||
//# sourceMappingURL=annotorious-react.es14.js.map |
@@ -1,200 +0,394 @@ | ||
import { offset as I, shift as J, flip as K, inline as N, computePosition as Q, arrow as A } from "./annotorious-react.es16.js"; | ||
import { autoUpdate as le, platform as ce } from "./annotorious-react.es16.js"; | ||
import * as f from "react"; | ||
import { useLayoutEffect as T, useEffect as X } from "react"; | ||
import * as Y from "react-dom"; | ||
var R = typeof document < "u" ? T : X; | ||
function h(e, t) { | ||
if (e === t) | ||
return !0; | ||
if (typeof e != typeof t) | ||
return !1; | ||
if (typeof e == "function" && e.toString() === t.toString()) | ||
return !0; | ||
let n, r, s; | ||
if (e && t && typeof e == "object") { | ||
if (Array.isArray(e)) { | ||
if (n = e.length, n !== t.length) return !1; | ||
for (r = n; r-- !== 0; ) | ||
if (!h(e[r], t[r])) | ||
return !1; | ||
return !0; | ||
import { offset as ot, shift as st, flip as rt, inline as ct, arrow as lt, computePosition as ft } from "./annotorious-react.es22.js"; | ||
import { createCoords as m, rectToClientRect as J, round as H, floor as A, max as E, min as z } from "./annotorious-react.es21.js"; | ||
import { getOverflowAncestors as $, isElement as v, getWindow as L, getFrameElement as K, getComputedStyle as R, getDocumentElement as O, isHTMLElement as b, isWebKit as Q, isTopLayer as M, getNodeName as S, isOverflowElement as _, getNodeScroll as I, getParentNode as W, isLastTraversableNode as N, isTableElement as ut, isContainingBlock as Y, getContainingBlock as ht } from "./annotorious-react.es17.js"; | ||
function Z(t) { | ||
const e = R(t); | ||
let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0; | ||
const o = b(t), r = o ? t.offsetWidth : n, s = o ? t.offsetHeight : i, c = H(n) !== r || H(i) !== s; | ||
return c && (n = r, i = s), { | ||
width: n, | ||
height: i, | ||
$: c | ||
}; | ||
} | ||
function q(t) { | ||
return v(t) ? t : t.contextElement; | ||
} | ||
function F(t) { | ||
const e = q(t); | ||
if (!b(e)) | ||
return m(1); | ||
const n = e.getBoundingClientRect(), { | ||
width: i, | ||
height: o, | ||
$: r | ||
} = Z(e); | ||
let s = (r ? H(n.width) : n.width) / i, c = (r ? H(n.height) : n.height) / o; | ||
return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), { | ||
x: s, | ||
y: c | ||
}; | ||
} | ||
const at = /* @__PURE__ */ m(0); | ||
function X(t) { | ||
const e = L(t); | ||
return !Q() || !e.visualViewport ? at : { | ||
x: e.visualViewport.offsetLeft, | ||
y: e.visualViewport.offsetTop | ||
}; | ||
} | ||
function dt(t, e, n) { | ||
return e === void 0 && (e = !1), !n || e && n !== L(t) ? !1 : e; | ||
} | ||
function T(t, e, n, i) { | ||
e === void 0 && (e = !1), n === void 0 && (n = !1); | ||
const o = t.getBoundingClientRect(), r = q(t); | ||
let s = m(1); | ||
e && (i ? v(i) && (s = F(i)) : s = F(t)); | ||
const c = dt(r, n, i) ? X(r) : m(0); | ||
let l = (o.left + c.x) / s.x, f = (o.top + c.y) / s.y, u = o.width / s.x, h = o.height / s.y; | ||
if (r) { | ||
const p = L(r), a = i && v(i) ? L(i) : i; | ||
let y = p, g = K(y); | ||
for (; g && i && a !== y; ) { | ||
const w = F(g), d = g.getBoundingClientRect(), x = R(g), C = d.left + (g.clientLeft + parseFloat(x.paddingLeft)) * w.x, B = d.top + (g.clientTop + parseFloat(x.paddingTop)) * w.y; | ||
l *= w.x, f *= w.y, u *= w.x, h *= w.y, l += C, f += B, y = L(g), g = K(y); | ||
} | ||
if (s = Object.keys(e), n = s.length, n !== Object.keys(t).length) | ||
return !1; | ||
for (r = n; r-- !== 0; ) | ||
if (!{}.hasOwnProperty.call(t, s[r])) | ||
return !1; | ||
for (r = n; r-- !== 0; ) { | ||
const p = s[r]; | ||
if (!(p === "_owner" && e.$$typeof) && !h(e[p], t[p])) | ||
return !1; | ||
} | ||
return !0; | ||
} | ||
return e !== e && t !== t; | ||
return J({ | ||
width: u, | ||
height: h, | ||
x: l, | ||
y: f | ||
}); | ||
} | ||
function v(e) { | ||
return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1; | ||
function k(t, e) { | ||
const n = I(t).scrollLeft; | ||
return e ? e.left + n : T(O(t)).left + n; | ||
} | ||
function q(e, t) { | ||
const n = v(e); | ||
return Math.round(t * n) / n; | ||
function tt(t, e, n) { | ||
n === void 0 && (n = !1); | ||
const i = t.getBoundingClientRect(), o = i.left + e.scrollLeft - (n ? 0 : ( | ||
// RTL <body> scrollbar. | ||
k(t, i) | ||
)), r = i.top + e.scrollTop; | ||
return { | ||
x: o, | ||
y: r | ||
}; | ||
} | ||
function $(e) { | ||
const t = f.useRef(e); | ||
return R(() => { | ||
t.current = e; | ||
}), t; | ||
function gt(t) { | ||
let { | ||
elements: e, | ||
rect: n, | ||
offsetParent: i, | ||
strategy: o | ||
} = t; | ||
const r = o === "fixed", s = O(i), c = e ? M(e.floating) : !1; | ||
if (i === s || c && r) | ||
return n; | ||
let l = { | ||
scrollLeft: 0, | ||
scrollTop: 0 | ||
}, f = m(1); | ||
const u = m(0), h = b(i); | ||
if ((h || !h && !r) && ((S(i) !== "body" || _(s)) && (l = I(i)), b(i))) { | ||
const a = T(i); | ||
f = F(i), u.x = a.x + i.clientLeft, u.y = a.y + i.clientTop; | ||
} | ||
const p = s && !h && !r ? tt(s, l, !0) : m(0); | ||
return { | ||
width: n.width * f.x, | ||
height: n.height * f.y, | ||
x: n.x * f.x - l.scrollLeft * f.x + u.x + p.x, | ||
y: n.y * f.y - l.scrollTop * f.y + u.y + p.y | ||
}; | ||
} | ||
function te(e) { | ||
e === void 0 && (e = {}); | ||
function pt(t) { | ||
return Array.from(t.getClientRects()); | ||
} | ||
function wt(t) { | ||
const e = O(t), n = I(t), i = t.ownerDocument.body, o = E(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), r = E(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight); | ||
let s = -n.scrollLeft + k(t); | ||
const c = -n.scrollTop; | ||
return R(i).direction === "rtl" && (s += E(e.clientWidth, i.clientWidth) - o), { | ||
width: o, | ||
height: r, | ||
x: s, | ||
y: c | ||
}; | ||
} | ||
function mt(t, e) { | ||
const n = L(t), i = O(t), o = n.visualViewport; | ||
let r = i.clientWidth, s = i.clientHeight, c = 0, l = 0; | ||
if (o) { | ||
r = o.width, s = o.height; | ||
const f = Q(); | ||
(!f || f && e === "fixed") && (c = o.offsetLeft, l = o.offsetTop); | ||
} | ||
return { | ||
width: r, | ||
height: s, | ||
x: c, | ||
y: l | ||
}; | ||
} | ||
function yt(t, e) { | ||
const n = T(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, r = b(t) ? F(t) : m(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, l = o * r.x, f = i * r.y; | ||
return { | ||
width: s, | ||
height: c, | ||
x: l, | ||
y: f | ||
}; | ||
} | ||
function j(t, e, n) { | ||
let i; | ||
if (e === "viewport") | ||
i = mt(t, n); | ||
else if (e === "document") | ||
i = wt(O(t)); | ||
else if (v(e)) | ||
i = yt(e, n); | ||
else { | ||
const o = X(t); | ||
i = { | ||
x: e.x - o.x, | ||
y: e.y - o.y, | ||
width: e.width, | ||
height: e.height | ||
}; | ||
} | ||
return J(i); | ||
} | ||
function et(t, e) { | ||
const n = W(t); | ||
return n === e || !v(n) || N(n) ? !1 : R(n).position === "fixed" || et(n, e); | ||
} | ||
function xt(t, e) { | ||
const n = e.get(t); | ||
if (n) | ||
return n; | ||
let i = $(t, [], !1).filter((c) => v(c) && S(c) !== "body"), o = null; | ||
const r = R(t).position === "fixed"; | ||
let s = r ? W(t) : t; | ||
for (; v(s) && !N(s); ) { | ||
const c = R(s), l = Y(s); | ||
!l && c.position === "fixed" && (o = null), (r ? !l && !o : !l && c.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || _(s) && !l && et(t, s)) ? i = i.filter((u) => u !== s) : o = c, s = W(s); | ||
} | ||
return e.set(t, i), i; | ||
} | ||
function vt(t) { | ||
let { | ||
element: e, | ||
boundary: n, | ||
rootBoundary: i, | ||
strategy: o | ||
} = t; | ||
const s = [...n === "clippingAncestors" ? M(e) ? [] : xt(e, this._c) : [].concat(n), i], c = s[0], l = s.reduce((f, u) => { | ||
const h = j(e, u, o); | ||
return f.top = E(h.top, f.top), f.right = z(h.right, f.right), f.bottom = z(h.bottom, f.bottom), f.left = E(h.left, f.left), f; | ||
}, j(e, c, o)); | ||
return { | ||
width: l.right - l.left, | ||
height: l.bottom - l.top, | ||
x: l.left, | ||
y: l.top | ||
}; | ||
} | ||
function Rt(t) { | ||
const { | ||
placement: t = "bottom", | ||
strategy: n = "absolute", | ||
middleware: r = [], | ||
platform: s, | ||
elements: { | ||
reference: p, | ||
floating: B | ||
} = {}, | ||
transform: k = !0, | ||
whileElementsMounted: D, | ||
open: x | ||
} = e, [i, O] = f.useState({ | ||
x: 0, | ||
y: 0, | ||
strategy: n, | ||
placement: t, | ||
middlewareData: {}, | ||
isPositioned: !1 | ||
}), [M, U] = f.useState(r); | ||
h(M, r) || U(r); | ||
const [V, W] = f.useState(null), [z, G] = f.useState(null), _ = f.useCallback((o) => { | ||
o !== a.current && (a.current = o, W(o)); | ||
}, []), C = f.useCallback((o) => { | ||
o !== d.current && (d.current = o, G(o)); | ||
}, []), u = p || V, l = B || z, a = f.useRef(null), d = f.useRef(null), y = f.useRef(i), H = D != null, P = $(D), S = $(s), F = $(x), g = f.useCallback(() => { | ||
if (!a.current || !d.current) | ||
width: e, | ||
height: n | ||
} = Z(t); | ||
return { | ||
width: e, | ||
height: n | ||
}; | ||
} | ||
function Ot(t, e, n) { | ||
const i = b(e), o = O(e), r = n === "fixed", s = T(t, !0, r, e); | ||
let c = { | ||
scrollLeft: 0, | ||
scrollTop: 0 | ||
}; | ||
const l = m(0); | ||
if (i || !i && !r) | ||
if ((S(e) !== "body" || _(o)) && (c = I(e)), i) { | ||
const p = T(e, !0, r, e); | ||
l.x = p.x + e.clientLeft, l.y = p.y + e.clientTop; | ||
} else o && (l.x = k(o)); | ||
const f = o && !i && !r ? tt(o, c) : m(0), u = s.left + c.scrollLeft - l.x - f.x, h = s.top + c.scrollTop - l.y - f.y; | ||
return { | ||
x: u, | ||
y: h, | ||
width: s.width, | ||
height: s.height | ||
}; | ||
} | ||
function V(t) { | ||
return R(t).position === "static"; | ||
} | ||
function G(t, e) { | ||
if (!b(t) || R(t).position === "fixed") | ||
return null; | ||
if (e) | ||
return e(t); | ||
let n = t.offsetParent; | ||
return O(t) === n && (n = n.ownerDocument.body), n; | ||
} | ||
function nt(t, e) { | ||
const n = L(t); | ||
if (M(t)) | ||
return n; | ||
if (!b(t)) { | ||
let o = W(t); | ||
for (; o && !N(o); ) { | ||
if (v(o) && !V(o)) | ||
return o; | ||
o = W(o); | ||
} | ||
return n; | ||
} | ||
let i = G(t, e); | ||
for (; i && ut(i) && V(i); ) | ||
i = G(i, e); | ||
return i && N(i) && V(i) && !Y(i) ? n : i || ht(t) || n; | ||
} | ||
const bt = async function(t) { | ||
const e = this.getOffsetParent || nt, n = this.getDimensions, i = await n(t.floating); | ||
return { | ||
reference: Ot(t.reference, await e(t.floating), t.strategy), | ||
floating: { | ||
x: 0, | ||
y: 0, | ||
width: i.width, | ||
height: i.height | ||
} | ||
}; | ||
}; | ||
function Ct(t) { | ||
return R(t).direction === "rtl"; | ||
} | ||
const Lt = { | ||
convertOffsetParentRelativeRectToViewportRelativeRect: gt, | ||
getDocumentElement: O, | ||
getClippingRect: vt, | ||
getOffsetParent: nt, | ||
getElementRects: bt, | ||
getClientRects: pt, | ||
getDimensions: Rt, | ||
getScale: F, | ||
isElement: v, | ||
isRTL: Ct | ||
}; | ||
function it(t, e) { | ||
return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height; | ||
} | ||
function Tt(t, e) { | ||
let n = null, i; | ||
const o = O(t); | ||
function r() { | ||
var c; | ||
clearTimeout(i), (c = n) == null || c.disconnect(), n = null; | ||
} | ||
function s(c, l) { | ||
c === void 0 && (c = !1), l === void 0 && (l = 1), r(); | ||
const f = t.getBoundingClientRect(), { | ||
left: u, | ||
top: h, | ||
width: p, | ||
height: a | ||
} = f; | ||
if (c || e(), !p || !a) | ||
return; | ||
const o = { | ||
placement: t, | ||
strategy: n, | ||
middleware: M | ||
const y = A(h), g = A(o.clientWidth - (u + p)), w = A(o.clientHeight - (h + a)), d = A(u), C = { | ||
rootMargin: -y + "px " + -g + "px " + -w + "px " + -d + "px", | ||
threshold: E(0, z(1, l)) || 1 | ||
}; | ||
S.current && (o.platform = S.current), Q(a.current, d.current, o).then((w) => { | ||
const m = { | ||
...w, | ||
// The floating element's position may be recomputed while it's closed | ||
// but still mounted (such as when transitioning out). To ensure | ||
// `isPositioned` will be `false` initially on the next open, avoid | ||
// setting it to `true` when `open === false` (must be specified). | ||
isPositioned: F.current !== !1 | ||
}; | ||
E.current && !h(y.current, m) && (y.current = m, Y.flushSync(() => { | ||
O(m); | ||
})); | ||
}); | ||
}, [M, t, n, S, F]); | ||
R(() => { | ||
x === !1 && y.current.isPositioned && (y.current.isPositioned = !1, O((o) => ({ | ||
...o, | ||
isPositioned: !1 | ||
}))); | ||
}, [x]); | ||
const E = f.useRef(!1); | ||
R(() => (E.current = !0, () => { | ||
E.current = !1; | ||
}), []), R(() => { | ||
if (u && (a.current = u), l && (d.current = l), u && l) { | ||
if (P.current) | ||
return P.current(u, l, g); | ||
g(); | ||
let B = !0; | ||
function P(U) { | ||
const D = U[0].intersectionRatio; | ||
if (D !== l) { | ||
if (!B) | ||
return s(); | ||
D ? s(!1, D) : i = setTimeout(() => { | ||
s(!1, 1e-7); | ||
}, 1e3); | ||
} | ||
D === 1 && !it(f, t.getBoundingClientRect()) && s(), B = !1; | ||
} | ||
}, [u, l, g, P, H]); | ||
const j = f.useMemo(() => ({ | ||
reference: a, | ||
floating: d, | ||
setReference: _, | ||
setFloating: C | ||
}), [_, C]), c = f.useMemo(() => ({ | ||
reference: u, | ||
floating: l | ||
}), [u, l]), L = f.useMemo(() => { | ||
const o = { | ||
position: n, | ||
left: 0, | ||
top: 0 | ||
}; | ||
if (!c.floating) | ||
return o; | ||
const w = q(c.floating, i.x), m = q(c.floating, i.y); | ||
return k ? { | ||
...o, | ||
transform: "translate(" + w + "px, " + m + "px)", | ||
...v(c.floating) >= 1.5 && { | ||
willChange: "transform" | ||
} | ||
} : { | ||
position: n, | ||
left: w, | ||
top: m | ||
}; | ||
}, [n, k, c.floating, i.x, i.y]); | ||
return f.useMemo(() => ({ | ||
...i, | ||
update: g, | ||
refs: j, | ||
elements: c, | ||
floatingStyles: L | ||
}), [i, g, j, c, L]); | ||
try { | ||
n = new IntersectionObserver(P, { | ||
...C, | ||
// Handle <iframe>s | ||
root: o.ownerDocument | ||
}); | ||
} catch { | ||
n = new IntersectionObserver(P, C); | ||
} | ||
n.observe(t); | ||
} | ||
return s(!0), r; | ||
} | ||
const Z = (e) => { | ||
function t(n) { | ||
return {}.hasOwnProperty.call(n, "current"); | ||
function Bt(t, e, n, i) { | ||
i === void 0 && (i = {}); | ||
const { | ||
ancestorScroll: o = !0, | ||
ancestorResize: r = !0, | ||
elementResize: s = typeof ResizeObserver == "function", | ||
layoutShift: c = typeof IntersectionObserver == "function", | ||
animationFrame: l = !1 | ||
} = i, f = q(t), u = o || r ? [...f ? $(f) : [], ...$(e)] : []; | ||
u.forEach((d) => { | ||
o && d.addEventListener("scroll", n, { | ||
passive: !0 | ||
}), r && d.addEventListener("resize", n); | ||
}); | ||
const h = f && c ? Tt(f, n) : null; | ||
let p = -1, a = null; | ||
s && (a = new ResizeObserver((d) => { | ||
let [x] = d; | ||
x && x.target === f && a && (a.unobserve(e), cancelAnimationFrame(p), p = requestAnimationFrame(() => { | ||
var C; | ||
(C = a) == null || C.observe(e); | ||
})), n(); | ||
}), f && !l && a.observe(f), a.observe(e)); | ||
let y, g = l ? T(t) : null; | ||
l && w(); | ||
function w() { | ||
const d = T(t); | ||
g && !it(g, d) && n(), g = d, y = requestAnimationFrame(w); | ||
} | ||
return { | ||
name: "arrow", | ||
options: e, | ||
fn(n) { | ||
const { | ||
element: r, | ||
padding: s | ||
} = typeof e == "function" ? e(n) : e; | ||
return r && t(r) ? r.current != null ? A({ | ||
element: r.current, | ||
padding: s | ||
}).fn(n) : {} : r ? A({ | ||
element: r, | ||
padding: s | ||
}).fn(n) : {}; | ||
} | ||
return n(), () => { | ||
var d; | ||
u.forEach((x) => { | ||
o && x.removeEventListener("scroll", n), r && x.removeEventListener("resize", n); | ||
}), h == null || h(), (d = a) == null || d.disconnect(), a = null, l && cancelAnimationFrame(y); | ||
}; | ||
}, ne = (e, t) => ({ | ||
...I(e), | ||
options: [e, t] | ||
}), re = (e, t) => ({ | ||
...J(e), | ||
options: [e, t] | ||
}), fe = (e, t) => ({ | ||
...K(e), | ||
options: [e, t] | ||
}), oe = (e, t) => ({ | ||
...N(e), | ||
options: [e, t] | ||
}), se = (e, t) => ({ | ||
...Z(e), | ||
options: [e, t] | ||
}); | ||
} | ||
const Dt = ot, At = st, Ht = rt, Nt = lt, It = ct, Vt = (t, e, n) => { | ||
const i = /* @__PURE__ */ new Map(), o = { | ||
platform: Lt, | ||
...n | ||
}, r = { | ||
...o.platform, | ||
_c: i | ||
}; | ||
return ft(t, e, { | ||
...o, | ||
platform: r | ||
}); | ||
}; | ||
export { | ||
se as arrow, | ||
le as autoUpdate, | ||
Q as computePosition, | ||
fe as flip, | ||
oe as inline, | ||
ne as offset, | ||
ce as platform, | ||
re as shift, | ||
te as useFloating | ||
Nt as arrow, | ||
Bt as autoUpdate, | ||
Vt as computePosition, | ||
Ht as flip, | ||
$ as getOverflowAncestors, | ||
It as inline, | ||
Dt as offset, | ||
Lt as platform, | ||
At as shift | ||
}; | ||
//# sourceMappingURL=annotorious-react.es15.js.map |
@@ -1,394 +0,17 @@ | ||
import { offset as ot, shift as st, flip as rt, inline as ct, arrow as lt, computePosition as ft } from "./annotorious-react.es28.js"; | ||
import { createCoords as m, rectToClientRect as J, round as H, floor as A, max as E, min as z } from "./annotorious-react.es27.js"; | ||
import { getOverflowAncestors as $, isElement as v, getWindow as L, getFrameElement as K, getComputedStyle as R, getDocumentElement as O, isHTMLElement as b, isWebKit as Q, isTopLayer as M, getNodeName as S, isOverflowElement as _, getNodeScroll as I, getParentNode as W, isLastTraversableNode as N, isTableElement as ut, isContainingBlock as Y, getContainingBlock as ht } from "./annotorious-react.es21.js"; | ||
function Z(t) { | ||
const e = R(t); | ||
let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0; | ||
const o = b(t), r = o ? t.offsetWidth : n, s = o ? t.offsetHeight : i, c = H(n) !== r || H(i) !== s; | ||
return c && (n = r, i = s), { | ||
width: n, | ||
height: i, | ||
$: c | ||
}; | ||
import m from "./annotorious-react.es19.js"; | ||
import n from "./annotorious-react.es20.js"; | ||
import { unsafeStringify as t } from "./annotorious-react.es18.js"; | ||
function U(r, a, u) { | ||
var e; | ||
if (m.randomUUID && !r) | ||
return m.randomUUID(); | ||
r = r || {}; | ||
const f = r.random ?? ((e = r.rng) == null ? void 0 : e.call(r)) ?? n(); | ||
if (f.length < 16) | ||
throw new Error("Random bytes length must be >= 16"); | ||
return f[6] = f[6] & 15 | 64, f[8] = f[8] & 63 | 128, t(f); | ||
} | ||
function q(t) { | ||
return v(t) ? t : t.contextElement; | ||
} | ||
function F(t) { | ||
const e = q(t); | ||
if (!b(e)) | ||
return m(1); | ||
const n = e.getBoundingClientRect(), { | ||
width: i, | ||
height: o, | ||
$: r | ||
} = Z(e); | ||
let s = (r ? H(n.width) : n.width) / i, c = (r ? H(n.height) : n.height) / o; | ||
return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), { | ||
x: s, | ||
y: c | ||
}; | ||
} | ||
const at = /* @__PURE__ */ m(0); | ||
function X(t) { | ||
const e = L(t); | ||
return !Q() || !e.visualViewport ? at : { | ||
x: e.visualViewport.offsetLeft, | ||
y: e.visualViewport.offsetTop | ||
}; | ||
} | ||
function dt(t, e, n) { | ||
return e === void 0 && (e = !1), !n || e && n !== L(t) ? !1 : e; | ||
} | ||
function T(t, e, n, i) { | ||
e === void 0 && (e = !1), n === void 0 && (n = !1); | ||
const o = t.getBoundingClientRect(), r = q(t); | ||
let s = m(1); | ||
e && (i ? v(i) && (s = F(i)) : s = F(t)); | ||
const c = dt(r, n, i) ? X(r) : m(0); | ||
let l = (o.left + c.x) / s.x, f = (o.top + c.y) / s.y, u = o.width / s.x, h = o.height / s.y; | ||
if (r) { | ||
const p = L(r), a = i && v(i) ? L(i) : i; | ||
let y = p, g = K(y); | ||
for (; g && i && a !== y; ) { | ||
const w = F(g), d = g.getBoundingClientRect(), x = R(g), C = d.left + (g.clientLeft + parseFloat(x.paddingLeft)) * w.x, B = d.top + (g.clientTop + parseFloat(x.paddingTop)) * w.y; | ||
l *= w.x, f *= w.y, u *= w.x, h *= w.y, l += C, f += B, y = L(g), g = K(y); | ||
} | ||
} | ||
return J({ | ||
width: u, | ||
height: h, | ||
x: l, | ||
y: f | ||
}); | ||
} | ||
function k(t, e) { | ||
const n = I(t).scrollLeft; | ||
return e ? e.left + n : T(O(t)).left + n; | ||
} | ||
function tt(t, e, n) { | ||
n === void 0 && (n = !1); | ||
const i = t.getBoundingClientRect(), o = i.left + e.scrollLeft - (n ? 0 : ( | ||
// RTL <body> scrollbar. | ||
k(t, i) | ||
)), r = i.top + e.scrollTop; | ||
return { | ||
x: o, | ||
y: r | ||
}; | ||
} | ||
function gt(t) { | ||
let { | ||
elements: e, | ||
rect: n, | ||
offsetParent: i, | ||
strategy: o | ||
} = t; | ||
const r = o === "fixed", s = O(i), c = e ? M(e.floating) : !1; | ||
if (i === s || c && r) | ||
return n; | ||
let l = { | ||
scrollLeft: 0, | ||
scrollTop: 0 | ||
}, f = m(1); | ||
const u = m(0), h = b(i); | ||
if ((h || !h && !r) && ((S(i) !== "body" || _(s)) && (l = I(i)), b(i))) { | ||
const a = T(i); | ||
f = F(i), u.x = a.x + i.clientLeft, u.y = a.y + i.clientTop; | ||
} | ||
const p = s && !h && !r ? tt(s, l, !0) : m(0); | ||
return { | ||
width: n.width * f.x, | ||
height: n.height * f.y, | ||
x: n.x * f.x - l.scrollLeft * f.x + u.x + p.x, | ||
y: n.y * f.y - l.scrollTop * f.y + u.y + p.y | ||
}; | ||
} | ||
function pt(t) { | ||
return Array.from(t.getClientRects()); | ||
} | ||
function wt(t) { | ||
const e = O(t), n = I(t), i = t.ownerDocument.body, o = E(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), r = E(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight); | ||
let s = -n.scrollLeft + k(t); | ||
const c = -n.scrollTop; | ||
return R(i).direction === "rtl" && (s += E(e.clientWidth, i.clientWidth) - o), { | ||
width: o, | ||
height: r, | ||
x: s, | ||
y: c | ||
}; | ||
} | ||
function mt(t, e) { | ||
const n = L(t), i = O(t), o = n.visualViewport; | ||
let r = i.clientWidth, s = i.clientHeight, c = 0, l = 0; | ||
if (o) { | ||
r = o.width, s = o.height; | ||
const f = Q(); | ||
(!f || f && e === "fixed") && (c = o.offsetLeft, l = o.offsetTop); | ||
} | ||
return { | ||
width: r, | ||
height: s, | ||
x: c, | ||
y: l | ||
}; | ||
} | ||
function yt(t, e) { | ||
const n = T(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, r = b(t) ? F(t) : m(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, l = o * r.x, f = i * r.y; | ||
return { | ||
width: s, | ||
height: c, | ||
x: l, | ||
y: f | ||
}; | ||
} | ||
function j(t, e, n) { | ||
let i; | ||
if (e === "viewport") | ||
i = mt(t, n); | ||
else if (e === "document") | ||
i = wt(O(t)); | ||
else if (v(e)) | ||
i = yt(e, n); | ||
else { | ||
const o = X(t); | ||
i = { | ||
x: e.x - o.x, | ||
y: e.y - o.y, | ||
width: e.width, | ||
height: e.height | ||
}; | ||
} | ||
return J(i); | ||
} | ||
function et(t, e) { | ||
const n = W(t); | ||
return n === e || !v(n) || N(n) ? !1 : R(n).position === "fixed" || et(n, e); | ||
} | ||
function xt(t, e) { | ||
const n = e.get(t); | ||
if (n) | ||
return n; | ||
let i = $(t, [], !1).filter((c) => v(c) && S(c) !== "body"), o = null; | ||
const r = R(t).position === "fixed"; | ||
let s = r ? W(t) : t; | ||
for (; v(s) && !N(s); ) { | ||
const c = R(s), l = Y(s); | ||
!l && c.position === "fixed" && (o = null), (r ? !l && !o : !l && c.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || _(s) && !l && et(t, s)) ? i = i.filter((u) => u !== s) : o = c, s = W(s); | ||
} | ||
return e.set(t, i), i; | ||
} | ||
function vt(t) { | ||
let { | ||
element: e, | ||
boundary: n, | ||
rootBoundary: i, | ||
strategy: o | ||
} = t; | ||
const s = [...n === "clippingAncestors" ? M(e) ? [] : xt(e, this._c) : [].concat(n), i], c = s[0], l = s.reduce((f, u) => { | ||
const h = j(e, u, o); | ||
return f.top = E(h.top, f.top), f.right = z(h.right, f.right), f.bottom = z(h.bottom, f.bottom), f.left = E(h.left, f.left), f; | ||
}, j(e, c, o)); | ||
return { | ||
width: l.right - l.left, | ||
height: l.bottom - l.top, | ||
x: l.left, | ||
y: l.top | ||
}; | ||
} | ||
function Rt(t) { | ||
const { | ||
width: e, | ||
height: n | ||
} = Z(t); | ||
return { | ||
width: e, | ||
height: n | ||
}; | ||
} | ||
function Ot(t, e, n) { | ||
const i = b(e), o = O(e), r = n === "fixed", s = T(t, !0, r, e); | ||
let c = { | ||
scrollLeft: 0, | ||
scrollTop: 0 | ||
}; | ||
const l = m(0); | ||
if (i || !i && !r) | ||
if ((S(e) !== "body" || _(o)) && (c = I(e)), i) { | ||
const p = T(e, !0, r, e); | ||
l.x = p.x + e.clientLeft, l.y = p.y + e.clientTop; | ||
} else o && (l.x = k(o)); | ||
const f = o && !i && !r ? tt(o, c) : m(0), u = s.left + c.scrollLeft - l.x - f.x, h = s.top + c.scrollTop - l.y - f.y; | ||
return { | ||
x: u, | ||
y: h, | ||
width: s.width, | ||
height: s.height | ||
}; | ||
} | ||
function V(t) { | ||
return R(t).position === "static"; | ||
} | ||
function G(t, e) { | ||
if (!b(t) || R(t).position === "fixed") | ||
return null; | ||
if (e) | ||
return e(t); | ||
let n = t.offsetParent; | ||
return O(t) === n && (n = n.ownerDocument.body), n; | ||
} | ||
function nt(t, e) { | ||
const n = L(t); | ||
if (M(t)) | ||
return n; | ||
if (!b(t)) { | ||
let o = W(t); | ||
for (; o && !N(o); ) { | ||
if (v(o) && !V(o)) | ||
return o; | ||
o = W(o); | ||
} | ||
return n; | ||
} | ||
let i = G(t, e); | ||
for (; i && ut(i) && V(i); ) | ||
i = G(i, e); | ||
return i && N(i) && V(i) && !Y(i) ? n : i || ht(t) || n; | ||
} | ||
const bt = async function(t) { | ||
const e = this.getOffsetParent || nt, n = this.getDimensions, i = await n(t.floating); | ||
return { | ||
reference: Ot(t.reference, await e(t.floating), t.strategy), | ||
floating: { | ||
x: 0, | ||
y: 0, | ||
width: i.width, | ||
height: i.height | ||
} | ||
}; | ||
}; | ||
function Ct(t) { | ||
return R(t).direction === "rtl"; | ||
} | ||
const Lt = { | ||
convertOffsetParentRelativeRectToViewportRelativeRect: gt, | ||
getDocumentElement: O, | ||
getClippingRect: vt, | ||
getOffsetParent: nt, | ||
getElementRects: bt, | ||
getClientRects: pt, | ||
getDimensions: Rt, | ||
getScale: F, | ||
isElement: v, | ||
isRTL: Ct | ||
}; | ||
function it(t, e) { | ||
return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height; | ||
} | ||
function Tt(t, e) { | ||
let n = null, i; | ||
const o = O(t); | ||
function r() { | ||
var c; | ||
clearTimeout(i), (c = n) == null || c.disconnect(), n = null; | ||
} | ||
function s(c, l) { | ||
c === void 0 && (c = !1), l === void 0 && (l = 1), r(); | ||
const f = t.getBoundingClientRect(), { | ||
left: u, | ||
top: h, | ||
width: p, | ||
height: a | ||
} = f; | ||
if (c || e(), !p || !a) | ||
return; | ||
const y = A(h), g = A(o.clientWidth - (u + p)), w = A(o.clientHeight - (h + a)), d = A(u), C = { | ||
rootMargin: -y + "px " + -g + "px " + -w + "px " + -d + "px", | ||
threshold: E(0, z(1, l)) || 1 | ||
}; | ||
let B = !0; | ||
function P(U) { | ||
const D = U[0].intersectionRatio; | ||
if (D !== l) { | ||
if (!B) | ||
return s(); | ||
D ? s(!1, D) : i = setTimeout(() => { | ||
s(!1, 1e-7); | ||
}, 1e3); | ||
} | ||
D === 1 && !it(f, t.getBoundingClientRect()) && s(), B = !1; | ||
} | ||
try { | ||
n = new IntersectionObserver(P, { | ||
...C, | ||
// Handle <iframe>s | ||
root: o.ownerDocument | ||
}); | ||
} catch { | ||
n = new IntersectionObserver(P, C); | ||
} | ||
n.observe(t); | ||
} | ||
return s(!0), r; | ||
} | ||
function Bt(t, e, n, i) { | ||
i === void 0 && (i = {}); | ||
const { | ||
ancestorScroll: o = !0, | ||
ancestorResize: r = !0, | ||
elementResize: s = typeof ResizeObserver == "function", | ||
layoutShift: c = typeof IntersectionObserver == "function", | ||
animationFrame: l = !1 | ||
} = i, f = q(t), u = o || r ? [...f ? $(f) : [], ...$(e)] : []; | ||
u.forEach((d) => { | ||
o && d.addEventListener("scroll", n, { | ||
passive: !0 | ||
}), r && d.addEventListener("resize", n); | ||
}); | ||
const h = f && c ? Tt(f, n) : null; | ||
let p = -1, a = null; | ||
s && (a = new ResizeObserver((d) => { | ||
let [x] = d; | ||
x && x.target === f && a && (a.unobserve(e), cancelAnimationFrame(p), p = requestAnimationFrame(() => { | ||
var C; | ||
(C = a) == null || C.observe(e); | ||
})), n(); | ||
}), f && !l && a.observe(f), a.observe(e)); | ||
let y, g = l ? T(t) : null; | ||
l && w(); | ||
function w() { | ||
const d = T(t); | ||
g && !it(g, d) && n(), g = d, y = requestAnimationFrame(w); | ||
} | ||
return n(), () => { | ||
var d; | ||
u.forEach((x) => { | ||
o && x.removeEventListener("scroll", n), r && x.removeEventListener("resize", n); | ||
}), h == null || h(), (d = a) == null || d.disconnect(), a = null, l && cancelAnimationFrame(y); | ||
}; | ||
} | ||
const Dt = ot, At = st, Ht = rt, Nt = lt, It = ct, Vt = (t, e, n) => { | ||
const i = /* @__PURE__ */ new Map(), o = { | ||
platform: Lt, | ||
...n | ||
}, r = { | ||
...o.platform, | ||
_c: i | ||
}; | ||
return ft(t, e, { | ||
...o, | ||
platform: r | ||
}); | ||
}; | ||
export { | ||
Nt as arrow, | ||
Bt as autoUpdate, | ||
Vt as computePosition, | ||
Ht as flip, | ||
$ as getOverflowAncestors, | ||
It as inline, | ||
Dt as offset, | ||
Lt as platform, | ||
At as shift | ||
U as default | ||
}; | ||
//# sourceMappingURL=annotorious-react.es16.js.map |
@@ -1,17 +0,132 @@ | ||
import m from "./annotorious-react.es25.js"; | ||
import n from "./annotorious-react.es26.js"; | ||
import { unsafeStringify as t } from "./annotorious-react.es24.js"; | ||
function U(r, a, u) { | ||
function c() { | ||
return typeof window < "u"; | ||
} | ||
function f(n) { | ||
return p(n) ? (n.nodeName || "").toLowerCase() : "#document"; | ||
} | ||
function i(n) { | ||
var e; | ||
if (m.randomUUID && !r) | ||
return m.randomUUID(); | ||
r = r || {}; | ||
const f = r.random ?? ((e = r.rng) == null ? void 0 : e.call(r)) ?? n(); | ||
if (f.length < 16) | ||
throw new Error("Random bytes length must be >= 16"); | ||
return f[6] = f[6] & 15 | 64, f[8] = f[8] & 63 | 128, t(f); | ||
return (n == null || (e = n.ownerDocument) == null ? void 0 : e.defaultView) || window; | ||
} | ||
function E(n) { | ||
var e; | ||
return (e = (p(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : e.documentElement; | ||
} | ||
function p(n) { | ||
return c() ? n instanceof Node || n instanceof i(n).Node : !1; | ||
} | ||
function m(n) { | ||
return c() ? n instanceof Element || n instanceof i(n).Element : !1; | ||
} | ||
function w(n) { | ||
return c() ? n instanceof HTMLElement || n instanceof i(n).HTMLElement : !1; | ||
} | ||
function a(n) { | ||
return !c() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof i(n).ShadowRoot; | ||
} | ||
function y(n) { | ||
const { | ||
overflow: e, | ||
overflowX: t, | ||
overflowY: o, | ||
display: r | ||
} = b(n); | ||
return /auto|scroll|overlay|hidden|clip/.test(e + o + t) && !["inline", "contents"].includes(r); | ||
} | ||
function k(n) { | ||
return ["table", "td", "th"].includes(f(n)); | ||
} | ||
function N(n) { | ||
return [":popover-open", ":modal"].some((e) => { | ||
try { | ||
return n.matches(e); | ||
} catch { | ||
return !1; | ||
} | ||
}); | ||
} | ||
function T(n) { | ||
const e = L(), t = m(n) ? b(n) : n; | ||
return ["transform", "translate", "scale", "rotate", "perspective"].some((o) => t[o] ? t[o] !== "none" : !1) || (t.containerType ? t.containerType !== "normal" : !1) || !e && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !e && (t.filter ? t.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (t.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (t.contain || "").includes(o)); | ||
} | ||
function C(n) { | ||
let e = l(n); | ||
for (; w(e) && !g(e); ) { | ||
if (T(e)) | ||
return e; | ||
if (N(e)) | ||
return null; | ||
e = l(e); | ||
} | ||
return null; | ||
} | ||
function L() { | ||
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none"); | ||
} | ||
function g(n) { | ||
return ["html", "body", "#document"].includes(f(n)); | ||
} | ||
function b(n) { | ||
return i(n).getComputedStyle(n); | ||
} | ||
function R(n) { | ||
return m(n) ? { | ||
scrollLeft: n.scrollLeft, | ||
scrollTop: n.scrollTop | ||
} : { | ||
scrollLeft: n.scrollX, | ||
scrollTop: n.scrollY | ||
}; | ||
} | ||
function l(n) { | ||
if (f(n) === "html") | ||
return n; | ||
const e = ( | ||
// Step into the shadow DOM of the parent of a slotted node. | ||
n.assignedSlot || // DOM Element detected. | ||
n.parentNode || // ShadowRoot detected. | ||
a(n) && n.host || // Fallback. | ||
E(n) | ||
); | ||
return a(e) ? e.host : e; | ||
} | ||
function h(n) { | ||
const e = l(n); | ||
return g(e) ? n.ownerDocument ? n.ownerDocument.body : n.body : w(e) && y(e) ? e : h(e); | ||
} | ||
function d(n, e, t) { | ||
var o; | ||
e === void 0 && (e = []), t === void 0 && (t = !0); | ||
const r = h(n), S = r === ((o = n.ownerDocument) == null ? void 0 : o.body), u = i(r); | ||
if (S) { | ||
const s = D(u); | ||
return e.concat(u, u.visualViewport || [], y(r) ? r : [], s && t ? d(s) : []); | ||
} | ||
return e.concat(r, d(r, [], t)); | ||
} | ||
function D(n) { | ||
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null; | ||
} | ||
export { | ||
U as default | ||
b as getComputedStyle, | ||
C as getContainingBlock, | ||
E as getDocumentElement, | ||
D as getFrameElement, | ||
h as getNearestOverflowAncestor, | ||
f as getNodeName, | ||
R as getNodeScroll, | ||
d as getOverflowAncestors, | ||
l as getParentNode, | ||
i as getWindow, | ||
T as isContainingBlock, | ||
m as isElement, | ||
w as isHTMLElement, | ||
g as isLastTraversableNode, | ||
p as isNode, | ||
y as isOverflowElement, | ||
a as isShadowRoot, | ||
k as isTableElement, | ||
N as isTopLayer, | ||
L as isWebKit | ||
}; | ||
//# sourceMappingURL=annotorious-react.es17.js.map |
@@ -1,5 +0,10 @@ | ||
var e = { exports: {} }; | ||
const i = []; | ||
for (let n = 0; n < 256; ++n) | ||
i.push((n + 256).toString(16).slice(1)); | ||
function c(n, u = 0) { | ||
return (i[n[u + 0]] + i[n[u + 1]] + i[n[u + 2]] + i[n[u + 3]] + "-" + i[n[u + 4]] + i[n[u + 5]] + "-" + i[n[u + 6]] + i[n[u + 7]] + "-" + i[n[u + 8]] + i[n[u + 9]] + "-" + i[n[u + 10]] + i[n[u + 11]] + i[n[u + 12]] + i[n[u + 13]] + i[n[u + 14]] + i[n[u + 15]]).toLowerCase(); | ||
} | ||
export { | ||
e as __module | ||
c as unsafeStringify | ||
}; | ||
//# sourceMappingURL=annotorious-react.es18.js.map |
@@ -1,36 +0,5 @@ | ||
import { __exports as t } from "./annotorious-react.es22.js"; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.production.js | ||
* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var i; | ||
function R() { | ||
if (i) return t; | ||
i = 1; | ||
var d = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment"); | ||
function s(_, r, e) { | ||
var n = null; | ||
if (e !== void 0 && (n = "" + e), r.key !== void 0 && (n = "" + r.key), "key" in r) { | ||
e = {}; | ||
for (var u in r) | ||
u !== "key" && (e[u] = r[u]); | ||
} else e = r; | ||
return r = e.ref, { | ||
$$typeof: d, | ||
type: _, | ||
key: n, | ||
ref: r !== void 0 ? r : null, | ||
props: e | ||
}; | ||
} | ||
return t.Fragment = o, t.jsx = s, t.jsxs = s, t; | ||
} | ||
const o = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), t = { randomUUID: o }; | ||
export { | ||
R as __require | ||
t as default | ||
}; | ||
//# sourceMappingURL=annotorious-react.es19.js.map |
@@ -1,6 +0,6 @@ | ||
import { j as E } from "./annotorious-react.es11.js"; | ||
import { onUserSelect as I } from "@annotorious/core"; | ||
import { useDebounce as H } from "./annotorious-react.es12.js"; | ||
import { createContext as O, forwardRef as R, useState as p, useImperativeHandle as P, useEffect as m, useContext as l } from "react"; | ||
const i = O({ | ||
import { jsx as O } from "react/jsx-runtime"; | ||
import { onUserSelect as j } from "@annotorious/core"; | ||
import { useDebounce as H } from "./annotorious-react.es11.js"; | ||
import { createContext as E, forwardRef as P, useState as f, useImperativeHandle as R, useEffect as m, useContext as l } from "react"; | ||
const i = E({ | ||
anno: void 0, | ||
@@ -10,5 +10,5 @@ setAnno: void 0, | ||
selection: { selected: [] } | ||
}), L = R((n, e) => { | ||
const [t, c] = p(null), [a, o] = p([]), [u, r] = p({ selected: [] }); | ||
return P(e, () => t), m(() => { | ||
}), L = P((n, e) => { | ||
const [t, c] = f(null), [a, o] = f([]), [u, r] = f({ selected: [] }); | ||
return R(e, () => t), m(() => { | ||
if (t) { | ||
@@ -20,15 +20,15 @@ const { selection: h, store: s, hover: S } = t.state; | ||
let d; | ||
const b = h.subscribe(({ selected: A, ...j }) => { | ||
const b = h.subscribe(({ selected: A, ...D }) => { | ||
d && s.unobserve(d); | ||
const D = (A || []).map(({ id: f, editable: w }) => ({ annotation: s.getAnnotation(f), editable: w })); | ||
r({ selected: D, ...j }), d = (f) => { | ||
const { updated: w } = f.changes; | ||
const U = (A || []).map(({ id: p, editable: w }) => ({ annotation: s.getAnnotation(p), editable: w })); | ||
r({ selected: U, ...D }), d = (p) => { | ||
const { updated: w } = p.changes; | ||
r((V) => ({ | ||
...V, | ||
selected: V.selected.map(({ annotation: g, editable: x }) => { | ||
const C = w.find((U) => U.oldValue.id === g.id); | ||
const C = w.find((I) => I.oldValue.id === g.id); | ||
return C ? { annotation: C.newValue, editable: x } : { annotation: g, editable: x }; | ||
}) | ||
})); | ||
}, s.observe(d, { annotations: A.map(({ id: f }) => f) }); | ||
}, s.observe(d, { annotations: A.map(({ id: p }) => p) }); | ||
}); | ||
@@ -39,3 +39,3 @@ return () => { | ||
} | ||
}, [t]), /* @__PURE__ */ E.jsx(i.Provider, { value: { | ||
}, [t]), /* @__PURE__ */ O(i.Provider, { value: { | ||
anno: t, | ||
@@ -59,3 +59,3 @@ setAnno: c, | ||
}, N = (n) => n ? y(n) : q(), z = (n, e) => { | ||
const t = k(), [c, a] = p( | ||
const t = k(), [c, a] = f( | ||
t == null ? void 0 : t.getAnnotation(n) | ||
@@ -73,3 +73,3 @@ ); | ||
const t = z(n); | ||
return t ? I(t, e) : void 0; | ||
return t ? j(t, e) : void 0; | ||
}, T = () => { | ||
@@ -79,3 +79,3 @@ const { selection: n } = l(i); | ||
}, W = () => { | ||
const { anno: n } = l(i), [e, t] = p(); | ||
const { anno: n } = l(i), [e, t] = f(); | ||
return m(() => { | ||
@@ -98,3 +98,3 @@ if (!n) return; | ||
}, _ = () => { | ||
const { anno: n } = l(i), [e, t] = p([]); | ||
const { anno: n } = l(i), [e, t] = f([]); | ||
return m(() => { | ||
@@ -101,0 +101,0 @@ if (n) { |
@@ -1,409 +0,14 @@ | ||
import { __exports as _ } from "./annotorious-react.es23.js"; | ||
import we from "react"; | ||
/** | ||
* @license React | ||
* react-jsx-runtime.development.js | ||
* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var ue; | ||
function he() { | ||
return ue ? _ : (ue = 1, process.env.NODE_ENV !== "production" && function() { | ||
function s(e) { | ||
if (e == null) return null; | ||
if (typeof e == "function") | ||
return e.$$typeof === me ? null : e.displayName || e.name || null; | ||
if (typeof e == "string") return e; | ||
switch (e) { | ||
case j: | ||
return "Fragment"; | ||
case ge: | ||
return "Portal"; | ||
case K: | ||
return "Profiler"; | ||
case H: | ||
return "StrictMode"; | ||
case A: | ||
return "Suspense"; | ||
case R: | ||
return "SuspenseList"; | ||
} | ||
if (typeof e == "object") | ||
switch (typeof e.tag == "number" && console.error( | ||
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." | ||
), e.$$typeof) { | ||
case q: | ||
return (e.displayName || "Context") + ".Provider"; | ||
case X: | ||
return (e._context.displayName || "Context") + ".Consumer"; | ||
case S: | ||
var r = e.render; | ||
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e; | ||
case k: | ||
return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo"; | ||
case p: | ||
r = e._payload, e = e._init; | ||
try { | ||
return s(e(r)); | ||
} catch { | ||
} | ||
} | ||
return null; | ||
} | ||
function M(e) { | ||
return "" + e; | ||
} | ||
function W(e) { | ||
try { | ||
M(e); | ||
var r = !1; | ||
} catch { | ||
r = !0; | ||
} | ||
if (r) { | ||
r = console; | ||
var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object"; | ||
return t.call( | ||
r, | ||
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", | ||
n | ||
), M(e); | ||
} | ||
} | ||
function $() { | ||
} | ||
function le() { | ||
if (v === 0) { | ||
Z = console.log, F = console.info, I = console.warn, L = console.error, Q = console.group, D = console.groupCollapsed, ee = console.groupEnd; | ||
var e = { | ||
configurable: !0, | ||
enumerable: !0, | ||
value: $, | ||
writable: !0 | ||
}; | ||
Object.defineProperties(console, { | ||
info: e, | ||
log: e, | ||
warn: e, | ||
error: e, | ||
group: e, | ||
groupCollapsed: e, | ||
groupEnd: e | ||
}); | ||
} | ||
v++; | ||
} | ||
function fe() { | ||
if (v--, v === 0) { | ||
var e = { configurable: !0, enumerable: !0, writable: !0 }; | ||
Object.defineProperties(console, { | ||
log: E({}, e, { value: Z }), | ||
info: E({}, e, { value: F }), | ||
warn: E({}, e, { value: I }), | ||
error: E({}, e, { value: L }), | ||
group: E({}, e, { value: Q }), | ||
groupCollapsed: E({}, e, { value: D }), | ||
groupEnd: E({}, e, { value: ee }) | ||
}); | ||
} | ||
0 > v && console.error( | ||
"disabledDepth fell below zero. This is a bug in React. Please file an issue." | ||
); | ||
} | ||
function y(e) { | ||
if (x === void 0) | ||
try { | ||
throw Error(); | ||
} catch (t) { | ||
var r = t.stack.trim().match(/\n( *(at )?)/); | ||
x = r && r[1] || "", re = -1 < t.stack.indexOf(` | ||
at`) ? " (<anonymous>)" : -1 < t.stack.indexOf("@") ? "@unknown:0:0" : ""; | ||
} | ||
return ` | ||
` + x + e + re; | ||
} | ||
function U(e, r) { | ||
if (!e || P) return ""; | ||
var t = Y.get(e); | ||
if (t !== void 0) return t; | ||
P = !0, t = Error.prepareStackTrace, Error.prepareStackTrace = void 0; | ||
var n = null; | ||
n = d.H, d.H = null, le(); | ||
try { | ||
var u = { | ||
DetermineComponentFrameRoot: function() { | ||
try { | ||
if (r) { | ||
var i = function() { | ||
throw Error(); | ||
}; | ||
if (Object.defineProperty(i.prototype, "props", { | ||
set: function() { | ||
throw Error(); | ||
} | ||
}), typeof Reflect == "object" && Reflect.construct) { | ||
try { | ||
Reflect.construct(i, []); | ||
} catch (c) { | ||
var w = c; | ||
} | ||
Reflect.construct(e, [], i); | ||
} else { | ||
try { | ||
i.call(); | ||
} catch (c) { | ||
w = c; | ||
} | ||
e.call(i.prototype); | ||
} | ||
} else { | ||
try { | ||
throw Error(); | ||
} catch (c) { | ||
w = c; | ||
} | ||
(i = e()) && typeof i.catch == "function" && i.catch(function() { | ||
}); | ||
} | ||
} catch (c) { | ||
if (c && w && typeof c.stack == "string") | ||
return [c.stack, w.stack]; | ||
} | ||
return [null, null]; | ||
} | ||
}; | ||
u.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; | ||
var a = Object.getOwnPropertyDescriptor( | ||
u.DetermineComponentFrameRoot, | ||
"name" | ||
); | ||
a && a.configurable && Object.defineProperty( | ||
u.DetermineComponentFrameRoot, | ||
"name", | ||
{ value: "DetermineComponentFrameRoot" } | ||
); | ||
var o = u.DetermineComponentFrameRoot(), f = o[0], g = o[1]; | ||
if (f && g) { | ||
var l = f.split(` | ||
`), b = g.split(` | ||
`); | ||
for (o = a = 0; a < l.length && !l[a].includes( | ||
"DetermineComponentFrameRoot" | ||
); ) | ||
a++; | ||
for (; o < b.length && !b[o].includes( | ||
"DetermineComponentFrameRoot" | ||
); ) | ||
o++; | ||
if (a === l.length || o === b.length) | ||
for (a = l.length - 1, o = b.length - 1; 1 <= a && 0 <= o && l[a] !== b[o]; ) | ||
o--; | ||
for (; 1 <= a && 0 <= o; a--, o--) | ||
if (l[a] !== b[o]) { | ||
if (a !== 1 || o !== 1) | ||
do | ||
if (a--, o--, 0 > o || l[a] !== b[o]) { | ||
var m = ` | ||
` + l[a].replace( | ||
" at new ", | ||
" at " | ||
); | ||
return e.displayName && m.includes("<anonymous>") && (m = m.replace("<anonymous>", e.displayName)), typeof e == "function" && Y.set(e, m), m; | ||
} | ||
while (1 <= a && 0 <= o); | ||
break; | ||
} | ||
} | ||
} finally { | ||
P = !1, d.H = n, fe(), Error.prepareStackTrace = t; | ||
} | ||
return l = (l = e ? e.displayName || e.name : "") ? y(l) : "", typeof e == "function" && Y.set(e, l), l; | ||
} | ||
function T(e) { | ||
if (e == null) return ""; | ||
if (typeof e == "function") { | ||
var r = e.prototype; | ||
return U( | ||
e, | ||
!(!r || !r.isReactComponent) | ||
); | ||
} | ||
if (typeof e == "string") return y(e); | ||
switch (e) { | ||
case A: | ||
return y("Suspense"); | ||
case R: | ||
return y("SuspenseList"); | ||
} | ||
if (typeof e == "object") | ||
switch (e.$$typeof) { | ||
case S: | ||
return e = U(e.render, !1), e; | ||
case k: | ||
return T(e.type); | ||
case p: | ||
r = e._payload, e = e._init; | ||
try { | ||
return T(e(r)); | ||
} catch { | ||
} | ||
} | ||
return ""; | ||
} | ||
function C() { | ||
var e = d.A; | ||
return e === null ? null : e.getOwner(); | ||
} | ||
function ce(e) { | ||
if (J.call(e, "key")) { | ||
var r = Object.getOwnPropertyDescriptor(e, "key").get; | ||
if (r && r.isReactWarning) return !1; | ||
} | ||
return e.key !== void 0; | ||
} | ||
function se(e, r) { | ||
function t() { | ||
te || (te = !0, console.error( | ||
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", | ||
r | ||
)); | ||
} | ||
t.isReactWarning = !0, Object.defineProperty(e, "key", { | ||
get: t, | ||
configurable: !0 | ||
}); | ||
} | ||
function ie() { | ||
var e = s(this.type); | ||
return oe[e] || (oe[e] = !0, console.error( | ||
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." | ||
)), e = this.props.ref, e !== void 0 ? e : null; | ||
} | ||
function de(e, r, t, n, u, a) { | ||
return t = a.ref, e = { | ||
$$typeof: O, | ||
type: e, | ||
key: r, | ||
props: a, | ||
_owner: u | ||
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", { | ||
enumerable: !1, | ||
get: ie | ||
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", { | ||
configurable: !1, | ||
enumerable: !1, | ||
writable: !0, | ||
value: 0 | ||
}), Object.defineProperty(e, "_debugInfo", { | ||
configurable: !1, | ||
enumerable: !1, | ||
writable: !0, | ||
value: null | ||
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e; | ||
} | ||
function z(e, r, t, n, u, a) { | ||
if (typeof e == "string" || typeof e == "function" || e === j || e === K || e === H || e === A || e === R || e === ve || typeof e == "object" && e !== null && (e.$$typeof === p || e.$$typeof === k || e.$$typeof === q || e.$$typeof === X || e.$$typeof === S || e.$$typeof === _e || e.getModuleId !== void 0)) { | ||
var o = r.children; | ||
if (o !== void 0) | ||
if (n) | ||
if (N(o)) { | ||
for (n = 0; n < o.length; n++) | ||
V(o[n], e); | ||
Object.freeze && Object.freeze(o); | ||
} else | ||
console.error( | ||
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." | ||
); | ||
else V(o, e); | ||
} else | ||
o = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? n = "null" : N(e) ? n = "array" : e !== void 0 && e.$$typeof === O ? (n = "<" + (s(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : n = typeof e, console.error( | ||
"React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", | ||
n, | ||
o | ||
); | ||
if (J.call(r, "key")) { | ||
o = s(e); | ||
var f = Object.keys(r).filter(function(l) { | ||
return l !== "key"; | ||
}); | ||
n = 0 < f.length ? "{key: someKey, " + f.join(": ..., ") + ": ...}" : "{key: someKey}", ne[o + n] || (f = 0 < f.length ? "{" + f.join(": ..., ") + ": ...}" : "{}", console.error( | ||
`A props object containing a "key" prop is being spread into JSX: | ||
let props = %s; | ||
<%s {...props} /> | ||
React keys must be passed directly to JSX without using spread: | ||
let props = %s; | ||
<%s key={someKey} {...props} />`, | ||
n, | ||
o, | ||
f, | ||
o | ||
), ne[o + n] = !0); | ||
} | ||
if (o = null, t !== void 0 && (W(t), o = "" + t), ce(r) && (W(r.key), o = "" + r.key), "key" in r) { | ||
t = {}; | ||
for (var g in r) | ||
g !== "key" && (t[g] = r[g]); | ||
} else t = r; | ||
return o && se( | ||
t, | ||
typeof e == "function" ? e.displayName || e.name || "Unknown" : e | ||
), de(e, o, a, u, C(), t); | ||
} | ||
function V(e, r) { | ||
if (typeof e == "object" && e && e.$$typeof !== ye) { | ||
if (N(e)) | ||
for (var t = 0; t < e.length; t++) { | ||
var n = e[t]; | ||
h(n) && G(n, r); | ||
} | ||
else if (h(e)) | ||
e._store && (e._store.validated = 1); | ||
else if (e === null || typeof e != "object" ? t = null : (t = B && e[B] || e["@@iterator"], t = typeof t == "function" ? t : null), typeof t == "function" && t !== e.entries && (t = t.call(e), t !== e)) | ||
for (; !(e = t.next()).done; ) | ||
h(e.value) && G(e.value, r); | ||
} | ||
} | ||
function h(e) { | ||
return typeof e == "object" && e !== null && e.$$typeof === O; | ||
} | ||
function G(e, r) { | ||
if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, r = Ee(r), !ae[r])) { | ||
ae[r] = !0; | ||
var t = ""; | ||
e && e._owner != null && e._owner !== C() && (t = null, typeof e._owner.tag == "number" ? t = s(e._owner.type) : typeof e._owner.name == "string" && (t = e._owner.name), t = " It was passed a child from " + t + "."); | ||
var n = d.getCurrentStack; | ||
d.getCurrentStack = function() { | ||
var u = T(e.type); | ||
return n && (u += n() || ""), u; | ||
}, console.error( | ||
'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.', | ||
r, | ||
t | ||
), d.getCurrentStack = n; | ||
} | ||
} | ||
function Ee(e) { | ||
var r = "", t = C(); | ||
return t && (t = s(t.type)) && (r = ` | ||
Check the render method of \`` + t + "`."), r || (e = s(e)) && (r = ` | ||
Check the top-level render call using <` + e + ">."), r; | ||
} | ||
var be = we, O = Symbol.for("react.transitional.element"), ge = Symbol.for("react.portal"), j = Symbol.for("react.fragment"), H = Symbol.for("react.strict_mode"), K = Symbol.for("react.profiler"), X = Symbol.for("react.consumer"), q = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), A = Symbol.for("react.suspense"), R = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), ve = Symbol.for("react.offscreen"), B = Symbol.iterator, me = Symbol.for("react.client.reference"), d = be.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, E = Object.assign, _e = Symbol.for("react.client.reference"), N = Array.isArray, v = 0, Z, F, I, L, Q, D, ee; | ||
$.__reactDisabledLog = !0; | ||
var x, re, P = !1, Y = new (typeof WeakMap == "function" ? WeakMap : Map)(), ye = Symbol.for("react.client.reference"), te, oe = {}, ne = {}, ae = {}; | ||
_.Fragment = j, _.jsx = function(e, r, t, n, u) { | ||
return z(e, r, t, !1, n, u); | ||
}, _.jsxs = function(e, r, t, n, u) { | ||
return z(e, r, t, !0, n, u); | ||
}; | ||
}(), _); | ||
let t; | ||
const e = new Uint8Array(16); | ||
function o() { | ||
if (!t) { | ||
if (typeof crypto > "u" || !crypto.getRandomValues) | ||
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); | ||
t = crypto.getRandomValues.bind(crypto); | ||
} | ||
return t(e); | ||
} | ||
export { | ||
he as __require | ||
o as default | ||
}; | ||
//# sourceMappingURL=annotorious-react.es20.js.map |
@@ -1,132 +0,129 @@ | ||
function c() { | ||
return typeof window < "u"; | ||
const l = Math.min, a = Math.max, P = Math.round, M = Math.floor, O = (t) => ({ | ||
x: t, | ||
y: t | ||
}), m = { | ||
left: "right", | ||
right: "left", | ||
bottom: "top", | ||
top: "bottom" | ||
}, p = { | ||
start: "end", | ||
end: "start" | ||
}; | ||
function S(t, n, e) { | ||
return a(t, l(n, e)); | ||
} | ||
function f(n) { | ||
return p(n) ? (n.nodeName || "").toLowerCase() : "#document"; | ||
function w(t, n) { | ||
return typeof t == "function" ? t(n) : t; | ||
} | ||
function i(n) { | ||
var e; | ||
return (n == null || (e = n.ownerDocument) == null ? void 0 : e.defaultView) || window; | ||
function f(t) { | ||
return t.split("-")[0]; | ||
} | ||
function E(n) { | ||
var e; | ||
return (e = (p(n) ? n.ownerDocument : n.document) || window.document) == null ? void 0 : e.documentElement; | ||
function g(t) { | ||
return t.split("-")[1]; | ||
} | ||
function p(n) { | ||
return c() ? n instanceof Node || n instanceof i(n).Node : !1; | ||
function h(t) { | ||
return t === "x" ? "y" : "x"; | ||
} | ||
function m(n) { | ||
return c() ? n instanceof Element || n instanceof i(n).Element : !1; | ||
function x(t) { | ||
return t === "y" ? "height" : "width"; | ||
} | ||
function w(n) { | ||
return c() ? n instanceof HTMLElement || n instanceof i(n).HTMLElement : !1; | ||
function b(t) { | ||
return ["top", "bottom"].includes(f(t)) ? "y" : "x"; | ||
} | ||
function a(n) { | ||
return !c() || typeof ShadowRoot > "u" ? !1 : n instanceof ShadowRoot || n instanceof i(n).ShadowRoot; | ||
function d(t) { | ||
return h(b(t)); | ||
} | ||
function y(n) { | ||
const { | ||
overflow: e, | ||
overflowX: t, | ||
overflowY: o, | ||
display: r | ||
} = b(n); | ||
return /auto|scroll|overlay|hidden|clip/.test(e + o + t) && !["inline", "contents"].includes(r); | ||
function j(t, n, e) { | ||
e === void 0 && (e = !1); | ||
const r = g(t), o = d(t), i = x(o); | ||
let c = o === "x" ? r === (e ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top"; | ||
return n.reference[i] > n.floating[i] && (c = u(c)), [c, u(c)]; | ||
} | ||
function k(n) { | ||
return ["table", "td", "th"].includes(f(n)); | ||
function C(t) { | ||
const n = u(t); | ||
return [s(t), n, s(n)]; | ||
} | ||
function N(n) { | ||
return [":popover-open", ":modal"].some((e) => { | ||
try { | ||
return n.matches(e); | ||
} catch { | ||
return !1; | ||
} | ||
}); | ||
function s(t) { | ||
return t.replace(/start|end/g, (n) => p[n]); | ||
} | ||
function T(n) { | ||
const e = L(), t = m(n) ? b(n) : n; | ||
return ["transform", "translate", "scale", "rotate", "perspective"].some((o) => t[o] ? t[o] !== "none" : !1) || (t.containerType ? t.containerType !== "normal" : !1) || !e && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !e && (t.filter ? t.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (t.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (t.contain || "").includes(o)); | ||
} | ||
function C(n) { | ||
let e = l(n); | ||
for (; w(e) && !g(e); ) { | ||
if (T(e)) | ||
return e; | ||
if (N(e)) | ||
return null; | ||
e = l(e); | ||
function A(t, n, e) { | ||
const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], c = ["bottom", "top"]; | ||
switch (t) { | ||
case "top": | ||
case "bottom": | ||
return e ? n ? o : r : n ? r : o; | ||
case "left": | ||
case "right": | ||
return n ? i : c; | ||
default: | ||
return []; | ||
} | ||
return null; | ||
} | ||
function L() { | ||
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none"); | ||
function L(t, n, e, r) { | ||
const o = g(t); | ||
let i = A(f(t), e === "start", r); | ||
return o && (i = i.map((c) => c + "-" + o), n && (i = i.concat(i.map(s)))), i; | ||
} | ||
function g(n) { | ||
return ["html", "body", "#document"].includes(f(n)); | ||
function u(t) { | ||
return t.replace(/left|right|bottom|top/g, (n) => m[n]); | ||
} | ||
function b(n) { | ||
return i(n).getComputedStyle(n); | ||
function y(t) { | ||
return { | ||
top: 0, | ||
right: 0, | ||
bottom: 0, | ||
left: 0, | ||
...t | ||
}; | ||
} | ||
function R(n) { | ||
return m(n) ? { | ||
scrollLeft: n.scrollLeft, | ||
scrollTop: n.scrollTop | ||
} : { | ||
scrollLeft: n.scrollX, | ||
scrollTop: n.scrollY | ||
function E(t) { | ||
return typeof t != "number" ? y(t) : { | ||
top: t, | ||
right: t, | ||
bottom: t, | ||
left: t | ||
}; | ||
} | ||
function l(n) { | ||
if (f(n) === "html") | ||
return n; | ||
const e = ( | ||
// Step into the shadow DOM of the parent of a slotted node. | ||
n.assignedSlot || // DOM Element detected. | ||
n.parentNode || // ShadowRoot detected. | ||
a(n) && n.host || // Fallback. | ||
E(n) | ||
); | ||
return a(e) ? e.host : e; | ||
function R(t) { | ||
const { | ||
x: n, | ||
y: e, | ||
width: r, | ||
height: o | ||
} = t; | ||
return { | ||
width: r, | ||
height: o, | ||
top: e, | ||
left: n, | ||
right: n + r, | ||
bottom: e + o, | ||
x: n, | ||
y: e | ||
}; | ||
} | ||
function h(n) { | ||
const e = l(n); | ||
return g(e) ? n.ownerDocument ? n.ownerDocument.body : n.body : w(e) && y(e) ? e : h(e); | ||
} | ||
function d(n, e, t) { | ||
var o; | ||
e === void 0 && (e = []), t === void 0 && (t = !0); | ||
const r = h(n), S = r === ((o = n.ownerDocument) == null ? void 0 : o.body), u = i(r); | ||
if (S) { | ||
const s = D(u); | ||
return e.concat(u, u.visualViewport || [], y(r) ? r : [], s && t ? d(s) : []); | ||
} | ||
return e.concat(r, d(r, [], t)); | ||
} | ||
function D(n) { | ||
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null; | ||
} | ||
export { | ||
b as getComputedStyle, | ||
C as getContainingBlock, | ||
E as getDocumentElement, | ||
D as getFrameElement, | ||
h as getNearestOverflowAncestor, | ||
f as getNodeName, | ||
R as getNodeScroll, | ||
d as getOverflowAncestors, | ||
l as getParentNode, | ||
i as getWindow, | ||
T as isContainingBlock, | ||
m as isElement, | ||
w as isHTMLElement, | ||
g as isLastTraversableNode, | ||
p as isNode, | ||
y as isOverflowElement, | ||
a as isShadowRoot, | ||
k as isTableElement, | ||
N as isTopLayer, | ||
L as isWebKit | ||
S as clamp, | ||
O as createCoords, | ||
w as evaluate, | ||
y as expandPaddingObject, | ||
M as floor, | ||
g as getAlignment, | ||
d as getAlignmentAxis, | ||
j as getAlignmentSides, | ||
x as getAxisLength, | ||
C as getExpandedPlacements, | ||
s as getOppositeAlignmentPlacement, | ||
h as getOppositeAxis, | ||
L as getOppositeAxisPlacements, | ||
u as getOppositePlacement, | ||
E as getPaddingObject, | ||
f as getSide, | ||
b as getSideAxis, | ||
a as max, | ||
l as min, | ||
R as rectToClientRect, | ||
P as round | ||
}; | ||
//# sourceMappingURL=annotorious-react.es21.js.map |
@@ -1,5 +0,469 @@ | ||
var r = {}; | ||
import { evaluate as Y, getSide as F, getSideAxis as M, getOppositePlacement as Q, getExpandedPlacements as U, getOppositeAxisPlacements as Z, getAlignmentSides as ee, rectToClientRect as $, getPaddingObject as H, clamp as _, getAlignmentAxis as q, getAlignment as I, min as X, max as z, getOppositeAxis as te, getAxisLength as G } from "./annotorious-react.es21.js"; | ||
function W(s, c, l) { | ||
let { | ||
reference: t, | ||
floating: o | ||
} = s; | ||
const e = M(c), a = q(c), r = G(a), d = F(c), u = e === "y", g = t.x + t.width / 2 - o.width / 2, i = t.y + t.height / 2 - o.height / 2, m = t[r] / 2 - o[r] / 2; | ||
let n; | ||
switch (d) { | ||
case "top": | ||
n = { | ||
x: g, | ||
y: t.y - o.height | ||
}; | ||
break; | ||
case "bottom": | ||
n = { | ||
x: g, | ||
y: t.y + t.height | ||
}; | ||
break; | ||
case "right": | ||
n = { | ||
x: t.x + t.width, | ||
y: i | ||
}; | ||
break; | ||
case "left": | ||
n = { | ||
x: t.x - o.width, | ||
y: i | ||
}; | ||
break; | ||
default: | ||
n = { | ||
x: t.x, | ||
y: t.y | ||
}; | ||
} | ||
switch (I(c)) { | ||
case "start": | ||
n[a] -= m * (l && u ? -1 : 1); | ||
break; | ||
case "end": | ||
n[a] += m * (l && u ? -1 : 1); | ||
break; | ||
} | ||
return n; | ||
} | ||
const oe = async (s, c, l) => { | ||
const { | ||
placement: t = "bottom", | ||
strategy: o = "absolute", | ||
middleware: e = [], | ||
platform: a | ||
} = l, r = e.filter(Boolean), d = await (a.isRTL == null ? void 0 : a.isRTL(c)); | ||
let u = await a.getElementRects({ | ||
reference: s, | ||
floating: c, | ||
strategy: o | ||
}), { | ||
x: g, | ||
y: i | ||
} = W(u, t, d), m = t, n = {}, f = 0; | ||
for (let h = 0; h < r.length; h++) { | ||
const { | ||
name: x, | ||
fn: w | ||
} = r[h], { | ||
x: b, | ||
y, | ||
data: P, | ||
reset: p | ||
} = await w({ | ||
x: g, | ||
y: i, | ||
initialPlacement: t, | ||
placement: m, | ||
strategy: o, | ||
middlewareData: n, | ||
rects: u, | ||
platform: a, | ||
elements: { | ||
reference: s, | ||
floating: c | ||
} | ||
}); | ||
g = b ?? g, i = y ?? i, n = { | ||
...n, | ||
[x]: { | ||
...n[x], | ||
...P | ||
} | ||
}, p && f <= 50 && (f++, typeof p == "object" && (p.placement && (m = p.placement), p.rects && (u = p.rects === !0 ? await a.getElementRects({ | ||
reference: s, | ||
floating: c, | ||
strategy: o | ||
}) : p.rects), { | ||
x: g, | ||
y: i | ||
} = W(u, m, d)), h = -1); | ||
} | ||
return { | ||
x: g, | ||
y: i, | ||
placement: m, | ||
strategy: o, | ||
middlewareData: n | ||
}; | ||
}; | ||
async function J(s, c) { | ||
var l; | ||
c === void 0 && (c = {}); | ||
const { | ||
x: t, | ||
y: o, | ||
platform: e, | ||
rects: a, | ||
elements: r, | ||
strategy: d | ||
} = s, { | ||
boundary: u = "clippingAncestors", | ||
rootBoundary: g = "viewport", | ||
elementContext: i = "floating", | ||
altBoundary: m = !1, | ||
padding: n = 0 | ||
} = Y(c, s), f = H(n), x = r[m ? i === "floating" ? "reference" : "floating" : i], w = $(await e.getClippingRect({ | ||
element: (l = await (e.isElement == null ? void 0 : e.isElement(x))) == null || l ? x : x.contextElement || await (e.getDocumentElement == null ? void 0 : e.getDocumentElement(r.floating)), | ||
boundary: u, | ||
rootBoundary: g, | ||
strategy: d | ||
})), b = i === "floating" ? { | ||
x: t, | ||
y: o, | ||
width: a.floating.width, | ||
height: a.floating.height | ||
} : a.reference, y = await (e.getOffsetParent == null ? void 0 : e.getOffsetParent(r.floating)), P = await (e.isElement == null ? void 0 : e.isElement(y)) ? await (e.getScale == null ? void 0 : e.getScale(y)) || { | ||
x: 1, | ||
y: 1 | ||
} : { | ||
x: 1, | ||
y: 1 | ||
}, p = $(e.convertOffsetParentRelativeRectToViewportRelativeRect ? await e.convertOffsetParentRelativeRectToViewportRelativeRect({ | ||
elements: r, | ||
rect: b, | ||
offsetParent: y, | ||
strategy: d | ||
}) : b); | ||
return { | ||
top: (w.top - p.top + f.top) / P.y, | ||
bottom: (p.bottom - w.bottom + f.bottom) / P.y, | ||
left: (w.left - p.left + f.left) / P.x, | ||
right: (p.right - w.right + f.right) / P.x | ||
}; | ||
} | ||
const ce = (s) => ({ | ||
name: "arrow", | ||
options: s, | ||
async fn(c) { | ||
const { | ||
x: l, | ||
y: t, | ||
placement: o, | ||
rects: e, | ||
platform: a, | ||
elements: r, | ||
middlewareData: d | ||
} = c, { | ||
element: u, | ||
padding: g = 0 | ||
} = Y(s, c) || {}; | ||
if (u == null) | ||
return {}; | ||
const i = H(g), m = { | ||
x: l, | ||
y: t | ||
}, n = q(o), f = G(n), h = await a.getDimensions(u), x = n === "y", w = x ? "top" : "left", b = x ? "bottom" : "right", y = x ? "clientHeight" : "clientWidth", P = e.reference[f] + e.reference[n] - m[n] - e.floating[f], p = m[n] - e.reference[n], C = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(u)); | ||
let k = C ? C[y] : 0; | ||
(!k || !await (a.isElement == null ? void 0 : a.isElement(C))) && (k = r.floating[y] || e.floating[f]); | ||
const j = P / 2 - p / 2, T = k / 2 - h[f] / 2 - 1, A = X(i[w], T), L = X(i[b], T), S = A, B = k - h[f] - L, R = k / 2 - h[f] / 2 + j, D = _(S, R, B), v = !d.arrow && I(o) != null && R !== D && e.reference[f] / 2 - (R < S ? A : L) - h[f] / 2 < 0, O = v ? R < S ? R - S : R - B : 0; | ||
return { | ||
[n]: m[n] + O, | ||
data: { | ||
[n]: D, | ||
centerOffset: R - D - O, | ||
...v && { | ||
alignmentOffset: O | ||
} | ||
}, | ||
reset: v | ||
}; | ||
} | ||
}), le = function(s) { | ||
return s === void 0 && (s = {}), { | ||
name: "flip", | ||
options: s, | ||
async fn(c) { | ||
var l, t; | ||
const { | ||
placement: o, | ||
middlewareData: e, | ||
rects: a, | ||
initialPlacement: r, | ||
platform: d, | ||
elements: u | ||
} = c, { | ||
mainAxis: g = !0, | ||
crossAxis: i = !0, | ||
fallbackPlacements: m, | ||
fallbackStrategy: n = "bestFit", | ||
fallbackAxisSideDirection: f = "none", | ||
flipAlignment: h = !0, | ||
...x | ||
} = Y(s, c); | ||
if ((l = e.arrow) != null && l.alignmentOffset) | ||
return {}; | ||
const w = F(o), b = M(r), y = F(r) === r, P = await (d.isRTL == null ? void 0 : d.isRTL(u.floating)), p = m || (y || !h ? [Q(r)] : U(r)), C = f !== "none"; | ||
!m && C && p.push(...Z(r, h, f, P)); | ||
const k = [r, ...p], j = await J(c, x), T = []; | ||
let A = ((t = e.flip) == null ? void 0 : t.overflows) || []; | ||
if (g && T.push(j[w]), i) { | ||
const R = ee(o, a, P); | ||
T.push(j[R[0]], j[R[1]]); | ||
} | ||
if (A = [...A, { | ||
placement: o, | ||
overflows: T | ||
}], !T.every((R) => R <= 0)) { | ||
var L, S; | ||
const R = (((L = e.flip) == null ? void 0 : L.index) || 0) + 1, D = k[R]; | ||
if (D) | ||
return { | ||
data: { | ||
index: R, | ||
overflows: A | ||
}, | ||
reset: { | ||
placement: D | ||
} | ||
}; | ||
let v = (S = A.filter((O) => O.overflows[0] <= 0).sort((O, E) => O.overflows[1] - E.overflows[1])[0]) == null ? void 0 : S.placement; | ||
if (!v) | ||
switch (n) { | ||
case "bestFit": { | ||
var B; | ||
const O = (B = A.filter((E) => { | ||
if (C) { | ||
const V = M(E.placement); | ||
return V === b || // Create a bias to the `y` side axis due to horizontal | ||
// reading directions favoring greater width. | ||
V === "y"; | ||
} | ||
return !0; | ||
}).map((E) => [E.placement, E.overflows.filter((V) => V > 0).reduce((V, N) => V + N, 0)]).sort((E, V) => E[1] - V[1])[0]) == null ? void 0 : B[0]; | ||
O && (v = O); | ||
break; | ||
} | ||
case "initialPlacement": | ||
v = r; | ||
break; | ||
} | ||
if (o !== v) | ||
return { | ||
reset: { | ||
placement: v | ||
} | ||
}; | ||
} | ||
return {}; | ||
} | ||
}; | ||
}; | ||
function K(s) { | ||
const c = X(...s.map((e) => e.left)), l = X(...s.map((e) => e.top)), t = z(...s.map((e) => e.right)), o = z(...s.map((e) => e.bottom)); | ||
return { | ||
x: c, | ||
y: l, | ||
width: t - c, | ||
height: o - l | ||
}; | ||
} | ||
function ne(s) { | ||
const c = s.slice().sort((o, e) => o.y - e.y), l = []; | ||
let t = null; | ||
for (let o = 0; o < c.length; o++) { | ||
const e = c[o]; | ||
!t || e.y - t.y > t.height / 2 ? l.push([e]) : l[l.length - 1].push(e), t = e; | ||
} | ||
return l.map((o) => $(K(o))); | ||
} | ||
const ae = function(s) { | ||
return s === void 0 && (s = {}), { | ||
name: "inline", | ||
options: s, | ||
async fn(c) { | ||
const { | ||
placement: l, | ||
elements: t, | ||
rects: o, | ||
platform: e, | ||
strategy: a | ||
} = c, { | ||
padding: r = 2, | ||
x: d, | ||
y: u | ||
} = Y(s, c), g = Array.from(await (e.getClientRects == null ? void 0 : e.getClientRects(t.reference)) || []), i = ne(g), m = $(K(g)), n = H(r); | ||
function f() { | ||
if (i.length === 2 && i[0].left > i[1].right && d != null && u != null) | ||
return i.find((x) => d > x.left - n.left && d < x.right + n.right && u > x.top - n.top && u < x.bottom + n.bottom) || m; | ||
if (i.length >= 2) { | ||
if (M(l) === "y") { | ||
const A = i[0], L = i[i.length - 1], S = F(l) === "top", B = A.top, R = L.bottom, D = S ? A.left : L.left, v = S ? A.right : L.right, O = v - D, E = R - B; | ||
return { | ||
top: B, | ||
bottom: R, | ||
left: D, | ||
right: v, | ||
width: O, | ||
height: E, | ||
x: D, | ||
y: B | ||
}; | ||
} | ||
const x = F(l) === "left", w = z(...i.map((A) => A.right)), b = X(...i.map((A) => A.left)), y = i.filter((A) => x ? A.left === b : A.right === w), P = y[0].top, p = y[y.length - 1].bottom, C = b, k = w, j = k - C, T = p - P; | ||
return { | ||
top: P, | ||
bottom: p, | ||
left: C, | ||
right: k, | ||
width: j, | ||
height: T, | ||
x: C, | ||
y: P | ||
}; | ||
} | ||
return m; | ||
} | ||
const h = await e.getElementRects({ | ||
reference: { | ||
getBoundingClientRect: f | ||
}, | ||
floating: t.floating, | ||
strategy: a | ||
}); | ||
return o.reference.x !== h.reference.x || o.reference.y !== h.reference.y || o.reference.width !== h.reference.width || o.reference.height !== h.reference.height ? { | ||
reset: { | ||
rects: h | ||
} | ||
} : {}; | ||
} | ||
}; | ||
}; | ||
async function ie(s, c) { | ||
const { | ||
placement: l, | ||
platform: t, | ||
elements: o | ||
} = s, e = await (t.isRTL == null ? void 0 : t.isRTL(o.floating)), a = F(l), r = I(l), d = M(l) === "y", u = ["left", "top"].includes(a) ? -1 : 1, g = e && d ? -1 : 1, i = Y(c, s); | ||
let { | ||
mainAxis: m, | ||
crossAxis: n, | ||
alignmentAxis: f | ||
} = typeof i == "number" ? { | ||
mainAxis: i, | ||
crossAxis: 0, | ||
alignmentAxis: null | ||
} : { | ||
mainAxis: i.mainAxis || 0, | ||
crossAxis: i.crossAxis || 0, | ||
alignmentAxis: i.alignmentAxis | ||
}; | ||
return r && typeof f == "number" && (n = r === "end" ? f * -1 : f), d ? { | ||
x: n * g, | ||
y: m * u | ||
} : { | ||
x: m * u, | ||
y: n * g | ||
}; | ||
} | ||
const re = function(s) { | ||
return s === void 0 && (s = 0), { | ||
name: "offset", | ||
options: s, | ||
async fn(c) { | ||
var l, t; | ||
const { | ||
x: o, | ||
y: e, | ||
placement: a, | ||
middlewareData: r | ||
} = c, d = await ie(c, s); | ||
return a === ((l = r.offset) == null ? void 0 : l.placement) && (t = r.arrow) != null && t.alignmentOffset ? {} : { | ||
x: o + d.x, | ||
y: e + d.y, | ||
data: { | ||
...d, | ||
placement: a | ||
} | ||
}; | ||
} | ||
}; | ||
}, fe = function(s) { | ||
return s === void 0 && (s = {}), { | ||
name: "shift", | ||
options: s, | ||
async fn(c) { | ||
const { | ||
x: l, | ||
y: t, | ||
placement: o | ||
} = c, { | ||
mainAxis: e = !0, | ||
crossAxis: a = !1, | ||
limiter: r = { | ||
fn: (x) => { | ||
let { | ||
x: w, | ||
y: b | ||
} = x; | ||
return { | ||
x: w, | ||
y: b | ||
}; | ||
} | ||
}, | ||
...d | ||
} = Y(s, c), u = { | ||
x: l, | ||
y: t | ||
}, g = await J(c, d), i = M(F(o)), m = te(i); | ||
let n = u[m], f = u[i]; | ||
if (e) { | ||
const x = m === "y" ? "top" : "left", w = m === "y" ? "bottom" : "right", b = n + g[x], y = n - g[w]; | ||
n = _(b, n, y); | ||
} | ||
if (a) { | ||
const x = i === "y" ? "top" : "left", w = i === "y" ? "bottom" : "right", b = f + g[x], y = f - g[w]; | ||
f = _(b, f, y); | ||
} | ||
const h = r.fn({ | ||
...c, | ||
[m]: n, | ||
[i]: f | ||
}); | ||
return { | ||
...h, | ||
data: { | ||
x: h.x - l, | ||
y: h.y - t, | ||
enabled: { | ||
[m]: e, | ||
[i]: a | ||
} | ||
} | ||
}; | ||
} | ||
}; | ||
}; | ||
export { | ||
r as __exports | ||
ce as arrow, | ||
oe as computePosition, | ||
J as detectOverflow, | ||
le as flip, | ||
ae as inline, | ||
re as offset, | ||
$ as rectToClientRect, | ||
fe as shift | ||
}; | ||
//# sourceMappingURL=annotorious-react.es22.js.map |
@@ -1,10 +0,10 @@ | ||
import { j as g } from "./annotorious-react.es11.js"; | ||
import { useState as E, useRef as C, useEffect as A } from "react"; | ||
import { useFloating as D, FloatingArrow as O } from "./annotorious-react.es13.js"; | ||
import { useAnnotator as j, useSelection as L } from "./annotorious-react.es2.js"; | ||
import { toClientRects as S } from "./annotorious-react.es14.js"; | ||
import { inline as U, offset as F, flip as M, shift as P, arrow as b } from "./annotorious-react.es15.js"; | ||
import { autoUpdate as k } from "./annotorious-react.es16.js"; | ||
import w from "./annotorious-react.es17.js"; | ||
const z = (i, t) => { | ||
import { jsxs as x, jsx as C } from "react/jsx-runtime"; | ||
import { useState as E, useRef as A, useEffect as D } from "react"; | ||
import { useFloating as O, FloatingArrow as L } from "./annotorious-react.es12.js"; | ||
import { useAnnotator as S, useSelection as U } from "./annotorious-react.es2.js"; | ||
import { toClientRects as F } from "./annotorious-react.es13.js"; | ||
import { inline as M, offset as P, flip as b, shift as j, arrow as k } from "./annotorious-react.es14.js"; | ||
import { autoUpdate as z } from "./annotorious-react.es15.js"; | ||
import g from "./annotorious-react.es16.js"; | ||
const H = (i, t) => { | ||
const n = t.querySelector("img"), { left: a, top: d } = n.getBoundingClientRect(), s = n.offsetWidth / n.naturalWidth, c = n.offsetHeight / n.naturalHeight, { minX: o, minY: l, maxX: p, maxY: u } = i.bounds; | ||
@@ -17,16 +17,16 @@ return new DOMRect( | ||
); | ||
}, K = (i) => { | ||
}, Q = (i) => { | ||
var m, f; | ||
const t = j(), [n, a] = E(!1), d = C(null), { selected: s, event: c } = L(), o = (m = s[0]) == null ? void 0 : m.annotation, l = (f = s[0]) == null ? void 0 : f.editable, { refs: p, floatingStyles: u, context: h, update: H } = D({ | ||
const t = S(), [n, a] = E(!1), d = A(null), { selected: s, event: c } = U(), o = (m = s[0]) == null ? void 0 : m.annotation, l = (f = s[0]) == null ? void 0 : f.editable, { refs: p, floatingStyles: u, context: w, update: I } = O({ | ||
open: n, | ||
onOpenChange: a, | ||
middleware: [ | ||
U(), | ||
F(10), | ||
M({ crossAxis: !0 }), | ||
P({ | ||
M(), | ||
P(10), | ||
b({ crossAxis: !0 }), | ||
j({ | ||
crossAxis: !0, | ||
padding: { right: 5, left: 5, top: 10, bottom: 10 } | ||
}), | ||
b({ | ||
k({ | ||
element: d, | ||
@@ -36,5 +36,5 @@ padding: 5 | ||
], | ||
whileElementsMounted: k | ||
whileElementsMounted: z | ||
}); | ||
A(() => { | ||
D(() => { | ||
if (s.length === 0) | ||
@@ -44,6 +44,6 @@ a(!1); | ||
const e = () => { | ||
const r = z(o.target.selector.geometry, t.element); | ||
const r = H(o.target.selector.geometry, t.element); | ||
p.setReference({ | ||
getBoundingClientRect: () => r, | ||
getClientRects: () => S(r) | ||
getClientRects: () => F(r) | ||
}); | ||
@@ -56,4 +56,4 @@ }; | ||
}, [t, i.popup, s]); | ||
const x = (e) => { | ||
const r = e.id || w(); | ||
const h = (e) => { | ||
const r = e.id || g(); | ||
t.state.store.addBody({ | ||
@@ -68,13 +68,13 @@ ...e, | ||
t.state.store.deleteBody({ id: e, annotation: o.id }); | ||
}, R = (e, r) => { | ||
const v = r.id || w(), B = { | ||
}, v = (e, r) => { | ||
const B = r.id || g(), R = { | ||
updated: /* @__PURE__ */ new Date(), | ||
updatedBy: t.getUser(), | ||
...r, | ||
id: v, | ||
id: B, | ||
annotation: o.id | ||
}; | ||
t.state.store.updateBody(e, B); | ||
t.state.store.updateBody(e, R); | ||
}; | ||
return n && o ? /* @__PURE__ */ g.jsxs( | ||
return n && o ? /* @__PURE__ */ x( | ||
"div", | ||
@@ -86,7 +86,7 @@ { | ||
children: [ | ||
i.arrow && /* @__PURE__ */ g.jsx( | ||
O, | ||
i.arrow && /* @__PURE__ */ C( | ||
L, | ||
{ | ||
ref: d, | ||
context: h, | ||
context: w, | ||
...i.arrowProps || {} | ||
@@ -99,5 +99,5 @@ } | ||
event: c, | ||
onCreateBody: x, | ||
onCreateBody: h, | ||
onDeleteBody: y, | ||
onUpdateBody: R | ||
onUpdateBody: v | ||
}) | ||
@@ -109,4 +109,4 @@ ] | ||
export { | ||
K as ImageAnnotationPopup | ||
Q as ImageAnnotationPopup | ||
}; | ||
//# sourceMappingURL=annotorious-react.es4.js.map |
@@ -1,29 +0,29 @@ | ||
import { j as i } from "./annotorious-react.es11.js"; | ||
import { Children as g, useContext as u, useEffect as n, cloneElement as x } from "react"; | ||
import { createImageAnnotator as A } from "@annotorious/annotorious"; | ||
import { AnnotoriousContext as C } from "./annotorious-react.es2.js"; | ||
const N = (e) => { | ||
const { children: a, tool: o, ...l } = e, r = g.only(a), { anno: t, setAnno: c } = u(C), s = (m) => { | ||
if (!t) { | ||
const f = m.target, d = A(f, l); | ||
c(d); | ||
import { jsx as d, Fragment as g } from "react/jsx-runtime"; | ||
import { Children as u, useContext as A, useEffect as n, cloneElement as C } from "react"; | ||
import { createImageAnnotator as x } from "@annotorious/annotorious"; | ||
import { AnnotoriousContext as E } from "./annotorious-react.es2.js"; | ||
const S = (t) => { | ||
const { children: i, tool: o, ...a } = t, l = u.only(i), { anno: e, setAnno: c } = A(E), r = (s) => { | ||
if (!e) { | ||
const m = s.target, f = x(m, a); | ||
c(f); | ||
} | ||
}; | ||
return n(() => { | ||
!t || !e.containerClassName || (t.element.className = e.containerClassName); | ||
}, [e.containerClassName, t]), n(() => { | ||
t && t.setDrawingEnabled(e.drawingEnabled); | ||
}, [e.drawingEnabled]), n(() => { | ||
t && t.setFilter(e.filter); | ||
}, [e.filter]), n(() => { | ||
t && t.setStyle(e.style); | ||
}, [e.style]), n(() => { | ||
o && t && t.setDrawingTool(e.tool); | ||
}, [o, t]), n(() => { | ||
t && t.setUserSelectAction(e.userSelectAction); | ||
}, [e.userSelectAction]), /* @__PURE__ */ i.jsx(i.Fragment, { children: x(r, { onLoad: s }) }); | ||
!e || !t.containerClassName || (e.element.className = t.containerClassName); | ||
}, [t.containerClassName, e]), n(() => { | ||
e && e.setDrawingEnabled(t.drawingEnabled); | ||
}, [t.drawingEnabled]), n(() => { | ||
e && e.setFilter(t.filter); | ||
}, [t.filter]), n(() => { | ||
e && e.setStyle(t.style); | ||
}, [t.style]), n(() => { | ||
o && e && e.setDrawingTool(t.tool); | ||
}, [o, e]), n(() => { | ||
e && e.setUserSelectAction(t.userSelectAction); | ||
}, [t.userSelectAction]), /* @__PURE__ */ d(g, { children: C(l, { onLoad: r }) }); | ||
}; | ||
export { | ||
N as ImageAnnotator | ||
S as ImageAnnotator | ||
}; | ||
//# sourceMappingURL=annotorious-react.es5.js.map |
@@ -1,11 +0,11 @@ | ||
import { j as d } from "./annotorious-react.es11.js"; | ||
import { createContext as m, forwardRef as S, useState as w, useContext as s, useImperativeHandle as A, useEffect as n } from "react"; | ||
import { createAnonymousGuest as x } from "@annotorious/core"; | ||
import { createOSDAnnotator as g } from "@annotorious/openseadragon"; | ||
import { jsx as d } from "react/jsx-runtime"; | ||
import { createContext as m, forwardRef as S, useState as w, useContext as a, useImperativeHandle as A, useEffect as n } from "react"; | ||
import { createAnonymousGuest as g } from "@annotorious/core"; | ||
import { createOSDAnnotator as x } from "@annotorious/openseadragon"; | ||
import { AnnotoriousContext as y } from "./annotorious-react.es2.js"; | ||
const a = m({ viewer: null, setViewer: null }), D = S((t, c) => { | ||
const { children: E, tool: o, ...u } = t, [r, f] = w(), { anno: e, setAnno: i } = s(y); | ||
const s = m({ viewer: null, setViewer: null }), O = S((t, c) => { | ||
const { children: v, tool: o, ...f } = t, [r, u] = w(), { anno: e, setAnno: i } = a(y); | ||
return A(c, () => e, [e]), n(() => { | ||
if (r != null && r.element) { | ||
const l = g(r, u); | ||
const l = x(r, f); | ||
return i(l), () => { | ||
@@ -26,15 +26,15 @@ l.destroy(), i(void 0); | ||
}, [e, t.modalSelect]), n(() => { | ||
e && (t.user ? e.setUser(t.user) : e.setUser(x())); | ||
e && (t.user ? e.setUser(t.user) : e.setUser(g())); | ||
}, [e, t.user]), n(() => { | ||
e && e.setUserSelectAction(t.userSelectAction); | ||
}, [e, t.userSelectAction]), /* @__PURE__ */ d.jsx(a.Provider, { value: { viewer: r, setViewer: f }, children: t.children }); | ||
}), O = () => { | ||
const { viewer: t } = s(a); | ||
}, [e, t.userSelectAction]), /* @__PURE__ */ d(s.Provider, { value: { viewer: r, setViewer: u }, children: t.children }); | ||
}), U = () => { | ||
const { viewer: t } = a(s); | ||
return t; | ||
}; | ||
export { | ||
D as OpenSeadragonAnnotator, | ||
a as OpenSeadragonAnnotatorContext, | ||
O as useViewer | ||
O as OpenSeadragonAnnotator, | ||
s as OpenSeadragonAnnotatorContext, | ||
U as useViewer | ||
}; | ||
//# sourceMappingURL=annotorious-react.es8.js.map |
@@ -1,5 +0,5 @@ | ||
import { j as g } from "./annotorious-react.es11.js"; | ||
import { useState as O, useRef as A, useEffect as D } from "react"; | ||
import w from "openseadragon"; | ||
import { useAnnotator as L, useSelection as P } from "./annotorious-react.es2.js"; | ||
import { jsxs as h, jsx as O } from "react/jsx-runtime"; | ||
import { useState as A, useRef as D, useEffect as L } from "react"; | ||
import g from "openseadragon"; | ||
import { useAnnotator as P, useSelection as S } from "./annotorious-react.es2.js"; | ||
/* empty css */ | ||
@@ -9,19 +9,19 @@ /* empty css */ | ||
import "@annotorious/annotorious"; | ||
import { toClientRects as S } from "./annotorious-react.es14.js"; | ||
import { useFloating as b, FloatingArrow as j } from "./annotorious-react.es13.js"; | ||
import { useViewer as U } from "./annotorious-react.es8.js"; | ||
import { inline as F, offset as M, flip as V, shift as z, arrow as H } from "./annotorious-react.es15.js"; | ||
import { autoUpdate as T } from "./annotorious-react.es16.js"; | ||
import x from "./annotorious-react.es17.js"; | ||
const X = (n, r) => { | ||
const { minX: d, minY: a, maxX: o, maxY: m } = r.bounds, { top: s, left: l } = n.element.getBoundingClientRect(), t = n.viewport.imageToViewerElementCoordinates(new w.Point(d, a)), p = n.viewport.imageToViewerElementCoordinates(new w.Point(o, m)); | ||
import { toClientRects as b } from "./annotorious-react.es13.js"; | ||
import { useFloating as U, FloatingArrow as F } from "./annotorious-react.es12.js"; | ||
import { useViewer as M } from "./annotorious-react.es8.js"; | ||
import { inline as V, offset as j, flip as z, shift as H, arrow as T } from "./annotorious-react.es14.js"; | ||
import { autoUpdate as X } from "./annotorious-react.es15.js"; | ||
import w from "./annotorious-react.es16.js"; | ||
const Y = (n, r) => { | ||
const { minX: d, minY: a, maxX: o, maxY: l } = r.bounds, { top: s, left: p } = n.element.getBoundingClientRect(), t = n.viewport.imageToViewerElementCoordinates(new g.Point(d, a)), m = n.viewport.imageToViewerElementCoordinates(new g.Point(o, l)); | ||
return new DOMRect( | ||
t.x + l, | ||
t.x + p, | ||
t.y + s, | ||
p.x - t.x, | ||
p.y - t.y | ||
m.x - t.x, | ||
m.y - t.y | ||
); | ||
}, te = (n) => { | ||
}, oe = (n) => { | ||
var u, f; | ||
const r = L(), [d, a] = O(!1), o = U(), m = A(null), { selected: s, event: l } = P(), t = (u = s[0]) == null ? void 0 : u.annotation, p = (f = s[0]) == null ? void 0 : f.editable, { refs: c, floatingStyles: y, context: v } = b({ | ||
const r = P(), [d, a] = A(!1), o = M(), l = D(null), { selected: s, event: p } = 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 } = U({ | ||
open: d, | ||
@@ -31,6 +31,6 @@ onOpenChange: a, | ||
middleware: [ | ||
F(), | ||
M(10), | ||
V({ crossAxis: !0 }), | ||
z({ | ||
V(), | ||
j(10), | ||
z({ crossAxis: !0 }), | ||
H({ | ||
crossAxis: !0, | ||
@@ -40,10 +40,10 @@ boundary: o == null ? void 0 : o.element, | ||
}), | ||
H({ | ||
element: m, | ||
T({ | ||
element: l, | ||
padding: 5 | ||
}) | ||
], | ||
whileElementsMounted: T | ||
whileElementsMounted: X | ||
}); | ||
D(() => { | ||
L(() => { | ||
if (s.length === 0) | ||
@@ -54,6 +54,6 @@ a(!1); | ||
if (!o.element) return; | ||
const i = X(o, t.target.selector.geometry); | ||
const i = Y(o, t.target.selector.geometry); | ||
c.setReference({ | ||
getBoundingClientRect: () => i, | ||
getClientRects: () => S(i) | ||
getClientRects: () => b(i) | ||
}); | ||
@@ -66,4 +66,4 @@ }; | ||
}, [n.popup, s, o]); | ||
const R = (e) => { | ||
const i = e.id || x(); | ||
const x = (e) => { | ||
const i = e.id || w(); | ||
r.state.store.addBody({ | ||
@@ -76,6 +76,6 @@ ...e, | ||
}); | ||
}, B = (e) => { | ||
}, R = (e) => { | ||
r.state.store.deleteBody({ id: e, annotation: t.id }); | ||
}, E = (e, i) => { | ||
const C = i.id || x(), h = { | ||
}, B = (e, i) => { | ||
const C = i.id || w(), E = { | ||
updated: /* @__PURE__ */ new Date(), | ||
@@ -87,5 +87,5 @@ updatedBy: r.getUser(), | ||
}; | ||
r.state.store.updateBody(e, h); | ||
r.state.store.updateBody(e, E); | ||
}; | ||
return d && t ? /* @__PURE__ */ g.jsxs( | ||
return d && t ? /* @__PURE__ */ h( | ||
"div", | ||
@@ -97,6 +97,6 @@ { | ||
children: [ | ||
n.arrow && /* @__PURE__ */ g.jsx( | ||
j, | ||
n.arrow && /* @__PURE__ */ O( | ||
F, | ||
{ | ||
ref: m, | ||
ref: l, | ||
context: v, | ||
@@ -108,7 +108,7 @@ ...n.arrowProps || {} | ||
annotation: t, | ||
editable: p, | ||
event: l, | ||
onCreateBody: R, | ||
onDeleteBody: B, | ||
onUpdateBody: E | ||
editable: m, | ||
event: p, | ||
onCreateBody: x, | ||
onDeleteBody: R, | ||
onUpdateBody: B | ||
}) | ||
@@ -120,4 +120,4 @@ ] | ||
export { | ||
te as OpenSeadragonAnnotationPopup | ||
oe as OpenSeadragonAnnotationPopup | ||
}; | ||
//# sourceMappingURL=annotorious-react.es9.js.map |
{ | ||
"name": "@annotorious/react", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Annotorious React bindings", | ||
@@ -48,5 +48,5 @@ "author": "Rainer Simon", | ||
"dependencies": { | ||
"@annotorious/annotorious": "3.1.1", | ||
"@annotorious/core": "3.1.1", | ||
"@annotorious/openseadragon": "3.1.1", | ||
"@annotorious/annotorious": "3.1.2", | ||
"@annotorious/core": "3.1.2", | ||
"@annotorious/openseadragon": "3.1.2", | ||
"@floating-ui/react": "^0.27.3", | ||
@@ -53,0 +53,0 @@ "zustand": "^5.0.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
446017
71
2329
1
+ Added@annotorious/annotorious@3.1.2(transitive)
+ Added@annotorious/core@3.1.2(transitive)
+ Added@annotorious/openseadragon@3.1.2(transitive)
+ Addednanoid@5.0.9(transitive)
- Removed@annotorious/annotorious@3.1.1(transitive)
- Removed@annotorious/core@3.1.1(transitive)
- Removed@annotorious/openseadragon@3.1.1(transitive)
- Removednanoid@5.1.0(transitive)
Updated@annotorious/core@3.1.2