@prozilla-os/core 1.3.13 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/chunks/cat-DH-kPf08.js +44 -0
  2. package/dist/chunks/cat-DH-kPf08.js.map +1 -0
  3. package/dist/chunks/cd-DGILEGTs.js +21 -0
  4. package/dist/chunks/cd-DGILEGTs.js.map +1 -0
  5. package/dist/chunks/clear-DC-frUcf.js +13 -0
  6. package/dist/chunks/clear-DC-frUcf.js.map +1 -0
  7. package/dist/chunks/cmatrix-DvaWzvRn.js +63 -0
  8. package/dist/chunks/cmatrix-DvaWzvRn.js.map +1 -0
  9. package/dist/chunks/compgen-OhvISbst.js +11 -0
  10. package/dist/chunks/compgen-OhvISbst.js.map +1 -0
  11. package/dist/chunks/cowsay-hTKzWScw.js +56 -0
  12. package/dist/chunks/cowsay-hTKzWScw.js.map +1 -0
  13. package/dist/chunks/date-D8cnHZuY.js +33 -0
  14. package/dist/chunks/date-D8cnHZuY.js.map +1 -0
  15. package/dist/chunks/dir-BmNeEPzy.js +11 -0
  16. package/dist/chunks/dir-BmNeEPzy.js.map +1 -0
  17. package/dist/chunks/echo-Gmh-b8f5.js +17 -0
  18. package/dist/chunks/echo-Gmh-b8f5.js.map +1 -0
  19. package/dist/chunks/eval-DINS_Vhl.js +24 -0
  20. package/dist/chunks/eval-DINS_Vhl.js.map +1 -0
  21. package/dist/chunks/exit-w3PqRkwA.js +10 -0
  22. package/dist/chunks/exit-w3PqRkwA.js.map +1 -0
  23. package/dist/chunks/fortune-DkIZpYa_.js +59 -0
  24. package/dist/chunks/fortune-DkIZpYa_.js.map +1 -0
  25. package/dist/chunks/grep-CR3FMStR.js +41 -0
  26. package/dist/chunks/grep-CR3FMStR.js.map +1 -0
  27. package/dist/chunks/help-Drx0UDCY.js +19 -0
  28. package/dist/chunks/help-Drx0UDCY.js.map +1 -0
  29. package/dist/chunks/history-BEJhnsrb.js +17 -0
  30. package/dist/chunks/history-BEJhnsrb.js.map +1 -0
  31. package/dist/chunks/hostname-D8sxyWIy.js +10 -0
  32. package/dist/chunks/hostname-D8sxyWIy.js.map +1 -0
  33. package/dist/chunks/htop-l0sNRNKZ.js +2 -0
  34. package/dist/chunks/htop-l0sNRNKZ.js.map +1 -0
  35. package/dist/chunks/lolcat-Dyjbg15t.js +67 -0
  36. package/dist/chunks/lolcat-Dyjbg15t.js.map +1 -0
  37. package/dist/chunks/ls-DnmR50y0.js +17 -0
  38. package/dist/chunks/ls-DnmR50y0.js.map +1 -0
  39. package/dist/chunks/man-7W6T7lda.js +60 -0
  40. package/dist/chunks/man-7W6T7lda.js.map +1 -0
  41. package/dist/chunks/mkdir-BdEywO2H.js +11 -0
  42. package/dist/chunks/mkdir-BdEywO2H.js.map +1 -0
  43. package/dist/chunks/neofetch--vHMIS9v.js +40 -0
  44. package/dist/chunks/neofetch--vHMIS9v.js.map +1 -0
  45. package/dist/chunks/printenv-6OpJKd7g.js +24 -0
  46. package/dist/chunks/printenv-6OpJKd7g.js.map +1 -0
  47. package/dist/chunks/pwd-9JYDUbov.js +11 -0
  48. package/dist/chunks/pwd-9JYDUbov.js.map +1 -0
  49. package/dist/chunks/reboot-nbAmZck6.js +10 -0
  50. package/dist/chunks/reboot-nbAmZck6.js.map +1 -0
  51. package/dist/chunks/reload-CjTJVt5Z.js +10 -0
  52. package/dist/chunks/reload-CjTJVt5Z.js.map +1 -0
  53. package/dist/chunks/rev--2pyt1P8.js +12 -0
  54. package/dist/chunks/rev--2pyt1P8.js.map +1 -0
  55. package/dist/chunks/rm-Uxuv-dEz.js +13 -0
  56. package/dist/chunks/rm-Uxuv-dEz.js.map +1 -0
  57. package/dist/chunks/rmdir-BYWer3pb.js +13 -0
  58. package/dist/chunks/rmdir-BYWer3pb.js.map +1 -0
  59. package/dist/chunks/sh-B67OTc-j.js +15 -0
  60. package/dist/chunks/sh-B67OTc-j.js.map +1 -0
  61. package/dist/chunks/sl-CLAmugya.js +168 -0
  62. package/dist/chunks/sl-CLAmugya.js.map +1 -0
  63. package/dist/chunks/touch-BReUyL_z.js +15 -0
  64. package/dist/chunks/touch-BReUyL_z.js.map +1 -0
  65. package/dist/chunks/uniq-Dx_4r3B5.js +44 -0
  66. package/dist/chunks/uniq-Dx_4r3B5.js.map +1 -0
  67. package/dist/chunks/uptime-DjJ5V7hu.js +10 -0
  68. package/dist/chunks/uptime-DjJ5V7hu.js.map +1 -0
  69. package/dist/chunks/watch-BjJ8bCnP.js +52 -0
  70. package/dist/chunks/watch-BjJ8bCnP.js.map +1 -0
  71. package/dist/chunks/whatis-CFZWdHZ4.js +17 -0
  72. package/dist/chunks/whatis-CFZWdHZ4.js.map +1 -0
  73. package/dist/chunks/whoami-D-es0JvS.js +10 -0
  74. package/dist/chunks/whoami-D-es0JvS.js.map +1 -0
  75. package/dist/main.d.ts +1029 -473
  76. package/dist/main.js +18432 -16877
  77. package/dist/main.js.map +1 -1
  78. package/package.json +15 -11
package/dist/main.d.ts CHANGED
@@ -1,36 +1,44 @@
1
1
  import { Context } from 'react';
2
+ import { EventEmitter } from '@prozilla-os/shared';
2
3
  import { FC } from 'react';
4
+ import { ForwardRefExoticComponent } from 'react';
3
5
  import { HTMLAttributeAnchorTarget } from 'react';
4
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
6
+ import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
5
7
  import { JSX as JSX_2 } from 'react/jsx-runtime';
8
+ import { Listener } from '@prozilla-os/shared';
6
9
  import { MemoExoticComponent } from 'react';
7
10
  import { MouseEvent as MouseEvent_2 } from 'react';
8
11
  import { MutableRefObject } from 'react';
9
12
  import { NamedExoticComponent } from 'react';
10
13
  import { ReactElement } from 'react';
11
14
  import { ReactNode } from 'react';
12
- import { Ref } from 'react';
15
+ import { RefAttributes } from 'react';
16
+ import { RefObject } from 'react';
17
+ import { Skin } from '@prozilla-os/skins';
18
+ import { Snapshot } from 'valtio';
13
19
  import { UaEventOptions } from 'react-ga4/types/ga4';
20
+ import { UIEvent as UIEvent_2 } from 'react';
14
21
  import { default as utilStyles } from './utils.module.css';
22
+ import { Vector2 } from '@prozilla-os/shared';
15
23
 
16
24
  export declare interface ActionProps {
17
- /** ID of the action */
25
+ /** ID of the action. */
18
26
  actionId?: string;
19
- /** Label of the action */
27
+ /** Label of the action. */
20
28
  label?: string;
21
- /** Icon for the action */
29
+ /** Icon for the action. */
22
30
  icon?: string | object;
23
- /** Keyboard shortcut for the action */
31
+ /** Keyboard shortcut for the action. */
24
32
  shortcut?: string[];
25
- /** Function that handles the trigger event for the action */
33
+ /** Function that handles the trigger event for the action. */
26
34
  onTrigger?: (event?: Event, triggerParams?: unknown, ...args: unknown[]) => void;
27
35
  children?: ReactNode;
28
- /** Whether the action should be disabled */
36
+ /** Whether the action should be disabled. */
29
37
  disabled?: boolean;
30
38
  }
31
39
 
32
40
  /**
33
- * Component that renders a collection of actions (e.g., as a context menu or a header menu) and handles keyboard shortcuts
41
+ * Component that renders a collection of actions (e.g., as a context menu or a header menu) and handles keyboard shortcuts.
34
42
  * @example
35
43
  * <ClickAction
36
44
  * label="Reload"
@@ -45,93 +53,99 @@ export declare function Actions({ children, mode, className, onAnyTrigger, trigg
45
53
 
46
54
  export declare interface ActionsProps {
47
55
  mode?: string;
48
- /** `className` prop for the container */
56
+ /** `className` prop for the container. */
49
57
  className?: string;
50
- /** Function that handles the trigger event for all actions */
58
+ /** Function that handles the trigger event for all actions. */
51
59
  onAnyTrigger?: (event: Event, triggerParams: unknown, ...args: unknown[]) => void;
52
60
  children?: ReactNode;
53
- /** The parameters to pass whenever an action is triggered */
61
+ /** The parameters to pass whenever an action is triggered. */
54
62
  triggerParams?: unknown;
55
- /** Whether the actions should automatically orient themselves to not overlap with the taskbar */
63
+ /** Whether the actions should automatically orient themselves to not overlap with the taskbar. */
56
64
  avoidTaskbar?: boolean;
57
65
  [key: string]: unknown;
58
66
  }
59
67
 
60
68
  export declare interface AlertParams {
61
69
  /**
62
- * The title of the alert
70
+ * The title of the alert.
63
71
  * @default "Alert"
64
72
  */
65
- title: string;
66
- /** The body of the alert */
73
+ title?: string;
74
+ /** The body of the alert. */
67
75
  text: string;
68
- /** The URL of the icon of the alert */
76
+ /** The URL of the icon of the alert. */
69
77
  iconUrl?: string;
70
78
  /**
71
- * The size of the alert modal
79
+ * The size of the alert modal.
72
80
  * @default new Vector2(300, 150)
73
81
  */
74
82
  size?: Vector2;
75
83
  single?: boolean;
76
84
  }
77
85
 
86
+ export declare const ANSI_ASCII_LOGO: string;
87
+
88
+ export declare const ANSI_LOGO_COLOR: string;
89
+
78
90
  /**
79
- * An application that can be ran by ProzillaOS
80
- * Applications can be installed by adding them to the `apps` array in {@link AppsConfig}
91
+ * An application that can be ran by ProzillaOS.
92
+ *
93
+ * Applications can be installed by adding them to {@link AppsConfig.apps}.
94
+ * @typeParam AppProps - The props of the {@link windowContent} of this app.
81
95
  */
82
96
  export declare class App<AppProps extends WindowProps = WindowProps> {
83
97
  /**
84
- * The display name of this application
98
+ * The display name of this application.
85
99
  */
86
100
  name: string;
87
101
  /**
88
- * The unique ID of this application
102
+ * The unique ID of this application.
89
103
  */
90
104
  id: string;
91
105
  /**
92
- * Main component that renders this app inside a window
106
+ * Main component that renders this app inside a window.
93
107
  */
94
- windowContent: FC<AppProps>;
108
+ windowContent: FC<AppProps> | null;
95
109
  /**
96
- * Default options that get passed to the {@link App.windowContent} component
110
+ * Default options that get passed to the {@link App.windowContent} component.
97
111
  */
98
112
  windowOptions?: Partial<AppProps> & DefaultWindowOptions;
99
113
  /**
100
- * Description of this application
114
+ * Description of this application.
101
115
  */
102
116
  description: string | null;
103
117
  /**
104
- * URL of the icon of this application
118
+ * URL of the icon of this application.
105
119
  */
106
120
  iconUrl: string | null;
107
121
  /**
108
- * Defines what the app can handle and how it can be used elsewhere in the system
122
+ * Defines what the app can handle and how it can be used elsewhere in the system.
109
123
  */
110
124
  role: string | null;
111
125
  /**
112
- * An array of file extensions that this application can interpret
126
+ * An array of file extensions that this application can interpret.
113
127
  */
114
128
  associatedExtensions: string[];
115
129
  /**
116
- * Determines whether the app is pinned by default
130
+ * Determines whether the app is pinned by default.
117
131
  * @default true
118
132
  */
119
133
  pinnedByDefault: boolean;
120
134
  /**
121
- * Determines whether the app is launched at startup
135
+ * Determines whether the app is launched at startup.
122
136
  * @default false
123
137
  */
124
138
  launchAtStartup: boolean;
125
139
  /**
126
- * The category the app belongs to
140
+ * The category the app belongs to.
127
141
  */
128
142
  category: typeof APP_CATEGORIES[number] | null;
129
143
  /**
130
- * Metadata of the app's package
144
+ * Metadata of the app's package.
131
145
  */
132
146
  metadata: AppMetadata | null;
133
147
  /**
134
- * Determines whether a desktop icon is added to the default data
148
+ * Determines whether a desktop icon is added to the default data.
135
149
  * @default false
136
150
  */
137
151
  showDesktopIcon: boolean;
@@ -140,55 +154,55 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
140
154
  isInstalled: boolean;
141
155
  constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: Partial<AppProps> & DefaultWindowOptions);
142
156
  /**
143
- * Returns the component that renders the content of a window for this app
157
+ * Returns the component that renders the content of a window for this app.
144
158
  */
145
159
  WindowContent: (props: AppProps) => JSX_2.Element | null;
146
160
  /**
147
- * Sets the display name of this application
161
+ * Sets the display name of this application.
148
162
  */
149
163
  setName(name: string): this;
150
164
  /**
151
- * Sets the description of this application
165
+ * Sets the description of this application.
152
166
  */
153
167
  setDescription(description: App["description"]): this;
154
168
  /**
155
- * Sets the URL of the icon of this application
169
+ * Sets the URL of the icon of this application.
156
170
  */
157
171
  setIconUrl(iconUrl: App["iconUrl"]): this;
158
172
  /**
159
- * Sets the role of this application
173
+ * Sets the role of this application.
160
174
  */
161
175
  setRole(role: string | null): this;
162
176
  /**
163
- * Sets the associated extensions of this application
177
+ * Sets the associated extensions of this application.
164
178
  */
165
179
  setAssociatedExtensions(extensions: string[] | null): this;
166
180
  /**
167
- * Changes whether this application is pinned by default or not
181
+ * Changes whether this application is pinned by default or not.
168
182
  */
