prozilla-os 1.3.15 → 1.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -1,1965 +1,10 @@
1
- import { Context } from 'react';
2
- import { Dispatch } from 'react';
3
- import { EventEmitter as EventEmitter_2 } from '@prozilla-os/shared';
4
- import { FC } from 'react';
5
- import { HTMLAttributeAnchorTarget } from 'react';
6
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
7
- import { JSX as JSX_2 } from 'react/jsx-runtime';
8
- import { MemoExoticComponent } from 'react';
9
- import { MouseEvent as MouseEvent_2 } from 'react';
10
- import { MutableRefObject } from 'react';
11
- import { NamedExoticComponent } from 'react';
12
- import { ReactElement } from 'react';
13
- import { ReactNode } from 'react';
14
- import { Ref } from 'react';
15
- import { SetStateAction } from 'react';
16
- import { UaEventOptions } from 'react-ga4/types/ga4';
17
- import { default as utilStyles } from './utils.module.css';
18
-
19
- export declare interface ActionProps {
20
- /** ID of the action */
21
- actionId?: string;
22
- /** Label of the action */
23
- label?: string;
24
- /** Icon for the action */
25
- icon?: string | object;
26
- /** Keyboard shortcut for the action */
27
- shortcut?: string[];
28
- /** Function that handles the trigger event for the action */
29
- onTrigger?: (event?: Event, triggerParams?: unknown, ...args: unknown[]) => void;
30
- children?: ReactNode;
31
- /** Whether the action should be disabled */
32
- disabled?: boolean;
33
- }
34
-
35
- /**
36
- * Component that renders a collection of actions (e.g., as a context menu or a header menu) and handles keyboard shortcuts
37
- * @example
38
- * <ClickAction
39
- * label="Reload"
40
- * shortcut={["Control", "r"]}
41
- * icon={faArrowsRotate}
42
- * onTrigger={() => {
43
- * reloadViewport();
44
- * }}
45
- * />
46
- */
47
- export declare function Actions({ children, mode, className, onAnyTrigger, triggerParams, avoidTaskbar }: ActionsProps): ReactElement;
48
-
49
- export declare interface ActionsProps {
50
- mode?: string;
51
- /** `className` prop for the container */
52
- className?: string;
53
- /** Function that handles the trigger event for all actions */
54
- onAnyTrigger?: (event: Event, triggerParams: unknown, ...args: unknown[]) => void;
55
- children?: ReactNode;
56
- /** The parameters to pass whenever an action is triggered */
57
- triggerParams?: unknown;
58
- /** Whether the actions should automatically orient themselves to not overlap with the taskbar */
59
- avoidTaskbar?: boolean;
60
- [key: string]: unknown;
61
- }
62
-
63
- export declare interface AlertParams {
64
- /**
65
- * The title of the alert
66
- * @default "Alert"
67
- */
68
- title: string;
69
- /** The body of the alert */
70
- text: string;
71
- /** The URL of the icon of the alert */
72
- iconUrl?: string;
73
- /**
74
- * The size of the alert modal
75
- * @default new Vector2(300, 150)
76
- */
77
- size?: Vector2;
78
- single?: boolean;
79
- }
80
-
81
- /**
82
- * An application that can be ran by ProzillaOS
83
- * Applications can be installed by adding them to the `apps` array in {@link AppsConfig}
84
- */
85
- export declare class App<AppProps extends WindowProps = WindowProps> {
86
- /**
87
- * The display name of this application
88
- */
89
- name: string;
90
- /**
91
- * The unique ID of this application
92
- */
93
- id: string;
94
- /**
95
- * Main component that renders this app inside a window
96
- */
97
- windowContent: FC<AppProps>;
98
- /**
99
- * Default options that get passed to the {@link App.windowContent} component
100
- */
101
- windowOptions?: Partial<AppProps> & DefaultWindowOptions;
102
- /**
103
- * Description of this application
104
- */
105
- description: string | null;
106
- /**
107
- * URL of the icon of this application
108
- */
109
- iconUrl: string | null;
110
- /**
111
- * Defines what the app can handle and how it can be used elsewhere in the system
112
- */
113
- role: string | null;
114
- /**
115
- * An array of file extensions that this application can interpret
116
- */
117
- associatedExtensions: string[];
118
- /**
119
- * Determines whether the app is pinned by default
120
- * @default true
121
- */
122
- pinnedByDefault: boolean;
123
- /**
124
- * Determines whether the app is launched at startup
125
- * @default false
126
- */
127
- launchAtStartup: boolean;
128
- /**
129
- * The category the app belongs to
130
- */
131
- category: typeof APP_CATEGORIES[number] | null;
132
- /**
133
- * Metadata of the app's package
134
- */
135
- metadata: AppMetadata | null;
136
- /**
137
- * Determines whether a desktop icon is added to the default data
138
- * @default false
139
- */
140
- showDesktopIcon: boolean;
141
- isActive: boolean;
142
- isPinned?: boolean;
143
- isInstalled: boolean;
144
- constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: Partial<AppProps> & DefaultWindowOptions);
145
- /**
146
- * Returns the component that renders the content of a window for this app
147
- */
148
- WindowContent: (props: AppProps) => JSX_2.Element | null;
149
- /**
150
- * Sets the display name of this application
151
- */
152
- setName(name: string): this;
153
- /**
154
- * Sets the description of this application
155
- */
156
- setDescription(description: App["description"]): this;
157
- /**
158
- * Sets the URL of the icon of this application
159
- */
160
- setIconUrl(iconUrl: App["iconUrl"]): this;
161
- /**
162
- * Sets the role of this application
163
- */
164
- setRole(role: string | null): this;
165
- /**
166
- * Sets the associated extensions of this application
167
- */
168
- setAssociatedExtensions(extensions: string[] | null): this;
169
- /**
170
- * Changes whether this application is pinned by default or not
171
- */
172
- setPinnedByDefault(pinnedByDefault: boolean): this;
173
- /**
174
- * Changes whether this application is launched at startup or not
175
- */
176
- setLaunchAtStartup(launchAtStartup: boolean): this;
177
- /**
178
- * Changes whether this application is installed by default or not
179
- */
180
- setInstalled(installed: boolean): this;
181
- /**
182
- * Sets the category this application belongs to
183
- */
184
- setCategory(category: typeof APP_CATEGORIES[number] | null): this;
185
- /**
186
- * Sets the metadata for this application
187
- */
188
- setMetadata(metadata: AppMetadata | null): this;
189
- /**
190
- * Changes whether this application has a desktop icon in the default data
191
- */
192
- setShowDesktopIcon(showDesktopIcon: boolean): this;
193
- /**
194
- * Sets the default options for the {@link App.windowContent} component
195
- */
196
- setWindowOptions(windowOptions: Partial<AppProps> & DefaultWindowOptions): this;
197
- }
198
-
199
- export declare const APP_CATEGORIES: readonly ["Business", "Developer tools", "Education", "Entertainment", "Food & dining", "Health & fitness", "Kids & family", "Lifestyle", "Media", "Medical", "Multimedia design", "Music", "Navigation & maps", "News & weather", "Personal finance", "Personalization", "Photo & video", "Productivity", "Security", "Shopping", "Social", "Sports", "Travel", "Utilities & tools"];
200
-
201
- export declare const appCenter: App<WindowProps>;
202
-
203
- export declare interface AppMetadata {
204
- name: string;
205
- version: `${number}.${number}.${number}`;
206
- author: string;
207
- }
208
-
209
- export declare class AppsConfig {
210
- apps: AppsConfigOptions["apps"];
211
- static APP_ROLES: {
212
- fileExplorer: string;
213
- terminal: string;
214
- textEditor: string;
215
- settings: string;
216
- mediaViewer: string;
217
- browser: string;
218
- };
219
- constructor(options?: Partial<AppsConfigOptions>);
220
- get installedApps(): App<WindowProps>[];
221
- /**
222
- * @param includeUninstalled Include apps that are not currently installed
223
- */
224
- getAppById(id: string, includeUninstalled?: boolean): App | null;
225
- /**
226
- * Get the app associated with a file extension
227
- */
228
- getAppByFileExtension(fileExtension: string): App | null;
229
- /**
230
- * Get the app with a specific role
231
- */
232
- getAppByRole(role: string): App | null;
233
- /**
234
- * Get all applications (including uninstalled apps) that belong to a category
235
- */
236
- getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
237
- }
238
-
239
- export declare interface AppsConfigOptions {
240
- /**
241
- * An array of applications
242
- */
243
- apps: App<WindowProps>[];
244
- }
245
-
246
- export declare const AUDIO_EXTENSIONS: string[];
247
-
248
- export declare const browser: App<BrowserProps>;
249
-
250
- declare interface BrowserProps extends WindowProps {
251
- url?: string;
252
- }
253
-
254
- export declare function Button({ className, href, children, icon, target, ...props }: ButtonProps): JSX_2.Element;
255
-
256
- export declare interface ButtonProps {
257
- className?: string;
258
- href?: string;
259
- icon?: IconProp;
260
- target?: HTMLAttributeAnchorTarget;
261
- children?: ReactNode;
262
- [key: string]: unknown;
263
- }
264
-
265
- export declare const calculator: App<WindowProps>;
266
-
267
- export declare const ClickAction: MemoExoticComponent<({ actionId, label, shortcut, disabled, onTrigger, icon }: ClickActionProps) => JSX_2.Element>;
268
-
269
- export declare interface ClickActionProps extends ActionProps {
270
- icon?: string | object;
271
- }
272
-
273
- /**
274
- * Simulates closing the viewport by opening a blank page
275
- * @param name - Name of the app
276
- */
277
- export declare function closeViewport(requireConfirmation: boolean | undefined, name: string): void;
278
-
279
- export declare const CODE_EXTENSIONS: string[];
280
-
281
- export declare class Command {
282
- #private;
283
- options: Option_2[];
284
- manual?: Manual;
285
- requireArgs?: boolean;
286
- requireOptions?: boolean;
287
- execute: Execute;
288
- setName(name?: string): Command;
289
- get name(): string;
290
- setExecute(execute: Execute): Command;
291
- setRequireArgs(value: boolean): Command;
292
- setRequireOptions(value: boolean): Command;
293
- setManual({ purpose, usage, description, options }: Manual): Command;
294
- addOption({ short, long, isInput }: Option_2): Command;
295
- getOption(key: string): Option_2 | null;
296
- }
297
-
298
- export declare type CommandResponse = string | {
299
- blank: boolean;
300
- } | void | Stream;
301
-
302
- export declare class CommandsManager {
303
- static COMMANDS: Command[];
304
- static addCommand(command: Command): void;
305
- static find(name: string): Command | null;
306
- static search(pattern: string): Command[];
307
- static reload(): void;
308
- }
309
-
310
- export declare function copyToClipboard(string: string, onSuccess?: (value: void) => void, onFail?: (value: void) => void): void;
311
-
312
- export declare function DefaultRoute(): JSX_2.Element;
313
-
314
- export declare interface DefaultWindowOptions {
315
- size?: Vector2;
316
- [key: string]: unknown;
317
- }
318
-
319
- /**
320
- * Component that renders the wallpaper and desktop icons
321
- */
322
- export declare const Desktop: MemoExoticComponent<() => JSX_2.Element>;
323
-
324
- export declare class DesktopConfig {
325
- defaultIconSize: DesktopConfigOptions["defaultIconSize"];
326
- defaultIconDirection: DesktopConfigOptions["defaultIconDirection"];
327
- constructor(options?: Partial<DesktopConfigOptions>);
328
- }
329
-
330
- export declare interface DesktopConfigOptions {
331
- /**
332
- * The default size of the icons
333
- * @default 1
334
- */
335
- defaultIconSize: 0 | 1 | 2;
336
- /**
337
- * The defailt direction of the icons
338
- * 0: vertical, 1: horizontal
339
- * @default 0
340
- * */
341
- defaultIconDirection: 0 | 1;
342
- }
343
-
344
- export declare function DialogBox({ modal, params, children, ...props }: ModalProps): JSX_2.Element;
345
-
346
- /**
347
- * Component that displays the contents of a directory
348
- */
349
- export declare function DirectoryList({ directory, showHidden, folderClassName, fileClassName, className, onContextMenuFile, onContextMenuFolder, onOpenFile, onOpenFolder, allowMultiSelect, onSelectionChange, ...props }: DirectoryListProps): ReactElement | null;
350
-
351
- export declare interface DirectoryListProps {
352
- /** The directory to display */
353
- directory: VirtualFolder;
354
- /** Whether to show hidden files and folders */
355
- showHidden?: boolean;
356
- /** `className` prop for folders */
357
- folderClassName?: string;
358
- /** `className` prop for files */
359
- fileClassName?: string;
360
- /** `className` prop for this component */
361
- className?: string;
362
- /** Function that handles context menu interactions on files */
363
- onContextMenuFile?: FileEventHandler;
364
- /** Function that handles context menu interactions on folders */
365
- onContextMenuFolder?: FolderEventHandler;
366
- /** Function that handles file opening events */
367
- onOpenFile?: FileEventHandler;
368
- /** Function that handles folder opening events */
369
- onOpenFolder?: FolderEventHandler;
370
- /** Whether to allow multiple files and folders to be selected at the same time */
371
- allowMultiSelect?: boolean;
372
- /** Function that handles selection changes */
373
- onSelectionChange?: (params: OnSelectionChangeParams) => void;
374
- [key: string]: unknown;
375
- }
376
-
377
- export declare function Divider(): JSX_2.Element;
378
-
379
- export declare function downloadUrl(url: string, name: string): void;
380
-
381
- export declare function DropdownAction({ label, icon, children, showOnHover }: DropdownActionProps): ReactElement;
382
-
383
- export declare interface DropdownActionProps extends ActionProps {
384
- showOnHover?: boolean;
385
- }
386
-
387
- /**
388
- * Component that opens a dropdown menu
389
- */
390
- export declare function DropdownButton({ label, options, shortcuts }: DropdownButtonProps): JSX_2.Element;
391
-
392
- export declare interface DropdownButtonProps {
393
- /** The label of the button */
394
- label: string;
395
- /** The options in the dropdown menu mapped to the function that handles their selection */
396
- options: Record<string, () => void>;
397
- /** The keyboard shortcut for options in the dropdown menu */
398
- shortcuts: Record<string, string[]>;
399
- }
400
-
401
- declare class EventEmitter<EventMap extends EventNamesMap> {
402
- #private;
403
- static EVENT_NAMES: EventNamesMap;
404
- /**
405
- * Add event listener for an event
406
- */
407
- on<Key extends keyof EventMap>(eventName: Key, callback: Listener): Listener;
408
- /**
409
- * Remove event listener for an event
410
- */
411
- off<Key extends keyof EventMap>(eventName: Key, callback: Listener): void;
412
- /**
413
- * Dispatch event
414
- */
415
- emit<Key extends keyof EventMap>(eventName: Key, data?: unknown): void;
416
- }
417
-
418
- declare type EventNamesMap = Record<string, string>;
419
-
420
- declare type Execute = (args?: string[], params?: ExecuteParams) => CommandResponse | Promise<CommandResponse>;
421
-
422
- export declare type ExecuteParams = {
423
- promptOutput?: (text: string) => void;
424
- pushHistory?: (entry: HistoryEntry) => void;
425
- virtualRoot?: VirtualRoot;
426
- currentDirectory: VirtualFolder;
427
- setCurrentDirectory?: Dispatch<SetStateAction<VirtualFolder>>;
428
- username?: string;
429
- hostname?: string;
430
- rawInputValue?: string;
431
- options?: string[];
432
- exit?: () => void;
433
- inputs?: Record<string, string>;
434
- timestamp: number;
435
- settingsManager: SettingsManager;
436
- systemManager: SystemManager;
437
- app: App;
438
- };
439
-
440
- export declare const FILE_SCHEMES: {
441
- external: string;
442
- app: string;
443
- };
444
-
445
- export declare type FileEventHandler = (event: Event, file: VirtualFile) => void;
446
-
447
- export declare const fileExplorer: App<FileExplorerProps>;
448
-
449
- declare interface FileExplorerProps extends WindowProps {
450
- path?: string;
451
- selectorMode?: number;
452
- Footer?: FC;
453
- onSelectionChange?: (params: OnSelectionChangeParams) => void;
454
- onSelectionFinish?: () => void;
455
- }
456
-
457
- export declare enum FileSelectorMode {
458
- None = 0,
459
- Single = 1,
460
- Multi = 2
461
- }
462
-
463
- export declare type FolderEventHandler = (event: Event, folder: VirtualFolder) => void;
464
-
465
- /**
466
- * Formats a shortcut (combination of keys) into a human-readable format.
467
- *
468
- * 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>
469
- */
470
- export declare function formatShortcut(shortcut: string[]): string;
471
-
472
- export declare function generateUrl(options: GenerateUrlParams): string;
473
-
474
- export declare interface GenerateUrlParams {
475
- appId?: string;
476
- fullscreen?: boolean;
477
- standalone?: boolean;
478
- }
479
-
480
- export declare function getViewportParams(): Record<string, string>;
481
-
482
- /**
483
- * Component that shows a header menu at the top of a window
484
- */
485
- export declare function HeaderMenu({ children, ...props }: ActionsProps): JSX_2.Element;
486
-
487
- declare interface HistoryEntry {
488
- text?: string;
489
- isInput: boolean;
490
- value?: string;
491
- clear?: boolean;
492
- }
493
-
494
- declare function Image_2({ className, src, ...props }: ImageProps): JSX_2.Element;
495
- export { Image_2 as Image }
496
-
497
- export declare const IMAGE_EXTENSIONS: string[];
498
-
499
- export declare function ImagePreview({ source, className, onError, ...props }: ImagePreviewProps): JSX_2.Element;
500
-
501
- export declare interface ImagePreviewProps {
502
- source: string;
503
- className?: string;
504
- onError?: () => void;
505
- }
506
-
507
- export declare interface ImageProps {
508
- className?: string;
509
- src?: string;
510
- [key: string]: unknown;
511
- }
512
-
513
- /**
514
- * Button component that handles single and double clicks
515
- */
516
- export declare function Interactable({ onClick, onDoubleClick, children, ...props }: InteractableProps): JSX_2.Element;
517
-
518
- export declare interface InteractableProps {
519
- /** Function that handles single clicks */
520
- onClick?: (event: MouseEvent) => void;
521
- /** Function that handles double clicks */
522
- onDoubleClick?: (event: MouseEvent) => void;
523
- children: ReactNode;
524
- [key: string]: unknown;
525
- }
526
-
527
- export declare function isValidUrl(string: string): boolean;
528
-
529
- declare type Listener = (data: unknown) => void;
530
-
531
- declare type Manual = {
532
- purpose?: string;
533
- usage?: string;
534
- description?: string;
535
- options?: object;
536
- };
537
-
538
- export declare const MEDIA_EXTENSIONS: string[];
539
-
540
- export declare const mediaViewer: App<MediaViewerProps>;
541
-
542
- declare interface MediaViewerProps extends WindowProps {
543
- file?: VirtualFile;
544
- }
545
-
546
- export declare class MiscConfig {
547
- doubleClickDelay: MiscConfigOptions["doubleClickDelay"];
548
- constructor(options?: Partial<MiscConfigOptions>);
549
- }
550
-
551
- export declare interface MiscConfigOptions {
552
- /**
553
- * The maximum time between two clicks to register as a double click (in ms)
554
- * @default 250
555
- * */
556
- doubleClickDelay: number;
557
- }
558
-
559
- /**
560
- * Represents a modal window
561
- */
562
- export declare class Modal {
563
- /**
564
- * The size of this modal
565
- * @default new Vector2(400, 200)
566
- */
567
- size: Vector2;
568
- /**
569
- * The position of this modal
570
- * @default new Vector2(300, 300)
571
- */
572
- position: Vector2;
573
- /**
574
- * The icon of this modal
575
- * @default null
576
- */
577
- icon: string | null;
578
- /**
579
- * The title of this modal
580
- * @default null
581
- */
582
- title: string | null;
583
- /**
584
- * The manager that handles all modals
585
- */
586
- modalsManager: ModalsManager | null;
587
- /**
588
- * The content of this modal
589
- * @default null
590
- */
591
- element: FC<ModalProps> | null;
592
- props: object;
593
- callback: ((...args: unknown[]) => void) | null;
594
- /** The ID of this modal */
595
- id: number | null;
596
- /**
597
- * Whether this modal can be dismissed (e.g., by pressing ESC)
598
- * @default true
599
- */
600
- dismissible: boolean;
601
- /** Timestamp of the most recent interaction with this modal */
602
- lastInteraction?: number;
603
- constructor(element: Modal["element"], callback?: Modal["callback"]);
604
- setIcon(icon: string): Modal;
605
- setTitle(title: string): Modal;
606
- setPosition(position: Vector2): Modal;
607
- setSize(size: Vector2): Modal;
608
- setProps(props: object): Modal;
609
- /**
610
- * @param {boolean} dismissible
611
- * @returns {Modal}
612
- */
613
- setDismissible(dismissible: boolean): Modal;
614
- focus(): void;
615
- finish(...args: unknown[]): void;
616
- close(): void;
617
- }
618
-
619
- export declare interface ModalProps {
620
- /** */
621
- modal?: Modal;
622
- params?: {
623
- appId?: string;
624
- fullscreen?: boolean;
625
- iconUrl?: string;
626
- title?: string;
627
- standalone?: boolean;
628
- [key: string]: unknown;
629
- };
630
- children?: ReactNode;
631
- onFinish?: () => void;
632
- [key: string]: unknown;
633
- }
634
-
635
- export declare class ModalsConfig {
636
- defaultDialogSize: ModalsConfigOptions["defaultDialogSize"];
637
- defaultFileSelectorSize: ModalsConfigOptions["defaultFileSelectorSize"];
638
- static DIALOG_CONTENT_TYPES: {
639
- closeButton: number;
640
- };
641
- constructor(options?: Partial<ModalsConfigOptions>);
642
- }
643
-
644
- export declare interface ModalsConfigOptions {
645
- /**
646
- * Default size of a dialog box
647
- * @default new Vector2(400, 200)
648
- */
649
- defaultDialogSize: Vector2;
650
- /**
651
- * Default size of a file selector
652
- * @default new Vector2(700, 400)
653
- */
654
- defaultFileSelectorSize: Vector2;
655
- }
656
-
657
- /**
658
- * Manages the opening, closing and ordering of modals
659
- */
660
- export declare class ModalsManager {
661
- /** Maps every modal ID to the corresponding modal */
662
- modals: Record<string, Modal>;
663
- containerRef?: MutableRefObject<HTMLElement>;
664
- /** Function that handles changes to modals */
665
- updateModals: (modals: ModalsManager["modals"]) => void;
666
- /**
667
- * Opens a modal
668
- * @param single - Set to false to preserve other open modals
669
- */
670
- open(modal: Modal, single?: boolean): void;
671
- /**
672
- * Closes a modal
673
- * @param modalId The ID of the modal to close
674
- */
675
- close(modalId: string | number, sendModalsUpdate?: boolean): void;
676
- /**
677
- * Brings a modal into focus
678
- * @param modalId The ID of the modal to bring into focus
679
- */
680
- focus(modalId: string): void;
681
- setUpdateModals(updateModals: ModalsManager["updateModals"]): void;
682
- /**
683
- * Returns the IDs of all open modals
684
- */
685
- get modalIds(): string[];
686
- static getModalIconUrl(name: string): string;
687
- }
688
-
689
- export declare const modalsManagerContext: Context<ModalsManagerState>;
690
-
691
- export declare type ModalsManagerState = ModalsManager | undefined;
692
-
693
- /**
694
- * Component that renders all active modals
695
- */
696
- export declare const ModalsView: MemoExoticComponent<() => JSX_2.Element>;
697
-
698
- export declare function NoRoute(): JSX_2.Element;
699
-
700
- export declare interface NoRouteProps {
701
- /**
702
- * Title of the route
703
- * @default "404: Not Found"
704
- */
705
- title: string;
706
- }
707
-
708
- export declare interface OnSelectionChangeParams {
709
- /** The selected files */
710
- files?: string[];
711
- /** The selected folders */
712
- folders?: string[];
713
- /** The directory the selection was made in */
714
- directory?: VirtualFolder;
715
- }
716
-
717
- export declare function openUrl(url: string, target?: HTMLAttributeAnchorTarget): void;
718
-
719
- export declare type OpenWindowedModal = (params: OpenWindowedModalParams) => Modal;
720
-
721
- export declare interface OpenWindowedModalParams {
722
- /** The ID of the associated app */
723
- appId?: string;
724
- /** The URL of the icon of the modal */
725
- iconUrl?: string;
726
- /** The title of the modal */
727
- title?: string;
728
- /** The size of the modal */
729
- size: Vector2;
730
- /** The modal component */
731
- Modal: FC<ModalProps>;
732
- single?: boolean;
733
- fullscreen?: WindowProps["fullscreen"];
734
- }
735
-
736
- declare type Option_2 = {
737
- long: string;
738
- short: string;
739
- isInput: boolean;
740
- };
741
-
742
- export declare type OptionalStringProperty = string | null | undefined;
743
-
744
- /**
745
- * Component that calls a function when the user clicks outside of it
746
- */
747
- export declare const OutsideClickListener: MemoExoticComponent<({ onOutsideClick, children }: OutsideClickListenerProps) => JSX_2.Element>;
748
-
749
- export declare interface OutsideClickListenerProps {
750
- /** Function that handles clicks outside of this component */
751
- onOutsideClick: (event: Event) => void;
752
- children: ReactNode;
753
- }
754
-
755
- /**
756
- * Component that renders a progress bar
757
- */
758
- export declare function ProgressBar({ fillPercentage, fillColor, backgroundColor, align, className }: ProgressBarProps): JSX_2.Element;
759
-
760
- export declare interface ProgressBarProps {
761
- /** The amount of progress, as a percentage */
762
- fillPercentage: number;
763
- /** The CSS color to use for the filled part of the progress bar */
764
- fillColor?: string;
765
- /** The CSS background color of the progress bar */
766
- backgroundColor?: string;
767
- align?: "left";
768
- /** `className` prop for the progress bar */
769
- className?: string;
770
- }
771
-
772
- /**
773
- * Main component that contains everything
774
- */
775
- export declare const ProzillaOS: NamedExoticComponent<ProzillaOSProps>;
776
-
777
- export declare interface ProzillaOSProps {
778
- /** The name of the system */
779
- systemName?: string;
780
- /** The tagline/short description of the system */
781
- tagLine?: string;
782
- /** The system configuration */
783
- config?: {
784
- apps?: Partial<AppsConfigOptions>;
785
- desktop?: Partial<DesktopConfigOptions>;
786
- misc?: Partial<MiscConfigOptions>;
787
- modals?: Partial<ModalsConfigOptions>;
788
- taskbar?: Partial<TaskbarConfigOptions>;
789
- tracking?: Partial<TrackingConfigOptions>;
790
- windows?: Partial<WindowsConfigOptions>;
791
- virtualDrive?: Partial<VirtualDriveConfigOptions>;
792
- };
793
- skin?: Skin;
794
- children?: ReactNode;
795
- }
796
-
797
- export declare function RadioAction({ actionId, options, initialIndex, onTrigger }: RadioActionProps): ReactElement;
798
-
799
- /**
800
- * @param {object} props
801
- * @param {string} props.actionId
802
- * @param {{
803
- * label: string,
804
- * shortcut: string[]
805
- * }[]} props.options
806
- * @param {number} props.initialIndex
807
- * @param {Function} props.onTrigger
808
- */
809
- export declare interface RadioActionProps extends ActionProps {
810
- options: {
811
- label: string;
812
- shortcut?: string[];
813
- }[];
814
- initialIndex: number;
815
- }
816
-
817
- /**
818
- * Reloads the viewport
819
- */
820
- export declare function reloadViewport(): void;
821
-
822
- export declare function removeBaseUrl(url: string): string;
823
-
824
- export declare function removeUrlProtocol(url: string): string;
825
-
826
- export declare function Router({ path, homePage, fallbackPage, children }: RouterProps): JSX_2.Element;
827
-
828
- export declare interface RouterProps {
829
- path?: string;
830
- homePage?: JSX.Element;
831
- fallbackPage?: JSX.Element;
832
- children?: ReactElement;
833
- }
834
-
835
- export declare class Settings {
836
- #private;
837
- path: string;
838
- file: VirtualFile;
839
- xmlDoc?: Document;
840
- constructor(virtualRoot: VirtualRoot, path: string);
841
- /**
842
- * Reads the xml doc from the given path and assigns it to itself
843
- */
844
- read(): Promise<void>;
845
- write(): void;
846
- /**
847
- * Checks if xml doc is missing
848
- */
849
- isMissingXmlDoc(): Promise<boolean>;
850
- /**
851
- * Gets a value by a given key if it exists and optionally calls a callback function whenever the value changes
852
- * @param key The key of the setting
853
- * @param callback The callback function to call whenever the value changes
854
- */
855
- get(key: string, callback?: (value: string) => void): Promise<{
856
- value: string | null;
857
- listener?: Listener;
858
- }>;
859
- /**
860
- * Gets a value by a given key as a boolean
861
- */
862
- getBool(key: string, callback?: (value: boolean) => void): Promise<{
863
- value: boolean | null;
864
- listener?: Listener;
865
- }>;
866
- /**
867
- * Gets a value by a given key as an integer
868
- */
869
- getInt(key: string, callback?: (value: number) => void): Promise<{
870
- value: number | null;
871
- listener?: Listener;
872
- }>;
873
- /**
874
- * Sets the value associated with a given key
875
- * @param key The key of the setting
876
- * @param value The new value
877
- */
878
- set(key: string, value: string): Promise<void>;
879
- /**
880
- * Removes a listener from the settings file
881
- * @param listener The listener to remove
882
- */
883
- removeListener(listener: Listener): void;
884
- }
885
-
886
- export declare const settings: App<SettingsProps>;
887
-
888
- export declare class SettingsManager {
889
- #private;
890
- static VIRTUAL_PATHS: {
891
- [s: string]: string;
892
- };
893
- constructor(virtualRoot: VirtualRoot);
894
- getSettings(path: string): Settings;
895
- }
896
-
897
- export declare const SettingsManagerContext: Context<SettingsManagerState>;
898
-
899
- export declare type SettingsManagerState = SettingsManager | undefined;
900
-
901
- export declare type SettingsPath = typeof SettingsManager.VIRTUAL_PATHS[string];
902
-
903
- declare interface SettingsProps extends WindowProps {
904
- tab?: number;
905
- }
906
-
907
- export declare function setViewportIcon(url: string): void;
908
-
909
- export declare function setViewportTitle(title: string): void;
910
-
911
- export declare function Share({ modal, params, ...props }: ModalProps): JSX_2.Element;
912
-
913
- declare class Skin {
914
- systemIcon: SkinOptions["systemIcon"];
915
- appIcons: SkinOptions["appIcons"];
916
- appNames: SkinOptions["appNames"];
917
- wallpapers: SkinOptions["wallpapers"];
918
- defaultWallpaper: SkinOptions["defaultWallpaper"];
919
- fileIcons: SkinOptions["fileIcons"];
920
- folderIcons: SkinOptions["folderIcons"];
921
- loadStyleSheet: SkinOptions["loadStyleSheet"];
922
- defaultTheme: SkinOptions["defaultTheme"];
923
- constructor(options?: Partial<SkinOptions>);
924
- }
925
-
926
- declare interface SkinOptions {
927
- /**
928
- * SVG icon for the system
929
- * @default
930
- * "https://os.prozilla.dev/icon.svg"
931
- */
932
- systemIcon: string;
933
- /**
934
- * Replacements for app icons based on app id
935
- */
936
- appIcons?: {
937
- [key: string]: string;
938
- };
939
- /**
940
- * Replacements for app names based on app id
941
- */
942
- appNames?: {
943
- [key: string]: string;
944
- };
945
- /**
946
- * Array of URLs of wallpaper images
947
- */
948
- wallpapers: string[];
949
- /**
950
- * URL of default wallpaper image
951
- * @default
952
- * "https://os.prozilla.dev/assets/wallpapers/vibrant-wallpaper-blue-purple-red.png"
953
- */
954
- defaultWallpaper: string;
955
- /**
956
- * URLs of icons for types of files
957
- */
958
- fileIcons: {
959
- generic: string;
960
- info?: string;
961
- text?: string;
962
- code?: string;
963
- external?: string;
964
- video?: string;
965
- audio?: string;
966
- };
967
- /**
968
- * URLs of icons for types of folders
969
- */
970
- folderIcons: {
971
- generic: string;
972
- images?: string;
973
- text?: string;
974
- link?: string;
975
- video?: string;
976
- audio?: string;
977
- };
978
- /**
979
- * Function that dynamically imports style sheet
980
- */
981
- loadStyleSheet?: () => void;
982
- /**
983
- * Default theme
984
- */
985
- defaultTheme?: Theme;
986
- }
987
-
988
- export declare function StandaloneRoute({ app }: StandaloneRouteProps): JSX_2.Element;
989
-
990
- export declare interface StandaloneRouteProps {
991
- app: App;
992
- }
993
-
994
- declare class StorageManager_2 {
995
- static MAX_BYTES: number;
996
- static store(key: string, value: string): void;
997
- static load(key: string): string | null;
998
- static clear(): void;
999
- static getByteSize(string: string | null): number;
1000
- static byteToKilobyte(bytes: number): number;
1001
- }
1002
- export { StorageManager_2 as StorageManager }
1003
-
1004
- export declare class Stream extends EventEmitter_2<typeof StreamEvents> {
1005
- static EVENT_NAMES: {
1006
- readonly new: "new";
1007
- readonly start: "start";
1008
- readonly stop: "stop";
1009
- };
1010
- enabled: boolean;
1011
- start(callback?: (stream: this) => void): Stream;
1012
- stop(): Stream;
1013
- send(text: string): Stream;
1014
- }
1015
-
1016
- declare const StreamEvents: {
1017
- readonly new: "new";
1018
- readonly start: "start";
1019
- readonly stop: "stop";
1020
- };
1021
-
1022
- export declare class SystemManager {
1023
- #private;
1024
- /** The name of the system */
1025
- readonly systemName: string;
1026
- /** The tagline/short description of the system */
1027
- readonly tagLine: string;
1028
- readonly skin: Skin;
1029
- readonly appsConfig: AppsConfig;
1030
- readonly desktopConfig: DesktopConfig;
1031
- readonly miscConfig: MiscConfig;
1032
- readonly modalsConfig: ModalsConfig;
1033
- readonly taskbarConfig: TaskbarConfig;
1034
- readonly trackingConfig: TrackingConfig;
1035
- readonly windowsConfig: WindowsConfig;
1036
- readonly virtualDriveConfig: VirtualDriveConfig;
1037
- constructor({ systemName, tagLine, skin, desktopConfig, appsConfig, miscConfig, modalsConfig, taskbarConfig, trackingConfig, windowsConfig, virtualDriveConfig, }: SystemManagerParams);
1038
- private loadSkin;
1039
- getUptime(precision?: number): string;
1040
- }
1041
-
1042
- export declare const SystemManagerContext: Context<SystemManager | undefined>;
1043
-
1044
- export declare interface SystemManagerParams {
1045
- systemName: SystemManager["systemName"] | null;
1046
- tagLine: SystemManager["tagLine"] | null;
1047
- skin?: SystemManager["skin"];
1048
- desktopConfig: DesktopConfig;
1049
- appsConfig: AppsConfig;
1050
- miscConfig: MiscConfig;
1051
- modalsConfig: ModalsConfig;
1052
- taskbarConfig: TaskbarConfig;
1053
- trackingConfig: TrackingConfig;
1054
- windowsConfig: WindowsConfig;
1055
- virtualDriveConfig: VirtualDriveConfig;
1056
- }
1057
-
1058
- /**
1059
- * Component that renders the start and search menus, pinned applications and various indicators
1060
- */
1061
- export declare const Taskbar: MemoExoticComponent<() => JSX_2.Element>;
1062
-
1063
- export declare class TaskbarConfig {
1064
- height: TaskbarConfigOptions["height"];
1065
- constructor(options?: Partial<TaskbarConfigOptions>);
1066
- }
1067
-
1068
- export declare interface TaskbarConfigOptions {
1069
- /**
1070
- * Height of the taskbar in CSS pixels
1071
- * @default 3 * 16
1072
- */
1073
- height: number;
1074
- }
1075
-
1076
- export declare const terminal: TerminalApp;
1077
-
1078
- export declare class TerminalApp extends App<TerminalProps> {
1079
- constructor();
1080
- addCommands(commands: Command[]): this;
1081
- addCommand(command: Command): this;
1082
- }
1083
-
1084
- declare interface TerminalProps extends WindowProps {
1085
- path?: string;
1086
- input?: string;
1087
- }
1088
-
1089
- export declare function TextDisplay({ children }: TextDisplayProps): JSX_2.Element;
1090
-
1091
- export declare interface TextDisplayProps {
1092
- children: ReactNode;
1093
- }
1094
-
1095
- export declare const textEditor: App<TextEditorProps>;
1096
-
1097
- declare interface TextEditorProps extends WindowProps {
1098
- file?: VirtualFile;
1099
- mode?: "view" | "edit";
1100
- path?: string;
1101
- }
1102
-
1103
- declare enum Theme {
1104
- Dark = 0,
1105
- Light = 1,
1106
- Cherry = 2,
1107
- Mango = 3,
1108
- Aqua = 4,
1109
- Grape = 5
1110
- }
1111
-
1112
- export declare class TimeManager {
1113
- static START_DATE: Date;
1114
- /**
1115
- * Resets the time
1116
- */
1117
- static reset(): void;
1118
- /**
1119
- * Get the current uptime
1120
- */
1121
- static getUptime(precision?: number): string;
1122
- }
1123
-
1124
- export declare function ToggleAction({ actionId, label, shortcut, initialValue, onTrigger }: ToggleActionProps): ReactElement;
1125
-
1126
- export declare interface ToggleActionProps extends ActionProps {
1127
- initialValue: boolean;
1128
- }
1129
-
1130
- export declare class TrackingConfig {
1131
- enabled: TrackingConfigOptions["enabled"];
1132
- googleAnalyticsMeasurementId: TrackingConfigOptions["GAMeasurementId"];
1133
- constructor(options?: Partial<TrackingConfigOptions>);
1134
- }
1135
-
1136
- export declare interface TrackingConfigOptions {
1137
- /**
1138
- * Enable tracking
1139
- * @default true
1140
- */
1141
- enabled: boolean;
1142
- /** Google Analytics measurement ID */
1143
- GAMeasurementId: string;
1144
- }
1145
-
1146
- export declare class TrackingManager {
1147
- #private;
1148
- measurementId?: string | null;
1149
- constructor(systemManager: SystemManager);
1150
- init(): this;
1151
- event(options: UaEventOptions | string): void;
1152
- }
1153
-
1154
- export declare const TrackingManagerContext: Context<TrackingManagerState>;
1155
-
1156
- export declare type TrackingManagerState = TrackingManager | undefined;
1157
-
1158
- /** Returns a function that opens an alert modal */
1159
- export declare function useAlert(): {
1160
- alert: (params: AlertParams) => void;
1161
- };
1162
-
1163
- /**
1164
- * Returns the folder associated with a given app
1165
- */
1166
- export declare function useAppFolder(app?: App): VirtualFolder | null;
1167
-
1168
- /**
1169
- * Returns the boolean value of a setting and a function to update it
1170
- * @param path The path of the settings file
1171
- * @param key The key of the setting
1172
- * @param defaultValue The default value of the setting
1173
- * @returns The boolean value of a setting and a function to update it
1174
- */
1175
- export declare function useBoolSetting(path: SettingsPath, key: string, defaultValue?: boolean): [boolean, (value: string | boolean) => void];
1176
-
1177
- /**
1178
- * Combine class names and an optional static class name
1179
- */
1180
- export declare function useClassNames(classNames: (string | undefined)[], block?: string, element?: string, modifier?: string | string[]): string;
1181
-
1182
- /**
1183
- * Creates a function that handles the opening of a custom context menu and a component that listens for keyboard shortcuts
1184
- */
1185
- export declare function useContextMenu({ Actions }: UseContextMenuParams): {
1186
- onContextMenu: (event: MouseEvent_2<HTMLElement, MouseEvent_2>, params?: object) => Modal;
1187
- ShortcutsListener: () => JSX_2.Element;
1188
- };
1189
-
1190
- export declare interface UseContextMenuParams {
1191
- /** The component with the actions of the context menu */
1192
- Actions: FC<ActionsProps>;
1193
- }
1194
-
1195
- /**
1196
- * Returns an object that handles stateful history with undo and redo methods
1197
- */
1198
- export declare function useHistory<Type>(initialState: Type): {
1199
- /** The entries of the history */
1200
- history: Type[];
1201
- /** The index of the active entry in list of entries */
1202
- stateIndex: number;
1203
- /** Adds a new entry to the history */
1204
- pushState: (state: Type) => void;
1205
- /** Moves backwards in the history */
1206
- undo: () => void;
1207
- /** Moves forwards in the history */
1208
- redo: () => void;
1209
- undoAvailable: boolean;
1210
- redoAvailable: boolean;
1211
- };
1212
-
1213
- /**
1214
- * Returns the integer value of a setting and a function to update it
1215
- * @param path The path of the settings file
1216
- * @param key The key of the setting
1217
- * @param defaultValue The default value of the setting
1218
- * @returns The integer value of a setting and a function to update it
1219
- */
1220
- export declare function useIntSetting(path: SettingsPath, key: string, defaultValue?: number): [number, (value: string | number) => void];
1221
-
1222
- /**
1223
- * Creates listeners for `"keydown"` and `"keyup"` events
1224
- */
1225
- export declare function useKeyboardListener({ onKeyDown, onKeyUp }: UseKeyboardListenerParams): void;
1226
-
1227
- export declare interface UseKeyboardListenerParams {
1228
- /** Function that handles `"keydown"` events */
1229
- onKeyDown?: (event: KeyboardEvent) => void;
1230
- /** Function that handles `"keyup"` events */
1231
- onKeyUp?: (event: KeyboardEvent) => void;
1232
- }
1233
-
1234
- /**
1235
- * Returns the items of a list value of a setting and a function to update it
1236
- * @param path The path of the settings file
1237
- * @param key The key of the setting
1238
- * @param defaultValue The default value of the setting
1239
- * @returns The items of a list value of a setting and a function to update it
1240
- */
1241
- export declare function useListSetting(path: SettingsPath, key: string, defaultValue?: string[]): [string[], (value: string | string[]) => void];
1242
-
1243
- export declare function useModalsManager(): ModalsManagerState;
1244
-
1245
- /**
1246
- * Creates listeners for `"mousedown"`, `"mouseup"`, `"click"` and `"contextmenu"` events
1247
- */
1248
- export declare function useMouseListener({ onMouseDown, onMouseUp, onClick, onContextMenu }: UseMouseListenerParams): void;
1249
-
1250
- export declare interface UseMouseListenerParams {
1251
- /** Function that handles `"mousedown"` events */
1252
- onMouseDown: EventListener;
1253
- /** Function that handles `"mouseup"` events */
1254
- onMouseUp: EventListener;
1255
- /** Function that handles `"click"` events */
1256
- onClick: EventListener;
1257
- /** Function that handles `"contextmenu"` events */
1258
- onContextMenu: EventListener;
1259
- }
1260
-
1261
- /**
1262
- * Returns the ideal orientation of an element so that it does not go outside of the screen
1263
- */
1264
- export declare function useScreenBounds({ avoidTaskbar }: {
1265
- /** Whether to avoid the task bar */
1266
- avoidTaskbar: boolean;
1267
- }): {
1268
- /** The React ref of the element */
1269
- ref: Ref<HTMLElement>;
1270
- initiated: boolean;
1271
- /** Whether the element should align to the left (`true`) or right (`false`) */
1272
- alignLeft: boolean;
1273
- /** Whether the element should align to the top (`true`) or bottom (`false`) */
1274
- alignTop: boolean;
1275
- };
1276
-
1277
- /**
1278
- * Returns the width and height of the element with ID "root"
1279
- */
1280
- export declare function useScreenDimensions(): [screenWidth: number | null, screenHeight: number | null];
1281
-
1282
- export declare function useScrollWithShadow(params: UseScrollWithShadowParams): {
1283
- boxShadow: string;
1284
- onUpdate: (event: Event | {
1285
- target: HTMLElement;
1286
- }) => void;
1287
- };
1288
-
1289
- export declare interface UseScrollWithShadowParams {
1290
- ref?: MutableRefObject<HTMLElement>;
1291
- horizontal?: boolean;
1292
- dynamicOffset?: boolean;
1293
- dynamicOffsetFactor?: number;
1294
- shadow?: {
1295
- offset?: number;
1296
- blurRadius?: number;
1297
- spreadRadius?: number;
1298
- color?: {
1299
- r?: number;
1300
- g?: number;
1301
- b?: number;
1302
- a?: number;
1303
- };
1304
- };
1305
- }
1306
-
1307
- /**
1308
- * Returns the value of a setting and a function to update it
1309
- * @param path The path of the settings file
1310
- * @param key The key of the setting
1311
- * @param defaultValue The default value of the setting
1312
- * @param parse A function that converts a string to a value
1313
- * @param stringify A function that converts a value to a string
1314
- * @returns The value of a setting and a function to update it
1315
- */
1316
- 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];
1317
-
1318
- export declare function useSettingsManager(): SettingsManagerState;
1319
-
1320
- /**
1321
- * Creates listeners for keyboard shortcuts
1322
- */
1323
- export declare function useShortcuts({ options, shortcuts, useCategories }: UseShortcutsParams): void;
1324
-
1325
- export declare interface UseShortcutsParams {
1326
- options: Record<string, Record<string, (event: KeyboardEvent) => void>> | Record<string, (event: KeyboardEvent) => void>;
1327
- shortcuts?: Record<string, Record<string, string[]>> | Record<string, string[]>;
1328
- useCategories?: boolean;
1329
- }
1330
-
1331
- /**
1332
- * Generates static class name using BEM notation
1333
- */
1334
- export declare function useStaticClassName(block?: string, element?: string, modifier?: string | string[]): string | null;
1335
-
1336
- /**
1337
- * Returns the value of a setting and a function to update it
1338
- * @param path The path of the settings file
1339
- * @param key The key of the setting
1340
- * @param defaultValue The default value of the setting
1341
- * @returns The value of a setting and a function to update it
1342
- */
1343
- export declare function useStringSetting(path: SettingsPath, key: string, defaultValue?: string | null): [string | null, (value: string | null) => void];
1344
-
1345
- export declare function useSystemManager(): SystemManager;
1346
-
1347
- export declare function useTrackingManager(): TrackingManagerState;
1348
-
1349
- export declare function useVirtualRoot(): VirtualRootState;
1350
-
1351
- export declare function useWindowedModal(): {
1352
- openWindowedModal: OpenWindowedModal;
1353
- };
1354
-
1355
- export declare function useWindowsManager(): WindowsManagerState;
1356
-
1357
- export declare function useZIndex({ groupIndex, index }: UseZIndexParams): number;
1358
-
1359
- export declare interface UseZIndexParams {
1360
- groupIndex: number;
1361
- index: number;
1362
- }
1363
-
1364
- export { utilStyles }
1365
-
1366
- export declare class Vector2 {
1367
- x: number;
1368
- y: number;
1369
- static get ZERO(): Vector2;
1370
- get clone(): Vector2;
1371
- constructor(x: number, y?: number);
1372
- round(): Vector2;
1373
- getDistance(x: number, y?: number): number;
1374
- getDistance(vector2: Vector2): number;
1375
- static add(vector2A: Vector2, vector2B: Vector2): Vector2;
1376
- static subtract(vector2A: Vector2, vector2B: Vector2): Vector2;
1377
- static scale(vector2: Vector2, scalar: number): Vector2;
1378
- static magnitude(vector2: Vector2): number;
1379
- static normalize(vector2: Vector2): Vector2;
1380
- static sqrDistance(vector2A: Vector2, vector2B: Vector2): number;
1381
- static lerp(vector2A: Vector2, vector2B: Vector2, t: number): Vector2;
1382
- }
1383
-
1384
- export declare const VIDEO_EXTENSIONS: string[];
1385
-
1386
- declare class VirtualBase extends EventEmitter<EventNamesMap> {
1387
- /** The name of this item */
1388
- name: string;
1389
- /** The alias of this item */
1390
- alias: string | undefined | null;
1391
- /** The folder this item is in */
1392
- parent: VirtualFolder | undefined | null;
1393
- /** Whether this item is protected from changes */
1394
- isProtected: boolean | undefined | null;
1395
- /** The URL of the icon of this item */
1396
- iconUrl: string | undefined | null;
1397
- /** The file this item links to */
1398
- linkedFile: VirtualFile | undefined | null;
1399
- /** The folder this item links to */
1400
- linkedFolder: VirtualFolder | undefined | null;
1401
- /** Whether this item has been edited by the user */
1402
- editedByUser: boolean | undefined | null;
1403
- /** Whether this item is the root folder */
1404
- isRoot: boolean | undefined | null;
1405
- /** The root folder */
1406
- root: VirtualRoot | undefined | null;
1407
- /** Whether this item has been deleted */
1408
- isDeleted: boolean;
1409
- static EVENT_NAMES: {
1410
- update: string;
1411
- };
1412
- constructor(name: string);
1413
- get id(): string;
1414
- setName(name: string): this;
1415
- setAlias(alias: string): this;
1416
- setParent(parent: VirtualFolder): this;
1417
- setProtected(value: boolean): this;
1418
- setIconUrl(iconUrl: string | null): this;
1419
- getIconUrl(): string;
1420
- getType(): string;
1421
- /**
1422
- * Tries to delete this item
1423
- */
1424
- delete(): void;
1425
- confirmChanges(root?: VirtualRoot): void;
1426
- /**
1427
- * Opens this item in the appropriate application
1428
- */
1429
- open(..._args: unknown[]): unknown;
1430
- /**
1431
- * Returns the path of this item
1432
- */
1433
- get path(): string;
1434
- /**
1435
- * Returns path without using this item's alias
1436
- */
1437
- get displayPath(): string;
1438
- /**
1439
- * Returns path without using any aliases
1440
- */
1441
- get absolutePath(): string;
1442
- /**
1443
- * Returns whether this can be edited in its current state
1444
- */
1445
- get canBeEdited(): boolean;
1446
- /**
1447
- * Returns the root folder
1448
- */
1449
- getRoot(): VirtualRoot;
1450
- isFile(): boolean;
1451
- isFolder(): boolean;
1452
- toJSON(): VirtualBaseJson | null;
1453
- toString(): string | null;
1454
- }
1455
-
1456
- declare interface VirtualBaseJson {
1457
- nam: string;
1458
- ico?: string;
1459
- }
1460
-
1461
- export declare class VirtualDriveConfig {
1462
- saveData: VirtualDriveConfigOptions["saveData"];
1463
- defaultData: VirtualDriveConfigOptions["defaultData"];
1464
- constructor(options?: Partial<VirtualDriveConfigOptions>);
1465
- }
1466
-
1467
- export declare interface VirtualDriveConfigOptions {
1468
- /**
1469
- * Enables persistent storage of the virtual drive
1470
- * @default true
1471
- */
1472
- saveData: boolean;
1473
- /**
1474
- * Configure the data that is loaded initially when ProzillaOS is opened
1475
- */
1476
- defaultData: {
1477
- /**
1478
- * Include pictures folder in default data
1479
- * @default true
1480
- */
1481
- includePicturesFolder?: boolean;
1482
- /**
1483
- * Include documents folder in default data
1484
- * @default true
1485
- */
1486
- includeDocumentsFolder?: boolean;
1487
- /**
1488
- * Include desktop folder in default data
1489
- * @default true
1490
- */
1491
- includeDesktopFolder?: boolean;
1492
- /**
1493
- * Include source tree folder in default data
1494
- * @default true
1495
- */
1496
- includeSourceTree?: boolean;
1497
- /**
1498
- * Include apps folder in default data
1499
- * @default true
1500
- */
1501
- includeAppsFolder?: boolean;
1502
- loadData?: (virtualRoot: VirtualRoot) => void;
1503
- };
1504
- }
1505
-
1506
- /**
1507
- * A virtual file that can be stored inside a folder
1508
- */
1509
- export declare class VirtualFile extends VirtualBase {
1510
- /** The extension of this file */
1511
- extension: OptionalStringProperty;
1512
- /** The URL of the source of this file */
1513
- source: OptionalStringProperty;
1514
- /** The content of this file */
1515
- content: OptionalStringProperty;
1516
- static NON_TEXT_EXTENSIONS: string[];
1517
- static EVENT_NAMES: {
1518
- update: string;
1519
- contentChange: string;
1520
- };
1521
- constructor(name: string, extension?: string);
1522
- setAlias(alias: string): this;
1523
- /**
1524
- * Sets the source of this file and removes the content
1525
- */
1526
- setSource(source: string): this;
1527
- /**
1528
- * Sets the content of this file and removes the source
1529
- */
1530
- setContent(content: string | string[]): this;
1531
- get id(): string;
1532
- static splitId(id: string): {
1533
- name: string;
1534
- extension: OptionalStringProperty;
1535
- };
1536
- /**
1537
- * Opens this file in an app associated with its extension
1538
- */
1539
- open(windowsManager: WindowsManager): object | null;
1540
- read(): Promise<OptionalStringProperty | undefined>;
1541
- isFile(): boolean;
1542
- getIconUrl(): string;
1543
- getType(): string;
1544
- download(): void;
1545
- isDownloadable(): boolean;
1546
- toJSON(): VirtualFileJson | null;
1547
- static removeFileScheme(source: string): string;
1548
- }
1549
-
1550
- export declare interface VirtualFileJson extends VirtualBaseJson {
1551
- ext?: string;
1552
- cnt?: string;
1553
- src?: string;
1554
- }
1555
-
1556
- /**
1557
- * A link that points to a virtual file
1558
- */
1559
- export declare class VirtualFileLink extends VirtualFile {
1560
- linkedPath?: string;
1561
- constructor(name: string, linkedFile?: VirtualFile);
1562
- setLinkedFile(file: VirtualFile): VirtualFileLink;
1563
- setLinkedPath(path: string): VirtualFileLink;
1564
- isValid(): boolean;
1565
- toJSON(): VirtualFileLinkJson | null;
1566
- setAlias(...args: Parameters<VirtualFile["setAlias"]>): this;
1567
- setSource(...args: Parameters<VirtualFile["setSource"]>): this;
1568
- setContent(...args: Parameters<VirtualFile["setContent"]>): this;
1569
- get id(): string;
1570
- open(...args: Parameters<VirtualFile["open"]>): ReturnType<VirtualFile["open"]>;
1571
- read(...args: Parameters<VirtualFile["read"]>): Promise<string | null | undefined>;
1572
- getIconUrl(...args: Parameters<VirtualFile["getIconUrl"]>): ReturnType<VirtualFile["getIconUrl"]>;
1573
- }
1574
-
1575
- export declare interface VirtualFileLinkJson extends VirtualFileJson {
1576
- lnk: string;
1577
- }
1578
-
1579
- /**
1580
- * A virtual folder that can contains files and sub-folders
1581
- */
1582
- export declare class VirtualFolder extends VirtualBase {
1583
- /** The folders inside this folder */
1584
- subFolders: (VirtualFolder | VirtualFolderLink)[];
1585
- /** The files inside this folder */
1586
- files: (VirtualFile | VirtualFileLink)[];
1587
- /**
1588
- * The type of this folder
1589
- * @default VirtualFolder.TYPE.general
1590
- */
1591
- type: number | undefined;
1592
- static TYPE: {
1593
- general: number;
1594
- media: number;
1595
- };
1596
- constructor(name: string, type?: number);
1597
- setAlias(alias: string): this;
1598
- /**
1599
- * Returns true if this folder contains a file matching a name and extension
1600
- */
1601
- hasFile(name: string, extension?: string): boolean;
1602
- /**
1603
- * Returns true if this folder contains a folder matching a name
1604
- */
1605
- hasFolder(name: string): boolean;
1606
- /**
1607
- * Finds and returns a file inside this folder matching a name and extension
1608
- */
1609
- findFile(name: string, extension?: string | null): VirtualFile | VirtualFileLink | null;
1610
- /**
1611
- * Finds and returns a folder inside this folder matching a name
1612
- */
1613
- findSubFolder(name: string): VirtualFolder | VirtualFolderLink | null;
1614
- /**
1615
- * Creates a file with a name and extension
1616
- */
1617
- createFile(name: string, extension?: string, callback?: (newFile: VirtualFile | VirtualFileLink) => void): this;
1618
- /**
1619
- * Creates files based on an array of objects with file names and extensions
1620
- */
1621
- createFiles(files: {
1622
- name: string;
1623
- extension: string;
1624
- }[]): this;
1625
- /**
1626
- * Creates a file link with a name
1627
- */
1628
- createFileLink(name: string, callback?: (newFileLink: VirtualFileLink | VirtualFile) => void): this;
1629
- /**
1630
- * Creates file links based on an array of objects with file names and extensions
1631
- */
1632
- createFileLinks(fileLinks: {
1633
- name: string;
1634
- }[]): this;
1635
- /**
1636
- * Creates a folder with a name
1637
- */
1638
- createFolder(name: string, callback?: (newFolder: VirtualFolder) => void): this;
1639
- /**
1640
- * Creates folders based on an array of folder names
1641
- */
1642
- createFolders(names: string[]): this;
1643
- /**
1644
- * Creates a folder link with a name
1645
- */
1646
- createFolderLink(name: string, callback?: (newFolderLink: VirtualFolderLink | VirtualFolder) => void): this;
1647
- /**
1648
- * Creates folder links based on an array of folder names
1649
- */
1650
- createFolderLinks(names: string[]): this;
1651
- /**
1652
- * Removes a file or folder from this folder
1653
- */
1654
- remove(child: VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink): this;
1655
- /**
1656
- * Returns the file or folder at a relative path or null if it doesn't exist
1657
- */
1658
- navigate(relativePath: string): VirtualFile | VirtualFolder | null;
1659
- /**
1660
- * Opens this folder in file explorer
1661
- */
1662
- open(windowsManager: WindowsManager): object | null | undefined;
1663
- /**
1664
- * Deletes this folder and all its files and sub-folders recursively
1665
- */
1666
- delete(): void;
1667
- /**
1668
- * Returns all files inside this folder
1669
- * @param showHidden Whether to include hidden files
1670
- */
1671
- getFiles(showHidden?: boolean): VirtualFile[];
1672
- /**
1673
- * Returns all sub-folders inside this folder
1674
- * @param showHidden Whether to include hidden folders
1675
- */
1676
- getSubFolders(showHidden?: boolean): VirtualFolder[];
1677
- /**
1678
- * Returns the amount of files and sub-folders inside this folder
1679
- * @param includeHidden Whether to include hidden files and folders in the count
1680
- */
1681
- getItemCount(includeHidden?: boolean): number;
1682
- isFolder(): boolean;
1683
- getIconUrl(): string;
1684
- toJSON(): VirtualFolderJson | null;
1685
- }
1686
-
1687
- export declare interface VirtualFolderJson extends VirtualBaseJson {
1688
- fls?: VirtualFileJson[];
1689
- fds?: VirtualFolderJson[];
1690
- }
1691
-
1692
- /**
1693
- * A link that points to a virtual folder
1694
- */
1695
- export declare class VirtualFolderLink extends VirtualFolder {
1696
- linkedPath?: string;
1697
- constructor(name: string, linkedFolder?: VirtualFolder);
1698
- setLinkedFolder(folder: VirtualFolder): VirtualFolderLink;
1699
- setLinkedPath(path: string): VirtualFolderLink;
1700
- isValid(): boolean;
1701
- getIconUrl(): string;
1702
- toJSON(): VirtualFolderLinkJson | null;
1703
- setAlias(...args: Parameters<VirtualFolder["setAlias"]>): this;
1704
- createFile(...args: Parameters<VirtualFolder["createFile"]>): this;
1705
- createFiles(...args: Parameters<VirtualFolder["createFiles"]>): this;
1706
- createFolder(...args: Parameters<VirtualFolder["createFolder"]>): this;
1707
- createFolders(...args: Parameters<VirtualFolder["createFolders"]>): this;
1708
- hasFile(...args: Parameters<VirtualFolder["hasFile"]>): ReturnType<VirtualFolder["hasFile"]>;
1709
- hasFolder(...args: Parameters<VirtualFolder["hasFolder"]>): ReturnType<VirtualFolder["hasFolder"]>;
1710
- findFile(...args: Parameters<VirtualFolder["findFile"]>): ReturnType<VirtualFolder["findFile"]>;
1711
- findSubFolder(...args: Parameters<VirtualFolder["findSubFolder"]>): ReturnType<VirtualFolder["findSubFolder"]>;
1712
- getFiles(...args: Parameters<VirtualFolder["getFiles"]>): ReturnType<VirtualFolder["getFiles"]>;
1713
- getSubFolders(...args: Parameters<VirtualFolder["getSubFolders"]>): ReturnType<VirtualFolder["getSubFolders"]>;
1714
- open(...args: Parameters<VirtualFolder["open"]>): ReturnType<VirtualFolder["open"]>;
1715
- getItemCount(...args: Parameters<VirtualFolder["getItemCount"]>): ReturnType<VirtualFolder["getItemCount"]>;
1716
- }
1717
-
1718
- export declare interface VirtualFolderLinkJson extends VirtualFolderJson {
1719
- lnk: string;
1720
- }
1721
-
1722
- /**
1723
- * A virtual folder that serves as the root folder
1724
- */
1725
- export declare class VirtualRoot extends VirtualFolder {
1726
- /** Aliases for files and folders */
1727
- shortcuts: Record<string, VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink>;
1728
- initiated: boolean;
1729
- loadedDefaultData: boolean;
1730
- systemManager: SystemManager;
1731
- static EVENT_NAMES: {
1732
- update: string;
1733
- error: string;
1734
- };
1735
- constructor(systemManager: SystemManager);
1736
- loadDefaultData(): void;
1737
- loadData(): void;
1738
- /**
1739
- * Calls the storage manager's store function with this root's data as a string
1740
- */
1741
- saveData(): void;
1742
- /**
1743
- * Initializes this root by loading the default data and then the user's data on top
1744
- */
1745
- init(): VirtualRoot;
1746
- /**
1747
- * Adds a shortcut to a file or folder
1748
- */
1749
- addShortcut(name: string, destination: VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink): this;
1750
- /**
1751
- * Tells the storage manager to clear all data and reloads the window
1752
- */
1753
- reset(): void;
1754
- static isValidName(_name: string): boolean;
1755
- static isValidFileName(_name: string): boolean;
1756
- static isValidFolderName(_name: string): boolean;
1757
- get path(): string;
1758
- get displayPath(): string;
1759
- toJSON(): VirtualRootJson | null;
1760
- toString(): string | null;
1761
- }
1762
-
1763
- export declare const VirtualRootContext: Context<VirtualRootState>;
1764
-
1765
- export declare interface VirtualRootJson extends VirtualFolderJson {
1766
- scs: Record<string, string>;
1767
- }
1768
-
1769
- export declare type VirtualRootState = VirtualRoot | undefined;
1770
-
1771
- /**
1772
- * Component that renders an external application inside an iframe
1773
- */
1774
- export declare const WebView: FC<WebViewProps>;
1775
-
1776
- export declare interface WebViewProps extends WindowProps {
1777
- /** The URL of the external application */
1778
- source?: string;
1779
- title?: string;
1780
- }
1781
-
1782
- export declare function WindowedModal({ modal, params, children, ...props }: ModalProps): JSX_2.Element;
1783
-
1784
- export declare interface WindowOptions {
1785
- /** The ID of the window */
1786
- id?: string;
1787
- /** The app associated with the window */
1788
- app?: App;
1789
- /**
1790
- * The size of the window
1791
- * @default new Vector2(700, 400)
1792
- */
1793
- size?: Vector2;
1794
- /** The position of the window */
1795
- position?: Vector2;
1796
- fullscreen?: boolean | string;
1797
- options?: object;
1798
- isFocused?: boolean;
1799
- lastInteraction?: number;
1800
- minimized?: boolean;
1801
- [key: string]: unknown;
1802
- }
1803
-
1804
- export declare interface WindowProps extends WindowOptions {
1805
- /**
1806
- * Whether to start the window in fullscreen mode
1807
- * @default false
1808
- */
1809
- fullscreen?: boolean;
1810
- /** Function that handles interactions with the window */
1811
- onInteract?: () => void;
1812
- /** Function that sets the title of the window */
1813
- setTitle?: React.Dispatch<React.SetStateAction<string>>;
1814
- /** Function that sets the icon URL of the window */
1815
- setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
1816
- /** Function that closes the window */
1817
- close?: (event?: Event) => void;
1818
- /** Function that brings the window in focus */
1819
- focus?: (event: Event, force?: boolean) => void;
1820
- /** Whether the window is currently focused and should allow interactions */
1821
- active?: boolean;
1822
- /** Whether to start the window in minimized mode */
1823
- minimized?: boolean;
1824
- /** Function that toggles the minimized mode of the window */
1825
- toggleMinimized?: (event?: Event) => void;
1826
- /** The depth value of the window */
1827
- index?: number;
1828
- /** Whether the window is in standalone mode */
1829
- standalone?: boolean;
1830
- }
1831
-
1832
- export declare class WindowsConfig {
1833
- screenMargin: WindowsConfigOptions["screenMargin"];
1834
- titleSeparator: WindowsConfigOptions["titleSeparator"];
1835
- minScreenSize: WindowsConfigOptions["minScreenSize"];
1836
- constructor(options?: Partial<WindowsConfigOptions>);
1837
- }
1838
-
1839
- export declare interface WindowsConfigOptions {
1840
- /**
1841
- * The margin around windows that are not maximized, in pixels
1842
- * @default 32
1843
- */
1844
- screenMargin: number;
1845
- /**
1846
- * The separator to use in window titles
1847
- * @default "-"
1848
- */
1849
- titleSeparator: string;
1850
- /**
1851
- * If the user's screen is smaller than these values, windows will always be maximized
1852
- * @default new Vector2(350, 350)
1853
- */
1854
- minScreenSize: Vector2;
1855
- }
1856
-
1857
- /**
1858
- * Manages the states of windows
1859
- */
1860
- export declare class WindowsManager {
1861
- #private;
1862
- windows: {
1863
- [id: string]: WindowOptions;
1864
- };
1865
- /** Function that handles changes to the open windows */
1866
- updateWindows: (window: WindowsManager["windows"]) => void;
1867
- startupComplete: boolean;
1868
- constructor(systemManager: SystemManager, trackingManager: TrackingManager);
1869
- /**
1870
- * Opens a window for an application
1871
- * @param appId The ID of the app
1872
- */
1873
- open(appId: string, options?: WindowOptions | null): object | null;
1874
- /**
1875
- * Opens a file with the associated app or by a method specified by the file scheme
1876
- * @returns Opened window
1877
- */
1878
- openFile(file: VirtualFile, options?: object): object | null;
1879
- /**
1880
- * Close a window
1881
- */
1882
- close(windowId: string): void;
1883
- /**
1884
- * Focus on a specific window
1885
- */
1886
- focus(windowId: string): void;
1887
- /**
1888
- * Check whether a window is focused
1889
- */
1890
- isFocused(windowId: string): boolean | undefined;
1891
- /**
1892
- * Check if any window is focused
1893
- */
1894
- isAnyFocused(): boolean;
1895
- /**
1896
- * Change the minimized state of a window
1897
- * @param minimized - Leave as undefined to toggle the window's minimization state
1898
- */
1899
- setMinimized(windowId: string, minimized?: boolean): void;
1900
- /**
1901
- * Minimize all windows
1902
- */
1903
- minimizeAll(): void;
1904
- /**
1905
- * Check if an app has an open window
1906
- */
1907
- isAppActive(appId: string): boolean;
1908
- /**
1909
- * Get an opened window of a certain app
1910
- */
1911
- getAppWindowId(appId: string): string | null;
1912
- setUpdateWindows(updateWindows: WindowsManager["updateWindows"]): void;
1913
- startup(appIds: string[], options: Record<string, unknown>): void;
1914
- get windowIds(): string[];
1915
- }
1916
-
1917
- export declare const WindowsManagerContext: Context<WindowsManagerState>;
1918
-
1919
- export declare type WindowsManagerState = WindowsManager | undefined;
1920
-
1921
- /**
1922
- * Component that renders the windows for all currently active applications
1923
- */
1924
- export declare const WindowsView: FC;
1925
-
1926
- /**
1927
- * Component that renders the window for an application
1928
- */
1929
- export declare const WindowView: FC<WindowProps>;
1930
-
1931
- /**
1932
- * Represents a group of HTML elements whose z-index is automatically calculated based on a given order
1933
- */
1934
- export declare class ZIndexGroup {
1935
- length: number;
1936
- offset: number;
1937
- groupIndex: number;
1938
- zIndexManager: ZIndexManager | null;
1939
- constructor(zIndexManager: ZIndexManager, initialLength?: number);
1940
- setManager(zIndexManager: ZIndexManager): ZIndexGroup;
1941
- setOffset(offset: number): ZIndexGroup;
1942
- setLength(length: number): ZIndexGroup;
1943
- getIndex(index: number): number;
1944
- }
1945
-
1946
- export declare class ZIndexManager extends EventEmitter<typeof ZIndexManagerEvents> {
1947
- static GROUPS: {
1948
- WINDOWS: number;
1949
- TASKBAR: number;
1950
- MODALS: number;
1951
- };
1952
- static EVENT_NAMES: {
1953
- readonly indexChange: "indexChange";
1954
- };
1955
- groups: ZIndexGroup[];
1956
- constructor();
1957
- update(): void;
1958
- getIndex(groupIndex: number, index: number): number;
1959
- }
1960
-
1961
- declare const ZIndexManagerEvents: {
1962
- readonly indexChange: "indexChange";
1963
- };
1964
-
1965
- export { }
1
+ export * from "@prozilla-os/core";
2
+ export * from "@prozilla-os/shared";
3
+ export * from "@prozilla-os/file-explorer";
4
+ export * from "@prozilla-os/terminal";
5
+ export * from "@prozilla-os/text-editor";
6
+ export * from "@prozilla-os/settings";
7
+ export * from "@prozilla-os/media-viewer";
8
+ export * from "@prozilla-os/browser";
9
+ export * from "@prozilla-os/calculator";
10
+ export * from "@prozilla-os/app-center";