@fde-desktop/fde-core 0.4.11 → 0.4.19

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 (132) hide show
  1. package/dist/{AppEmptyState-Boej96TB.js → AppEmptyState-BVfKZU-h.js} +1 -1
  2. package/dist/AppEmptyState-Z8_Cviti.cjs +1 -0
  3. package/dist/AppIcon-Czrtau6A.cjs +1 -0
  4. package/dist/{AppIcon-mtEoyzOb.js → AppIcon-aFNw89J2.js} +1 -1
  5. package/dist/AppMenuBar-38QtFTPk.cjs +1 -0
  6. package/dist/AppTempMemory-DAC62jiS.cjs +1 -0
  7. package/dist/AppTempMemory-DgUW6GaF.js +23 -0
  8. package/dist/CalendarApp-BYTyu089.js +9 -0
  9. package/dist/CalendarApp-DPOK4mqg.cjs +1 -0
  10. package/dist/{ColorPicker-WCeD3Wjf.js → ColorPicker-B76rCS2H.js} +1 -1
  11. package/dist/ColorPicker-BZqsPh3X.cjs +1 -0
  12. package/dist/CreateItemApp-B0IHL16b.cjs +1 -0
  13. package/dist/CreateItemApp-UUP2HAu2.js +149 -0
  14. package/dist/DeviceInfoApp-BPQyeVSd.js +162 -0
  15. package/dist/DeviceInfoApp-D2mS2OT-.cjs +1 -0
  16. package/dist/DownloadProgress-CpJguS8g.cjs +1 -0
  17. package/dist/FilePickerApp-ClmPw6lk.cjs +1 -0
  18. package/dist/{FilePickerApp-ClHuhm6Z.js → FilePickerApp-D7fERKbp.js} +1 -1
  19. package/dist/FilesApp-DhJbO8wg.js +191 -0
  20. package/dist/FilesApp-LbwRRR1i.cjs +1 -0
  21. package/dist/IconColorPicker-7rWNAiNQ.cjs +1 -0
  22. package/dist/IconColorPicker-DUIXSb5E.js +58 -0
  23. package/dist/ImageViewerApp-9T-V8uP5.cjs +1 -0
  24. package/dist/ImageViewerApp-ihqIwJ-L.js +68 -0
  25. package/dist/ImageViewerMenuBar-DmvZoZ03.cjs +1 -0
  26. package/dist/{ImageViewerMenuBar-BIsUokxV.js → ImageViewerMenuBar-ZeIKHdA-.js} +18 -19
  27. package/dist/MenuEditApp-DRKfmSIZ.js +361 -0
  28. package/dist/MenuEditApp-U7EqB5Rl.cjs +1 -0
  29. package/dist/MenuEditMenuBar-BE_cXaoG.cjs +1 -0
  30. package/dist/MenuEditMenuBar-Df1je7F6.js +59 -0
  31. package/dist/NotesApp-DZfNQ8mN.cjs +1 -0
  32. package/dist/NotesApp-rwAeXyJy.js +344 -0
  33. package/dist/{NotesMenuBar-DILZTjnT.js → NotesMenuBar-C503t5pu.js} +12 -13
  34. package/dist/NotesMenuBar-CwgZ9dHy.cjs +1 -0
  35. package/dist/PdfApp-DNZaSXbF.cjs +1 -0
  36. package/dist/PdfApp-K1Z612o3.js +38 -0
  37. package/dist/PdfMenuBar-BPzP_JUO.cjs +1 -0
  38. package/dist/PdfMenuBar-DEUKgKTE.js +38 -0
  39. package/dist/SettingsApp-DdWqiYFE.cjs +1 -0
  40. package/dist/SettingsApp-ghc3RaMv.js +875 -0
  41. package/dist/SettingsMenuBar-C4KAPoBs.js +41 -0
  42. package/dist/SettingsMenuBar-CgmaF9_B.cjs +1 -0
  43. package/dist/{UploaderApp-CbypD538.js → UploaderApp-D9vfOR0S.js} +28 -40
  44. package/dist/UploaderApp-omSY-NSn.cjs +1 -0
  45. package/dist/VscIcon-CeELixwP.cjs +1 -0
  46. package/dist/buildBreadcrumbs-C2c2a4R3.cjs +1 -0
  47. package/dist/desktopStore-LSQweOqZ.cjs +1 -0
  48. package/dist/{desktopStore-8cSZlj7s.js → desktopStore-xnNbYaYm.js} +263 -263
  49. package/dist/formatBytes-Bv1bQPKQ.cjs +1 -0
  50. package/dist/formatBytes-CaP80WnM.js +14 -0
  51. package/dist/i18nConstants-DgbKSBIK.cjs +1 -0
  52. package/dist/i18nConstants-Nzpf2IFp.js +611 -0
  53. package/dist/imageViewerStore-CYt4R4e4.cjs +1 -0
  54. package/dist/index.cjs +1 -1
  55. package/dist/index.css +1 -1
  56. package/dist/index.d.ts +50 -29
  57. package/dist/index.js +715 -658
  58. package/dist/menuEditStore-sU6qaF2j.cjs +1 -0
  59. package/dist/notesStore-BnMXBRaV.cjs +1 -0
  60. package/dist/settingsAppStore-CQ4JHd7Q.cjs +1 -0
  61. package/dist/useAdaptiveDimensions-BDZxP4E3.cjs +1 -0
  62. package/dist/{useAdaptiveDimensions-DxNLJ7R5.js → useAdaptiveDimensions-sv9lwqF_.js} +1 -1
  63. package/dist/useCloseInterceptor-AzfjUZgz.cjs +1 -0
  64. package/dist/{useCloseInterceptor-CIxhOZx1.js → useCloseInterceptor-Bwm4I0O8.js} +1 -1
  65. package/dist/useDeviceDetection-B9jjlate.js +37 -0
  66. package/dist/useDeviceDetection-CnxnQWIq.cjs +1 -0
  67. package/dist/useDragDrop-Bdwzk6VO.cjs +1 -0
  68. package/dist/useDragDrop-D2LtOEYC.js +139 -0
  69. package/dist/useDynamicIcon-Cg3B_Aeq.cjs +1 -0
  70. package/dist/useNotifications-CR9JLjtC.js +26 -0
  71. package/dist/useNotifications-rwLmJ7fI.cjs +1 -0
  72. package/dist/useOpenApp-BBZ_B7Pr.cjs +1 -0
  73. package/dist/{useOpenApp-DkZLFFCH.js → useOpenApp-DdEbOVby.js} +3 -3
  74. package/dist/useResolvedUrl-CgqjNxzw.js +389 -0
  75. package/dist/useResolvedUrl-Dz2AhrDV.cjs +1 -0
  76. package/package.json +1 -1
  77. package/dist/AppEmptyState-CLc00OOG.cjs +0 -1
  78. package/dist/AppIcon-C8vHUVcb.cjs +0 -1
  79. package/dist/AppMenuBar-CAlkNHjj.cjs +0 -1
  80. package/dist/CalendarApp-DOmjWbpl.js +0 -10
  81. package/dist/CalendarApp-Z0bCCYsK.cjs +0 -1
  82. package/dist/ColorPicker-CQRRwY-y.cjs +0 -1
  83. package/dist/CreateItemApp-BkFFFdX1.cjs +0 -1
  84. package/dist/CreateItemApp-DR8Y4bwo.js +0 -202
  85. package/dist/DeviceInfoApp-BXQ9uOwF.cjs +0 -1
  86. package/dist/DeviceInfoApp-I63mJRWy.js +0 -195
  87. package/dist/DownloadProgress-CkTGTf0z.cjs +0 -1
  88. package/dist/FilePickerApp-By6-vbag.cjs +0 -1
  89. package/dist/FilesApp-BC4UPNuw.cjs +0 -1
  90. package/dist/FilesApp-D8MqvC5X.js +0 -210
  91. package/dist/ImageViewerApp-B1niWF75.cjs +0 -1
  92. package/dist/ImageViewerApp-iojtyFEf.js +0 -69
  93. package/dist/ImageViewerMenuBar-BgzgSF3v.cjs +0 -1
  94. package/dist/MenuEditApp-BHptoJbz.cjs +0 -1
  95. package/dist/MenuEditApp-CJUbJaqh.js +0 -492
  96. package/dist/MenuEditMenuBar-CCOSPAUe.cjs +0 -1
  97. package/dist/MenuEditMenuBar-DnCL-kaZ.js +0 -60
  98. package/dist/NotesApp-BmQIBtJ2.cjs +0 -1
  99. package/dist/NotesApp-DJ2dGt4-.js +0 -364
  100. package/dist/NotesMenuBar-BzojwMtH.cjs +0 -1
  101. package/dist/PdfApp-IjY_GtnW.js +0 -39
  102. package/dist/PdfApp-krW8UI97.cjs +0 -1
  103. package/dist/PdfMenuBar-Bd5MTZcZ.js +0 -39
  104. package/dist/PdfMenuBar-DWD0Qa3F.cjs +0 -1
  105. package/dist/SettingsApp-BE22l5UP.cjs +0 -1
  106. package/dist/SettingsApp-BTFtTFY_.js +0 -1228
  107. package/dist/SettingsMenuBar-CZE2evG2.cjs +0 -1
  108. package/dist/SettingsMenuBar-ktC0viTd.js +0 -42
  109. package/dist/UploaderApp-D_qD3O70.cjs +0 -1
  110. package/dist/VscIcon-BYb_Soyy.cjs +0 -1
  111. package/dist/buildBreadcrumbs-Ccd8i11b.cjs +0 -1
  112. package/dist/desktopStore-C1jR6Fdb.cjs +0 -1
  113. package/dist/imageViewerStore-Dfylg59V.cjs +0 -1
  114. package/dist/menuEditStore-CYwtfD6H.cjs +0 -1
  115. package/dist/notesStore-CrWTO6oB.cjs +0 -1
  116. package/dist/rolldown-runtime-CAFD8bLK.js +0 -11
  117. package/dist/settingsAppStore-DuYZNeFf.cjs +0 -1
  118. package/dist/useAdaptiveDimensions-3Lz4X0Tc.cjs +0 -1
  119. package/dist/useCloseInterceptor-CdX-09Ib.cjs +0 -1
  120. package/dist/useDynamicIcon-CK6SjEv5.cjs +0 -1
  121. package/dist/useOpenApp-D-FOY88T.cjs +0 -1
  122. package/dist/useResolvedUrl-B6x4xy0x.js +0 -29
  123. package/dist/useResolvedUrl-Bb39DpVy.cjs +0 -1
  124. /package/dist/{Colors-CuABn2W4.js → Colors-BIj4g0eH.js} +0 -0
  125. /package/dist/{Colors-CNJbU7oq.cjs → Colors-PNt4eyR6.cjs} +0 -0
  126. /package/dist/{DownloadProgress-DnVASsv5.js → DownloadProgress-DBFA58C5.js} +0 -0
  127. /package/dist/{imageViewerStore-COrD02Zu.js → imageViewerStore-C6UgceP-.js} +0 -0
  128. /package/dist/{menuEditStore-CxsgLiQu.js → menuEditStore-DPqViGva.js} +0 -0
  129. /package/dist/{notesStore-Dgah46U5.js → notesStore-KZDXN6zx.js} +0 -0
  130. /package/dist/{settingsAppStore-DHZhi6Rl.js → settingsAppStore-Y7x3r6pV.js} +0 -0
  131. /package/dist/{useMenuBarUtils-DAap0ukp.cjs → useMenuBarUtils-BOnQYtKU.cjs} +0 -0
  132. /package/dist/{useMenuBarUtils-ChAfI7OA.js → useMenuBarUtils-DTPFK0IN.js} +0 -0
