mirador
Version:
An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.
98 lines (97 loc) • 2.82 kB
JavaScript
import { G as e, dt as t, ft as n, mt as r, st as i, v as a } from "./getters-H0mV17lW.js";
import { createContext as o, useContext as s } from "react";
import { jsx as c } from "react/jsx-runtime";
import { styled as l } from "@mui/material/styles";
import u from "@mui/material/Badge";
import d from "@mui/material/IconButton";
import f from "@mui/material/Tooltip";
//#region src/contexts/WorkspaceContext.js
var p = /* @__PURE__ */ r(i(), 1), m = o({ current: document.body }), h = l(d, {
name: "MiradorMenuButton",
slot: "root"
})(({ selected: e, theme: t }) => ({
fill: "currentcolor",
...e && { backgroundColor: t.palette.action.selected }
}));
function g({ "aria-label": e, badge: t = !1, children: n, dispatch: r = () => {}, selected: i = !1, BadgeProps: a = {}, TooltipProps: o = {}, sx: l = {}, ...d }) {
let p = s(m), g = /* @__PURE__ */ c(h, {
selected: i,
"aria-label": e,
...d,
sx: l,
size: "large",
children: t ? /* @__PURE__ */ c(u, {
overlap: "rectangular",
...a,
children: n
}) : n
});
return d.disabled ? g : /* @__PURE__ */ c(f, {
title: e,
...o,
slotProps: { popper: { container: p?.current } },
children: g
});
}
g.propTypes = {
"aria-label": p.default.string.isRequired,
badge: p.default.bool,
BadgeProps: p.default.object,
children: p.default.element.isRequired,
dispatch: p.default.func,
selected: p.default.bool,
sx: p.default.object,
TooltipProps: p.default.object
};
var _ = e(a("MiradorMenuButton"))(g), v = /* @__PURE__ */ n(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.useElementSize = void 0;
var n = t();
function r() {
var e = (0, n.useState)(null), t = e[0], r = e[1], i = (0, n.useState)({
width: 0,
height: 0
}), a = i[0], o = i[1], s = (0, n.useCallback)(function() {
t && o({
width: t.offsetWidth,
height: t.offsetHeight
});
}, [t]);
return (typeof window < "u" ? n.useLayoutEffect : n.useEffect)(function() {
if (t) {
s();
var e = new ResizeObserver(s);
return e.observe(t), function() {
return e.disconnect();
};
}
}, [t, s]), [r, a];
}
e.useElementSize = r;
}));
//#endregion
//#region node_modules/merge-refs/dist/index.js
function y() {
var e = [...arguments].filter(Boolean);
return e.length <= 1 ? e[0] || null : function(t) {
for (var n = 0, r = e; n < r.length; n++) {
var i = r[n];
typeof i == "function" ? i(t) : i && (i.current = t);
}
};
}
//#endregion
//#region node_modules/@mui/utils/visuallyHidden/visuallyHidden.mjs
var b = {
border: 0,
clip: "rect(0 0 0 0)",
height: "1px",
margin: "-1px",
overflow: "hidden",
padding: 0,
position: "absolute",
whiteSpace: "nowrap",
width: "1px"
};
//#endregion
export { g as a, _ as i, y as n, m as o, v as r, b as t };
//# sourceMappingURL=visuallyHidden-ClS3et6J.js.map