prozilla-os 1.3.2 → 1.3.3

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"];
@@ -608,6 +649,12 @@ declare class Skin {
608
649
  }
609
650
 
610
651
  declare interface SkinOptions {
652
+ /**
653
+ * SVG icon for the system
654
+ * @default
655
+ * "https://os.prozilla.dev/icon.svg"
656
+ */
657
+ systemIcon: string;
611
658
  /**
612
659
  * Replacements for app icons based on app id
613
660
  */
@@ -638,6 +685,7 @@ declare interface SkinOptions {
638
685
  info?: string;
639
686
  text?: string;
640
687
  code?: string;
688
+ external?: string;
641
689
  };
642
690
  /**
643
691
  * URLs of icons for types of folders
@@ -683,7 +731,7 @@ export declare class SystemManager {
683
731
  readonly trackingConfig: TrackingConfig;
684
732
  readonly windowsConfig: WindowsConfig;
685
733
  readonly virtualDriveConfig: VirtualDriveConfig;
686
- constructor({ systemName, tagLine, skin, desktopConfig, appsConfig, miscConfig, modalsConfig, taskbarConfig, trackingConfig, windowsConfig, virtualDriveConfig }: SystemManagerParams);
734
+ constructor({ systemName, tagLine, skin, desktopConfig, appsConfig, miscConfig, modalsConfig, taskbarConfig, trackingConfig, windowsConfig, virtualDriveConfig, }: SystemManagerParams);
687
735
  private loadSkin;
688
736
  getUptime(precision?: number): string;
689
737
  }
@@ -741,8 +789,14 @@ declare interface TextEditorProps extends WindowProps {
741
789
  export declare const THEMES: Record<number, string | null>;
742
790
 
743
791
  export declare class TimeManager {
744
- static startDate: Date;
792
+ static START_DATE: Date;
793
+ /**
794
+ * Resets the time
795
+ */
745
796
  static reset(): void;
797
+ /**
798
+ * Get the current uptime
799
+ */
746
800
  static getUptime(precision?: number): string;
747
801
  }
748
802
 
