rita-workspace 0.5.31 → 0.5.32

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.
Files changed (3) hide show
  1. package/dist/index.js +334 -283
  2. package/dist/index.mjs +334 -283
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1922,30 +1922,7 @@ var DrawingsDialog = ({
1922
1922
  gap: "2px",
1923
1923
  alignItems: "center",
1924
1924
  visibility: hoveredId === drawing.id || selectedId === drawing.id || activeDrawing?.id === drawing.id || confirmDeleteId === drawing.id || movingDrawingId === drawing.id || editingId === drawing.id ? "visible" : "hidden"
1925
- }, children: confirmDeleteId === drawing.id ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
1926
- /* @__PURE__ */ jsx6(
1927
- "button",
1928
- {
1929
- onClick: (e) => {
1930
- e.stopPropagation();
1931
- handleDelete(drawing.id);
1932
- },
1933
- style: { padding: "4px 10px", fontSize: "12px", backgroundColor: "#dc3545", color: "#fff", border: "none", borderRadius: "4px", cursor: "pointer" },
1934
- children: t.delete
1935
- }
1936
- ),
1937
- /* @__PURE__ */ jsx6(
1938
- "button",
1939
- {
1940
- onClick: (e) => {
1941
- e.stopPropagation();
1942
- setConfirmDeleteId(null);
1943
- },
1944
- style: { padding: "4px 10px", fontSize: "12px", backgroundColor: "transparent", border: "1px solid var(--default-border-color, #ccc)", borderRadius: "4px", cursor: "pointer", color: "inherit" },
1945
- children: t.cancel
1946
- }
1947
- )
1948
- ] }) : movingDrawingId === drawing.id ? /* @__PURE__ */ jsxs4("div", { onClick: (e) => e.stopPropagation(), style: { display: "flex", flexDirection: "column", gap: "2px", fontSize: "12px" }, children: [
1925
+ }, children: movingDrawingId === drawing.id ? /* @__PURE__ */ jsxs4("div", { onClick: (e) => e.stopPropagation(), style: { display: "flex", flexDirection: "column", gap: "2px", fontSize: "12px" }, children: [
1949
1926
  /* @__PURE__ */ jsx6(
1950
1927
  "button",
1951
1928
  {
@@ -2113,24 +2090,7 @@ var DrawingsDialog = ({
2113
2090
  ")"
2114
2091
  ] })
2115
2092
  ] }) }),
2116
- confirmDeleteFolderId === folder.id ? /* @__PURE__ */ jsxs4("div", { onClick: (e) => e.stopPropagation(), style: { display: "flex", gap: "4px" }, children: [
2117
- /* @__PURE__ */ jsx6(
2118
- "button",
2119
- {
2120
- onClick: () => handleDeleteFolder(folder.id),
2121
- style: { padding: "2px 8px", fontSize: "12px", backgroundColor: "#dc3545", color: "#fff", border: "none", borderRadius: "4px", cursor: "pointer" },
2122
- children: t.delete
2123
- }
2124
- ),
2125
- /* @__PURE__ */ jsx6(
2126
- "button",
2127
- {
2128
- onClick: () => setConfirmDeleteFolderId(null),
2129
- style: { padding: "2px 8px", fontSize: "12px", backgroundColor: "transparent", border: "1px solid var(--default-border-color, #ccc)", borderRadius: "4px", cursor: "pointer", color: "inherit" },
2130
- children: t.cancel
2131
- }
2132
- )
2133
- ] }) : editingFolderId !== folder.id && /* @__PURE__ */ jsxs4("div", { onClick: (e) => e.stopPropagation(), style: { display: "flex", gap: "2px" }, children: [
2093
+ editingFolderId !== folder.id && /* @__PURE__ */ jsxs4("div", { onClick: (e) => e.stopPropagation(), style: { display: "flex", gap: "2px" }, children: [
2134
2094
  /* @__PURE__ */ jsx6(
2135
2095
  "button",
2136
2096
  {
@@ -2165,7 +2125,7 @@ var DrawingsDialog = ({
2165
2125
  folder.id
2166
2126
  );
2167
2127
  };
2168
- return /* @__PURE__ */ jsx6(
2128
+ return /* @__PURE__ */ jsxs4(
2169
2129
  "div",
2170
2130
  {
2171
2131
  className: "rita-workspace-dialog-overlay",
@@ -2184,275 +2144,366 @@ var DrawingsDialog = ({
2184
2144
  onClick: (e) => {
2185
2145
  if (e.target === e.currentTarget) onClose();
2186
2146
  },
2187
- children: /* @__PURE__ */ jsxs4("div", { ref: dialogRef, className: "rita-workspace-dialog", style: dialogStyle, children: [
2188
- /* @__PURE__ */ jsxs4(
2189
- "div",
2190
- {
2191
- onMouseDown: handleMouseDown,
2192
- style: {
2193
- padding: "16px 20px",
2194
- display: "flex",
2195
- alignItems: "center",
2196
- justifyContent: "space-between",
2197
- cursor: "grab",
2198
- userSelect: "none",
2199
- borderBottom: "1px solid var(--default-border-color, #e0e0e0)"
2200
- },
2201
- children: [
2202
- /* @__PURE__ */ jsxs4("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600, display: "flex", alignItems: "center", gap: "8px" }, children: [
2203
- t.dialogTitle,
2147
+ children: [
2148
+ /* @__PURE__ */ jsxs4("div", { ref: dialogRef, className: "rita-workspace-dialog", style: dialogStyle, children: [
2149
+ /* @__PURE__ */ jsxs4(
2150
+ "div",
2151
+ {
2152
+ onMouseDown: handleMouseDown,
2153
+ style: {
2154
+ padding: "16px 20px",
2155
+ display: "flex",
2156
+ alignItems: "center",
2157
+ justifyContent: "space-between",
2158
+ cursor: "grab",
2159
+ userSelect: "none",
2160
+ borderBottom: "1px solid var(--default-border-color, #e0e0e0)"
2161
+ },
2162
+ children: [
2163
+ /* @__PURE__ */ jsxs4("h2", { style: { margin: 0, fontSize: "18px", fontWeight: 600, display: "flex", alignItems: "center", gap: "8px" }, children: [
2164
+ t.dialogTitle,
2165
+ /* @__PURE__ */ jsx6(
2166
+ "span",
2167
+ {
2168
+ style: {
2169
+ fontSize: "10px",
2170
+ fontWeight: 700,
2171
+ letterSpacing: "0.5px",
2172
+ padding: "2px 8px",
2173
+ borderRadius: "10px",
2174
+ backgroundColor: "#fff3cd",
2175
+ color: "#856404",
2176
+ border: "1px solid #ffc107",
2177
+ textTransform: "uppercase"
2178
+ },
2179
+ title: "Beta \u2014 funktionen \xE4r under utveckling och kan \xE4ndras",
2180
+ children: "BETA"
2181
+ }
2182
+ )
2183
+ ] }),
2204
2184
  /* @__PURE__ */ jsx6(
2205
- "span",
2185
+ "button",
2206
2186
  {
2187
+ onClick: onClose,
2207
2188
  style: {
2208
- fontSize: "10px",
2209
- fontWeight: 700,
2210
- letterSpacing: "0.5px",
2211
- padding: "2px 8px",
2212
- borderRadius: "10px",
2213
- backgroundColor: "#fff3cd",
2214
- color: "#856404",
2215
- border: "1px solid #ffc107",
2216
- textTransform: "uppercase"
2189
+ background: "none",
2190
+ border: "none",
2191
+ fontSize: "24px",
2192
+ cursor: "pointer",
2193
+ padding: "4px",
2194
+ lineHeight: 1,
2195
+ color: "inherit"
2217
2196
  },
2218
- title: "Beta \u2014 funktionen \xE4r under utveckling och kan \xE4ndras",
2219
- children: "BETA"
2197
+ "aria-label": t.close,
2198
+ children: "\xD7"
2220
2199
  }
2221
2200
  )
2222
- ] }),
2223
- /* @__PURE__ */ jsx6(
2224
- "button",
2225
- {
2226
- onClick: onClose,
2227
- style: {
2228
- background: "none",
2229
- border: "none",
2230
- fontSize: "24px",
2231
- cursor: "pointer",
2232
- padding: "4px",
2233
- lineHeight: 1,
2234
- color: "inherit"
2235
- },
2236
- "aria-label": t.close,
2237
- children: "\xD7"
2238
- }
2239
- )
2240
- ]
2241
- }
2242
- ),
2243
- /* @__PURE__ */ jsxs4(
2244
- "div",
2245
- {
2246
- style: {
2247
- padding: "8px 20px",
2248
- backgroundColor: "#fff3cd",
2249
- color: "#856404",
2250
- fontSize: "12px",
2251
- borderBottom: "1px solid #ffc107",
2252
- display: "flex",
2253
- alignItems: "center",
2254
- gap: "8px"
2255
- },
2256
- children: [
2257
- /* @__PURE__ */ jsx6("span", { children: "\u26A0\uFE0F" }),
2258
- /* @__PURE__ */ jsxs4("span", { children: [
2259
- /* @__PURE__ */ jsx6("strong", { children: "Beta:" }),
2260
- ' Arbetsyta \xE4r under utveckling. Ta regelbundet backup via "Spara alla ritningar".'
2261
- ] })
2262
- ]
2263
- }
2264
- ),
2265
- drawings.length > 3 && /* @__PURE__ */ jsx6("div", { style: { padding: "8px 20px", borderBottom: "1px solid var(--default-border-color, #e0e0e0)" }, children: /* @__PURE__ */ jsx6(
2266
- "input",
2267
- {
2268
- type: "text",
2269
- value: searchQuery,
2270
- onChange: (e) => setSearchQuery(e.target.value),
2271
- placeholder: "\u{1F50D}",
2272
- style: {
2273
- width: "100%",
2274
- padding: "6px 12px",
2275
- fontSize: "14px",
2276
- border: "1px solid var(--default-border-color, #e0e0e0)",
2277
- borderRadius: "6px",
2278
- outline: "none",
2279
- backgroundColor: "transparent",
2280
- color: "inherit",
2281
- boxSizing: "border-box"
2201
+ ]
2282
2202
  }
2283
- }
2284
- ) }),
2285
- /* @__PURE__ */ jsxs4(
2286
- "div",
2287
- {
2288
- style: { flex: 1, overflow: "auto" },
2289
- onClick: () => setSelectedId(null),
2290
- onDragOver: (e) => {
2291
- if (!draggingDrawingId) return;
2292
- const el = e.currentTarget;
2293
- const rect = el.getBoundingClientRect();
2294
- const margin = 40;
2295
- if (e.clientY - rect.top < margin) {
2296
- el.scrollTop -= 8;
2297
- } else if (rect.bottom - e.clientY < margin) {
2298
- el.scrollTop += 8;
2203
+ ),
2204
+ /* @__PURE__ */ jsxs4(
2205
+ "div",
2206
+ {
2207
+ style: {
2208
+ padding: "8px 20px",
2209
+ backgroundColor: "#fff3cd",
2210
+ color: "#856404",
2211
+ fontSize: "12px",
2212
+ borderBottom: "1px solid #ffc107",
2213
+ display: "flex",
2214
+ alignItems: "center",
2215
+ gap: "8px"
2216
+ },
2217
+ children: [
2218
+ /* @__PURE__ */ jsx6("span", { children: "\u26A0\uFE0F" }),
2219
+ /* @__PURE__ */ jsxs4("span", { children: [
2220
+ /* @__PURE__ */ jsx6("strong", { children: "Beta:" }),
2221
+ ' Arbetsyta \xE4r under utveckling. Ta regelbundet backup via "Spara alla ritningar".'
2222
+ ] })
2223
+ ]
2224
+ }
2225
+ ),
2226
+ drawings.length > 3 && /* @__PURE__ */ jsx6("div", { style: { padding: "8px 20px", borderBottom: "1px solid var(--default-border-color, #e0e0e0)" }, children: /* @__PURE__ */ jsx6(
2227
+ "input",
2228
+ {
2229
+ type: "text",
2230
+ value: searchQuery,
2231
+ onChange: (e) => setSearchQuery(e.target.value),
2232
+ placeholder: "\u{1F50D}",
2233
+ style: {
2234
+ width: "100%",
2235
+ padding: "6px 12px",
2236
+ fontSize: "14px",
2237
+ border: "1px solid var(--default-border-color, #e0e0e0)",
2238
+ borderRadius: "6px",
2239
+ outline: "none",
2240
+ backgroundColor: "transparent",
2241
+ color: "inherit",
2242
+ boxSizing: "border-box"
2299
2243
  }
2300
- },
2301
- children: [
2302
- 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: [
2303
- filteredFolders.map(renderFolderGroup),
2304
- draggingDrawingId && folders.length > 0 && /* @__PURE__ */ jsx6(
2305
- "div",
2306
- {
2307
- onDragOver: (e) => {
2308
- e.preventDefault();
2309
- e.dataTransfer.dropEffect = "move";
2310
- setDropTargetFolderId("__root__");
2311
- },
2312
- onDragLeave: () => {
2313
- if (dropTargetFolderId === "__root__") setDropTargetFolderId(null);
2314
- },
2315
- onDrop: (e) => {
2316
- e.preventDefault();
2317
- if (draggingDrawingId) {
2318
- handleMoveToFolder(draggingDrawingId, null);
2319
- setDraggingDrawingId(null);
2320
- setDropTargetFolderId(null);
2321
- }
2322
- },
2323
- style: {
2324
- padding: "8px 12px",
2325
- marginBottom: "4px",
2326
- borderRadius: "8px",
2327
- textAlign: "center",
2328
- fontSize: "12px",
2329
- color: "var(--text-secondary-color, #888)",
2330
- backgroundColor: dropTargetFolderId === "__root__" ? "var(--color-primary-light, rgba(108, 99, 255, 0.2))" : "transparent",
2331
- border: "2px dashed var(--default-border-color, #ccc)",
2332
- borderColor: dropTargetFolderId === "__root__" ? "var(--color-primary, #6c63ff)" : "var(--default-border-color, #ccc)",
2333
- transition: "background-color 0.15s, border-color 0.15s"
2334
- },
2335
- children: t.moveToRoot
2336
- }
2337
- ),
2338
- rootDrawings.map(renderDrawingRow)
2339
- ] }) : /* @__PURE__ */ jsxs4("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: [
2340
- /* @__PURE__ */ jsx6("p", { children: t.noDrawingsYet }),
2341
- /* @__PURE__ */ jsx6("p", { children: t.clickNewToStart })
2342
- ] }),
2343
- /* @__PURE__ */ jsx6("div", { style: sectionHeaderStyle, children: t.sectionDrawings }),
2344
- /* @__PURE__ */ jsxs4("div", { style: { padding: "0 20px", display: "flex", flexDirection: "column", gap: "8px" }, children: [
2345
- /* @__PURE__ */ jsx6(
2346
- ActionButton,
2347
- {
2348
- icon: "\u{1F4C4}",
2349
- label: t.createNewDrawing,
2350
- description: t.createNewDrawingDesc,
2351
- onClick: () => handleCreate()
2352
- }
2353
- ),
2354
- /* @__PURE__ */ jsx6(
2355
- ActionButton,
2356
- {
2357
- icon: "\u{1F4C2}",
2358
- label: t.openFromFile,
2359
- description: t.openFromFileDesc,
2360
- onClick: importExcalidrawFile
2361
- }
2362
- ),
2363
- creatingFolder ? /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "8px", alignItems: "center", padding: "4px 0" }, children: [
2364
- /* @__PURE__ */ jsx6(
2365
- "input",
2244
+ }
2245
+ ) }),
2246
+ /* @__PURE__ */ jsxs4(
2247
+ "div",
2248
+ {
2249
+ style: { flex: 1, overflow: "auto" },
2250
+ onClick: () => setSelectedId(null),
2251
+ onDragOver: (e) => {
2252
+ if (!draggingDrawingId) return;
2253
+ const el = e.currentTarget;
2254
+ const rect = el.getBoundingClientRect();
2255
+ const margin = 40;
2256
+ if (e.clientY - rect.top < margin) {
2257
+ el.scrollTop -= 8;
2258
+ } else if (rect.bottom - e.clientY < margin) {
2259
+ el.scrollTop += 8;
2260
+ }
2261
+ },
2262
+ children: [
2263
+ 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: [
2264
+ filteredFolders.map(renderFolderGroup),
2265
+ draggingDrawingId && folders.length > 0 && /* @__PURE__ */ jsx6(
2266
+ "div",
2366
2267
  {
2367
- ref: newFolderInputRef,
2368
- type: "text",
2369
- value: newFolderName,
2370
- onChange: (e) => setNewFolderName(e.target.value),
2371
- onKeyDown: (e) => {
2372
- if (e.key === "Enter") handleCreateFolder();
2373
- if (e.key === "Escape") {
2374
- setCreatingFolder(false);
2375
- setNewFolderName("");
2268
+ onDragOver: (e) => {
2269
+ e.preventDefault();
2270
+ e.dataTransfer.dropEffect = "move";
2271
+ setDropTargetFolderId("__root__");
2272
+ },
2273
+ onDragLeave: () => {
2274
+ if (dropTargetFolderId === "__root__") setDropTargetFolderId(null);
2275
+ },
2276
+ onDrop: (e) => {
2277
+ e.preventDefault();
2278
+ if (draggingDrawingId) {
2279
+ handleMoveToFolder(draggingDrawingId, null);
2280
+ setDraggingDrawingId(null);
2281
+ setDropTargetFolderId(null);
2376
2282
  }
2377
2283
  },
2378
- placeholder: t.newFolderName,
2379
2284
  style: {
2380
- flex: 1,
2381
2285
  padding: "8px 12px",
2382
- fontSize: "14px",
2383
- border: "1px solid var(--color-primary, #6c63ff)",
2286
+ marginBottom: "4px",
2384
2287
  borderRadius: "8px",
2385
- outline: "none"
2288
+ textAlign: "center",
2289
+ fontSize: "12px",
2290
+ color: "var(--text-secondary-color, #888)",
2291
+ backgroundColor: dropTargetFolderId === "__root__" ? "var(--color-primary-light, rgba(108, 99, 255, 0.2))" : "transparent",
2292
+ border: "2px dashed var(--default-border-color, #ccc)",
2293
+ borderColor: dropTargetFolderId === "__root__" ? "var(--color-primary, #6c63ff)" : "var(--default-border-color, #ccc)",
2294
+ transition: "background-color 0.15s, border-color 0.15s"
2295
+ },
2296
+ children: t.moveToRoot
2297
+ }
2298
+ ),
2299
+ rootDrawings.map(renderDrawingRow)
2300
+ ] }) : /* @__PURE__ */ jsxs4("div", { style: { padding: "24px 20px", textAlign: "center", color: "var(--text-secondary-color, #666)" }, children: [
2301
+ /* @__PURE__ */ jsx6("p", { children: t.noDrawingsYet }),
2302
+ /* @__PURE__ */ jsx6("p", { children: t.clickNewToStart })
2303
+ ] }),
2304
+ /* @__PURE__ */ jsx6("div", { style: sectionHeaderStyle, children: t.sectionDrawings }),
2305
+ /* @__PURE__ */ jsxs4("div", { style: { padding: "0 20px", display: "flex", flexDirection: "column", gap: "8px" }, children: [
2306
+ /* @__PURE__ */ jsx6(
2307
+ ActionButton,
2308
+ {
2309
+ icon: "\u{1F4C4}",
2310
+ label: t.createNewDrawing,
2311
+ description: t.createNewDrawingDesc,
2312
+ onClick: () => handleCreate()
2313
+ }
2314
+ ),
2315
+ /* @__PURE__ */ jsx6(
2316
+ ActionButton,
2317
+ {
2318
+ icon: "\u{1F4C2}",
2319
+ label: t.openFromFile,
2320
+ description: t.openFromFileDesc,
2321
+ onClick: importExcalidrawFile
2322
+ }
2323
+ ),
2324
+ creatingFolder ? /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "8px", alignItems: "center", padding: "4px 0" }, children: [
2325
+ /* @__PURE__ */ jsx6(
2326
+ "input",
2327
+ {
2328
+ ref: newFolderInputRef,
2329
+ type: "text",
2330
+ value: newFolderName,
2331
+ onChange: (e) => setNewFolderName(e.target.value),
2332
+ onKeyDown: (e) => {
2333
+ if (e.key === "Enter") handleCreateFolder();
2334
+ if (e.key === "Escape") {
2335
+ setCreatingFolder(false);
2336
+ setNewFolderName("");
2337
+ }
2338
+ },
2339
+ placeholder: t.newFolderName,
2340
+ style: {
2341
+ flex: 1,
2342
+ padding: "8px 12px",
2343
+ fontSize: "14px",
2344
+ border: "1px solid var(--color-primary, #6c63ff)",
2345
+ borderRadius: "8px",
2346
+ outline: "none"
2347
+ }
2348
+ }
2349
+ ),
2350
+ /* @__PURE__ */ jsx6(
2351
+ "button",
2352
+ {
2353
+ onClick: handleCreateFolder,
2354
+ style: { padding: "8px 16px", fontSize: "14px", backgroundColor: "var(--color-primary, #6c63ff)", color: "#fff", border: "none", borderRadius: "8px", cursor: "pointer" },
2355
+ children: t.save
2356
+ }
2357
+ ),
2358
+ /* @__PURE__ */ jsx6(
2359
+ "button",
2360
+ {
2361
+ onClick: () => {
2362
+ setCreatingFolder(false);
2363
+ setNewFolderName("");
2364
+ },
2365
+ style: { padding: "8px 16px", fontSize: "14px", backgroundColor: "transparent", border: "1px solid var(--default-border-color, #ccc)", borderRadius: "8px", cursor: "pointer", color: "inherit" },
2366
+ children: t.cancel
2367
+ }
2368
+ )
2369
+ ] }) : /* @__PURE__ */ jsx6(
2370
+ ActionButton,
2371
+ {
2372
+ icon: "\u{1F4C1}",
2373
+ label: t.createFolder,
2374
+ description: "",
2375
+ onClick: () => setCreatingFolder(true)
2376
+ }
2377
+ )
2378
+ ] }),
2379
+ /* @__PURE__ */ jsx6("div", { style: sectionHeaderStyle, children: t.sectionWorkspace }),
2380
+ daysSinceBackup !== null && daysSinceBackup >= 7 && /* @__PURE__ */ jsx6("div", { style: { padding: "0 20px 8px", fontSize: "12px", color: "var(--text-secondary-color, #888)" }, children: daysSinceBackup >= 30 ? `\u26A0\uFE0F ${t.backupReminder || "Ingen backup p\xE5"} ${daysSinceBackup} ${t.days || "dagar"}` : `${t.backupReminder || "Senaste backup:"} ${daysSinceBackup} ${t.days || "dagar sedan"}` }),
2381
+ /* @__PURE__ */ jsxs4("div", { style: { padding: "0 20px 16px", display: "flex", gap: "8px" }, children: [
2382
+ /* @__PURE__ */ jsx6(
2383
+ ActionButton,
2384
+ {
2385
+ icon: "\u{1F4BE}",
2386
+ label: t.saveAllBackup,
2387
+ description: t.saveAllBackupDesc,
2388
+ onClick: () => {
2389
+ localStorage.setItem("rita-workspace-last-backup", Date.now().toString());
2390
+ exportWorkspace();
2386
2391
  }
2387
2392
  }
2388
2393
  ),
2389
2394
  /* @__PURE__ */ jsx6(
2390
- "button",
2395
+ ActionButton,
2391
2396
  {
2392
- onClick: handleCreateFolder,
2393
- style: { padding: "8px 16px", fontSize: "14px", backgroundColor: "var(--color-primary, #6c63ff)", color: "#fff", border: "none", borderRadius: "8px", cursor: "pointer" },
2394
- children: t.save
2397
+ icon: "\u{1F4E6}",
2398
+ label: "Exportera alla som .excalidraw",
2399
+ description: "Laddar ner varje ritning som separat fil",
2400
+ onClick: exportAllDrawingsAsExcalidraw
2395
2401
  }
2396
2402
  ),
2403
+ /* @__PURE__ */ jsx6(
2404
+ ActionButton,
2405
+ {
2406
+ icon: "\u{1F4E5}",
2407
+ label: t.loadBackup,
2408
+ description: t.loadBackupDesc,
2409
+ onClick: importWorkspace
2410
+ }
2411
+ )
2412
+ ] })
2413
+ ]
2414
+ }
2415
+ )
2416
+ ] }),
2417
+ (confirmDeleteId || confirmDeleteFolderId) && (() => {
2418
+ const isFolder = !!confirmDeleteFolderId;
2419
+ const targetName = isFolder ? folders.find((f) => f.id === confirmDeleteFolderId)?.name : drawings.find((d) => d.id === confirmDeleteId)?.name;
2420
+ const onConfirm = () => {
2421
+ if (isFolder && confirmDeleteFolderId) handleDeleteFolder(confirmDeleteFolderId);
2422
+ else if (confirmDeleteId) handleDelete(confirmDeleteId);
2423
+ };
2424
+ const onCancel = () => {
2425
+ setConfirmDeleteId(null);
2426
+ setConfirmDeleteFolderId(null);
2427
+ };
2428
+ return /* @__PURE__ */ jsx6(
2429
+ "div",
2430
+ {
2431
+ onClick: (e) => {
2432
+ if (e.target === e.currentTarget) onCancel();
2433
+ },
2434
+ onKeyDown: (e) => {
2435
+ if (e.key === "Escape") onCancel();
2436
+ },
2437
+ style: {
2438
+ position: "fixed",
2439
+ top: 0,
2440
+ left: 0,
2441
+ right: 0,
2442
+ bottom: 0,
2443
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
2444
+ display: "flex",
2445
+ alignItems: "center",
2446
+ justifyContent: "center",
2447
+ zIndex: 1e4
2448
+ },
2449
+ children: /* @__PURE__ */ jsxs4("div", { style: {
2450
+ backgroundColor: "var(--island-bg-color, #fff)",
2451
+ color: "var(--text-primary-color, #1b1b1f)",
2452
+ borderRadius: "12px",
2453
+ padding: "24px",
2454
+ minWidth: "320px",
2455
+ maxWidth: "420px",
2456
+ boxShadow: "0 12px 32px rgba(0, 0, 0, 0.25)"
2457
+ }, children: [
2458
+ /* @__PURE__ */ jsx6("h3", { style: { margin: "0 0 12px", fontSize: "16px", fontWeight: 600 }, children: isFolder ? t.deleteFolder : t.delete }),
2459
+ /* @__PURE__ */ jsxs4("p", { style: { margin: "0 0 20px", fontSize: "14px", lineHeight: 1.5, color: "var(--text-secondary-color, #666)" }, children: [
2460
+ isFolder ? t.deleteFolderConfirm : t.confirmDelete,
2461
+ targetName && /* @__PURE__ */ jsxs4(Fragment3, { children: [
2462
+ " ",
2463
+ /* @__PURE__ */ jsx6("strong", { style: { color: "var(--text-primary-color, #1b1b1f)" }, children: targetName }),
2464
+ "?"
2465
+ ] })
2466
+ ] }),
2467
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" }, children: [
2397
2468
  /* @__PURE__ */ jsx6(
2398
2469
  "button",
2399
2470
  {
2400
- onClick: () => {
2401
- setCreatingFolder(false);
2402
- setNewFolderName("");
2471
+ onClick: onCancel,
2472
+ autoFocus: true,
2473
+ style: {
2474
+ padding: "8px 16px",
2475
+ fontSize: "14px",
2476
+ backgroundColor: "transparent",
2477
+ border: "1px solid var(--default-border-color, #ccc)",
2478
+ borderRadius: "6px",
2479
+ cursor: "pointer",
2480
+ color: "inherit"
2403
2481
  },
2404
- style: { padding: "8px 16px", fontSize: "14px", backgroundColor: "transparent", border: "1px solid var(--default-border-color, #ccc)", borderRadius: "8px", cursor: "pointer", color: "inherit" },
2405
2482
  children: t.cancel
2406
2483
  }
2407
- )
2408
- ] }) : /* @__PURE__ */ jsx6(
2409
- ActionButton,
2410
- {
2411
- icon: "\u{1F4C1}",
2412
- label: t.createFolder,
2413
- description: "",
2414
- onClick: () => setCreatingFolder(true)
2415
- }
2416
- )
2417
- ] }),
2418
- /* @__PURE__ */ jsx6("div", { style: sectionHeaderStyle, children: t.sectionWorkspace }),
2419
- daysSinceBackup !== null && daysSinceBackup >= 7 && /* @__PURE__ */ jsx6("div", { style: { padding: "0 20px 8px", fontSize: "12px", color: "var(--text-secondary-color, #888)" }, children: daysSinceBackup >= 30 ? `\u26A0\uFE0F ${t.backupReminder || "Ingen backup p\xE5"} ${daysSinceBackup} ${t.days || "dagar"}` : `${t.backupReminder || "Senaste backup:"} ${daysSinceBackup} ${t.days || "dagar sedan"}` }),
2420
- /* @__PURE__ */ jsxs4("div", { style: { padding: "0 20px 16px", display: "flex", gap: "8px" }, children: [
2421
- /* @__PURE__ */ jsx6(
2422
- ActionButton,
2423
- {
2424
- icon: "\u{1F4BE}",
2425
- label: t.saveAllBackup,
2426
- description: t.saveAllBackupDesc,
2427
- onClick: () => {
2428
- localStorage.setItem("rita-workspace-last-backup", Date.now().toString());
2429
- exportWorkspace();
2484
+ ),
2485
+ /* @__PURE__ */ jsx6(
2486
+ "button",
2487
+ {
2488
+ onClick: onConfirm,
2489
+ style: {
2490
+ padding: "8px 16px",
2491
+ fontSize: "14px",
2492
+ backgroundColor: "#dc3545",
2493
+ color: "#fff",
2494
+ border: "none",
2495
+ borderRadius: "6px",
2496
+ cursor: "pointer"
2497
+ },
2498
+ children: t.delete
2430
2499
  }
2431
- }
2432
- ),
2433
- /* @__PURE__ */ jsx6(
2434
- ActionButton,
2435
- {
2436
- icon: "\u{1F4E6}",
2437
- label: "Exportera alla som .excalidraw",
2438
- description: "Laddar ner varje ritning som separat fil",
2439
- onClick: exportAllDrawingsAsExcalidraw
2440
- }
2441
- ),
2442
- /* @__PURE__ */ jsx6(
2443
- ActionButton,
2444
- {
2445
- icon: "\u{1F4E5}",
2446
- label: t.loadBackup,
2447
- description: t.loadBackupDesc,
2448
- onClick: importWorkspace
2449
- }
2450
- )
2500
+ )
2501
+ ] })
2451
2502
  ] })
2452
- ]
2453
- }
2454
- )
2455
- ] })
2503
+ }
2504
+ );
2505
+ })()
2506
+ ]
2456
2507
  }
2457
2508
  );
2458
2509
  };