glitchgrab 1.31.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -989,6 +989,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
|
|
|
989
989
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
990
990
|
"div",
|
|
991
991
|
{
|
|
992
|
+
"data-glitchgrab-layer": "",
|
|
992
993
|
style: {
|
|
993
994
|
position: "fixed",
|
|
994
995
|
inset: 0,
|
|
@@ -1565,13 +1566,29 @@ function ReportDialog({
|
|
|
1565
1566
|
const isPushToTalkRef = (0, import_react.useRef)(false);
|
|
1566
1567
|
(0, import_react.useEffect)(() => {
|
|
1567
1568
|
if (!isOpen) return;
|
|
1568
|
-
const
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
)
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1569
|
+
const HOST_LAYERS = '[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"]';
|
|
1570
|
+
const inerted = /* @__PURE__ */ new Set();
|
|
1571
|
+
const applyInert = () => {
|
|
1572
|
+
document.querySelectorAll(HOST_LAYERS).forEach((el) => {
|
|
1573
|
+
if (el.closest("[data-glitchgrab-layer]")) return;
|
|
1574
|
+
if (el.querySelector("[data-glitchgrab-layer]")) return;
|
|
1575
|
+
if (inerted.has(el) || el.hasAttribute("inert")) return;
|
|
1576
|
+
el.setAttribute("inert", "");
|
|
1577
|
+
inerted.add(el);
|
|
1578
|
+
});
|
|
1579
|
+
};
|
|
1580
|
+
applyInert();
|
|
1581
|
+
const observer = new MutationObserver((mutations) => {
|
|
1582
|
+
const structural = mutations.some(
|
|
1583
|
+
(m) => m.addedNodes.length > 0 || m.removedNodes.length > 0
|
|
1584
|
+
);
|
|
1585
|
+
if (structural) applyInert();
|
|
1586
|
+
});
|
|
1587
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1588
|
+
return () => {
|
|
1589
|
+
observer.disconnect();
|
|
1590
|
+
inerted.forEach((el) => el.removeAttribute("inert"));
|
|
1591
|
+
};
|
|
1575
1592
|
}, [isOpen]);
|
|
1576
1593
|
const [step, setStep] = (0, import_react.useState)(1);
|
|
1577
1594
|
const [reportType, setReportType] = (0, import_react.useState)("BUG");
|
|
@@ -1662,6 +1679,8 @@ function ReportDialog({
|
|
|
1662
1679
|
};
|
|
1663
1680
|
const handleOpen = async () => {
|
|
1664
1681
|
setSubmitted(false);
|
|
1682
|
+
closePreview();
|
|
1683
|
+
setAnnotatingIndex(null);
|
|
1665
1684
|
if (availableTypes.length === 1) {
|
|
1666
1685
|
setReportType(availableTypes[0]);
|
|
1667
1686
|
setStep(2);
|
|
@@ -1688,14 +1707,15 @@ function ReportDialog({
|
|
|
1688
1707
|
if (!isOpen) return;
|
|
1689
1708
|
const handleEsc = (e) => {
|
|
1690
1709
|
if (e.key === "Escape") {
|
|
1691
|
-
if (
|
|
1710
|
+
if (annotatingIndex !== null) setAnnotatingIndex(null);
|
|
1711
|
+
else if (previewZoomed) setPreviewZoomed(false);
|
|
1692
1712
|
else if (previewIndex !== null) closePreview();
|
|
1693
1713
|
else handleClose();
|
|
1694
1714
|
}
|
|
1695
1715
|
};
|
|
1696
1716
|
document.addEventListener("keydown", handleEsc);
|
|
1697
1717
|
return () => document.removeEventListener("keydown", handleEsc);
|
|
1698
|
-
}, [isOpen, previewIndex, previewZoomed]);
|
|
1718
|
+
}, [isOpen, previewIndex, previewZoomed, annotatingIndex]);
|
|
1699
1719
|
(0, import_react.useEffect)(() => {
|
|
1700
1720
|
if (previewIndex === null || annotatingIndex !== null) return;
|
|
1701
1721
|
const handlePointerDown = (e) => {
|
|
@@ -1830,6 +1850,8 @@ function ReportDialog({
|
|
|
1830
1850
|
const handleClose = () => {
|
|
1831
1851
|
stopVoice();
|
|
1832
1852
|
setIsOpen(false);
|
|
1853
|
+
closePreview();
|
|
1854
|
+
setAnnotatingIndex(null);
|
|
1833
1855
|
setStep(1);
|
|
1834
1856
|
setRating(0);
|
|
1835
1857
|
setHoveredStar(0);
|
|
@@ -2080,6 +2102,7 @@ function ReportDialog({
|
|
|
2080
2102
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2081
2103
|
"div",
|
|
2082
2104
|
{
|
|
2105
|
+
"data-glitchgrab-layer": "",
|
|
2083
2106
|
style: {
|
|
2084
2107
|
position: "fixed",
|
|
2085
2108
|
inset: 0,
|
|
@@ -3505,10 +3528,11 @@ function ReportDialog({
|
|
|
3505
3528
|
style: { display: "none" }
|
|
3506
3529
|
}
|
|
3507
3530
|
),
|
|
3508
|
-
previewIndex !== null && screenshots[previewIndex] && (0, import_react_dom.createPortal)(
|
|
3531
|
+
isOpen && previewIndex !== null && screenshots[previewIndex] && (0, import_react_dom.createPortal)(
|
|
3509
3532
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3510
3533
|
"div",
|
|
3511
3534
|
{
|
|
3535
|
+
"data-glitchgrab-layer": "",
|
|
3512
3536
|
style: {
|
|
3513
3537
|
position: "fixed",
|
|
3514
3538
|
inset: 0,
|
|
@@ -3661,7 +3685,7 @@ function ReportDialog({
|
|
|
3661
3685
|
),
|
|
3662
3686
|
document.body
|
|
3663
3687
|
),
|
|
3664
|
-
annotatingIndex !== null && screenshots[annotatingIndex] && (0, import_react_dom.createPortal)(
|
|
3688
|
+
isOpen && annotatingIndex !== null && screenshots[annotatingIndex] && (0, import_react_dom.createPortal)(
|
|
3665
3689
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3666
3690
|
AnnotationCanvas,
|
|
3667
3691
|
{
|