@@ -754,7 +808,7 @@ declare interface ToggleActionProps extends ActionProps {
754
808
 
755
809
  export declare class TrackingConfig {
756
810
  enabled: TrackingConfigOptions["enabled"];
757
- GAMeasurementId: TrackingConfigOptions["GAMeasurementId"];
811
+ googleAnalyticsMeasurementId: TrackingConfigOptions["GAMeasurementId"];
758
812
  constructor(options?: OptionalInterface<TrackingConfigOptions>);
759
813
  }
760
814
 
@@ -801,9 +855,9 @@ declare interface UseContextMenuParams {
801
855
  export declare function useHistory<Type>(initialState: Type): {
802
856
  history: Type[];
803
857
  stateIndex: number;
804
- pushState: Function;
805
- undo: Function;
806
- redo: Function;
858
+ pushState: (state: Type) => void;
859
+ undo: () => void;
860
+ redo: () => void;
807
861
  undoAvailable: boolean;
808
862
  redoAvailable: boolean;
809
863
  };
@@ -870,7 +924,7 @@ export declare function useSettingsManager(): SettingsManagerState;
870
924
  export declare function useShortcuts({ options, shortcuts, useCategories }: UseShortcutsParams): void;
871
925
 
872
926
  declare interface UseShortcutsParams {
873
- options: Record<string, Record<string, Function>> | Record<string, Function>;
927
+ options: Record<string, Record<string, (event: KeyboardEvent) => void>> | Record<string, (event: KeyboardEvent) => void>;
874
928
  shortcuts?: Record<string, Record<string, string[]>> | Record<string, string[]>;
875
929
  useCategories?: boolean;
876
930
  }
@@ -968,10 +1022,43 @@ declare interface VirtualBaseJson {
968
1022
  }
969
1023
 
970
1024
  export declare class VirtualDriveConfig {
1025
+ saveData: VirtualDriveConfigOptions["saveData"];
1026
+ defaultData: VirtualDriveConfigOptions["defaultData"];
971
1027
  constructor(options?: OptionalInterface<VirtualDriveConfigOptions>);
972
1028
  }
973
1029
 
974
1030
  declare interface VirtualDriveConfigOptions {
1031
+ /**
1032
+ * Enables persistent storage of the virtual drive
1033
+ * @default true
1034
+ */
1035
+ saveData: boolean;
1036
+ /**
1037
+ * Configure the data that is loaded initially when ProzillaOS is opened
1038
+ */
1039
+ defaultData: {
1040
+ /**
1041
+ * Include pictures folder in default data
1042
+ * @default true
1043
+ */
1044
+ includePicturesFolder?: boolean;
1045
+ /**
1046
+ * Include documents folder in default data
1047
+ * @default true
1048
+ */
1049
+ includeDocumentsFolder?: boolean;
1050
+ /**
1051
+ * Include desktop folder in default data
1052
+ * @default true
1053
+ */
1054
+ includeDesktopFolder?: boolean;
1055
+ /**
1056
+ * Include source tree folder in default data
1057
+ * @default true
1058
+ */
1059
+ includeSourceTree?: boolean;
1060
+ loadData?: (virtualRoot: VirtualRoot) => void;
1061
+ };
975
1062
  }
976
1063
 
977
1064
  /**
@@ -983,9 +1070,9 @@ export declare class VirtualFile extends VirtualBase {
983
1070
  content: OptionalStringProperty;
984
1071
  static NON_TEXT_EXTENSIONS: string[];
985
1072
  static EVENT_NAMES: {
986
- CONTENT_CHANGE: string;
1073
+ contentChange: string;
987
1074
  };
988
- constructor(name: string, extension?: string | undefined);
1075
+ constructor(name: string, extension?: string);
989
1076
  setAlias(alias: string): this;
990
1077
  /**
991
1078
  * Sets the source of this file and removes the content
@@ -1009,6 +1096,7 @@ export declare class VirtualFile extends VirtualBase {
1009
1096
  getIconUrl(): string;
1010
1097
  getType(): string;
1011
1098
  toJSON(): VirtualFileJson | null;
1099
+ static removeFileScheme(source: string): string;
1012
1100
  }
1013
1101
 
1014
1102
  declare interface VirtualFileJson extends VirtualBaseJson {
@@ -1048,8 +1136,8 @@ export declare class VirtualFolder extends VirtualBase {
1048
1136
  files: (VirtualFile | VirtualFileLink)[];
1049
1137
  type: number | undefined;
1050
1138
  static TYPE: {
1051
- GENERAL: number;
1052
- MEDIA: number;
1139
+ general: number;
1140
+ media: number;
1053
1141
  };
1054
1142
  constructor(name: string, type?: number);
1055
1143
  setAlias(alias: string): this;
@@ -1183,7 +1271,7 @@ export declare class VirtualRoot extends VirtualFolder {
1183
1271
  loadedDefaultData: boolean;
1184
1272
  systemManager: SystemManager;
1185
1273
  static EVENT_NAMES: {
1186
- ERROR: string;
1274
+ error: string;
1187
1275
  };
1188
1276
  constructor(systemManager: SystemManager);
1189
1277
  loadDefaultData(): void;
@@ -1243,14 +1331,14 @@ declare interface WindowOptions {
1243
1331
 
1244
1332
  export declare interface WindowProps extends WindowOptions {
1245
1333
  fullscreen?: boolean;
1246
- onInteract?: Function;
1334
+ onInteract?: () => void;
1247
1335
  setTitle?: React.Dispatch<React.SetStateAction<string>>;
1248
1336
  setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
1249
1337
  close?: (event?: Event) => void;
1250
1338
  focus?: (event: Event, force?: boolean) => void;
1251
1339
  active?: boolean;
1252
1340
  minimized?: boolean;
1253
- toggleMinimized?: Function;
1341
+ toggleMinimized?: (event?: Event) => void;
1254
1342
  index?: number;
1255
1343
  standalone?: boolean;
1256
1344
  }
@@ -1283,24 +1371,53 @@ export declare class WindowsManager {
1283
1371
  windows: {
1284
1372
  [id: string]: WindowOptions;
1285
1373
  };
1286
- updateWindows: Function;
1374
+ updateWindows: (window: WindowsManager["windows"]) => void;
1287
1375
  startupComplete: boolean;
1288
1376
  constructor(systemManager: SystemManager, trackingManager: TrackingManager);
1377
+ /**
1378
+ * Open a window for an app
1379
+ */
1289
1380
  open(appId: string, options?: WindowOptions | null): object | null;
1381
+ /**
1382
+ * Opens a file with the associated app or by a method specified by the file scheme
1383
+ * @returns Opened window
1384
+ */
1290
1385
  openFile(file: VirtualFile, options?: object): object | null;
1386
+ /**
1387
+ * Close a window
1388
+ */
1291
1389
  close(windowId: string): void;
1390
+ /**
1391
+ * Focus on a specific window
1392
+ */
1292
1393
  focus(windowId: string): void;
1394
+ /**
1395
+ * Check whether a window is focused
1396
+ */
1293
1397
  isFocused(windowId: string): boolean | undefined;
1398
+ /**
1399
+ * Check if any window is focused
1400
+ */
1294
1401
  isAnyFocused(): boolean;
1295
1402
  /**
1403
+ * Change the minimized state of a window
1296
1404
  * @param minimized - Leave as undefined to toggle the window's minimization state
1297
1405
  */
1298
1406
  setMinimized(windowId: string, minimized?: boolean): void;
1407
+ /**
1408
+ * Minimize all windows
1409
+ */
1299
1410
  minimizeAll(): void;
1411
+ /**
1412
+ * Check if an app has an open window
1413
+ */
1300
1414
  isAppActive(appId: string): boolean;
1415
+ /**
1416
+ * Get an opened window of a certain app
1417
+ */
1301
1418
  getAppWindowId(appId: string): string | null;
1302
- setUpdateWindows(updateWindows: Function): void;
1303
- startup(appIds: string[], options: {}): void;
1419
+ setUpdateWindows(updateWindows: WindowsManager["updateWindows"]): void;
1420
+ startup(appIds: string[], options: Record<string, unknown>): void;
1304
1421
  get windowIds(): string[];
1305
1422
  }
1306
1423