@fde-desktop/fde-core 0.3.8 → 0.4.2
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/README.md +419 -68
- package/dist/CalendarApp-CHLUCAI7.css +744 -0
- package/dist/CalendarApp-K7ZOUZ6C.js +2 -0
- package/dist/CalendarApp-OTGEERSS.cjs +8 -0
- package/dist/CodeServerApp-5KZGO7HL.css +75 -0
- package/dist/CodeServerApp-LUZFCQBI.js +3 -0
- package/dist/CodeServerApp-P3TMJPLY.cjs +9 -0
- package/dist/CreateItemApp-NAZMXOPK.cjs +14 -0
- package/dist/CreateItemApp-PQB5GTFG.css +107 -0
- package/dist/CreateItemApp-ZHCTSPQE.js +8 -0
- package/dist/DeviceInfoApp-R6YNVIGX.cjs +11 -0
- package/dist/DeviceInfoApp-YHCYAO6N.js +5 -0
- package/dist/DeviceInfoApp-ZSMRSITP.css +7 -0
- package/dist/FilesApp-AKCVRTXR.js +8 -0
- package/dist/FilesApp-E6L5W3T2.css +1817 -0
- package/dist/FilesApp-RW3Y6ILO.cjs +14 -0
- package/dist/ImageViewerApp-5UXNSW2O.js +11 -0
- package/dist/ImageViewerApp-N2Q7E7WZ.css +215 -0
- package/dist/ImageViewerApp-RRRRKSFN.cjs +17 -0
- package/dist/ImageViewerMenuBar-I3TFKQPS.cjs +14 -0
- package/dist/ImageViewerMenuBar-TV5C6TM2.js +5 -0
- package/dist/ImageViewerMenuBar-XLK4LIHW.css +56 -0
- package/dist/MenuEditApp-HUZRFEHE.js +9 -0
- package/dist/MenuEditApp-MCUHGTKQ.cjs +15 -0
- package/dist/MenuEditApp-YA6HSAMJ.css +94 -0
- package/dist/MenuEditMenuBar-7VHMZNRM.css +56 -0
- package/dist/MenuEditMenuBar-GF6L4PGZ.cjs +15 -0
- package/dist/MenuEditMenuBar-IUXFPZE5.js +6 -0
- package/dist/NotesApp-37BV33C6.js +10 -0
- package/dist/NotesApp-4EVUQEFZ.cjs +16 -0
- package/dist/NotesApp-TQ6IHDNX.css +302 -0
- package/dist/NotesMenuBar-25LKN3SE.cjs +15 -0
- package/dist/NotesMenuBar-MXLOX7OT.css +56 -0
- package/dist/NotesMenuBar-SRV3AIAL.js +6 -0
- package/dist/PdfApp-5VBDNRMC.cjs +16 -0
- package/dist/PdfApp-BUIC5U5H.css +206 -0
- package/dist/PdfApp-RH6MZZX5.js +10 -0
- package/dist/PdfMenuBar-NLZC6JHS.js +4 -0
- package/dist/PdfMenuBar-QUM72EE4.css +56 -0
- package/dist/PdfMenuBar-WBRTKMLN.cjs +13 -0
- package/dist/SettingsApp-5LDHEHYV.cjs +20 -0
- package/dist/SettingsApp-JVOSEFH3.css +283 -0
- package/dist/SettingsApp-X6764D7T.js +14 -0
- package/dist/SettingsMenuBar-5CBSSMVM.css +56 -0
- package/dist/SettingsMenuBar-VLT6TTCM.js +6 -0
- package/dist/SettingsMenuBar-Y5QEXDEO.cjs +15 -0
- package/dist/StorybookApp-NQ244BER.css +7 -0
- package/dist/StorybookApp-NZDV4X3Y.js +1 -0
- package/dist/StorybookApp-VF3KIMU3.cjs +7 -0
- package/dist/TerminalApp-CDGWRBFJ.cjs +10 -0
- package/dist/TerminalApp-EAATMIMX.css +77 -0
- package/dist/TerminalApp-GCKJCM55.js +4 -0
- package/dist/TerminalMenuBar-3J26O26Q.css +56 -0
- package/dist/TerminalMenuBar-7BH7MGNJ.cjs +14 -0
- package/dist/TerminalMenuBar-7JAEQUZ4.js +5 -0
- package/dist/UploaderApp-2WYRCUQV.js +10 -0
- package/dist/UploaderApp-6KV3TGCT.css +1817 -0
- package/dist/UploaderApp-EYFC36PM.cjs +16 -0
- package/dist/chunk-2FO445RM.cjs +449 -0
- package/dist/chunk-2PSTHGTD.cjs +42 -0
- package/dist/chunk-2RQX7QBP.cjs +148 -0
- package/dist/chunk-3IICBLEA.js +442 -0
- package/dist/chunk-43W6UDUZ.cjs +19 -0
- package/dist/chunk-4E45FBAH.js +223 -0
- package/dist/chunk-4MCFQPKY.js +444 -0
- package/dist/chunk-4OH5RPSQ.cjs +38 -0
- package/dist/chunk-4XURSNM4.js +43 -0
- package/dist/chunk-4ZCRYHL6.js +407 -0
- package/dist/chunk-54PYEQLK.js +283 -0
- package/dist/chunk-5C6IQE42.cjs +35 -0
- package/dist/chunk-5NOHYJNH.js +84 -0
- package/dist/chunk-5PYK5ASL.js +162 -0
- package/dist/chunk-5YH6AKEO.js +146 -0
- package/dist/chunk-657BJOY5.cjs +324 -0
- package/dist/chunk-6QOUYSEE.cjs +2303 -0
- package/dist/chunk-7SAFECOJ.js +215 -0
- package/dist/chunk-7Y7HB7FB.cjs +53 -0
- package/dist/chunk-ABIAPZ6S.cjs +45 -0
- package/dist/chunk-AQL372JF.cjs +219 -0
- package/dist/chunk-AXDUVZVP.cjs +88 -0
- package/dist/chunk-AYFNYHMP.js +541 -0
- package/dist/chunk-BDO6B7MZ.cjs +451 -0
- package/dist/chunk-BKXEA2BK.cjs +286 -0
- package/dist/chunk-BLV47DX2.js +47 -0
- package/dist/chunk-BQCD5RAF.cjs +48 -0
- package/dist/chunk-BQL3YXMV.js +17429 -0
- package/dist/chunk-C6BEZNAM.cjs +45 -0
- package/dist/chunk-CFWV2JMR.js +234 -0
- package/dist/chunk-CV5PUHAE.cjs +86 -0
- package/dist/chunk-D5MVFFID.js +42 -0
- package/dist/chunk-D7R55WWT.js +1601 -0
- package/dist/chunk-DMNF4CNN.cjs +49 -0
- package/dist/chunk-DWP2SYF7.js +55 -0
- package/dist/chunk-E55VXNLK.cjs +17498 -0
- package/dist/chunk-EAELL43F.js +42 -0
- package/dist/chunk-EUQLZW6P.js +48 -0
- package/dist/chunk-EX5V2ZTU.js +40 -0
- package/dist/chunk-FH4ILMKF.js +38 -0
- package/dist/chunk-FRHBM2U7.js +33 -0
- package/dist/chunk-FX2TPX3L.cjs +45 -0
- package/dist/chunk-GCYD6T52.js +32 -0
- package/dist/chunk-GRYCUBJZ.js +9 -0
- package/dist/chunk-HWHBSAUC.js +40 -0
- package/dist/chunk-ICUE6T7J.cjs +50 -0
- package/dist/chunk-IDHP3R4I.js +31 -0
- package/dist/chunk-IUOQPOEN.js +2293 -0
- package/dist/chunk-J7L2S2GT.cjs +34 -0
- package/dist/chunk-JEBKLIMU.cjs +123 -0
- package/dist/chunk-KQHICFX3.js +121 -0
- package/dist/chunk-LMJE6V4N.cjs +42 -0
- package/dist/chunk-MVDGM5Y4.js +68 -0
- package/dist/chunk-NVEGEK3N.js +31 -0
- package/dist/chunk-NWMSWRUD.js +2236 -0
- package/dist/chunk-ODXL6BR3.js +77 -0
- package/dist/chunk-OJIDKDKF.js +68 -0
- package/dist/chunk-PKPQA5NR.js +15 -0
- package/dist/chunk-PNDBLFJW.cjs +50 -0
- package/dist/chunk-PYTKNRGM.js +280 -0
- package/dist/chunk-Q3WA72BF.cjs +70 -0
- package/dist/chunk-QB72BLCJ.cjs +237 -0
- package/dist/chunk-QHBBLML3.js +86 -0
- package/dist/chunk-RDIDAZ3S.cjs +9 -0
- package/dist/chunk-RGJPRXYY.js +48 -0
- package/dist/chunk-RQ6OZRUW.cjs +41 -0
- package/dist/chunk-SBE4SZAN.cjs +226 -0
- package/dist/chunk-SYGUWGWK.cjs +2329 -0
- package/dist/chunk-TDZ43MUX.cjs +165 -0
- package/dist/chunk-TGWMOHAO.js +17 -0
- package/dist/chunk-U4RYIS6Z.cjs +548 -0
- package/dist/chunk-UIQCTAVM.cjs +59 -0
- package/dist/chunk-XVASHRCE.cjs +70 -0
- package/dist/chunk-XYSMVQQD.cjs +1608 -0
- package/dist/chunk-YAIWI4Z5.js +7 -0
- package/dist/chunk-YP2PLNOF.cjs +34 -0
- package/dist/chunk-YSOLW4FS.cjs +11 -0
- package/dist/chunk-YY6OUR2U.js +44 -0
- package/dist/chunk-YZWS7FDT.cjs +409 -0
- package/dist/chunk-Z5YGWL65.cjs +39 -0
- package/dist/chunk-ZBGWYTCU.cjs +83 -0
- package/dist/chunk-ZHB5Q2M6.js +36 -0
- package/dist/chunk-ZHNDXNL4.js +45 -0
- package/dist/chunk-ZX3EDZ5C.cjs +17 -0
- package/dist/index.cjs +4405 -5156
- package/dist/index.css +9192 -0
- package/dist/index.d.cts +1324 -762
- package/dist/index.d.ts +1324 -762
- package/dist/index.js +3648 -5038
- package/package.json +14 -6
package/README.md
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @fde-desktop/fde-core
|
|
2
2
|
|
|
3
|
-
Core library for building FDE Desktop environments. This package provides
|
|
3
|
+
Core library for building FDE Desktop environments. This package provides everything needed to create desktop-like applications in React:
|
|
4
|
+
|
|
5
|
+
- **UI Components**: Desktop, Window, Taskbar, Launcher, ContextMenu, etc.
|
|
6
|
+
- **Core Apps**: Files, Settings, Notepad, Image Viewer, PDF Viewer, etc.
|
|
7
|
+
- **Stores**: Zustand stores for desktop, settings, custom apps
|
|
8
|
+
- **Hooks**: 30+ hooks for app management, notifications, icons, file system, etc.
|
|
9
|
+
- **Domain Entities**: createWindow, createDesktopIcon, createLauncherFolder
|
|
10
|
+
- **Infrastructure**: IndexedDBFileSystem, DockerFileSystemAdapter, FdeApiAdapter
|
|
11
|
+
- **Types & Utilities**: Full TypeScript types and helper functions
|
|
4
12
|
|
|
5
13
|
## Installation
|
|
6
14
|
|
|
7
15
|
```bash
|
|
8
|
-
npm install @
|
|
16
|
+
npm install @fde-desktop/fde-core
|
|
9
17
|
# or
|
|
10
|
-
yarn add @
|
|
18
|
+
yarn add @fde-desktop/fde-core
|
|
11
19
|
# or
|
|
12
|
-
bun add @
|
|
20
|
+
bun add @fde-desktop/fde-core
|
|
13
21
|
```
|
|
14
22
|
|
|
15
23
|
## Peer Dependencies
|
|
@@ -17,89 +25,448 @@ bun add @frannunpal/fde-core react react-dom
|
|
|
17
25
|
- `react` ^19.0.0
|
|
18
26
|
- `react-dom` ^19.0.0
|
|
19
27
|
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
The simplest way is to use the `FdeDesktop` component:
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { FdeDesktop, type AppRegistryEntry } from '@fde-desktop/fde-core';
|
|
34
|
+
|
|
35
|
+
// Define your custom apps (optional)
|
|
36
|
+
const myApps: Record<string, AppRegistryEntry> = {
|
|
37
|
+
'my-app': {
|
|
38
|
+
loader: () => import('./MyApp'),
|
|
39
|
+
appName: 'My App',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function App() {
|
|
44
|
+
return <FdeDesktop customApps={myApps}>{/* Optional: custom desktop content */}</FdeDesktop>;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Core apps (Files, Settings, Notepad, etc.) are loaded automatically. Your custom apps are merged with the core registry.
|
|
49
|
+
|
|
20
50
|
## Exports
|
|
21
51
|
|
|
52
|
+
### UI Components
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import {
|
|
56
|
+
// Main wrapper
|
|
57
|
+
FdeDesktop,
|
|
58
|
+
|
|
59
|
+
// Desktop components
|
|
60
|
+
Desktop,
|
|
61
|
+
DesktopIcon,
|
|
62
|
+
Window,
|
|
63
|
+
AppMenuBar,
|
|
64
|
+
DynamicMenuBarRenderer,
|
|
65
|
+
|
|
66
|
+
// System UI
|
|
67
|
+
Taskbar,
|
|
68
|
+
Launcher,
|
|
69
|
+
TaskbarContextMenu,
|
|
70
|
+
LanguageSelector,
|
|
71
|
+
|
|
72
|
+
// Menus
|
|
73
|
+
ContextMenu,
|
|
74
|
+
CreateItemContextMenu,
|
|
75
|
+
|
|
76
|
+
// Theme
|
|
77
|
+
ThemeProvider,
|
|
78
|
+
useTheme,
|
|
79
|
+
DEFAULT_FDE_THEME,
|
|
80
|
+
|
|
81
|
+
// Context
|
|
82
|
+
FdeProvider,
|
|
83
|
+
useFdeContext,
|
|
84
|
+
AppReadyProvider,
|
|
85
|
+
useAppReady,
|
|
86
|
+
|
|
87
|
+
// Registry helpers
|
|
88
|
+
initRegistry,
|
|
89
|
+
getAppComponent,
|
|
90
|
+
getMenuBarComponent,
|
|
91
|
+
getMenuBarBuilder,
|
|
92
|
+
isLazyApp,
|
|
93
|
+
getAppName,
|
|
94
|
+
registerComponents,
|
|
95
|
+
} from '@fde-desktop/fde-core';
|
|
96
|
+
```
|
|
97
|
+
|
|
22
98
|
### Apps (Core Apps)
|
|
23
99
|
|
|
24
|
-
```
|
|
100
|
+
```tsx
|
|
25
101
|
import {
|
|
26
102
|
FilesApp,
|
|
27
103
|
SettingsApp,
|
|
28
|
-
|
|
104
|
+
NotesApp,
|
|
29
105
|
ImageViewerApp,
|
|
30
106
|
PdfApp,
|
|
31
107
|
UploaderApp,
|
|
32
108
|
MenuEditApp,
|
|
33
109
|
DeviceInfoApp,
|
|
34
110
|
CalendarApp,
|
|
111
|
+
TerminalApp,
|
|
112
|
+
CodeServerApp,
|
|
35
113
|
CORE_APPS,
|
|
36
114
|
CORE_APP_IDS,
|
|
37
|
-
|
|
115
|
+
DEFAULT_WINDOW_DIMENSIONS,
|
|
116
|
+
} from '@fde-desktop/fde-core';
|
|
117
|
+
|
|
118
|
+
// Menu bar components for apps
|
|
119
|
+
import {
|
|
120
|
+
NotesMenuBar,
|
|
121
|
+
SettingsMenuBar,
|
|
122
|
+
PdfMenuBar,
|
|
123
|
+
ImageViewerMenuBar,
|
|
124
|
+
MenuEditMenuBar,
|
|
125
|
+
TerminalMenuBar,
|
|
126
|
+
} from '@fde-desktop/fde-core';
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Lazy-Loaded App Components
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import {
|
|
133
|
+
FilesAppLazy,
|
|
134
|
+
NotesAppLazy,
|
|
135
|
+
ImageViewerAppLazy,
|
|
136
|
+
PdfAppLazy,
|
|
137
|
+
MenuEditAppLazy,
|
|
138
|
+
UploaderAppLazy,
|
|
139
|
+
SettingsAppLazy,
|
|
140
|
+
DeviceInfoAppLazy,
|
|
141
|
+
CalendarAppLazy,
|
|
142
|
+
CreateItemAppLazy,
|
|
143
|
+
} from '@fde-desktop/fde-core';
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Shared Components
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import {
|
|
150
|
+
AppIcon,
|
|
151
|
+
VscIcon,
|
|
152
|
+
AppLoading,
|
|
153
|
+
AppEmptyState,
|
|
154
|
+
LanguageFlag,
|
|
155
|
+
CollapsibleSection,
|
|
156
|
+
FileIcon,
|
|
157
|
+
DirtyIndicator,
|
|
158
|
+
ColorPicker,
|
|
159
|
+
CreateItemApp,
|
|
160
|
+
DownloadProgress,
|
|
161
|
+
FilePickerApp,
|
|
162
|
+
FilePickerModal,
|
|
163
|
+
FolderPicker,
|
|
164
|
+
IconColorPicker,
|
|
165
|
+
SettingsSection,
|
|
166
|
+
ExternalLinkApp,
|
|
167
|
+
CustomAppLoader,
|
|
168
|
+
CustomAppLoadingScreen,
|
|
169
|
+
CustomAppNotSupported,
|
|
170
|
+
CustomAppOffline,
|
|
171
|
+
PortraitWarning,
|
|
172
|
+
} from '@fde-desktop/fde-core';
|
|
38
173
|
```
|
|
39
174
|
|
|
40
175
|
### Stores
|
|
41
176
|
|
|
42
|
-
```
|
|
177
|
+
```tsx
|
|
43
178
|
import {
|
|
44
179
|
useDesktopStore,
|
|
45
180
|
useSettingsStore,
|
|
46
181
|
useCustomAppStore,
|
|
47
182
|
useAppTempMemoryStore,
|
|
48
|
-
|
|
183
|
+
useCloseModalStore,
|
|
184
|
+
fileSystem,
|
|
185
|
+
resetFileSystem,
|
|
186
|
+
resetWindowManager,
|
|
187
|
+
} from '@fde-desktop/fde-core';
|
|
188
|
+
|
|
189
|
+
// Desktop state
|
|
190
|
+
const { windows, openWindow, closeWindow } = useDesktopStore();
|
|
191
|
+
|
|
192
|
+
// Settings
|
|
193
|
+
const { wallpaper, theme, language, setThemeMode } = useSettingsStore();
|
|
194
|
+
|
|
195
|
+
// Custom apps (Docker)
|
|
196
|
+
const { customApps, loadCustomApps } = useCustomAppStore();
|
|
49
197
|
```
|
|
50
198
|
|
|
51
199
|
### Hooks
|
|
52
200
|
|
|
53
|
-
```
|
|
201
|
+
```tsx
|
|
54
202
|
import {
|
|
203
|
+
// App management
|
|
55
204
|
useOpenApp,
|
|
205
|
+
useAppName,
|
|
56
206
|
useFdeApi,
|
|
57
|
-
|
|
58
|
-
|
|
207
|
+
|
|
208
|
+
// UI
|
|
59
209
|
useClock,
|
|
210
|
+
useSystemTheme,
|
|
211
|
+
useAnimationDuration,
|
|
212
|
+
useAdaptiveDimensions,
|
|
213
|
+
useTaskbarHeight,
|
|
214
|
+
useTaskbarContextMenu,
|
|
215
|
+
useContextMenu,
|
|
216
|
+
useCollapsible,
|
|
217
|
+
useSearchFilter,
|
|
218
|
+
|
|
219
|
+
// Notifications
|
|
220
|
+
useNotifications,
|
|
221
|
+
|
|
222
|
+
// File system
|
|
223
|
+
useDownload,
|
|
224
|
+
useResolvedUrl,
|
|
225
|
+
|
|
226
|
+
// Icons
|
|
227
|
+
useFcIcon,
|
|
228
|
+
useFcIconElement,
|
|
229
|
+
useFiIcon,
|
|
230
|
+
useFiIconElement,
|
|
231
|
+
useVscIcon,
|
|
232
|
+
useVscIconElement,
|
|
233
|
+
|
|
234
|
+
// Drag & Drop
|
|
235
|
+
DragDropProvider,
|
|
236
|
+
useDroppableArea,
|
|
237
|
+
useDraggableItem,
|
|
238
|
+
useDragDropState,
|
|
239
|
+
|
|
240
|
+
// Window
|
|
241
|
+
useWindowButtonRegistry,
|
|
242
|
+
|
|
243
|
+
// Theme & Language
|
|
244
|
+
useApplyFont,
|
|
245
|
+
useFontDownload,
|
|
246
|
+
useLanguageSync,
|
|
247
|
+
|
|
248
|
+
// State
|
|
249
|
+
useIsDirty,
|
|
250
|
+
useCloseInterceptor,
|
|
251
|
+
|
|
252
|
+
// Device
|
|
253
|
+
useDeviceDetection,
|
|
254
|
+
|
|
255
|
+
// Updates
|
|
256
|
+
useAppUpdate,
|
|
257
|
+
|
|
258
|
+
// Custom apps
|
|
60
259
|
useCustomAppHMR,
|
|
61
|
-
|
|
62
|
-
|
|
260
|
+
useCustomAppLifecycle,
|
|
261
|
+
|
|
262
|
+
// Lifecycle
|
|
263
|
+
useFolderName,
|
|
264
|
+
} from '@fde-desktop/fde-core';
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Domain Entities
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
import {
|
|
271
|
+
createWindow,
|
|
272
|
+
createDesktopIcon,
|
|
273
|
+
createLauncherFolder,
|
|
274
|
+
createPredefinedLauncherFolder,
|
|
275
|
+
updateLauncherFolder,
|
|
276
|
+
createFolder,
|
|
277
|
+
createFile,
|
|
278
|
+
} from '@fde-desktop/fde-core';
|
|
279
|
+
|
|
280
|
+
const win = createWindow({
|
|
281
|
+
title: 'My Window',
|
|
282
|
+
appId: 'my-app',
|
|
283
|
+
x: 100,
|
|
284
|
+
y: 100,
|
|
285
|
+
width: 800,
|
|
286
|
+
height: 600,
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const icon = createDesktopIcon({
|
|
290
|
+
appId: 'files',
|
|
291
|
+
x: 20,
|
|
292
|
+
y: 20,
|
|
293
|
+
name: 'Files',
|
|
294
|
+
fcIcon: 'FcFolder',
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Infrastructure
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
import {
|
|
302
|
+
IndexedDBFileSystem,
|
|
303
|
+
DockerFileSystemAdapter,
|
|
304
|
+
FdeApiAdapter,
|
|
305
|
+
initializeFdeApi,
|
|
306
|
+
getFdeApi,
|
|
307
|
+
WindowManagerAdapter,
|
|
308
|
+
DefaultThemeProvider,
|
|
309
|
+
toMantineTheme,
|
|
310
|
+
JsDosAdapter,
|
|
311
|
+
prefetchApps,
|
|
312
|
+
migrateStorage,
|
|
313
|
+
SUPPORTED_LANGUAGES,
|
|
314
|
+
DEFAULT_LANGUAGE,
|
|
315
|
+
} from '@fde-desktop/fde-core';
|
|
63
316
|
```
|
|
64
317
|
|
|
65
318
|
### Types & Interfaces
|
|
66
319
|
|
|
67
|
-
```
|
|
320
|
+
```tsx
|
|
68
321
|
import type {
|
|
322
|
+
// App types
|
|
69
323
|
AppEntry,
|
|
324
|
+
AppRegistryEntry,
|
|
325
|
+
AppComponent,
|
|
326
|
+
WindowContentProps,
|
|
327
|
+
MenuBarBuilder,
|
|
328
|
+
MenuBarComponent,
|
|
329
|
+
MenuBarComponentProps,
|
|
330
|
+
|
|
331
|
+
// Window types
|
|
70
332
|
WindowEntity,
|
|
71
|
-
|
|
72
|
-
|
|
333
|
+
WindowInput,
|
|
334
|
+
WindowProps,
|
|
335
|
+
|
|
336
|
+
// File system types
|
|
337
|
+
FileSystemNode,
|
|
338
|
+
FileNode,
|
|
339
|
+
FolderNode,
|
|
73
340
|
IFileSystem,
|
|
74
|
-
|
|
75
|
-
|
|
341
|
+
|
|
342
|
+
// Desktop types
|
|
343
|
+
DesktopIconEntity,
|
|
344
|
+
DesktopIconInput,
|
|
345
|
+
DesktopState,
|
|
346
|
+
NotificationItem,
|
|
347
|
+
ClipboardState,
|
|
348
|
+
|
|
349
|
+
// Theme types
|
|
350
|
+
Theme,
|
|
351
|
+
ThemeMode,
|
|
352
|
+
FdeTheme,
|
|
353
|
+
CustomThemeColors,
|
|
354
|
+
IThemeProvider,
|
|
355
|
+
|
|
356
|
+
// Other
|
|
357
|
+
AppMenuElement,
|
|
358
|
+
MenuItem,
|
|
359
|
+
CreateFolderOptions,
|
|
360
|
+
FdeApi,
|
|
361
|
+
LauncherFolder,
|
|
362
|
+
LauncherFolderInput,
|
|
363
|
+
SupportedLanguage,
|
|
364
|
+
} from '@fde-desktop/fde-core';
|
|
76
365
|
```
|
|
77
366
|
|
|
78
367
|
### Utilities
|
|
79
368
|
|
|
80
|
-
```
|
|
369
|
+
```tsx
|
|
81
370
|
import {
|
|
371
|
+
// UUID
|
|
372
|
+
generateUUID,
|
|
373
|
+
uuidv4,
|
|
374
|
+
|
|
375
|
+
// Runtime detection
|
|
82
376
|
getRuntime,
|
|
83
377
|
isDocker,
|
|
84
378
|
isBrowser,
|
|
85
|
-
|
|
379
|
+
isElectron,
|
|
380
|
+
isDev,
|
|
381
|
+
|
|
382
|
+
// Formatting
|
|
86
383
|
formatBytes,
|
|
87
|
-
|
|
88
|
-
|
|
384
|
+
getFileExtension,
|
|
385
|
+
getMimeTypeFromExtension,
|
|
386
|
+
getAppIdForMime,
|
|
387
|
+
|
|
388
|
+
// File system
|
|
389
|
+
sortNodes,
|
|
390
|
+
sortDesktopIcons,
|
|
391
|
+
buildBreadcrumbs,
|
|
392
|
+
|
|
393
|
+
// Version
|
|
394
|
+
isNewerVersion,
|
|
395
|
+
|
|
396
|
+
// Browser
|
|
397
|
+
clearBrowserData,
|
|
398
|
+
|
|
399
|
+
// DOM
|
|
400
|
+
waitForContainer,
|
|
401
|
+
|
|
402
|
+
// URL
|
|
403
|
+
getBaseUrl,
|
|
404
|
+
resolveUrl,
|
|
405
|
+
|
|
406
|
+
// Hash
|
|
407
|
+
hashBlob,
|
|
408
|
+
|
|
409
|
+
// Colors
|
|
410
|
+
getFourRandomColors,
|
|
411
|
+
} from '@fde-desktop/fde-core';
|
|
89
412
|
```
|
|
90
413
|
|
|
91
414
|
### Constants
|
|
92
415
|
|
|
93
|
-
```
|
|
416
|
+
```tsx
|
|
94
417
|
import {
|
|
95
|
-
|
|
96
|
-
EXTRA_APPS,
|
|
418
|
+
// Layout
|
|
97
419
|
DEFAULT_WINDOW_DIMENSIONS,
|
|
98
|
-
DEFAULT_THEME_COLORS,
|
|
99
420
|
ICON_COLUMN_WIDTH,
|
|
421
|
+
ICON_ROW_HEIGHT,
|
|
422
|
+
ICON_MARGIN,
|
|
100
423
|
TASKBAR_HEIGHT,
|
|
101
|
-
|
|
102
|
-
|
|
424
|
+
DEFAULT_VIEWPORT_WIDTH,
|
|
425
|
+
DEFAULT_VIEWPORT_HEIGHT,
|
|
426
|
+
|
|
427
|
+
// Breakpoints
|
|
428
|
+
BREAKPOINTS,
|
|
429
|
+
|
|
430
|
+
// Animation
|
|
431
|
+
ANIMATION_DURATION,
|
|
432
|
+
|
|
433
|
+
// Fonts
|
|
434
|
+
AVAILABLE_FONTS,
|
|
435
|
+
FONT_STACKS,
|
|
436
|
+
GOOGLE_FONTS_HREF,
|
|
437
|
+
|
|
438
|
+
// Colors
|
|
439
|
+
PRESET_COLORS,
|
|
440
|
+
|
|
441
|
+
// Icons
|
|
442
|
+
PRESET_ICONS,
|
|
443
|
+
|
|
444
|
+
// Launcher
|
|
445
|
+
DEFAULT_LAUNCHER_FOLDERS,
|
|
446
|
+
CUSTOM_APPS_FOLDER_ID,
|
|
447
|
+
|
|
448
|
+
// App IDs
|
|
449
|
+
APP_IDS,
|
|
450
|
+
|
|
451
|
+
// Themes
|
|
452
|
+
DEFAULT_FDE_THEME,
|
|
453
|
+
} from '@fde-desktop/fde-core';
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### i18n
|
|
457
|
+
|
|
458
|
+
```tsx
|
|
459
|
+
import { i18n } from '@fde-desktop/fde-core';
|
|
460
|
+
import { I18nextProvider } from 'react-i18next';
|
|
461
|
+
|
|
462
|
+
// Use in your app
|
|
463
|
+
function App() {
|
|
464
|
+
return (
|
|
465
|
+
<I18nextProvider i18n={i18n}>
|
|
466
|
+
<FdeDesktop />
|
|
467
|
+
</I18nextProvider>
|
|
468
|
+
);
|
|
469
|
+
}
|
|
103
470
|
```
|
|
104
471
|
|
|
105
472
|
## Core Apps
|
|
@@ -108,7 +475,7 @@ The following apps are included in `CORE_APPS`:
|
|
|
108
475
|
|
|
109
476
|
| App ID | Name | Description |
|
|
110
477
|
| -------------- | ------------ | ---------------------- |
|
|
111
|
-
| `files` |
|
|
478
|
+
| `files` | Files | File browser |
|
|
112
479
|
| `settings` | Settings | System settings |
|
|
113
480
|
| `notepad` | Notepad | Text editor (Tiptap) |
|
|
114
481
|
| `image-viewer` | Image Viewer | Image viewer |
|
|
@@ -117,56 +484,40 @@ The following apps are included in `CORE_APPS`:
|
|
|
117
484
|
| `device-info` | Device Info | System information |
|
|
118
485
|
| `calendar` | Calendar | Calendar widget |
|
|
119
486
|
| `menuedit` | MenuEdit | Launcher folder editor |
|
|
487
|
+
| `terminal` | Terminal | Terminal emulator |
|
|
488
|
+
| `code-server` | VS Code | VS Code in browser |
|
|
489
|
+
|
|
490
|
+
## Example App
|
|
491
|
+
|
|
492
|
+
The main repository's `src/` directory contains a complete example application that demonstrates how to use this package. It includes:
|
|
493
|
+
|
|
494
|
+
- **WelcomeApp**: Personal portfolio/profile app
|
|
495
|
+
- **LinkedinApp** / **GithubApp**: External link apps
|
|
496
|
+
- **DosEmulatorApp**: DOS game emulator using js-dos
|
|
497
|
+
- **Custom App Registry**: Shows how to register custom apps
|
|
498
|
+
|
|
499
|
+
See the [main repository](https://github.com/frannunpal/fde-desktop) for the complete example.
|
|
120
500
|
|
|
121
501
|
## Runtime Detection
|
|
122
502
|
|
|
123
|
-
```
|
|
124
|
-
import { getRuntime, isDocker, isBrowser, isElectron, isDev } from '@
|
|
503
|
+
```tsx
|
|
504
|
+
import { getRuntime, isDocker, isBrowser, isElectron, isDev } from '@fde-desktop/fde-core';
|
|
125
505
|
|
|
126
|
-
const runtime = getRuntime(); // '
|
|
506
|
+
const runtime = getRuntime(); // 'browser' | 'docker' | 'electron'
|
|
127
507
|
|
|
128
508
|
if (isDocker()) {
|
|
129
|
-
// Docker-specific code
|
|
509
|
+
// Docker-specific code (API-based file system)
|
|
130
510
|
}
|
|
131
511
|
|
|
132
512
|
if (isBrowser()) {
|
|
133
|
-
// Browser-
|
|
513
|
+
// Browser-only code (IndexedDB file system)
|
|
134
514
|
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Usage Example
|
|
138
|
-
|
|
139
|
-
```tsx
|
|
140
|
-
import { useDesktopStore, useOpenApp, FilesApp, CORE_APPS } from '@frannunpal/fde-core';
|
|
141
|
-
|
|
142
|
-
function MyDesktop() {
|
|
143
|
-
const { windows, openWindow } = useDesktopStore();
|
|
144
|
-
const openApp = useOpenApp();
|
|
145
515
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<h1>My Desktop</h1>
|
|
149
|
-
{CORE_APPS.map(app => (
|
|
150
|
-
<button key={app.id} onClick={() => openApp(app)}>
|
|
151
|
-
{app.icon} {app.name}
|
|
152
|
-
</button>
|
|
153
|
-
))}
|
|
154
|
-
</div>
|
|
155
|
-
);
|
|
516
|
+
if (isElectron()) {
|
|
517
|
+
// Electron desktop app code
|
|
156
518
|
}
|
|
157
519
|
```
|
|
158
520
|
|
|
159
|
-
## Note on UI Components
|
|
160
|
-
|
|
161
|
-
This package exports core logic, hooks, stores, and types, but **does not include UI components**. The UI components in the main repo depend on static assets (images, wallpapers) specific to the host application.
|
|
162
|
-
|
|
163
|
-
For UI components, refer to the source code at:
|
|
164
|
-
|
|
165
|
-
- `src/Presentation/Components/DesktopArea/`
|
|
166
|
-
- `src/Presentation/Components/Window/`
|
|
167
|
-
- `src/Presentation/Components/Taskbar/`
|
|
168
|
-
- `src/Presentation/Components/Launcher/`
|
|
169
|
-
|
|
170
521
|
## License
|
|
171
522
|
|
|
172
|
-
|
|
523
|
+
MIT
|