rita-workspace 0.4.6 → 0.4.7
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 +11 -8
- package/dist/index.d.ts +11 -8
- package/dist/index.js +294 -356
- package/dist/index.mjs +294 -356
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -224,12 +224,24 @@ var sv = {
|
|
|
224
224
|
save: "Spara",
|
|
225
225
|
cancel: "Avbryt",
|
|
226
226
|
confirm: "Bekr\xE4fta",
|
|
227
|
+
// Sections
|
|
228
|
+
sectionDrawings: "Ritningar (enskilda filer)",
|
|
229
|
+
sectionWorkspace: "Hela arbetsytan (alla ritningar)",
|
|
230
|
+
// Actions with descriptions
|
|
231
|
+
createNewDrawing: "Skapa ny ritning",
|
|
232
|
+
createNewDrawingDesc: "Skapar en tom ritning i din arbetsyta",
|
|
233
|
+
openFromFile: "\xD6ppna ritning fr\xE5n fil",
|
|
234
|
+
openFromFileDesc: "\xD6ppnar en sparad ritning fr\xE5n din dator",
|
|
235
|
+
saveAllBackup: "Spara alla ritningar (backup)",
|
|
236
|
+
saveAllBackupDesc: "Ladda ner hela din arbetsyta som backup",
|
|
237
|
+
loadBackup: "L\xE4s in sparad arbetsyta",
|
|
238
|
+
loadBackupDesc: "\xC5terst\xE4ll alla ritningar fr\xE5n en tidigare backup",
|
|
227
239
|
// Messages
|
|
228
240
|
noDrawingsYet: "Inga ritningar \xE4nnu.",
|
|
229
|
-
clickNewToStart: 'Klicka "
|
|
241
|
+
clickNewToStart: 'Klicka "Skapa ny ritning" f\xF6r att b\xF6rja.',
|
|
230
242
|
modified: "\xC4ndrad",
|
|
231
243
|
confirmDelete: "Vill du ta bort denna ritning?",
|
|
232
|
-
// Export/Import
|
|
244
|
+
// Export/Import (legacy)
|
|
233
245
|
exportWorkspace: "Exportera arbetsyta",
|
|
234
246
|
importWorkspace: "Importera arbetsyta",
|
|
235
247
|
exportDrawing: "Spara som .excalidraw",
|
|
@@ -243,7 +255,7 @@ var en = {
|
|
|
243
255
|
newDrawing: "New drawing",
|
|
244
256
|
manageDrawings: "Manage workspace...",
|
|
245
257
|
// Dialog
|
|
246
|
-
dialogTitle: "Workspace",
|
|
258
|
+
dialogTitle: "My Workspace",
|
|
247
259
|
close: "Close",
|
|
248
260
|
open: "Open",
|
|
249
261
|
rename: "Rename",
|
|
@@ -251,12 +263,24 @@ var en = {
|
|
|
251
263
|
save: "Save",
|
|
252
264
|
cancel: "Cancel",
|
|
253
265
|
confirm: "Confirm",
|
|
266
|
+
// Sections
|
|
267
|
+
sectionDrawings: "Drawings (individual files)",
|
|
268
|
+
sectionWorkspace: "Entire workspace (all drawings)",
|
|
269
|
+
// Actions with descriptions
|
|
270
|
+
createNewDrawing: "Create new drawing",
|
|
271
|
+
createNewDrawingDesc: "Creates an empty drawing in your workspace",
|
|
272
|
+
openFromFile: "Open drawing from file",
|
|
273
|
+
openFromFileDesc: "Opens a saved drawing from your computer",
|
|
274
|
+
saveAllBackup: "Save all drawings (backup)",
|
|
275
|
+
saveAllBackupDesc: "Download your entire workspace as a backup",
|
|
276
|
+
loadBackup: "Load saved workspace",
|
|
277
|
+
loadBackupDesc: "Restore all drawings from a previous backup",
|
|
254
278
|
// Messages
|
|
255
279
|
noDrawingsYet: "No drawings yet.",
|
|
256
|
-
clickNewToStart: 'Click "
|
|
280
|
+
clickNewToStart: 'Click "Create new drawing" to start.',
|
|
257
281
|
modified: "Modified",
|
|
258
282
|
confirmDelete: "Do you want to delete this drawing?",
|
|
259
|
-
// Export/Import
|
|
283
|
+
// Export/Import (legacy)
|
|
260
284
|
exportWorkspace: "Export workspace",
|
|
261
285
|
importWorkspace: "Import workspace",
|
|
262
286
|
exportDrawing: "Save as .excalidraw",
|
|
@@ -907,6 +931,33 @@ var WorkspaceMenuItems = ({
|
|
|
907
931
|
// src/ui/Dialog/DrawingsDialog.tsx
|
|
908
932
|
var import_react5 = require("react");
|
|
909
933
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
934
|
+
var ActionButton = ({ icon, label, description, onClick, primary }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
935
|
+
"button",
|
|
936
|
+
{
|
|
937
|
+
onClick,
|
|
938
|
+
style: {
|
|
939
|
+
display: "flex",
|
|
940
|
+
alignItems: "center",
|
|
941
|
+
gap: "12px",
|
|
942
|
+
width: "100%",
|
|
943
|
+
padding: "12px 16px",
|
|
944
|
+
backgroundColor: primary ? "var(--color-primary-light, rgba(108, 99, 255, 0.08))" : "transparent",
|
|
945
|
+
border: "1px solid var(--default-border-color, #e0e0e0)",
|
|
946
|
+
borderRadius: "8px",
|
|
947
|
+
cursor: "pointer",
|
|
948
|
+
textAlign: "left",
|
|
949
|
+
color: "inherit",
|
|
950
|
+
fontSize: "14px"
|
|
951
|
+
},
|
|
952
|
+
children: [
|
|
953
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontSize: "20px", flexShrink: 0 }, children: icon }),
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontWeight: 500 }, children: label }),
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: "12px", color: "var(--text-secondary-color, #888)", marginTop: "2px" }, children: description })
|
|
957
|
+
] })
|
|
958
|
+
]
|
|
959
|
+
}
|
|
960
|
+
);
|
|
910
961
|
var DrawingsDialog = ({
|
|
911
962
|
open,
|
|
912
963
|
onClose,
|
|
@@ -929,11 +980,6 @@ var DrawingsDialog = ({
|
|
|
929
980
|
t: contextT,
|
|
930
981
|
lang: contextLang
|
|
931
982
|
} = useWorkspace();
|
|
932
|
-
(0, import_react5.useEffect)(() => {
|
|
933
|
-
if (open) {
|
|
934
|
-
refreshDrawings();
|
|
935
|
-
}
|
|
936
|
-
}, [open, refreshDrawings]);
|
|
937
983
|
const t = lang ? getTranslations(lang) : contextT;
|
|
938
984
|
const effectiveLang = lang || contextLang;
|
|
939
985
|
const [editingId, setEditingId] = (0, import_react5.useState)(null);
|
|
@@ -942,7 +988,14 @@ var DrawingsDialog = ({
|
|
|
942
988
|
const [position, setPosition] = (0, import_react5.useState)(null);
|
|
943
989
|
const dragRef = (0, import_react5.useRef)(null);
|
|
944
990
|
const dialogRef = (0, import_react5.useRef)(null);
|
|
991
|
+
(0, import_react5.useEffect)(() => {
|
|
992
|
+
if (open) {
|
|
993
|
+
refreshDrawings();
|
|
994
|
+
setPosition(null);
|
|
995
|
+
}
|
|
996
|
+
}, [open, refreshDrawings]);
|
|
945
997
|
const handleMouseDown = (0, import_react5.useCallback)((e) => {
|
|
998
|
+
if (e.target.closest("button")) return;
|
|
946
999
|
if (!dialogRef.current) return;
|
|
947
1000
|
const rect = dialogRef.current.getBoundingClientRect();
|
|
948
1001
|
const currentX = position?.x ?? rect.left;
|
|
@@ -968,9 +1021,7 @@ var DrawingsDialog = ({
|
|
|
968
1021
|
}, [switchDrawing, onDrawingSelect]);
|
|
969
1022
|
const handleCreate = (0, import_react5.useCallback)(async () => {
|
|
970
1023
|
const newDrawing = await createNewDrawing();
|
|
971
|
-
if (newDrawing)
|
|
972
|
-
onDrawingSelect?.(newDrawing);
|
|
973
|
-
}
|
|
1024
|
+
if (newDrawing) onDrawingSelect?.(newDrawing);
|
|
974
1025
|
}, [createNewDrawing, onDrawingSelect]);
|
|
975
1026
|
const handleStartEdit = (0, import_react5.useCallback)((drawing) => {
|
|
976
1027
|
setEditingId(drawing.id);
|
|
@@ -994,12 +1045,10 @@ var DrawingsDialog = ({
|
|
|
994
1045
|
const getLocale = () => {
|
|
995
1046
|
if (!effectiveLang) return "en-US";
|
|
996
1047
|
const baseLang = effectiveLang.split("-")[0].toLowerCase();
|
|
997
|
-
|
|
998
|
-
return "en-US";
|
|
1048
|
+
return baseLang === "sv" ? "sv-SE" : "en-US";
|
|
999
1049
|
};
|
|
1000
1050
|
const formatDate = (timestamp) => {
|
|
1001
1051
|
return new Date(timestamp).toLocaleString(getLocale(), {
|
|
1002
|
-
year: "numeric",
|
|
1003
1052
|
month: "short",
|
|
1004
1053
|
day: "numeric",
|
|
1005
1054
|
hour: "2-digit",
|
|
@@ -1012,26 +1061,34 @@ var DrawingsDialog = ({
|
|
|
1012
1061
|
left: position.x,
|
|
1013
1062
|
top: position.y,
|
|
1014
1063
|
backgroundColor: "var(--island-bg-color, #fff)",
|
|
1015
|
-
borderRadius: "
|
|
1016
|
-
boxShadow: "0
|
|
1064
|
+
borderRadius: "12px",
|
|
1065
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
1017
1066
|
width: "90%",
|
|
1018
|
-
maxWidth: "
|
|
1019
|
-
maxHeight: "
|
|
1067
|
+
maxWidth: "520px",
|
|
1068
|
+
maxHeight: "85vh",
|
|
1020
1069
|
display: "flex",
|
|
1021
1070
|
flexDirection: "column",
|
|
1022
1071
|
color: "var(--text-primary-color, #1b1b1f)",
|
|
1023
1072
|
zIndex: 1e4
|
|
1024
1073
|
} : {
|
|
1025
1074
|
backgroundColor: "var(--island-bg-color, #fff)",
|
|
1026
|
-
borderRadius: "
|
|
1027
|
-
boxShadow: "0
|
|
1075
|
+
borderRadius: "12px",
|
|
1076
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.2)",
|
|
1028
1077
|
width: "90%",
|
|
1029
|
-
maxWidth: "
|
|
1030
|
-
maxHeight: "
|
|
1078
|
+
maxWidth: "520px",
|
|
1079
|
+
maxHeight: "85vh",
|
|
1031
1080
|
display: "flex",
|
|
1032
1081
|
flexDirection: "column",
|
|
1033
1082
|
color: "var(--text-primary-color, #1b1b1f)"
|
|
1034
1083
|
};
|
|
1084
|
+
const sectionHeaderStyle = {
|
|
1085
|
+
fontSize: "12px",
|
|
1086
|
+
fontWeight: 600,
|
|
1087
|
+
textTransform: "uppercase",
|
|
1088
|
+
letterSpacing: "0.5px",
|
|
1089
|
+
color: "var(--text-secondary-color, #888)",
|
|
1090
|
+
padding: "16px 20px 8px"
|
|
1091
|
+
};
|
|
1035
1092
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1036
1093
|
"div",
|
|
1037
1094
|
{
|
|
@@ -1042,7 +1099,7 @@ var DrawingsDialog = ({
|
|
|
1042
1099
|
left: 0,
|
|
1043
1100
|
right: 0,
|
|
1044
1101
|
bottom: 0,
|
|
1045
|
-
backgroundColor: position ? "transparent" : "rgba(0, 0, 0, 0.
|
|
1102
|
+
backgroundColor: position ? "transparent" : "rgba(0, 0, 0, 0.4)",
|
|
1046
1103
|
display: position ? "block" : "flex",
|
|
1047
1104
|
alignItems: "center",
|
|
1048
1105
|
justifyContent: "center",
|
|
@@ -1052,384 +1109,265 @@ var DrawingsDialog = ({
|
|
|
1052
1109
|
onClick: (e) => {
|
|
1053
1110
|
if (!position && e.target === e.currentTarget) onClose();
|
|
1054
1111
|
},
|
|
1055
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
"
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: dialogRef, className: "rita-workspace-dialog", style: { ...dialogStyle, pointerEvents: "auto" }, children: [
|
|
1113
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1114
|
+
"div",
|
|
1115
|
+
{
|
|
1116
|
+
onMouseDown: handleMouseDown,
|
|
1117
|
+
style: {
|
|
1118
|
+
padding: "16px 20px",
|
|
1119
|
+
display: "flex",
|
|
1120
|
+
alignItems: "center",
|
|
1121
|
+
justifyContent: "space-between",
|
|
1122
|
+
cursor: "grab",
|
|
1123
|
+
userSelect: "none",
|
|
1124
|
+
borderBottom: "1px solid var(--default-border-color, #e0e0e0)"
|
|
1125
|
+
},
|
|
1126
|
+
children: [
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: t.dialogTitle }),
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1129
|
+
"button",
|
|
1130
|
+
{
|
|
1131
|
+
onClick: onClose,
|
|
1132
|
+
style: {
|
|
1133
|
+
background: "none",
|
|
1134
|
+
border: "none",
|
|
1135
|
+
fontSize: "24px",
|
|
1136
|
+
cursor: "pointer",
|
|
1137
|
+
padding: "4px",
|
|
1138
|
+
lineHeight: 1,
|
|
1139
|
+
color: "inherit"
|
|
1140
|
+
},
|
|
1141
|
+
"aria-label": t.close,
|
|
1142
|
+
children: "\xD7"
|
|
1143
|
+
}
|
|
1144
|
+
)
|
|
1145
|
+
]
|
|
1146
|
+
}
|
|
1147
|
+
),
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { flex: 1, overflow: "auto" }, children: [
|
|
1149
|
+
drawings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { padding: "8px 20px 0" }, children: drawings.map((drawing) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1150
|
+
"div",
|
|
1151
|
+
{
|
|
1152
|
+
onClick: () => {
|
|
1153
|
+
if (editingId || confirmDeleteId) return;
|
|
1154
|
+
if (activeDrawing?.id !== drawing.id) handleSelect(drawing);
|
|
1155
|
+
},
|
|
1156
|
+
style: {
|
|
1157
|
+
padding: "10px 12px",
|
|
1158
|
+
display: "flex",
|
|
1159
|
+
alignItems: "center",
|
|
1160
|
+
gap: "12px",
|
|
1161
|
+
borderRadius: "8px",
|
|
1162
|
+
marginBottom: "4px",
|
|
1163
|
+
cursor: editingId || confirmDeleteId ? "default" : "pointer",
|
|
1164
|
+
backgroundColor: activeDrawing?.id === drawing.id ? "var(--color-primary-light, rgba(108, 99, 255, 0.1))" : "transparent",
|
|
1165
|
+
transition: "background-color 0.15s"
|
|
1166
|
+
},
|
|
1167
|
+
children: [
|
|
1168
|
+
renderThumbnail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
|
|
1169
|
+
width: "64px",
|
|
1170
|
+
height: "48px",
|
|
1171
|
+
flexShrink: 0,
|
|
1172
|
+
borderRadius: "4px",
|
|
1173
|
+
overflow: "hidden",
|
|
1174
|
+
border: "1px solid var(--default-border-color, #e0e0e0)",
|
|
1175
|
+
backgroundColor: "#fff",
|
|
1069
1176
|
display: "flex",
|
|
1070
1177
|
alignItems: "center",
|
|
1071
|
-
justifyContent: "
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
},
|
|
1075
|
-
children: [
|
|
1076
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600 }, children: t.dialogTitle }),
|
|
1178
|
+
justifyContent: "center"
|
|
1179
|
+
}, children: renderThumbnail(drawing) }),
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { flex: 1, minWidth: 0 }, children: editingId === drawing.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center" }, children: [
|
|
1077
1181
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1078
|
-
"
|
|
1182
|
+
"input",
|
|
1079
1183
|
{
|
|
1080
|
-
|
|
1184
|
+
type: "text",
|
|
1185
|
+
value: editName,
|
|
1186
|
+
onChange: (e) => setEditName(e.target.value),
|
|
1187
|
+
onKeyDown: (e) => {
|
|
1188
|
+
if (e.key === "Enter") handleSaveEdit();
|
|
1189
|
+
if (e.key === "Escape") handleCancelEdit();
|
|
1190
|
+
},
|
|
1191
|
+
onClick: (e) => e.stopPropagation(),
|
|
1192
|
+
autoFocus: true,
|
|
1081
1193
|
style: {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
fontSize: "
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1194
|
+
flex: 1,
|
|
1195
|
+
padding: "4px 8px",
|
|
1196
|
+
fontSize: "14px",
|
|
1197
|
+
border: "1px solid var(--color-primary, #6c63ff)",
|
|
1198
|
+
borderRadius: "4px",
|
|
1199
|
+
outline: "none"
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
),
|
|
1203
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1204
|
+
"button",
|
|
1205
|
+
{
|
|
1206
|
+
onClick: (e) => {
|
|
1207
|
+
e.stopPropagation();
|
|
1208
|
+
handleSaveEdit();
|
|
1089
1209
|
},
|
|
1090
|
-
"
|
|
1091
|
-
children:
|
|
1210
|
+
style: { padding: "4px 10px", fontSize: "12px", backgroundColor: "var(--color-primary, #6c63ff)", color: "#fff", border: "none", borderRadius: "4px", cursor: "pointer" },
|
|
1211
|
+
children: t.save
|
|
1212
|
+
}
|
|
1213
|
+
),
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1215
|
+
"button",
|
|
1216
|
+
{
|
|
1217
|
+
onClick: (e) => {
|
|
1218
|
+
e.stopPropagation();
|
|
1219
|
+
handleCancelEdit();
|
|
1220
|
+
},
|
|
1221
|
+
style: { padding: "4px 10px", fontSize: "12px", backgroundColor: "transparent", border: "1px solid var(--default-border-color, #ccc)", borderRadius: "4px", cursor: "pointer", color: "inherit" },
|
|
1222
|
+
children: t.cancel
|
|
1092
1223
|
}
|
|
1093
1224
|
)
|
|
1094
|
-
]
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t.noDrawingsYet }),
|
|
1099
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t.clickNewToStart })
|
|
1100
|
-
] }) : drawings.map((drawing) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1101
|
-
"div",
|
|
1102
|
-
{
|
|
1103
|
-
className: "rita-workspace-dialog-item",
|
|
1104
|
-
onClick: () => {
|
|
1105
|
-
if (editingId || confirmDeleteId) return;
|
|
1106
|
-
if (activeDrawing?.id !== drawing.id) handleSelect(drawing);
|
|
1107
|
-
},
|
|
1108
|
-
style: {
|
|
1109
|
-
padding: "12px 20px",
|
|
1110
|
-
display: "flex",
|
|
1111
|
-
alignItems: "center",
|
|
1112
|
-
gap: "12px",
|
|
1113
|
-
borderBottom: "1px solid var(--default-border-color, #f0f0f0)",
|
|
1114
|
-
cursor: editingId || confirmDeleteId ? "default" : "pointer",
|
|
1115
|
-
backgroundColor: activeDrawing?.id === drawing.id ? "var(--color-primary-light, rgba(108, 99, 255, 0.1))" : "transparent"
|
|
1116
|
-
},
|
|
1117
|
-
children: [
|
|
1118
|
-
renderThumbnail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
|
|
1119
|
-
width: "80px",
|
|
1120
|
-
height: "60px",
|
|
1121
|
-
flexShrink: 0,
|
|
1122
|
-
borderRadius: "4px",
|
|
1123
|
-
overflow: "hidden",
|
|
1124
|
-
border: "1px solid var(--default-border-color, #e0e0e0)",
|
|
1125
|
-
backgroundColor: "#fff",
|
|
1126
|
-
display: "flex",
|
|
1127
|
-
alignItems: "center",
|
|
1128
|
-
justifyContent: "center"
|
|
1129
|
-
}, children: renderThumbnail(drawing) }),
|
|
1130
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { flex: 1, minWidth: 0 }, children: editingId === drawing.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center" }, children: [
|
|
1131
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1132
|
-
"input",
|
|
1133
|
-
{
|
|
1134
|
-
type: "text",
|
|
1135
|
-
value: editName,
|
|
1136
|
-
onChange: (e) => setEditName(e.target.value),
|
|
1137
|
-
onKeyDown: (e) => {
|
|
1138
|
-
if (e.key === "Enter") handleSaveEdit();
|
|
1139
|
-
if (e.key === "Escape") handleCancelEdit();
|
|
1140
|
-
},
|
|
1141
|
-
onClick: (e) => e.stopPropagation(),
|
|
1142
|
-
autoFocus: true,
|
|
1143
|
-
style: {
|
|
1144
|
-
flex: 1,
|
|
1145
|
-
padding: "4px 8px",
|
|
1146
|
-
fontSize: "14px",
|
|
1147
|
-
border: "1px solid var(--color-primary, #6c63ff)",
|
|
1148
|
-
borderRadius: "4px",
|
|
1149
|
-
outline: "none"
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
),
|
|
1153
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1154
|
-
"button",
|
|
1155
|
-
{
|
|
1156
|
-
onClick: (e) => {
|
|
1157
|
-
e.stopPropagation();
|
|
1158
|
-
handleSaveEdit();
|
|
1159
|
-
},
|
|
1160
|
-
style: {
|
|
1161
|
-
padding: "4px 10px",
|
|
1162
|
-
fontSize: "12px",
|
|
1163
|
-
backgroundColor: "var(--color-primary, #6c63ff)",
|
|
1164
|
-
color: "#fff",
|
|
1165
|
-
border: "none",
|
|
1166
|
-
borderRadius: "4px",
|
|
1167
|
-
cursor: "pointer"
|
|
1168
|
-
},
|
|
1169
|
-
children: t.save
|
|
1170
|
-
}
|
|
1171
|
-
),
|
|
1172
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1173
|
-
"button",
|
|
1225
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1228
|
+
"span",
|
|
1174
1229
|
{
|
|
1175
1230
|
onClick: (e) => {
|
|
1176
1231
|
e.stopPropagation();
|
|
1177
|
-
|
|
1232
|
+
handleStartEdit(drawing);
|
|
1178
1233
|
},
|
|
1179
1234
|
style: {
|
|
1180
|
-
|
|
1181
|
-
fontSize: "
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
cursor: "
|
|
1186
|
-
color: "inherit"
|
|
1187
|
-
},
|
|
1188
|
-
children: t.cancel
|
|
1189
|
-
}
|
|
1190
|
-
)
|
|
1191
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1192
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
1193
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1194
|
-
"span",
|
|
1195
|
-
{
|
|
1196
|
-
onClick: (e) => {
|
|
1197
|
-
e.stopPropagation();
|
|
1198
|
-
handleStartEdit(drawing);
|
|
1199
|
-
},
|
|
1200
|
-
style: {
|
|
1201
|
-
fontWeight: activeDrawing?.id === drawing.id ? 600 : 400,
|
|
1202
|
-
fontSize: "14px",
|
|
1203
|
-
overflow: "hidden",
|
|
1204
|
-
textOverflow: "ellipsis",
|
|
1205
|
-
whiteSpace: "nowrap",
|
|
1206
|
-
cursor: "text"
|
|
1207
|
-
},
|
|
1208
|
-
title: t.rename,
|
|
1209
|
-
children: [
|
|
1210
|
-
activeDrawing?.id === drawing.id && "\u2713 ",
|
|
1211
|
-
drawing.name
|
|
1212
|
-
]
|
|
1213
|
-
}
|
|
1214
|
-
),
|
|
1215
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1216
|
-
"button",
|
|
1217
|
-
{
|
|
1218
|
-
onClick: (e) => {
|
|
1219
|
-
e.stopPropagation();
|
|
1220
|
-
handleStartEdit(drawing);
|
|
1221
|
-
},
|
|
1222
|
-
style: {
|
|
1223
|
-
background: "none",
|
|
1224
|
-
border: "none",
|
|
1225
|
-
cursor: "pointer",
|
|
1226
|
-
padding: "0 2px",
|
|
1227
|
-
fontSize: "12px",
|
|
1228
|
-
opacity: 0.5,
|
|
1229
|
-
flexShrink: 0
|
|
1230
|
-
},
|
|
1231
|
-
title: t.rename,
|
|
1232
|
-
children: "\u270F\uFE0F"
|
|
1233
|
-
}
|
|
1234
|
-
)
|
|
1235
|
-
] }),
|
|
1236
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1237
|
-
"div",
|
|
1238
|
-
{
|
|
1239
|
-
style: {
|
|
1240
|
-
fontSize: "12px",
|
|
1241
|
-
color: "var(--text-secondary-color, #888)",
|
|
1242
|
-
marginTop: "2px"
|
|
1235
|
+
fontWeight: activeDrawing?.id === drawing.id ? 600 : 400,
|
|
1236
|
+
fontSize: "14px",
|
|
1237
|
+
overflow: "hidden",
|
|
1238
|
+
textOverflow: "ellipsis",
|
|
1239
|
+
whiteSpace: "nowrap",
|
|
1240
|
+
cursor: "text"
|
|
1243
1241
|
},
|
|
1242
|
+
title: t.rename,
|
|
1244
1243
|
children: [
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
formatDate(drawing.updatedAt)
|
|
1244
|
+
activeDrawing?.id === drawing.id && "\u2713 ",
|
|
1245
|
+
drawing.name
|
|
1248
1246
|
]
|
|
1249
1247
|
}
|
|
1250
|
-
)
|
|
1251
|
-
] }) }),
|
|
1252
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", gap: "4px" }, children: confirmDeleteId === drawing.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1253
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1254
|
-
"button",
|
|
1255
|
-
{
|
|
1256
|
-
onClick: (e) => {
|
|
1257
|
-
e.stopPropagation();
|
|
1258
|
-
handleDelete(drawing.id);
|
|
1259
|
-
},
|
|
1260
|
-
style: {
|
|
1261
|
-
padding: "6px 12px",
|
|
1262
|
-
fontSize: "12px",
|
|
1263
|
-
backgroundColor: "#dc3545",
|
|
1264
|
-
color: "#fff",
|
|
1265
|
-
border: "none",
|
|
1266
|
-
borderRadius: "4px",
|
|
1267
|
-
cursor: "pointer"
|
|
1268
|
-
},
|
|
1269
|
-
children: t.delete
|
|
1270
|
-
}
|
|
1271
|
-
),
|
|
1272
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1273
|
-
"button",
|
|
1274
|
-
{
|
|
1275
|
-
onClick: (e) => {
|
|
1276
|
-
e.stopPropagation();
|
|
1277
|
-
setConfirmDeleteId(null);
|
|
1278
|
-
},
|
|
1279
|
-
style: {
|
|
1280
|
-
padding: "6px 12px",
|
|
1281
|
-
fontSize: "12px",
|
|
1282
|
-
backgroundColor: "transparent",
|
|
1283
|
-
border: "1px solid var(--default-border-color, #ccc)",
|
|
1284
|
-
borderRadius: "4px",
|
|
1285
|
-
cursor: "pointer",
|
|
1286
|
-
color: "inherit"
|
|
1287
|
-
},
|
|
1288
|
-
children: t.cancel
|
|
1289
|
-
}
|
|
1290
|
-
)
|
|
1291
|
-
] }) : editingId !== drawing.id && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1292
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1293
|
-
"button",
|
|
1294
|
-
{
|
|
1295
|
-
onClick: (e) => {
|
|
1296
|
-
e.stopPropagation();
|
|
1297
|
-
exportDrawingAsExcalidraw(drawing.id);
|
|
1298
|
-
},
|
|
1299
|
-
style: {
|
|
1300
|
-
padding: "6px 12px",
|
|
1301
|
-
fontSize: "12px",
|
|
1302
|
-
backgroundColor: "transparent",
|
|
1303
|
-
border: "1px solid var(--default-border-color, #ccc)",
|
|
1304
|
-
borderRadius: "4px",
|
|
1305
|
-
cursor: "pointer",
|
|
1306
|
-
color: "inherit"
|
|
1307
|
-
},
|
|
1308
|
-
title: t.exportDrawing,
|
|
1309
|
-
children: "\u{1F4BE}"
|
|
1310
|
-
}
|
|
1311
1248
|
),
|
|
1312
1249
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1313
1250
|
"button",
|
|
1314
1251
|
{
|
|
1315
1252
|
onClick: (e) => {
|
|
1316
1253
|
e.stopPropagation();
|
|
1317
|
-
|
|
1318
|
-
},
|
|
1319
|
-
style: {
|
|
1320
|
-
padding: "6px 12px",
|
|
1321
|
-
fontSize: "12px",
|
|
1322
|
-
backgroundColor: "transparent",
|
|
1323
|
-
border: "1px solid var(--default-border-color, #ccc)",
|
|
1324
|
-
borderRadius: "4px",
|
|
1325
|
-
cursor: "pointer",
|
|
1326
|
-
color: "inherit"
|
|
1254
|
+
handleStartEdit(drawing);
|
|
1327
1255
|
},
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
children: "\
|
|
1256
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: "0 2px", fontSize: "12px", opacity: 0.4, flexShrink: 0 },
|
|
1257
|
+
title: t.rename,
|
|
1258
|
+
children: "\u270F\uFE0F"
|
|
1331
1259
|
}
|
|
1332
1260
|
)
|
|
1333
|
-
] })
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
padding: "16px 20px",
|
|
1343
|
-
borderTop: "1px solid var(--default-border-color, #e0e0e0)",
|
|
1344
|
-
display: "flex",
|
|
1345
|
-
justifyContent: "space-between",
|
|
1346
|
-
alignItems: "center"
|
|
1347
|
-
},
|
|
1348
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: [
|
|
1349
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1261
|
+
] }),
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: "11px", color: "var(--text-secondary-color, #888)", marginTop: "1px" }, children: [
|
|
1263
|
+
t.modified,
|
|
1264
|
+
": ",
|
|
1265
|
+
formatDate(drawing.updatedAt)
|
|
1266
|
+
] })
|
|
1267
|
+
] }) }),
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", gap: "2px" }, children: confirmDeleteId === drawing.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1269
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1350
1270
|
"button",
|
|
1351
1271
|
{
|
|
1352
|
-
onClick:
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
fontSize: "14px",
|
|
1356
|
-
backgroundColor: "var(--color-primary, #6c63ff)",
|
|
1357
|
-
color: "#fff",
|
|
1358
|
-
border: "none",
|
|
1359
|
-
borderRadius: "6px",
|
|
1360
|
-
cursor: "pointer",
|
|
1361
|
-
fontWeight: 500
|
|
1272
|
+
onClick: (e) => {
|
|
1273
|
+
e.stopPropagation();
|
|
1274
|
+
handleDelete(drawing.id);
|
|
1362
1275
|
},
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
t.newDrawing
|
|
1366
|
-
]
|
|
1276
|
+
style: { padding: "4px 10px", fontSize: "12px", backgroundColor: "#dc3545", color: "#fff", border: "none", borderRadius: "4px", cursor: "pointer" },
|
|
1277
|
+
children: t.delete
|
|
1367
1278
|
}
|
|
1368
1279
|
),
|
|
1369
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1370
1281
|
"button",
|
|
1371
1282
|
{
|
|
1372
|
-
onClick:
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
fontSize: "14px",
|
|
1376
|
-
backgroundColor: "transparent",
|
|
1377
|
-
border: "1px solid var(--default-border-color, #ccc)",
|
|
1378
|
-
borderRadius: "6px",
|
|
1379
|
-
cursor: "pointer",
|
|
1380
|
-
color: "inherit"
|
|
1283
|
+
onClick: (e) => {
|
|
1284
|
+
e.stopPropagation();
|
|
1285
|
+
setConfirmDeleteId(null);
|
|
1381
1286
|
},
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
t.importDrawing
|
|
1385
|
-
]
|
|
1287
|
+
style: { padding: "4px 10px", fontSize: "12px", backgroundColor: "transparent", border: "1px solid var(--default-border-color, #ccc)", borderRadius: "4px", cursor: "pointer", color: "inherit" },
|
|
1288
|
+
children: t.cancel
|
|
1386
1289
|
}
|
|
1387
|
-
)
|
|
1388
|
-
|
|
1290
|
+
)
|
|
1291
|
+
] }) : editingId !== drawing.id && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1292
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1389
1293
|
"button",
|
|
1390
1294
|
{
|
|
1391
|
-
onClick:
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
fontSize: "14px",
|
|
1395
|
-
backgroundColor: "transparent",
|
|
1396
|
-
border: "1px solid var(--default-border-color, #ccc)",
|
|
1397
|
-
borderRadius: "6px",
|
|
1398
|
-
cursor: "pointer",
|
|
1399
|
-
color: "inherit"
|
|
1295
|
+
onClick: (e) => {
|
|
1296
|
+
e.stopPropagation();
|
|
1297
|
+
exportDrawingAsExcalidraw(drawing.id);
|
|
1400
1298
|
},
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
]
|
|
1299
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: "4px", fontSize: "14px", opacity: 0.5 },
|
|
1300
|
+
title: t.exportDrawing,
|
|
1301
|
+
children: "\u{1F4BE}"
|
|
1405
1302
|
}
|
|
1406
1303
|
),
|
|
1407
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1408
1305
|
"button",
|
|
1409
1306
|
{
|
|
1410
|
-
onClick:
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
fontSize: "14px",
|
|
1414
|
-
backgroundColor: "transparent",
|
|
1415
|
-
border: "1px solid var(--default-border-color, #ccc)",
|
|
1416
|
-
borderRadius: "6px",
|
|
1417
|
-
cursor: "pointer",
|
|
1418
|
-
color: "inherit"
|
|
1307
|
+
onClick: (e) => {
|
|
1308
|
+
e.stopPropagation();
|
|
1309
|
+
setConfirmDeleteId(drawing.id);
|
|
1419
1310
|
},
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
]
|
|
1311
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: "4px", fontSize: "14px", opacity: 0.5 },
|
|
1312
|
+
title: t.delete,
|
|
1313
|
+
disabled: drawings.length <= 1,
|
|
1314
|
+
children: "\u{1F5D1}\uFE0F"
|
|
1425
1315
|
}
|
|
1426
1316
|
)
|
|
1427
|
-
] })
|
|
1317
|
+
] }) })
|
|
1318
|
+
]
|
|
1319
|
+
},
|
|
1320
|
+
drawing.id
|
|
1321
|
+
)) }),
|
|
1322
|
+
drawings.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: [
|
|
1323
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t.noDrawingsYet }),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: t.clickNewToStart })
|
|
1325
|
+
] }),
|
|
1326
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: sectionHeaderStyle, children: t.sectionDrawings }),
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "0 20px", display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1329
|
+
ActionButton,
|
|
1330
|
+
{
|
|
1331
|
+
icon: "\u{1F4C4}",
|
|
1332
|
+
label: t.createNewDrawing,
|
|
1333
|
+
description: t.createNewDrawingDesc,
|
|
1334
|
+
onClick: handleCreate,
|
|
1335
|
+
primary: true
|
|
1336
|
+
}
|
|
1337
|
+
),
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1339
|
+
ActionButton,
|
|
1340
|
+
{
|
|
1341
|
+
icon: "\u{1F4C2}",
|
|
1342
|
+
label: t.openFromFile,
|
|
1343
|
+
description: t.openFromFileDesc,
|
|
1344
|
+
onClick: importExcalidrawFile
|
|
1428
1345
|
}
|
|
1429
1346
|
)
|
|
1430
|
-
]
|
|
1431
|
-
|
|
1432
|
-
|
|
1347
|
+
] }),
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: sectionHeaderStyle, children: t.sectionWorkspace }),
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: "0 20px 16px", display: "flex", gap: "8px" }, children: [
|
|
1350
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1351
|
+
ActionButton,
|
|
1352
|
+
{
|
|
1353
|
+
icon: "\u{1F4BE}",
|
|
1354
|
+
label: t.saveAllBackup,
|
|
1355
|
+
description: t.saveAllBackupDesc,
|
|
1356
|
+
onClick: exportWorkspace
|
|
1357
|
+
}
|
|
1358
|
+
),
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1360
|
+
ActionButton,
|
|
1361
|
+
{
|
|
1362
|
+
icon: "\u{1F4E5}",
|
|
1363
|
+
label: t.loadBackup,
|
|
1364
|
+
description: t.loadBackupDesc,
|
|
1365
|
+
onClick: importWorkspace
|
|
1366
|
+
}
|
|
1367
|
+
)
|
|
1368
|
+
] })
|
|
1369
|
+
] })
|
|
1370
|
+
] })
|
|
1433
1371
|
}
|
|
1434
1372
|
);
|
|
1435
1373
|
};
|