@fde-desktop/fde-core 0.4.9 → 0.4.11
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/{AppEmptyState-Bxpit0JV.js → AppEmptyState-Boej96TB.js} +1 -1
- package/dist/AppEmptyState-CLc00OOG.cjs +1 -0
- package/dist/AppIcon-C8vHUVcb.cjs +1 -0
- package/dist/AppIcon-mtEoyzOb.js +22 -0
- package/dist/AppMenuBar-CAlkNHjj.cjs +1 -0
- package/dist/AppMenuBar-DmSfQRXU.js +197 -0
- package/dist/CalendarApp-DOmjWbpl.js +10 -0
- package/dist/CalendarApp-Z0bCCYsK.cjs +1 -0
- package/dist/ColorPicker-CQRRwY-y.cjs +1 -0
- package/dist/ColorPicker-WCeD3Wjf.js +35 -0
- package/dist/CreateItemApp-BkFFFdX1.cjs +1 -0
- package/dist/CreateItemApp-DR8Y4bwo.js +202 -0
- package/dist/DeviceInfoApp-BXQ9uOwF.cjs +1 -0
- package/dist/DeviceInfoApp-I63mJRWy.js +195 -0
- package/dist/DownloadProgress-CkTGTf0z.cjs +1 -0
- package/dist/DownloadProgress-DnVASsv5.js +39 -0
- package/dist/FilePickerApp-By6-vbag.cjs +1 -0
- package/dist/FilePickerApp-ClHuhm6Z.js +390 -0
- package/dist/FilesApp-BC4UPNuw.cjs +1 -0
- package/dist/FilesApp-D8MqvC5X.js +210 -0
- package/dist/ImageViewerApp-B1niWF75.cjs +1 -0
- package/dist/{ImageViewerApp-BaLP3gkO.js → ImageViewerApp-iojtyFEf.js} +5 -5
- package/dist/{ImageViewerMenuBar-CabGSi9r.js → ImageViewerMenuBar-BIsUokxV.js} +2 -2
- package/dist/ImageViewerMenuBar-BgzgSF3v.cjs +1 -0
- package/dist/MenuEditApp-BHptoJbz.cjs +1 -0
- package/dist/{MenuEditApp-BTRppYnD.js → MenuEditApp-CJUbJaqh.js} +138 -143
- package/dist/MenuEditMenuBar-CCOSPAUe.cjs +1 -0
- package/dist/{MenuEditMenuBar-x1IQrHP2.js → MenuEditMenuBar-DnCL-kaZ.js} +3 -3
- package/dist/NotesApp-BmQIBtJ2.cjs +1 -0
- package/dist/{NotesApp-CQe7UfBC.js → NotesApp-DJ2dGt4-.js} +5 -5
- package/dist/NotesMenuBar-BzojwMtH.cjs +1 -0
- package/dist/{NotesMenuBar-VhpIe68v.js → NotesMenuBar-DILZTjnT.js} +3 -3
- package/dist/{PdfApp-DL_R9-Nc.js → PdfApp-IjY_GtnW.js} +3 -3
- package/dist/PdfApp-krW8UI97.cjs +1 -0
- package/dist/{PdfMenuBar-DZCLSOpR.js → PdfMenuBar-Bd5MTZcZ.js} +1 -1
- package/dist/PdfMenuBar-DWD0Qa3F.cjs +1 -0
- package/dist/SettingsApp-BE22l5UP.cjs +1 -0
- package/dist/SettingsApp-BTFtTFY_.js +1228 -0
- package/dist/SettingsMenuBar-CZE2evG2.cjs +1 -0
- package/dist/{SettingsMenuBar-YWiJHaxq.js → SettingsMenuBar-ktC0viTd.js} +3 -3
- package/dist/UploaderApp-CbypD538.js +263 -0
- package/dist/UploaderApp-D_qD3O70.cjs +1 -0
- package/dist/{VscIcon-DBfVnArE.js → VscIcon-AEENjKOE.js} +1 -1
- package/dist/VscIcon-BYb_Soyy.cjs +1 -0
- package/dist/buildBreadcrumbs-Ccd8i11b.cjs +1 -0
- package/dist/buildBreadcrumbs-noWhu8os.js +45 -0
- package/dist/{desktopStore-F8bgLqFl.js → desktopStore-8cSZlj7s.js} +407 -477
- package/dist/desktopStore-C1jR6Fdb.cjs +1 -0
- package/dist/imageViewerStore-Dfylg59V.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +16 -6
- package/dist/index.js +1646 -1960
- package/dist/menuEditStore-CYwtfD6H.cjs +1 -0
- package/dist/notesStore-CrWTO6oB.cjs +1 -0
- package/dist/settingsAppStore-DuYZNeFf.cjs +1 -0
- package/dist/useAdaptiveDimensions-3Lz4X0Tc.cjs +1 -0
- package/dist/{useAdaptiveDimensions-AVDc_qPa.js → useAdaptiveDimensions-DxNLJ7R5.js} +1 -1
- package/dist/{useCloseInterceptor-BZd3VILp.js → useCloseInterceptor-CIxhOZx1.js} +1 -1
- package/dist/useCloseInterceptor-CdX-09Ib.cjs +1 -0
- package/dist/useDynamicIcon-CK6SjEv5.cjs +1 -0
- package/dist/useOpenApp-D-FOY88T.cjs +1 -0
- package/dist/{useOpenApp-CBIm7Gzl.js → useOpenApp-DkZLFFCH.js} +51 -67
- package/dist/{useResolvedUrl-DQpLqOoL.js → useResolvedUrl-B6x4xy0x.js} +1 -2
- package/dist/useResolvedUrl-Bb39DpVy.cjs +1 -0
- package/package.json +2 -1
- package/dist/AccordionChevron-DxpOyInK.js +0 -26
- package/dist/AccordionChevron-kn5kSrEc.cjs +0 -1
- package/dist/ActionIcon-Drh4p6Fv.js +0 -145
- package/dist/ActionIcon-alk2zZD6.cjs +0 -1
- package/dist/AppEmptyState-BWCUbf-B.cjs +0 -1
- package/dist/AppIcon-BU7a3ZNH.cjs +0 -1
- package/dist/AppIcon-XumS3bIG.js +0 -80
- package/dist/AppMenuBar-B9U0n1Vv.cjs +0 -1
- package/dist/AppMenuBar-CnIEVjr8.js +0 -2049
- package/dist/Box-DSKR_qaa.js +0 -1579
- package/dist/Box-zW6Twge8.cjs +0 -1
- package/dist/Button-DMlnrqyx.cjs +0 -1
- package/dist/Button-wTOTQKxF.js +0 -178
- package/dist/CalendarApp-B_e1B1Yn.cjs +0 -1
- package/dist/CalendarApp-C-l9D6nd.cjs +0 -1
- package/dist/CalendarApp-D0ftTCTG.js +0 -1399
- package/dist/Center-CmxXB9ql.js +0 -25
- package/dist/Center-DKUE2pER.cjs +0 -1
- package/dist/CheckIcon-CZhtJD1O.cjs +0 -1
- package/dist/CheckIcon-N5qBqXQJ.js +0 -25
- package/dist/CodeServerApp-BOoGwZ7r.cjs +0 -1
- package/dist/CodeServerApp-Be3I5EGg.cjs +0 -1
- package/dist/CodeServerApp-DW18EZxa.js +0 -150
- package/dist/ColorPicker-BCNqi02x.js +0 -997
- package/dist/ColorPicker-BrDE7tMO.cjs +0 -1
- package/dist/CreateItemApp-B12M1E_1.cjs +0 -1
- package/dist/CreateItemApp-TAAprby3.js +0 -400
- package/dist/CreateItemApp-ePB6ujNl.cjs +0 -1
- package/dist/DeviceInfoApp-BMF18BGo.cjs +0 -1
- package/dist/DeviceInfoApp-DRy0H3aT.cjs +0 -1
- package/dist/DeviceInfoApp-lgpwkeRR.js +0 -223
- package/dist/DownloadProgress-EoyCaD5O.js +0 -174
- package/dist/DownloadProgress-VNdj22U8.cjs +0 -1
- package/dist/FileIcon-7JaSR3Gn.js +0 -89
- package/dist/FileIcon-CIXopWLv.cjs +0 -1
- package/dist/FilePickerApp-DaMgEqKh.js +0 -409
- package/dist/FilePickerApp-DjmuSFqa.cjs +0 -1
- package/dist/FilesApp-Bp7wfrBZ.cjs +0 -1
- package/dist/FilesApp-BpJJRKhi.cjs +0 -1
- package/dist/FilesApp-Cj94QG5o.js +0 -225
- package/dist/Group-CtBJSfCo.js +0 -48
- package/dist/Group-Dsrf6lEK.cjs +0 -1
- package/dist/ImageViewerApp-DlHGeB3S.cjs +0 -1
- package/dist/ImageViewerApp-DoXd_Swu.cjs +0 -1
- package/dist/ImageViewerMenuBar-SAI7UNz7.cjs +0 -1
- package/dist/ImageViewerMenuBar-_Jr29gii.cjs +0 -1
- package/dist/MenuEditApp-BJjlPTOa.cjs +0 -1
- package/dist/MenuEditApp-JPsGT-S3.cjs +0 -1
- package/dist/MenuEditMenuBar-BydGkqMw.cjs +0 -1
- package/dist/MenuEditMenuBar-DptlwVPQ.cjs +0 -1
- package/dist/NotesApp-BOcRGO7w.cjs +0 -1
- package/dist/NotesApp-OL07JXRE.cjs +0 -1
- package/dist/NotesMenuBar-BSI_2Y7p.cjs +0 -1
- package/dist/NotesMenuBar-Df6aW85J.cjs +0 -1
- package/dist/Paper-BX_9odR6.js +0 -30
- package/dist/Paper-D8-BaBx2.cjs +0 -1
- package/dist/PdfApp-CNEbty5v.cjs +0 -1
- package/dist/PdfApp-CVv3ZCaM.cjs +0 -1
- package/dist/PdfMenuBar--E6kDyrT.cjs +0 -1
- package/dist/PdfMenuBar-Dj5cJUkg.cjs +0 -1
- package/dist/SettingsApp-BlmHuAjT.js +0 -1831
- package/dist/SettingsApp-CNvIgf5B.cjs +0 -1
- package/dist/SettingsApp-DWxanNE4.cjs +0 -1
- package/dist/SettingsMenuBar-CBoOBCfx.cjs +0 -1
- package/dist/SettingsMenuBar-DQooFkZN.cjs +0 -1
- package/dist/Slider-BUiHxjKO.cjs +0 -1
- package/dist/Slider-t-NcD60t.js +0 -1176
- package/dist/Stack-Bp1Ek2Gp.js +0 -34
- package/dist/Stack-D4jAiRfc.cjs +0 -1
- package/dist/StorybookApp-CDLV_kja.cjs +0 -1
- package/dist/StorybookApp-DKwlPCmo.js +0 -10
- package/dist/TerminalApp-BCB7i1lR.cjs +0 -1
- package/dist/TerminalApp-BYc_gHLe.js +0 -326
- package/dist/TerminalApp-Dviz6aP2.cjs +0 -1
- package/dist/TerminalMenuBar-D5tPmgR_.js +0 -113
- package/dist/TerminalMenuBar-DNshPmCa.cjs +0 -1
- package/dist/TerminalMenuBar-HzMSR7XP.cjs +0 -1
- package/dist/TextInput-C-JtGWn1.js +0 -981
- package/dist/TextInput-CrsmcOip.cjs +0 -1
- package/dist/Tooltip-D5Cd9wtz.cjs +0 -1
- package/dist/Tooltip-DOeIvhrO.js +0 -1142
- package/dist/UnstyledButton-DGaG-e_G.js +0 -25
- package/dist/UnstyledButton-DX2pTahr.cjs +0 -1
- package/dist/UploaderApp-C6xA5Rrf2.cjs +0 -1
- package/dist/UploaderApp-DnHIRxB_.cjs +0 -1
- package/dist/UploaderApp-qBfpukR_.js +0 -488
- package/dist/VscIcon-CcMdrFoJ.cjs +0 -1
- package/dist/create-safe-context-Bboj0GWC.cjs +0 -1
- package/dist/create-safe-context-XT2cxc14.js +0 -12
- package/dist/desktopStore-CZoA9VHO.cjs +0 -1
- package/dist/getRuntime-BFK0-8R1.cjs +0 -1
- package/dist/getRuntime-DAPqFH2W.js +0 -63
- package/dist/imageViewerStore-BB_tssZR.cjs +0 -1
- package/dist/is-element-Bu_JY8Qy.js +0 -7
- package/dist/is-element-CdV0xajp.cjs +0 -1
- package/dist/menuEditStore-CTeM_dns.cjs +0 -1
- package/dist/notesStore-BCEl1D_v.cjs +0 -1
- package/dist/settingsAppStore-CMBc13VU.cjs +0 -1
- package/dist/terminalStore-IWdf4Mm6.js +0 -30
- package/dist/terminalStore-iIuyodfK.cjs +0 -1
- package/dist/use-merged-ref-BT8_u6vW.js +0 -25
- package/dist/use-merged-ref-n9Gw9LNn.cjs +0 -1
- package/dist/use-resolved-styles-api-8OXE2oRq.cjs +0 -1
- package/dist/use-resolved-styles-api-DNUlJJZf.js +0 -21
- package/dist/use-uncontrolled-A4hm9ATM.js +0 -23
- package/dist/use-uncontrolled-DDJVQiM_.cjs +0 -1
- package/dist/useAdaptiveDimensions-CfITBJ_m.cjs +0 -1
- package/dist/useCloseInterceptor-yntBEzNc.cjs +0 -1
- package/dist/useDynamicIcon-DJ_il30E.cjs +0 -1
- package/dist/useOpenApp-DW4x79Zg.cjs +0 -1
- package/dist/useResolvedUrl-BkMPM1fM.cjs +0 -1
- /package/dist/{Colors-zP2AFgU3.cjs → Colors-CNJbU7oq.cjs} +0 -0
- /package/dist/{Colors-ClnDxnyA.js → Colors-CuABn2W4.js} +0 -0
- /package/dist/{imageViewerStore-C5kWz0o7.js → imageViewerStore-COrD02Zu.js} +0 -0
- /package/dist/{menuEditStore-Cj1zAwxQ.js → menuEditStore-CxsgLiQu.js} +0 -0
- /package/dist/{notesStore-BPyRTHEc.js → notesStore-Dgah46U5.js} +0 -0
- /package/dist/{settingsAppStore-BDQ3ts1y.js → settingsAppStore-DHZhi6Rl.js} +0 -0
- /package/dist/{useDynamicIcon-Bf0t2foA.js → useDynamicIcon-_wGeWu-b.js} +0 -0
- /package/dist/{useMenuBarUtils-nmu9yehT.js → useMenuBarUtils-ChAfI7OA.js} +0 -0
- /package/dist/{useMenuBarUtils-nJIPJGIQ.cjs → useMenuBarUtils-DAap0ukp.cjs} +0 -0
|
@@ -1,44 +1,146 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { create as e } from "zustand";
|
|
2
|
+
import { createJSONStorage as t, persist as n } from "zustand/middleware";
|
|
3
|
+
import { v4 as r, v4 as i } from "uuid";
|
|
4
|
+
//#region src/constants/coreApps.ts
|
|
5
|
+
var a = {
|
|
6
|
+
defaultWidth: 800,
|
|
7
|
+
defaultHeight: 600,
|
|
8
|
+
minWidth: 640,
|
|
9
|
+
minHeight: 480
|
|
10
|
+
}, o = [
|
|
11
|
+
{
|
|
12
|
+
id: "files",
|
|
13
|
+
name: "FilesApp",
|
|
14
|
+
icon: "📁",
|
|
15
|
+
fcIcon: "FcOpenedFolder",
|
|
16
|
+
hasContextMenu: !0,
|
|
17
|
+
...a
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "settings",
|
|
21
|
+
name: "Settings",
|
|
22
|
+
icon: "⚙️",
|
|
23
|
+
fcIcon: "FcSettings",
|
|
24
|
+
singleWindow: !0,
|
|
25
|
+
...a
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "notepad",
|
|
29
|
+
name: "Notepad",
|
|
30
|
+
icon: "📝",
|
|
31
|
+
fcIcon: "FcEditImage",
|
|
32
|
+
...a
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "image-viewer",
|
|
36
|
+
name: "Image Viewer",
|
|
37
|
+
icon: "🖼️",
|
|
38
|
+
fcIcon: "FcPicture",
|
|
39
|
+
defaultWidth: 700,
|
|
40
|
+
defaultHeight: 520,
|
|
41
|
+
minWidth: 640,
|
|
42
|
+
minHeight: 480
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "pdf",
|
|
46
|
+
name: "PDF Viewer",
|
|
47
|
+
icon: "📄",
|
|
48
|
+
fcIcon: "FcDocument",
|
|
49
|
+
defaultWidth: 780,
|
|
50
|
+
defaultHeight: 580,
|
|
51
|
+
minWidth: 640,
|
|
52
|
+
minHeight: 480
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "uploader",
|
|
56
|
+
name: "Uploader",
|
|
57
|
+
icon: "📤",
|
|
58
|
+
fcIcon: "FcUpload",
|
|
59
|
+
...a
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "menuedit",
|
|
63
|
+
name: "MenuEdit",
|
|
64
|
+
icon: "📁",
|
|
65
|
+
fcIcon: "FcFolder",
|
|
66
|
+
singleWindow: !0,
|
|
67
|
+
...a
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "device-info",
|
|
71
|
+
name: "Device Info",
|
|
72
|
+
icon: "📊",
|
|
73
|
+
fcIcon: "FcBarChart",
|
|
74
|
+
defaultWidth: 300,
|
|
75
|
+
defaultHeight: 400,
|
|
76
|
+
minWidth: 280,
|
|
77
|
+
minHeight: 350,
|
|
78
|
+
canMaximize: !1,
|
|
79
|
+
alwaysOnTop: !0,
|
|
80
|
+
singleWindow: !0
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "calendar",
|
|
84
|
+
name: "Calendar",
|
|
85
|
+
icon: "📅",
|
|
86
|
+
fcIcon: "FcCalendar",
|
|
87
|
+
defaultWidth: 320,
|
|
88
|
+
defaultHeight: 370,
|
|
89
|
+
minWidth: !1,
|
|
90
|
+
minHeight: !1,
|
|
91
|
+
canMaximize: !1,
|
|
92
|
+
singleWindow: !0
|
|
93
|
+
}
|
|
94
|
+
], s = o.map((e) => e.id), c = [...o], l = [
|
|
95
|
+
"uploader",
|
|
96
|
+
"settings",
|
|
97
|
+
"notepad",
|
|
98
|
+
"files"
|
|
99
|
+
];
|
|
100
|
+
function u(e) {
|
|
101
|
+
for (let t of e) c.find((e) => e.id === t.id) || c.push(t);
|
|
102
|
+
}
|
|
103
|
+
function d(e) {
|
|
104
|
+
for (let t of e) l.includes(t) || l.push(t);
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
5
107
|
//#region src/utils/uuid.ts
|
|
6
|
-
function
|
|
7
|
-
return
|
|
108
|
+
function f() {
|
|
109
|
+
return r();
|
|
8
110
|
}
|
|
9
111
|
//#endregion
|
|
10
112
|
//#region src/domain/entities/Window.ts
|
|
11
|
-
var
|
|
113
|
+
var p = (e) => ({
|
|
12
114
|
alwaysOnTop: !1,
|
|
13
115
|
...e,
|
|
14
|
-
id:
|
|
116
|
+
id: f(),
|
|
15
117
|
isOpen: !0,
|
|
16
118
|
state: "normal",
|
|
17
119
|
zIndex: 0
|
|
18
|
-
}),
|
|
120
|
+
}), m = (e) => ({
|
|
19
121
|
...e,
|
|
20
|
-
id:
|
|
21
|
-
}),
|
|
22
|
-
id:
|
|
122
|
+
id: f()
|
|
123
|
+
}), h = (e) => ({
|
|
124
|
+
id: f(),
|
|
23
125
|
name: e.name,
|
|
24
126
|
fcIcon: e.fcIcon,
|
|
25
127
|
appIds: e.appIds ?? [],
|
|
26
128
|
isExpanded: e.isExpanded ?? !1,
|
|
27
129
|
isPredefined: e.isPredefined ?? !1,
|
|
28
130
|
order: e.order ?? 0
|
|
29
|
-
}),
|
|
30
|
-
id:
|
|
131
|
+
}), ee = (e) => ({
|
|
132
|
+
id: f(),
|
|
31
133
|
name: e.name,
|
|
32
134
|
fcIcon: e.fcIcon,
|
|
33
135
|
appIds: e.appIds ?? [],
|
|
34
136
|
isExpanded: e.isExpanded ?? !1,
|
|
35
137
|
isPredefined: !0,
|
|
36
138
|
order: e.order ?? 0
|
|
37
|
-
}),
|
|
139
|
+
}), g = (e, t) => ({
|
|
38
140
|
...e,
|
|
39
141
|
...t
|
|
40
|
-
}),
|
|
41
|
-
id:
|
|
142
|
+
}), _ = (e, t = null, n = {}) => ({
|
|
143
|
+
id: f(),
|
|
42
144
|
name: e,
|
|
43
145
|
type: "folder",
|
|
44
146
|
parentId: t,
|
|
@@ -46,8 +148,8 @@ var c = (e) => ({
|
|
|
46
148
|
createdAt: /* @__PURE__ */ new Date(),
|
|
47
149
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
48
150
|
...n
|
|
49
|
-
}),
|
|
50
|
-
id:
|
|
151
|
+
}), v = (e, t, n = null, r, i) => ({
|
|
152
|
+
id: f(),
|
|
51
153
|
name: e,
|
|
52
154
|
type: "file",
|
|
53
155
|
content: t,
|
|
@@ -56,12 +158,12 @@ var c = (e) => ({
|
|
|
56
158
|
createdAt: /* @__PURE__ */ new Date(),
|
|
57
159
|
updatedAt: /* @__PURE__ */ new Date(),
|
|
58
160
|
...i === void 0 ? {} : { url: i }
|
|
59
|
-
}),
|
|
161
|
+
}), y = 1e4, te = class {
|
|
60
162
|
windows = /* @__PURE__ */ new Map();
|
|
61
163
|
nextZIndex = 1;
|
|
62
164
|
assignZIndex(e) {
|
|
63
165
|
let t = this.nextZIndex++;
|
|
64
|
-
return e ?
|
|
166
|
+
return e ? y + t : t;
|
|
65
167
|
}
|
|
66
168
|
reset() {
|
|
67
169
|
this.windows.clear(), this.nextZIndex = 1;
|
|
@@ -71,7 +173,7 @@ var c = (e) => ({
|
|
|
71
173
|
let t = 0;
|
|
72
174
|
for (let n of e) {
|
|
73
175
|
this.windows.set(n.id, n);
|
|
74
|
-
let e = n.alwaysOnTop ?? !1 ? n.zIndex -
|
|
176
|
+
let e = n.alwaysOnTop ?? !1 ? n.zIndex - y : n.zIndex;
|
|
75
177
|
e > t && (t = e);
|
|
76
178
|
}
|
|
77
179
|
this.nextZIndex = t + 1;
|
|
@@ -83,7 +185,7 @@ var c = (e) => ({
|
|
|
83
185
|
return this.windows.get(e);
|
|
84
186
|
}
|
|
85
187
|
open(e) {
|
|
86
|
-
let t =
|
|
188
|
+
let t = p(e);
|
|
87
189
|
return t.zIndex = this.assignZIndex(t.alwaysOnTop ?? !1), this.windows.set(t.id, t), t;
|
|
88
190
|
}
|
|
89
191
|
close(e) {
|
|
@@ -144,7 +246,7 @@ var c = (e) => ({
|
|
|
144
246
|
".jsdos": "application/jsdos",
|
|
145
247
|
".zip": "application/zip"
|
|
146
248
|
};
|
|
147
|
-
function
|
|
249
|
+
function b(e) {
|
|
148
250
|
let t = e.lastIndexOf(".");
|
|
149
251
|
if (!(t === -1 || t === e.length - 1)) return ne[e.slice(t).toLowerCase()];
|
|
150
252
|
}
|
|
@@ -155,7 +257,7 @@ function re(e) {
|
|
|
155
257
|
for (let n = 0; n < e.length; n++) t = (t << 5) + t ^ e[n], t >>>= 0;
|
|
156
258
|
return t.toString(16).padStart(8, "0") + e.length.toString(16).padStart(8, "0");
|
|
157
259
|
}
|
|
158
|
-
async function
|
|
260
|
+
async function x(e) {
|
|
159
261
|
let t = await e.arrayBuffer(), n = new Uint8Array(t);
|
|
160
262
|
if (crypto?.subtle) {
|
|
161
263
|
let e = await crypto.subtle.digest("SHA-256", n);
|
|
@@ -165,7 +267,7 @@ async function g(e) {
|
|
|
165
267
|
}
|
|
166
268
|
//#endregion
|
|
167
269
|
//#region src/infrastructure/adapters/IndexedDBFileSystem.ts
|
|
168
|
-
var ie = "fde-desktop-fs",
|
|
270
|
+
var ie = "fde-desktop-fs", S = "nodes", C = "blobs", w = "metadata", ae = 2, T = class {
|
|
169
271
|
db = null;
|
|
170
272
|
nodes = /* @__PURE__ */ new Map();
|
|
171
273
|
ready = !1;
|
|
@@ -185,15 +287,15 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
185
287
|
this.db = n.result, e();
|
|
186
288
|
}, n.onupgradeneeded = () => {
|
|
187
289
|
let e = n.result;
|
|
188
|
-
e.objectStoreNames.contains(
|
|
290
|
+
e.objectStoreNames.contains(S) || e.createObjectStore(S), e.objectStoreNames.contains(C) || e.createObjectStore(C), e.objectStoreNames.contains(w) || e.createObjectStore(w);
|
|
189
291
|
};
|
|
190
292
|
});
|
|
191
293
|
}
|
|
192
294
|
async loadNodes() {
|
|
193
295
|
if (this.db) return new Promise((e, t) => {
|
|
194
|
-
let n = this.db.transaction(
|
|
296
|
+
let n = this.db.transaction(S, "readonly"), r = n.objectStore(S).getAll();
|
|
195
297
|
r.onsuccess = () => {
|
|
196
|
-
let i = n.objectStore(
|
|
298
|
+
let i = n.objectStore(S).getAllKeys();
|
|
197
299
|
i.onsuccess = () => {
|
|
198
300
|
let t = r.result, n = i.result;
|
|
199
301
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -221,7 +323,7 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
221
323
|
}
|
|
222
324
|
persistAllNodes() {
|
|
223
325
|
return this.db ? new Promise((e, t) => {
|
|
224
|
-
let n = this.db.transaction(
|
|
326
|
+
let n = this.db.transaction(S, "readwrite"), r = n.objectStore(S);
|
|
225
327
|
for (let [e, t] of this.nodes.entries()) r.put(t, e);
|
|
226
328
|
n.oncomplete = () => e(), n.onerror = () => t(n.error);
|
|
227
329
|
}) : Promise.resolve();
|
|
@@ -235,7 +337,7 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
235
337
|
if (!this.db || this.persistQueue.length === 0) return;
|
|
236
338
|
let e = [...this.persistQueue];
|
|
237
339
|
this.persistQueue = [];
|
|
238
|
-
let t = this.db.transaction(
|
|
340
|
+
let t = this.db.transaction(S, "readwrite"), n = t.objectStore(S);
|
|
239
341
|
t.onerror = () => {
|
|
240
342
|
console.error("IndexedDB write failed", t.error);
|
|
241
343
|
};
|
|
@@ -256,9 +358,9 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
256
358
|
}
|
|
257
359
|
async saveBlob(e) {
|
|
258
360
|
this.db || await this.initialize();
|
|
259
|
-
let t = await
|
|
361
|
+
let t = await x(e);
|
|
260
362
|
return await this.getBlob(`idb://${t}`) ? `idb://${t}` : new Promise((n, r) => {
|
|
261
|
-
let i = this.db.transaction(
|
|
363
|
+
let i = this.db.transaction(C, "readwrite").objectStore(C).put(e, t);
|
|
262
364
|
i.onsuccess = () => n(`idb://${t}`), i.onerror = () => r(i.error);
|
|
263
365
|
});
|
|
264
366
|
}
|
|
@@ -266,7 +368,7 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
266
368
|
this.db || await this.initialize();
|
|
267
369
|
let t = e.startsWith("idb://") ? e.slice(6) : e;
|
|
268
370
|
return new Promise((e, n) => {
|
|
269
|
-
let r = this.db.transaction(
|
|
371
|
+
let r = this.db.transaction(C, "readonly").objectStore(C).get(t);
|
|
270
372
|
r.onsuccess = () => e(r.result ?? null), r.onerror = () => n(r.error);
|
|
271
373
|
});
|
|
272
374
|
}
|
|
@@ -277,7 +379,7 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
277
379
|
}
|
|
278
380
|
async clearBlobs() {
|
|
279
381
|
if (this.db) return new Promise((e, t) => {
|
|
280
|
-
let n = this.db.transaction(
|
|
382
|
+
let n = this.db.transaction(C, "readwrite").objectStore(C).clear();
|
|
281
383
|
n.onsuccess = () => e(), n.onerror = () => t(n.error);
|
|
282
384
|
});
|
|
283
385
|
}
|
|
@@ -302,11 +404,11 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
302
404
|
return this.nodes.size === 0;
|
|
303
405
|
}
|
|
304
406
|
async createFile(e, t, n, r) {
|
|
305
|
-
let i =
|
|
407
|
+
let i = v(e, t, n, b(e), r);
|
|
306
408
|
return this.nodes.set(i.id, i), n && this.addChildToFolder(n, i.id), this.persistNode(i.id, i), i;
|
|
307
409
|
}
|
|
308
410
|
async createFolder(e, t, n, r) {
|
|
309
|
-
let i =
|
|
411
|
+
let i = _(e, t, {
|
|
310
412
|
iconName: n,
|
|
311
413
|
iconColor: r
|
|
312
414
|
});
|
|
@@ -346,36 +448,36 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
346
448
|
}
|
|
347
449
|
async getManifestSha() {
|
|
348
450
|
return this.db || await this.initialize(), new Promise((e, t) => {
|
|
349
|
-
let n = this.db.transaction(
|
|
451
|
+
let n = this.db.transaction(w, "readonly").objectStore(w).get("manifestSha");
|
|
350
452
|
n.onsuccess = () => e(n.result ?? null), n.onerror = () => t(n.error);
|
|
351
453
|
});
|
|
352
454
|
}
|
|
353
455
|
async saveManifestSha(e) {
|
|
354
456
|
return this.db || await this.initialize(), new Promise((t, n) => {
|
|
355
|
-
let r = this.db.transaction(
|
|
457
|
+
let r = this.db.transaction(w, "readwrite").objectStore(w).put(e, "manifestSha");
|
|
356
458
|
r.onsuccess = () => t(), r.onerror = () => n(r.error);
|
|
357
459
|
});
|
|
358
460
|
}
|
|
359
461
|
async clearAll() {
|
|
360
462
|
this.nodes.clear(), this.ready = !1, this.initPromise = null, this.db &&= (await Promise.all([
|
|
361
463
|
new Promise((e, t) => {
|
|
362
|
-
let n = this.db.transaction(
|
|
363
|
-
n.objectStore(
|
|
464
|
+
let n = this.db.transaction(S, "readwrite");
|
|
465
|
+
n.objectStore(S).clear(), n.oncomplete = () => e(), n.onerror = () => t(n.error);
|
|
364
466
|
}),
|
|
365
467
|
new Promise((e, t) => {
|
|
366
|
-
let n = this.db.transaction(
|
|
367
|
-
n.objectStore(
|
|
468
|
+
let n = this.db.transaction(C, "readwrite");
|
|
469
|
+
n.objectStore(C).clear(), n.oncomplete = () => e(), n.onerror = () => t(n.error);
|
|
368
470
|
}),
|
|
369
471
|
new Promise((e, t) => {
|
|
370
|
-
let n = this.db.transaction(
|
|
371
|
-
n.objectStore(
|
|
472
|
+
let n = this.db.transaction(w, "readwrite");
|
|
473
|
+
n.objectStore(w).clear(), n.oncomplete = () => e(), n.onerror = () => t(n.error);
|
|
372
474
|
})
|
|
373
475
|
]), this.db.close(), null);
|
|
374
476
|
}
|
|
375
477
|
async seed(e) {
|
|
376
478
|
let t = this.buildFolderMapFromManifest(e);
|
|
377
479
|
for (let n of e.files) {
|
|
378
|
-
let e = t.get(n.folder), r =
|
|
480
|
+
let e = t.get(n.folder), r = v(n.name, "", e?.id ?? null, n.mimeType, n.url);
|
|
379
481
|
if (this.nodes.set(r.id, r), e) {
|
|
380
482
|
let i = {
|
|
381
483
|
...e,
|
|
@@ -402,7 +504,7 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
402
504
|
}
|
|
403
505
|
continue;
|
|
404
506
|
}
|
|
405
|
-
let i =
|
|
507
|
+
let i = v(n.name, "", e.id, n.mimeType, n.url);
|
|
406
508
|
this.nodes.set(i.id, i);
|
|
407
509
|
let a = {
|
|
408
510
|
...e,
|
|
@@ -423,7 +525,7 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
423
525
|
continue;
|
|
424
526
|
}
|
|
425
527
|
}
|
|
426
|
-
let c =
|
|
528
|
+
let c = _(i, s);
|
|
427
529
|
if (this.nodes.set(c.id, c), n.set(e, c), o) {
|
|
428
530
|
let e = {
|
|
429
531
|
...o,
|
|
@@ -459,8 +561,8 @@ var ie = "fde-desktop-fs", _ = "nodes", v = "blobs", y = "metadata", ae = 2, oe
|
|
|
459
561
|
e && (e.type === "folder" && this.deleteRecursive(e), this.nodes.delete(t), this.deleteNodeFromPersist(t));
|
|
460
562
|
}
|
|
461
563
|
}
|
|
462
|
-
},
|
|
463
|
-
async function
|
|
564
|
+
}, oe = "/api/fs", se = 6e4;
|
|
565
|
+
async function ce(e, t = {}, n = se) {
|
|
464
566
|
let r = new AbortController(), i = setTimeout(() => r.abort(), n);
|
|
465
567
|
try {
|
|
466
568
|
return await fetch(e, {
|
|
@@ -471,25 +573,25 @@ async function le(e, t = {}, n = ce) {
|
|
|
471
573
|
clearTimeout(i);
|
|
472
574
|
}
|
|
473
575
|
}
|
|
474
|
-
var
|
|
475
|
-
function
|
|
476
|
-
|
|
576
|
+
var E = oe;
|
|
577
|
+
function le(e) {
|
|
578
|
+
E = e;
|
|
477
579
|
}
|
|
478
|
-
var
|
|
580
|
+
var ue = class {
|
|
479
581
|
nodes = /* @__PURE__ */ new Map();
|
|
480
582
|
pathToId = /* @__PURE__ */ new Map();
|
|
481
583
|
ready = !1;
|
|
482
584
|
rootFolderId;
|
|
483
585
|
initPromise = null;
|
|
484
586
|
constructor() {
|
|
485
|
-
this.rootFolderId =
|
|
587
|
+
this.rootFolderId = f(), this.pathToId.set("/", this.rootFolderId);
|
|
486
588
|
}
|
|
487
589
|
async initialize() {
|
|
488
590
|
return this.initPromise ||= this.doInitialize(), this.initPromise;
|
|
489
591
|
}
|
|
490
592
|
async doInitialize() {
|
|
491
593
|
try {
|
|
492
|
-
let e = await fetch(`${
|
|
594
|
+
let e = await fetch(`${E}?action=readdir&path=/`);
|
|
493
595
|
if (e.ok) {
|
|
494
596
|
let t = await e.json();
|
|
495
597
|
await this.syncFromEntries(t, null);
|
|
@@ -500,7 +602,7 @@ var de = class {
|
|
|
500
602
|
this.ready = !0;
|
|
501
603
|
}
|
|
502
604
|
async reinitialize() {
|
|
503
|
-
this.ready = !1, this.nodes.clear(), this.pathToId.clear(), this.rootFolderId =
|
|
605
|
+
this.ready = !1, this.nodes.clear(), this.pathToId.clear(), this.rootFolderId = f(), this.pathToId.set("/", this.rootFolderId), this.initPromise = null, await this.initialize();
|
|
504
606
|
}
|
|
505
607
|
isReady() {
|
|
506
608
|
return this.ready;
|
|
@@ -523,32 +625,32 @@ var de = class {
|
|
|
523
625
|
return Array.from(this.nodes.values());
|
|
524
626
|
}
|
|
525
627
|
async createFile(e, t, n, r) {
|
|
526
|
-
let i =
|
|
527
|
-
...
|
|
628
|
+
let i = f(), a = n ? this.getPathFromId(n) : "/", o = a ? `${a}/${e}`.replace("//", "/") : `/${e}`, s = r ?? `/api/fs?action=file&path=${encodeURIComponent(o)}`, c = {
|
|
629
|
+
...v(e, t, n, this.getMimeType(e), s),
|
|
528
630
|
id: i
|
|
529
631
|
};
|
|
530
|
-
this.nodes.set(i,
|
|
632
|
+
this.nodes.set(i, c), this.pathToId.set(o, i);
|
|
531
633
|
try {
|
|
532
634
|
await this.writeFileToServer(o, t);
|
|
533
635
|
} catch (e) {
|
|
534
636
|
throw this.nodes.delete(i), this.pathToId.delete(o), e;
|
|
535
637
|
}
|
|
536
|
-
return
|
|
638
|
+
return c;
|
|
537
639
|
}
|
|
538
640
|
async createFolder(e, t, n, r) {
|
|
539
|
-
let i =
|
|
540
|
-
n && (
|
|
541
|
-
let
|
|
542
|
-
...
|
|
641
|
+
let i = f(), a = t ? this.getPathFromId(t) : "/", o = a ? `${a}/${e}`.replace("//", "/") : `/${e}`, s = {};
|
|
642
|
+
n && (s.iconName = n), r && (s.iconColor = r);
|
|
643
|
+
let c = {
|
|
644
|
+
..._(e, t, s),
|
|
543
645
|
id: i
|
|
544
646
|
};
|
|
545
|
-
this.nodes.set(i,
|
|
647
|
+
this.nodes.set(i, c), this.pathToId.set(o, i);
|
|
546
648
|
try {
|
|
547
|
-
await this.createDirOnServer(o,
|
|
649
|
+
await this.createDirOnServer(o, s);
|
|
548
650
|
} catch (e) {
|
|
549
651
|
throw this.nodes.delete(i), this.pathToId.delete(o), e;
|
|
550
652
|
}
|
|
551
|
-
return
|
|
653
|
+
return c;
|
|
552
654
|
}
|
|
553
655
|
async updateFile(e, t) {
|
|
554
656
|
let n = this.nodes.get(e);
|
|
@@ -576,7 +678,7 @@ var de = class {
|
|
|
576
678
|
let r = this.getPathFromId(e), i = t ? this.getPathFromId(t) : "/", a = i ? `${i}/${n.name}`.replace("//", "/") : `/${n.name}`;
|
|
577
679
|
if (!r) throw Error(`Cannot determine path for node ${e}`);
|
|
578
680
|
if (!i && t !== null) throw Error(`Cannot determine parent path for ${t}`);
|
|
579
|
-
let o = await
|
|
681
|
+
let o = await ce(`${E}?action=move&oldPath=${encodeURIComponent(r)}&newPath=${encodeURIComponent(a)}`);
|
|
580
682
|
if (!o.ok) {
|
|
581
683
|
let e = await o.json().catch(() => ({}));
|
|
582
684
|
throw Error(e.error || `HTTP ${o.status}`);
|
|
@@ -597,7 +699,7 @@ var de = class {
|
|
|
597
699
|
}
|
|
598
700
|
async readFile(e) {
|
|
599
701
|
try {
|
|
600
|
-
let t = await fetch(`${
|
|
702
|
+
let t = await fetch(`${E}?action=read&path=${encodeURIComponent(e)}`);
|
|
601
703
|
if (t.ok) return (await t.json()).content;
|
|
602
704
|
} catch (t) {
|
|
603
705
|
console.warn(`[DockerFS] Failed to read file ${e}:`, t);
|
|
@@ -608,9 +710,9 @@ var de = class {
|
|
|
608
710
|
await this.writeFileToServer(e, t);
|
|
609
711
|
}
|
|
610
712
|
async saveBlob(e) {
|
|
611
|
-
let t = `/.blobs/${await
|
|
713
|
+
let t = `/.blobs/${await x(e)}.${e.type.split("/")[1] || "bin"}`;
|
|
612
714
|
try {
|
|
613
|
-
await fetch(`${
|
|
715
|
+
await fetch(`${E}?action=writeBinary&path=${encodeURIComponent(t)}`, {
|
|
614
716
|
method: "POST",
|
|
615
717
|
body: e
|
|
616
718
|
});
|
|
@@ -650,10 +752,10 @@ var de = class {
|
|
|
650
752
|
return Promise.resolve();
|
|
651
753
|
}
|
|
652
754
|
async clearAll() {
|
|
653
|
-
this.nodes.clear(), this.pathToId.clear(), this.ready = !1, this.initPromise = null, this.rootFolderId =
|
|
755
|
+
this.nodes.clear(), this.pathToId.clear(), this.ready = !1, this.initPromise = null, this.rootFolderId = f(), this.pathToId.set("/", this.rootFolderId);
|
|
654
756
|
}
|
|
655
757
|
getMimeType(e) {
|
|
656
|
-
return
|
|
758
|
+
return b(e) || "application/octet-stream";
|
|
657
759
|
}
|
|
658
760
|
getPathFromId(e) {
|
|
659
761
|
if (!e) return null;
|
|
@@ -671,9 +773,9 @@ var de = class {
|
|
|
671
773
|
}
|
|
672
774
|
async syncFromEntries(e, t) {
|
|
673
775
|
for (let n of e) {
|
|
674
|
-
let e =
|
|
776
|
+
let e = f();
|
|
675
777
|
if (n.type === "directory") {
|
|
676
|
-
let r =
|
|
778
|
+
let r = _(n.name, t);
|
|
677
779
|
this.nodes.set(e, {
|
|
678
780
|
...r,
|
|
679
781
|
id: e
|
|
@@ -681,7 +783,7 @@ var de = class {
|
|
|
681
783
|
let i = await this.fetchReaddir(n.path);
|
|
682
784
|
await this.syncFromEntries(i, e);
|
|
683
785
|
} else {
|
|
684
|
-
let r = `/api/fs?action=file&path=${encodeURIComponent(n.path)}`, i =
|
|
786
|
+
let r = `/api/fs?action=file&path=${encodeURIComponent(n.path)}`, i = v(n.name, "", t, this.getMimeType(n.name), r);
|
|
685
787
|
this.nodes.set(e, {
|
|
686
788
|
...i,
|
|
687
789
|
id: e
|
|
@@ -691,7 +793,7 @@ var de = class {
|
|
|
691
793
|
}
|
|
692
794
|
async fetchReaddir(e) {
|
|
693
795
|
try {
|
|
694
|
-
let t = await fetch(`${
|
|
796
|
+
let t = await fetch(`${E}?action=readdir&path=${encodeURIComponent(e)}`);
|
|
695
797
|
if (t.ok) return await t.json();
|
|
696
798
|
} catch (t) {
|
|
697
799
|
console.warn(`[DockerFS] Failed to readdir ${e}:`, t);
|
|
@@ -699,7 +801,7 @@ var de = class {
|
|
|
699
801
|
return [];
|
|
700
802
|
}
|
|
701
803
|
async writeFileToServer(e, t) {
|
|
702
|
-
let n = await fetch(`${
|
|
804
|
+
let n = await fetch(`${E}`, {
|
|
703
805
|
method: "POST",
|
|
704
806
|
headers: { "Content-Type": "application/json" },
|
|
705
807
|
body: JSON.stringify({
|
|
@@ -710,7 +812,7 @@ var de = class {
|
|
|
710
812
|
if (!n.ok) throw Error(`Failed to write file ${e}: HTTP ${n.status}`);
|
|
711
813
|
}
|
|
712
814
|
async createDirOnServer(e, t) {
|
|
713
|
-
let n = await fetch(`${
|
|
815
|
+
let n = await fetch(`${E}`, {
|
|
714
816
|
method: "PUT",
|
|
715
817
|
headers: { "Content-Type": "application/json" },
|
|
716
818
|
body: JSON.stringify({
|
|
@@ -722,12 +824,32 @@ var de = class {
|
|
|
722
824
|
}
|
|
723
825
|
async deleteFromServer(e) {
|
|
724
826
|
try {
|
|
725
|
-
await fetch(`${
|
|
827
|
+
await fetch(`${E}?path=${encodeURIComponent(e)}`, { method: "DELETE" });
|
|
726
828
|
} catch (t) {
|
|
727
829
|
console.warn(`[DockerFS] Failed to delete ${e}:`, t);
|
|
728
830
|
}
|
|
729
831
|
}
|
|
730
|
-
}
|
|
832
|
+
};
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/utils/getRuntime.ts
|
|
835
|
+
function D() {
|
|
836
|
+
return typeof window > "u" ? "browser" : window.__FDE_IN_DOCKER__ === !0 ? "docker" : typeof navigator < "u" && /Electron/i.test(navigator.userAgent) ? "electron" : "browser";
|
|
837
|
+
}
|
|
838
|
+
function de() {
|
|
839
|
+
return D() === "docker";
|
|
840
|
+
}
|
|
841
|
+
function fe() {
|
|
842
|
+
return D() === "electron";
|
|
843
|
+
}
|
|
844
|
+
function O() {
|
|
845
|
+
return D() === "browser";
|
|
846
|
+
}
|
|
847
|
+
function pe() {
|
|
848
|
+
return typeof window > "u" ? !1 : window.__IS_DEV__ === !0 ? !0 : window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
|
|
849
|
+
}
|
|
850
|
+
//#endregion
|
|
851
|
+
//#region src/constants/launcherFolders.ts
|
|
852
|
+
var me = "launcher-folder-custom-apps", he = [
|
|
731
853
|
{
|
|
732
854
|
id: "launcher-folder-social-links",
|
|
733
855
|
name: "Social Links",
|
|
@@ -774,7 +896,7 @@ var de = class {
|
|
|
774
896
|
order: 3
|
|
775
897
|
},
|
|
776
898
|
{
|
|
777
|
-
id:
|
|
899
|
+
id: me,
|
|
778
900
|
name: "Custom Apps",
|
|
779
901
|
fcIcon: "VscExtensions",
|
|
780
902
|
appIds: [],
|
|
@@ -782,59 +904,59 @@ var de = class {
|
|
|
782
904
|
isPredefined: !0,
|
|
783
905
|
order: 4
|
|
784
906
|
}
|
|
785
|
-
],
|
|
786
|
-
async function
|
|
907
|
+
], k = [...he], A = null, j = null, M = 0, ge = 5e3, N = "/dist-apps/apps-manifest.json";
|
|
908
|
+
async function P(e = !1) {
|
|
787
909
|
let t = Date.now();
|
|
788
|
-
if (!e &&
|
|
789
|
-
if (
|
|
790
|
-
let n = `${
|
|
791
|
-
return
|
|
910
|
+
if (!e && A && t - M < ge) return A;
|
|
911
|
+
if (j) return j;
|
|
912
|
+
let n = `${N}?t=${t}`;
|
|
913
|
+
return j = fetch(n).then(async (e) => {
|
|
792
914
|
if (!e.ok) {
|
|
793
|
-
if (e.status === 404) return console.warn("[CustomApps] No apps manifest found at",
|
|
915
|
+
if (e.status === 404) return console.warn("[CustomApps] No apps manifest found at", N), null;
|
|
794
916
|
throw Error(`Failed to fetch manifest: ${e.status}`);
|
|
795
917
|
}
|
|
796
918
|
return e.json();
|
|
797
|
-
}).then((e) => (
|
|
919
|
+
}).then((e) => (A = e, M = Date.now(), j = null, console.log(`[CustomApps] Loaded manifest with ${e.apps.length} apps`), e)).catch((e) => (console.error("[CustomApps] Error fetching manifest:", e), j = null, null)), j;
|
|
798
920
|
}
|
|
799
|
-
function
|
|
800
|
-
return
|
|
921
|
+
function _e() {
|
|
922
|
+
return A;
|
|
801
923
|
}
|
|
802
|
-
function
|
|
803
|
-
|
|
924
|
+
function F() {
|
|
925
|
+
A = null, M = 0;
|
|
804
926
|
}
|
|
805
|
-
function
|
|
806
|
-
if (!
|
|
807
|
-
|
|
927
|
+
function ve(e) {
|
|
928
|
+
if (!A) {
|
|
929
|
+
A = {
|
|
808
930
|
version: "1.0.0",
|
|
809
931
|
generated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
810
932
|
apps: [e]
|
|
811
933
|
};
|
|
812
934
|
return;
|
|
813
935
|
}
|
|
814
|
-
|
|
815
|
-
...
|
|
816
|
-
apps:
|
|
936
|
+
A = A.apps.some((t) => t.id === e.id) ? {
|
|
937
|
+
...A,
|
|
938
|
+
apps: A.apps.map((t) => t.id === e.id ? e : t)
|
|
817
939
|
} : {
|
|
818
|
-
...
|
|
819
|
-
apps: [...
|
|
940
|
+
...A,
|
|
941
|
+
apps: [...A.apps, e]
|
|
820
942
|
};
|
|
821
943
|
}
|
|
822
|
-
function
|
|
823
|
-
|
|
824
|
-
...
|
|
825
|
-
apps:
|
|
944
|
+
function ye(e) {
|
|
945
|
+
A &&= {
|
|
946
|
+
...A,
|
|
947
|
+
apps: A.apps.filter((t) => t.id !== e)
|
|
826
948
|
};
|
|
827
949
|
}
|
|
828
|
-
async function
|
|
829
|
-
return (await
|
|
950
|
+
async function I() {
|
|
951
|
+
return (await P())?.apps ?? [];
|
|
830
952
|
}
|
|
831
|
-
async function
|
|
832
|
-
return (await
|
|
953
|
+
async function be(e) {
|
|
954
|
+
return (await I()).find((t) => t.id === e);
|
|
833
955
|
}
|
|
834
|
-
function
|
|
835
|
-
return
|
|
956
|
+
function xe(e) {
|
|
957
|
+
return A ? A.apps.some((t) => t.id === e) : !1;
|
|
836
958
|
}
|
|
837
|
-
function
|
|
959
|
+
function Se(e) {
|
|
838
960
|
return {
|
|
839
961
|
id: e.id,
|
|
840
962
|
name: e.name,
|
|
@@ -848,7 +970,7 @@ function ye(e) {
|
|
|
848
970
|
alwaysOnTop: e.window.alwaysOnTop
|
|
849
971
|
};
|
|
850
972
|
}
|
|
851
|
-
function
|
|
973
|
+
function Ce(e, t) {
|
|
852
974
|
let n = new Set(t.map((e) => e.id)), r = e.filter((e) => !n.has(e.id)), i = t.map((e) => {
|
|
853
975
|
let t = {
|
|
854
976
|
id: e.id,
|
|
@@ -865,9 +987,9 @@ function be(e, t) {
|
|
|
865
987
|
});
|
|
866
988
|
return [...r, ...i];
|
|
867
989
|
}
|
|
868
|
-
async function
|
|
869
|
-
|
|
870
|
-
let t = await
|
|
990
|
+
async function we(e) {
|
|
991
|
+
F();
|
|
992
|
+
let t = await P(!0);
|
|
871
993
|
if (!t) return {
|
|
872
994
|
added: [],
|
|
873
995
|
removed: [],
|
|
@@ -882,26 +1004,26 @@ async function xe(e) {
|
|
|
882
1004
|
}
|
|
883
1005
|
//#endregion
|
|
884
1006
|
//#region src/utils/sortNodes.ts
|
|
885
|
-
var
|
|
1007
|
+
var L = (e) => {
|
|
886
1008
|
let t = e.filter((e) => e.type === "folder"), n = e.filter((e) => e.type === "file"), r = (e, t) => e.name.localeCompare(t.name);
|
|
887
1009
|
return [...t.sort(r), ...n.sort(r)];
|
|
888
|
-
},
|
|
1010
|
+
}, Te = {
|
|
889
1011
|
BY_TYPE: "byType",
|
|
890
1012
|
BY_NAME: "byName",
|
|
891
1013
|
BY_DATE: "byDate"
|
|
892
1014
|
};
|
|
893
|
-
function
|
|
1015
|
+
function R(e) {
|
|
894
1016
|
return e.nodeId ? e.appId === "files" ? "folder" : "file" : "app";
|
|
895
1017
|
}
|
|
896
|
-
var
|
|
1018
|
+
var z = {
|
|
897
1019
|
app: 0,
|
|
898
1020
|
folder: 1,
|
|
899
1021
|
file: 2
|
|
900
1022
|
};
|
|
901
|
-
function
|
|
1023
|
+
function B(e, t) {
|
|
902
1024
|
return [...e].sort((e, n) => {
|
|
903
|
-
let r =
|
|
904
|
-
if (r !== i) return
|
|
1025
|
+
let r = R(e), i = R(n);
|
|
1026
|
+
if (r !== i) return z[r] - z[i];
|
|
905
1027
|
if (r === "app") {
|
|
906
1028
|
if (!t) return e.name.localeCompare(n.name);
|
|
907
1029
|
let r = t.indexOf(e.appId), i = t.indexOf(n.appId);
|
|
@@ -910,219 +1032,27 @@ function N(e, t) {
|
|
|
910
1032
|
return e.name.localeCompare(n.name);
|
|
911
1033
|
});
|
|
912
1034
|
}
|
|
913
|
-
var
|
|
1035
|
+
var V = (e, t) => {
|
|
914
1036
|
switch (t) {
|
|
915
|
-
case "default": return
|
|
1037
|
+
case "default": return B(e);
|
|
916
1038
|
case "name-asc": return [...e].sort((e, t) => e.name.localeCompare(t.name));
|
|
917
1039
|
case "name-desc": return [...e].sort((e, t) => t.name.localeCompare(e.name));
|
|
918
1040
|
case "type": return [...e].sort((e, t) => {
|
|
919
|
-
let n =
|
|
920
|
-
return n === r ? e.name.localeCompare(t.name) :
|
|
1041
|
+
let n = R(e), r = R(t);
|
|
1042
|
+
return n === r ? e.name.localeCompare(t.name) : z[n] - z[r];
|
|
921
1043
|
});
|
|
922
|
-
default: return
|
|
1044
|
+
default: return B(e);
|
|
923
1045
|
}
|
|
924
|
-
},
|
|
1046
|
+
}, Ee = (e, t) => {
|
|
925
1047
|
switch (t) {
|
|
926
1048
|
case "default":
|
|
927
|
-
case "type": return
|
|
1049
|
+
case "type": return L(e);
|
|
928
1050
|
case "name-asc": return [...e].sort((e, t) => e.name.localeCompare(t.name));
|
|
929
1051
|
case "name-desc": return [...e].sort((e, t) => t.name.localeCompare(e.name));
|
|
930
|
-
default: return
|
|
1052
|
+
default: return L(e);
|
|
931
1053
|
}
|
|
932
|
-
},
|
|
933
|
-
|
|
934
|
-
defaultHeight: 600,
|
|
935
|
-
minWidth: 640,
|
|
936
|
-
minHeight: 480
|
|
937
|
-
}, I = [
|
|
938
|
-
{
|
|
939
|
-
id: "files",
|
|
940
|
-
name: "FilesApp",
|
|
941
|
-
icon: "📁",
|
|
942
|
-
fcIcon: "FcOpenedFolder",
|
|
943
|
-
hasContextMenu: !0,
|
|
944
|
-
...F
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
id: "settings",
|
|
948
|
-
name: "Settings",
|
|
949
|
-
icon: "⚙️",
|
|
950
|
-
fcIcon: "FcSettings",
|
|
951
|
-
singleWindow: !0,
|
|
952
|
-
...F
|
|
953
|
-
},
|
|
954
|
-
{
|
|
955
|
-
id: "notepad",
|
|
956
|
-
name: "Notepad",
|
|
957
|
-
icon: "📝",
|
|
958
|
-
fcIcon: "FcEditImage",
|
|
959
|
-
...F
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
id: "image-viewer",
|
|
963
|
-
name: "Image Viewer",
|
|
964
|
-
icon: "🖼️",
|
|
965
|
-
fcIcon: "FcPicture",
|
|
966
|
-
defaultWidth: 700,
|
|
967
|
-
defaultHeight: 520,
|
|
968
|
-
minWidth: 640,
|
|
969
|
-
minHeight: 480
|
|
970
|
-
},
|
|
971
|
-
{
|
|
972
|
-
id: "pdf",
|
|
973
|
-
name: "PDF Viewer",
|
|
974
|
-
icon: "📄",
|
|
975
|
-
fcIcon: "FcDocument",
|
|
976
|
-
defaultWidth: 780,
|
|
977
|
-
defaultHeight: 580,
|
|
978
|
-
minWidth: 640,
|
|
979
|
-
minHeight: 480
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
id: "uploader",
|
|
983
|
-
name: "Uploader",
|
|
984
|
-
icon: "📤",
|
|
985
|
-
fcIcon: "FcUpload",
|
|
986
|
-
...F
|
|
987
|
-
},
|
|
988
|
-
{
|
|
989
|
-
id: "menuedit",
|
|
990
|
-
name: "MenuEdit",
|
|
991
|
-
icon: "📁",
|
|
992
|
-
fcIcon: "FcFolder",
|
|
993
|
-
singleWindow: !0,
|
|
994
|
-
...F
|
|
995
|
-
},
|
|
996
|
-
{
|
|
997
|
-
id: "device-info",
|
|
998
|
-
name: "Device Info",
|
|
999
|
-
icon: "📊",
|
|
1000
|
-
fcIcon: "FcBarChart",
|
|
1001
|
-
defaultWidth: 300,
|
|
1002
|
-
defaultHeight: 400,
|
|
1003
|
-
minWidth: 280,
|
|
1004
|
-
minHeight: 350,
|
|
1005
|
-
canMaximize: !1,
|
|
1006
|
-
alwaysOnTop: !0,
|
|
1007
|
-
singleWindow: !0
|
|
1008
|
-
},
|
|
1009
|
-
{
|
|
1010
|
-
id: "calendar",
|
|
1011
|
-
name: "Calendar",
|
|
1012
|
-
icon: "📅",
|
|
1013
|
-
fcIcon: "FcCalendar",
|
|
1014
|
-
defaultWidth: 320,
|
|
1015
|
-
defaultHeight: 370,
|
|
1016
|
-
minWidth: !1,
|
|
1017
|
-
minHeight: !1,
|
|
1018
|
-
canMaximize: !1,
|
|
1019
|
-
singleWindow: !0
|
|
1020
|
-
}
|
|
1021
|
-
], we = I.map((e) => e.id), L = [
|
|
1022
|
-
{
|
|
1023
|
-
id: "welcome",
|
|
1024
|
-
name: "Welcome",
|
|
1025
|
-
icon: "👋",
|
|
1026
|
-
fcIcon: "FcBusinessContact",
|
|
1027
|
-
defaultWidth: 900,
|
|
1028
|
-
defaultHeight: 700,
|
|
1029
|
-
minWidth: 600,
|
|
1030
|
-
minHeight: 500
|
|
1031
|
-
},
|
|
1032
|
-
{
|
|
1033
|
-
id: "storybook",
|
|
1034
|
-
name: "Storybook",
|
|
1035
|
-
icon: "📖",
|
|
1036
|
-
fcIcon: "FcReading",
|
|
1037
|
-
defaultWidth: 1100,
|
|
1038
|
-
defaultHeight: 700,
|
|
1039
|
-
minWidth: 640,
|
|
1040
|
-
minHeight: 480
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1043
|
-
id: "linkedin",
|
|
1044
|
-
name: "LinkedinApp",
|
|
1045
|
-
icon: "🔗",
|
|
1046
|
-
fcIcon: "FiLinkedin",
|
|
1047
|
-
iconColor: "#0A66C2",
|
|
1048
|
-
defaultWidth: 1100,
|
|
1049
|
-
defaultHeight: 700
|
|
1050
|
-
},
|
|
1051
|
-
{
|
|
1052
|
-
id: "github",
|
|
1053
|
-
name: "GithubApp",
|
|
1054
|
-
icon: "🔗",
|
|
1055
|
-
fcIcon: "FiGithub",
|
|
1056
|
-
iconColor: "#000",
|
|
1057
|
-
defaultWidth: 640,
|
|
1058
|
-
defaultHeight: 480
|
|
1059
|
-
},
|
|
1060
|
-
{
|
|
1061
|
-
id: "terminal",
|
|
1062
|
-
name: "Terminal",
|
|
1063
|
-
icon: "💻",
|
|
1064
|
-
fcIcon: "FcCommandLine",
|
|
1065
|
-
...F
|
|
1066
|
-
},
|
|
1067
|
-
{
|
|
1068
|
-
id: "code-server",
|
|
1069
|
-
name: "VS Code",
|
|
1070
|
-
icon: "📘",
|
|
1071
|
-
fcIcon: "FcCodesandbox",
|
|
1072
|
-
iconUrl: "/vscode.svg",
|
|
1073
|
-
defaultWidth: 1200,
|
|
1074
|
-
defaultHeight: 800,
|
|
1075
|
-
minWidth: 800,
|
|
1076
|
-
minHeight: 600
|
|
1077
|
-
},
|
|
1078
|
-
{
|
|
1079
|
-
id: "dos-emulator",
|
|
1080
|
-
name: "DOS Emulator",
|
|
1081
|
-
icon: "🎮",
|
|
1082
|
-
fcIcon: "FcGamepad",
|
|
1083
|
-
defaultWidth: 900,
|
|
1084
|
-
defaultHeight: 700,
|
|
1085
|
-
minWidth: 640,
|
|
1086
|
-
minHeight: 480
|
|
1087
|
-
},
|
|
1088
|
-
{
|
|
1089
|
-
id: "doom",
|
|
1090
|
-
name: "DOOM",
|
|
1091
|
-
icon: "🔫",
|
|
1092
|
-
fcIcon: "FcVideoGame",
|
|
1093
|
-
iconUrl: "doom.png",
|
|
1094
|
-
defaultWidth: 900,
|
|
1095
|
-
defaultHeight: 700,
|
|
1096
|
-
minWidth: 640,
|
|
1097
|
-
minHeight: 480,
|
|
1098
|
-
autoLoad: {
|
|
1099
|
-
url: "Games/doom.jsdos",
|
|
1100
|
-
name: "DOOM"
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
], Te = L.map((e) => e.id), R = [...I, ...L], z = [
|
|
1104
|
-
"welcome",
|
|
1105
|
-
"uploader",
|
|
1106
|
-
"terminal",
|
|
1107
|
-
"code-server",
|
|
1108
|
-
"storybook",
|
|
1109
|
-
"settings",
|
|
1110
|
-
"notepad",
|
|
1111
|
-
"linkedin",
|
|
1112
|
-
"github",
|
|
1113
|
-
"files",
|
|
1114
|
-
"doom"
|
|
1115
|
-
];
|
|
1116
|
-
function Ee(e) {
|
|
1117
|
-
for (let t of e) R.find((e) => e.id === t.id) || R.push(t);
|
|
1118
|
-
}
|
|
1119
|
-
function De(e) {
|
|
1120
|
-
for (let t of e) z.includes(t) || z.push(t);
|
|
1121
|
-
}
|
|
1122
|
-
//#endregion
|
|
1123
|
-
//#region src/utils/getAppIdForMime.ts
|
|
1124
|
-
var B = [], V = (e) => {
|
|
1125
|
-
B.push(e);
|
|
1054
|
+
}, De = [], H = (e) => {
|
|
1055
|
+
De.push(e);
|
|
1126
1056
|
}, Oe = new Set([
|
|
1127
1057
|
"image/jpeg",
|
|
1128
1058
|
"image/png",
|
|
@@ -1130,29 +1060,29 @@ var B = [], V = (e) => {
|
|
|
1130
1060
|
"image/svg+xml",
|
|
1131
1061
|
"image/webp",
|
|
1132
1062
|
"image/bmp"
|
|
1133
|
-
]),
|
|
1063
|
+
]), ke = new Set([
|
|
1134
1064
|
"text/plain",
|
|
1135
1065
|
"text/markdown",
|
|
1136
1066
|
"text/x-markdown",
|
|
1137
1067
|
"application/json"
|
|
1138
1068
|
]);
|
|
1139
|
-
|
|
1069
|
+
H({
|
|
1140
1070
|
appId: "pdf",
|
|
1141
1071
|
mimeTypes: ["application/pdf"],
|
|
1142
1072
|
transformContentData: (e) => ({ src: e.url ?? e.name })
|
|
1143
|
-
}),
|
|
1073
|
+
}), H({
|
|
1144
1074
|
appId: "image-viewer",
|
|
1145
1075
|
mimeTypes: (e) => Oe.has(e) || e.startsWith("image/"),
|
|
1146
1076
|
transformContentData: (e) => ({ src: e.url ?? e.name })
|
|
1147
|
-
}),
|
|
1077
|
+
}), H({
|
|
1148
1078
|
appId: "notepad",
|
|
1149
|
-
mimeTypes: (e) =>
|
|
1079
|
+
mimeTypes: (e) => ke.has(e) || e.startsWith("text/"),
|
|
1150
1080
|
transformContentData: (e) => ({
|
|
1151
1081
|
url: e.url,
|
|
1152
1082
|
initialName: e.name,
|
|
1153
1083
|
fileId: e.id
|
|
1154
1084
|
})
|
|
1155
|
-
}),
|
|
1085
|
+
}), H({
|
|
1156
1086
|
appId: "dos-emulator",
|
|
1157
1087
|
mimeTypes: [
|
|
1158
1088
|
"application/jsdos",
|
|
@@ -1164,14 +1094,14 @@ V({
|
|
|
1164
1094
|
name: e.name
|
|
1165
1095
|
} })
|
|
1166
1096
|
});
|
|
1167
|
-
function
|
|
1097
|
+
function Ae(e) {
|
|
1168
1098
|
if (!e) return null;
|
|
1169
|
-
for (let t of
|
|
1099
|
+
for (let t of De) if (typeof t.mimeTypes == "function" ? t.mimeTypes(e) : t.mimeTypes.includes(e)) return t;
|
|
1170
1100
|
return null;
|
|
1171
1101
|
}
|
|
1172
1102
|
function U(e) {
|
|
1173
|
-
if (typeof e == "string" || e === void 0) return
|
|
1174
|
-
let t =
|
|
1103
|
+
if (typeof e == "string" || e === void 0) return Ae(e)?.appId ?? "files";
|
|
1104
|
+
let t = Ae(e.mimeType);
|
|
1175
1105
|
return t ? {
|
|
1176
1106
|
appId: t.appId,
|
|
1177
1107
|
contentData: t.transformContentData(e)
|
|
@@ -1187,7 +1117,7 @@ var W = {
|
|
|
1187
1117
|
error: void 0,
|
|
1188
1118
|
mountedAt: 0,
|
|
1189
1119
|
instance: void 0
|
|
1190
|
-
}, G =
|
|
1120
|
+
}, G = e((e) => ({
|
|
1191
1121
|
mountedApps: {},
|
|
1192
1122
|
registeredApps: {},
|
|
1193
1123
|
hmrConnected: !1,
|
|
@@ -1253,11 +1183,11 @@ var W = {
|
|
|
1253
1183
|
setDevServerOffline: (t) => e({ devServerOffline: t }),
|
|
1254
1184
|
incrementHmrRetry: () => e((e) => ({ hmrRetryCount: e.hmrRetryCount + 1 })),
|
|
1255
1185
|
resetHmrRetry: () => e({ hmrRetryCount: 0 })
|
|
1256
|
-
})),
|
|
1257
|
-
function
|
|
1186
|
+
})), je = "/", K = null, q = null;
|
|
1187
|
+
function Me(e) {
|
|
1258
1188
|
q = e, K = null;
|
|
1259
1189
|
}
|
|
1260
|
-
function
|
|
1190
|
+
function Ne() {
|
|
1261
1191
|
if (K !== null) return K;
|
|
1262
1192
|
if (q !== null) return K = q, K;
|
|
1263
1193
|
let e = document.querySelector("base[href]");
|
|
@@ -1265,44 +1195,44 @@ function Me() {
|
|
|
1265
1195
|
let t = e.getAttribute("href");
|
|
1266
1196
|
if (t) return K = t, t;
|
|
1267
1197
|
}
|
|
1268
|
-
return K =
|
|
1198
|
+
return K = je, K;
|
|
1269
1199
|
}
|
|
1270
|
-
function
|
|
1200
|
+
function Pe() {
|
|
1271
1201
|
K = null;
|
|
1272
1202
|
}
|
|
1273
|
-
function
|
|
1203
|
+
function Fe(e) {
|
|
1274
1204
|
if (!e || e.startsWith("http://") || e.startsWith("https://") || e.startsWith("idb://") || e.startsWith("blob:") || e.startsWith("/")) return e;
|
|
1275
|
-
let t =
|
|
1205
|
+
let t = Ne();
|
|
1276
1206
|
return (t.endsWith("/") ? t : `${t}/`) + e;
|
|
1277
1207
|
}
|
|
1278
1208
|
//#endregion
|
|
1279
1209
|
//#region src/constants/breakpoints.ts
|
|
1280
|
-
var
|
|
1210
|
+
var Ie = {
|
|
1281
1211
|
MOBILE: 768,
|
|
1282
1212
|
TABLET: 1024,
|
|
1283
1213
|
DESKTOP: 1280
|
|
1284
|
-
},
|
|
1214
|
+
}, Le = {
|
|
1285
1215
|
WIDTH: 1280,
|
|
1286
1216
|
HEIGHT: 800
|
|
1287
|
-
},
|
|
1288
|
-
let e = await fetch(
|
|
1217
|
+
}, Re = 48, ze = 80, Be = 80, Ve = 20, He = Le.WIDTH, J = Le.HEIGHT, Ue = async () => {
|
|
1218
|
+
let e = await fetch(Fe("fs-manifest.json")), t = e.headers.get("content-type")?.includes("application/json");
|
|
1289
1219
|
return e.ok && t ? await e.json() : null;
|
|
1290
|
-
},
|
|
1220
|
+
}, Y = new te();
|
|
1291
1221
|
function We() {
|
|
1292
|
-
return
|
|
1222
|
+
return de() ? (console.log("[FileSystem] Using DockerFileSystemAdapter"), new ue()) : (console.log("[FileSystem] Using IndexedDBFileSystem"), new T());
|
|
1293
1223
|
}
|
|
1294
|
-
var
|
|
1295
|
-
|
|
1296
|
-
}, Ke = () =>
|
|
1224
|
+
var X = We(), Ge = () => {
|
|
1225
|
+
X.clearAll().catch(() => {});
|
|
1226
|
+
}, Ke = () => Y.reset();
|
|
1297
1227
|
async function qe(e, t) {
|
|
1298
1228
|
if (e.startsWith("idb://")) {
|
|
1299
|
-
let t = await
|
|
1229
|
+
let t = await X.getBlob(e);
|
|
1300
1230
|
return t ? t.text() : "";
|
|
1301
1231
|
}
|
|
1302
1232
|
let n = e.startsWith("http") || e.startsWith("/") ? e : `/${e}`, r = await fetch(n, { signal: t });
|
|
1303
1233
|
return r.ok ? r.text() : "";
|
|
1304
1234
|
}
|
|
1305
|
-
var
|
|
1235
|
+
var Z = () => X.getRootNodes().find((e) => e.type === "folder" && e.name === "Desktop")?.id ?? null, Je = (e, t) => {
|
|
1306
1236
|
let n = new Set(e.map((e) => `${e.x},${e.y}`)), r = Math.max(1, Math.floor((t - 20) / 80));
|
|
1307
1237
|
for (let e = 0;; e++) {
|
|
1308
1238
|
let t = 20 + e * 80;
|
|
@@ -1320,16 +1250,16 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1320
1250
|
x: 20 + r * 80,
|
|
1321
1251
|
y: 20 + i * 80
|
|
1322
1252
|
};
|
|
1323
|
-
},
|
|
1253
|
+
}, Q = (e, t, n) => {
|
|
1324
1254
|
let r = Je(e, n);
|
|
1325
|
-
return [...e,
|
|
1255
|
+
return [...e, m({
|
|
1326
1256
|
...t,
|
|
1327
1257
|
...r
|
|
1328
1258
|
})];
|
|
1329
|
-
},
|
|
1330
|
-
let e =
|
|
1331
|
-
if (!e || !
|
|
1332
|
-
let t =
|
|
1259
|
+
}, Xe = () => {
|
|
1260
|
+
let e = Z();
|
|
1261
|
+
if (!e || !X.isReady()) return;
|
|
1262
|
+
let t = X.getChildren(e), n = new Set(t.map((e) => e.id)), r = new Set(t.map((e) => e.name)), { icons: i, viewportHeight: a } = $.getState(), o = i.filter((e) => !e.nodeId || n.has(e.nodeId) || r.has(e.name));
|
|
1333
1263
|
for (let e of t) {
|
|
1334
1264
|
let t = o.find((t) => t.name === e.name);
|
|
1335
1265
|
if (t) t.nodeId !== e.id && (o = o.map((t) => t.name === e.name ? {
|
|
@@ -1338,7 +1268,7 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1338
1268
|
} : t));
|
|
1339
1269
|
else {
|
|
1340
1270
|
let t = e.type === "folder", n = t ? e : null, r = t ? null : e, i = t ? "files" : r ? U(r)?.appId ?? "" : "";
|
|
1341
|
-
o =
|
|
1271
|
+
o = Q(o, {
|
|
1342
1272
|
name: e.name,
|
|
1343
1273
|
icon: t ? "📁" : "📄",
|
|
1344
1274
|
iconName: n?.iconName,
|
|
@@ -1348,52 +1278,52 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1348
1278
|
}, a);
|
|
1349
1279
|
}
|
|
1350
1280
|
}
|
|
1351
|
-
let s =
|
|
1281
|
+
let s = B(o);
|
|
1352
1282
|
$.setState({ icons: s.map((e, t) => ({
|
|
1353
1283
|
...e,
|
|
1354
1284
|
...Ye(t, a)
|
|
1355
1285
|
})) });
|
|
1356
|
-
}, $ =
|
|
1286
|
+
}, $ = e()(n((e, t) => ({
|
|
1357
1287
|
windows: [],
|
|
1358
1288
|
openWindow: (t) => {
|
|
1359
|
-
let n =
|
|
1289
|
+
let n = Y.open(t);
|
|
1360
1290
|
e((e) => ({ windows: [...e.windows, n] }));
|
|
1361
1291
|
},
|
|
1362
1292
|
closeWindow: (t) => {
|
|
1363
|
-
|
|
1293
|
+
Y.close(t), e((e) => ({ windows: e.windows.filter((e) => e.id !== t) }));
|
|
1364
1294
|
},
|
|
1365
1295
|
minimizeWindow: (t) => {
|
|
1366
|
-
|
|
1296
|
+
Y.minimize(t), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
|
|
1367
1297
|
...e,
|
|
1368
1298
|
state: "minimized"
|
|
1369
1299
|
} : e) }));
|
|
1370
1300
|
},
|
|
1371
1301
|
maximizeWindow: (t) => {
|
|
1372
|
-
|
|
1302
|
+
Y.maximize(t), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
|
|
1373
1303
|
...e,
|
|
1374
1304
|
state: "maximized"
|
|
1375
1305
|
} : e) }));
|
|
1376
1306
|
},
|
|
1377
1307
|
restoreWindow: (t) => {
|
|
1378
|
-
|
|
1308
|
+
Y.restore(t), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
|
|
1379
1309
|
...e,
|
|
1380
1310
|
state: "normal"
|
|
1381
1311
|
} : e) }));
|
|
1382
1312
|
},
|
|
1383
1313
|
focusWindow: (t) => {
|
|
1384
|
-
|
|
1385
|
-
let n =
|
|
1314
|
+
Y.focus(t);
|
|
1315
|
+
let n = Y.getById(t);
|
|
1386
1316
|
n && e((e) => ({ windows: e.windows.map((e) => e.id === t ? n : e) }));
|
|
1387
1317
|
},
|
|
1388
1318
|
moveWindow: (t, n, r) => {
|
|
1389
|
-
|
|
1319
|
+
Y.move(t, n, r), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
|
|
1390
1320
|
...e,
|
|
1391
1321
|
x: n,
|
|
1392
1322
|
y: r
|
|
1393
1323
|
} : e) }));
|
|
1394
1324
|
},
|
|
1395
1325
|
resizeWindow: (t, n, r) => {
|
|
1396
|
-
|
|
1326
|
+
Y.resize(t, n, r), e((e) => ({ windows: e.windows.map((e) => e.id === t ? {
|
|
1397
1327
|
...e,
|
|
1398
1328
|
width: n,
|
|
1399
1329
|
height: r
|
|
@@ -1401,7 +1331,7 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1401
1331
|
},
|
|
1402
1332
|
icons: [],
|
|
1403
1333
|
addIcon: (t) => {
|
|
1404
|
-
let n =
|
|
1334
|
+
let n = m(t);
|
|
1405
1335
|
e((e) => ({ icons: [...e.icons, n] }));
|
|
1406
1336
|
},
|
|
1407
1337
|
removeIcon: (t) => {
|
|
@@ -1412,24 +1342,24 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1412
1342
|
isFsReady: !1,
|
|
1413
1343
|
initFs: async () => {
|
|
1414
1344
|
try {
|
|
1415
|
-
|
|
1416
|
-
let
|
|
1417
|
-
if (
|
|
1418
|
-
let e =
|
|
1419
|
-
|
|
1345
|
+
X.isReady() && X.reinitialize ? await X.reinitialize() : X.isReady() || await X.initialize();
|
|
1346
|
+
let n = await Ue();
|
|
1347
|
+
if (n) {
|
|
1348
|
+
let e = n.sha ?? null, t = await X.getManifestSha();
|
|
1349
|
+
X.isEmpty() ? (await X.seed(n), e && await X.saveManifestSha(e)) : t !== e && e !== null && (await X.mergeSeed(n), await X.saveManifestSha(e));
|
|
1420
1350
|
}
|
|
1421
1351
|
if (e({
|
|
1422
|
-
fsNodes:
|
|
1423
|
-
desktopFolderId:
|
|
1352
|
+
fsNodes: X.getAllNodes(),
|
|
1353
|
+
desktopFolderId: Z(),
|
|
1424
1354
|
isFsReady: !0
|
|
1425
|
-
}), !
|
|
1426
|
-
let
|
|
1355
|
+
}), !O()) {
|
|
1356
|
+
let n = null;
|
|
1427
1357
|
try {
|
|
1428
|
-
if (
|
|
1429
|
-
e({ customApps:
|
|
1430
|
-
for (let e of
|
|
1358
|
+
if (n = await P(), n?.apps?.length) {
|
|
1359
|
+
e({ customApps: n.apps });
|
|
1360
|
+
for (let e of n.apps) G.getState().registerApp(e);
|
|
1431
1361
|
}
|
|
1432
|
-
let r = new Set(
|
|
1362
|
+
let r = new Set(n?.apps?.map((e) => e.id) ?? []), i = t().icons.filter((e) => e.appId && !c.find((t) => t.id === e.appId) && !r.has(e.appId)).map((e) => e.appId);
|
|
1433
1363
|
i.length > 0 && e((e) => ({
|
|
1434
1364
|
icons: e.icons.filter((e) => !i.includes(e.appId)),
|
|
1435
1365
|
customApps: e.customApps.filter((e) => !i.includes(e.id))
|
|
@@ -1438,55 +1368,55 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1438
1368
|
console.warn("[DesktopStore] Failed to load custom apps manifest:", e);
|
|
1439
1369
|
}
|
|
1440
1370
|
}
|
|
1441
|
-
for (let
|
|
1442
|
-
let r =
|
|
1443
|
-
r && (
|
|
1371
|
+
for (let n of l) {
|
|
1372
|
+
let r = c.find((e) => e.id === n);
|
|
1373
|
+
r && (t().icons.some((e) => e.appId === n) || e({ icons: Q(t().icons, {
|
|
1444
1374
|
name: r.name,
|
|
1445
1375
|
icon: r.icon,
|
|
1446
|
-
appId:
|
|
1447
|
-
},
|
|
1376
|
+
appId: n
|
|
1377
|
+
}, t().viewportHeight) }));
|
|
1448
1378
|
}
|
|
1449
|
-
if (!
|
|
1450
|
-
let
|
|
1451
|
-
if (
|
|
1379
|
+
if (!O()) {
|
|
1380
|
+
let n = t().customApps;
|
|
1381
|
+
if (n.length) for (let r of n) t().icons.some((e) => e.appId === r.id) || e({ icons: Q(t().icons, {
|
|
1452
1382
|
name: r.name,
|
|
1453
1383
|
icon: r.icon,
|
|
1454
1384
|
appId: r.id
|
|
1455
|
-
},
|
|
1385
|
+
}, t().viewportHeight) });
|
|
1456
1386
|
}
|
|
1457
|
-
let
|
|
1458
|
-
if (!
|
|
1459
|
-
|
|
1460
|
-
if (
|
|
1461
|
-
let r =
|
|
1462
|
-
r ? r.nodeId || e({ icons:
|
|
1387
|
+
let r = Z();
|
|
1388
|
+
if (!r) return;
|
|
1389
|
+
X.getChildren(r).forEach((n) => {
|
|
1390
|
+
if (n.type !== "file") return;
|
|
1391
|
+
let r = t().icons.find((e) => e.name === n.name);
|
|
1392
|
+
r ? r.nodeId || e({ icons: t().icons.map((e) => e.name === n.name ? {
|
|
1463
1393
|
...e,
|
|
1464
|
-
nodeId:
|
|
1465
|
-
} : e) }) : e({ icons:
|
|
1466
|
-
name:
|
|
1394
|
+
nodeId: n.id
|
|
1395
|
+
} : e) }) : e({ icons: Q(t().icons, {
|
|
1396
|
+
name: n.name,
|
|
1467
1397
|
icon: "📄",
|
|
1468
|
-
appId: U(
|
|
1469
|
-
nodeId:
|
|
1470
|
-
},
|
|
1471
|
-
}),
|
|
1398
|
+
appId: U(n.mimeType),
|
|
1399
|
+
nodeId: n.id
|
|
1400
|
+
}, t().viewportHeight) });
|
|
1401
|
+
}), Xe();
|
|
1472
1402
|
} catch (t) {
|
|
1473
1403
|
console.error("Failed to initialize filesystem:", t), e({ isFsReady: !0 });
|
|
1474
1404
|
}
|
|
1475
1405
|
},
|
|
1476
|
-
createFile: async (
|
|
1477
|
-
let o = await
|
|
1406
|
+
createFile: async (n, r, i, a) => {
|
|
1407
|
+
let o = await X.createFile(n, r, i, a), s = Z(), { icons: c, viewportHeight: l } = t(), u = i && i === s && !c.some((e) => e.name === o.name) ? Q(c, {
|
|
1478
1408
|
name: o.name,
|
|
1479
1409
|
icon: "📄",
|
|
1480
1410
|
appId: U(o.mimeType),
|
|
1481
1411
|
nodeId: o.id
|
|
1482
1412
|
}, l) : c;
|
|
1483
1413
|
return e({
|
|
1484
|
-
fsNodes:
|
|
1414
|
+
fsNodes: X.getAllNodes(),
|
|
1485
1415
|
icons: u
|
|
1486
1416
|
}), o;
|
|
1487
1417
|
},
|
|
1488
|
-
createFolder: async (
|
|
1489
|
-
let o = await
|
|
1418
|
+
createFolder: async (n, r, i, a) => {
|
|
1419
|
+
let o = await X.createFolder(n, r, i, a), s = Z(), { icons: c, viewportHeight: l } = t(), u = r && r === s && !c.some((e) => e.name === o.name) ? Q(c, {
|
|
1490
1420
|
name: o.name,
|
|
1491
1421
|
icon: "📁",
|
|
1492
1422
|
iconName: o.iconName,
|
|
@@ -1495,28 +1425,28 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1495
1425
|
nodeId: o.id
|
|
1496
1426
|
}, l) : c;
|
|
1497
1427
|
return e({
|
|
1498
|
-
fsNodes:
|
|
1428
|
+
fsNodes: X.getAllNodes(),
|
|
1499
1429
|
icons: u
|
|
1500
1430
|
}), o;
|
|
1501
1431
|
},
|
|
1502
1432
|
updateFile: async (t, n) => {
|
|
1503
|
-
await
|
|
1433
|
+
await X.updateFile(t, n), e({ fsNodes: X.getAllNodes() });
|
|
1504
1434
|
},
|
|
1505
1435
|
deleteNode: async (t) => {
|
|
1506
|
-
let n =
|
|
1507
|
-
if (await
|
|
1508
|
-
let t =
|
|
1436
|
+
let n = X.getNode(t);
|
|
1437
|
+
if (await X.delete(t), e({ fsNodes: X.getAllNodes() }), n?.type === "file" || n?.type === "folder") {
|
|
1438
|
+
let t = Z();
|
|
1509
1439
|
n.parentId && n.parentId === t && e((e) => ({ icons: e.icons.filter((e) => e.name !== n.name) }));
|
|
1510
1440
|
}
|
|
1511
1441
|
},
|
|
1512
1442
|
moveNode: async (t, n) => {
|
|
1513
|
-
await
|
|
1443
|
+
await X.move(t, n), e({ fsNodes: X.getAllNodes() });
|
|
1514
1444
|
},
|
|
1515
1445
|
setFsNodes: (t) => {
|
|
1516
1446
|
e({ fsNodes: t });
|
|
1517
1447
|
},
|
|
1518
1448
|
syncIcons: () => {
|
|
1519
|
-
|
|
1449
|
+
Xe();
|
|
1520
1450
|
},
|
|
1521
1451
|
clipboard: {
|
|
1522
1452
|
content: [],
|
|
@@ -1566,38 +1496,38 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1566
1496
|
} });
|
|
1567
1497
|
},
|
|
1568
1498
|
mergeSeed: async (t) => {
|
|
1569
|
-
await
|
|
1570
|
-
fsNodes:
|
|
1571
|
-
desktopFolderId:
|
|
1499
|
+
await X.mergeSeed(t), e({
|
|
1500
|
+
fsNodes: X.getAllNodes(),
|
|
1501
|
+
desktopFolderId: Z()
|
|
1572
1502
|
});
|
|
1573
1503
|
},
|
|
1574
|
-
mergeDesktopApps: (
|
|
1575
|
-
for (let r of
|
|
1576
|
-
let
|
|
1577
|
-
|
|
1578
|
-
name:
|
|
1579
|
-
icon:
|
|
1504
|
+
mergeDesktopApps: (n) => {
|
|
1505
|
+
for (let r of n) {
|
|
1506
|
+
let n = c.find((e) => e.id === r);
|
|
1507
|
+
n && (t().icons.some((e) => e.appId === r) || e({ icons: Q(t().icons, {
|
|
1508
|
+
name: n.name,
|
|
1509
|
+
icon: n.icon,
|
|
1580
1510
|
appId: r
|
|
1581
|
-
},
|
|
1511
|
+
}, t().viewportHeight) }));
|
|
1582
1512
|
}
|
|
1583
|
-
let r =
|
|
1584
|
-
if (r) for (let
|
|
1585
|
-
name:
|
|
1513
|
+
let r = Z();
|
|
1514
|
+
if (r) for (let n of X.getChildren(r)) n.type === "file" && (t().icons.some((e) => e.name === n.name) || e({ icons: Q(t().icons, {
|
|
1515
|
+
name: n.name,
|
|
1586
1516
|
icon: "📄",
|
|
1587
|
-
appId: U(
|
|
1588
|
-
nodeId:
|
|
1589
|
-
},
|
|
1517
|
+
appId: U(n.mimeType),
|
|
1518
|
+
nodeId: n.id
|
|
1519
|
+
}, t().viewportHeight) }));
|
|
1590
1520
|
},
|
|
1591
|
-
reorderDesktopApps: (
|
|
1592
|
-
let r =
|
|
1521
|
+
reorderDesktopApps: (n) => {
|
|
1522
|
+
let r = t().icons, i = [], a = [];
|
|
1593
1523
|
for (let e of r) e.appId && !e.nodeId ? i.push(e) : a.push(e);
|
|
1594
1524
|
let o = [];
|
|
1595
|
-
for (let e of
|
|
1525
|
+
for (let e of n) {
|
|
1596
1526
|
let t = i.findIndex((t) => t.appId === e);
|
|
1597
1527
|
t !== -1 && o.push(i[t]);
|
|
1598
1528
|
}
|
|
1599
1529
|
for (let e of i) o.includes(e) || o.push(e);
|
|
1600
|
-
let s = 20, c = 20, l =
|
|
1530
|
+
let s = 20, c = 20, l = t().viewportHeight, u = Math.max(1, Math.floor((l - 48 - 20) / 80));
|
|
1601
1531
|
for (let e = 0; e < o.length; e++) {
|
|
1602
1532
|
let t = Math.floor(e / 1);
|
|
1603
1533
|
t >= u && t > 0 && (c += 80, s = 20), o[e] = {
|
|
@@ -1615,22 +1545,22 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1615
1545
|
removeNotification: (t) => {
|
|
1616
1546
|
e((e) => ({ notifications: e.notifications.filter((e) => e.id !== t) }));
|
|
1617
1547
|
},
|
|
1618
|
-
viewportWidth:
|
|
1619
|
-
viewportHeight:
|
|
1548
|
+
viewportWidth: He,
|
|
1549
|
+
viewportHeight: J,
|
|
1620
1550
|
isViewportInitialized: !1,
|
|
1621
|
-
setViewportSize: (
|
|
1622
|
-
let i =
|
|
1623
|
-
if (i ===
|
|
1551
|
+
setViewportSize: (n, r) => {
|
|
1552
|
+
let i = t().viewportWidth, a = t().viewportHeight, o = t().isViewportInitialized;
|
|
1553
|
+
if (i === n && a === r) return;
|
|
1624
1554
|
if (e({
|
|
1625
|
-
viewportWidth:
|
|
1555
|
+
viewportWidth: n,
|
|
1626
1556
|
viewportHeight: r
|
|
1627
1557
|
}), !o) {
|
|
1628
1558
|
e({ isViewportInitialized: !0 });
|
|
1629
1559
|
return;
|
|
1630
1560
|
}
|
|
1631
1561
|
if (a !== r) {
|
|
1632
|
-
let
|
|
1633
|
-
|
|
1562
|
+
let n = Math.max(1, Math.floor((a - 20) / 80)), i = Math.max(1, Math.floor((r - 20) / 80));
|
|
1563
|
+
n !== i && e({ icons: t().icons.map((e, t) => {
|
|
1634
1564
|
let n = Math.floor(t / i), r = t % i;
|
|
1635
1565
|
return {
|
|
1636
1566
|
...e,
|
|
@@ -1639,19 +1569,19 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1639
1569
|
};
|
|
1640
1570
|
}) });
|
|
1641
1571
|
}
|
|
1642
|
-
let s =
|
|
1572
|
+
let s = n < 768, c = t().windows.map((e) => {
|
|
1643
1573
|
if (e.state !== "normal") return e;
|
|
1644
1574
|
if (s) return {
|
|
1645
1575
|
...e,
|
|
1646
1576
|
x: 0,
|
|
1647
1577
|
y: 0,
|
|
1648
|
-
width:
|
|
1578
|
+
width: n,
|
|
1649
1579
|
height: r,
|
|
1650
1580
|
minWidth: void 0,
|
|
1651
1581
|
minHeight: void 0
|
|
1652
1582
|
};
|
|
1653
|
-
let
|
|
1654
|
-
return u >
|
|
1583
|
+
let t = i > 0 ? n / i : 1, o = a > 0 ? r / a : 1, c = Math.round(e.x * t), l = Math.round(e.y * o), u = e.width, d = e.height;
|
|
1584
|
+
return u > n && (u = n), d > r && (d = r), c = Math.max(0, Math.min(c, n - Math.min(u, 100))), l = Math.max(0, Math.min(l, r - Math.min(d, 40))), {
|
|
1655
1585
|
...e,
|
|
1656
1586
|
x: c,
|
|
1657
1587
|
y: l,
|
|
@@ -1659,14 +1589,14 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1659
1589
|
height: d
|
|
1660
1590
|
};
|
|
1661
1591
|
});
|
|
1662
|
-
for (let e of c)
|
|
1592
|
+
for (let e of c) Y.move(e.id, e.x, e.y), Y.resize(e.id, e.width, e.height);
|
|
1663
1593
|
e({ windows: c });
|
|
1664
1594
|
},
|
|
1665
1595
|
desktopSortMode: "default",
|
|
1666
1596
|
filesSortMode: "default",
|
|
1667
|
-
setDesktopSortMode: (
|
|
1668
|
-
e({ desktopSortMode:
|
|
1669
|
-
let r =
|
|
1597
|
+
setDesktopSortMode: (n) => {
|
|
1598
|
+
e({ desktopSortMode: n });
|
|
1599
|
+
let r = t().icons, i = V(r, n), a = t().viewportHeight;
|
|
1670
1600
|
e({ icons: i.map((e, t) => ({
|
|
1671
1601
|
...e,
|
|
1672
1602
|
...Ye(t, a)
|
|
@@ -1675,16 +1605,16 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1675
1605
|
setFilesSortMode: (t) => {
|
|
1676
1606
|
e({ filesSortMode: t });
|
|
1677
1607
|
},
|
|
1678
|
-
launcherFolders:
|
|
1608
|
+
launcherFolders: k,
|
|
1679
1609
|
setLauncherFolders: (t) => {
|
|
1680
1610
|
e({ launcherFolders: t });
|
|
1681
1611
|
},
|
|
1682
1612
|
createLauncherFolder: (t) => {
|
|
1683
|
-
let n =
|
|
1613
|
+
let n = h(t);
|
|
1684
1614
|
return e((e) => ({ launcherFolders: [...e.launcherFolders, n].sort((e, t) => e.order - t.order) })), n;
|
|
1685
1615
|
},
|
|
1686
1616
|
updateLauncherFolder: (t, n) => {
|
|
1687
|
-
e((e) => ({ launcherFolders: e.launcherFolders.map((e) => e.id === t ?
|
|
1617
|
+
e((e) => ({ launcherFolders: e.launcherFolders.map((e) => e.id === t ? g(e, n) : e) }));
|
|
1688
1618
|
},
|
|
1689
1619
|
deleteLauncherFolder: (t) => {
|
|
1690
1620
|
e((e) => ({ launcherFolders: e.launcherFolders.filter((e) => e.id !== t || e.isPredefined) }));
|
|
@@ -1711,19 +1641,19 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1711
1641
|
setCustomApps: (t) => {
|
|
1712
1642
|
e({ customApps: t });
|
|
1713
1643
|
},
|
|
1714
|
-
handleCustomAppRegistered: (
|
|
1715
|
-
e((e) => ({ customApps: e.customApps.some((e) => e.id ===
|
|
1716
|
-
name:
|
|
1717
|
-
icon:
|
|
1718
|
-
appId:
|
|
1644
|
+
handleCustomAppRegistered: (n) => {
|
|
1645
|
+
e((e) => ({ customApps: e.customApps.some((e) => e.id === n.id) ? e.customApps.map((e) => e.id === n.id ? n : e) : [...e.customApps, n] })), t().icons.find((e) => e.appId === n.id) || e((e) => ({ icons: Q(e.icons, {
|
|
1646
|
+
name: n.name,
|
|
1647
|
+
icon: n.icon || "FcDataSheet",
|
|
1648
|
+
appId: n.id
|
|
1719
1649
|
}, e.viewportHeight) }));
|
|
1720
1650
|
},
|
|
1721
|
-
handleCustomAppUnregistered: (
|
|
1722
|
-
e((e) => ({ customApps: e.customApps.filter((e) => e.id !==
|
|
1651
|
+
handleCustomAppUnregistered: (n) => {
|
|
1652
|
+
e((e) => ({ customApps: e.customApps.filter((e) => e.id !== n) })), e((e) => ({ icons: e.icons.filter((e) => e.appId !== n) })), t().windows.filter((e) => e.content === n).forEach((e) => t().closeWindow(e.id)), G.getState().clearApp(n);
|
|
1723
1653
|
}
|
|
1724
1654
|
}), {
|
|
1725
1655
|
name: "fde-desktop",
|
|
1726
|
-
storage:
|
|
1656
|
+
storage: t(() => localStorage),
|
|
1727
1657
|
partialize: (e) => ({
|
|
1728
1658
|
windows: e.windows,
|
|
1729
1659
|
icons: e.icons,
|
|
@@ -1736,7 +1666,7 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1736
1666
|
}),
|
|
1737
1667
|
merge: (e, t) => {
|
|
1738
1668
|
let n = e, r = ["createItem"], i = (n.windows ?? []).filter((e) => !r.includes(e.content)).map((e) => {
|
|
1739
|
-
let r =
|
|
1669
|
+
let r = c.find((t) => t.id === e.content), i = (n.customApps ?? t.customApps)?.find((t) => t.id === e.content);
|
|
1740
1670
|
return {
|
|
1741
1671
|
...e,
|
|
1742
1672
|
icon: e.icon ?? r?.icon ?? i?.icon,
|
|
@@ -1744,20 +1674,20 @@ var X = () => Y.getRootNodes().find((e) => e.type === "folder" && e.name === "De
|
|
|
1744
1674
|
iconUrl: e.iconUrl ?? r?.iconUrl,
|
|
1745
1675
|
iconColor: r?.iconColor,
|
|
1746
1676
|
canMaximize: r?.canMaximize ?? i?.window?.canMaximize,
|
|
1747
|
-
minWidth: r?.minWidth === !1 || i?.window?.minWidth === !1 ? void 0 : r?.minWidth ?? i?.window?.minWidth ??
|
|
1748
|
-
minHeight: r?.minHeight === !1 || i?.window?.minHeight === !1 ? void 0 : r?.minHeight ?? i?.window?.minHeight ??
|
|
1677
|
+
minWidth: r?.minWidth === !1 || i?.window?.minWidth === !1 ? void 0 : r?.minWidth ?? i?.window?.minWidth ?? a.minWidth,
|
|
1678
|
+
minHeight: r?.minHeight === !1 || i?.window?.minHeight === !1 ? void 0 : r?.minHeight ?? i?.window?.minHeight ?? a.minHeight
|
|
1749
1679
|
};
|
|
1750
1680
|
});
|
|
1751
|
-
|
|
1752
|
-
let
|
|
1681
|
+
Y.loadWindows(i);
|
|
1682
|
+
let o = new Set(k.map((e) => e.id)), s = (n.launcherFolders ?? []).filter((e) => !o.has(e.id)), l = [...k, ...s].sort((e, t) => e.order - t.order), u = n.viewportWidth != null && n.viewportHeight != null;
|
|
1753
1683
|
return {
|
|
1754
1684
|
...t,
|
|
1755
1685
|
...n,
|
|
1756
1686
|
windows: i,
|
|
1757
|
-
launcherFolders:
|
|
1687
|
+
launcherFolders: l,
|
|
1758
1688
|
viewportWidth: n.viewportWidth ?? t.viewportWidth,
|
|
1759
1689
|
viewportHeight: n.viewportHeight ?? t.viewportHeight,
|
|
1760
|
-
isViewportInitialized:
|
|
1690
|
+
isViewportInitialized: u ? !0 : t.isViewportInitialized
|
|
1761
1691
|
};
|
|
1762
1692
|
}
|
|
1763
1693
|
}));
|
|
@@ -1765,4 +1695,4 @@ typeof window < "u" && (window.__DESKTOP_STATE__ = $.getState(), $.subscribe((e)
|
|
|
1765
1695
|
window.__DESKTOP_STATE__ = e;
|
|
1766
1696
|
}));
|
|
1767
1697
|
//#endregion
|
|
1768
|
-
export {
|
|
1698
|
+
export { v as $, P as A, k as B, Te as C, Ee as D, L as E, Ce as F, de as G, D as H, ye as I, le as J, fe as K, we as L, be as M, I as N, F as O, xe as P, te as Q, ve as R, H as S, V as T, O as U, he as V, pe as W, x as X, T as Y, b as Z, Me as _, qe as a, p as at, ke as b, He as c, c as ct, Be as d, d as dt, _ as et, Re as f, o as ft, Fe as g, Pe as h, Ke as i, m as it, _e as j, Se as k, ze as l, l as lt, Ne as m, a as mt, X as n, ee as nt, $ as o, f as ot, Ie as p, s as pt, ue as q, Ge as r, g as rt, J as s, i as st, Ue as t, h as tt, Ve as u, u as ut, G as v, B as w, U as x, Oe as y, me as z };
|