169
183
  setPinnedByDefault(pinnedByDefault: boolean): this;
170
184
  /**
171
- * Changes whether this application is launched at startup or not
185
+ * Changes whether this application is launched at startup or not.
172
186
  */
173
187
  setLaunchAtStartup(launchAtStartup: boolean): this;
174
188
  /**
175
- * Changes whether this application is installed by default or not
189
+ * Changes whether this application is installed by default or not.
176
190
  */
177
191
  setInstalled(installed: boolean): this;
178
192
  /**
179
- * Sets the category this application belongs to
193
+ * Sets the category this application belongs to.
180
194
  */
181
195
  setCategory(category: typeof APP_CATEGORIES[number] | null): this;
182
196
  /**
183
- * Sets the metadata for this application
197
+ * Sets the metadata for this application.
184
198
  */
185
199
  setMetadata(metadata: AppMetadata | null): this;
186
200
  /**
187
- * Changes whether this application has a desktop icon in the default data
201
+ * Changes whether this application has a desktop icon in the default data.
188
202
  */
189
203
  setShowDesktopIcon(showDesktopIcon: boolean): this;
190
204
  /**
191
- * Sets the default options for the {@link App.windowContent} component
205
+ * Sets the default options for the {@link App.windowContent} component.
192
206
  */
193
207
  setWindowOptions(windowOptions: Partial<AppProps> & DefaultWindowOptions): this;
194
208
  }
@@ -214,30 +228,33 @@ export declare class AppsConfig {
214
228
  constructor(options?: Partial<AppsConfigOptions>);
215
229
  get installedApps(): App<WindowProps>[];
216
230
  /**
217
- * @param includeUninstalled Include apps that are not currently installed
231
+ * @param id - The ID of the app.
232
+ * @param includeUninstalled - Include apps that are not currently installed.
218
233
  */
219
234
  getAppById(id: string, includeUninstalled?: boolean): App | null;
220
235
  /**
221
- * Get the app associated with a file extension
236
+ * Get the app associated with a file extension.
222
237
  */
223
238
  getAppByFileExtension(fileExtension: string): App | null;
224
239
  /**
225
- * Get the app with a specific role
240
+ * Get the app with a specific role.
226
241
  */
227
242
  getAppByRole(role: string): App | null;
228
243
  /**
229
- * Get all applications (including uninstalled apps) that belong to a category
244
+ * Get all applications (including uninstalled apps) that belong to a category.
230
245
  */
231
246
  getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
232
247
  }
233
248
 
234
249
  export declare interface AppsConfigOptions {
235
250
  /**
236
- * An array of applications
251
+ * An array of applications.
237
252
  */
238
253
  apps: App<WindowProps>[];
239
254
  }
240
255
 
256
+ export declare const ASCII_LOGO = "\n :. \n -==. \n .=====: \n ---::..:=======-. \n :===+=----------::.. \n =+=---------------:.. \n --------------------:. \n.:-+=----*###*--*####=---. \n:==+----#%+-+%#-##%*+----:.\n .=----#%+-+%#-*+-%#+---:.\n ==----*###*--*###*----. \n ==+-------------------:. \n ...::---------------:. \n .::---------::.. \n ....::... ";
257
+
241
258
  export declare const AUDIO_EXTENSIONS: string[];
242
259
 
243
260
  export declare function Button({ className, href, children, icon, target, ...props }: ButtonProps): JSX_2.Element;
