@prozilla-os/core 1.3.11 → 1.3.13
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/LICENSE +20 -20
- package/README.md +186 -186
- package/dist/main.d.ts +452 -83
- package/dist/main.js +7787 -7553
- package/dist/main.js.map +1 -1
- package/package.json +2 -2
package/dist/main.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Context } from 'react';
|
|
1
2
|
import { FC } from 'react';
|
|
2
3
|
import { HTMLAttributeAnchorTarget } from 'react';
|
|
3
4
|
import { IconProp } from '@fortawesome/fontawesome-svg-core';
|
|
@@ -12,17 +13,24 @@ import { Ref } from 'react';
|
|
|
12
13
|
import { UaEventOptions } from 'react-ga4/types/ga4';
|
|
13
14
|
import { default as utilStyles } from './utils.module.css';
|
|
14
15
|
|
|
15
|
-
declare interface ActionProps {
|
|
16
|
+
export declare interface ActionProps {
|
|
17
|
+
/** ID of the action */
|
|
16
18
|
actionId?: string;
|
|
19
|
+
/** Label of the action */
|
|
17
20
|
label?: string;
|
|
21
|
+
/** Icon for the action */
|
|
18
22
|
icon?: string | object;
|
|
23
|
+
/** Keyboard shortcut for the action */
|
|
19
24
|
shortcut?: string[];
|
|
25
|
+
/** Function that handles the trigger event for the action */
|
|
20
26
|
onTrigger?: (event?: Event, triggerParams?: unknown, ...args: unknown[]) => void;
|
|
21
27
|
children?: ReactNode;
|
|
28
|
+
/** Whether the action should be disabled */
|
|
22
29
|
disabled?: boolean;
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
/**
|
|
33
|
+
* Component that renders a collection of actions (e.g., as a context menu or a header menu) and handles keyboard shortcuts
|
|
26
34
|
* @example
|
|
27
35
|
* <ClickAction
|
|
28
36
|
* label="Reload"
|
|
@@ -35,20 +43,34 @@ declare interface ActionProps {
|
|
|
35
43
|
*/
|
|
36
44
|
export declare function Actions({ children, mode, className, onAnyTrigger, triggerParams, avoidTaskbar }: ActionsProps): ReactElement;
|
|
37
45
|
|
|
38
|
-
declare interface ActionsProps {
|
|
46
|
+
export declare interface ActionsProps {
|
|
39
47
|
mode?: string;
|
|
48
|
+
/** `className` prop for the container */
|
|
40
49
|
className?: string;
|
|
50
|
+
/** Function that handles the trigger event for all actions */
|
|
41
51
|
onAnyTrigger?: (event: Event, triggerParams: unknown, ...args: unknown[]) => void;
|
|
42
52
|
children?: ReactNode;
|
|
53
|
+
/** The parameters to pass whenever an action is triggered */
|
|
43
54
|
triggerParams?: unknown;
|
|
55
|
+
/** Whether the actions should automatically orient themselves to not overlap with the taskbar */
|
|
44
56
|
avoidTaskbar?: boolean;
|
|
45
57
|
[key: string]: unknown;
|
|
46
58
|
}
|
|
47
59
|
|
|
48
|
-
declare interface AlertParams {
|
|
60
|
+
export declare interface AlertParams {
|
|
61
|
+
/**
|
|
62
|
+
* The title of the alert
|
|
63
|
+
* @default "Alert"
|
|
64
|
+
*/
|
|
49
65
|
title: string;
|
|
66
|
+
/** The body of the alert */
|
|
50
67
|
text: string;
|
|
68
|
+
/** The URL of the icon of the alert */
|
|
51
69
|
iconUrl?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The size of the alert modal
|
|
72
|
+
* @default new Vector2(300, 150)
|
|
73
|
+
*/
|
|
52
74
|
size?: Vector2;
|
|
53
75
|
single?: boolean;
|
|
54
76
|
}
|
|
@@ -71,9 +93,9 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
|
|
|
71
93
|
*/
|
|
72
94
|
windowContent: FC<AppProps>;
|
|
73
95
|
/**
|
|
74
|
-
* Default options that get passed to the {@link
|
|
96
|
+
* Default options that get passed to the {@link App.windowContent} component
|
|
75
97
|
*/
|
|
76
|
-
windowOptions?: Partial<AppProps> &
|
|
98
|
+
windowOptions?: Partial<AppProps> & DefaultWindowOptions;
|
|
77
99
|
/**
|
|
78
100
|
* Description of this application
|
|
79
101
|
*/
|
|
@@ -116,26 +138,29 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
|
|
|
116
138
|
isActive: boolean;
|
|
117
139
|
isPinned?: boolean;
|
|
118
140
|
isInstalled: boolean;
|
|
119
|
-
constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: Partial<AppProps> &
|
|
141
|
+
constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: Partial<AppProps> & DefaultWindowOptions);
|
|
142
|
+
/**
|
|
143
|
+
* Returns the component that renders the content of a window for this app
|
|
144
|
+
*/
|
|
120
145
|
WindowContent: (props: AppProps) => JSX_2.Element | null;
|
|
121
146
|
/**
|
|
122
|
-
*
|
|
147
|
+
* Sets the display name of this application
|
|
123
148
|
*/
|
|
124
149
|
setName(name: string): this;
|
|
125
150
|
/**
|
|
126
|
-
*
|
|
151
|
+
* Sets the description of this application
|
|
127
152
|
*/
|
|
128
153
|
setDescription(description: App["description"]): this;
|
|
129
154
|
/**
|
|
130
|
-
*
|
|
155
|
+
* Sets the URL of the icon of this application
|
|
131
156
|
*/
|
|
132
157
|
setIconUrl(iconUrl: App["iconUrl"]): this;
|
|
133
158
|
/**
|
|
134
|
-
*
|
|
159
|
+
* Sets the role of this application
|
|
135
160
|
*/
|
|
136
161
|
setRole(role: string | null): this;
|
|
137
162
|
/**
|
|
138
|
-
*
|
|
163
|
+
* Sets the associated extensions of this application
|
|
139
164
|
*/
|
|
140
165
|
setAssociatedExtensions(extensions: string[] | null): this;
|
|
141
166
|
/**
|
|
@@ -151,11 +176,11 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
|
|
|
151
176
|
*/
|
|
152
177
|
setInstalled(installed: boolean): this;
|
|
153
178
|
/**
|
|
154
|
-
*
|
|
179
|
+
* Sets the category this application belongs to
|
|
155
180
|
*/
|
|
156
181
|
setCategory(category: typeof APP_CATEGORIES[number] | null): this;
|
|
157
182
|
/**
|
|
158
|
-
*
|
|
183
|
+
* Sets the metadata for this application
|
|
159
184
|
*/
|
|
160
185
|
setMetadata(metadata: AppMetadata | null): this;
|
|
161
186
|
/**
|
|
@@ -163,14 +188,14 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
|
|
|
163
188
|
*/
|
|
164
189
|
setShowDesktopIcon(showDesktopIcon: boolean): this;
|
|
165
190
|
/**
|
|
166
|
-
*
|
|
191
|
+
* Sets the default options for the {@link App.windowContent} component
|
|
167
192
|
*/
|
|
168
|
-
setWindowOptions(windowOptions: Partial<AppProps> &
|
|
193
|
+
setWindowOptions(windowOptions: Partial<AppProps> & DefaultWindowOptions): this;
|
|
169
194
|
}
|
|
170
195
|
|
|
171
196
|
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"];
|
|
172
197
|
|
|
173
|
-
declare interface AppMetadata {
|
|
198
|
+
export declare interface AppMetadata {
|
|
174
199
|
name: string;
|
|
175
200
|
version: `${number}.${number}.${number}`;
|
|
176
201
|
author: string;
|
|
@@ -206,16 +231,18 @@ export declare class AppsConfig {
|
|
|
206
231
|
getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
|
|
207
232
|
}
|
|
208
233
|
|
|
209
|
-
declare interface AppsConfigOptions {
|
|
234
|
+
export declare interface AppsConfigOptions {
|
|
210
235
|
/**
|
|
211
236
|
* An array of applications
|
|
212
237
|
*/
|
|
213
238
|
apps: App<WindowProps>[];
|
|
214
239
|
}
|
|
215
240
|
|
|
241
|
+
export declare const AUDIO_EXTENSIONS: string[];
|
|
242
|
+
|
|
216
243
|
export declare function Button({ className, href, children, icon, target, ...props }: ButtonProps): JSX_2.Element;
|
|
217
244
|
|
|
218
|
-
declare interface ButtonProps {
|
|
245
|
+
export declare interface ButtonProps {
|
|
219
246
|
className?: string;
|
|
220
247
|
href?: string;
|
|
221
248
|
icon?: IconProp;
|
|
@@ -226,7 +253,7 @@ declare interface ButtonProps {
|
|
|
226
253
|
|
|
227
254
|
export declare const ClickAction: MemoExoticComponent<({ actionId, label, shortcut, disabled, onTrigger, icon }: ClickActionProps) => JSX_2.Element>;
|
|
228
255
|
|
|
229
|
-
declare interface ClickActionProps extends ActionProps {
|
|
256
|
+
export declare interface ClickActionProps extends ActionProps {
|
|
230
257
|
icon?: string | object;
|
|
231
258
|
}
|
|
232
259
|
|
|
@@ -242,6 +269,14 @@ export declare function copyToClipboard(string: string, onSuccess?: (value: void
|
|
|
242
269
|
|
|
243
270
|
export declare function DefaultRoute(): JSX_2.Element;
|
|
244
271
|
|
|
272
|
+
export declare interface DefaultWindowOptions {
|
|
273
|
+
size?: Vector2;
|
|
274
|
+
[key: string]: unknown;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Component that renders the wallpaper and desktop icons
|
|
279
|
+
*/
|
|
245
280
|
export declare const Desktop: MemoExoticComponent<() => JSX_2.Element>;
|
|
246
281
|
|
|
247
282
|
export declare class DesktopConfig {
|
|
@@ -250,12 +285,14 @@ export declare class DesktopConfig {
|
|
|
250
285
|
constructor(options?: Partial<DesktopConfigOptions>);
|
|
251
286
|
}
|
|
252
287
|
|
|
253
|
-
declare interface DesktopConfigOptions {
|
|
288
|
+
export declare interface DesktopConfigOptions {
|
|
254
289
|
/**
|
|
290
|
+
* The default size of the icons
|
|
255
291
|
* @default 1
|
|
256
292
|
*/
|
|
257
293
|
defaultIconSize: 0 | 1 | 2;
|
|
258
294
|
/**
|
|
295
|
+
* The defailt direction of the icons
|
|
259
296
|
* 0: vertical, 1: horizontal
|
|
260
297
|
* @default 0
|
|
261
298
|
* */
|
|
@@ -264,36 +301,58 @@ declare interface DesktopConfigOptions {
|
|
|
264
301
|
|
|
265
302
|
export declare function DialogBox({ modal, params, children, ...props }: ModalProps): JSX_2.Element;
|
|
266
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Component that displays the contents of a directory
|
|
306
|
+
*/
|
|
267
307
|
export declare function DirectoryList({ directory, showHidden, folderClassName, fileClassName, className, onContextMenuFile, onContextMenuFolder, onOpenFile, onOpenFolder, allowMultiSelect, onSelectionChange, ...props }: DirectoryListProps): ReactElement | null;
|
|
268
308
|
|
|
269
|
-
declare interface DirectoryListProps {
|
|
309
|
+
export declare interface DirectoryListProps {
|
|
310
|
+
/** The directory to display */
|
|
270
311
|
directory: VirtualFolder;
|
|
312
|
+
/** Whether to show hidden files and folders */
|
|
271
313
|
showHidden?: boolean;
|
|
314
|
+
/** `className` prop for folders */
|
|
272
315
|
folderClassName?: string;
|
|
316
|
+
/** `className` prop for files */
|
|
273
317
|
fileClassName?: string;
|
|
318
|
+
/** `className` prop for this component */
|
|
274
319
|
className?: string;
|
|
320
|
+
/** Function that handles context menu interactions on files */
|
|
275
321
|
onContextMenuFile?: FileEventHandler;
|
|
322
|
+
/** Function that handles context menu interactions on folders */
|
|
276
323
|
onContextMenuFolder?: FolderEventHandler;
|
|
324
|
+
/** Function that handles file opening events */
|
|
277
325
|
onOpenFile?: FileEventHandler;
|
|
326
|
+
/** Function that handles folder opening events */
|
|
278
327
|
onOpenFolder?: FolderEventHandler;
|
|
328
|
+
/** Whether to allow multiple files and folders to be selected at the same time */
|
|
279
329
|
allowMultiSelect?: boolean;
|
|
330
|
+
/** Function that handles selection changes */
|
|
280
331
|
onSelectionChange?: (params: OnSelectionChangeParams) => void;
|
|
281
332
|
[key: string]: unknown;
|
|
282
333
|
}
|
|
283
334
|
|
|
284
335
|
export declare function Divider(): JSX_2.Element;
|
|
285
336
|
|
|
337
|
+
export declare function downloadUrl(url: string, name: string): void;
|
|
338
|
+
|
|
286
339
|
export declare function DropdownAction({ label, icon, children, showOnHover }: DropdownActionProps): ReactElement;
|
|
287
340
|
|
|
288
|
-
declare interface DropdownActionProps extends ActionProps {
|
|
341
|
+
export declare interface DropdownActionProps extends ActionProps {
|
|
289
342
|
showOnHover?: boolean;
|
|
290
343
|
}
|
|
291
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Component that opens a dropdown menu
|
|
347
|
+
*/
|
|
292
348
|
export declare function DropdownButton({ label, options, shortcuts }: DropdownButtonProps): JSX_2.Element;
|
|
293
349
|
|
|
294
|
-
declare interface DropdownButtonProps {
|
|
350
|
+
export declare interface DropdownButtonProps {
|
|
351
|
+
/** The label of the button */
|
|
295
352
|
label: string;
|
|
353
|
+
/** The options in the dropdown menu mapped to the function that handles their selection */
|
|
296
354
|
options: Record<string, () => void>;
|
|
355
|
+
/** The keyboard shortcut for options in the dropdown menu */
|
|
297
356
|
shortcuts: Record<string, string[]>;
|
|
298
357
|
}
|
|
299
358
|
|
|
@@ -303,11 +362,11 @@ declare class EventEmitter<EventMap extends EventNamesMap> {
|
|
|
303
362
|
/**
|
|
304
363
|
* Add event listener for an event
|
|
305
364
|
*/
|
|
306
|
-
on<Key extends keyof EventMap>(eventName: Key, callback:
|
|
365
|
+
on<Key extends keyof EventMap>(eventName: Key, callback: Listener): Listener;
|
|
307
366
|
/**
|
|
308
367
|
* Remove event listener for an event
|
|
309
368
|
*/
|
|
310
|
-
off<Key extends keyof EventMap>(eventName: Key, callback:
|
|
369
|
+
off<Key extends keyof EventMap>(eventName: Key, callback: Listener): void;
|
|
311
370
|
/**
|
|
312
371
|
* Dispatch event
|
|
313
372
|
*/
|
|
@@ -332,9 +391,9 @@ export declare type FolderEventHandler = (event: Event, folder: VirtualFolder) =
|
|
|
332
391
|
*/
|
|
333
392
|
export declare function formatShortcut(shortcut: string[]): string;
|
|
334
393
|
|
|
335
|
-
export declare function generateUrl(options:
|
|
394
|
+
export declare function generateUrl(options: GenerateUrlParams): string;
|
|
336
395
|
|
|
337
|
-
declare interface
|
|
396
|
+
export declare interface GenerateUrlParams {
|
|
338
397
|
appId?: string;
|
|
339
398
|
fullscreen?: boolean;
|
|
340
399
|
standalone?: boolean;
|
|
@@ -342,6 +401,9 @@ declare interface GenerateUrlOptions {
|
|
|
342
401
|
|
|
343
402
|
export declare function getViewportParams(): Record<string, string>;
|
|
344
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Component that shows a header menu at the top of a window
|
|
406
|
+
*/
|
|
345
407
|
export declare function HeaderMenu({ children, ...props }: ActionsProps): JSX_2.Element;
|
|
346
408
|
|
|
347
409
|
declare function Image_2({ className, src, ...props }: ImageProps): JSX_2.Element;
|
|
@@ -351,22 +413,27 @@ export declare const IMAGE_EXTENSIONS: string[];
|
|
|
351
413
|
|
|
352
414
|
export declare function ImagePreview({ source, className, onError, ...props }: ImagePreviewProps): JSX_2.Element;
|
|
353
415
|
|
|
354
|
-
declare interface ImagePreviewProps {
|
|
416
|
+
export declare interface ImagePreviewProps {
|
|
355
417
|
source: string;
|
|
356
418
|
className?: string;
|
|
357
419
|
onError?: () => void;
|
|
358
420
|
}
|
|
359
421
|
|
|
360
|
-
declare interface ImageProps {
|
|
422
|
+
export declare interface ImageProps {
|
|
361
423
|
className?: string;
|
|
362
424
|
src?: string;
|
|
363
425
|
[key: string]: unknown;
|
|
364
426
|
}
|
|
365
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Button component that handles single and double clicks
|
|
430
|
+
*/
|
|
366
431
|
export declare function Interactable({ onClick, onDoubleClick, children, ...props }: InteractableProps): JSX_2.Element;
|
|
367
432
|
|
|
368
|
-
declare interface InteractableProps {
|
|
433
|
+
export declare interface InteractableProps {
|
|
434
|
+
/** Function that handles single clicks */
|
|
369
435
|
onClick?: (event: MouseEvent) => void;
|
|
436
|
+
/** Function that handles double clicks */
|
|
370
437
|
onDoubleClick?: (event: MouseEvent) => void;
|
|
371
438
|
children: ReactNode;
|
|
372
439
|
[key: string]: unknown;
|
|
@@ -374,12 +441,16 @@ declare interface InteractableProps {
|
|
|
374
441
|
|
|
375
442
|
export declare function isValidUrl(string: string): boolean;
|
|
376
443
|
|
|
444
|
+
declare type Listener = (data: unknown) => void;
|
|
445
|
+
|
|
446
|
+
export declare const MEDIA_EXTENSIONS: string[];
|
|
447
|
+
|
|
377
448
|
export declare class MiscConfig {
|
|
378
449
|
doubleClickDelay: MiscConfigOptions["doubleClickDelay"];
|
|
379
450
|
constructor(options?: Partial<MiscConfigOptions>);
|
|
380
451
|
}
|
|
381
452
|
|
|
382
|
-
declare interface MiscConfigOptions {
|
|
453
|
+
export declare interface MiscConfigOptions {
|
|
383
454
|
/**
|
|
384
455
|
* The maximum time between two clicks to register as a double click (in ms)
|
|
385
456
|
* @default 250
|
|
@@ -387,17 +458,49 @@ declare interface MiscConfigOptions {
|
|
|
387
458
|
doubleClickDelay: number;
|
|
388
459
|
}
|
|
389
460
|
|
|
390
|
-
|
|
461
|
+
/**
|
|
462
|
+
* Represents a modal window
|
|
463
|
+
*/
|
|
464
|
+
export declare class Modal {
|
|
465
|
+
/**
|
|
466
|
+
* The size of this modal
|
|
467
|
+
* @default new Vector2(400, 200)
|
|
468
|
+
*/
|
|
391
469
|
size: Vector2;
|
|
470
|
+
/**
|
|
471
|
+
* The position of this modal
|
|
472
|
+
* @default new Vector2(300, 300)
|
|
473
|
+
*/
|
|
392
474
|
position: Vector2;
|
|
475
|
+
/**
|
|
476
|
+
* The icon of this modal
|
|
477
|
+
* @default null
|
|
478
|
+
*/
|
|
393
479
|
icon: string | null;
|
|
480
|
+
/**
|
|
481
|
+
* The title of this modal
|
|
482
|
+
* @default null
|
|
483
|
+
*/
|
|
394
484
|
title: string | null;
|
|
485
|
+
/**
|
|
486
|
+
* The manager that handles all modals
|
|
487
|
+
*/
|
|
395
488
|
modalsManager: ModalsManager | null;
|
|
489
|
+
/**
|
|
490
|
+
* The content of this modal
|
|
491
|
+
* @default null
|
|
492
|
+
*/
|
|
396
493
|
element: FC<ModalProps> | null;
|
|
397
494
|
props: object;
|
|
398
495
|
callback: ((...args: unknown[]) => void) | null;
|
|
496
|
+
/** The ID of this modal */
|
|
399
497
|
id: number | null;
|
|
498
|
+
/**
|
|
499
|
+
* Whether this modal can be dismissed (e.g., by pressing ESC)
|
|
500
|
+
* @default true
|
|
501
|
+
*/
|
|
400
502
|
dismissible: boolean;
|
|
503
|
+
/** Timestamp of the most recent interaction with this modal */
|
|
401
504
|
lastInteraction?: number;
|
|
402
505
|
constructor(element: Modal["element"], callback?: Modal["callback"]);
|
|
403
506
|
setIcon(icon: string): Modal;
|
|
@@ -416,6 +519,7 @@ declare class Modal {
|
|
|
416
519
|
}
|
|
417
520
|
|
|
418
521
|
export declare interface ModalProps {
|
|
522
|
+
/** */
|
|
419
523
|
modal?: Modal;
|
|
420
524
|
params?: {
|
|
421
525
|
appId?: string;
|
|
@@ -439,7 +543,7 @@ export declare class ModalsConfig {
|
|
|
439
543
|
constructor(options?: Partial<ModalsConfigOptions>);
|
|
440
544
|
}
|
|
441
545
|
|
|
442
|
-
declare interface ModalsConfigOptions {
|
|
546
|
+
export declare interface ModalsConfigOptions {
|
|
443
547
|
/**
|
|
444
548
|
* Default size of a dialog box
|
|
445
549
|
* @default new Vector2(400, 200)
|
|
@@ -452,71 +556,126 @@ declare interface ModalsConfigOptions {
|
|
|
452
556
|
defaultFileSelectorSize: Vector2;
|
|
453
557
|
}
|
|
454
558
|
|
|
559
|
+
/**
|
|
560
|
+
* Manages the opening, closing and ordering of modals
|
|
561
|
+
*/
|
|
455
562
|
export declare class ModalsManager {
|
|
563
|
+
/** Maps every modal ID to the corresponding modal */
|
|
456
564
|
modals: Record<string, Modal>;
|
|
457
565
|
containerRef?: MutableRefObject<HTMLElement>;
|
|
566
|
+
/** Function that handles changes to modals */
|
|
458
567
|
updateModals: (modals: ModalsManager["modals"]) => void;
|
|
459
568
|
/**
|
|
569
|
+
* Opens a modal
|
|
460
570
|
* @param single - Set to false to preserve other open modals
|
|
461
571
|
*/
|
|
462
572
|
open(modal: Modal, single?: boolean): void;
|
|
573
|
+
/**
|
|
574
|
+
* Closes a modal
|
|
575
|
+
* @param modalId The ID of the modal to close
|
|
576
|
+
*/
|
|
463
577
|
close(modalId: string | number, sendModalsUpdate?: boolean): void;
|
|
578
|
+
/**
|
|
579
|
+
* Brings a modal into focus
|
|
580
|
+
* @param modalId The ID of the modal to bring into focus
|
|
581
|
+
*/
|
|
464
582
|
focus(modalId: string): void;
|
|
465
583
|
setUpdateModals(updateModals: ModalsManager["updateModals"]): void;
|
|
584
|
+
/**
|
|
585
|
+
* Returns the IDs of all open modals
|
|
586
|
+
*/
|
|
466
587
|
get modalIds(): string[];
|
|
467
588
|
static getModalIconUrl(name: string): string;
|
|
468
589
|
}
|
|
469
590
|
|
|
470
|
-
declare
|
|
591
|
+
export declare const modalsManagerContext: Context<ModalsManagerState>;
|
|
471
592
|
|
|
593
|
+
export declare type ModalsManagerState = ModalsManager | undefined;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Component that renders all active modals
|
|
597
|
+
*/
|
|
472
598
|
export declare const ModalsView: MemoExoticComponent<() => JSX_2.Element>;
|
|
473
599
|
|
|
474
600
|
export declare function NoRoute(): JSX_2.Element;
|
|
475
601
|
|
|
602
|
+
export declare interface NoRouteProps {
|
|
603
|
+
/**
|
|
604
|
+
* Title of the route
|
|
605
|
+
* @default "404: Not Found"
|
|
606
|
+
*/
|
|
607
|
+
title: string;
|
|
608
|
+
}
|
|
609
|
+
|
|
476
610
|
export declare interface OnSelectionChangeParams {
|
|
611
|
+
/** The selected files */
|
|
477
612
|
files?: string[];
|
|
613
|
+
/** The selected folders */
|
|
478
614
|
folders?: string[];
|
|
615
|
+
/** The directory the selection was made in */
|
|
479
616
|
directory?: VirtualFolder;
|
|
480
617
|
}
|
|
481
618
|
|
|
482
619
|
export declare function openUrl(url: string, target?: HTMLAttributeAnchorTarget): void;
|
|
483
620
|
|
|
484
|
-
declare type OpenWindowedModal = (params: OpenWindowedModalParams) => Modal;
|
|
621
|
+
export declare type OpenWindowedModal = (params: OpenWindowedModalParams) => Modal;
|
|
485
622
|
|
|
486
|
-
declare interface OpenWindowedModalParams {
|
|
623
|
+
export declare interface OpenWindowedModalParams {
|
|
624
|
+
/** The ID of the associated app */
|
|
487
625
|
appId?: string;
|
|
626
|
+
/** The URL of the icon of the modal */
|
|
488
627
|
iconUrl?: string;
|
|
628
|
+
/** The title of the modal */
|
|
489
629
|
title?: string;
|
|
630
|
+
/** The size of the modal */
|
|
490
631
|
size: Vector2;
|
|
632
|
+
/** The modal component */
|
|
491
633
|
Modal: FC<ModalProps>;
|
|
492
634
|
single?: boolean;
|
|
493
635
|
fullscreen?: WindowProps["fullscreen"];
|
|
494
636
|
}
|
|
495
637
|
|
|
496
|
-
declare type OptionalStringProperty = string | null | undefined;
|
|
638
|
+
export declare type OptionalStringProperty = string | null | undefined;
|
|
497
639
|
|
|
640
|
+
/**
|
|
641
|
+
* Component that calls a function when the user clicks outside of it
|
|
642
|
+
*/
|
|
498
643
|
export declare const OutsideClickListener: MemoExoticComponent<({ onOutsideClick, children }: OutsideClickListenerProps) => JSX_2.Element>;
|
|
499
644
|
|
|
500
|
-
declare interface OutsideClickListenerProps {
|
|
645
|
+
export declare interface OutsideClickListenerProps {
|
|
646
|
+
/** Function that handles clicks outside of this component */
|
|
501
647
|
onOutsideClick: (event: Event) => void;
|
|
502
648
|
children: ReactNode;
|
|
503
649
|
}
|
|
504
650
|
|
|
651
|
+
/**
|
|
652
|
+
* Component that renders a progress bar
|
|
653
|
+
*/
|
|
505
654
|
export declare function ProgressBar({ fillPercentage, fillColor, backgroundColor, align, className }: ProgressBarProps): JSX_2.Element;
|
|
506
655
|
|
|
507
|
-
declare interface ProgressBarProps {
|
|
656
|
+
export declare interface ProgressBarProps {
|
|
657
|
+
/** The amount of progress, as a percentage */
|
|
508
658
|
fillPercentage: number;
|
|
659
|
+
/** The CSS color to use for the filled part of the progress bar */
|
|
509
660
|
fillColor?: string;
|
|
661
|
+
/** The CSS background color of the progress bar */
|
|
510
662
|
backgroundColor?: string;
|
|
511
663
|
align?: "left";
|
|
664
|
+
/** `className` prop for the progress bar */
|
|
512
665
|
className?: string;
|
|
513
666
|
}
|
|
514
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Main component that contains everything
|
|
670
|
+
*/
|
|
515
671
|
export declare const ProzillaOS: NamedExoticComponent<ProzillaOSProps>;
|
|
516
672
|
|
|
517
|
-
declare interface ProzillaOSProps {
|
|
673
|
+
export declare interface ProzillaOSProps {
|
|
674
|
+
/** The name of the system */
|
|
518
675
|
systemName?: string;
|
|
676
|
+
/** The tagline/short description of the system */
|
|
519
677
|
tagLine?: string;
|
|
678
|
+
/** The system configuration */
|
|
520
679
|
config?: {
|
|
521
680
|
apps?: Partial<AppsConfigOptions>;
|
|
522
681
|
desktop?: Partial<DesktopConfigOptions>;
|
|
@@ -543,7 +702,7 @@ export declare function RadioAction({ actionId, options, initialIndex, onTrigger
|
|
|
543
702
|
* @param {number} props.initialIndex
|
|
544
703
|
* @param {Function} props.onTrigger
|
|
545
704
|
*/
|
|
546
|
-
declare interface RadioActionProps extends ActionProps {
|
|
705
|
+
export declare interface RadioActionProps extends ActionProps {
|
|
547
706
|
options: {
|
|
548
707
|
label: string;
|
|
549
708
|
shortcut?: string[];
|
|
@@ -562,14 +721,14 @@ export declare function removeUrlProtocol(url: string): string;
|
|
|
562
721
|
|
|
563
722
|
export declare function Router({ path, homePage, fallbackPage, children }: RouterProps): JSX_2.Element;
|
|
564
723
|
|
|
565
|
-
declare interface RouterProps {
|
|
724
|
+
export declare interface RouterProps {
|
|
566
725
|
path?: string;
|
|
567
726
|
homePage?: JSX.Element;
|
|
568
727
|
fallbackPage?: JSX.Element;
|
|
569
728
|
children?: ReactElement;
|
|
570
729
|
}
|
|
571
730
|
|
|
572
|
-
declare class Settings {
|
|
731
|
+
export declare class Settings {
|
|
573
732
|
#private;
|
|
574
733
|
path: string;
|
|
575
734
|
file: VirtualFile;
|
|
@@ -585,10 +744,39 @@ declare class Settings {
|
|
|
585
744
|
*/
|
|
586
745
|
isMissingXmlDoc(): Promise<boolean>;
|
|
587
746
|
/**
|
|
588
|
-
* Gets a value by a given key if it exists
|
|
747
|
+
* Gets a value by a given key if it exists and optionally calls a callback function whenever the value changes
|
|
748
|
+
* @param key The key of the setting
|
|
749
|
+
* @param callback The callback function to call whenever the value changes
|
|
750
|
+
*/
|
|
751
|
+
get(key: string, callback?: (value: string) => void): Promise<{
|
|
752
|
+
value: string | null;
|
|
753
|
+
listener?: Listener;
|
|
754
|
+
}>;
|
|
755
|
+
/**
|
|
756
|
+
* Gets a value by a given key as a boolean
|
|
757
|
+
*/
|
|
758
|
+
getBool(key: string, callback?: (value: boolean) => void): Promise<{
|
|
759
|
+
value: boolean | null;
|
|
760
|
+
listener?: Listener;
|
|
761
|
+
}>;
|
|
762
|
+
/**
|
|
763
|
+
* Gets a value by a given key as an integer
|
|
764
|
+
*/
|
|
765
|
+
getInt(key: string, callback?: (value: number) => void): Promise<{
|
|
766
|
+
value: number | null;
|
|
767
|
+
listener?: Listener;
|
|
768
|
+
}>;
|
|
769
|
+
/**
|
|
770
|
+
* Sets the value associated with a given key
|
|
771
|
+
* @param key The key of the setting
|
|
772
|
+
* @param value The new value
|
|
589
773
|
*/
|
|
590
|
-
get(key: string, callback?: (value: string) => void): Promise<string | null>;
|
|
591
774
|
set(key: string, value: string): Promise<void>;
|
|
775
|
+
/**
|
|
776
|
+
* Removes a listener from the settings file
|
|
777
|
+
* @param listener The listener to remove
|
|
778
|
+
*/
|
|
779
|
+
removeListener(listener: Listener): void;
|
|
592
780
|
}
|
|
593
781
|
|
|
594
782
|
export declare class SettingsManager {
|
|
@@ -600,7 +788,11 @@ export declare class SettingsManager {
|
|
|
600
788
|
getSettings(path: string): Settings;
|
|
601
789
|
}
|
|
602
790
|
|
|
603
|
-
declare
|
|
791
|
+
export declare const SettingsManagerContext: Context<SettingsManagerState>;
|
|
792
|
+
|
|
793
|
+
export declare type SettingsManagerState = SettingsManager | undefined;
|
|
794
|
+
|
|
795
|
+
export declare type SettingsPath = typeof SettingsManager.VIRTUAL_PATHS[string];
|
|
604
796
|
|
|
605
797
|
export declare function setViewportIcon(url: string): void;
|
|
606
798
|
|
|
@@ -659,6 +851,8 @@ declare interface SkinOptions {
|
|
|
659
851
|
text?: string;
|
|
660
852
|
code?: string;
|
|
661
853
|
external?: string;
|
|
854
|
+
video?: string;
|
|
855
|
+
audio?: string;
|
|
662
856
|
};
|
|
663
857
|
/**
|
|
664
858
|
* URLs of icons for types of folders
|
|
@@ -668,6 +862,8 @@ declare interface SkinOptions {
|
|
|
668
862
|
images?: string;
|
|
669
863
|
text?: string;
|
|
670
864
|
link?: string;
|
|
865
|
+
video?: string;
|
|
866
|
+
audio?: string;
|
|
671
867
|
};
|
|
672
868
|
/**
|
|
673
869
|
* Function that dynamically imports style sheet
|
|
@@ -681,7 +877,7 @@ declare interface SkinOptions {
|
|
|
681
877
|
|
|
682
878
|
export declare function StandaloneRoute({ app }: StandaloneRouteProps): JSX_2.Element;
|
|
683
879
|
|
|
684
|
-
declare interface StandaloneRouteProps {
|
|
880
|
+
export declare interface StandaloneRouteProps {
|
|
685
881
|
app: App;
|
|
686
882
|
}
|
|
687
883
|
|
|
@@ -697,7 +893,9 @@ export { StorageManager_2 as StorageManager }
|
|
|
697
893
|
|
|
698
894
|
export declare class SystemManager {
|
|
699
895
|
#private;
|
|
896
|
+
/** The name of the system */
|
|
700
897
|
readonly systemName: string;
|
|
898
|
+
/** The tagline/short description of the system */
|
|
701
899
|
readonly tagLine: string;
|
|
702
900
|
readonly skin: Skin;
|
|
703
901
|
readonly appsConfig: AppsConfig;
|
|
@@ -713,7 +911,9 @@ export declare class SystemManager {
|
|
|
713
911
|
getUptime(precision?: number): string;
|
|
714
912
|
}
|
|
715
913
|
|
|
716
|
-
declare
|
|
914
|
+
export declare const SystemManagerContext: Context<SystemManager | undefined>;
|
|
915
|
+
|
|
916
|
+
export declare interface SystemManagerParams {
|
|
717
917
|
systemName: SystemManager["systemName"] | null;
|
|
718
918
|
tagLine: SystemManager["tagLine"] | null;
|
|
719
919
|
skin?: SystemManager["skin"];
|
|
@@ -727,6 +927,9 @@ declare interface SystemManagerParams {
|
|
|
727
927
|
virtualDriveConfig: VirtualDriveConfig;
|
|
728
928
|
}
|
|
729
929
|
|
|
930
|
+
/**
|
|
931
|
+
* Component that renders the start and search menus, pinned applications and various indicators
|
|
932
|
+
*/
|
|
730
933
|
export declare const Taskbar: MemoExoticComponent<() => JSX_2.Element>;
|
|
731
934
|
|
|
732
935
|
export declare class TaskbarConfig {
|
|
@@ -734,7 +937,7 @@ export declare class TaskbarConfig {
|
|
|
734
937
|
constructor(options?: Partial<TaskbarConfigOptions>);
|
|
735
938
|
}
|
|
736
939
|
|
|
737
|
-
declare interface TaskbarConfigOptions {
|
|
940
|
+
export declare interface TaskbarConfigOptions {
|
|
738
941
|
/**
|
|
739
942
|
* Height of the taskbar in CSS pixels
|
|
740
943
|
* @default 3 * 16
|
|
@@ -744,7 +947,7 @@ declare interface TaskbarConfigOptions {
|
|
|
744
947
|
|
|
745
948
|
export declare function TextDisplay({ children }: TextDisplayProps): JSX_2.Element;
|
|
746
949
|
|
|
747
|
-
declare interface TextDisplayProps {
|
|
950
|
+
export declare interface TextDisplayProps {
|
|
748
951
|
children: ReactNode;
|
|
749
952
|
}
|
|
750
953
|
|
|
@@ -771,7 +974,7 @@ export declare class TimeManager {
|
|
|
771
974
|
|
|
772
975
|
export declare function ToggleAction({ actionId, label, shortcut, initialValue, onTrigger }: ToggleActionProps): ReactElement;
|
|
773
976
|
|
|
774
|
-
declare interface ToggleActionProps extends ActionProps {
|
|
977
|
+
export declare interface ToggleActionProps extends ActionProps {
|
|
775
978
|
initialValue: boolean;
|
|
776
979
|
}
|
|
777
980
|
|
|
@@ -781,7 +984,7 @@ export declare class TrackingConfig {
|
|
|
781
984
|
constructor(options?: Partial<TrackingConfigOptions>);
|
|
782
985
|
}
|
|
783
986
|
|
|
784
|
-
declare interface TrackingConfigOptions {
|
|
987
|
+
export declare interface TrackingConfigOptions {
|
|
785
988
|
/**
|
|
786
989
|
* Enable tracking
|
|
787
990
|
* @default true
|
|
@@ -799,65 +1002,132 @@ export declare class TrackingManager {
|
|
|
799
1002
|
event(options: UaEventOptions | string): void;
|
|
800
1003
|
}
|
|
801
1004
|
|
|
802
|
-
declare
|
|
1005
|
+
export declare const TrackingManagerContext: Context<TrackingManagerState>;
|
|
1006
|
+
|
|
1007
|
+
export declare type TrackingManagerState = TrackingManager | undefined;
|
|
803
1008
|
|
|
1009
|
+
/** Returns a function that opens an alert modal */
|
|
804
1010
|
export declare function useAlert(): {
|
|
805
|
-
alert: (
|
|
1011
|
+
alert: (params: AlertParams) => void;
|
|
806
1012
|
};
|
|
807
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* Returns the folder associated with a given app
|
|
1016
|
+
*/
|
|
808
1017
|
export declare function useAppFolder(app?: App): VirtualFolder | null;
|
|
809
1018
|
|
|
1019
|
+
/**
|
|
1020
|
+
* Returns the boolean value of a setting and a function to update it
|
|
1021
|
+
* @param path The path of the settings file
|
|
1022
|
+
* @param key The key of the setting
|
|
1023
|
+
* @param defaultValue The default value of the setting
|
|
1024
|
+
* @returns The boolean value of a setting and a function to update it
|
|
1025
|
+
*/
|
|
1026
|
+
export declare function useBoolSetting(path: SettingsPath, key: string, defaultValue?: boolean): [boolean, (value: string | boolean) => void];
|
|
1027
|
+
|
|
810
1028
|
/**
|
|
811
1029
|
* Combine class names and an optional static class name
|
|
812
1030
|
*/
|
|
813
1031
|
export declare function useClassNames(classNames: (string | undefined)[], block?: string, element?: string, modifier?: string | string[]): string;
|
|
814
1032
|
|
|
1033
|
+
/**
|
|
1034
|
+
* Creates a function that handles the opening of a custom context menu and a component that listens for keyboard shortcuts
|
|
1035
|
+
*/
|
|
815
1036
|
export declare function useContextMenu({ Actions }: UseContextMenuParams): {
|
|
816
1037
|
onContextMenu: (event: MouseEvent_2<HTMLElement, MouseEvent_2>, params?: object) => Modal;
|
|
817
1038
|
ShortcutsListener: () => JSX_2.Element;
|
|
818
1039
|
};
|
|
819
1040
|
|
|
820
|
-
declare interface UseContextMenuParams {
|
|
1041
|
+
export declare interface UseContextMenuParams {
|
|
1042
|
+
/** The component with the actions of the context menu */
|
|
821
1043
|
Actions: FC<ActionsProps>;
|
|
822
1044
|
}
|
|
823
1045
|
|
|
1046
|
+
/**
|
|
1047
|
+
* Returns an object that handles stateful history with undo and redo methods
|
|
1048
|
+
*/
|
|
824
1049
|
export declare function useHistory<Type>(initialState: Type): {
|
|
1050
|
+
/** The entries of the history */
|
|
825
1051
|
history: Type[];
|
|
1052
|
+
/** The index of the active entry in list of entries */
|
|
826
1053
|
stateIndex: number;
|
|
1054
|
+
/** Adds a new entry to the history */
|
|
827
1055
|
pushState: (state: Type) => void;
|
|
1056
|
+
/** Moves backwards in the history */
|
|
828
1057
|
undo: () => void;
|
|
1058
|
+
/** Moves forwards in the history */
|
|
829
1059
|
redo: () => void;
|
|
830
1060
|
undoAvailable: boolean;
|
|
831
1061
|
redoAvailable: boolean;
|
|
832
1062
|
};
|
|
833
1063
|
|
|
1064
|
+
/**
|
|
1065
|
+
* Returns the integer value of a setting and a function to update it
|
|
1066
|
+
* @param path The path of the settings file
|
|
1067
|
+
* @param key The key of the setting
|
|
1068
|
+
* @param defaultValue The default value of the setting
|
|
1069
|
+
* @returns The integer value of a setting and a function to update it
|
|
1070
|
+
*/
|
|
1071
|
+
export declare function useIntSetting(path: SettingsPath, key: string, defaultValue?: number): [number, (value: string | number) => void];
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Creates listeners for `"keydown"` and `"keyup"` events
|
|
1075
|
+
*/
|
|
834
1076
|
export declare function useKeyboardListener({ onKeyDown, onKeyUp }: UseKeyboardListenerParams): void;
|
|
835
1077
|
|
|
836
|
-
declare interface UseKeyboardListenerParams {
|
|
1078
|
+
export declare interface UseKeyboardListenerParams {
|
|
1079
|
+
/** Function that handles `"keydown"` events */
|
|
837
1080
|
onKeyDown?: (event: KeyboardEvent) => void;
|
|
1081
|
+
/** Function that handles `"keyup"` events */
|
|
838
1082
|
onKeyUp?: (event: KeyboardEvent) => void;
|
|
839
1083
|
}
|
|
840
1084
|
|
|
1085
|
+
/**
|
|
1086
|
+
* Returns the items of a list value of a setting and a function to update it
|
|
1087
|
+
* @param path The path of the settings file
|
|
1088
|
+
* @param key The key of the setting
|
|
1089
|
+
* @param defaultValue The default value of the setting
|
|
1090
|
+
* @returns The items of a list value of a setting and a function to update it
|
|
1091
|
+
*/
|
|
1092
|
+
export declare function useListSetting(path: SettingsPath, key: string, defaultValue?: string[]): [string[], (value: string | string[]) => void];
|
|
1093
|
+
|
|
841
1094
|
export declare function useModalsManager(): ModalsManagerState;
|
|
842
1095
|
|
|
1096
|
+
/**
|
|
1097
|
+
* Creates listeners for `"mousedown"`, `"mouseup"`, `"click"` and `"contextmenu"` events
|
|
1098
|
+
*/
|
|
843
1099
|
export declare function useMouseListener({ onMouseDown, onMouseUp, onClick, onContextMenu }: UseMouseListenerParams): void;
|
|
844
1100
|
|
|
845
|
-
declare interface UseMouseListenerParams {
|
|
1101
|
+
export declare interface UseMouseListenerParams {
|
|
1102
|
+
/** Function that handles `"mousedown"` events */
|
|
846
1103
|
onMouseDown: EventListener;
|
|
1104
|
+
/** Function that handles `"mouseup"` events */
|
|
847
1105
|
onMouseUp: EventListener;
|
|
1106
|
+
/** Function that handles `"click"` events */
|
|
848
1107
|
onClick: EventListener;
|
|
1108
|
+
/** Function that handles `"contextmenu"` events */
|
|
849
1109
|
onContextMenu: EventListener;
|
|
850
1110
|
}
|
|
851
1111
|
|
|
1112
|
+
/**
|
|
1113
|
+
* Returns the ideal orientation of an element so that it does not go outside of the screen
|
|
1114
|
+
*/
|
|
852
1115
|
export declare function useScreenBounds({ avoidTaskbar }: {
|
|
1116
|
+
/** Whether to avoid the task bar */
|
|
853
1117
|
avoidTaskbar: boolean;
|
|
854
1118
|
}): {
|
|
1119
|
+
/** The React ref of the element */
|
|
855
1120
|
ref: Ref<HTMLElement>;
|
|
856
1121
|
initiated: boolean;
|
|
1122
|
+
/** Whether the element should align to the left (`true`) or right (`false`) */
|
|
857
1123
|
alignLeft: boolean;
|
|
1124
|
+
/** Whether the element should align to the top (`true`) or bottom (`false`) */
|
|
858
1125
|
alignTop: boolean;
|
|
859
1126
|
};
|
|
860
1127
|
|
|
1128
|
+
/**
|
|
1129
|
+
* Returns the width and height of the element with ID "root"
|
|
1130
|
+
*/
|
|
861
1131
|
export declare function useScreenDimensions(): [screenWidth: number | null, screenHeight: number | null];
|
|
862
1132
|
|
|
863
1133
|
export declare function useScrollWithShadow(params: UseScrollWithShadowParams): {
|
|
@@ -867,7 +1137,7 @@ export declare function useScrollWithShadow(params: UseScrollWithShadowParams):
|
|
|
867
1137
|
}) => void;
|
|
868
1138
|
};
|
|
869
1139
|
|
|
870
|
-
declare interface UseScrollWithShadowParams {
|
|
1140
|
+
export declare interface UseScrollWithShadowParams {
|
|
871
1141
|
ref?: MutableRefObject<HTMLElement>;
|
|
872
1142
|
horizontal?: boolean;
|
|
873
1143
|
dynamicOffset?: boolean;
|
|
@@ -885,14 +1155,25 @@ declare interface UseScrollWithShadowParams {
|
|
|
885
1155
|
};
|
|
886
1156
|
}
|
|
887
1157
|
|
|
1158
|
+
/**
|
|
1159
|
+
* Returns the value of a setting and a function to update it
|
|
1160
|
+
* @param path The path of the settings file
|
|
1161
|
+
* @param key The key of the setting
|
|
1162
|
+
* @param defaultValue The default value of the setting
|
|
1163
|
+
* @param parse A function that converts a string to a value
|
|
1164
|
+
* @param stringify A function that converts a value to a string
|
|
1165
|
+
* @returns The value of a setting and a function to update it
|
|
1166
|
+
*/
|
|
1167
|
+
export declare function useSetting<Type = string>(path: SettingsPath, key: string, defaultValue: Type, parse: (value: string) => Type, stringify?: (value: Type) => string): [Type, (value: Type | string) => void];
|
|
1168
|
+
|
|
888
1169
|
export declare function useSettingsManager(): SettingsManagerState;
|
|
889
1170
|
|
|
890
1171
|
/**
|
|
891
|
-
*
|
|
1172
|
+
* Creates listeners for keyboard shortcuts
|
|
892
1173
|
*/
|
|
893
1174
|
export declare function useShortcuts({ options, shortcuts, useCategories }: UseShortcutsParams): void;
|
|
894
1175
|
|
|
895
|
-
declare interface UseShortcutsParams {
|
|
1176
|
+
export declare interface UseShortcutsParams {
|
|
896
1177
|
options: Record<string, Record<string, (event: KeyboardEvent) => void>> | Record<string, (event: KeyboardEvent) => void>;
|
|
897
1178
|
shortcuts?: Record<string, Record<string, string[]>> | Record<string, string[]>;
|
|
898
1179
|
useCategories?: boolean;
|
|
@@ -903,6 +1184,15 @@ declare interface UseShortcutsParams {
|
|
|
903
1184
|
*/
|
|
904
1185
|
export declare function useStaticClassName(block?: string, element?: string, modifier?: string | string[]): string | null;
|
|
905
1186
|
|
|
1187
|
+
/**
|
|
1188
|
+
* Returns the value of a setting and a function to update it
|
|
1189
|
+
* @param path The path of the settings file
|
|
1190
|
+
* @param key The key of the setting
|
|
1191
|
+
* @param defaultValue The default value of the setting
|
|
1192
|
+
* @returns The value of a setting and a function to update it
|
|
1193
|
+
*/
|
|
1194
|
+
export declare function useStringSetting(path: SettingsPath, key: string, defaultValue?: string | null): [string | null, (value: string | null) => void];
|
|
1195
|
+
|
|
906
1196
|
export declare function useSystemManager(): SystemManager;
|
|
907
1197
|
|
|
908
1198
|
export declare function useTrackingManager(): TrackingManagerState;
|
|
@@ -917,7 +1207,7 @@ export declare function useWindowsManager(): WindowsManagerState;
|
|
|
917
1207
|
|
|
918
1208
|
export declare function useZIndex({ groupIndex, index }: UseZIndexParams): number;
|
|
919
1209
|
|
|
920
|
-
declare interface UseZIndexParams {
|
|
1210
|
+
export declare interface UseZIndexParams {
|
|
921
1211
|
groupIndex: number;
|
|
922
1212
|
index: number;
|
|
923
1213
|
}
|
|
@@ -942,17 +1232,30 @@ export declare class Vector2 {
|
|
|
942
1232
|
static lerp(vector2A: Vector2, vector2B: Vector2, t: number): Vector2;
|
|
943
1233
|
}
|
|
944
1234
|
|
|
1235
|
+
export declare const VIDEO_EXTENSIONS: string[];
|
|
1236
|
+
|
|
945
1237
|
declare class VirtualBase extends EventEmitter<EventNamesMap> {
|
|
1238
|
+
/** The name of this item */
|
|
946
1239
|
name: string;
|
|
1240
|
+
/** The alias of this item */
|
|
947
1241
|
alias: string | undefined | null;
|
|
1242
|
+
/** The folder this item is in */
|
|
948
1243
|
parent: VirtualFolder | undefined | null;
|
|
1244
|
+
/** Whether this item is protected from changes */
|
|
949
1245
|
isProtected: boolean | undefined | null;
|
|
1246
|
+
/** The URL of the icon of this item */
|
|
950
1247
|
iconUrl: string | undefined | null;
|
|
1248
|
+
/** The file this item links to */
|
|
951
1249
|
linkedFile: VirtualFile | undefined | null;
|
|
1250
|
+
/** The folder this item links to */
|
|
952
1251
|
linkedFolder: VirtualFolder | undefined | null;
|
|
1252
|
+
/** Whether this item has been edited by the user */
|
|
953
1253
|
editedByUser: boolean | undefined | null;
|
|
1254
|
+
/** Whether this item is the root folder */
|
|
954
1255
|
isRoot: boolean | undefined | null;
|
|
1256
|
+
/** The root folder */
|
|
955
1257
|
root: VirtualRoot | undefined | null;
|
|
1258
|
+
/** Whether this item has been deleted */
|
|
956
1259
|
isDeleted: boolean;
|
|
957
1260
|
static EVENT_NAMES: {
|
|
958
1261
|
update: string;
|
|
@@ -966,9 +1269,18 @@ declare class VirtualBase extends EventEmitter<EventNamesMap> {
|
|
|
966
1269
|
setIconUrl(iconUrl: string | null): this;
|
|
967
1270
|
getIconUrl(): string;
|
|
968
1271
|
getType(): string;
|
|
1272
|
+
/**
|
|
1273
|
+
* Tries to delete this item
|
|
1274
|
+
*/
|
|
969
1275
|
delete(): void;
|
|
970
1276
|
confirmChanges(root?: VirtualRoot): void;
|
|
1277
|
+
/**
|
|
1278
|
+
* Opens this item in the appropriate application
|
|
1279
|
+
*/
|
|
971
1280
|
open(..._args: unknown[]): unknown;
|
|
1281
|
+
/**
|
|
1282
|
+
* Returns the path of this item
|
|
1283
|
+
*/
|
|
972
1284
|
get path(): string;
|
|
973
1285
|
/**
|
|
974
1286
|
* Returns path without using this item's alias
|
|
@@ -982,6 +1294,9 @@ declare class VirtualBase extends EventEmitter<EventNamesMap> {
|
|
|
982
1294
|
* Returns whether this can be edited in its current state
|
|
983
1295
|
*/
|
|
984
1296
|
get canBeEdited(): boolean;
|
|
1297
|
+
/**
|
|
1298
|
+
* Returns the root folder
|
|
1299
|
+
*/
|
|
985
1300
|
getRoot(): VirtualRoot;
|
|
986
1301
|
isFile(): boolean;
|
|
987
1302
|
isFolder(): boolean;
|
|
@@ -1000,7 +1315,7 @@ export declare class VirtualDriveConfig {
|
|
|
1000
1315
|
constructor(options?: Partial<VirtualDriveConfigOptions>);
|
|
1001
1316
|
}
|
|
1002
1317
|
|
|
1003
|
-
declare interface VirtualDriveConfigOptions {
|
|
1318
|
+
export declare interface VirtualDriveConfigOptions {
|
|
1004
1319
|
/**
|
|
1005
1320
|
* Enables persistent storage of the virtual drive
|
|
1006
1321
|
* @default true
|
|
@@ -1043,8 +1358,11 @@ declare interface VirtualDriveConfigOptions {
|
|
|
1043
1358
|
* A virtual file that can be stored inside a folder
|
|
1044
1359
|
*/
|
|
1045
1360
|
export declare class VirtualFile extends VirtualBase {
|
|
1361
|
+
/** The extension of this file */
|
|
1046
1362
|
extension: OptionalStringProperty;
|
|
1363
|
+
/** The URL of the source of this file */
|
|
1047
1364
|
source: OptionalStringProperty;
|
|
1365
|
+
/** The content of this file */
|
|
1048
1366
|
content: OptionalStringProperty;
|
|
1049
1367
|
static NON_TEXT_EXTENSIONS: string[];
|
|
1050
1368
|
static EVENT_NAMES: {
|
|
@@ -1074,11 +1392,13 @@ export declare class VirtualFile extends VirtualBase {
|
|
|
1074
1392
|
isFile(): boolean;
|
|
1075
1393
|
getIconUrl(): string;
|
|
1076
1394
|
getType(): string;
|
|
1395
|
+
download(): void;
|
|
1396
|
+
isDownloadable(): boolean;
|
|
1077
1397
|
toJSON(): VirtualFileJson | null;
|
|
1078
1398
|
static removeFileScheme(source: string): string;
|
|
1079
1399
|
}
|
|
1080
1400
|
|
|
1081
|
-
declare interface VirtualFileJson extends VirtualBaseJson {
|
|
1401
|
+
export declare interface VirtualFileJson extends VirtualBaseJson {
|
|
1082
1402
|
ext?: string;
|
|
1083
1403
|
cnt?: string;
|
|
1084
1404
|
src?: string;
|
|
@@ -1103,7 +1423,7 @@ export declare class VirtualFileLink extends VirtualFile {
|
|
|
1103
1423
|
getIconUrl(...args: Parameters<VirtualFile["getIconUrl"]>): ReturnType<VirtualFile["getIconUrl"]>;
|
|
1104
1424
|
}
|
|
1105
1425
|
|
|
1106
|
-
declare interface VirtualFileLinkJson extends VirtualFileJson {
|
|
1426
|
+
export declare interface VirtualFileLinkJson extends VirtualFileJson {
|
|
1107
1427
|
lnk: string;
|
|
1108
1428
|
}
|
|
1109
1429
|
|
|
@@ -1111,8 +1431,14 @@ declare interface VirtualFileLinkJson extends VirtualFileJson {
|
|
|
1111
1431
|
* A virtual folder that can contains files and sub-folders
|
|
1112
1432
|
*/
|
|
1113
1433
|
export declare class VirtualFolder extends VirtualBase {
|
|
1434
|
+
/** The folders inside this folder */
|
|
1114
1435
|
subFolders: (VirtualFolder | VirtualFolderLink)[];
|
|
1436
|
+
/** The files inside this folder */
|
|
1115
1437
|
files: (VirtualFile | VirtualFileLink)[];
|
|
1438
|
+
/**
|
|
1439
|
+
* The type of this folder
|
|
1440
|
+
* @default VirtualFolder.TYPE.general
|
|
1441
|
+
*/
|
|
1116
1442
|
type: number | undefined;
|
|
1117
1443
|
static TYPE: {
|
|
1118
1444
|
general: number;
|
|
@@ -1209,7 +1535,7 @@ export declare class VirtualFolder extends VirtualBase {
|
|
|
1209
1535
|
toJSON(): VirtualFolderJson | null;
|
|
1210
1536
|
}
|
|
1211
1537
|
|
|
1212
|
-
declare interface VirtualFolderJson extends VirtualBaseJson {
|
|
1538
|
+
export declare interface VirtualFolderJson extends VirtualBaseJson {
|
|
1213
1539
|
fls?: VirtualFileJson[];
|
|
1214
1540
|
fds?: VirtualFolderJson[];
|
|
1215
1541
|
}
|
|
@@ -1240,7 +1566,7 @@ export declare class VirtualFolderLink extends VirtualFolder {
|
|
|
1240
1566
|
getItemCount(...args: Parameters<VirtualFolder["getItemCount"]>): ReturnType<VirtualFolder["getItemCount"]>;
|
|
1241
1567
|
}
|
|
1242
1568
|
|
|
1243
|
-
declare interface VirtualFolderLinkJson extends VirtualFolderJson {
|
|
1569
|
+
export declare interface VirtualFolderLinkJson extends VirtualFolderJson {
|
|
1244
1570
|
lnk: string;
|
|
1245
1571
|
}
|
|
1246
1572
|
|
|
@@ -1248,6 +1574,7 @@ declare interface VirtualFolderLinkJson extends VirtualFolderJson {
|
|
|
1248
1574
|
* A virtual folder that serves as the root folder
|
|
1249
1575
|
*/
|
|
1250
1576
|
export declare class VirtualRoot extends VirtualFolder {
|
|
1577
|
+
/** Aliases for files and folders */
|
|
1251
1578
|
shortcuts: Record<string, VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink>;
|
|
1252
1579
|
initiated: boolean;
|
|
1253
1580
|
loadedDefaultData: boolean;
|
|
@@ -1264,7 +1591,7 @@ export declare class VirtualRoot extends VirtualFolder {
|
|
|
1264
1591
|
*/
|
|
1265
1592
|
saveData(): void;
|
|
1266
1593
|
/**
|
|
1267
|
-
*
|
|
1594
|
+
* Initializes this root by loading the default data and then the user's data on top
|
|
1268
1595
|
*/
|
|
1269
1596
|
init(): VirtualRoot;
|
|
1270
1597
|
/**
|
|
@@ -1275,34 +1602,47 @@ export declare class VirtualRoot extends VirtualFolder {
|
|
|
1275
1602
|
* Tells the storage manager to clear all data and reloads the window
|
|
1276
1603
|
*/
|
|
1277
1604
|
reset(): void;
|
|
1278
|
-
static isValidName(_name: string):
|
|
1279
|
-
static isValidFileName(_name: string):
|
|
1280
|
-
static isValidFolderName(_name: string):
|
|
1605
|
+
static isValidName(_name: string): boolean;
|
|
1606
|
+
static isValidFileName(_name: string): boolean;
|
|
1607
|
+
static isValidFolderName(_name: string): boolean;
|
|
1281
1608
|
get path(): string;
|
|
1282
1609
|
get displayPath(): string;
|
|
1283
1610
|
toJSON(): VirtualRootJson | null;
|
|
1284
1611
|
toString(): string | null;
|
|
1285
1612
|
}
|
|
1286
1613
|
|
|
1287
|
-
declare
|
|
1614
|
+
export declare const VirtualRootContext: Context<VirtualRootState>;
|
|
1615
|
+
|
|
1616
|
+
export declare interface VirtualRootJson extends VirtualFolderJson {
|
|
1288
1617
|
scs: Record<string, string>;
|
|
1289
1618
|
}
|
|
1290
1619
|
|
|
1291
|
-
declare type VirtualRootState = VirtualRoot | undefined;
|
|
1620
|
+
export declare type VirtualRootState = VirtualRoot | undefined;
|
|
1292
1621
|
|
|
1622
|
+
/**
|
|
1623
|
+
* Component that renders an external application inside an iframe
|
|
1624
|
+
*/
|
|
1293
1625
|
export declare const WebView: FC<WebViewProps>;
|
|
1294
1626
|
|
|
1295
|
-
declare interface WebViewProps extends WindowProps {
|
|
1627
|
+
export declare interface WebViewProps extends WindowProps {
|
|
1628
|
+
/** The URL of the external application */
|
|
1296
1629
|
source?: string;
|
|
1297
1630
|
title?: string;
|
|
1298
1631
|
}
|
|
1299
1632
|
|
|
1300
1633
|
export declare function WindowedModal({ modal, params, children, ...props }: ModalProps): JSX_2.Element;
|
|
1301
1634
|
|
|
1302
|
-
declare interface WindowOptions {
|
|
1635
|
+
export declare interface WindowOptions {
|
|
1636
|
+
/** The ID of the window */
|
|
1303
1637
|
id?: string;
|
|
1638
|
+
/** The app associated with the window */
|
|
1304
1639
|
app?: App;
|
|
1640
|
+
/**
|
|
1641
|
+
* The size of the window
|
|
1642
|
+
* @default new Vector2(700, 400)
|
|
1643
|
+
*/
|
|
1305
1644
|
size?: Vector2;
|
|
1645
|
+
/** The position of the window */
|
|
1306
1646
|
position?: Vector2;
|
|
1307
1647
|
fullscreen?: boolean | string;
|
|
1308
1648
|
options?: object;
|
|
@@ -1312,22 +1652,31 @@ declare interface WindowOptions {
|
|
|
1312
1652
|
[key: string]: unknown;
|
|
1313
1653
|
}
|
|
1314
1654
|
|
|
1315
|
-
declare interface WindowOptions_2 {
|
|
1316
|
-
size?: Vector2;
|
|
1317
|
-
[key: string]: unknown;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
1655
|
export declare interface WindowProps extends WindowOptions {
|
|
1656
|
+
/**
|
|
1657
|
+
* Whether to start the window in fullscreen mode
|
|
1658
|
+
* @default false
|
|
1659
|
+
*/
|
|
1321
1660
|
fullscreen?: boolean;
|
|
1661
|
+
/** Function that handles interactions with the window */
|
|
1322
1662
|
onInteract?: () => void;
|
|
1663
|
+
/** Function that sets the title of the window */
|
|
1323
1664
|
setTitle?: React.Dispatch<React.SetStateAction<string>>;
|
|
1665
|
+
/** Function that sets the icon URL of the window */
|
|
1324
1666
|
setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
|
|
1667
|
+
/** Function that closes the window */
|
|
1325
1668
|
close?: (event?: Event) => void;
|
|
1669
|
+
/** Function that brings the window in focus */
|
|
1326
1670
|
focus?: (event: Event, force?: boolean) => void;
|
|
1671
|
+
/** Whether the window is currently focused and should allow interactions */
|
|
1327
1672
|
active?: boolean;
|
|
1673
|
+
/** Whether to start the window in minimized mode */
|
|
1328
1674
|
minimized?: boolean;
|
|
1675
|
+
/** Function that toggles the minimized mode of the window */
|
|
1329
1676
|
toggleMinimized?: (event?: Event) => void;
|
|
1677
|
+
/** The depth value of the window */
|
|
1330
1678
|
index?: number;
|
|
1679
|
+
/** Whether the window is in standalone mode */
|
|
1331
1680
|
standalone?: boolean;
|
|
1332
1681
|
}
|
|
1333
1682
|
|
|
@@ -1338,12 +1687,14 @@ export declare class WindowsConfig {
|
|
|
1338
1687
|
constructor(options?: Partial<WindowsConfigOptions>);
|
|
1339
1688
|
}
|
|
1340
1689
|
|
|
1341
|
-
declare interface WindowsConfigOptions {
|
|
1690
|
+
export declare interface WindowsConfigOptions {
|
|
1342
1691
|
/**
|
|
1692
|
+
* The margin around windows that are not maximized, in pixels
|
|
1343
1693
|
* @default 32
|
|
1344
1694
|
*/
|
|
1345
1695
|
screenMargin: number;
|
|
1346
1696
|
/**
|
|
1697
|
+
* The separator to use in window titles
|
|
1347
1698
|
* @default "-"
|
|
1348
1699
|
*/
|
|
1349
1700
|
titleSeparator: string;
|
|
@@ -1354,16 +1705,21 @@ declare interface WindowsConfigOptions {
|
|
|
1354
1705
|
minScreenSize: Vector2;
|
|
1355
1706
|
}
|
|
1356
1707
|
|
|
1708
|
+
/**
|
|
1709
|
+
* Manages the states of windows
|
|
1710
|
+
*/
|
|
1357
1711
|
export declare class WindowsManager {
|
|
1358
1712
|
#private;
|
|
1359
1713
|
windows: {
|
|
1360
1714
|
[id: string]: WindowOptions;
|
|
1361
1715
|
};
|
|
1716
|
+
/** Function that handles changes to the open windows */
|
|
1362
1717
|
updateWindows: (window: WindowsManager["windows"]) => void;
|
|
1363
1718
|
startupComplete: boolean;
|
|
1364
1719
|
constructor(systemManager: SystemManager, trackingManager: TrackingManager);
|
|
1365
1720
|
/**
|
|
1366
|
-
*
|
|
1721
|
+
* Opens a window for an application
|
|
1722
|
+
* @param appId The ID of the app
|
|
1367
1723
|
*/
|
|
1368
1724
|
open(appId: string, options?: WindowOptions | null): object | null;
|
|
1369
1725
|
/**
|
|
@@ -1409,11 +1765,24 @@ export declare class WindowsManager {
|
|
|
1409
1765
|
get windowIds(): string[];
|
|
1410
1766
|
}
|
|
1411
1767
|
|
|
1412
|
-
declare
|
|
1768
|
+
export declare const WindowsManagerContext: Context<WindowsManagerState>;
|
|
1413
1769
|
|
|
1770
|
+
export declare type WindowsManagerState = WindowsManager | undefined;
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* Component that renders the windows for all currently active applications
|
|
1774
|
+
*/
|
|
1414
1775
|
export declare const WindowsView: FC;
|
|
1415
1776
|
|
|
1416
|
-
|
|
1777
|
+
/**
|
|
1778
|
+
* Component that renders the window for an application
|
|
1779
|
+
*/
|
|
1780
|
+
export declare const WindowView: FC<WindowProps>;
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Represents a group of HTML elements whose z-index is automatically calculated based on a given order
|
|
1784
|
+
*/
|
|
1785
|
+
export declare class ZIndexGroup {
|
|
1417
1786
|
length: number;
|
|
1418
1787
|
offset: number;
|
|
1419
1788
|
groupIndex: number;
|