rita-workspace 0.5.10 → 0.5.12
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 +33 -3
- package/dist/index.mjs +33 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -579,11 +579,33 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
579
579
|
}
|
|
580
580
|
};
|
|
581
581
|
window.addEventListener("storage", onStorage);
|
|
582
|
-
|
|
582
|
+
let intervalId = null;
|
|
583
|
+
const startPolling = () => {
|
|
584
|
+
if (!intervalId && drawingId) {
|
|
585
|
+
intervalId = setInterval(recheckConflict, 5e3);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
const stopPolling = () => {
|
|
589
|
+
if (intervalId) {
|
|
590
|
+
clearInterval(intervalId);
|
|
591
|
+
intervalId = null;
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
const onVisibilityChange = () => {
|
|
595
|
+
if (document.hidden) {
|
|
596
|
+
stopPolling();
|
|
597
|
+
} else {
|
|
598
|
+
recheckConflict();
|
|
599
|
+
startPolling();
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
if (!document.hidden) startPolling();
|
|
603
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
583
604
|
return () => {
|
|
584
605
|
channel?.close();
|
|
585
606
|
window.removeEventListener("storage", onStorage);
|
|
586
|
-
|
|
607
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
608
|
+
stopPolling();
|
|
587
609
|
};
|
|
588
610
|
}, [activeDrawing?.id]);
|
|
589
611
|
(0, import_react.useEffect)(() => {
|
|
@@ -1382,6 +1404,7 @@ var DrawingsDialog = ({
|
|
|
1382
1404
|
const [confirmDeleteId, setConfirmDeleteId] = (0, import_react5.useState)(null);
|
|
1383
1405
|
const [switchingId, setSwitchingId] = (0, import_react5.useState)(null);
|
|
1384
1406
|
const [selectedId, setSelectedId] = (0, import_react5.useState)(null);
|
|
1407
|
+
const [hoveredId, setHoveredId] = (0, import_react5.useState)(null);
|
|
1385
1408
|
const [expandedFolders, setExpandedFolders] = (0, import_react5.useState)(/* @__PURE__ */ new Set());
|
|
1386
1409
|
const [creatingFolder, setCreatingFolder] = (0, import_react5.useState)(false);
|
|
1387
1410
|
const [newFolderName, setNewFolderName] = (0, import_react5.useState)("");
|
|
@@ -1579,6 +1602,8 @@ var DrawingsDialog = ({
|
|
|
1579
1602
|
setDraggingDrawingId(null);
|
|
1580
1603
|
setDropTargetFolderId(null);
|
|
1581
1604
|
},
|
|
1605
|
+
onMouseEnter: () => setHoveredId(drawing.id),
|
|
1606
|
+
onMouseLeave: () => setHoveredId(null),
|
|
1582
1607
|
onClick: (e) => {
|
|
1583
1608
|
e.stopPropagation();
|
|
1584
1609
|
if (editingId || confirmDeleteId || movingDrawingId) return;
|
|
@@ -1698,7 +1723,12 @@ var DrawingsDialog = ({
|
|
|
1698
1723
|
formatDate(drawing.updatedAt)
|
|
1699
1724
|
] })
|
|
1700
1725
|
] }) }),
|
|
1701
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
|
|
1727
|
+
display: "flex",
|
|
1728
|
+
gap: "2px",
|
|
1729
|
+
alignItems: "center",
|
|
1730
|
+
visibility: hoveredId === drawing.id || selectedId === drawing.id || activeDrawing?.id === drawing.id || confirmDeleteId === drawing.id || movingDrawingId === drawing.id || editingId === drawing.id ? "visible" : "hidden"
|
|
1731
|
+
}, children: confirmDeleteId === drawing.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1702
1732
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1703
1733
|
"button",
|
|
1704
1734
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -511,11 +511,33 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
511
511
|
}
|
|
512
512
|
};
|
|
513
513
|
window.addEventListener("storage", onStorage);
|
|
514
|
-
|
|
514
|
+
let intervalId = null;
|
|
515
|
+
const startPolling = () => {
|
|
516
|
+
if (!intervalId && drawingId) {
|
|
517
|
+
intervalId = setInterval(recheckConflict, 5e3);
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
const stopPolling = () => {
|
|
521
|
+
if (intervalId) {
|
|
522
|
+
clearInterval(intervalId);
|
|
523
|
+
intervalId = null;
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
const onVisibilityChange = () => {
|
|
527
|
+
if (document.hidden) {
|
|
528
|
+
stopPolling();
|
|
529
|
+
} else {
|
|
530
|
+
recheckConflict();
|
|
531
|
+
startPolling();
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
if (!document.hidden) startPolling();
|
|
535
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
515
536
|
return () => {
|
|
516
537
|
channel?.close();
|
|
517
538
|
window.removeEventListener("storage", onStorage);
|
|
518
|
-
|
|
539
|
+
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
540
|
+
stopPolling();
|
|
519
541
|
};
|
|
520
542
|
}, [activeDrawing?.id]);
|
|
521
543
|
useEffect(() => {
|
|
@@ -1314,6 +1336,7 @@ var DrawingsDialog = ({
|
|
|
1314
1336
|
const [confirmDeleteId, setConfirmDeleteId] = useState4(null);
|
|
1315
1337
|
const [switchingId, setSwitchingId] = useState4(null);
|
|
1316
1338
|
const [selectedId, setSelectedId] = useState4(null);
|
|
1339
|
+
const [hoveredId, setHoveredId] = useState4(null);
|
|
1317
1340
|
const [expandedFolders, setExpandedFolders] = useState4(/* @__PURE__ */ new Set());
|
|
1318
1341
|
const [creatingFolder, setCreatingFolder] = useState4(false);
|
|
1319
1342
|
const [newFolderName, setNewFolderName] = useState4("");
|
|
@@ -1511,6 +1534,8 @@ var DrawingsDialog = ({
|
|
|
1511
1534
|
setDraggingDrawingId(null);
|
|
1512
1535
|
setDropTargetFolderId(null);
|
|
1513
1536
|
},
|
|
1537
|
+
onMouseEnter: () => setHoveredId(drawing.id),
|
|
1538
|
+
onMouseLeave: () => setHoveredId(null),
|
|
1514
1539
|
onClick: (e) => {
|
|
1515
1540
|
e.stopPropagation();
|
|
1516
1541
|
if (editingId || confirmDeleteId || movingDrawingId) return;
|
|
@@ -1630,7 +1655,12 @@ var DrawingsDialog = ({
|
|
|
1630
1655
|
formatDate(drawing.updatedAt)
|
|
1631
1656
|
] })
|
|
1632
1657
|
] }) }),
|
|
1633
|
-
/* @__PURE__ */ jsx6("div", { style: {
|
|
1658
|
+
/* @__PURE__ */ jsx6("div", { style: {
|
|
1659
|
+
display: "flex",
|
|
1660
|
+
gap: "2px",
|
|
1661
|
+
alignItems: "center",
|
|
1662
|
+
visibility: hoveredId === drawing.id || selectedId === drawing.id || activeDrawing?.id === drawing.id || confirmDeleteId === drawing.id || movingDrawingId === drawing.id || editingId === drawing.id ? "visible" : "hidden"
|
|
1663
|
+
}, children: confirmDeleteId === drawing.id ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1634
1664
|
/* @__PURE__ */ jsx6(
|
|
1635
1665
|
"button",
|
|
1636
1666
|
{
|