@fde-desktop/fde-core 0.3.7 → 0.4.1

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 (163) hide show
  1. package/README.md +419 -68
  2. package/dist/CalendarApp-CHLUCAI7.css +744 -0
  3. package/dist/CalendarApp-K7ZOUZ6C.js +2 -0
  4. package/dist/CalendarApp-OTGEERSS.cjs +8 -0
  5. package/dist/CodeServerApp-5KZGO7HL.css +75 -0
  6. package/dist/CodeServerApp-LUZFCQBI.js +3 -0
  7. package/dist/CodeServerApp-P3TMJPLY.cjs +9 -0
  8. package/dist/CreateItemApp-NAZMXOPK.cjs +14 -0
  9. package/dist/CreateItemApp-PQB5GTFG.css +107 -0
  10. package/dist/CreateItemApp-ZHCTSPQE.js +8 -0
  11. package/dist/DeviceInfoApp-R6YNVIGX.cjs +11 -0
  12. package/dist/DeviceInfoApp-YHCYAO6N.js +5 -0
  13. package/dist/DeviceInfoApp-ZSMRSITP.css +7 -0
  14. package/dist/FilesApp-AKCVRTXR.js +8 -0
  15. package/dist/FilesApp-E6L5W3T2.css +1817 -0
  16. package/dist/FilesApp-RW3Y6ILO.cjs +14 -0
  17. package/dist/ImageViewerApp-5UXNSW2O.js +11 -0
  18. package/dist/ImageViewerApp-N2Q7E7WZ.css +215 -0
  19. package/dist/ImageViewerApp-RRRRKSFN.cjs +17 -0
  20. package/dist/ImageViewerMenuBar-I3TFKQPS.cjs +14 -0
  21. package/dist/ImageViewerMenuBar-TV5C6TM2.js +5 -0
  22. package/dist/ImageViewerMenuBar-XLK4LIHW.css +56 -0
  23. package/dist/MenuEditApp-HUZRFEHE.js +9 -0
  24. package/dist/MenuEditApp-MCUHGTKQ.cjs +15 -0
  25. package/dist/MenuEditApp-YA6HSAMJ.css +94 -0
  26. package/dist/MenuEditMenuBar-7VHMZNRM.css +56 -0
  27. package/dist/MenuEditMenuBar-GF6L4PGZ.cjs +15 -0
  28. package/dist/MenuEditMenuBar-IUXFPZE5.js +6 -0
  29. package/dist/NotesApp-37BV33C6.js +10 -0
  30. package/dist/NotesApp-4EVUQEFZ.cjs +16 -0
  31. package/dist/NotesApp-TQ6IHDNX.css +302 -0
  32. package/dist/NotesMenuBar-25LKN3SE.cjs +15 -0
  33. package/dist/NotesMenuBar-MXLOX7OT.css +56 -0
  34. package/dist/NotesMenuBar-SRV3AIAL.js +6 -0
  35. package/dist/PdfApp-5VBDNRMC.cjs +16 -0
  36. package/dist/PdfApp-BUIC5U5H.css +206 -0
  37. package/dist/PdfApp-RH6MZZX5.js +10 -0
  38. package/dist/PdfMenuBar-NLZC6JHS.js +4 -0
  39. package/dist/PdfMenuBar-QUM72EE4.css +56 -0
  40. package/dist/PdfMenuBar-WBRTKMLN.cjs +13 -0
  41. package/dist/SettingsApp-5LDHEHYV.cjs +20 -0
  42. package/dist/SettingsApp-JVOSEFH3.css +283 -0
  43. package/dist/SettingsApp-X6764D7T.js +14 -0
  44. package/dist/SettingsMenuBar-5CBSSMVM.css +56 -0
  45. package/dist/SettingsMenuBar-VLT6TTCM.js +6 -0
  46. package/dist/SettingsMenuBar-Y5QEXDEO.cjs +15 -0
  47. package/dist/StorybookApp-NQ244BER.css +7 -0
  48. package/dist/StorybookApp-NZDV4X3Y.js +1 -0
  49. package/dist/StorybookApp-VF3KIMU3.cjs +7 -0
  50. package/dist/TerminalApp-CDGWRBFJ.cjs +10 -0
  51. package/dist/TerminalApp-EAATMIMX.css +77 -0
  52. package/dist/TerminalApp-GCKJCM55.js +4 -0
  53. package/dist/TerminalMenuBar-3J26O26Q.css +56 -0
  54. package/dist/TerminalMenuBar-7BH7MGNJ.cjs +14 -0
  55. package/dist/TerminalMenuBar-7JAEQUZ4.js +5 -0
  56. package/dist/UploaderApp-2WYRCUQV.js +10 -0
  57. package/dist/UploaderApp-6KV3TGCT.css +1817 -0
  58. package/dist/UploaderApp-EYFC36PM.cjs +16 -0
  59. package/dist/chunk-2FO445RM.cjs +449 -0
  60. package/dist/chunk-2PSTHGTD.cjs +42 -0
  61. package/dist/chunk-2RQX7QBP.cjs +148 -0
  62. package/dist/chunk-3IICBLEA.js +442 -0
  63. package/dist/chunk-43W6UDUZ.cjs +19 -0
  64. package/dist/chunk-4E45FBAH.js +223 -0
  65. package/dist/chunk-4MCFQPKY.js +444 -0
  66. package/dist/chunk-4OH5RPSQ.cjs +38 -0
  67. package/dist/chunk-4XURSNM4.js +43 -0
  68. package/dist/chunk-4ZCRYHL6.js +407 -0
  69. package/dist/chunk-54PYEQLK.js +283 -0
  70. package/dist/chunk-5C6IQE42.cjs +35 -0
  71. package/dist/chunk-5NOHYJNH.js +84 -0
  72. package/dist/chunk-5PYK5ASL.js +162 -0
  73. package/dist/chunk-5YH6AKEO.js +146 -0
  74. package/dist/chunk-657BJOY5.cjs +324 -0
  75. package/dist/chunk-6QOUYSEE.cjs +2303 -0
  76. package/dist/chunk-7SAFECOJ.js +215 -0
  77. package/dist/chunk-7Y7HB7FB.cjs +53 -0
  78. package/dist/chunk-ABIAPZ6S.cjs +45 -0
  79. package/dist/chunk-AQL372JF.cjs +219 -0
  80. package/dist/chunk-AXDUVZVP.cjs +88 -0
  81. package/dist/chunk-AYFNYHMP.js +541 -0
  82. package/dist/chunk-BDO6B7MZ.cjs +451 -0
  83. package/dist/chunk-BKXEA2BK.cjs +286 -0
  84. package/dist/chunk-BLV47DX2.js +47 -0
  85. package/dist/chunk-BQCD5RAF.cjs +48 -0
  86. package/dist/chunk-BQL3YXMV.js +17429 -0
  87. package/dist/chunk-C6BEZNAM.cjs +45 -0
  88. package/dist/chunk-CFWV2JMR.js +234 -0
  89. package/dist/chunk-CV5PUHAE.cjs +86 -0
  90. package/dist/chunk-D5MVFFID.js +42 -0
  91. package/dist/chunk-D7R55WWT.js +1601 -0
  92. package/dist/chunk-DMNF4CNN.cjs +49 -0
  93. package/dist/chunk-DWP2SYF7.js +55 -0
  94. package/dist/chunk-E55VXNLK.cjs +17498 -0
  95. package/dist/chunk-EAELL43F.js +42 -0
  96. package/dist/chunk-EUQLZW6P.js +48 -0
  97. package/dist/chunk-EX5V2ZTU.js +40 -0
  98. package/dist/chunk-FH4ILMKF.js +38 -0
  99. package/dist/chunk-FRHBM2U7.js +33 -0
  100. package/dist/chunk-FX2TPX3L.cjs +45 -0
  101. package/dist/chunk-GCYD6T52.js +32 -0
  102. package/dist/chunk-GRYCUBJZ.js +9 -0
  103. package/dist/chunk-HWHBSAUC.js +40 -0
  104. package/dist/chunk-ICUE6T7J.cjs +50 -0
  105. package/dist/chunk-IDHP3R4I.js +31 -0
  106. package/dist/chunk-IUOQPOEN.js +2293 -0
  107. package/dist/chunk-J7L2S2GT.cjs +34 -0
  108. package/dist/chunk-JEBKLIMU.cjs +123 -0
  109. package/dist/chunk-KQHICFX3.js +121 -0
  110. package/dist/chunk-LMJE6V4N.cjs +42 -0
  111. package/dist/chunk-MVDGM5Y4.js +68 -0
  112. package/dist/chunk-NVEGEK3N.js +31 -0
  113. package/dist/chunk-NWMSWRUD.js +2236 -0
  114. package/dist/chunk-ODXL6BR3.js +77 -0
  115. package/dist/chunk-OJIDKDKF.js +68 -0
  116. package/dist/chunk-PKPQA5NR.js +15 -0
  117. package/dist/chunk-PNDBLFJW.cjs +50 -0
  118. package/dist/chunk-PYTKNRGM.js +280 -0
  119. package/dist/chunk-Q3WA72BF.cjs +70 -0
  120. package/dist/chunk-QB72BLCJ.cjs +237 -0
  121. package/dist/chunk-QHBBLML3.js +86 -0
  122. package/dist/chunk-RDIDAZ3S.cjs +9 -0
  123. package/dist/chunk-RGJPRXYY.js +48 -0
  124. package/dist/chunk-RQ6OZRUW.cjs +41 -0
  125. package/dist/chunk-SBE4SZAN.cjs +226 -0
  126. package/dist/chunk-SYGUWGWK.cjs +2329 -0
  127. package/dist/chunk-TDZ43MUX.cjs +165 -0
  128. package/dist/chunk-TGWMOHAO.js +17 -0
  129. package/dist/chunk-U4RYIS6Z.cjs +548 -0
  130. package/dist/chunk-UIQCTAVM.cjs +59 -0
  131. package/dist/chunk-XVASHRCE.cjs +70 -0
  132. package/dist/chunk-XYSMVQQD.cjs +1608 -0
  133. package/dist/chunk-YAIWI4Z5.js +7 -0
  134. package/dist/chunk-YP2PLNOF.cjs +34 -0
  135. package/dist/chunk-YSOLW4FS.cjs +11 -0
  136. package/dist/chunk-YY6OUR2U.js +44 -0
  137. package/dist/chunk-YZWS7FDT.cjs +409 -0
  138. package/dist/chunk-Z5YGWL65.cjs +39 -0
  139. package/dist/chunk-ZBGWYTCU.cjs +83 -0
  140. package/dist/chunk-ZHB5Q2M6.js +36 -0
  141. package/dist/chunk-ZHNDXNL4.js +45 -0
  142. package/dist/chunk-ZX3EDZ5C.cjs +17 -0
  143. package/dist/index.cjs +5641 -0
  144. package/dist/index.css +9192 -0
  145. package/dist/index.d.cts +2019 -0
  146. package/dist/index.d.ts +2019 -11
  147. package/dist/index.js +4794 -6598
  148. package/package.json +26 -14
  149. package/dist/apps/index.d.ts +0 -2
  150. package/dist/components/index.d.ts +0 -1
  151. package/dist/constants/index.d.ts +0 -12
  152. package/dist/domain/index.d.ts +0 -5
  153. package/dist/fc-D_a-n3yF.js +0 -20204
  154. package/dist/fi-DwZ_MW7F.js +0 -9993
  155. package/dist/hooks/index.d.ts +0 -28
  156. package/dist/i18n/index.d.ts +0 -2
  157. package/dist/iconBase-B764UN-4.js +0 -108
  158. package/dist/infrastructure/index.d.ts +0 -6
  159. package/dist/interfaces/index.d.ts +0 -11
  160. package/dist/stores/index.d.ts +0 -8
  161. package/dist/types/index.d.ts +0 -4
  162. package/dist/utils/index.d.ts +0 -14
  163. package/dist/vsc-CeA30gcb.js +0 -9574
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var chunkSBE4SZAN_cjs = require('./chunk-SBE4SZAN.cjs');
4
+ var react = require('react');
5
+ var reactI18next = require('react-i18next');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ var usePdfMenuBarElements = (options) => {
9
+ const { contentData, onExit } = options;
10
+ const { t } = reactI18next.useTranslation("common");
11
+ const setPickerOpen = contentData?.setPickerOpen;
12
+ return react.useMemo(() => {
13
+ return [
14
+ {
15
+ type: "menu",
16
+ label: t("menu.file"),
17
+ items: [
18
+ {
19
+ type: "item",
20
+ label: t("actions.open"),
21
+ icon: "FcOpenedFolder",
22
+ onClick: () => setPickerOpen?.()
23
+ },
24
+ { type: "divider" },
25
+ {
26
+ type: "item",
27
+ label: t("actions.exit"),
28
+ icon: "FcLeft",
29
+ onClick: onExit
30
+ }
31
+ ]
32
+ }
33
+ ];
34
+ }, [t, setPickerOpen, onExit]);
35
+ };
36
+ var PdfMenuBar = react.memo(({ windowId, contentData, onExit }) => {
37
+ const elements = usePdfMenuBarElements({
38
+ contentData,
39
+ onExit
40
+ });
41
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkSBE4SZAN_cjs.AppMenuBar_default, { elements });
42
+ });
43
+ PdfMenuBar.displayName = "PdfMenuBar";
44
+
45
+ exports.PdfMenuBar = PdfMenuBar;
@@ -0,0 +1,234 @@
1
+ import { useOpenApp } from './chunk-PYTKNRGM.js';
2
+ import { DownloadProgress_default } from './chunk-HWHBSAUC.js';
3
+ import { FolderPickerModal } from './chunk-4MCFQPKY.js';
4
+ import { useDesktopStore, fileSystem, getAppIdForMime } from './chunk-NWMSWRUD.js';
5
+ import { useFcIconElement } from './chunk-YY6OUR2U.js';
6
+ import { Paper, Box, Text, Group, Button, Stepper, FileButton } from './chunk-BQL3YXMV.js';
7
+ import { useState, useCallback } from 'react';
8
+ import { useTranslation } from 'react-i18next';
9
+ import { jsx, jsxs } from 'react/jsx-runtime';
10
+
11
+ // src/utils/formatBytes.ts
12
+ function formatBytes(bytes) {
13
+ if (bytes === 0) return "0 B";
14
+ const k = 1024;
15
+ const sizes = ["B", "KB", "MB", "GB", "TB"];
16
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
17
+ const index = Math.min(i, sizes.length - 1);
18
+ return `${parseFloat((bytes / Math.pow(k, index)).toFixed(1))} ${sizes[index]}`;
19
+ }
20
+
21
+ // src/components/Apps/UploaderApp/UploaderApp.module.css
22
+ var UploaderApp_default = {};
23
+ var UploaderApp = ({ window: win }) => {
24
+ const { t } = useTranslation("apps");
25
+ const createFile = useDesktopStore((state) => state.createFile);
26
+ const openApp = useOpenApp();
27
+ const [activeStep, setActiveStep] = useState(0);
28
+ const [file, setFile] = useState(null);
29
+ const [selectedFolderId, setSelectedFolderId] = useState(null);
30
+ const [folderSelected, setFolderSelected] = useState(false);
31
+ const [pickerOpen, setPickerOpen] = useState(false);
32
+ const [uploadStarted, setUploadStarted] = useState(false);
33
+ const [uploadState, setUploadState] = useState({
34
+ status: "idle",
35
+ progress: { status: "idle", loaded: 0, total: null, percent: null, error: null }
36
+ });
37
+ const [createdFileId, setCreatedFileId] = useState(null);
38
+ const uploadIcon = useFcIconElement("FcUpload", { size: 120 });
39
+ const checkIconLg = useFcIconElement("FcCheckmark", { size: 64 });
40
+ const checkIconSm = useFcIconElement("FcCheckmark", { size: 14 });
41
+ const infoIcon = useFcIconElement("FcInfo", { size: 64 });
42
+ const handleFileChange = useCallback((selectedFile) => {
43
+ if (selectedFile) {
44
+ setFile(selectedFile);
45
+ setActiveStep(1);
46
+ }
47
+ }, []);
48
+ const handleFolderSelect = useCallback((folderId) => {
49
+ setSelectedFolderId(folderId);
50
+ setFolderSelected(true);
51
+ setPickerOpen(false);
52
+ setActiveStep(2);
53
+ }, []);
54
+ const handleUpload = useCallback(async () => {
55
+ if (!file) return;
56
+ console.log("[UploaderApp] Starting upload for file:", file.name, "size:", file.size);
57
+ setUploadStarted(true);
58
+ setUploadState({
59
+ status: "reading",
60
+ progress: { status: "downloading", loaded: 0, total: file.size, percent: 0, error: null }
61
+ });
62
+ try {
63
+ setUploadState((prev) => ({
64
+ ...prev,
65
+ progress: {
66
+ status: "downloading",
67
+ loaded: 0,
68
+ total: file.size,
69
+ percent: 0,
70
+ error: null
71
+ }
72
+ }));
73
+ for (let i = 0; i <= 50; i += 10) {
74
+ await new Promise((resolve) => setTimeout(resolve, 50));
75
+ setUploadState((prev) => ({
76
+ ...prev,
77
+ progress: {
78
+ status: "downloading",
79
+ loaded: Math.floor(file.size * i / 100),
80
+ total: file.size,
81
+ percent: i,
82
+ error: null
83
+ }
84
+ }));
85
+ }
86
+ console.log("[UploaderApp] Calling saveBlob...");
87
+ const saveBlobStart = Date.now();
88
+ const idbUrl = await fileSystem.saveBlob(file);
89
+ console.log(
90
+ "[UploaderApp] saveBlob completed in",
91
+ Date.now() - saveBlobStart,
92
+ "ms, url:",
93
+ idbUrl
94
+ );
95
+ setUploadState((prev) => ({
96
+ ...prev,
97
+ progress: {
98
+ status: "downloading",
99
+ loaded: Math.floor(file.size * 80 / 100),
100
+ total: file.size,
101
+ percent: 80,
102
+ error: null
103
+ }
104
+ }));
105
+ console.log("[UploaderApp] Calling createFile with folderId:", selectedFolderId);
106
+ const createStart = Date.now();
107
+ const createdFile = await createFile(file.name, "", selectedFolderId, idbUrl);
108
+ console.log(
109
+ "[UploaderApp] createFile completed in",
110
+ Date.now() - createStart,
111
+ "ms, id:",
112
+ createdFile.id
113
+ );
114
+ setCreatedFileId(createdFile.id);
115
+ setUploadState({
116
+ status: "done",
117
+ progress: {
118
+ status: "done",
119
+ loaded: file.size,
120
+ total: file.size,
121
+ percent: 100,
122
+ error: null
123
+ }
124
+ });
125
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
126
+ setActiveStep(3);
127
+ } catch (err) {
128
+ console.error("[UploaderApp] Upload FAILED:", err);
129
+ setUploadState((prev) => ({
130
+ ...prev,
131
+ status: "error",
132
+ error: err instanceof Error ? err.message : "Upload failed"
133
+ }));
134
+ await new Promise((resolve) => setTimeout(resolve, 1e3));
135
+ setActiveStep(3);
136
+ }
137
+ }, [file, selectedFolderId, createFile]);
138
+ const handleShowFile = useCallback(() => {
139
+ if (!selectedFolderId) {
140
+ openApp("files");
141
+ } else {
142
+ openApp("files", { contentData: { initialFolderId: selectedFolderId } });
143
+ }
144
+ }, [selectedFolderId, openApp]);
145
+ const handleOpenFile = useCallback(() => {
146
+ if (!createdFileId) return;
147
+ const createdNode = useDesktopStore.getState().fsNodes.find((n) => n.id === createdFileId);
148
+ if (!createdNode || createdNode.type !== "file") return;
149
+ const fileNode = createdNode;
150
+ const result = getAppIdForMime(fileNode);
151
+ if (result) {
152
+ openApp(result.appId, { contentData: result.contentData });
153
+ }
154
+ }, [createdFileId, openApp]);
155
+ if (!win) return null;
156
+ const isSuccess = uploadState.status === "done";
157
+ const errorMessage = uploadState.error;
158
+ if (activeStep === 3) {
159
+ return /* @__PURE__ */ jsx("div", { className: UploaderApp_default.container, children: /* @__PURE__ */ jsxs(Paper, { shadow: "sm", className: UploaderApp_default.resultPaper, children: [
160
+ /* @__PURE__ */ jsx(Box, { className: UploaderApp_default.resultIcon, children: isSuccess ? checkIconLg : infoIcon }),
161
+ /* @__PURE__ */ jsx(Text, { size: "lg", fw: 500, ta: "center", children: isSuccess ? t("uploader.uploadComplete") : `${t("uploader.uploadFailed")}: ${errorMessage}` }),
162
+ isSuccess && /* @__PURE__ */ jsxs(Group, { mt: "md", justify: "center", children: [
163
+ /* @__PURE__ */ jsx(
164
+ Button,
165
+ {
166
+ variant: "default",
167
+ size: "sm",
168
+ onClick: handleShowFile,
169
+ "data-testid": "uploader-show-file",
170
+ children: t("uploader.showFile")
171
+ }
172
+ ),
173
+ /* @__PURE__ */ jsx(Button, { size: "sm", onClick: handleOpenFile, "data-testid": "uploader-open-file", children: t("uploader.openFile") })
174
+ ] })
175
+ ] }) });
176
+ }
177
+ return /* @__PURE__ */ jsxs("div", { className: UploaderApp_default.container, children: [
178
+ uploadIcon && /* @__PURE__ */ jsx("div", { className: UploaderApp_default.backgroundIcon, children: uploadIcon }),
179
+ /* @__PURE__ */ jsxs(Stepper, { active: activeStep, orientation: "horizontal", size: "sm", className: UploaderApp_default.stepper, children: [
180
+ /* @__PURE__ */ jsx(Stepper.Step, { label: t("uploader.stepSelect"), description: t("uploader.clickToUpload"), children: /* @__PURE__ */ jsx(FileButton, { accept: "*", onChange: handleFileChange, children: (props) => /* @__PURE__ */ jsx(Button, { ...props, size: "sm", "data-testid": "uploader-select-file", children: t("uploader.clickToUpload") }) }) }),
181
+ /* @__PURE__ */ jsxs(
182
+ Stepper.Step,
183
+ {
184
+ label: t("uploader.stepDestination"),
185
+ description: folderSelected ? /* @__PURE__ */ jsxs(Group, { gap: 4, align: "center", style: { display: "inline-flex" }, children: [
186
+ checkIconSm,
187
+ /* @__PURE__ */ jsx("span", { children: t("uploader.folderSelected") })
188
+ ] }) : t("uploader.selectDestination"),
189
+ children: [
190
+ file && /* @__PURE__ */ jsxs(Box, { className: UploaderApp_default.fileInfo, children: [
191
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: file.name }),
192
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: formatBytes(file.size) })
193
+ ] }),
194
+ /* @__PURE__ */ jsxs(Group, { mt: "md", children: [
195
+ /* @__PURE__ */ jsx(
196
+ Button,
197
+ {
198
+ variant: "default",
199
+ size: "xs",
200
+ onClick: () => setPickerOpen(true),
201
+ "data-testid": "uploader-select-folder",
202
+ children: t("uploader.selectDestination")
203
+ }
204
+ ),
205
+ /* @__PURE__ */ jsx(Button, { size: "xs", onClick: () => setActiveStep(2), "data-testid": "uploader-skip-folder", children: t("uploader.next", { defaultValue: "Next" }) })
206
+ ] }),
207
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", mt: "xs", children: selectedFolderId ? `${t("uploader.uploadTo")}: ${useDesktopStore.getState().fsNodes.find((n) => n.id === selectedFolderId)?.name || ""}` : t("uploader.uploadToRoot") })
208
+ ]
209
+ }
210
+ ),
211
+ /* @__PURE__ */ jsx(Stepper.Step, { label: t("uploader.stepUpload"), description: t("uploader.uploading"), children: !uploadStarted ? /* @__PURE__ */ jsxs(Box, { className: UploaderApp_default.readyContainer, children: [
212
+ /* @__PURE__ */ jsx(Text, { size: "sm", ta: "center", children: t("uploader.readyToUpload") }),
213
+ /* @__PURE__ */ jsx(Group, { justify: "center", children: /* @__PURE__ */ jsx(Button, { size: "sm", onClick: handleUpload, "data-testid": "uploader-upload", children: t("uploader.upload") }) })
214
+ ] }) : /* @__PURE__ */ jsx(
215
+ DownloadProgress_default,
216
+ {
217
+ state: uploadState.progress,
218
+ ariaLabel: t("uploader.uploadProgress")
219
+ }
220
+ ) })
221
+ ] }),
222
+ /* @__PURE__ */ jsx(
223
+ FolderPickerModal,
224
+ {
225
+ opened: pickerOpen,
226
+ onConfirm: handleFolderSelect,
227
+ onCancel: () => setPickerOpen(false)
228
+ }
229
+ )
230
+ ] });
231
+ };
232
+ var UploaderApp_default2 = UploaderApp;
233
+
234
+ export { UploaderApp_default2 as UploaderApp_default, formatBytes };
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ var chunkSBE4SZAN_cjs = require('./chunk-SBE4SZAN.cjs');
4
+ var chunkUIQCTAVM_cjs = require('./chunk-UIQCTAVM.cjs');
5
+ var react = require('react');
6
+ var reactI18next = require('react-i18next');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ var ZOOM_MARKS = [
10
+ { value: 25, label: "25%" },
11
+ { value: 50, label: "50%" },
12
+ { value: 75, label: "75%" },
13
+ { value: 100, label: "100%" },
14
+ { value: 200, label: "200%" }
15
+ ];
16
+ var useImageViewerMenuBarElements = (options) => {
17
+ const { windowId, onOpenPicker, onExit } = options;
18
+ const { t } = reactI18next.useTranslation("common");
19
+ const { t: tApps } = reactI18next.useTranslation("apps");
20
+ const displayZoom = chunkUIQCTAVM_cjs.useDisplayZoom(windowId);
21
+ const fitToWindow = chunkUIQCTAVM_cjs.useFitToWindow(windowId);
22
+ const setUserZoom = chunkUIQCTAVM_cjs.useImageViewerStore((s) => s.setUserZoom);
23
+ const setFitToWindow = chunkUIQCTAVM_cjs.useImageViewerStore((s) => s.setFitToWindow);
24
+ const handleFitChange = react.useCallback(
25
+ (checked) => setFitToWindow(windowId, checked),
26
+ [windowId, setFitToWindow]
27
+ );
28
+ const handleZoomChange = react.useCallback(
29
+ (value) => setUserZoom(windowId, value),
30
+ [windowId, setUserZoom]
31
+ );
32
+ return react.useMemo(() => {
33
+ const zoomLabel = `${tApps("imageViewer.zoom")}: ${displayZoom}%`;
34
+ return [
35
+ {
36
+ type: "menu",
37
+ label: t("menu.file"),
38
+ items: [
39
+ {
40
+ type: "item",
41
+ label: t("actions.open"),
42
+ icon: "FcOpenedFolder",
43
+ onClick: onOpenPicker ?? (() => {
44
+ })
45
+ },
46
+ { type: "divider" },
47
+ {
48
+ type: "item",
49
+ label: t("actions.exit"),
50
+ icon: "FcLeft",
51
+ onClick: onExit
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ type: "switch",
57
+ label: tApps("imageViewer.fitToWindow"),
58
+ checked: fitToWindow,
59
+ onChange: handleFitChange
60
+ },
61
+ {
62
+ type: "slider",
63
+ label: zoomLabel,
64
+ min: 10,
65
+ max: 200,
66
+ value: displayZoom,
67
+ onChange: handleZoomChange,
68
+ marks: ZOOM_MARKS,
69
+ labelFormat: (value) => `${value}%`
70
+ }
71
+ ];
72
+ }, [t, tApps, onOpenPicker, onExit, displayZoom, fitToWindow, handleFitChange, handleZoomChange]);
73
+ };
74
+ var ImageViewerMenuBar = react.memo(
75
+ ({ windowId, contentData, onExit }) => {
76
+ const elements = useImageViewerMenuBarElements({
77
+ windowId,
78
+ onOpenPicker: contentData?.setPickerOpen,
79
+ onExit
80
+ });
81
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkSBE4SZAN_cjs.AppMenuBar_default, { elements });
82
+ }
83
+ );
84
+ ImageViewerMenuBar.displayName = "ImageViewerMenuBar";
85
+
86
+ exports.ImageViewerMenuBar = ImageViewerMenuBar;
@@ -0,0 +1,42 @@
1
+ import { create } from 'zustand';
2
+
3
+ // src/components/Apps/MenuEditApp/menuEditStore.ts
4
+ var useMenuEditStore = create((set, get) => ({
5
+ windows: {},
6
+ reset: (windowId) => {
7
+ set((state) => ({
8
+ windows: {
9
+ ...state.windows,
10
+ [windowId]: { isDirty: false, snapshot: null }
11
+ }
12
+ }));
13
+ },
14
+ setIsDirty: (windowId, isDirty) => {
15
+ set((state) => {
16
+ const windowState = state.windows[windowId];
17
+ if (windowState?.isDirty === isDirty) return state;
18
+ return {
19
+ windows: {
20
+ ...state.windows,
21
+ [windowId]: { ...windowState, isDirty }
22
+ }
23
+ };
24
+ });
25
+ },
26
+ takeSnapshot: (windowId, folders) => {
27
+ set((state) => ({
28
+ windows: {
29
+ ...state.windows,
30
+ [windowId]: { isDirty: false, snapshot: folders }
31
+ }
32
+ }));
33
+ },
34
+ getSnapshot: (windowId) => {
35
+ return get().windows[windowId]?.snapshot ?? null;
36
+ }
37
+ }));
38
+ var useIsDirty = (windowId) => {
39
+ return useMenuEditStore((state) => state.windows[windowId]?.isDirty ?? false);
40
+ };
41
+
42
+ export { useIsDirty, useMenuEditStore };