rita-workspace 0.5.16 → 0.5.18
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.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +11 -5
- package/dist/index.mjs +10 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -168,6 +168,11 @@ interface WorkspaceProviderProps {
|
|
|
168
168
|
*/
|
|
169
169
|
lang?: string;
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Check if another tab opened the same drawing BEFORE this tab.
|
|
173
|
+
* Only the tab that opened the drawing later is considered in conflict.
|
|
174
|
+
*/
|
|
175
|
+
declare function isDrawingOpenedEarlierInOtherTab(drawingId: string): boolean;
|
|
171
176
|
declare function WorkspaceProvider({ children, lang }: WorkspaceProviderProps): react_jsx_runtime.JSX.Element;
|
|
172
177
|
|
|
173
178
|
interface SidebarProps {
|
|
@@ -377,4 +382,4 @@ interface WorkspacePluginProps {
|
|
|
377
382
|
*/
|
|
378
383
|
declare function WorkspacePlugin(props: WorkspacePluginProps): react_jsx_runtime.JSX.Element;
|
|
379
384
|
|
|
380
|
-
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, type Folder, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, createFolder, deleteDrawing, deleteFolder, duplicateDrawing, getAllDrawings, getAllFolders, getDB, getDrawing, getFolder, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isLanguageSupported, moveDrawingToFolder, removeDrawingFromWorkspace, renameFolder, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|
|
385
|
+
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, type Folder, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, createFolder, deleteDrawing, deleteFolder, duplicateDrawing, getAllDrawings, getAllFolders, getDB, getDrawing, getFolder, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isDrawingOpenedEarlierInOtherTab, isLanguageSupported, moveDrawingToFolder, removeDrawingFromWorkspace, renameFolder, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|
package/dist/index.d.ts
CHANGED
|
@@ -168,6 +168,11 @@ interface WorkspaceProviderProps {
|
|
|
168
168
|
*/
|
|
169
169
|
lang?: string;
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Check if another tab opened the same drawing BEFORE this tab.
|
|
173
|
+
* Only the tab that opened the drawing later is considered in conflict.
|
|
174
|
+
*/
|
|
175
|
+
declare function isDrawingOpenedEarlierInOtherTab(drawingId: string): boolean;
|
|
171
176
|
declare function WorkspaceProvider({ children, lang }: WorkspaceProviderProps): react_jsx_runtime.JSX.Element;
|
|
172
177
|
|
|
173
178
|
interface SidebarProps {
|
|
@@ -377,4 +382,4 @@ interface WorkspacePluginProps {
|
|
|
377
382
|
*/
|
|
378
383
|
declare function WorkspacePlugin(props: WorkspacePluginProps): react_jsx_runtime.JSX.Element;
|
|
379
384
|
|
|
380
|
-
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, type Folder, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, createFolder, deleteDrawing, deleteFolder, duplicateDrawing, getAllDrawings, getAllFolders, getDB, getDrawing, getFolder, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isLanguageSupported, moveDrawingToFolder, removeDrawingFromWorkspace, renameFolder, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|
|
385
|
+
export { type Drawing, DrawingList, DrawingListItem, DrawingsDialog, type DrawingsDialogProps, type ExcalidrawImperativeAPI, type Folder, Sidebar, type SupportedLanguage, type Translations, type Workspace, WorkspaceBridge, type WorkspaceBridgeProps, type WorkspaceContextValue, WorkspaceMenuItems, type WorkspaceMenuItemsProps, WorkspacePlugin, WorkspaceProvider, addDrawingToWorkspace, closeDB, createDrawing, createFolder, deleteDrawing, deleteFolder, duplicateDrawing, getAllDrawings, getAllFolders, getDB, getDrawing, getFolder, getOrCreateDefaultWorkspace, getTranslations, getWorkspace, isDrawingOpenedEarlierInOtherTab, isLanguageSupported, moveDrawingToFolder, removeDrawingFromWorkspace, renameFolder, setActiveDrawing, updateDrawing, updateWorkspace, useExcalidrawBridge, useWorkspace, useWorkspaceLang };
|
package/dist/index.js
CHANGED
|
@@ -53,6 +53,7 @@ __export(index_exports, {
|
|
|
53
53
|
getOrCreateDefaultWorkspace: () => getOrCreateDefaultWorkspace,
|
|
54
54
|
getTranslations: () => getTranslations,
|
|
55
55
|
getWorkspace: () => getWorkspace,
|
|
56
|
+
isDrawingOpenedEarlierInOtherTab: () => isDrawingOpenedEarlierInOtherTab,
|
|
56
57
|
isLanguageSupported: () => isLanguageSupported,
|
|
57
58
|
moveDrawingToFolder: () => moveDrawingToFolder,
|
|
58
59
|
removeDrawingFromWorkspace: () => removeDrawingFromWorkspace,
|
|
@@ -548,9 +549,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
548
549
|
channel?.close();
|
|
549
550
|
};
|
|
550
551
|
}, []);
|
|
552
|
+
const hasCleanedUpRef = (0, import_react.useRef)(false);
|
|
551
553
|
(0, import_react.useEffect)(() => {
|
|
552
554
|
cleanupStaleTabs();
|
|
553
555
|
const timer = setTimeout(() => {
|
|
556
|
+
hasCleanedUpRef.current = true;
|
|
554
557
|
const drawingId = activeDrawingIdRef.current;
|
|
555
558
|
if (drawingId) {
|
|
556
559
|
setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
|
|
@@ -561,10 +564,12 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
561
564
|
(0, import_react.useEffect)(() => {
|
|
562
565
|
const drawingId = activeDrawing?.id || null;
|
|
563
566
|
setTabDrawing(drawingId);
|
|
564
|
-
if (
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
567
|
+
if (hasCleanedUpRef.current) {
|
|
568
|
+
if (drawingId) {
|
|
569
|
+
setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
|
|
570
|
+
} else {
|
|
571
|
+
setIsDrawingConflict(false);
|
|
572
|
+
}
|
|
568
573
|
}
|
|
569
574
|
const recheckConflict = () => {
|
|
570
575
|
if (drawingId) {
|
|
@@ -2084,7 +2089,7 @@ var DrawingsDialog = ({
|
|
|
2084
2089
|
}
|
|
2085
2090
|
},
|
|
2086
2091
|
children: [
|
|
2087
|
-
isRefreshing
|
|
2092
|
+
isRefreshing ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "inline-block", animation: "spin 1s linear infinite", fontSize: "24px" }, children: "\u23F3" }) }) : drawings.length > 0 || folders.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "8px 20px 0" }, onClick: () => setSelectedId(null), children: [
|
|
2088
2093
|
filteredFolders.map(renderFolderGroup),
|
|
2089
2094
|
draggingDrawingId && folders.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2090
2095
|
"div",
|
|
@@ -2462,6 +2467,7 @@ function WorkspacePlugin(props) {
|
|
|
2462
2467
|
getOrCreateDefaultWorkspace,
|
|
2463
2468
|
getTranslations,
|
|
2464
2469
|
getWorkspace,
|
|
2470
|
+
isDrawingOpenedEarlierInOtherTab,
|
|
2465
2471
|
isLanguageSupported,
|
|
2466
2472
|
moveDrawingToFolder,
|
|
2467
2473
|
removeDrawingFromWorkspace,
|
package/dist/index.mjs
CHANGED
|
@@ -480,9 +480,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
480
480
|
channel?.close();
|
|
481
481
|
};
|
|
482
482
|
}, []);
|
|
483
|
+
const hasCleanedUpRef = useRef(false);
|
|
483
484
|
useEffect(() => {
|
|
484
485
|
cleanupStaleTabs();
|
|
485
486
|
const timer = setTimeout(() => {
|
|
487
|
+
hasCleanedUpRef.current = true;
|
|
486
488
|
const drawingId = activeDrawingIdRef.current;
|
|
487
489
|
if (drawingId) {
|
|
488
490
|
setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
|
|
@@ -493,10 +495,12 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
493
495
|
useEffect(() => {
|
|
494
496
|
const drawingId = activeDrawing?.id || null;
|
|
495
497
|
setTabDrawing(drawingId);
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
if (hasCleanedUpRef.current) {
|
|
499
|
+
if (drawingId) {
|
|
500
|
+
setIsDrawingConflict(isDrawingOpenedEarlierInOtherTab(drawingId));
|
|
501
|
+
} else {
|
|
502
|
+
setIsDrawingConflict(false);
|
|
503
|
+
}
|
|
500
504
|
}
|
|
501
505
|
const recheckConflict = () => {
|
|
502
506
|
if (drawingId) {
|
|
@@ -2016,7 +2020,7 @@ var DrawingsDialog = ({
|
|
|
2016
2020
|
}
|
|
2017
2021
|
},
|
|
2018
2022
|
children: [
|
|
2019
|
-
isRefreshing
|
|
2023
|
+
isRefreshing ? /* @__PURE__ */ jsx6("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: /* @__PURE__ */ jsx6("span", { style: { display: "inline-block", animation: "spin 1s linear infinite", fontSize: "24px" }, children: "\u23F3" }) }) : drawings.length > 0 || folders.length > 0 ? /* @__PURE__ */ jsxs4("div", { style: { padding: "8px 20px 0" }, onClick: () => setSelectedId(null), children: [
|
|
2020
2024
|
filteredFolders.map(renderFolderGroup),
|
|
2021
2025
|
draggingDrawingId && folders.length > 0 && /* @__PURE__ */ jsx6(
|
|
2022
2026
|
"div",
|
|
@@ -2393,6 +2397,7 @@ export {
|
|
|
2393
2397
|
getOrCreateDefaultWorkspace,
|
|
2394
2398
|
getTranslations,
|
|
2395
2399
|
getWorkspace,
|
|
2400
|
+
isDrawingOpenedEarlierInOtherTab,
|
|
2396
2401
|
isLanguageSupported,
|
|
2397
2402
|
moveDrawingToFolder,
|
|
2398
2403
|
removeDrawingFromWorkspace,
|