@@ -245,12 +262,16 @@ export declare function Button({ className, href, children, icon, target, ...pro
245
262
  export declare interface ButtonProps {
246
263
  className?: string;
247
264
  href?: string;
248
- icon?: IconProp;
265
+ icon?: IconDefinition;
249
266
  target?: HTMLAttributeAnchorTarget;
250
267
  children?: ReactNode;
251
268
  [key: string]: unknown;
252
269
  }
253
270
 
271
+ declare type CategorizedOptions = Record<string, Record<string, ShortcutHandler>>;
272
+
273
+ declare type CategorizedShortcuts = Record<string, Record<string, string[]>>;
274
+
254
275
  export declare const ClickAction: MemoExoticComponent<({ actionId, label, shortcut, disabled, onTrigger, icon }: ClickActionProps) => JSX_2.Element>;
255
276
 
256
277
  export declare interface ClickActionProps extends ActionProps {
@@ -258,13 +279,60 @@ export declare interface ClickActionProps extends ActionProps {
258
279
  }
259
280
 
260
281
  /**
261
- * Simulates closing the viewport by opening a blank page
262
- * @param name - Name of the app
282
+ * Simulates closing the viewport by opening a blank page.
283
+ * @param requireConfirmation - Whether to require confirmation before closing.
284
+ * @param name - Name of the app.
263
285
  */
264
286
  export declare function closeViewport(requireConfirmation: boolean | undefined, name: string): void;
265
287
 
266
288
  export declare const CODE_EXTENSIONS: string[];
267
289
 
290
+ /**
291
+ * Defines a shell command, including its execution logic, arguments requirements, and manual page.
292
+ */
293
+ export declare class Command {
294
+ #private;
295
+ options: Option_2[];
296
+ manual?: Manual;
297
+ requireArgs?: boolean;
298
+ requireOptions?: boolean;
299
+ /**
300
+ * The core logic to run when the command is invoked.
301
+ */
302
+ execute: Execute;
303
+ /**
304
+ * Sets the command name and initializes the default usage string if not already set.
305
+ */
306
+ setName(name?: string): Command;
307
+ get name(): string;
308
+ setExecute(execute: Execute): Command;
309
+ setRequireArgs(value: boolean): Command;
310
+ setRequireOptions(value: boolean): Command;
311
+ setManual({ purpose, usage, description, options }: Manual): Command;
312
+ /**
313
+ * Registers a new option/flag for this command.
314
+ */
315
+ addOption({ short, long, isInput }: Omit<Option_2, "isInput"> & {
316
+ isInput?: boolean;
317
+ }): Command;
318
+ /**
319
+ * Retrieves an option definition by either its short or long name.
320
+ */
321
+ getOption(key: string): Option_2 | undefined;
322
+ }
323
+
324
+ export declare type CommandOutput = number | undefined | void;
325
+
326
+ export declare class CommandsManager {
327
+ static COMMANDS: Command[];
328
+ static addCommand(command: Command): void;
329
+ static find(name: string): Command | null;
330
+ static search(pattern: string): Command[];
331
+ static reload(): void;
332
+ }
333
+
334
+ export declare type ContextMenuHandler = (event: MouseEvent_2<HTMLElement, MouseEvent_2>, params?: object) => Modal;
335
+
268
336
  export declare function copyToClipboard(string: string, onSuccess?: (value: void) => void, onFail?: (value: void) => void): void;
269
337
 
270
338
  export declare function DefaultRoute(): JSX_2.Element;
@@ -275,7 +343,7 @@ export declare interface DefaultWindowOptions {
275
343
  }
276
344
 
277
345
  /**
278
- * Component that renders the wallpaper and desktop icons
346
+ * Component that renders the wallpaper and desktop icons.
279
347
  */
280
348
  export declare const Desktop: MemoExoticComponent<() => JSX_2.Element>;
281
349
 
@@ -287,13 +355,13 @@ export declare class DesktopConfig {
287
355
 
288
356
  export declare interface DesktopConfigOptions {
289
357
  /**
290
- * The default size of the icons
358
+ * The default size of the icons.
291
359
  * @default 1
292
360
  */
293
361
  defaultIconSize: 0 | 1 | 2;
294
362
  /**
295
363
  * The defailt direction of the icons
296
- * 0: vertical, 1: horizontal
364
+ * 0: vertical, 1: horizontal.
297
365
  * @default 0
298
366
  * */
299
367
  defaultIconDirection: 0 | 1;
@@ -302,32 +370,32 @@ export declare interface DesktopConfigOptions {
302
370
  export declare function DialogBox({ modal, params, children, ...props }: ModalProps): JSX_2.Element;
303
371
 
304
372
  /**
305
- * Component that displays the contents of a directory
373
+ * Component that displays the contents of a directory.
306
374
  */
307
375
  export declare function DirectoryList({ directory, showHidden, folderClassName, fileClassName, className, onContextMenuFile, onContextMenuFolder, onOpenFile, onOpenFolder, allowMultiSelect, onSelectionChange, ...props }: DirectoryListProps): ReactElement | null;
308
376
 
309
377
  export declare interface DirectoryListProps {
310
- /** The directory to display */
378
+ /** The directory to display. */
311
379
  directory: VirtualFolder;
312
- /** Whether to show hidden files and folders */
380
+ /** Whether to show hidden files and folders. */
313
381
  showHidden?: boolean;
314
- /** `className` prop for folders */
382
+ /** `className` prop for folders. */
315
383
  folderClassName?: string;
316
- /** `className` prop for files */
384
+ /** `className` prop for files. */
317
385
  fileClassName?: string;
318
- /** `className` prop for this component */
386
+ /** `className` prop for this component. */
319
387
  className?: string;
320
- /** Function that handles context menu interactions on files */
388
+ /** Function that handles context menu interactions on files. */
321
389
  onContextMenuFile?: FileEventHandler;
322
- /** Function that handles context menu interactions on folders */
390
+ /** Function that handles context menu interactions on folders. */
323
391
  onContextMenuFolder?: FolderEventHandler;
324
- /** Function that handles file opening events */
392
+ /** Function that handles file opening events. */
325
393
  onOpenFile?: FileEventHandler;
326
- /** Function that handles folder opening events */
394
+ /** Function that handles folder opening events. */
327
395
  onOpenFolder?: FolderEventHandler;
328
- /** Whether to allow multiple files and folders to be selected at the same time */
396
+ /** Whether to allow multiple files and folders to be selected at the same time. */
329
397
  allowMultiSelect?: boolean;
330
- /** Function that handles selection changes */
398
+ /** Function that handles selection changes. */
331
399
  onSelectionChange?: (params: OnSelectionChangeParams) => void;
332
400
  [key: string]: unknown;
333
401
  }
@@ -343,37 +411,30 @@ export declare interface DropdownActionProps extends ActionProps {
343
411
  }
344
412
 
345
413
  /**
346
- * Component that opens a dropdown menu
414
+ * Component that opens a dropdown menu.
347
415
  */
348
416
  export declare function DropdownButton({ label, options, shortcuts }: DropdownButtonProps): JSX_2.Element;
349
417
 
350
418
  export declare interface DropdownButtonProps {
351
- /** The label of the button */
419
+ /** The label of the button. */
352
420
  label: string;
353
- /** The options in the dropdown menu mapped to the function that handles their selection */
354
- options: Record<string, () => void>;
355
- /** The keyboard shortcut for options in the dropdown menu */
421
+ /** The options in the dropdown menu mapped to the function that handles their selection. */
422
+ options?: Record<string, () => void>;
423
+ /** The keyboard shortcut for options in the dropdown menu. */
356
424
  shortcuts: Record<string, string[]>;
357
425
  }
358
426
 
359
- declare class EventEmitter<EventMap extends EventNamesMap> {
360
- #private;
361
- static EVENT_NAMES: EventNamesMap;
362
- /**
363
- * Add event listener for an event
364
- */
365
- on<Key extends keyof EventMap>(eventName: Key, callback: Listener): Listener;
366
- /**
367
- * Remove event listener for an event
368
- */
369
- off<Key extends keyof EventMap>(eventName: Key, callback: Listener): void;
370
- /**
371
- * Dispatch event
372
- */
373
- emit<Key extends keyof EventMap>(eventName: Key, data?: unknown): void;
374
- }
427
+ export declare type Execute = (args: string[], context: ShellContext) => Promise<CommandOutput> | CommandOutput;
375
428
 
376
- declare type EventNamesMap = Record<string, string>;
429
+ export declare const EXIT_CODE: {
430
+ readonly success: 0;
431
+ readonly generalError: 1;
432
+ readonly misuseOfBuiltins: 2;
433
+ readonly commandNotExecutable: 126;
434
+ readonly commandNotFound: 127;
435
+ readonly invalidExitArgument: 128;
436
+ readonly terminatedByCtrlC: 130;
437
+ };
377
438
 
378
439
  export declare const FILE_SCHEMES: {
379
440
  external: string;
@@ -382,16 +443,20 @@ export declare const FILE_SCHEMES: {
382
443
 
383
444
  export declare type FileEventHandler = (event: Event, file: VirtualFile) => void;
384
445
 
446
+ declare type FlatOptions = Record<string, ShortcutHandler>;
447
+
448
+ declare type FlatShortcuts = Record<string, string[]>;
449
+
385
450
  export declare type FolderEventHandler = (event: Event, folder: VirtualFolder) => void;
386
451
 
387
452
  /**
388
453
  * Formats a shortcut (combination of keys) into a human-readable format.
389
454
  *
390
- * For a list of valid key values, refer to this page: <https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values>
455
+ * For a list of valid key values, refer to this page: <https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values>.
391
456
  */
392
457
  export declare function formatShortcut(shortcut: string[]): string;
393
458
 
394
- export declare function generateUrl(options: GenerateUrlParams): string;
459
+ export declare function generateUrl(options?: GenerateUrlParams): string;
395
460
 
396
461
  export declare interface GenerateUrlParams {
397
462
  appId?: string;
@@ -402,10 +467,26 @@ export declare interface GenerateUrlParams {
402
467
  export declare function getViewportParams(): Record<string, string>;
403
468
 
404
469
  /**
405
- * Component that shows a header menu at the top of a window
470
+ * Component that shows a header menu at the top of a window.
406
471
  */
407
472
  export declare function HeaderMenu({ children, ...props }: ActionsProps): JSX_2.Element;
408
473
 
474
+ /**
475
+ * Represents a single entry in the shell's output history.
476
+ */
477
+ export declare interface HistoryEntry {
478
+ /** The text content to display. */
479
+ text?: string;
480
+ /** Whether this entry represents a user-inputted command. */
481
+ isCommand: boolean;
482
+ /** The raw string value of the command. */
483
+ value?: string;
484
+ /** If true, the terminal view should be cleared before rendering this entry. */
485
+ clear?: boolean;
486
+ }
487
+
488
+ export declare const HOSTNAME = "prozilla-os";
489
+
409
490
  declare function Image_2({ className, src, ...props }: ImageProps): JSX_2.Element;
410
491
  export { Image_2 as Image }
411
492
 
@@ -426,14 +507,14 @@ export declare interface ImageProps {
426
507
  }
427
508
 
428
509
  /**
429
- * Button component that handles single and double clicks
510
+ * Button component that handles single and double clicks.
430
511
  */
431
512
  export declare function Interactable({ onClick, onDoubleClick, children, ...props }: InteractableProps): JSX_2.Element;
432
513
 
433
514
  export declare interface InteractableProps {
434
- /** Function that handles single clicks */
515
+ /** Function that handles single clicks. */
435
516
  onClick?: (event: MouseEvent) => void;
436
- /** Function that handles double clicks */
517
+ /** Function that handles double clicks. */
437
518
  onDoubleClick?: (event: MouseEvent) => void;
438
519
  children: ReactNode;
439
520
  [key: string]: unknown;
@@ -441,7 +522,21 @@ export declare interface InteractableProps {
441
522
 
442
523
  export declare function isValidUrl(string: string): boolean;
443
524
 
444
- declare type Listener = (data: unknown) => void;
525
+ /**
526
+ * Documentation metadata used by the `help` or `man` commands.
527
+ */
528
+ export declare interface Manual {
529
+ /** A brief one-line summary of what the command does. */
530
+ purpose?: string;
531
+ /** A string representing the syntax (e.g., "ls [OPTION]... [FILE]..."). */
532
+ usage?: string;
533
+ /** A detailed explanation of the command's behavior. */
534
+ description?: string;
535
+ /** A mapping of option names to their descriptions for the help output. */
536
+ options?: object;
537
+ }
538
+
539
+ export declare const MAX_WIDTH = 50;
445
540
 
446
541
  export declare const MEDIA_EXTENSIONS: string[];
447
542
 
@@ -452,55 +547,55 @@ export declare class MiscConfig {
452
547
 
453
548
  export declare interface MiscConfigOptions {
454
549
  /**
455
- * The maximum time between two clicks to register as a double click (in ms)
550
+ * The maximum time between two clicks to register as a double click (in ms).
456
551
  * @default 250
457
552
  * */
458
553
  doubleClickDelay: number;
459
554
  }
460
555
 
461
556
  /**
462
- * Represents a modal window
557
+ * Represents a modal window.
463
558
  */
464
559
  export declare class Modal {
465
560
  /**
466
- * The size of this modal
561
+ * The size of this modal.
467
562
  * @default new Vector2(400, 200)
468
563
  */
469
564
  size: Vector2;
470
565
  /**
471
- * The position of this modal
566
+ * The position of this modal.
472
567
  * @default new Vector2(300, 300)
473
568
  */
474
569
  position: Vector2;
475
570
  /**
476
- * The icon of this modal
571
+ * The icon of this modal.
477
572
  * @default null
478
573
  */
479
574
  icon: string | null;
480
575
  /**
481
- * The title of this modal
576
+ * The title of this modal.
482
577
  * @default null
483
578
  */
484
579
  title: string | null;
485
580
  /**
486
- * The manager that handles all modals
581
+ * The manager that handles all modals.
487
582
  */
488
583
  modalsManager: ModalsManager | null;
489
584
  /**
490
- * The content of this modal
585
+ * The content of this modal.
491
586
  * @default null
492
587
  */
493
588
  element: FC<ModalProps> | null;
494
589
  props: object;
495
590
  callback: ((...args: unknown[]) => void) | null;
496
- /** The ID of this modal */
591
+ /** The ID of this modal. */
497
592
  id: number | null;
498
593
  /**
499
- * Whether this modal can be dismissed (e.g., by pressing ESC)
594
+ * Whether this modal can be dismissed (e.g., by pressing ESC).
500
595
  * @default true
501
596
  */
502
597
  dismissible: boolean;
503
- /** Timestamp of the most recent interaction with this modal */
598
+ /** Timestamp of the most recent interaction with this modal. */
504
599
  lastInteraction?: number;
505
600
  constructor(element: Modal["element"], callback?: Modal["callback"]);
506
601
  setIcon(icon: string): Modal;
@@ -545,44 +640,45 @@ export declare class ModalsConfig {
545
640
 
546
641
  export declare interface ModalsConfigOptions {
547
642
  /**
548
- * Default size of a dialog box
643
+ * Default size of a dialog box.
549
644
  * @default new Vector2(400, 200)
550
645
  */
551
646
  defaultDialogSize: Vector2;
552
647
  /**
553
- * Default size of a file selector
648
+ * Default size of a file selector.
554
649
  * @default new Vector2(700, 400)
555
650
  */
556
651
  defaultFileSelectorSize: Vector2;
557
652
  }
558
653
 
559
654
  /**
560
- * Manages the opening, closing and ordering of modals
655
+ * Manages the opening, closing and ordering of modals.
561
656
  */
562
657
  export declare class ModalsManager {
563
- /** Maps every modal ID to the corresponding modal */
658
+ /** Maps every modal ID to the corresponding modal. */
564
659
  modals: Record<string, Modal>;
565
660
  containerRef?: MutableRefObject<HTMLElement>;
566
- /** Function that handles changes to modals */
661
+ /** Function that handles changes to modals. */
567
662
  updateModals: (modals: ModalsManager["modals"]) => void;
568
663
  /**
569
- * Opens a modal
570
- * @param single - Set to false to preserve other open modals
664
+ * Opens a modal.
665
+ * @param modal - The modal to open.
666
+ * @param single - Set to false to preserve other open modals.
571
667
  */
572
668
  open(modal: Modal, single?: boolean): void;
573
669
  /**
574
- * Closes a modal
575
- * @param modalId The ID of the modal to close
670
+ * Closes a modal.
671
+ * @param modalId - The ID of the modal to close.
576
672
  */
577
673
  close(modalId: string | number, sendModalsUpdate?: boolean): void;
578
674
  /**
579
- * Brings a modal into focus
580
- * @param modalId The ID of the modal to bring into focus
675
+ * Brings a modal into focus.
676
+ * @param modalId - The ID of the modal to bring into focus.
581
677
  */
582
678
  focus(modalId: string): void;
583
679
  setUpdateModals(updateModals: ModalsManager["updateModals"]): void;
584
680
  /**
585
- * Returns the IDs of all open modals
681
+ * Returns the IDs of all open modals.
586
682
  */
587
683
  get modalIds(): string[];
588
684
  static getModalIconUrl(name: string): string;
@@ -593,7 +689,7 @@ export declare const modalsManagerContext: Context<ModalsManagerState>;
593
689
  export declare type ModalsManagerState = ModalsManager | undefined;
594
690
 
595
691
  /**
596
- * Component that renders all active modals
692
+ * Component that renders all active modals.
597
693
  */
598
694
  export declare const ModalsView: MemoExoticComponent<() => JSX_2.Element>;
599
695
 
@@ -601,18 +697,18 @@ export declare function NoRoute(): JSX_2.Element;
601
697
 
602
698
  export declare interface NoRouteProps {
603
699
  /**
604
- * Title of the route
700
+ * Title of the route.
605
701
  * @default "404: Not Found"
606
702
  */
607
703
  title: string;
608
704
  }
609
705
 
610
706
  export declare interface OnSelectionChangeParams {
611
- /** The selected files */
707
+ /** The selected files. */
612
708
  files?: string[];
613
- /** The selected folders */
709
+ /** The selected folders. */
614
710
  folders?: string[];
615
- /** The directory the selection was made in */
711
+ /** The directory the selection was made in. */
616
712
  directory?: VirtualFolder;
617
713
  }
618
714
 
@@ -621,61 +717,96 @@ export declare function openUrl(url: string, target?: HTMLAttributeAnchorTarget)
621
717
  export declare type OpenWindowedModal = (params: OpenWindowedModalParams) => Modal;
622
718
 
623
719
  export declare interface OpenWindowedModalParams {
624
- /** The ID of the associated app */
720
+ /** The ID of the associated app. */
625
721
  appId?: string;
626
- /** The URL of the icon of the modal */
722
+ /** The URL of the icon of the modal. */
627
723
  iconUrl?: string;
628
- /** The title of the modal */
724
+ /** The title of the modal. */
629
725
  title?: string;
630
- /** The size of the modal */
631
- size: Vector2;
632
- /** The modal component */
726
+ /** The size of the modal. */
727
+ size?: Vector2;
728
+ /** The modal component. */
633
729
  Modal: FC<ModalProps>;
634
730
  single?: boolean;
635
731
  fullscreen?: WindowProps["fullscreen"];
636
732
  }
637
733
 
734
+ /**
735
+ * Represents a command-line flag or parameter.
736
+ */
737
+ declare interface Option_2 {
738
+ /** The full name of the option (e.g., "all" for --all). */
739
+ long: string;
740
+ /** The single-character alias (e.g., "a" for -a). */
741
+ short: string;
742
+ /** If true, the shell expects a value to follow this option (e.g., --file <name>). */
743
+ isInput: boolean;
744
+ }
745
+ export { Option_2 as Option }
746
+
638
747
  export declare type OptionalStringProperty = string | null | undefined;
639
748
 
640
749
  /**
641
- * Component that calls a function when the user clicks outside of it
750
+ * Component that calls a function when the user clicks outside of it.
642
751
  */
643
752
  export declare const OutsideClickListener: MemoExoticComponent<({ onOutsideClick, children }: OutsideClickListenerProps) => JSX_2.Element>;
644
753
 
645
754
  export declare interface OutsideClickListenerProps {
646
- /** Function that handles clicks outside of this component */
755
+ /** Function that handles clicks outside of this component. */
647
756
  onOutsideClick: (event: Event) => void;
648
757
  children: ReactNode;
649
758
  }
650
759
 
651
760
  /**
652
- * Component that renders a progress bar
761
+ * Represents an active or pending process within the shell.
762
+ */
763
+ export declare interface Process extends ProcessIO {
764
+ /** The executable name or alias being invoked. */
765
+ commandName: string;
766
+ /** Array of string arguments passed to the command. */
767
+ args: string[];
768
+ }
769
+
770
+ /**
771
+ * Standard input, output, and error streams for a process.
772
+ */
773
+ export declare interface ProcessIO {
774
+ /** The stream used to receive input data. */
775
+ stdin: Stream;
776
+ /** The stream used to output standard data. */
777
+ stdout: Stream;
778
+ /** The stream used to output error messages. */
779
+ stderr: Stream;
780
+ }
781
+
782
+ /**
783
+ * Component that renders a progress bar.
653
784
  */
654
785
  export declare function ProgressBar({ fillPercentage, fillColor, backgroundColor, align, className }: ProgressBarProps): JSX_2.Element;
655
786
 
656
787
  export declare interface ProgressBarProps {
657
- /** The amount of progress, as a percentage */
788
+ /** The amount of progress, as a percentage. */
658
789
  fillPercentage: number;
659
- /** The CSS color to use for the filled part of the progress bar */
790
+ /** The CSS color to use for the filled part of the progress bar. */
660
791
  fillColor?: string;
661
- /** The CSS background color of the progress bar */
792
+ /** The CSS background color of the progress bar. */
662
793
  backgroundColor?: string;
663
794
  align?: "left";
664
- /** `className` prop for the progress bar */
795
+ /** `className` prop for the progress bar. */
665
796
  className?: string;
666
797
  }
667
798
 
668
799
  /**
669
- * Main component that contains everything
800
+ * Main component that contains everything .
670
801
  */
671
802
  export declare const ProzillaOS: NamedExoticComponent<ProzillaOSProps>;
672
803
 
673
804
  export declare interface ProzillaOSProps {
674
- /** The name of the system */
805
+ /** The name of the system. */
675
806
  systemName?: string;
676
- /** The tagline/short description of the system */
807
+ /** The tagline/short description of the system. */
677
808
  tagLine?: string;
678
- /** The system configuration */
809
+ /** The system configuration. */
679
810
  config?: {
680
811
  apps?: Partial<AppsConfigOptions>;
681
812
  desktop?: Partial<DesktopConfigOptions>;
@@ -692,26 +823,16 @@ export declare interface ProzillaOSProps {
692
823
 
693
824
  export declare function RadioAction({ actionId, options, initialIndex, onTrigger }: RadioActionProps): ReactElement;
694
825
 
695
- /**
696
- * @param {object} props
697
- * @param {string} props.actionId
698
- * @param {{
699
- * label: string,
700
- * shortcut: string[]
701
- * }[]} props.options
702
- * @param {number} props.initialIndex
703
- * @param {Function} props.onTrigger
704
- */
705
826
  export declare interface RadioActionProps extends ActionProps {
706
827
  options: {
707
828
  label: string;
708
829
  shortcut?: string[];
709
830
  }[];
710
- initialIndex: number;
831
+ initialIndex?: number;
711
832
  }
712
833
 
713
834
  /**
714
- * Reloads the viewport
835
+ * Reloads the viewport.
715
836
  */
716
837
  export declare function reloadViewport(): void;
717
838
 
@@ -723,64 +844,95 @@ export declare function Router({ path, homePage, fallbackPage, children }: Route
723
844
 
724
845
  export declare interface RouterProps {
725
846
  path?: string;
726
- homePage?: JSX.Element;
727
- fallbackPage?: JSX.Element;
847
+ homePage?: ReactElement;
848
+ fallbackPage?: ReactElement;
728
849
  children?: ReactElement;
729
850
  }
730
851
 
731
852
  export declare class Settings {
732
853
  #private;
854
+ /**
855
+ * The virtual path of the settings file.
856
+ */
733
857
  path: string;
734
- file: VirtualFile;
858
+ /**
859
+ * The settings file.
860
+ */
861
+ file: VirtualFile | null;
735
862
  xmlDoc?: Document;
863
+ /**
864
+ * Virtual path to the desktop settings.
865
+ */
866
+ static readonly DESKTOP: string;
867
+ /**
868
+ * Virtual path to the taskbar settings.
869
+ */
870
+ static readonly TASKBAR: string;
871
+ /**
872
+ * Virtual path to the apps settings.
873
+ */
874
+ static readonly APPS: string;
875
+ /**
876
+ * Virtual path to the theme settings.
877
+ */
878
+ static readonly THEME: string;
879
+ /**
880
+ * Virtual path to the virtual drive settings.
881
+ */
882
+ static readonly VIRTUAL_DRIVE: string;
736
883
  constructor(virtualRoot: VirtualRoot, path: string);
737
884
  /**
738
- * Reads the xml doc from the given path and assigns it to itself
885
+ * Reads the xml doc from the given path and assigns it to itself.
739
886
  */
740
887
  read(): Promise<void>;
741
888
  write(): void;
742
889
  /**
743
- * Checks if xml doc is missing
890
+ * Checks if xml doc is missing.
744
891
  */
745
892
  isMissingXmlDoc(): Promise<boolean>;
746
893
  /**
747
- * Gets a value by a given key if it exists and optionally calls a callback function whenever the value changes
748
- * @param key The key of the setting
749
- * @param callback The callback function to call whenever the value changes
894
+ * Gets a value by a given key if it exists and optionally calls a callback function whenever the value changes.
895
+ * @param key - The key of the setting.
896
+ * @param callback - The callback function to call whenever the value changes.
750
897
  */
751
898
  get(key: string, callback?: (value: string) => void): Promise<{
752
899
  value: string | null;
753
- listener?: Listener;
900
+ listener?: SettingsListener;
754
901
  }>;
755
902
  /**
756
- * Gets a value by a given key as a boolean
903
+ * Gets a value by a given key as a boolean.
757
904
  */
758
905
  getBool(key: string, callback?: (value: boolean) => void): Promise<{
759
906
  value: boolean | null;
760
- listener?: Listener;
907
+ listener?: SettingsListener;
761
908
  }>;
762
909
  /**
763
- * Gets a value by a given key as an integer
910
+ * Gets a value by a given key as an integer.
764
911
  */
765
912
  getInt(key: string, callback?: (value: number) => void): Promise<{
766
913
  value: number | null;
767
- listener?: Listener;
914
+ listener?: SettingsListener;
768
915
  }>;
769
916
  /**
770
- * Sets the value associated with a given key
771
- * @param key The key of the setting
772
- * @param value The new value
917
+ * Sets the value associated with a given key.
918
+ * @param key - The key of the setting.
919
+ * @param value - The new value.
773
920
  */
774
921
  set(key: string, value: string): Promise<void>;
775
922
  /**
776
- * Removes a listener from the settings file
777
- * @param listener The listener to remove
923
+ * Removes a listener from the settings file.
924
+ * @param listener - The listener to remove.
778
925
  */
779
- removeListener(listener: Listener): void;
926
+ removeListener(listener: SettingsListener): void;
780
927
  }
781
928
 
929
+ export declare type SettingsListener = Listener<VirtualFileEvents, "contentChange">;
930
+
782
931
  export declare class SettingsManager {
783
932
  #private;
933
+ /**
934
+ * @deprecated - Use constants from {@link Settings} instead.
935
+ */
784
936
  static VIRTUAL_PATHS: {
785
937
  [s: string]: string;
786
938
  };
@@ -800,87 +952,371 @@ export declare function setViewportTitle(title: string): void;
800
952
 
801
953
  export declare function Share({ modal, params, ...props }: ModalProps): JSX_2.Element;
802
954
 
803
- declare class Skin {
804
- systemIcon: SkinOptions["systemIcon"];
805
- appIcons: SkinOptions["appIcons"];
806
- appNames: SkinOptions["appNames"];
807
- wallpapers: SkinOptions["wallpapers"];
808
- defaultWallpaper: SkinOptions["defaultWallpaper"];
809
- fileIcons: SkinOptions["fileIcons"];
810
- folderIcons: SkinOptions["folderIcons"];
811
- loadStyleSheet: SkinOptions["loadStyleSheet"];
812
- defaultTheme: SkinOptions["defaultTheme"];
813
- constructor(options?: Partial<SkinOptions>);
955
+ /**
956
+ * A Unix-like shell emulator that handles command parsing, environment management,
957
+ * autocompletion, and process I/O.
958
+ */
959
+ export declare class Shell {
960
+ /** The reactive state of this shell. */
961
+ state: ShellState;
962
+ /** The configuration used to initialize this shell. */
963
+ config: ShellConfig;
964
+ /** The environment variable manager for this shell. */
965
+ env: ShellEnvironment;
966
+ /** The logic handler for parsing and executing command strings. */
967
+ interpreter: ShellInterpreter;
968
+ static readonly COMMAND_NOT_FOUND_ERROR = "Command not found";
969
+ static readonly MISSING_ARGS_ERROR = "requires at least 1 argument";
970
+ static readonly MISSING_OPTIONS_ERROR = "requires at least 1 option";
971
+ static readonly COMMAND_FAILED_ERROR = "Command failed";
972
+ static readonly USAGE_ERROR = "Incorrect usage";
973
+ static readonly INVALID_PATH_ERROR = "No such file or directory";
974
+ static readonly SUDO_COMMAND = "sudo";
975
+ /** Regex used to strip specific ANSI escape codes from the TTY buffer. */
976
+ static readonly STRIP_ANSI_REGEX: RegExp;
977
+ constructor(config: ShellConfig);
978
+ /**
979
+ * Sends a signal to the shell or the currently active foreground process.
980
+ * @param signal - The signal to send. Defaults to `"SIGTERM"`.
981
+ */
982
+ terminate(signal?: StreamSignal): void;
983
+ /**
984
+ * Convenience method to send the `SIGINT` (Interrupt) signal.
985
+ * @see {@link Shell.terminate}
986
+ */
987
+ interrupt(): void;
988
+ /**
989
+ * Convenience method to send the `SIGKILL` (Kill) signal, closing the shell.
990
+ * @see {@link Shell.terminate}
991
+ */
992
+ kill(): void;
993
+ /**
994
+ * Recalculates the prompt string based on the current user, hostname, and working directory.
995
+ */
996
+ updatePrompt(): void;
997
+ /**
998
+ * Updates the text in the current input line.
999
+ * @param value - The new string value or a function that receives the previous value.
1000
+ */
1001
+ setLine(value: string | ((prev: string) => string)): void;
1002
+ /**
1003
+ * Appends a new entry to the terminal history.
1004
+ * @param entry - The history entry to add.
1005
+ */
1006
+ pushHistory(entry: HistoryEntry): void;
1007
+ /**
1008
+ * Writes raw text to the shell, handling ANSI escape codes for screen clearing and alt buffers.
1009
+ * @param text - The string data to write to the TTY.
1010
+ */
1011
+ write(text: string): void;
1012
+ /**
1013
+ * Clears the current input line and executes the given command string.
1014
+ * @param input - The command string to execute.
1015
+ * @returns A promise that resolves with the final exit code of the execution.
1016
+ */
1017
+ run(input: string): Promise<number>;
1018
+ /**
1019
+ * Clears the current input line and resets the history search offset.
1020
+ */
1021
+ clearLine(): void;
1022
+ /**
1023
+ * Navigates through command history.
1024
+ * @param direction - Positive to go back in time, negative to go forward.
1025
+ */
1026
+ historySearch(direction: number): void;
1027
+ /**
1028
+ * Changes the current working directory and updates `PWD`/`OLDPWD` environment variables.
1029
+ * @param directory - The virtual folder to switch to.
1030
+ */
1031
+ setWorkingDirectory(directory: VirtualFolder): void;
1032
+ /**
1033
+ * Calculates possible completions for the current input based on commands and file paths.
1034
+ * @returns An array of string suggestions.
1035
+ */
1036
+ getCompletions(): string[];
1037
+ /**
1038
+ * Performs an auto-completion action. If one match is found, it completes the line.
1039
+ * If multiple are found, it lists them in the history.
1040
+ */
1041
+ autoComplete(): void;
1042
+ /**
1043
+ * Utility to write a formatted error message to a stream and return an exit code.
1044
+ * @param stream - The stream to receive the error output.
1045
+ * @param commandName - The name of the command reporting the error.
1046
+ * @param error - A single string or array of strings representing the error message.
1047
+ * @param exitCode - The numerical exit code to return.
1048
+ * @returns `exitCode`.
1049
+ */
1050
+ static writeError(stream: Stream, commandName: string, error?: string | string[], exitCode?: number): number;
1051
+ /**
1052
+ * Executes a frame-based animation in the terminal using the Alternate Screen Buffer.
1053
+ * @returns A promise that resolves when the animation is stopped.
1054
+ */
1055
+ static animate({ stdout, stdin, render, delay, clear, stopOnBlank }: Pick<ShellContext, "stdout" | "stdin"> & {
1056
+ /** The function that renders each frame. */
1057
+ render: (frame: number) => string;
1058
+ /** The delay between each frame, in ms. */
1059
+ delay: number;
1060
+ /** Whether to clear the terminal before each frame. */
1061
+ clear?: boolean;
1062
+ /** Whether to stop the animation when the rendered frame is blank. */
1063
+ stopOnBlank?: boolean;
1064
+ }): Promise<0>;
1065
+ /**
1066
+ * Reads input data. If `rawLine` is provided, it processes it immediately via the callback.
1067
+ * Otherwise, it waits for data from the `stdin` stream.
1068
+ * @param rawLine - The pre-provided input string.
1069
+ * @param stdin - The input stream to fall back on.
1070
+ * @param callback - Function to process the collected input data.
1071
+ */
1072
+ static readInput(rawLine: string, stdin: Stream, callback: (data: string) => CommandOutput): Promise<CommandOutput>;
1073
+ }
1074
+
1075
+ /**
1076
+ * Configuration options for initializing a new Shell instance.
1077
+ */
1078
+ export declare interface ShellConfig {
1079
+ /** The application instance that owns and manages this shell. */
1080
+ app?: App;
1081
+ /** The initial working directory path (e.g., "~" or "/bin"). */
1082
+ path?: string;
1083
+ /** A string to pre-fill the shell input with. */
1084
+ input?: string;
1085
+ virtualRoot: VirtualRoot;
1086
+ systemManager: SystemManager;
1087
+ settingsManager: SettingsManager;
1088
+ /** Callback function to trigger when the shell process should be terminated. */
1089
+ exit: () => void;
1090
+ /** A reactive reference containing the current terminal dimensions in rows and columns. */
1091
+ sizeRef: {
1092
+ current: Vector2;
1093
+ };
1094
+ /** Optional initial environment variables to populate the shell with. */
1095
+ env?: Record<string, string>;
1096
+ }
1097
+
1098
+ /**
1099
+ * The context object provided to command execution functions.
1100
+ */
1101
+ export declare interface ShellContext extends ProcessIO {
1102
+ /** Reference to the parent Shell instance. */
1103
+ shell: Shell;
1104
+ /** The directory where the command was executed. */
1105
+ workingDirectory: VirtualFolder;
1106
+ /** The name of the user executing the command. */
1107
+ username: string;
1108
+ /** The hostname of the virtual system. */
1109
+ hostname: string;
1110
+ /** The full, unparsed command line string (excluding pipes/redirects). */
1111
+ rawLine: string;
1112
+ /** Array of parsed flags in their short form (e.g., ["l", "a"]). */
1113
+ options: string[];
1114
+ /**
1115
+ * Function to kill the shell session.
1116
+ * @see {@link Shell.kill}
1117
+ */
1118
+ exit: () => void;
1119
+ /** Map of option keys in their short form to their provided values. */
1120
+ inputs: Record<string, string>;
1121
+ /** Millisecond timestamp of when the command was started. */
1122
+ timestamp: number;
1123
+ virtualRoot: VirtualRoot;
1124
+ settingsManager: SettingsManager;
1125
+ systemManager: SystemManager;
1126
+ /** The owning application, if any. */
1127
+ app?: App;
1128
+ /** The current dimensions of the terminal window. */
1129
+ readonly size: Vector2;
1130
+ /** The scoped environment variables for this process. */
1131
+ env: ShellEnvironment;
814
1132
  }
815
1133
 
816
- declare interface SkinOptions {
1134
+ /**
1135
+ * Manages environment variabels for {@link Shell}.
1136
+ */
1137
+ export declare class ShellEnvironment {
1138
+ store: Record<string, string>;
1139
+ parent: ShellEnvironment | null;
1140
+ exportedKeys: Set<string>;
1141
+ static readonly USER = "USER";
1142
+ static readonly HOSTNAME = "HOSTNAME";
1143
+ static readonly WORKING_DIRECTORY = "PWD";
1144
+ static readonly PREVIOUS_WORKING_DIRECTORY = "OLDPWD";
1145
+ static readonly EXIT_CODE = "?";
1146
+ static readonly ARGUMENT_COUNT = "#";
1147
+ static readonly PROCESS_ID = "$";
1148
+ /** List of variables that should never be exported. */
1149
+ static readonly INTERNAL_VARS: string[];
1150
+ constructor(initialVars?: Record<string, string>, parent?: ShellEnvironment | null);
1151
+ get(key: string): string | undefined;
1152
+ set(key: string, value: string, isExported?: boolean): void;
817
1153
  /**
818
- * SVG icon for the system
819
- * @default
820
- * "https://os.prozilla.dev/icon.svg"
1154
+ * Marks an existing variable as exported.
821
1155
  */
822
- systemIcon: string;
1156
+ export(key: string): void;
823
1157
  /**
824
- * Replacements for app icons based on app id
1158
+ * Replaces variable placeholders in a string with their corresponding values.
825
1159
  */
826
- appIcons?: {
827
- [key: string]: string;
828
- };
1160
+ expand(input: string): string;
829
1161
  /**
830
- * Replacements for app names based on app id
1162
+ * Parses an assignment string (e.g., KEY=VALUE) and updates the environment.
1163
+ * @returns `true` if the string was a valid assignment.
831
1164
  */
832
- appNames?: {
833
- [key: string]: string;
834
- };
1165
+ parseAssignment(input: string): boolean;
835
1166
  /**
836
- * Array of URLs of wallpaper images
1167
+ * Returns only variables that are marked for export.
837
1168
  */
838
- wallpapers: string[];
1169
+ get exportedVariables(): Record<string, string>;
839
1170
  /**
840
- * URL of default wallpaper image
841
- * @default
842
- * "https://os.prozilla.dev/assets/wallpapers/vibrant-wallpaper-blue-purple-red.png"
1171
+ * Returns all variables visible to this scope (including internal).
843
1172
  */
844
- defaultWallpaper: string;
1173
+ get variables(): Record<string, string>;
845
1174
  /**
846
- * URLs of icons for types of files
1175
+ * Creates a child scope for subshells or command execution.
847
1176
  */
848
- fileIcons: {
849
- generic: string;
850
- info?: string;
851
- text?: string;
852
- code?: string;
853
- external?: string;
854
- video?: string;
855
- audio?: string;
856
- };
1177
+ fork(): ShellEnvironment;
1178
+ }
1179
+
1180
+ /**
1181
+ * Handles the parsing, expansion, and execution of shell commands and scripts.
1182
+ * Manages the process pipeline and stream redirection.
1183
+ */
1184
+ export declare class ShellInterpreter {
1185
+ private shell;
1186
+ pipeline: Process[];
1187
+ constructor(shell: Shell);
857
1188
  /**
858
- * URLs of icons for types of folders
1189
+ * Sends a termination signal to all processes currently in the pipeline.
1190
+ * @param signal - The signal to send.
859
1191
  */
860
- folderIcons: {
861
- generic: string;
862
- images?: string;
863
- text?: string;
864
- link?: string;
865
- video?: string;
866
- audio?: string;
867
- };
1192
+ terminatePipeline(signal: StreamSignal): void;
1193
+ /**
1194
+ * Parses and executes a shell script.
1195
+ * @param script - The script content or a virtual file.
1196
+ * @returns The exit code of the last command executed in the script.
1197
+ */
1198
+ executeScript(script: string | VirtualFile): Promise<number>;
1199
+ /**
1200
+ * Parses and executes an input string, handling environment expansion and piping.
1201
+ * @param input - The raw command line string.
1202
+ * @param streams - Optional output streams to override default TTY behavior.
1203
+ * @returns A promise that resolves with the final exit code of the execution.
1204
+ */
1205
+ execute(input: string, streams?: {
1206
+ stdout?: Stream;
1207
+ stderr?: Stream;
1208
+ }): Promise<number>;
868
1209
  /**
869
- * Function that dynamically imports style sheet
1210
+ * Resolves a command, parses flags/options, and executes the command logic.
1211
+ * @returns The resulting exit code from the command execution.
870
1212
  */
871
- loadStyleSheet?: () => void;
1213
+ spawn({ stdin, stdout, stderr, commandName, args }: Process): Promise<number>;
872
1214
  /**
873
- * Default theme
1215
+ * Splits a command string into an array of arguments, respecting single and double quotes.
874
1216
  */
875
- defaultTheme?: Theme;
1217
+ static parseCommand(input: string): string[];
876
1218
  }
877
1219
 
1220
+ /**
1221
+ * The internal reactive state of the shell.
1222
+ */
1223
+ export declare interface ShellState {
1224
+ /** An array of all past outputs and commands displayed in the terminal. */
1225
+ history: HistoryEntry[];
1226
+ /** The current, unsubmitted text in the input line. */
1227
+ line: string;
1228
+ /** Current position in the history search (0 is the current line). */
1229
+ historyOffset: number;
1230
+ /** The current directory the shell is operating within. */
1231
+ workingDirectory: VirtualFolder;
1232
+ /** The formatted prompt string (e.g., "user@host:~$ "). */
1233
+ prompt: string;
1234
+ /** The current active input stream for a running process. */
1235
+ stream: Stream | null;
1236
+ /** Temporary storage for data written to the terminal while a stream is active. */
1237
+ ttyBuffer: string | null;
1238
+ /** Indicates if a process has requested the Alternate Screen Buffer (e.g., a text editor). */
1239
+ isUsingAltScreen: boolean;
1240
+ /** A reactive view of the current environment variables. */
1241
+ env: Record<string, string>;
1242
+ }
1243
+
1244
+ declare type ShortcutHandler = (event: KeyboardEvent) => void;
1245
+
878
1246
  export declare function StandaloneRoute({ app }: StandaloneRouteProps): JSX_2.Element;
879
1247
 
880
1248
  export declare interface StandaloneRouteProps {
881
1249
  app: App;
882
1250
  }
883
1251
 
1252
+ /**
1253
+ * A wrapper for {@link localStorage} with additional functionality like compression and a size limit.
1254
+ */
1255
+ declare class Storage_2 {
1256
+ /**
1257
+ * Enables compression of values stored in this storage.
1258
+ * @default false
1259
+ */
1260
+ enableCompression: boolean;
1261
+ /**
1262
+ * The prefix to prepend to keys.
1263
+ * @default undefined
1264
+ */
1265
+ prefix: string | undefined;
1266
+ /**
1267
+ * The maximum amount of bytes of a value in this storage.
1268
+ */
1269
+ static readonly MAX_BYTES = 5000000;
1270
+ static readonly COMPRESSED_PREFIX = "\uE000";
1271
+ static readonly UNCOMPRESSED_PREFIX = "\uE001";
1272
+ /**
1273
+ * Stores a key and value pair in this storage.
1274
+ * @param key - The key to store.
1275
+ * @param value - The value to store.
1276
+ */
1277
+ store(key: string, value: string): void;
1278
+ /**
1279
+ * Loads a value associated with the given key.
1280
+ * @param key - The key of the item.
1281
+ * @returns The value of the item.
1282
+ */
1283
+ load(key: string): string | null;
1284
+ /**
1285
+ * Replaces the key of an item if it exists.
1286
+ * @param oldKey - The key to replace.
1287
+ * @param newKey - The new key.
1288
+ */
1289
+ rename(oldKey: string, newKey: string): this;
1290
+ /**
1291
+ * Removes the item with the given key from this storage.
1292
+ * @param key - The key of the item.
1293
+ */
1294
+ remove(key: string): this;
1295
+ /**
1296
+ * Clears all items stored in this storage.
1297
+ */
1298
+ clear(): this;
1299
+ /**
1300
+ * Returns the byte size of a key and value pair.
1301
+ * @param key - The key of the item.
1302
+ * @param value - The value of the item.
1303
+ */
1304
+ getItemByteSize(key: string, value: string): number;
1305
+ getEncodedByteSize(string: string | null): number;
1306
+ encode(string: string): {
1307
+ result: string;
1308
+ size: number;
1309
+ };
1310
+ decode(string: string): string;
1311
+ setPrefix(prefix?: string): this;
1312
+ static getByteSize(string: string | null): number;
1313
+ static byteToKilobyte(bytes: number): number;
1314
+ }
1315
+ export { Storage_2 as Storage }
1316
+
1317
+ /**
1318
+ * @deprecated Use {@link Storage} instead.
1319
+ */
884
1320
  declare class StorageManager_2 {
885
1321
  static MAX_BYTES: number;
886
1322
  static store(key: string, value: string): void;
@@ -891,11 +1327,63 @@ declare class StorageManager_2 {
891
1327
  }
892
1328
  export { StorageManager_2 as StorageManager }
893
1329
 
1330
+ /**
1331
+ * A communication channel for process I/O, supporting event-based data transmission,
1332
+ * signaling, and piping between streams.
1333
+ */
1334
+ export declare class Stream<T = string> extends EventEmitter<StreamEvents<T>> {
1335
+ enabled: boolean;
1336
+ static readonly DATA_EVENT = "data";
1337
+ static readonly START_EVENT = "start";
1338
+ static readonly STOP_EVENT = "stop";
1339
+ static readonly SIGNAL_EVENT = "signal";
1340
+ /**
1341
+ * Activates the stream and notifies listeners.
1342
+ */
1343
+ start(callback?: (stream: this) => void): this;
1344
+ /**
1345
+ * Deactivates the stream. Subsequent calls to {@link Stream.write} will be ignored.
1346
+ */
1347
+ stop(): this;
1348
+ /**
1349
+ * Emits a control signal. Standard termination signals will automatically stop the stream.
1350
+ */
1351
+ signal(signal: StreamSignal): this;
1352
+ /**
1353
+ * Broadcasts data to all listeners if the stream is enabled.
1354
+ */
1355
+ write(data: T): this;
1356
+ /**
1357
+ * Forwards data, stop events, and signals from this stream to another.
1358
+ * @param destination - The stream that will receive the forwarded data.
1359
+ * @returns The destination stream to allow for chainable piping.
1360
+ */
1361
+ pipe(destination: Stream<T>): Stream<T>;
1362
+ /**
1363
+ * Returns a promise that resolves when the stream is stopped.
1364
+ */
1365
+ wait(): Promise<void>;
1366
+ /**
1367
+ * Returns a promise that resolves when the stream is stopped.
1368
+ * @param value - Value to return when the promise resolves.
1369
+ */
1370
+ wait<U>(value: U): Promise<U>;
1371
+ }
1372
+
1373
+ export declare interface StreamEvents<T = string> {
1374
+ data: [T];
1375
+ start: [];
1376
+ stop: [];
1377
+ signal: [StreamSignal];
1378
+ }
1379
+
1380
+ export declare type StreamSignal = "SIGINT" | "SIGKILL" | "SIGTERM" | "SIGINFO";
1381
+
894
1382
  export declare class SystemManager {
895
1383
  #private;
896
- /** The name of the system */
1384
+ /** The name of the system. */
897
1385
  readonly systemName: string;
898
- /** The tagline/short description of the system */
1386
+ /** The tagline/short description of the system. */
899
1387
  readonly tagLine: string;
900
1388
  readonly skin: Skin;
901
1389
  readonly appsConfig: AppsConfig;
@@ -906,6 +1394,7 @@ export declare class SystemManager {
906
1394
  readonly trackingConfig: TrackingConfig;
907
1395
  readonly windowsConfig: WindowsConfig;
908
1396
  readonly virtualDriveConfig: VirtualDriveConfig;
1397
+ readonly storage: Storage_2;
909
1398
  constructor({ systemName, tagLine, skin, desktopConfig, appsConfig, miscConfig, modalsConfig, taskbarConfig, trackingConfig, windowsConfig, virtualDriveConfig, }: SystemManagerParams);
910
1399
  private loadSkin;
911
1400
  getUptime(precision?: number): string;
@@ -928,7 +1417,7 @@ export declare interface SystemManagerParams {
928
1417
  }
929
1418
 
930
1419
  /**
931
- * Component that renders the start and search menus, pinned applications and various indicators
1420
+ * Component that renders the start and search menus, pinned applications and various indicators.
932
1421
  */
933
1422
  export declare const Taskbar: MemoExoticComponent<() => JSX_2.Element>;
934
1423
 
@@ -939,7 +1428,7 @@ export declare class TaskbarConfig {
939
1428
 
940
1429
  export declare interface TaskbarConfigOptions {
941
1430
  /**
942
- * Height of the taskbar in CSS pixels
1431
+ * Height of the taskbar in CSS pixels.
943
1432
  * @default 3 * 16
944
1433
  */
945
1434
  height: number;
@@ -951,23 +1440,14 @@ export declare interface TextDisplayProps {
951
1440
  children: ReactNode;
952
1441
  }
953
1442
 
954
- declare enum Theme {
955
- Dark = 0,
956
- Light = 1,
957
- Cherry = 2,
958
- Mango = 3,
959
- Aqua = 4,
960
- Grape = 5
961
- }
962
-
963
1443
  export declare class TimeManager {
964
1444
  static START_DATE: Date;
965
1445
  /**
966
- * Resets the time
1446
+ * Resets the time.
967
1447
  */
968
1448
  static reset(): void;
969
1449
  /**
970
- * Get the current uptime
1450
+ * Get the current uptime.
971
1451
  */
972
1452
  static getUptime(precision?: number): string;
973
1453
  }
@@ -975,7 +1455,7 @@ export declare class TimeManager {
975
1455
  export declare function ToggleAction({ actionId, label, shortcut, initialValue, onTrigger }: ToggleActionProps): ReactElement;
976
1456
 
977
1457
  export declare interface ToggleActionProps extends ActionProps {
978
- initialValue: boolean;
1458
+ initialValue?: boolean;
979
1459
  }
980
1460
 
981
1461
  export declare class TrackingConfig {
@@ -986,11 +1466,11 @@ export declare class TrackingConfig {
986
1466
 
987
1467
  export declare interface TrackingConfigOptions {
988
1468
  /**
989
- * Enable tracking
1469
+ * Enable tracking.
990
1470
  * @default true
991
1471
  */
992
1472
  enabled: boolean;
993
- /** Google Analytics measurement ID */
1473
+ /** Google Analytics measurement ID. */
994
1474
  GAMeasurementId: string;
995
1475
  }
996
1476
 
@@ -1006,139 +1486,156 @@ export declare const TrackingManagerContext: Context<TrackingManagerState>;
1006
1486
 
1007
1487
  export declare type TrackingManagerState = TrackingManager | undefined;
1008
1488
 
1009
- /** Returns a function that opens an alert modal */
1489
+ /** Returns a function that opens an alert modal. */
1010
1490
  export declare function useAlert(): {
1011
1491
  alert: (params: AlertParams) => void;
1012
1492
  };
1013
1493
 
1014
1494
  /**
1015
- * Returns the folder associated with a given app
1495
+ * Returns the folder associated with a given app.
1016
1496
  */
1017
1497
  export declare function useAppFolder(app?: App): VirtualFolder | null;
1018
1498
 
1019
1499
  /**
1020
- * Returns the boolean value of a setting and a function to update it
1021
- * @param path The path of the settings file
1022
- * @param key The key of the setting
1023
- * @param defaultValue The default value of the setting
1024
- * @returns The boolean value of a setting and a function to update it
1500
+ * Returns the boolean value of a setting and a function to update it.
1501
+ * @param path - The path of the settings file.
1502
+ * @param key - The key of the setting.
1503
+ * @param defaultValue - The default value of the setting.
1504
+ * @returns The boolean value of a setting and a function to update it.
1025
1505
  */
1026
1506
  export declare function useBoolSetting(path: SettingsPath, key: string, defaultValue?: boolean): [boolean, (value: string | boolean) => void];
1027
1507
 
1028
1508
  /**
1029
- * Combine class names and an optional static class name
1509
+ * Combines class names and an optional static class name.
1510
+ * @param classNames - The class names to combine.
1511
+ * @param block - The name of the block.
1512
+ * @param element - The name of the element.
1513
+ * @param modifier - The name of the modifier(s).
1030
1514
  */
1031
1515
  export declare function useClassNames(classNames: (string | undefined)[], block?: string, element?: string, modifier?: string | string[]): string;
1032
1516
 
1033
1517
  /**
1034
- * Creates a function that handles the opening of a custom context menu and a component that listens for keyboard shortcuts
1518
+ * Creates a function that handles the opening of a custom context menu and a component that listens for keyboard shortcuts.
1035
1519
  */
1036
1520
  export declare function useContextMenu({ Actions }: UseContextMenuParams): {
1037
- onContextMenu: (event: MouseEvent_2<HTMLElement, MouseEvent_2>, params?: object) => Modal;
1521
+ onContextMenu: ContextMenuHandler;
1038
1522
  ShortcutsListener: () => JSX_2.Element;
1039
1523
  };
1040
1524
 
1041
1525
  export declare interface UseContextMenuParams {
1042
- /** The component with the actions of the context menu */
1526
+ /** The component with the actions of the context menu. */
1043
1527
  Actions: FC<ActionsProps>;
1044
1528
  }
1045
1529
 
1046
1530
  /**
1047
- * Returns an object that handles stateful history with undo and redo methods
1531
+ * Returns an object that handles stateful history with undo and redo methods.
1048
1532
  */
1049
1533
  export declare function useHistory<Type>(initialState: Type): {
1050
- /** The entries of the history */
1534
+ /** The entries of the history. */
1051
1535
  history: Type[];
1052
- /** The index of the active entry in list of entries */
1536
+ /** The index of the active entry in list of entries. */
1053
1537
  stateIndex: number;
1054
- /** Adds a new entry to the history */
1538
+ /** Adds a new entry to the history. */
1055
1539
  pushState: (state: Type) => void;
1056
- /** Moves backwards in the history */
1540
+ /** Moves backwards in the history. */
1057
1541
  undo: () => void;
1058
- /** Moves forwards in the history */
1542
+ /** Moves forwards in the history. */
1059
1543
  redo: () => void;
1060
1544
  undoAvailable: boolean;
1061
1545
  redoAvailable: boolean;
1062
1546
  };
1063
1547
 
1064
1548
  /**
1065
- * Returns the integer value of a setting and a function to update it
1066
- * @param path The path of the settings file
1067
- * @param key The key of the setting
1068
- * @param defaultValue The default value of the setting
1069
- * @returns The integer value of a setting and a function to update it
1549
+ * Returns the integer value of a setting and a function to update it.
1550
+ * @param path - The path of the settings file.
1551
+ * @param key - The key of the setting.
1552
+ * @param defaultValue - The default value of the setting.
1553
+ * @returns The integer value of a setting and a function to update it.
1070
1554
  */
1071
1555
  export declare function useIntSetting(path: SettingsPath, key: string, defaultValue?: number): [number, (value: string | number) => void];
1072
1556
 
1073
1557
  /**
1074
- * Creates listeners for `"keydown"` and `"keyup"` events
1558
+ * Creates listeners for `"keydown"` and `"keyup"` events.
1075
1559
  */
1076
1560
  export declare function useKeyboardListener({ onKeyDown, onKeyUp }: UseKeyboardListenerParams): void;
1077
1561
 
1078
1562
  export declare interface UseKeyboardListenerParams {
1079
- /** Function that handles `"keydown"` events */
1563
+ /** Function that handles `"keydown"` events. */
1080
1564
  onKeyDown?: (event: KeyboardEvent) => void;
1081
- /** Function that handles `"keyup"` events */
1565
+ /** Function that handles `"keyup"` events. */
1082
1566
  onKeyUp?: (event: KeyboardEvent) => void;
1083
1567
  }
1084
1568
 
1085
1569
  /**
1086
- * Returns the items of a list value of a setting and a function to update it
1087
- * @param path The path of the settings file
1088
- * @param key The key of the setting
1089
- * @param defaultValue The default value of the setting
1090
- * @returns The items of a list value of a setting and a function to update it
1570
+ * A hook that initializes a ref lazily.
1571
+ * Ensures the initializer function is only called once during the initial mount.
1572
+ * @param create - A factory function that returns the initial value.
1573
+ */
1574
+ export declare function useLazyRef<T>(create: () => T): MutableRefObject<T>;
1575
+
1576
+ /**
1577
+ * Returns the items of a list value of a setting and a function to update it.
1578
+ * @param path - The path of the settings file.
1579
+ * @param key - The key of the setting.
1580
+ * @param defaultValue - The default value of the setting.
1581
+ * @returns The items of a list value of a setting and a function to update it.
1091
1582
  */
1092
1583
  export declare function useListSetting(path: SettingsPath, key: string, defaultValue?: string[]): [string[], (value: string | string[]) => void];
1093
1584
 
1585
+ export declare function useManualContextMenu(): {
1586
+ openContextMenu: (position: Vector2, Actions: FC<ActionsProps>, params?: object) => Modal;
1587
+ };
1588
+
1094
1589
  export declare function useModalsManager(): ModalsManagerState;
1095
1590
 
1096
1591
  /**
1097
- * Creates listeners for `"mousedown"`, `"mouseup"`, `"click"` and `"contextmenu"` events
1592
+ * Creates listeners for `"mousedown"`, `"mouseup"`, `"click"` and `"contextmenu"` events.
1098
1593
  */
1099
1594
  export declare function useMouseListener({ onMouseDown, onMouseUp, onClick, onContextMenu }: UseMouseListenerParams): void;
1100
1595
 
1101
1596
  export declare interface UseMouseListenerParams {
1102
- /** Function that handles `"mousedown"` events */
1103
- onMouseDown: EventListener;
1104
- /** Function that handles `"mouseup"` events */
1105
- onMouseUp: EventListener;
1106
- /** Function that handles `"click"` events */
1107
- onClick: EventListener;
1108
- /** Function that handles `"contextmenu"` events */
1109
- onContextMenu: EventListener;
1597
+ /** Function that handles `"mousedown"` events. */
1598
+ onMouseDown?: EventListener;
1599
+ /** Function that handles `"mouseup"` events. */
1600
+ onMouseUp?: EventListener;
1601
+ /** Function that handles `"click"` events. */
1602
+ onClick?: EventListener;
1603
+ /** Function that handles `"contextmenu"` events. */
1604
+ onContextMenu?: EventListener;
1110
1605
  }
1111
1606
 
1607
+ export declare const USERNAME = "user";
1608
+
1112
1609
  /**
1113
- * Returns the ideal orientation of an element so that it does not go outside of the screen
1610
+ * Returns the ideal orientation of an element so that it does not go outside of the screen.
1114
1611
  */
1115
1612
  export declare function useScreenBounds({ avoidTaskbar }: {
1116
- /** Whether to avoid the task bar */
1613
+ /** Whether to avoid the task bar. */
1117
1614
  avoidTaskbar: boolean;
1118
1615
  }): {
1119
- /** The React ref of the element */
1120
- ref: Ref<HTMLElement>;
1616
+ /** The React ref of the element. */
1617
+ ref: MutableRefObject<HTMLElement | null>;
1121
1618
  initiated: boolean;
1122
- /** Whether the element should align to the left (`true`) or right (`false`) */
1619
+ /** Whether the element should align to the left (`true`) or right (`false`). */
1123
1620
  alignLeft: boolean;
1124
- /** Whether the element should align to the top (`true`) or bottom (`false`) */
1621
+ /** Whether the element should align to the top (`true`) or bottom (`false`). */
1125
1622
  alignTop: boolean;
1126
1623
  };
1127
1624
 
1128
1625
  /**
1129
- * Returns the width and height of the element with ID "root"
1626
+ * Returns the width and height of the element with ID "root".
1130
1627
  */
1131
1628
  export declare function useScreenDimensions(): [screenWidth: number | null, screenHeight: number | null];
1132
1629
 
1133
- export declare function useScrollWithShadow(params: UseScrollWithShadowParams): {
1630
+ export declare function useScrollWithShadow<T extends HTMLElement = HTMLElement>(params?: UseScrollWithShadowParams<T>): {
1134
1631
  boxShadow: string;
1135
- onUpdate: (event: Event | {
1136
- target: HTMLElement;
1632
+ onUpdate: (event: UIEvent_2<T> | {
1633
+ target: T | null;
1137
1634
  }) => void;
1138
1635
  };
1139
1636
 
1140
- export declare interface UseScrollWithShadowParams {
1141
- ref?: MutableRefObject<HTMLElement>;
1637
+ export declare interface UseScrollWithShadowParams<T extends HTMLElement = HTMLElement> {
1638
+ ref?: RefObject<T | null>;
1142
1639
  horizontal?: boolean;
1143
1640
  dynamicOffset?: boolean;
1144
1641
  dynamicOffsetFactor?: number;
@@ -1156,40 +1653,77 @@ export declare interface UseScrollWithShadowParams {
1156
1653
  }
1157
1654
 
1158
1655
  /**
1159
- * Returns the value of a setting and a function to update it
1160
- * @param path The path of the settings file
1161
- * @param key The key of the setting
1162
- * @param defaultValue The default value of the setting
1163
- * @param parse A function that converts a string to a value
1164
- * @param stringify A function that converts a value to a string
1165
- * @returns The value of a setting and a function to update it
1656
+ * Returns the value of a setting and a function to update it.
1657
+ * @param path - The path of the settings file.
1658
+ * @param key - The key of the setting.
1659
+ * @param defaultValue - The default value of the setting.
1660
+ * @param parse - A function that converts a string to a value.
1661
+ * @param stringify - A function that converts a value to a string.
1662
+ * @returns The value of a setting and a function to update it.
1166
1663
  */
1167
1664
  export declare function useSetting<Type = string>(path: SettingsPath, key: string, defaultValue: Type, parse: (value: string) => Type, stringify?: (value: Type) => string): [Type, (value: Type | string) => void];
1168
1665
 
1169
1666
  export declare function useSettingsManager(): SettingsManagerState;
1170
1667
 
1171
1668
  /**
1172
- * Creates listeners for keyboard shortcuts
1669
+ * A hook that initializes and manages a Shell instance within a React component.
1670
+ * It gathers required system contexts and returns a reactive snapshot of the shell's state.
1671
+ * @param config - Configuration subset required to instantiate the shell.
1672
+ * @returns A tuple containing the stable {@link Shell} instance and its reactive {@link ShellState} snapshot.
1673
+ * @example
1674
+ * const sizeRef = useRef(Vector2.ZERO);
1675
+ * const [shell, state] = useShell({
1676
+ * app: myApp,
1677
+ * path: "~",
1678
+ * input: "echo \"Hello world!\"",
1679
+ * exit: () => closeWindow(),
1680
+ * sizeRef,
1681
+ * });
1173
1682
  */
1174
- export declare function useShortcuts({ options, shortcuts, useCategories }: UseShortcutsParams): void;
1683
+ export declare function useShell({ app, path, input, exit, sizeRef, }: Pick<ShellConfig, "app" | "path" | "input" | "exit" | "sizeRef">): [Shell, Snapshot<ShellState>];
1175
1684
 
1176
- export declare interface UseShortcutsParams {
1177
- options: Record<string, Record<string, (event: KeyboardEvent) => void>> | Record<string, (event: KeyboardEvent) => void>;
1178
- shortcuts?: Record<string, Record<string, string[]>> | Record<string, string[]>;
1179
- useCategories?: boolean;
1180
- }
1685
+ /**
1686
+ * Creates listeners for keyboard shortcuts.
1687
+ */
1688
+ export declare function useShortcuts(params: UseShortcutsParams): void;
1689
+
1690
+ export declare type UseShortcutsParams = {
1691
+ useCategories: true;
1692
+ options: CategorizedOptions;
1693
+ shortcuts?: CategorizedShortcuts;
1694
+ } | {
1695
+ useCategories?: false;
1696
+ options: FlatOptions;
1697
+ shortcuts?: FlatShortcuts;
1698
+ };
1181
1699
 
1182
1700
  /**
1183
- * Generates static class name using BEM notation
1701
+ * Returns a stable value that is instantiated only once.
1702
+ * Useful for classes or objects that should not be re-created on every render.
1703
+ * @param create - A factory function that returns the singleton instance.
1704
+ * @example
1705
+ * const systemManager = useSingleton(() => new SystemManager(systemManagerParams));
1706
+ */
1707
+ export declare function useSingleton<T>(create: () => T): T;
1708
+
1709
+ export declare function useSkin(): Skin;
1710
+
1711
+ /**
1712
+ * Generates static class name using BEM notation.
1713
+ * @param block - The name of the block.
1714
+ * @param element - The name of the element.
1715
+ * @param modifier - The name of the modifier(s).
1184
1716
  */
1185
1717
  export declare function useStaticClassName(block?: string, element?: string, modifier?: string | string[]): string | null;
1186
1718
 
1719
+ export declare function useStorage(): Storage_2;
1720
+
1187
1721
  /**
1188
- * Returns the value of a setting and a function to update it
1189
- * @param path The path of the settings file
1190
- * @param key The key of the setting
1191
- * @param defaultValue The default value of the setting
1192
- * @returns The value of a setting and a function to update it
1722
+ * Returns the value of a setting and a function to update it.
1723
+ * @param path - The path of the settings file.
1724
+ * @param key - The key of the setting.
1725
+ * @param defaultValue - The default value of the setting.
1726
+ * @returns The value of a setting and a function to update it.
1193
1727
  */
1194
1728
  export declare function useStringSetting(path: SettingsPath, key: string, defaultValue?: string | null): [string | null, (value: string | null) => void];
1195
1729
 
@@ -1214,52 +1748,34 @@ export declare interface UseZIndexParams {
1214
1748
 
1215
1749
  export { utilStyles }
1216
1750
 
1217
- export declare class Vector2 {
1218
- x: number;
1219
- y: number;
1220
- static get ZERO(): Vector2;
1221
- get clone(): Vector2;
1222
- constructor(x: number, y?: number);
1223
- round(): Vector2;
1224
- getDistance(x: number, y?: number): number;
1225
- getDistance(vector2: Vector2): number;
1226
- static add(vector2A: Vector2, vector2B: Vector2): Vector2;
1227
- static subtract(vector2A: Vector2, vector2B: Vector2): Vector2;
1228
- static scale(vector2: Vector2, scalar: number): Vector2;
1229
- static magnitude(vector2: Vector2): number;
1230
- static normalize(vector2: Vector2): Vector2;
1231
- static sqrDistance(vector2A: Vector2, vector2B: Vector2): number;
1232
- static lerp(vector2A: Vector2, vector2B: Vector2, t: number): Vector2;
1233
- }
1751
+ export { Vector2 }
1234
1752
 
1235
1753
  export declare const VIDEO_EXTENSIONS: string[];
1236
1754
 
1237
- declare class VirtualBase extends EventEmitter<EventNamesMap> {
1238
- /** The name of this item */
1755
+ export declare class VirtualBase<E extends VirtualBaseEvents = VirtualBaseEvents> extends EventEmitter<E & Record<keyof E, unknown[]>> {
1756
+ /** The name of this item. */
1239
1757
  name: string;
1240
- /** The alias of this item */
1758
+ /** The alias of this item. */
1241
1759
  alias: string | undefined | null;
1242
- /** The folder this item is in */
1760
+ /** The folder this item is in. */
1243
1761
  parent: VirtualFolder | undefined | null;
1244
- /** Whether this item is protected from changes */
1762
+ /** Whether this item is protected from changes. */
1245
1763
  isProtected: boolean | undefined | null;
1246
- /** The URL of the icon of this item */
1764
+ /** The URL of the icon of this item. */
1247
1765
  iconUrl: string | undefined | null;
1248
- /** The file this item links to */
1766
+ /** The file this item links to. */
1249
1767
  linkedFile: VirtualFile | undefined | null;
1250
- /** The folder this item links to */
1768
+ /** The folder this item links to. */
1251
1769
  linkedFolder: VirtualFolder | undefined | null;
1252
- /** Whether this item has been edited by the user */
1770
+ /** Whether this item has been edited by the user. */
1253
1771
  editedByUser: boolean | undefined | null;
1254
- /** Whether this item is the root folder */
1772
+ /** Whether this item is the root folder. */
1255
1773
  isRoot: boolean | undefined | null;
1256
- /** The root folder */
1774
+ /** The root folder. */
1257
1775
  root: VirtualRoot | undefined | null;
1258
- /** Whether this item has been deleted */
1776
+ /** Whether this item has been deleted. */
1259
1777
  isDeleted: boolean;
1260
- static EVENT_NAMES: {
1261
- update: string;
1262
- };
1778
+ static readonly UPDATE_EVENT = "update";
1263
1779
  constructor(name: string);
1264
1780
  get id(): string;
1265
1781
  setName(name: string): this;
@@ -1270,41 +1786,45 @@ declare class VirtualBase extends EventEmitter<EventNamesMap> {
1270
1786
  getIconUrl(): string;
1271
1787
  getType(): string;
1272
1788
  /**
1273
- * Tries to delete this item
1789
+ * Tries to delete this item.
1274
1790
  */
1275
1791
  delete(): void;
1276
1792
  confirmChanges(root?: VirtualRoot): void;
1277
1793
  /**
1278
- * Opens this item in the appropriate application
1794
+ * Opens this item in the appropriate application.
1279
1795
  */
1280
1796
  open(..._args: unknown[]): unknown;
1281
1797
  /**
1282
- * Returns the path of this item
1798
+ * Returns the path of this item.
1283
1799
  */
1284
1800
  get path(): string;
1285
1801
  /**
1286
- * Returns path without using this item's alias
1802
+ * Returns path without using this item's alias.
1287
1803
  */
1288
1804
  get displayPath(): string;
1289
1805
  /**
1290
- * Returns path without using any aliases
1806
+ * Returns path without using any aliases.
1291
1807
  */
1292
1808
  get absolutePath(): string;
1293
1809
  /**
1294
- * Returns whether this can be edited in its current state
1810
+ * Returns whether this can be edited in its current state.
1295
1811
  */
1296
1812
  get canBeEdited(): boolean;
1297
1813
  /**
1298
- * Returns the root folder
1814
+ * Returns the root folder.
1299
1815
  */
1300
1816
  getRoot(): VirtualRoot;
1301
- isFile(): boolean;
1302
- isFolder(): boolean;
1817
+ isFile(): this is VirtualFile;
1818
+ isFolder(): this is VirtualFolder;
1303
1819
  toJSON(): VirtualBaseJson | null;
1304
1820
  toString(): string | null;
1305
1821
  }
1306
1822
 
1307
- declare interface VirtualBaseJson {
1823
+ export declare interface VirtualBaseEvents {
1824
+ update: [];
1825
+ }
1826
+
1827
+ export declare interface VirtualBaseJson {
1308
1828
  nam: string;
1309
1829
  ico?: string;
1310
1830
  }
@@ -1317,36 +1837,55 @@ export declare class VirtualDriveConfig {
1317
1837
 
1318
1838
  export declare interface VirtualDriveConfigOptions {
1319
1839
  /**
1320
- * Enables persistent storage of the virtual drive
1321
- * @default true
1840
+ * Enables persistent storage of the virtual drive.
1841
+ * @default {
1842
+ enableCompression: true,
1843
+ prefix: "pos-"
1844
+ }
1322
1845
  */
1323
- saveData: boolean;
1846
+ saveData: false | {
1847
+ /**
1848
+ * Enables compression of stored items.
1849
+ * @default false
1850
+ */
1851
+ enableCompression: boolean;
1852
+ /**
1853
+ * The prefix to prepend to stored keys.
1854
+ * @default "pos-"
1855
+ */
1856
+ prefix?: string;
1857
+ /**
1858
+ * An array of tuples of old and new keys to migrate.
1859
+ * @default [["data", VirtualDriveStorage.KEY]]
1860
+ */
1861
+ migrations?: [string, string][];
1862
+ };
1324
1863
  /**
1325
- * Configure the data that is loaded initially when ProzillaOS is opened
1864
+ * Configure the data that is loaded initially when ProzillaOS is opened.
1326
1865
  */
1327
1866
  defaultData: {
1328
1867
  /**
1329
- * Include pictures folder in default data
1868
+ * Include pictures folder in default data.
1330
1869
  * @default true
1331
1870
  */
1332
1871
  includePicturesFolder?: boolean;
1333
1872
  /**
1334
- * Include documents folder in default data
1873
+ * Include documents folder in default data.
1335
1874
  * @default true
1336
1875
  */
1337
1876
  includeDocumentsFolder?: boolean;
1338
1877
  /**
1339
- * Include desktop folder in default data
1878
+ * Include desktop folder in default data.
1340
1879
  * @default true
1341
1880
  */
1342
1881
  includeDesktopFolder?: boolean;
1343
1882
  /**
1344
- * Include source tree folder in default data
1883
+ * Include source tree folder in default data.
1345
1884
  * @default true
1346
1885
  */
1347
1886
  includeSourceTree?: boolean;
1348
1887
  /**
1349
- * Include apps folder in default data
1888
+ * Include apps folder in default data.
1350
1889
  * @default true
1351
1890
  */
1352
1891
  includeAppsFolder?: boolean;
@@ -1354,29 +1893,35 @@ export declare interface VirtualDriveConfigOptions {
1354
1893
  };
1355
1894
  }
1356
1895
 
1896
+ export declare class VirtualDriveStorage extends Storage_2 {
1897
+ virtualDriveConfig: VirtualDriveConfig;
1898
+ static readonly KEY = "drive";
1899
+ constructor(virtualDriveConfig: VirtualDriveConfig);
1900
+ load(key: string): string | null;
1901
+ store(key: string, value: string): void;
1902
+ synchronize(): void;
1903
+ }
1904
+
1357
1905
  /**
1358
- * A virtual file that can be stored inside a folder
1906
+ * A virtual file that can be stored inside a folder.
1359
1907
  */
1360
- export declare class VirtualFile extends VirtualBase {
1361
- /** The extension of this file */
1908
+ export declare class VirtualFile extends VirtualBase<VirtualFileEvents> {
1909
+ /** The extension of this file. */
1362
1910
  extension: OptionalStringProperty;
1363
- /** The URL of the source of this file */
1911
+ /** The URL of the source of this file. */
1364
1912
  source: OptionalStringProperty;
1365
- /** The content of this file */
1913
+ /** The content of this file. */
1366
1914
  content: OptionalStringProperty;
1367
1915
  static NON_TEXT_EXTENSIONS: string[];
1368
- static EVENT_NAMES: {
1369
- update: string;
1370
- contentChange: string;
1371
- };
1916
+ static readonly CONTENT_CHANGE_EVENT = "contentChange";
1372
1917
  constructor(name: string, extension?: string);
1373
1918
  setAlias(alias: string): this;
1374
1919
  /**
1375
- * Sets the source of this file and removes the content
1920
+ * Sets the source of this file and removes the content.
1376
1921
  */
1377
1922
  setSource(source: string): this;
1378
1923
  /**
1379
- * Sets the content of this file and removes the source
1924
+ * Sets the content of this file and removes the source.
1380
1925
  */
1381
1926
  setContent(content: string | string[]): this;
1382
1927
  get id(): string;
@@ -1385,11 +1930,11 @@ export declare class VirtualFile extends VirtualBase {
1385
1930
  extension: OptionalStringProperty;
1386
1931
  };
1387
1932
  /**
1388
- * Opens this file in an app associated with its extension
1933
+ * Opens this file in an app associated with its extension.
1389
1934
  */
1390
1935
  open(windowsManager: WindowsManager): object | null;
1391
1936
  read(): Promise<OptionalStringProperty | undefined>;
1392
- isFile(): boolean;
1937
+ isFile(): this is VirtualFile;
1393
1938
  getIconUrl(): string;
1394
1939
  getType(): string;
1395
1940
  download(): void;
@@ -1398,6 +1943,10 @@ export declare class VirtualFile extends VirtualBase {
1398
1943
  static removeFileScheme(source: string): string;
1399
1944
  }
1400
1945
 
1946
+ export declare interface VirtualFileEvents extends VirtualBaseEvents {
1947
+ contentChange: [VirtualFile];
1948
+ }
1949
+
1401
1950
  export declare interface VirtualFileJson extends VirtualBaseJson {
1402
1951
  ext?: string;
1403
1952
  cnt?: string;
@@ -1405,12 +1954,12 @@ export declare interface VirtualFileJson extends VirtualBaseJson {
1405
1954
  }
1406
1955
 
1407
1956
  /**
1408
- * A link that points to a virtual file
1957
+ * A link that points to a virtual file.
1409
1958
  */
1410
1959
  export declare class VirtualFileLink extends VirtualFile {
1411
1960
  linkedPath?: string;
1412
1961
  constructor(name: string, linkedFile?: VirtualFile);
1413
- setLinkedFile(file: VirtualFile): VirtualFileLink;
1962
+ setLinkedFile(file: VirtualFile | null): VirtualFileLink;
1414
1963
  setLinkedPath(path: string): VirtualFileLink;
1415
1964
  isValid(): boolean;
1416
1965
  toJSON(): VirtualFileLinkJson | null;
@@ -1428,15 +1977,15 @@ export declare interface VirtualFileLinkJson extends VirtualFileJson {
1428
1977
  }
1429
1978
 
1430
1979
  /**
1431
- * A virtual folder that can contains files and sub-folders
1980
+ * A virtual folder that can contains files and sub-folders.
1432
1981
  */
1433
- export declare class VirtualFolder extends VirtualBase {
1434
- /** The folders inside this folder */
1982
+ export declare class VirtualFolder<E extends VirtualBaseEvents = VirtualBaseEvents> extends VirtualBase<E> {
1983
+ /** The folders inside this folder. */
1435
1984
  subFolders: (VirtualFolder | VirtualFolderLink)[];
1436
- /** The files inside this folder */
1985
+ /** The files inside this folder. */
1437
1986
  files: (VirtualFile | VirtualFileLink)[];
1438
1987
  /**
1439
- * The type of this folder
1988
+ * The type of this folder.
1440
1989
  * @default VirtualFolder.TYPE.general
1441
1990
  */
1442
1991
  type: number | undefined;
@@ -1447,90 +1996,94 @@ export declare class VirtualFolder extends VirtualBase {
1447
1996
  constructor(name: string, type?: number);
1448
1997
  setAlias(alias: string): this;
1449
1998
  /**
1450
- * Returns true if this folder contains a file matching a name and extension
1999
+ * Returns true if this folder contains a file matching a name and extension.
1451
2000
  */
1452
2001
  hasFile(name: string, extension?: string): boolean;
1453
2002
  /**
1454
- * Returns true if this folder contains a folder matching a name
2003
+ * Returns true if this folder contains a folder matching a name.
1455
2004
  */
1456
2005
  hasFolder(name: string): boolean;
1457
2006
  /**
1458
- * Finds and returns a file inside this folder matching a name and extension
2007
+ * Finds and returns a file inside this folder matching a name and extension.
1459
2008
  */
1460
2009
  findFile(name: string, extension?: string | null): VirtualFile | VirtualFileLink | null;
1461
2010
  /**
1462
- * Finds and returns a folder inside this folder matching a name
2011
+ * Finds and returns a folder inside this folder matching a name.
1463
2012
  */
1464
2013
  findSubFolder(name: string): VirtualFolder | VirtualFolderLink | null;
2014
+ addFile(file: VirtualFile, confirmChanges?: boolean): this;
1465
2015
  /**
1466
- * Creates a file with a name and extension
2016
+ * Creates a file with a name and extension.
1467
2017
  */
1468
2018
  createFile(name: string, extension?: string, callback?: (newFile: VirtualFile | VirtualFileLink) => void): this;
1469
2019
  /**
1470
- * Creates files based on an array of objects with file names and extensions
2020
+ * Creates files based on an array of objects with file names and extensions.
1471
2021
  */
1472
2022
  createFiles(files: {
1473
2023
  name: string;
1474
2024
  extension: string;
1475
2025
  }[]): this;
1476
2026
  /**
1477
- * Creates a file link with a name
2027
+ * Creates a file link with a name.
1478
2028
  */
1479
2029
  createFileLink(name: string, callback?: (newFileLink: VirtualFileLink | VirtualFile) => void): this;
1480
2030
  /**
1481
- * Creates file links based on an array of objects with file names and extensions
2031
+ * Creates file links based on an array of objects with file names and extensions.
1482
2032
  */
1483
2033
  createFileLinks(fileLinks: {
1484
2034
  name: string;
1485
2035
  }[]): this;
2036
+ addFolder(folder: VirtualFolder, confirmChanges?: boolean): this;
1486
2037
  /**
1487
- * Creates a folder with a name
2038
+ * Creates a folder with a name.
1488
2039
  */
1489
2040
  createFolder(name: string, callback?: (newFolder: VirtualFolder) => void): this;
1490
2041
  /**
1491
- * Creates folders based on an array of folder names
2042
+ * Creates folders based on an array of folder names.
1492
2043
  */
1493
2044
  createFolders(names: string[]): this;
1494
2045
  /**
1495
- * Creates a folder link with a name
2046
+ * Creates a folder link with a name.
1496
2047
  */
1497
2048
  createFolderLink(name: string, callback?: (newFolderLink: VirtualFolderLink | VirtualFolder) => void): this;
1498
2049
  /**
1499
- * Creates folder links based on an array of folder names
2050
+ * Creates folder links based on an array of folder names.
1500
2051
  */
1501
2052
  createFolderLinks(names: string[]): this;
1502
2053
  /**
1503
- * Removes a file or folder from this folder
2054
+ * Removes a file or folder from this folder.
1504
2055
  */
1505
2056
  remove(child: VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink): this;
1506
2057
  /**
1507
- * Returns the file or folder at a relative path or null if it doesn't exist
2058
+ * Returns the file or folder at a relative path or null if it doesn't exist.
1508
2059
  */
1509
2060
  navigate(relativePath: string): VirtualFile | VirtualFolder | null;
2061
+ navigateToFolder(relativePath: string): VirtualFolder | null;
2062
+ navigateToFile(relativePath: string): VirtualFile | null;
1510
2063
  /**
1511
- * Opens this folder in file explorer
2064
+ * Opens this folder in file explorer.
1512
2065
  */
1513
2066
  open(windowsManager: WindowsManager): object | null | undefined;
1514
2067
  /**
1515
- * Deletes this folder and all its files and sub-folders recursively
2068
+ * Deletes this folder and all its files and sub-folders recursively.
1516
2069
  */
1517
2070
  delete(): void;
1518
2071
  /**
1519
- * Returns all files inside this folder
1520
- * @param showHidden Whether to include hidden files
2072
+ * Returns all files inside this folder.
2073
+ * @param showHidden - Whether to include hidden files.
1521
2074
  */
1522
2075
  getFiles(showHidden?: boolean): VirtualFile[];
1523
2076
  /**
1524
- * Returns all sub-folders inside this folder
1525
- * @param showHidden Whether to include hidden folders
2077
+ * Returns all sub-folders inside this folder.
2078
+ * @param showHidden - Whether to include hidden folders.
1526
2079
  */
1527
2080
  getSubFolders(showHidden?: boolean): VirtualFolder[];
1528
2081
  /**
1529
- * Returns the amount of files and sub-folders inside this folder
1530
- * @param includeHidden Whether to include hidden files and folders in the count
2082
+ * Returns the amount of files and sub-folders inside this folder.
2083
+ * @param includeHidden - Whether to include hidden files and folders in the count.
1531
2084
  */
1532
2085
  getItemCount(includeHidden?: boolean): number;
1533
- isFolder(): boolean;
2086
+ isFolder(): this is VirtualFolder;
1534
2087
  getIconUrl(): string;
1535
2088
  toJSON(): VirtualFolderJson | null;
1536
2089
  }
@@ -1541,12 +2094,12 @@ export declare interface VirtualFolderJson extends VirtualBaseJson {
1541
2094
  }
1542
2095
 
1543
2096
  /**
1544
- * A link that points to a virtual folder
2097
+ * A link that points to a virtual folder.
1545
2098
  */
1546
2099
  export declare class VirtualFolderLink extends VirtualFolder {
1547
2100
  linkedPath?: string;
1548
2101
  constructor(name: string, linkedFolder?: VirtualFolder);
1549
- setLinkedFolder(folder: VirtualFolder): VirtualFolderLink;
2102
+ setLinkedFolder(folder: VirtualFolder | null): VirtualFolderLink;
1550
2103
  setLinkedPath(path: string): VirtualFolderLink;
1551
2104
  isValid(): boolean;
1552
2105
  getIconUrl(): string;
@@ -1571,35 +2124,33 @@ export declare interface VirtualFolderLinkJson extends VirtualFolderJson {
1571
2124
  }
1572
2125
 
1573
2126
  /**
1574
- * A virtual folder that serves as the root folder
2127
+ * A virtual folder that serves as the root folder.
1575
2128
  */
1576
- export declare class VirtualRoot extends VirtualFolder {
1577
- /** Aliases for files and folders */
2129
+ export declare class VirtualRoot extends VirtualFolder<VirtualRootEvents> {
2130
+ /** Aliases for files and folders. */
1578
2131
  shortcuts: Record<string, VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink>;
1579
2132
  initiated: boolean;
1580
2133
  loadedDefaultData: boolean;
1581
2134
  systemManager: SystemManager;
1582
- static EVENT_NAMES: {
1583
- update: string;
1584
- error: string;
1585
- };
2135
+ storage: VirtualDriveStorage;
2136
+ static readonly ERROR_EVENT = "error";
1586
2137
  constructor(systemManager: SystemManager);
1587
2138
  loadDefaultData(): void;
1588
2139
  loadData(): void;
1589
2140
  /**
1590
- * Calls the storage manager's store function with this root's data as a string
2141
+ * Calls the storage manager's store function with this root's data as a string.
1591
2142
  */
1592
2143
  saveData(): void;
1593
2144
  /**
1594
- * Initializes this root by loading the default data and then the user's data on top
2145
+ * Initializes this root by loading the default data and then the user's data on top.
1595
2146
  */
1596
2147
  init(): VirtualRoot;
1597
2148
  /**
1598
- * Adds a shortcut to a file or folder
2149
+ * Adds a shortcut to a file or folder.
1599
2150
  */
1600
2151
  addShortcut(name: string, destination: VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink): this;
1601
2152
  /**
1602
- * Tells the storage manager to clear all data and reloads the window
2153
+ * Tells the storage manager to clear all data and reloads the window.
1603
2154
  */
1604
2155
  reset(): void;
1605
2156
  static isValidName(_name: string): boolean;
@@ -1613,6 +2164,12 @@ export declare class VirtualRoot extends VirtualFolder {
1613
2164
 
1614
2165
  export declare const VirtualRootContext: Context<VirtualRootState>;
1615
2166
 
2167
+ export declare interface VirtualRootEvents extends VirtualBaseEvents {
2168
+ error: [{
2169
+ message: string;
2170
+ }];
2171
+ }
2172
+
1616
2173
  export declare interface VirtualRootJson extends VirtualFolderJson {
1617
2174
  scs: Record<string, string>;
1618
2175
  }
@@ -1620,29 +2177,31 @@ export declare interface VirtualRootJson extends VirtualFolderJson {
1620
2177
  export declare type VirtualRootState = VirtualRoot | undefined;
1621
2178
 
1622
2179
  /**
1623
- * Component that renders an external application inside an iframe
2180
+ * Component that renders an external application inside an iframe.
1624
2181
  */
1625
- export declare const WebView: FC<WebViewProps>;
2182
+ export declare const WebView: ForwardRefExoticComponent<Omit<WebViewProps, "ref"> & RefAttributes<HTMLIFrameElement>>;
1626
2183
 
1627
2184
  export declare interface WebViewProps extends WindowProps {
1628
- /** The URL of the external application */
2185
+ /** The URL of the external application. */
1629
2186
  source?: string;
1630
2187
  title?: string;
1631
2188
  }
1632
2189
 
2190
+ export declare const WELCOME_MESSAGE: string;
2191
+
1633
2192
  export declare function WindowedModal({ modal, params, children, ...props }: ModalProps): JSX_2.Element;
1634
2193
 
1635
2194
  export declare interface WindowOptions {
1636
- /** The ID of the window */
2195
+ /** The ID of the window. */
1637
2196
  id?: string;
1638
- /** The app associated with the window */
2197
+ /** The app associated with the window. */
1639
2198
  app?: App;
1640
2199
  /**
1641
- * The size of the window
2200
+ * The size of the window.
1642
2201
  * @default new Vector2(700, 400)
1643
2202
  */
1644
2203
  size?: Vector2;
1645
- /** The position of the window */
2204
+ /** The position of the window. */
1646
2205
  position?: Vector2;
1647
2206
  fullscreen?: boolean | string;
1648
2207
  options?: object;
@@ -1654,29 +2213,27 @@ export declare interface WindowOptions {
1654
2213
 
1655
2214
  export declare interface WindowProps extends WindowOptions {
1656
2215
  /**
1657
- * Whether to start the window in fullscreen mode
2216
+ * Whether to start the window in fullscreen mode.
1658
2217
  * @default false
1659
2218
  */
1660
2219
  fullscreen?: boolean;
1661
- /** Function that handles interactions with the window */
1662
- onInteract?: () => void;
1663
- /** Function that sets the title of the window */
2220
+ /** Function that sets the title of the window. */
1664
2221
  setTitle?: React.Dispatch<React.SetStateAction<string>>;
1665
- /** Function that sets the icon URL of the window */
2222
+ /** Function that sets the icon URL of the window. */
1666
2223
  setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
1667
- /** Function that closes the window */
1668
- close?: (event?: Event) => void;
1669
- /** Function that brings the window in focus */
1670
- focus?: (event: Event, force?: boolean) => void;
1671
- /** Whether the window is currently focused and should allow interactions */
2224
+ /** Function that closes the window. */
2225
+ close?: (event?: Event | React.UIEvent<HTMLElement>) => void;
2226
+ /** Function that brings the window in focus. */
2227
+ focus?: (event?: Event | React.UIEvent<HTMLElement>, force?: boolean) => void;
2228
+ /** Whether the window is currently focused and should allow interactions. */
1672
2229
  active?: boolean;
1673
- /** Whether to start the window in minimized mode */
2230
+ /** Whether to start the window in minimized mode. */
1674
2231
  minimized?: boolean;
1675
- /** Function that toggles the minimized mode of the window */
2232
+ /** Function that toggles the minimized mode of the window. */
1676
2233
  toggleMinimized?: (event?: Event) => void;
1677
- /** The depth value of the window */
2234
+ /** The depth value of the window. */
1678
2235
  index?: number;
1679
- /** Whether the window is in standalone mode */
2236
+ /** Whether the window is in standalone mode. */
1680
2237
  standalone?: boolean;
1681
2238
  }
1682
2239
 
@@ -1689,75 +2246,76 @@ export declare class WindowsConfig {
1689
2246
 
1690
2247
  export declare interface WindowsConfigOptions {
1691
2248
  /**
1692
- * The margin around windows that are not maximized, in pixels
2249
+ * The margin around windows that are not maximized, in pixels.
1693
2250
  * @default 32
1694
2251
  */
1695
2252
  screenMargin: number;
1696
2253
  /**
1697
- * The separator to use in window titles
2254
+ * The separator to use in window titles.
1698
2255
  * @default "-"
1699
2256
  */
1700
2257
  titleSeparator: string;
1701
2258
  /**
1702
- * If the user's screen is smaller than these values, windows will always be maximized
2259
+ * If the user's screen is smaller than these values, windows will always be maximized.
1703
2260
  * @default new Vector2(350, 350)
1704
2261
  */
1705
2262
  minScreenSize: Vector2;
1706
2263
  }
1707
2264
 
1708
2265
  /**
1709
- * Manages the states of windows
2266
+ * Manages the states of windows.
1710
2267
  */
1711
2268
  export declare class WindowsManager {
1712
2269
  #private;
1713
2270
  windows: {
1714
2271
  [id: string]: WindowOptions;
1715
2272
  };
1716
- /** Function that handles changes to the open windows */
2273
+ /** Function that handles changes to the open windows. */
1717
2274
  updateWindows: (window: WindowsManager["windows"]) => void;
1718
2275
  startupComplete: boolean;
1719
2276
  constructor(systemManager: SystemManager, trackingManager: TrackingManager);
1720
2277
  /**
1721
- * Opens a window for an application
1722
- * @param appId The ID of the app
2278
+ * Opens a window for an application.
2279
+ * @param appId - The ID of the app.
1723
2280
  */
1724
2281
  open(appId: string, options?: WindowOptions | null): object | null;
1725
2282
  /**
1726
- * Opens a file with the associated app or by a method specified by the file scheme
1727
- * @returns Opened window
2283
+ * Opens a file with the associated app or by a method specified by the file scheme.
2284
+ * @returns Opened window.
1728
2285
  */
1729
2286
  openFile(file: VirtualFile, options?: object): object | null;
1730
2287
  /**
1731
- * Close a window
2288
+ * Close a window.
1732
2289
  */
1733
2290
  close(windowId: string): void;
1734
2291
  /**
1735
- * Focus on a specific window
2292
+ * Focus on a specific window.
1736
2293
  */
1737
2294
  focus(windowId: string): void;
1738
2295
  /**
1739
- * Check whether a window is focused
2296
+ * Check whether a window is focused.
1740
2297
  */
1741
2298
  isFocused(windowId: string): boolean | undefined;
1742
2299
  /**
1743
- * Check if any window is focused
2300
+ * Check if any window is focused.
1744
2301
  */
1745
2302
  isAnyFocused(): boolean;
1746
2303
  /**
1747
- * Change the minimized state of a window
1748
- * @param minimized - Leave as undefined to toggle the window's minimization state
2304
+ * Change the minimized state of a window.
2305
+ * @param windowId - The ID of the window.
2306
+ * @param minimized - Leave as undefined to toggle the window's minimization state.
1749
2307
  */
1750
2308
  setMinimized(windowId: string, minimized?: boolean): void;
1751
2309
  /**
1752
- * Minimize all windows
2310
+ * Minimize all windows.
1753
2311
  */
1754
2312
  minimizeAll(): void;
1755
2313
  /**
1756
- * Check if an app has an open window
2314
+ * Check if an app has an open window.
1757
2315
  */
1758
2316
  isAppActive(appId: string): boolean;
1759
2317
  /**
1760
- * Get an opened window of a certain app
2318
+ * Get an opened window of a certain app.
1761
2319
  */
1762
2320
  getAppWindowId(appId: string): string | null;
1763
2321
  setUpdateWindows(updateWindows: WindowsManager["updateWindows"]): void;
@@ -1770,17 +2328,17 @@ export declare const WindowsManagerContext: Context<WindowsManagerState>;
1770
2328
  export declare type WindowsManagerState = WindowsManager | undefined;
1771
2329
 
1772
2330
  /**
1773
- * Component that renders the windows for all currently active applications
2331
+ * Component that renders the windows for all currently active applications.
1774
2332
  */
1775
2333
  export declare const WindowsView: FC;
1776
2334
 
1777
2335
  /**
1778
- * Component that renders the window for an application
2336
+ * Component that renders the window for an application.
1779
2337
  */
1780
2338
  export declare const WindowView: FC<WindowProps>;
1781
2339
 
1782
2340
  /**
1783
- * Represents a group of HTML elements whose z-index is automatically calculated based on a given order
2341
+ * Represents a group of HTML elements whose z-index is automatically calculated based on a given order.
1784
2342
  */
1785
2343
  export declare class ZIndexGroup {
1786
2344
  length: number;
@@ -1794,23 +2352,21 @@ export declare class ZIndexGroup {
1794
2352
  getIndex(index: number): number;
1795
2353
  }
1796
2354
 
1797
- export declare class ZIndexManager extends EventEmitter<typeof ZIndexManagerEvents> {
2355
+ export declare class ZIndexManager extends EventEmitter<ZIndexManagerEvents> {
1798
2356
  static GROUPS: {
1799
2357
  WINDOWS: number;
1800
2358
  TASKBAR: number;
1801
2359
  MODALS: number;
1802
2360
  };
1803
- static EVENT_NAMES: {
1804
- readonly indexChange: "indexChange";
1805
- };
2361
+ static readonly INDEX_CHANGE_EVENT = "indexChange";
1806
2362
  groups: ZIndexGroup[];
1807
2363
  constructor();
1808
2364
  update(): void;
1809
2365
  getIndex(groupIndex: number, index: number): number;
1810
2366
  }
1811
2367
 
1812
- declare const ZIndexManagerEvents: {
1813
- readonly indexChange: "indexChange";
1814
- };
2368
+ export declare interface ZIndexManagerEvents {
2369
+ indexChange: [];
2370
+ }
1815
2371
 
1816
2372
  export { }