rita-workspace 0.5.34 → 0.5.36
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +69 -4
- package/dist/index.mjs +69 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -131,6 +131,8 @@ interface Translations {
|
|
|
131
131
|
newFolderName: string;
|
|
132
132
|
backupReminder: string;
|
|
133
133
|
days: string;
|
|
134
|
+
autoStartLabel: string;
|
|
135
|
+
autoStartDesc: string;
|
|
134
136
|
shortcutNewDrawing: string;
|
|
135
137
|
}
|
|
136
138
|
declare function getTranslations(langCode?: string): Translations;
|
package/dist/index.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ interface Translations {
|
|
|
131
131
|
newFolderName: string;
|
|
132
132
|
backupReminder: string;
|
|
133
133
|
days: string;
|
|
134
|
+
autoStartLabel: string;
|
|
135
|
+
autoStartDesc: string;
|
|
134
136
|
shortcutNewDrawing: string;
|
|
135
137
|
}
|
|
136
138
|
declare function getTranslations(langCode?: string): Translations;
|
package/dist/index.js
CHANGED
|
@@ -354,6 +354,9 @@ var sv = {
|
|
|
354
354
|
// Backup reminder
|
|
355
355
|
backupReminder: "Senaste backup:",
|
|
356
356
|
days: "dagar sedan",
|
|
357
|
+
// Auto-start
|
|
358
|
+
autoStartLabel: "Starta Rita i arbetsl\xE4ge",
|
|
359
|
+
autoStartDesc: "Aktivera arbetsl\xE4ge automatiskt n\xE4r Rita \xF6ppnas",
|
|
357
360
|
// Shortcuts
|
|
358
361
|
shortcutNewDrawing: "Ctrl+Alt+N"
|
|
359
362
|
};
|
|
@@ -404,6 +407,9 @@ var en = {
|
|
|
404
407
|
// Backup reminder
|
|
405
408
|
backupReminder: "Last backup:",
|
|
406
409
|
days: "days ago",
|
|
410
|
+
// Auto-start
|
|
411
|
+
autoStartLabel: "Start Rita in workspace mode",
|
|
412
|
+
autoStartDesc: "Automatically enable workspace mode when Rita opens",
|
|
407
413
|
// Shortcuts
|
|
408
414
|
shortcutNewDrawing: "Ctrl+Alt+N"
|
|
409
415
|
};
|
|
@@ -1186,6 +1192,7 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
1186
1192
|
input.click();
|
|
1187
1193
|
});
|
|
1188
1194
|
if (!files || files.length === 0) return;
|
|
1195
|
+
let lastImportedId = null;
|
|
1189
1196
|
for (const file of Array.from(files)) {
|
|
1190
1197
|
const text = await file.text();
|
|
1191
1198
|
const data = JSON.parse(text);
|
|
@@ -1200,16 +1207,20 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
1200
1207
|
files: data.files || {}
|
|
1201
1208
|
});
|
|
1202
1209
|
await addDrawingToWorkspace(workspace.id, drawing.id);
|
|
1210
|
+
lastImportedId = drawing.id;
|
|
1203
1211
|
}
|
|
1204
1212
|
const allDrawings = await getAllDrawings();
|
|
1205
1213
|
const ws = await getOrCreateDefaultWorkspace();
|
|
1206
1214
|
const wsDrawings = allDrawings.filter((dr) => ws.drawingIds.includes(dr.id));
|
|
1207
1215
|
setWorkspace(ws);
|
|
1208
1216
|
setDrawings(wsDrawings);
|
|
1217
|
+
if (lastImportedId) {
|
|
1218
|
+
await switchDrawing(lastImportedId);
|
|
1219
|
+
}
|
|
1209
1220
|
} catch (err) {
|
|
1210
1221
|
setError(err instanceof Error ? err.message : "Failed to import drawing");
|
|
1211
1222
|
}
|
|
1212
|
-
}, [workspace, t]);
|
|
1223
|
+
}, [workspace, t, switchDrawing]);
|
|
1213
1224
|
const createFolder2 = (0, import_react.useCallback)(async (name) => {
|
|
1214
1225
|
const now = Date.now();
|
|
1215
1226
|
const tempId = `temp-${now}`;
|
|
@@ -1691,6 +1702,27 @@ var DrawingsDialog = ({
|
|
|
1691
1702
|
const [movingDrawingId, setMovingDrawingId] = (0, import_react5.useState)(null);
|
|
1692
1703
|
const [searchQuery, setSearchQuery] = (0, import_react5.useState)("");
|
|
1693
1704
|
const [isRefreshing, setIsRefreshing] = (0, import_react5.useState)(false);
|
|
1705
|
+
const [autoStart, setAutoStart] = (0, import_react5.useState)(() => {
|
|
1706
|
+
try {
|
|
1707
|
+
return localStorage.getItem("rita-workspace-auto-start") === "true";
|
|
1708
|
+
} catch {
|
|
1709
|
+
return false;
|
|
1710
|
+
}
|
|
1711
|
+
});
|
|
1712
|
+
const handleToggleAutoStart = (0, import_react5.useCallback)(() => {
|
|
1713
|
+
setAutoStart((prev) => {
|
|
1714
|
+
const next = !prev;
|
|
1715
|
+
try {
|
|
1716
|
+
if (next) {
|
|
1717
|
+
localStorage.setItem("rita-workspace-auto-start", "true");
|
|
1718
|
+
} else {
|
|
1719
|
+
localStorage.removeItem("rita-workspace-auto-start");
|
|
1720
|
+
}
|
|
1721
|
+
} catch {
|
|
1722
|
+
}
|
|
1723
|
+
return next;
|
|
1724
|
+
});
|
|
1725
|
+
}, []);
|
|
1694
1726
|
const [draggingDrawingId, setDraggingDrawingId] = (0, import_react5.useState)(null);
|
|
1695
1727
|
const [dropTargetFolderId, setDropTargetFolderId] = (0, import_react5.useState)(null);
|
|
1696
1728
|
const [dropTargetDrawingId, setDropTargetDrawingId] = (0, import_react5.useState)(null);
|
|
@@ -1754,8 +1786,11 @@ var DrawingsDialog = ({
|
|
|
1754
1786
|
setSwitchingId(null);
|
|
1755
1787
|
}, [switchDrawing, onDrawingSelect]);
|
|
1756
1788
|
const handleCreate = (0, import_react5.useCallback)(async (folderId) => {
|
|
1757
|
-
await createNewDrawing(void 0, folderId
|
|
1758
|
-
|
|
1789
|
+
const created = await createNewDrawing(void 0, folderId);
|
|
1790
|
+
if (created) {
|
|
1791
|
+
onDrawingSelect?.(created);
|
|
1792
|
+
}
|
|
1793
|
+
}, [createNewDrawing, onDrawingSelect]);
|
|
1759
1794
|
const handleStartEdit = (0, import_react5.useCallback)((drawing) => {
|
|
1760
1795
|
setEditingId(drawing.id);
|
|
1761
1796
|
setEditName(drawing.name);
|
|
@@ -2573,7 +2608,37 @@ var DrawingsDialog = ({
|
|
|
2573
2608
|
onClick: importWorkspace
|
|
2574
2609
|
}
|
|
2575
2610
|
)
|
|
2576
|
-
] })
|
|
2611
|
+
] }),
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { padding: "0 20px 16px" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
2613
|
+
"label",
|
|
2614
|
+
{
|
|
2615
|
+
style: {
|
|
2616
|
+
display: "flex",
|
|
2617
|
+
alignItems: "center",
|
|
2618
|
+
gap: "10px",
|
|
2619
|
+
padding: "10px 12px",
|
|
2620
|
+
border: "1px solid var(--default-border-color, #e0e0e0)",
|
|
2621
|
+
borderRadius: "8px",
|
|
2622
|
+
cursor: "pointer",
|
|
2623
|
+
userSelect: "none"
|
|
2624
|
+
},
|
|
2625
|
+
children: [
|
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2627
|
+
"input",
|
|
2628
|
+
{
|
|
2629
|
+
type: "checkbox",
|
|
2630
|
+
checked: autoStart,
|
|
2631
|
+
onChange: handleToggleAutoStart,
|
|
2632
|
+
style: { width: "16px", height: "16px", cursor: "pointer", flexShrink: 0 }
|
|
2633
|
+
}
|
|
2634
|
+
),
|
|
2635
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2636
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: "14px", fontWeight: 500 }, children: t.autoStartLabel }),
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: "12px", color: "var(--text-secondary-color, #888)", marginTop: "2px" }, children: t.autoStartDesc })
|
|
2638
|
+
] })
|
|
2639
|
+
]
|
|
2640
|
+
}
|
|
2641
|
+
) })
|
|
2577
2642
|
]
|
|
2578
2643
|
}
|
|
2579
2644
|
)
|
package/dist/index.mjs
CHANGED
|
@@ -282,6 +282,9 @@ var sv = {
|
|
|
282
282
|
// Backup reminder
|
|
283
283
|
backupReminder: "Senaste backup:",
|
|
284
284
|
days: "dagar sedan",
|
|
285
|
+
// Auto-start
|
|
286
|
+
autoStartLabel: "Starta Rita i arbetsl\xE4ge",
|
|
287
|
+
autoStartDesc: "Aktivera arbetsl\xE4ge automatiskt n\xE4r Rita \xF6ppnas",
|
|
285
288
|
// Shortcuts
|
|
286
289
|
shortcutNewDrawing: "Ctrl+Alt+N"
|
|
287
290
|
};
|
|
@@ -332,6 +335,9 @@ var en = {
|
|
|
332
335
|
// Backup reminder
|
|
333
336
|
backupReminder: "Last backup:",
|
|
334
337
|
days: "days ago",
|
|
338
|
+
// Auto-start
|
|
339
|
+
autoStartLabel: "Start Rita in workspace mode",
|
|
340
|
+
autoStartDesc: "Automatically enable workspace mode when Rita opens",
|
|
335
341
|
// Shortcuts
|
|
336
342
|
shortcutNewDrawing: "Ctrl+Alt+N"
|
|
337
343
|
};
|
|
@@ -1114,6 +1120,7 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
1114
1120
|
input.click();
|
|
1115
1121
|
});
|
|
1116
1122
|
if (!files || files.length === 0) return;
|
|
1123
|
+
let lastImportedId = null;
|
|
1117
1124
|
for (const file of Array.from(files)) {
|
|
1118
1125
|
const text = await file.text();
|
|
1119
1126
|
const data = JSON.parse(text);
|
|
@@ -1128,16 +1135,20 @@ function WorkspaceProvider({ children, lang = "en" }) {
|
|
|
1128
1135
|
files: data.files || {}
|
|
1129
1136
|
});
|
|
1130
1137
|
await addDrawingToWorkspace(workspace.id, drawing.id);
|
|
1138
|
+
lastImportedId = drawing.id;
|
|
1131
1139
|
}
|
|
1132
1140
|
const allDrawings = await getAllDrawings();
|
|
1133
1141
|
const ws = await getOrCreateDefaultWorkspace();
|
|
1134
1142
|
const wsDrawings = allDrawings.filter((dr) => ws.drawingIds.includes(dr.id));
|
|
1135
1143
|
setWorkspace(ws);
|
|
1136
1144
|
setDrawings(wsDrawings);
|
|
1145
|
+
if (lastImportedId) {
|
|
1146
|
+
await switchDrawing(lastImportedId);
|
|
1147
|
+
}
|
|
1137
1148
|
} catch (err) {
|
|
1138
1149
|
setError(err instanceof Error ? err.message : "Failed to import drawing");
|
|
1139
1150
|
}
|
|
1140
|
-
}, [workspace, t]);
|
|
1151
|
+
}, [workspace, t, switchDrawing]);
|
|
1141
1152
|
const createFolder2 = useCallback(async (name) => {
|
|
1142
1153
|
const now = Date.now();
|
|
1143
1154
|
const tempId = `temp-${now}`;
|
|
@@ -1619,6 +1630,27 @@ var DrawingsDialog = ({
|
|
|
1619
1630
|
const [movingDrawingId, setMovingDrawingId] = useState4(null);
|
|
1620
1631
|
const [searchQuery, setSearchQuery] = useState4("");
|
|
1621
1632
|
const [isRefreshing, setIsRefreshing] = useState4(false);
|
|
1633
|
+
const [autoStart, setAutoStart] = useState4(() => {
|
|
1634
|
+
try {
|
|
1635
|
+
return localStorage.getItem("rita-workspace-auto-start") === "true";
|
|
1636
|
+
} catch {
|
|
1637
|
+
return false;
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
const handleToggleAutoStart = useCallback2(() => {
|
|
1641
|
+
setAutoStart((prev) => {
|
|
1642
|
+
const next = !prev;
|
|
1643
|
+
try {
|
|
1644
|
+
if (next) {
|
|
1645
|
+
localStorage.setItem("rita-workspace-auto-start", "true");
|
|
1646
|
+
} else {
|
|
1647
|
+
localStorage.removeItem("rita-workspace-auto-start");
|
|
1648
|
+
}
|
|
1649
|
+
} catch {
|
|
1650
|
+
}
|
|
1651
|
+
return next;
|
|
1652
|
+
});
|
|
1653
|
+
}, []);
|
|
1622
1654
|
const [draggingDrawingId, setDraggingDrawingId] = useState4(null);
|
|
1623
1655
|
const [dropTargetFolderId, setDropTargetFolderId] = useState4(null);
|
|
1624
1656
|
const [dropTargetDrawingId, setDropTargetDrawingId] = useState4(null);
|
|
@@ -1682,8 +1714,11 @@ var DrawingsDialog = ({
|
|
|
1682
1714
|
setSwitchingId(null);
|
|
1683
1715
|
}, [switchDrawing, onDrawingSelect]);
|
|
1684
1716
|
const handleCreate = useCallback2(async (folderId) => {
|
|
1685
|
-
await createNewDrawing(void 0, folderId
|
|
1686
|
-
|
|
1717
|
+
const created = await createNewDrawing(void 0, folderId);
|
|
1718
|
+
if (created) {
|
|
1719
|
+
onDrawingSelect?.(created);
|
|
1720
|
+
}
|
|
1721
|
+
}, [createNewDrawing, onDrawingSelect]);
|
|
1687
1722
|
const handleStartEdit = useCallback2((drawing) => {
|
|
1688
1723
|
setEditingId(drawing.id);
|
|
1689
1724
|
setEditName(drawing.name);
|
|
@@ -2501,7 +2536,37 @@ var DrawingsDialog = ({
|
|
|
2501
2536
|
onClick: importWorkspace
|
|
2502
2537
|
}
|
|
2503
2538
|
)
|
|
2504
|
-
] })
|
|
2539
|
+
] }),
|
|
2540
|
+
/* @__PURE__ */ jsx6("div", { style: { padding: "0 20px 16px" }, children: /* @__PURE__ */ jsxs4(
|
|
2541
|
+
"label",
|
|
2542
|
+
{
|
|
2543
|
+
style: {
|
|
2544
|
+
display: "flex",
|
|
2545
|
+
alignItems: "center",
|
|
2546
|
+
gap: "10px",
|
|
2547
|
+
padding: "10px 12px",
|
|
2548
|
+
border: "1px solid var(--default-border-color, #e0e0e0)",
|
|
2549
|
+
borderRadius: "8px",
|
|
2550
|
+
cursor: "pointer",
|
|
2551
|
+
userSelect: "none"
|
|
2552
|
+
},
|
|
2553
|
+
children: [
|
|
2554
|
+
/* @__PURE__ */ jsx6(
|
|
2555
|
+
"input",
|
|
2556
|
+
{
|
|
2557
|
+
type: "checkbox",
|
|
2558
|
+
checked: autoStart,
|
|
2559
|
+
onChange: handleToggleAutoStart,
|
|
2560
|
+
style: { width: "16px", height: "16px", cursor: "pointer", flexShrink: 0 }
|
|
2561
|
+
}
|
|
2562
|
+
),
|
|
2563
|
+
/* @__PURE__ */ jsxs4("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2564
|
+
/* @__PURE__ */ jsx6("div", { style: { fontSize: "14px", fontWeight: 500 }, children: t.autoStartLabel }),
|
|
2565
|
+
/* @__PURE__ */ jsx6("div", { style: { fontSize: "12px", color: "var(--text-secondary-color, #888)", marginTop: "2px" }, children: t.autoStartDesc })
|
|
2566
|
+
] })
|
|
2567
|
+
]
|
|
2568
|
+
}
|
|
2569
|
+
) })
|
|
2505
2570
|
]
|
|
2506
2571
|
}
|
|
2507
2572
|
)
|