prozilla-os 1.3.2 → 1.3.4

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,5 +1,3 @@
1
- /// <reference types="react" />
2
-
3
1
  import { FC } from 'react';
4
2
  import { HTMLAttributeAnchorTarget } from 'react';
5
3
  import { IconProp } from '@fortawesome/fontawesome-svg-core';
@@ -105,8 +103,17 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
105
103
  * @default false
106
104
  */
107
105
  launchAtStartup: boolean;
106
+ /**
107
+ * The category the app belongs to
108
+ */
109
+ category: typeof APP_CATEGORIES[number] | null;
110
+ /**
111
+ * Metadata of the app's package
112
+ */
113
+ metadata: AppMetadata | null;
108
114
  isActive: boolean;
109
115
  isPinned?: boolean;
116
+ isInstalled: boolean;
110
117
  constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: App["windowOptions"]);
111
118
  WindowContent: (props: AppProps) => JSX_2.Element | null;
112
119
  /**
@@ -137,20 +144,43 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
137
144
  * Changes whether this application is launched at startup or not
138
145
  */
139
146
  setLaunchAtStartup(launchAtStartup: boolean): this;
147
+ /**
148
+ * Changes whether this application is installed by default or not
149
+ */
150
+ setInstalled(installed: boolean): this;
151
+ /**
152
+ * Changes the category this application belongs to
153
+ */
154
+ setCategory(category: typeof APP_CATEGORIES[number] | null): this;
155
+ setMetadata(metadata: AppMetadata | null): this;
156
+ }
157
+
158
+ 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"];
159
+
160
+ export declare const appCenter: App<WindowProps>;
161
+
162
+ declare interface AppMetadata {
163
+ name: string;
164
+ version: `${number}.${number}.${number}`;
165
+ author: string;
140
166
  }
141
167
 