@@ -1,492 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-CAFD8bLK.js";
2
- import { G as t, ct as n, o as r } from "./desktopStore-8cSZlj7s.js";
3
- import { t as i } from "./AppIcon-mtEoyzOb.js";
4
- import { i as a } from "./useCloseInterceptor-CIxhOZx1.js";
5
- import { t as o } from "./VscIcon-AEENjKOE.js";
6
- import { n as s } from "./menuEditStore-CxsgLiQu.js";
7
- import { createContext as c, useCallback as l, useContext as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
8
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
9
- import { ActionIcon as _, Box as v, Card as y, Group as b, Text as x, TextInput as S, UnstyledButton as C } from "@mantine/core";
10
- import { useTranslation as w } from "react-i18next";
11
- import { DndContext as T, DragOverlay as E, defaultDropAnimation as D, pointerWithin as O, useDraggable as k, useDroppable as A } from "@dnd-kit/core";
12
- //#region src/hooks/useFolderName.ts
13
- var j = {
14
- "launcher-folder-social-links": "socialLinks",
15
- "launcher-folder-office": "office",
16
- "launcher-folder-programming": "programming",
17
- "launcher-folder-games": "games",
18
- "launcher-folder-custom-apps": "customApps"
19
- };
20
- function M(e) {
21
- let { t } = w("apps");
22
- if (!e.isPredefined) return e.name;
23
- let n = j[e.id];
24
- return n ? t(`folders.${n}`, e.name) : e.name;
25
- }
26
- //#endregion
27
- //#region src/hooks/useDragDrop/DragDropStateContext.tsx
28
- var N = c(null), P = ({ children: e, onDrop: t, onCancel: n }) => {
29
- let [r, i] = m(null), [a, o] = m(null), s = l((e) => {
30
- let t = e.active.data.current;
31
- t && i(t);
32
- }, []), c = l((e) => {
33
- if (e.over) {
34
- let t = e.over.data.current;
35
- t && o(t);
36
- } else o(null);
37
- }, []), u = l((e) => {
38
- let { active: r, over: a } = e;
39
- if (a && r.data.current) {
40
- let e = r.data.current, n = a.data.current;
41
- n.accepts.includes(e.type) && t(e, n);
42
- } else !a && n && n();
43
- i(null), o(null);
44
- }, [t, n]), d = f(() => ({
45
- activeItem: r,
46
- overTarget: a
47
- }), [r, a]);
48
- return /* @__PURE__ */ h(N.Provider, {
49
- value: d,
50
- children: /* @__PURE__ */ h(T, {
51
- onDragStart: s,
52
- onDragOver: c,
53
- onDragEnd: u,
54
- collisionDetection: O,
55
- children: e
56
- })
57
- });
58
- };
59
- //#endregion
60
- //#region src/hooks/useDragDrop/useDraggableItem.ts
61
- function F(e) {
62
- let { item: t, disabled: n = !1 } = e, { attributes: r, listeners: i, setNodeRef: a, transform: o, isDragging: s } = k({
63
- id: `${t.sourceId}-${t.id}`,
64
- data: t,
65
- disabled: n
66
- }), c = {
67
- opacity: s ? 0 : 1,
68
- cursor: n ? "default" : "grab"
69
- };
70
- return {
71
- attributes: r,
72
- listeners: i,
73
- setNodeRef: a,
74
- isDragging: s,
75
- transform: o ? {
76
- x: o.x,
77
- y: o.y
78
- } : null,
79
- style: c
80
- };
81
- }
82
- //#endregion
83
- //#region src/hooks/useDragDrop/useDroppableArea.ts
84
- function I(e) {
85
- let { target: t, disabled: n = !1 } = e, r = u(N), { setNodeRef: i, isOver: a } = A({
86
- id: t.id,
87
- data: t,
88
- disabled: n
89
- });
90
- return {
91
- setNodeRef: i,
92
- isOver: a,
93
- active: r?.activeItem ?? null
94
- };
95
- }
96
- //#endregion
97
- //#region src/hooks/useDragDrop/useDragDropState.ts
98
- function L() {
99
- let e = u(N);
100
- if (!e) throw Error("useDragDropState must be used within a DragDropProvider");
101
- return e;
102
- }
103
- //#endregion
104
- //#region src/hooks/useDragDrop/modifiers/snapCenterToCursor.ts
105
- var R = ({ activatorEvent: e, transform: t, draggingNodeRect: n }) => {
106
- if (!e || !n) return t;
107
- let r = e, i = 0, a = 0;
108
- "touches" in r && r.touches.length > 0 ? (i = r.touches[0].clientX, a = r.touches[0].clientY) : "clientX" in r && (i = r.clientX, a = r.clientY);
109
- let o = i - n.left - n.width / 2, s = a - n.top - n.height / 2;
110
- return {
111
- ...t,
112
- x: t.x + o,
113
- y: t.y + s
114
- };
115
- }, z = { dragOverlay: "_dragOverlay_myknw_1" }, B = () => {
116
- let { activeItem: e } = L();
117
- return e ? /* @__PURE__ */ h(E, {
118
- dropAnimation: D,
119
- modifiers: [R],
120
- children: /* @__PURE__ */ g(v, {
121
- className: z.dragOverlay,
122
- children: [/* @__PURE__ */ h(i, {
123
- fcIcon: e.metadata?.fcIcon,
124
- iconUrl: e.metadata?.iconUrl,
125
- fallback: e.metadata?.icon,
126
- size: 20
127
- }), /* @__PURE__ */ h(x, {
128
- size: "xs",
129
- children: e.name
130
- })]
131
- })
132
- }) : null;
133
- }, V = {
134
- "launcher-folder": ["app"],
135
- "filesystem-folder": ["file", "folder"],
136
- desktop: [
137
- "file",
138
- "folder",
139
- "app"
140
- ],
141
- "available-apps": ["app"]
142
- }, H = {
143
- container: "_container_y9c6e_1",
144
- content: "_content_y9c6e_7",
145
- folderList: "_folderList_y9c6e_13",
146
- folderCard: "_folderCard_y9c6e_19",
147
- folderHeader: "_folderHeader_y9c6e_28",
148
- appList: "_appList_y9c6e_40",
149
- availableApps: "_availableApps_y9c6e_49",
150
- appGrid: "_appGrid_y9c6e_58",
151
- appItem: "_appItem_y9c6e_64"
152
- }, U = /* @__PURE__ */ e({ default: () => Y }), W = ({ folder: e, isEditing: t, editingName: r, onEdit: a, onDelete: s, onRename: c, onSetEditingName: l, onRemoveApp: u }) => {
153
- let { t: d } = w("menuedit"), f = M(e), { activeItem: p } = L(), { setNodeRef: m, isOver: C } = I({ target: {
154
- type: "launcher-folder",
155
- id: e.id,
156
- name: f,
157
- accepts: V["launcher-folder"]
158
- } });
159
- return /* @__PURE__ */ g(y, {
160
- ref: m,
161
- className: H.folderCard,
162
- shadow: "xs",
163
- padding: "xs",
164
- "data-is-over": C && p?.type === "app" ? "true" : void 0,
165
- children: [/* @__PURE__ */ g(b, {
166
- justify: "space-between",
167
- mb: 4,
168
- children: [t ? /* @__PURE__ */ h(S, {
169
- value: r,
170
- onChange: (e) => l(e.target.value),
171
- onBlur: () => c(e.id),
172
- onKeyDown: (t) => {
173
- t.key === "Enter" && (t.preventDefault(), c(e.id));
174
- },
175
- autoFocus: !0,
176
- size: "xs",
177
- style: { flex: 1 }
178
- }) : /* @__PURE__ */ g(b, {
179
- gap: "xs",
180
- children: [
181
- /* @__PURE__ */ h(i, {
182
- fcIcon: e.fcIcon,
183
- size: 16
184
- }),
185
- /* @__PURE__ */ h(x, {
186
- size: "sm",
187
- fw: 500,
188
- children: f
189
- }),
190
- e.isPredefined && /* @__PURE__ */ g(x, {
191
- size: "xs",
192
- c: "dimmed",
193
- children: [
194
- "(",
195
- d("predefined"),
196
- ")"
197
- ]
198
- })
199
- ]
200
- }), !e.isPredefined && !t && /* @__PURE__ */ g(b, {
201
- gap: 4,
202
- children: [/* @__PURE__ */ h(_, {
203
- variant: "subtle",
204
- size: "xs",
205
- onClick: () => a(e.id),
206
- "aria-label": d("rename"),
207
- children: /* @__PURE__ */ h(o, {
208
- name: "VscEdit",
209
- size: 14
210
- })
211
- }), s && /* @__PURE__ */ h(_, {
212
- variant: "subtle",
213
- size: "xs",
214
- color: "red",
215
- onClick: () => s(e.id),
216
- "aria-label": d("delete"),
217
- children: /* @__PURE__ */ h(o, {
218
- name: "VscTrash",
219
- size: 14
220
- })
221
- })]
222
- })]
223
- }), /* @__PURE__ */ h(v, {
224
- className: H.appList,
225
- children: e.appIds.map((t) => {
226
- let r = n.find((e) => e.id === t);
227
- return r ? /* @__PURE__ */ h(G, {
228
- app: r,
229
- sourceId: e.id,
230
- onContextMenu: (n) => {
231
- n.preventDefault(), n.stopPropagation(), u(t, e.id);
232
- }
233
- }, t) : null;
234
- })
235
- })]
236
- });
237
- }, G = ({ app: e, sourceId: t, onContextMenu: n }) => {
238
- let { attributes: r, listeners: a, setNodeRef: o, isDragging: s, style: c } = F({ item: {
239
- type: "app",
240
- id: e.id,
241
- name: e.name,
242
- sourceId: t,
243
- sourceType: "launcher-folder",
244
- metadata: {
245
- fcIcon: e.fcIcon,
246
- iconUrl: e.iconUrl,
247
- icon: e.icon
248
- }
249
- } });
250
- return /* @__PURE__ */ g(C, {
251
- ref: o,
252
- className: H.appItem,
253
- style: {
254
- ...c,
255
- opacity: s ? .5 : 1
256
- },
257
- onContextMenu: n,
258
- ...r,
259
- ...a,
260
- children: [/* @__PURE__ */ h(i, {
261
- fcIcon: e.fcIcon,
262
- iconUrl: e.iconUrl,
263
- fallback: e.icon,
264
- size: 16
265
- }), /* @__PURE__ */ h(x, {
266
- size: "xs",
267
- children: e.name
268
- })]
269
- });
270
- }, K = ({ customFolderId: e }) => {
271
- let { t } = w("menuedit"), { activeItem: i } = L(), { setNodeRef: a, isOver: o } = I({ target: {
272
- type: "available-apps",
273
- id: "available-apps",
274
- name: "Available Apps",
275
- accepts: V["available-apps"]
276
- } }), s = new Set(r.getState().launcherFolders.flatMap((e) => e.appIds)), c = n.filter((e) => e.id !== "settings" && e.id !== "menuedit"), l = r((e) => e.addAppToFolder);
277
- return /* @__PURE__ */ g(v, {
278
- ref: a,
279
- className: H.availableApps,
280
- "data-is-over": o && i?.type === "app" ? "true" : void 0,
281
- children: [
282
- /* @__PURE__ */ h(x, {
283
- size: "xs",
284
- c: "dimmed",
285
- mb: 8,
286
- children: t("availableApps")
287
- }),
288
- e === null && /* @__PURE__ */ h(x, {
289
- size: "xs",
290
- c: "orange",
291
- mb: 4,
292
- children: t("canCreateNewFolder")
293
- }),
294
- /* @__PURE__ */ h(v, {
295
- className: H.appGrid,
296
- children: c.filter((e) => !s.has(e.id)).map((t) => /* @__PURE__ */ h(q, {
297
- app: t,
298
- targetFolderId: e,
299
- onAdd: l
300
- }, t.id))
301
- })
302
- ]
303
- });
304
- }, q = ({ app: e, targetFolderId: t, onAdd: n }) => {
305
- let { attributes: r, listeners: a, setNodeRef: o, isDragging: s, style: c } = F({ item: {
306
- type: "app",
307
- id: e.id,
308
- name: e.name,
309
- sourceId: "available-apps",
310
- sourceType: "available-apps",
311
- metadata: {
312
- fcIcon: e.fcIcon,
313
- iconUrl: e.iconUrl,
314
- icon: e.icon
315
- }
316
- } }), l = () => {
317
- t && n(e.id, t);
318
- };
319
- return /* @__PURE__ */ g(C, {
320
- ref: o,
321
- className: H.appItem,
322
- style: {
323
- ...c,
324
- opacity: s ? 0 : 1
325
- },
326
- onClick: l,
327
- disabled: !t,
328
- ...r,
329
- ...a,
330
- children: [/* @__PURE__ */ h(i, {
331
- fcIcon: e.fcIcon,
332
- iconUrl: e.iconUrl,
333
- fallback: e.icon,
334
- size: 16
335
- }), /* @__PURE__ */ h(x, {
336
- size: "xs",
337
- children: e.name
338
- })]
339
- });
340
- }, J = ({ window: e, notifyReady: n }) => {
341
- let { t: i } = w("menuedit"), c = e?.id, u = r((e) => e.launcherFolders), f = r((e) => e.setLauncherFolders), y = r((e) => e.createLauncherFolder), S = r((e) => e.updateLauncherFolder), C = r((e) => e.deleteLauncherFolder), T = r((e) => e.removeAppFromFolder), [E, D] = m(null), [O, k] = m(""), A = p(!1);
342
- d(() => {
343
- c && (A.current || (A.current = !0, s.getState().reset(c)));
344
- }, [c]), d(() => {
345
- if (!c) return;
346
- let e = s.getState();
347
- if (e.getSnapshot(c) === null) e.takeSnapshot(c, u);
348
- else {
349
- let t = e.getSnapshot(c);
350
- if (t) {
351
- let n = JSON.stringify(u) !== JSON.stringify(t);
352
- e.setIsDirty(c, n);
353
- }
354
- }
355
- }, [c, u]);
356
- let j = l(() => {
357
- c && s.getState().takeSnapshot(c, u);
358
- }, [c, u]), M = l(() => {
359
- if (!c) return;
360
- let e = s.getState().getSnapshot(c);
361
- e && f(e);
362
- }, [c, f]);
363
- a({
364
- isDirtyGetter: l(() => {
365
- if (!c) return !1;
366
- let e = s.getState().getSnapshot(c);
367
- return JSON.stringify(u) !== JSON.stringify(e ?? []);
368
- }, [c, u]),
369
- windowId: e?.id,
370
- onDiscard: M,
371
- onSave: j
372
- });
373
- let N = l(() => {
374
- let e = y({
375
- name: i("newFolder"),
376
- fcIcon: "VscFolder",
377
- order: u.length
378
- });
379
- D(e.id), k(e.name);
380
- }, [
381
- y,
382
- u.length,
383
- i
384
- ]);
385
- d(() => {
386
- n?.({
387
- createFolder: N,
388
- save: j,
389
- discard: M
390
- });
391
- }, [
392
- N,
393
- j,
394
- M,
395
- n
396
- ]);
397
- let P = l((e) => {
398
- let t = u.find((t) => t.id === e);
399
- t && (D(t.id), k(t.name));
400
- }, [u]), F = l((e) => {
401
- O.trim() && S(e, { name: O.trim() }), D(null);
402
- }, [O, S]), I = t(), L = u.filter((e) => e.isPredefined), R = u.filter((e) => !e.isPredefined), z = R.length > 0 ? R[0].id : null;
403
- return /* @__PURE__ */ h(v, {
404
- className: H.container,
405
- "data-windowid": e?.id,
406
- "data-menuedit-container": !0,
407
- children: /* @__PURE__ */ g(v, {
408
- className: H.content,
409
- children: [
410
- L.length > 0 && /* @__PURE__ */ g(v, {
411
- mb: "md",
412
- children: [/* @__PURE__ */ h(x, {
413
- size: "xs",
414
- c: "dimmed",
415
- mb: 8,
416
- children: i("predefinedFolders")
417
- }), /* @__PURE__ */ h(v, {
418
- className: H.folderList,
419
- children: L.map((e) => /* @__PURE__ */ h(W, {
420
- folder: e,
421
- isEditing: !1,
422
- editingName: "",
423
- onEdit: () => {},
424
- onRemoveApp: T,
425
- onRename: () => {},
426
- onSetEditingName: () => {}
427
- }, e.id))
428
- })]
429
- }),
430
- I && R.length > 0 && /* @__PURE__ */ g(v, {
431
- mb: "md",
432
- children: [/* @__PURE__ */ h(x, {
433
- size: "xs",
434
- c: "dimmed",
435
- mb: 8,
436
- children: i("customFolders")
437
- }), /* @__PURE__ */ h(v, {
438
- className: H.folderList,
439
- children: R.map((e) => /* @__PURE__ */ h(W, {
440
- folder: e,
441
- isEditing: E === e.id,
442
- editingName: O,
443
- onEdit: P,
444
- onDelete: C,
445
- onRename: F,
446
- onSetEditingName: k,
447
- onRemoveApp: T
448
- }, e.id))
449
- })]
450
- }),
451
- /* @__PURE__ */ g(b, {
452
- justify: "space-between",
453
- mb: "md",
454
- children: [
455
- /* @__PURE__ */ h(K, { customFolderId: z }),
456
- /* @__PURE__ */ h(x, {
457
- size: "xs",
458
- c: "dimmed",
459
- mt: "md",
460
- children: i("instructions")
461
- }),
462
- I && /* @__PURE__ */ h(_, {
463
- variant: "light",
464
- onClick: N,
465
- "aria-label": i("addFolder"),
466
- children: /* @__PURE__ */ h(o, {
467
- name: "VscAdd",
468
- size: 16
469
- })
470
- })
471
- ]
472
- })
473
- ]
474
- })
475
- });
476
- }, Y = (e) => {
477
- let t = r((e) => e.addAppToFolder), n = r((e) => e.removeAppFromFolder);
478
- return /* @__PURE__ */ g(P, {
479
- onDrop: l((e, r) => {
480
- if (e.type === "app") {
481
- if (r.type === "available-apps") {
482
- e.sourceType === "launcher-folder" && n(e.id, e.sourceId);
483
- return;
484
- }
485
- r.type === "launcher-folder" && (e.sourceId !== r.id && e.sourceType === "launcher-folder" && n(e.id, e.sourceId), t(e.id, r.id));
486
- }
487
- }, [t, n]),
488
- children: [/* @__PURE__ */ h(J, { ...e }), /* @__PURE__ */ h(B, {})]
489
- });
490
- };
491
- //#endregion
492
- export { F as a, I as i, U as n, P as o, L as r, M as s, Y as t };
@@ -1 +0,0 @@
1
- const e=require(`./NotesApp-BmQIBtJ2.cjs`),t=require(`./AppMenuBar-CAlkNHjj.cjs`),n=require(`./menuEditStore-CYwtfD6H.cjs`),r=require(`./useMenuBarUtils-DAap0ukp.cjs`);let i=require(`react`),a=require(`react/jsx-runtime`),o=require(`react-i18next`);var s=e=>{let{windowId:t,contentData:a,onExit:s}=e,{t:c}=(0,o.useTranslation)(`menuedit`),{t:l}=(0,o.useTranslation)(`common`),u=n.t(t),d=a?.createFolder,f=a?.save,p=a?.discard;return(0,i.useMemo)(()=>r.t([{type:`menu`,label:l(`menu.file`),items:[{type:`item`,label:c(`newFolder`),icon:`FcPlus`,onClick:()=>d?.()},{type:`divider`},{type:`item`,label:l(`actions.save`),icon:`FcInspection`,onClick:()=>f?.(),disabled:!u},{type:`item`,label:l(`actions.discard`),icon:`FcCancel`,onClick:()=>p?.(),disabled:!u},{type:`divider`},{type:`item`,label:l(`actions.exit`),icon:`FcLeft`,onClick:s}]}],u),[c,l,u,d,f,p,s])},c=e.i({MenuEditMenuBar:()=>l}),l=(0,i.memo)(({windowId:e,contentData:n,onExit:r})=>(0,a.jsx)(t.t,{elements:s({windowId:e,contentData:n,onExit:r})}));l.displayName=`MenuEditMenuBar`,Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
@@ -1,60 +0,0 @@
1
- import { t as e } from "./rolldown-runtime-CAFD8bLK.js";
2
- import { t } from "./AppMenuBar-DmSfQRXU.js";
3
- import { t as n } from "./menuEditStore-CxsgLiQu.js";
4
- import { t as r } from "./useMenuBarUtils-ChAfI7OA.js";
5
- import { memo as i, useMemo as a } from "react";
6
- import { jsx as o } from "react/jsx-runtime";
7
- import { useTranslation as s } from "react-i18next";
8
- //#region src/components/Apps/MenuEditApp/useMenuEditMenuBar.ts
9
- var c = (e) => {
10
- let { windowId: t, contentData: i, onExit: o } = e, { t: c } = s("menuedit"), { t: l } = s("common"), u = n(t), d = i?.createFolder, f = i?.save, p = i?.discard;
11
- return a(() => r([{
12
- type: "menu",
13
- label: l("menu.file"),
14
- items: [
15
- {
16
- type: "item",
17
- label: c("newFolder"),
18
- icon: "FcPlus",
19
- onClick: () => d?.()
20
- },
21
- { type: "divider" },
22
- {
23
- type: "item",
24
- label: l("actions.save"),
25
- icon: "FcInspection",
26
- onClick: () => f?.(),
27
- disabled: !u
28
- },
29
- {
30
- type: "item",
31
- label: l("actions.discard"),
32
- icon: "FcCancel",
33
- onClick: () => p?.(),
34
- disabled: !u
35
- },
36
- { type: "divider" },
37
- {
38
- type: "item",
39
- label: l("actions.exit"),
40
- icon: "FcLeft",
41
- onClick: o
42
- }
43
- ]
44
- }], u), [
45
- c,
46
- l,
47
- u,
48
- d,
49
- f,
50
- p,
51
- o
52
- ]);
53
- }, l = /* @__PURE__ */ e({ MenuEditMenuBar: () => u }), u = i(({ windowId: e, contentData: n, onExit: r }) => /* @__PURE__ */ o(t, { elements: c({
54
- windowId: e,
55
- contentData: n,
56
- onExit: r
57
- }) }));
58
- u.displayName = "MenuEditMenuBar";
59
- //#endregion
60
- export { l as n, u as t };
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const l=require(`./desktopStore-C1jR6Fdb.cjs`),u=require(`./useCloseInterceptor-CdX-09Ib.cjs`),d=require(`./VscIcon-BYb_Soyy.cjs`),f=require(`./FilePickerApp-By6-vbag.cjs`),p=require(`./notesStore-CrWTO6oB.cjs`);let m=require(`react`),h=require(`react/jsx-runtime`),g=require(`zustand`),_=require(`zustand/middleware`),v=require(`react-i18next`),y=require(`@tiptap/react`),b=require(`@tiptap/starter-kit`);b=c(b);let x=require(`@tiptap/markdown`),S=require(`@tiptap/core`);var C=(0,g.create)()((0,_.persist)((e,t)=>({snapshots:{},setSnapshot:(t,n)=>e(e=>({snapshots:{...e.snapshots,[t]:n}})),getSnapshot:e=>{let{snapshots:n}=t();return n[e]??null},clearSnapshot:t=>e(e=>{let n={...e.snapshots};return delete n[t],{snapshots:n}})}),{name:`fde-desktop:appTempMemory`,storage:(0,_.createJSONStorage)(()=>localStorage)})),w={container:`_container_3xue5_1`,toolbar:`_toolbar_3xue5_11`,toolbarBtn:`_toolbarBtn_3xue5_22`,active:`_active_3xue5_57`,separator:`_separator_3xue5_63`,editorContent:`_editorContent_3xue5_71`},T=o({default:()=>k}),E=[...l.b],D=S.Extension.create({name:`clearMarksOnEnter`,addKeyboardShortcuts(){return{Enter:({editor:e})=>{let{state:t,dispatch:n}=e.view,{selection:r,schema:i}=t,{$from:a,empty:o}=r;return!o||a.parent.type!==i.nodes.paragraph?!1:(n(t.tr.split(a.pos).setStoredMarks([])),!0)}}}}),O=`Desktop/NotesAppWelcome.md`,k=({window:e,notifyReady:t})=>{let{t:n}=(0,v.useTranslation)(`notes`),r=e,i=r?.id,a=i?`notesApp-${i}`:`notesApp`,o=r?.contentData,[s,c]=(0,m.useState)(o?.initialName??n(`untitled`)),[g,_]=(0,m.useState)(!1),S=(0,m.useRef)(`save`),[T,k]=(0,m.useState)(o?.fileId??null),A=(0,m.useRef)(o?.initialContent??``),[j,M]=(0,m.useState)(!1),N=p.n(e=>e.states[i??``]?.contentLoaded??!1),P=p.n(e=>e.setContentLoaded);(0,m.useEffect)(()=>{i&&p.n.getState().reset(i)},[i]),(0,m.useEffect)(()=>{i&&p.n.getState().setIsDirty(i,j)},[i,j]);let F=l.o(e=>e.createFile),I=l.o(e=>e.updateFile),L=l.o(e=>e.fsNodes),R=(0,y.useEditor)({extensions:[b.default,x.Markdown,D],content:o?.initialContent??``,contentType:`markdown`,shouldRerenderOnTransaction:!1,onCreate:()=>{let e=R?.getMarkdown()??``;A.current=e,a&&C.getState().setSnapshot(a,e)},onUpdate:()=>{let e=R?.getMarkdown()??``,t=e!==(A.current??``);M(t),!t&&a&&C.getState().setSnapshot(a,e)}});(0,m.useEffect)(()=>{if(!T||!R||N)return;let e=L.find(e=>e.id===T);if(!e||e.type!==`file`)return;let t=e;t.content&&t.content!==(A.current??``)&&(A.current=t.content,a&&C.getState().setSnapshot(a,t.content),R.commands.setContent(t.content,{emitUpdate:!1,contentType:`markdown`}),P(i,!0))},[T,R,a,L,N,i,P]),(0,m.useEffect)(()=>{if(!R||!i||N)return;let e=!1,t=new AbortController;return(async()=>{try{if(o?.initialContent){e||(R.commands.setContent(o.initialContent,{emitUpdate:!1,contentType:`markdown`}),P(i,!0));return}if(o?.url){let n=await l.a(o.url,t.signal);!e&&n&&(R.commands.setContent(n,{emitUpdate:!1,contentType:`markdown`}),P(i,!0));return}if(o?.fileId)return;let n=await fetch(`/${O}`,{signal:t.signal});if(!e&&n.ok){let e=await n.text();R.commands.setContent(e,{emitUpdate:!1,contentType:`markdown`}),P(i,!0)}}catch(t){!e&&t instanceof Error&&t.name!==`AbortError`&&console.warn(`Failed to load content:`,t)}})(),()=>{e=!0,t.abort()}},[R,o,i,N,P]);let z=(0,m.useCallback)(()=>R?R.getMarkdown():``,[R]),B=(0,m.useCallback)(()=>{R?.commands.setContent(``,{emitUpdate:!1,contentType:`markdown`}),k(null),c(`untitled.md`),A.current=``,M(!1),i&&P(i,!0)},[R,i,P]),V=(0,m.useCallback)(()=>{R&&(T?(I(T,z()),A.current=z(),M(!1)):(S.current=`save`,_(!0)))},[R,z,I,T]),H=(0,m.useCallback)(()=>{R&&(S.current=`saveAs`,_(!0))},[R]),U=(0,m.useCallback)(async({parentId:e,name:t})=>{if(!R)return;let n=z();if(S.current===`saveAs`||!T){let r=await F(t,n,e);k(r.id),c(r.name)}else await I(T,n);A.current=n,M(!1),_(!1)},[R,z,F,I,T]),[W,G]=(0,m.useState)(!1),K=(0,m.useCallback)(e=>{k(e.id),c(e.name),A.current=e.content??``,M(!1),G(!1);let t=e.url;t?l.a(t).then(e=>{e&&(R?.commands.setContent(e,{emitUpdate:!1,contentType:`markdown`}),i&&P(i,!0))}):e.content&&(R?.commands.setContent(e.content,{emitUpdate:!1,contentType:`markdown`}),i&&P(i,!0))},[R,i,P]),q=(0,m.useCallback)(()=>G(!0),[]);(0,m.useEffect)(()=>{let e={new:B,save:V,saveAs:H};t?.({...r?.contentData??{},actions:e,setPickerOpen:q,isDirty:j})},[B,V,H,r,t,q,j]),u.i({isDirtyGetter:(0,m.useCallback)(()=>(R?.getMarkdown()??``)!==(A.current??``),[R]),windowId:i,onDiscard:()=>{if(!R)return;let e=A.current??``;R.commands.setContent(e,{emitUpdate:!1,contentType:`markdown`}),M(!1)},onSave:V});let J=(0,y.useEditorState)({editor:R,selector:e=>({canUndo:e.editor?.can().undo()??!1,canRedo:e.editor?.can().redo()??!1,isBold:e.editor?.isActive(`bold`)??!1,isItalic:e.editor?.isActive(`italic`)??!1,isStrike:e.editor?.isActive(`strike`)??!1,isCode:e.editor?.isActive(`code`)??!1,isH1:e.editor?.isActive(`heading`,{level:1})??!1,isH2:e.editor?.isActive(`heading`,{level:2})??!1,isBulletList:e.editor?.isActive(`bulletList`)??!1,isOrderedList:e.editor?.isActive(`orderedList`)??!1,isBlockquote:e.editor?.isActive(`blockquote`)??!1,isCodeBlock:e.editor?.isActive(`codeBlock`)??!1})});return(0,h.jsxs)(`div`,{className:w.container,"data-windowid":r?.id,children:[(0,h.jsxs)(`div`,{className:w.toolbar,role:`toolbar`,"aria-label":n(`toolbar.formatting`),children:[(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isBold?w.active:``}`,onClick:()=>R?.chain().focus().toggleBold().run(),disabled:!R?.can().chain().focus().toggleBold().run(),title:n(`toolbar.bold`),"aria-label":n(`toolbar.bold`),children:(0,h.jsx)(d.t,{name:`VscBold`})}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isItalic?w.active:``}`,onClick:()=>R?.chain().focus().toggleItalic().run(),disabled:!R?.can().chain().focus().toggleItalic().run(),title:n(`toolbar.italic`),"aria-label":n(`toolbar.italic`),children:(0,h.jsx)(d.t,{name:`VscItalic`})}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isStrike?w.active:``}`,onClick:()=>R?.chain().focus().toggleStrike().run(),disabled:!R?.can().chain().focus().toggleStrike().run(),title:n(`toolbar.strikethrough`),"aria-label":n(`toolbar.strikethrough`),children:(0,h.jsx)(`s`,{children:`S`})}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isCode?w.active:``}`,onClick:()=>R?.chain().focus().toggleCode().run(),disabled:!R?.can().chain().focus().toggleCode().run(),title:n(`toolbar.inlineCode`),"aria-label":n(`toolbar.inlineCode`),children:(0,h.jsx)(d.t,{name:`VscCode`})}),(0,h.jsx)(`span`,{className:w.separator}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isH1?w.active:``}`,onClick:()=>R?.chain().focus().toggleHeading({level:1}).run(),title:n(`toolbar.heading1`),"aria-label":n(`toolbar.heading1`),children:(0,h.jsx)(`strong`,{children:`H1`})}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isH2?w.active:``}`,onClick:()=>R?.chain().focus().toggleHeading({level:2}).run(),title:n(`toolbar.heading2`),"aria-label":n(`toolbar.heading2`),children:(0,h.jsx)(`strong`,{children:`H2`})}),(0,h.jsx)(`span`,{className:w.separator}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isBulletList?w.active:``}`,onClick:()=>R?.chain().focus().toggleBulletList().run(),title:n(`toolbar.bulletList`),"aria-label":n(`toolbar.bulletList`),children:(0,h.jsx)(d.t,{name:`VscListUnordered`})}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isOrderedList?w.active:``}`,onClick:()=>R?.chain().focus().toggleOrderedList().run(),title:n(`toolbar.orderedList`),"aria-label":n(`toolbar.orderedList`),children:(0,h.jsx)(d.t,{name:`VscListOrdered`})}),(0,h.jsx)(`span`,{className:w.separator}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isBlockquote?w.active:``}`,onClick:()=>R?.chain().focus().toggleBlockquote().run(),title:n(`toolbar.blockquote`),"aria-label":n(`toolbar.blockquote`),children:(0,h.jsx)(d.t,{name:`VscQuote`})}),(0,h.jsx)(`button`,{className:`${w.toolbarBtn} ${J?.isCodeBlock?w.active:``}`,onClick:()=>R?.chain().focus().toggleCodeBlock().run(),title:n(`toolbar.codeBlock`),"aria-label":n(`toolbar.codeBlock`),children:(0,h.jsx)(d.t,{name:`VscTerminal`})}),(0,h.jsx)(`button`,{className:w.toolbarBtn,onClick:()=>R?.chain().focus().setHorizontalRule().run(),title:n(`toolbar.horizontalRule`),"aria-label":n(`toolbar.horizontalRule`),children:(0,h.jsx)(d.t,{name:`VscHorizontalRule`})}),(0,h.jsx)(`span`,{className:w.separator}),(0,h.jsx)(`button`,{className:w.toolbarBtn,onClick:()=>R?.chain().focus().undo().run(),disabled:!J?.canUndo,title:n(`common:actions.undo`),"aria-label":n(`common:actions.undo`),children:(0,h.jsx)(d.t,{name:`VscDiscard`})}),(0,h.jsx)(`button`,{className:w.toolbarBtn,onClick:()=>R?.chain().focus().redo().run(),disabled:!J?.canRedo,title:n(`common:actions.redo`),"aria-label":n(`common:actions.redo`),children:(0,h.jsx)(d.t,{name:`VscRedo`})})]}),(0,h.jsx)(y.EditorContent,{editor:R,className:w.editorContent}),(0,h.jsx)(f.n,{opened:W,acceptedMimeTypes:E,onConfirm:K,onCancel:()=>G(!1)}),(0,h.jsx)(f.r,{opened:g,initialName:s,onConfirm:U,onCancel:()=>_(!1)})]})};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});