142
168
  export declare class AppsConfig {
143
169
  apps: AppsConfigOptions["apps"];
144
170
  static APP_ROLES: {
145
- FileExplorer: string;
146
- Terminal: string;
147
- TextEditor: string;
148
- Settings: string;
149
- MediaViewer: string;
150
- Browser: string;
171
+ fileExplorer: string;
172
+ terminal: string;
173
+ textEditor: string;
174
+ settings: string;
175
+ mediaViewer: string;
176
+ browser: string;
151
177
  };
152
178
  constructor(options?: OptionalInterface<AppsConfigOptions>);
153
- getAppById(id: string): App | null;
179
+ get installedApps(): App<any>[];
180
+ /**
181
+ * @param includeUninstalled Include apps that are not currently installed
182
+ */
183
+ getAppById(id: string, includeUninstalled?: boolean): App | null;
154
184
  /**
155
185
  * Get the app associated with a file extension
156
186
  */
@@ -159,6 +189,10 @@ export declare class AppsConfig {
159
189
  * Get the app with a specific role
160
190
  */
161
191
  getAppByRole(role: string): App | null;
192
+ /**
193
+ * Get all applications (including uninstalled apps) that belong to a category
194
+ */
195
+ getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
162
196
  }
163
197
 
164
198
  declare interface AppsConfigOptions {
@@ -252,15 +286,13 @@ declare interface DropdownActionProps extends ActionProps {
252
286
  showOnHover?: boolean;
253
287
  }
254
288
 
255
- export declare function DropdownButton({ label, options, shortcuts }: {
289
+ export declare function DropdownButton({ label, options, shortcuts }: DropdownButtonProps): JSX_2.Element;
290
+
291
+ declare interface DropdownButtonProps {
256
292
  label: string;
257
- options: {
258
- [s: string]: Function;
259
- };
260
- shortcuts: {
261
- [s: string]: string[];
262
- };
263
- }): JSX_2.Element;
293
+ options: Record<string, () => void>;
294
+ shortcuts: Record<string, string[]>;
295
+ }
264
296
 
265
297
  declare class EventEmitter<EventMap extends EventNamesMap> {
266
298
  #private;
@@ -290,7 +322,7 @@ declare interface FileExplorerProps extends WindowProps {
290
322
  selectorMode?: number;
291
323
  Footer?: FC;
292
324
  onSelectionChange?: (params: OnSelectionChangeParams) => void;
293
- onSelectionFinish?: Function;
325
+ onSelectionFinish?: () => void;
294
326
  }
295
327
 
296
328
  export declare enum FileSelectorMode {
@@ -301,11 +333,16 @@ export declare enum FileSelectorMode {
301
333
 
302
334
  export declare type FolderEventHandler = (event: Event, folder: VirtualFolder) => void;
303
335
 
336
+ /**
337
+ * Formats a shortcut (combination of keys) into a human-readable format.
338
+ *
339
+ * 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>
340
+ */
304
341
  export declare function formatShortcut(shortcut: string[]): string;
305
342
 
306
- export declare function generateUrl(options: generateUrlOptions): string;
343
+ export declare function generateUrl(options: GenerateUrlOptions): string;
307
344
 
308
- declare interface generateUrlOptions {
345
+ declare interface GenerateUrlOptions {
309
346
  appId?: string;
310
347
  fullscreen?: boolean;
311
348
  standalone?: boolean;
@@ -325,7 +362,7 @@ export declare function ImagePreview({ source, className, onError, ...props }: I
325
362
  declare interface ImagePreviewProps {
326
363
  source: string;
327
364
  className?: string;
328
- onError?: Function;
365
+ onError?: () => void;
329
366
  }
330
367
 
331
368
  declare interface ImageProps {
@@ -337,8 +374,8 @@ declare interface ImageProps {
337
374
  export declare function Interactable({ onClick, onDoubleClick, children, ...props }: InteractableProps): JSX_2.Element;
338
375
 
339
376
  declare interface InteractableProps {
340
- onClick: Function;
341
- onDoubleClick: Function;
377
+ onClick?: (event: MouseEvent) => void;
378
+ onDoubleClick?: (event: MouseEvent) => void;
342
379
  children: ReactNode;
343
380
  [key: string]: unknown;
344
381
  }
@@ -372,7 +409,7 @@ declare class Modal {
372
409
  modalsManager: ModalsManager | null;
373
410
  element: FC<ModalProps> | null;
374
411
  props: object;
375
- callback: Function | null;
412
+ callback: ((...args: unknown[]) => void) | null;
376
413
  id: number | null;
377
414
  dismissible: boolean;
378
415
  lastInteraction?: number;
@@ -403,7 +440,7 @@ export declare interface ModalProps {
403
440
  [key: string]: unknown;
404
441
  };
405
442
  children?: ReactNode;
406
- onFinish?: Function;
443
+ onFinish?: () => void;
407
444
  [key: string]: unknown;
408
445
  }
409
446
 
@@ -411,7 +448,7 @@ export declare class ModalsConfig {
411
448
  defaultDialogSize: ModalsConfigOptions["defaultDialogSize"];
412
449
  defaultFileSelectorSize: ModalsConfigOptions["defaultFileSelectorSize"];
413
450
  static DIALOG_CONTENT_TYPES: {
414
- CloseButton: number;
451
+ closeButton: number;
415
452
  };
416
453
  constructor(options?: OptionalInterface<ModalsConfigOptions>);
417
454
  }
@@ -432,14 +469,14 @@ declare interface ModalsConfigOptions {
432
469
  export declare class ModalsManager {
433
470
  modals: Record<string, Modal>;
434
471
  containerRef?: MutableRefObject<HTMLElement>;
435
- updateModals: Function;
472
+ updateModals: (modals: ModalsManager["modals"]) => void;
436
473
  /**
437
474
  * @param single - Set to false to preserve other open modals
438
475
  */
439
476
  open(modal: Modal, single?: boolean): void;
440
477
  close(modalId: string | number, sendModalsUpdate?: boolean): void;
441
478
  focus(modalId: string): void;
442
- setUpdateModals(updateModals: Function): void;
479
+ setUpdateModals(updateModals: ModalsManager["updateModals"]): void;
443
480
  get modalIds(): string[];
444
481
  static getModalIconUrl(name: string): string;
445
482
  }
@@ -465,9 +502,9 @@ declare interface OpenWindowedModalParams {
465
502
  iconUrl?: string;
466
503
  title?: string;
467
504
  size: Vector2;
468
- Modal: Function;
505
+ Modal: FC<ModalProps>;
469
506
  single?: boolean;
470
- fullscreen?: boolean;
507
+ fullscreen?: WindowProps["fullscreen"];
471
508
  }
472
509
 
473
510
  export declare type OptionalInterface<Interface> = {
@@ -541,14 +578,17 @@ declare interface RadioActionProps extends ActionProps {
541
578
  */
542
579
  export declare function reloadViewport(): void;
543
580
 
581
+ export declare function removeBaseUrl(url: string): string;
582
+
544
583
  export declare function removeUrlProtocol(url: string): string;
545
584
 
546
- export declare function Router({ path, homePage, fallbackPage }: RouterProps): JSX_2.Element;
585
+ export declare function Router({ path, homePage, fallbackPage, children }: RouterProps): JSX_2.Element;
547
586
 
548
587
  declare interface RouterProps {
549
588
  path?: string;
550
589
  homePage?: JSX.Element;
551
590
  fallbackPage?: JSX.Element;
591
+ children?: ReactElement;
552
592
  }
553
593
 
554
594
  declare class Settings {
@@ -597,6 +637,7 @@ export declare function setViewportTitle(title: string): void;
597
637
  export declare function Share({ modal, params, ...props }: ModalProps): JSX_2.Element;
598
638
 
599
639
  declare class Skin {
640
+ systemIcon: SkinOptions["systemIcon"];
600
641
  appIcons: SkinOptions["appIcons"];
601
642
  appNames: SkinOptions["appNames"];
602
643
  wallpapers: SkinOptions["wallpapers"];
@@ -604,10 +645,17 @@ declare class Skin {
604
645
  fileIcons: SkinOptions["fileIcons"];
605
646
  folderIcons: SkinOptions["folderIcons"];
606
647
  loadStyleSheet: SkinOptions["loadStyleSheet"];
648
+ defaultTheme: SkinOptions["defaultTheme"];
607
649
  constructor(options?: OptionalInterface_2<SkinOptions>);
608
650
  }
609
651
 
610
652
  declare interface SkinOptions {
653
+ /**
654
+ * SVG icon for the system
655
+ * @default
656
+ * "https://os.prozilla.dev/icon.svg"
657
+ */
658
+ systemIcon: string;
611
659
  /**
612
660
  * Replacements for app icons based on app id
613
661
  */
@@ -638,6 +686,7 @@ declare interface SkinOptions {
638
686
  info?: string;
639
687
  text?: string;
640
688
  code?: string;
689
+ external?: string;
641
690
  };
642
691
  /**
643
692
  * URLs of icons for types of folders
@@ -652,6 +701,10 @@ declare interface SkinOptions {
652
701
  * Function that dynamically imports style sheet
653
702
  */
654
703
  loadStyleSheet?: () => void;
704
+ /**
705
+ * Default theme
706
+ */
707
+ defaultTheme?: Theme;
655
708
  }
656
709
 
657
710
  export declare function StandaloneRoute({ app }: StandaloneRouteProps): JSX_2.Element;
@@ -683,7 +736,7 @@ export declare class SystemManager {
683
736
  readonly trackingConfig: TrackingConfig;
684
737
  readonly windowsConfig: WindowsConfig;
685
738
  readonly virtualDriveConfig: VirtualDriveConfig;
686
- constructor({ systemName, tagLine, skin, desktopConfig, appsConfig, miscConfig, modalsConfig, taskbarConfig, trackingConfig, windowsConfig, virtualDriveConfig }: SystemManagerParams);
739
+ constructor({ systemName, tagLine, skin, desktopConfig, appsConfig, miscConfig, modalsConfig, taskbarConfig, trackingConfig, windowsConfig, virtualDriveConfig, }: SystemManagerParams);
687
740
  private loadSkin;
688
741
  getUptime(precision?: number): string;
689
742
  }
@@ -738,11 +791,24 @@ declare interface TextEditorProps extends WindowProps {
738
791
  path?: string;
739
792
  }
740
793
 
741
- export declare const THEMES: Record<number, string | null>;
794
+ declare enum Theme {
795
+ Dark = 0,
796
+ Light = 1,
797
+ Cherry = 2,
798
+ Mango = 3,
799
+ Aqua = 4,
800
+ Grape = 5
801
+ }
742
802
 
743
803
  export declare class TimeManager {
744
- static startDate: Date;
804
+ static START_DATE: Date;
805
+ /**
806
+ * Resets the time
807
+ */
745
808
  static reset(): void;
809
+ /**
810
+ * Get the current uptime
811
+ */
746
812
  static getUptime(precision?: number): string;
747
813
  }
748
814
 
@@ -754,7 +820,7 @@ declare interface ToggleActionProps extends ActionProps {
754
820
 
755
821
  export declare class TrackingConfig {
756
822
  enabled: TrackingConfigOptions["enabled"];
757
- GAMeasurementId: TrackingConfigOptions["GAMeasurementId"];
823
+ googleAnalyticsMeasurementId: TrackingConfigOptions["GAMeasurementId"];
758
824
  constructor(options?: OptionalInterface<TrackingConfigOptions>);
759
825
  }
760
826
 
@@ -785,7 +851,7 @@ export declare function useAlert(): {
785
851
  export declare function useAppFolder(app?: App): VirtualFolder | null;
786
852
 
787
853
  /**
788
- * Combine clas names and an optional static class name
854
+ * Combine class names and an optional static class name
789
855
  */
790
856
  export declare function useClassNames(classNames: (string | undefined)[], block?: string, element?: string, modifier?: string | string[]): string;
791
857
 
@@ -801,9 +867,9 @@ declare interface UseContextMenuParams {
801
867
  export declare function useHistory<Type>(initialState: Type): {
802
868
  history: Type[];
803
869
  stateIndex: number;
804
- pushState: Function;
805
- undo: Function;
806
- redo: Function;
870
+ pushState: (state: Type) => void;
871
+ undo: () => void;
872
+ redo: () => void;
807
873
  undoAvailable: boolean;
808
874
  redoAvailable: boolean;
809
875
  };
@@ -870,7 +936,7 @@ export declare function useSettingsManager(): SettingsManagerState;
870
936
  export declare function useShortcuts({ options, shortcuts, useCategories }: UseShortcutsParams): void;
871
937
 
872
938
  declare interface UseShortcutsParams {
873
- options: Record<string, Record<string, Function>> | Record<string, Function>;
939
+ options: Record<string, Record<string, (event: KeyboardEvent) => void>> | Record<string, (event: KeyboardEvent) => void>;
874
940
  shortcuts?: Record<string, Record<string, string[]>> | Record<string, string[]>;
875
941
  useCategories?: boolean;
876
942
  }
@@ -944,7 +1010,7 @@ declare class VirtualBase extends EventEmitter<EventNamesMap> {
944
1010
  open(..._args: unknown[]): unknown;
945
1011
  get path(): string;
946
1012
  /**
947
- * Returns path without using alias
1013
+ * Returns path without using this item's alias
948
1014
  */
949
1015
  get displayPath(): string;
950
1016
  /**
@@ -968,10 +1034,43 @@ declare interface VirtualBaseJson {
968
1034
  }
969
1035
 
970
1036
  export declare class VirtualDriveConfig {
1037
+ saveData: VirtualDriveConfigOptions["saveData"];
1038
+ defaultData: VirtualDriveConfigOptions["defaultData"];
971
1039
  constructor(options?: OptionalInterface<VirtualDriveConfigOptions>);
972
1040
  }
973
1041
 
974
1042
  declare interface VirtualDriveConfigOptions {
1043
+ /**
1044
+ * Enables persistent storage of the virtual drive
1045
+ * @default true
1046
+ */
1047
+ saveData: boolean;
1048
+ /**
1049
+ * Configure the data that is loaded initially when ProzillaOS is opened
1050
+ */
1051
+ defaultData: {
1052
+ /**
1053
+ * Include pictures folder in default data
1054
+ * @default true
1055
+ */
1056
+ includePicturesFolder?: boolean;
1057
+ /**
1058
+ * Include documents folder in default data
1059
+ * @default true
1060
+ */
1061
+ includeDocumentsFolder?: boolean;
1062
+ /**
1063
+ * Include desktop folder in default data
1064
+ * @default true
1065
+ */
1066
+ includeDesktopFolder?: boolean;
1067
+ /**
1068
+ * Include source tree folder in default data
1069
+ * @default true
1070
+ */
1071
+ includeSourceTree?: boolean;
1072
+ loadData?: (virtualRoot: VirtualRoot) => void;
1073
+ };
975
1074
  }
976
1075
 
977
1076
  /**
@@ -983,9 +1082,9 @@ export declare class VirtualFile extends VirtualBase {
983
1082
  content: OptionalStringProperty;
984
1083
  static NON_TEXT_EXTENSIONS: string[];
985
1084
  static EVENT_NAMES: {
986
- CONTENT_CHANGE: string;
1085
+ contentChange: string;
987
1086
  };
988
- constructor(name: string, extension?: string | undefined);
1087
+ constructor(name: string, extension?: string);
989
1088
  setAlias(alias: string): this;
990
1089
  /**
991
1090
  * Sets the source of this file and removes the content
@@ -1009,6 +1108,7 @@ export declare class VirtualFile extends VirtualBase {
1009
1108
  getIconUrl(): string;
1010
1109
  getType(): string;
1011
1110
  toJSON(): VirtualFileJson | null;
1111
+ static removeFileScheme(source: string): string;
1012
1112
  }
1013
1113
 
1014
1114
  declare interface VirtualFileJson extends VirtualBaseJson {
@@ -1048,8 +1148,8 @@ export declare class VirtualFolder extends VirtualBase {
1048
1148
  files: (VirtualFile | VirtualFileLink)[];
1049
1149
  type: number | undefined;
1050
1150
  static TYPE: {
1051
- GENERAL: number;
1052
- MEDIA: number;
1151
+ general: number;
1152
+ media: number;
1053
1153
  };
1054
1154
  constructor(name: string, type?: number);
1055
1155
  setAlias(alias: string): this;
@@ -1085,9 +1185,9 @@ export declare class VirtualFolder extends VirtualBase {
1085
1185
  */
1086
1186
  createFileLink(name: string, callback?: (newFileLink: VirtualFileLink | VirtualFile) => void): this;
1087
1187
  /**
1088
- * Creates files based on an array of objects with file names and extensions
1188
+ * Creates file links based on an array of objects with file names and extensions
1089
1189
  */
1090
- createFileLinks(files: {
1190
+ createFileLinks(fileLinks: {
1091
1191
  name: string;
1092
1192
  }[]): this;
1093
1193
  /**
@@ -1124,16 +1224,19 @@ export declare class VirtualFolder extends VirtualBase {
1124
1224
  delete(): void;
1125
1225
  /**
1126
1226
  * Returns all files inside this folder
1227
+ * @param showHidden Whether to include hidden files
1127
1228
  */
1128
1229
  getFiles(showHidden?: boolean): VirtualFile[];
1129
1230
  /**
1130
1231
  * Returns all sub-folders inside this folder
1232
+ * @param showHidden Whether to include hidden folders
1131
1233
  */
1132
1234
  getSubFolders(showHidden?: boolean): VirtualFolder[];
1133
1235
  /**
1134
- * Returns the amount of files and sub-folders inside this folder
1236
+ * Returns the amount of files and sub-folders inside this folder
1237
+ * @param includeHidden Whether to include hidden files and folders in the count
1135
1238
  */
1136
- getItemCount(showHidden?: boolean): number;
1239
+ getItemCount(includeHidden?: boolean): number;
1137
1240
  isFolder(): boolean;
1138
1241
  getIconUrl(): string;
1139
1242
  toJSON(): VirtualFolderJson | null;
@@ -1183,7 +1286,7 @@ export declare class VirtualRoot extends VirtualFolder {
1183
1286
  loadedDefaultData: boolean;
1184
1287
  systemManager: SystemManager;
1185
1288
  static EVENT_NAMES: {
1186
- ERROR: string;
1289
+ error: string;
1187
1290
  };
1188
1291
  constructor(systemManager: SystemManager);
1189
1292
  loadDefaultData(): void;
@@ -1243,14 +1346,14 @@ declare interface WindowOptions {
1243
1346
 
1244
1347
  export declare interface WindowProps extends WindowOptions {
1245
1348
  fullscreen?: boolean;
1246
- onInteract?: Function;
1349
+ onInteract?: () => void;
1247
1350
  setTitle?: React.Dispatch<React.SetStateAction<string>>;
1248
1351
  setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
1249
1352
  close?: (event?: Event) => void;
1250
1353
  focus?: (event: Event, force?: boolean) => void;
1251
1354
  active?: boolean;
1252
1355
  minimized?: boolean;
1253
- toggleMinimized?: Function;
1356
+ toggleMinimized?: (event?: Event) => void;
1254
1357
  index?: number;
1255
1358
  standalone?: boolean;
1256
1359
  }
@@ -1283,24 +1386,53 @@ export declare class WindowsManager {
1283
1386
  windows: {
1284
1387
  [id: string]: WindowOptions;
1285
1388
  };
1286
- updateWindows: Function;
1389
+ updateWindows: (window: WindowsManager["windows"]) => void;
1287
1390
  startupComplete: boolean;
1288
1391
  constructor(systemManager: SystemManager, trackingManager: TrackingManager);
1392
+ /**
1393
+ * Open a window for an app
1394
+ */
1289
1395
  open(appId: string, options?: WindowOptions | null): object | null;
1396
+ /**
1397
+ * Opens a file with the associated app or by a method specified by the file scheme
1398
+ * @returns Opened window
1399
+ */
1290
1400
  openFile(file: VirtualFile, options?: object): object | null;
1401
+ /**
1402
+ * Close a window
1403
+ */
1291
1404
  close(windowId: string): void;
1405
+ /**
1406
+ * Focus on a specific window
1407
+ */
1292
1408
  focus(windowId: string): void;
1409
+ /**
1410
+ * Check whether a window is focused
1411
+ */
1293
1412
  isFocused(windowId: string): boolean | undefined;
1413
+ /**
1414
+ * Check if any window is focused
1415
+ */
1294
1416
  isAnyFocused(): boolean;
1295
1417
  /**
1418
+ * Change the minimized state of a window
1296
1419
  * @param minimized - Leave as undefined to toggle the window's minimization state
1297
1420
  */
1298
1421
  setMinimized(windowId: string, minimized?: boolean): void;
1422
+ /**
1423
+ * Minimize all windows
1424
+ */
1299
1425
  minimizeAll(): void;
1426
+ /**
1427
+ * Check if an app has an open window
1428
+ */
1300
1429
  isAppActive(appId: string): boolean;
1430
+ /**
1431
+ * Get an opened window of a certain app
1432
+ */
1301
1433
  getAppWindowId(appId: string): string | null;
1302
- setUpdateWindows(updateWindows: Function): void;
1303
- startup(appIds: string[], options: {}): void;
1434
+ setUpdateWindows(updateWindows: WindowsManager["updateWindows"]): void;
1435
+ startup(appIds: string[], options: Record<string, unknown>): void;
1304
1436
  get windowIds(): string[];
1305
1437
  }
1306
1438