@prozilla-os/dev-tools 1.1.11 → 1.1.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/dist/main.d.ts +120 -70
- package/dist/main.js +10709 -148
- package/dist/main.js.map +1 -1
- package/package.json +9 -7
package/dist/main.d.ts
CHANGED
|
@@ -2,65 +2,68 @@ import { FC } from 'react';
|
|
|
2
2
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
3
|
import { Plugin as Plugin_2 } from 'rollup';
|
|
4
4
|
import { Plugin as Plugin_3 } from 'vite';
|
|
5
|
+
import { TestAPI } from 'vitest';
|
|
5
6
|
import { UserConfig } from 'vite';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* An application that can be ran by ProzillaOS
|
|
9
|
-
*
|
|
9
|
+
* An application that can be ran by ProzillaOS.
|
|
10
|
+
*
|
|
11
|
+
* Applications can be installed by adding them to {@link AppsConfig.apps}.
|
|
12
|
+
* @typeParam AppProps - The props of the {@link windowContent} of this app.
|
|
10
13
|
*/
|
|
11
14
|
declare class App<AppProps extends WindowProps = WindowProps> {
|
|
12
15
|
/**
|
|
13
|
-
* The display name of this application
|
|
16
|
+
* The display name of this application.
|
|
14
17
|
*/
|
|
15
18
|
name: string;
|
|
16
19
|
/**
|
|
17
|
-
* The unique ID of this application
|
|
20
|
+
* The unique ID of this application.
|
|
18
21
|
*/
|
|
19
22
|
id: string;
|
|
20
23
|
/**
|
|
21
|
-
* Main component that renders this app inside a window
|
|
24
|
+
* Main component that renders this app inside a window.
|
|
22
25
|
*/
|
|
23
|
-
windowContent: FC<AppProps
|
|
26
|
+
windowContent: FC<AppProps> | null;
|
|
24
27
|
/**
|
|
25
|
-
* Default options that get passed to the {@link App.windowContent} component
|
|
28
|
+
* Default options that get passed to the {@link App.windowContent} component.
|
|
26
29
|
*/
|
|
27
30
|
windowOptions?: Partial<AppProps> & DefaultWindowOptions;
|
|
28
31
|
/**
|
|
29
|
-
* Description of this application
|
|
32
|
+
* Description of this application.
|
|
30
33
|
*/
|
|
31
34
|
description: string | null;
|
|
32
35
|
/**
|
|
33
|
-
* URL of the icon of this application
|
|
36
|
+
* URL of the icon of this application.
|
|
34
37
|
*/
|
|
35
38
|
iconUrl: string | null;
|
|
36
39
|
/**
|
|
37
|
-
* Defines what the app can handle and how it can be used elsewhere in the system
|
|
40
|
+
* Defines what the app can handle and how it can be used elsewhere in the system.
|
|
38
41
|
*/
|
|
39
42
|
role: string | null;
|
|
40
43
|
/**
|
|
41
|
-
* An array of file extensions that this application can interpret
|
|
44
|
+
* An array of file extensions that this application can interpret.
|
|
42
45
|
*/
|
|
43
46
|
associatedExtensions: string[];
|
|
44
47
|
/**
|
|
45
|
-
* Determines whether the app is pinned by default
|
|
48
|
+
* Determines whether the app is pinned by default.
|
|
46
49
|
* @default true
|
|
47
50
|
*/
|
|
48
51
|
pinnedByDefault: boolean;
|
|
49
52
|
/**
|
|
50
|
-
* Determines whether the app is launched at startup
|
|
53
|
+
* Determines whether the app is launched at startup.
|
|
51
54
|
* @default false
|
|
52
55
|
*/
|
|
53
56
|
launchAtStartup: boolean;
|
|
54
57
|
/**
|
|
55
|
-
* The category the app belongs to
|
|
58
|
+
* The category the app belongs to.
|
|
56
59
|
*/
|
|
57
60
|
category: typeof APP_CATEGORIES[number] | null;
|
|
58
61
|
/**
|
|
59
|
-
* Metadata of the app's package
|
|
62
|
+
* Metadata of the app's package.
|
|
60
63
|
*/
|
|
61
64
|
metadata: AppMetadata | null;
|
|
62
65
|
/**
|
|
63
|
-
* Determines whether a desktop icon is added to the default data
|
|
66
|
+
* Determines whether a desktop icon is added to the default data.
|
|
64
67
|
* @default false
|
|
65
68
|
*/
|
|
66
69
|
showDesktopIcon: boolean;
|
|
@@ -69,55 +72,55 @@ declare class App<AppProps extends WindowProps = WindowProps> {
|
|
|
69
72
|
isInstalled: boolean;
|
|
70
73
|
constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: Partial<AppProps> & DefaultWindowOptions);
|
|
71
74
|
/**
|
|
72
|
-
* Returns the component that renders the content of a window for this app
|
|
75
|
+
* Returns the component that renders the content of a window for this app.
|
|
73
76
|
*/
|
|
74
77
|
WindowContent: (props: AppProps) => JSX_2.Element | null;
|
|
75
78
|
/**
|
|
76
|
-
* Sets the display name of this application
|
|
79
|
+
* Sets the display name of this application.
|
|
77
80
|
*/
|
|
78
81
|
setName(name: string): this;
|
|
79
82
|
/**
|
|
80
|
-
* Sets the description of this application
|
|
83
|
+
* Sets the description of this application.
|
|
81
84
|
*/
|
|
82
85
|
setDescription(description: App["description"]): this;
|
|
83
86
|
/**
|
|
84
|
-
* Sets the URL of the icon of this application
|
|
87
|
+
* Sets the URL of the icon of this application.
|
|
85
88
|
*/
|
|
86
89
|
setIconUrl(iconUrl: App["iconUrl"]): this;
|
|
87
90
|
/**
|
|
88
|
-
* Sets the role of this application
|
|
91
|
+
* Sets the role of this application.
|
|
89
92
|
*/
|
|
90
93
|
setRole(role: string | null): this;
|
|
91
94
|
/**
|
|
92
|
-
* Sets the associated extensions of this application
|
|
95
|
+
* Sets the associated extensions of this application.
|
|
93
96
|
*/
|
|
94
97
|
setAssociatedExtensions(extensions: string[] | null): this;
|
|
95
98
|
/**
|
|
96
|
-
* Changes whether this application is pinned by default or not
|
|
99
|
+
* Changes whether this application is pinned by default or not.
|
|
97
100
|
*/
|
|
98
101
|
setPinnedByDefault(pinnedByDefault: boolean): this;
|
|
99
102
|
/**
|
|
100
|
-
* Changes whether this application is launched at startup or not
|
|
103
|
+
* Changes whether this application is launched at startup or not.
|
|
101
104
|
*/
|
|
102
105
|
setLaunchAtStartup(launchAtStartup: boolean): this;
|
|
103
106
|
/**
|
|
104
|
-
* Changes whether this application is installed by default or not
|
|
107
|
+
* Changes whether this application is installed by default or not.
|
|
105
108
|
*/
|
|
106
109
|
setInstalled(installed: boolean): this;
|
|
107
110
|
/**
|
|
108
|
-
* Sets the category this application belongs to
|
|
111
|
+
* Sets the category this application belongs to.
|
|
109
112
|
*/
|
|
110
113
|
setCategory(category: typeof APP_CATEGORIES[number] | null): this;
|
|
111
114
|
/**
|
|
112
|
-
* Sets the metadata for this application
|
|
115
|
+
* Sets the metadata for this application.
|
|
113
116
|
*/
|
|
114
117
|
setMetadata(metadata: AppMetadata | null): this;
|
|
115
118
|
/**
|
|
116
|
-
* Changes whether this application has a desktop icon in the default data
|
|
119
|
+
* Changes whether this application has a desktop icon in the default data.
|
|
117
120
|
*/
|
|
118
121
|
setShowDesktopIcon(showDesktopIcon: boolean): this;
|
|
119
122
|
/**
|
|
120
|
-
* Sets the default options for the {@link App.windowContent} component
|
|
123
|
+
* Sets the default options for the {@link App.windowContent} component.
|
|
121
124
|
*/
|
|
122
125
|
setWindowOptions(windowOptions: Partial<AppProps> & DefaultWindowOptions): this;
|
|
123
126
|
}
|
|
@@ -130,10 +133,11 @@ declare interface AppMetadata {
|
|
|
130
133
|
author: string;
|
|
131
134
|
}
|
|
132
135
|
|
|
133
|
-
export declare function appMetadataPlugin({ entryPath }: AppMetadataPluginOptions): Plugin_3;
|
|
136
|
+
export declare function appMetadataPlugin({ entryPath, appClass }: AppMetadataPluginOptions): Plugin_3;
|
|
134
137
|
|
|
135
138
|
declare interface AppMetadataPluginOptions {
|
|
136
139
|
entryPath: string;
|
|
140
|
+
appClass?: string;
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
declare class AppsConfig {
|
|
@@ -149,72 +153,94 @@ declare class AppsConfig {
|
|
|
149
153
|
constructor(options?: Partial<AppsConfigOptions>);
|
|
150
154
|
get installedApps(): App<WindowProps>[];
|
|
151
155
|
/**
|
|
152
|
-
* @param
|
|
156
|
+
* @param id - The ID of the app.
|
|
157
|
+
* @param includeUninstalled - Include apps that are not currently installed.
|
|
153
158
|
*/
|
|
154
159
|
getAppById(id: string, includeUninstalled?: boolean): App | null;
|
|
155
160
|
/**
|
|
156
|
-
* Get the app associated with a file extension
|
|
161
|
+
* Get the app associated with a file extension.
|
|
157
162
|
*/
|
|
158
163
|
getAppByFileExtension(fileExtension: string): App | null;
|
|
159
164
|
/**
|
|
160
|
-
* Get the app with a specific role
|
|
165
|
+
* Get the app with a specific role.
|
|
161
166
|
*/
|
|
162
167
|
getAppByRole(role: string): App | null;
|
|
163
168
|
/**
|
|
164
|
-
* Get all applications (including uninstalled apps) that belong to a category
|
|
169
|
+
* Get all applications (including uninstalled apps) that belong to a category.
|
|
165
170
|
*/
|
|
166
171
|
getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
declare interface AppsConfigOptions {
|
|
170
175
|
/**
|
|
171
|
-
* An array of applications
|
|
176
|
+
* An array of applications.
|
|
172
177
|
*/
|
|
173
178
|
apps: App<WindowProps>[];
|
|
174
179
|
}
|
|
175
180
|
|
|
176
181
|
/**
|
|
177
|
-
*
|
|
178
|
-
* @param basePath -
|
|
179
|
-
* @param entryPath -
|
|
180
|
-
* @returns Vite configuration
|
|
182
|
+
* Creates a Vite configuration for ProzillaOS apps.
|
|
183
|
+
* @param basePath - The path of the base directory.
|
|
184
|
+
* @param entryPath - The path of the library entry.
|
|
185
|
+
* @returns The Vite configuration.
|
|
181
186
|
* @see https://vitejs.dev/config/
|
|
182
187
|
*/
|
|
183
|
-
export declare const appViteConfig: (basePath: string, entryPath: string) => UserConfig;
|
|
188
|
+
export declare const appViteConfig: (basePath: string, entryPath: string, appClass?: string) => UserConfig;
|
|
189
|
+
|
|
190
|
+
export declare interface CustomTestAPI {
|
|
191
|
+
simpleCases: <A = unknown, R = undefined>(func: (arg: A) => R, cases: [A, R][]) => void;
|
|
192
|
+
cases: <A extends unknown[] = [], R = undefined>(func: (...args: A) => R, cases: [A, R][]) => void;
|
|
193
|
+
}
|
|
184
194
|
|
|
185
195
|
declare interface DefaultWindowOptions {
|
|
186
196
|
size?: Vector2;
|
|
187
197
|
[key: string]: unknown;
|
|
188
198
|
}
|
|
189
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Extends Vitest's {@link TestAPI} with functions from the {@link CustomTestAPI}.
|
|
202
|
+
* @param test - The Vitest test API.
|
|
203
|
+
* @returns The extended test API.
|
|
204
|
+
* @example
|
|
205
|
+
* import { test as base } from "vitest";
|
|
206
|
+
*
|
|
207
|
+
* const test = extend(base);
|
|
208
|
+
*/
|
|
209
|
+
export declare function extend(test: TestAPI): ExtendedTestAPI;
|
|
210
|
+
|
|
211
|
+
export declare type ExtendedTestAPI = TestAPI & CustomTestAPI;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @deprecated Use {@link Logger} instead.
|
|
215
|
+
*/
|
|
190
216
|
declare function print_2(message: string, status?: Status, newLine?: boolean): void;
|
|
191
217
|
export { print_2 as print }
|
|
192
218
|
|
|
193
219
|
export declare interface StageOptions {
|
|
194
220
|
appsConfig: AppsConfig;
|
|
195
221
|
/**
|
|
196
|
-
* Favicon of the website
|
|
222
|
+
* Favicon of the website.
|
|
197
223
|
*/
|
|
198
224
|
favicon: string;
|
|
199
225
|
/**
|
|
200
|
-
* Name of the website
|
|
226
|
+
* Name of the website.
|
|
201
227
|
* @example "ProzillaOS"
|
|
202
228
|
*/
|
|
203
229
|
siteName: string;
|
|
204
230
|
/**
|
|
205
|
-
* Tag line of the website
|
|
231
|
+
* Tag line of the website.
|
|
206
232
|
* @example "Web-based Operating System"
|
|
207
233
|
*/
|
|
208
234
|
siteTagLine: string;
|
|
209
235
|
/**
|
|
210
|
-
* Domain of the live website
|
|
236
|
+
* Domain of the live website.
|
|
211
237
|
*
|
|
212
|
-
* A CNAME file will be generated with this value
|
|
238
|
+
* A CNAME file will be generated with this value.
|
|
213
239
|
* @example "os.prozilla.dev"
|
|
214
240
|
*/
|
|
215
241
|
domain: string;
|
|
216
242
|
/**
|
|
217
|
-
* Array of image URLs that will be added to the sitemap
|
|
243
|
+
* Array of image URLs that will be added to the sitemap.
|
|
218
244
|
*/
|
|
219
245
|
imageUrls?: string[];
|
|
220
246
|
}
|
|
@@ -226,32 +252,58 @@ export declare type Status = "error" | "info" | "file" | "success" | "start";
|
|
|
226
252
|
declare class Vector2 {
|
|
227
253
|
x: number;
|
|
228
254
|
y: number;
|
|
255
|
+
constructor(xy: number);
|
|
256
|
+
constructor(x: number, y?: number);
|
|
229
257
|
static get ZERO(): Vector2;
|
|
230
258
|
get clone(): Vector2;
|
|
231
|
-
|
|
232
|
-
|
|
259
|
+
get magnitude(): number;
|
|
260
|
+
setX(x: number): this;
|
|
261
|
+
setY(y: number): this;
|
|
262
|
+
set(x: number, y: number): this;
|
|
263
|
+
round(): this;
|
|
264
|
+
normalize(): this;
|
|
265
|
+
scale(scalar: number): this;
|
|
266
|
+
getDistanceSquared(x: number, y?: number): number;
|
|
267
|
+
getDistanceSquared(vector2: Vector2): number;
|
|
233
268
|
getDistance(x: number, y?: number): number;
|
|
234
269
|
getDistance(vector2: Vector2): number;
|
|
235
|
-
|
|
236
|
-
|
|
270
|
+
add(x: number, y?: number): this;
|
|
271
|
+
add(vector2: Vector2): this;
|
|
272
|
+
subtract(x: number, y?: number): this;
|
|
273
|
+
subtract(vector2: Vector2): this;
|
|
274
|
+
multiply(x: number, y?: number): this;
|
|
275
|
+
multiply(vector2: Vector2): this;
|
|
276
|
+
divide(x: number, y?: number): this;
|
|
277
|
+
divide(vector2: Vector2): this;
|
|
278
|
+
lerp(vector2: Vector2, t: number): this;
|
|
279
|
+
static sum(vector2A: Vector2, vector2B: Vector2): Vector2;
|
|
280
|
+
static difference(vector2A: Vector2, vector2B: Vector2): Vector2;
|
|
281
|
+
static product(vector2A: Vector2, vector2B: Vector2): Vector2;
|
|
282
|
+
static division(vector2A: Vector2, vector2B: Vector2): Vector2;
|
|
237
283
|
static scale(vector2: Vector2, scalar: number): Vector2;
|
|
238
|
-
static magnitude(vector2: Vector2): number;
|
|
239
284
|
static normalize(vector2: Vector2): Vector2;
|
|
240
|
-
static sqrDistance(vector2A: Vector2, vector2B: Vector2): number;
|
|
241
285
|
static lerp(vector2A: Vector2, vector2B: Vector2, t: number): Vector2;
|
|
286
|
+
static from({ x, y }: {
|
|
287
|
+
x: number;
|
|
288
|
+
y: number;
|
|
289
|
+
}): Vector2;
|
|
290
|
+
static parseVector(x: number | Vector2, y?: number): {
|
|
291
|
+
x: number;
|
|
292
|
+
y: number;
|
|
293
|
+
};
|
|
242
294
|
}
|
|
243
295
|
|
|
244
296
|
declare interface WindowOptions {
|
|
245
|
-
/** The ID of the window */
|
|
297
|
+
/** The ID of the window. */
|
|
246
298
|
id?: string;
|
|
247
|
-
/** The app associated with the window */
|
|
299
|
+
/** The app associated with the window. */
|
|
248
300
|
app?: App;
|
|
249
301
|
/**
|
|
250
|
-
* The size of the window
|
|
302
|
+
* The size of the window.
|
|
251
303
|
* @default new Vector2(700, 400)
|
|
252
304
|
*/
|
|
253
305
|
size?: Vector2;
|
|
254
|
-
/** The position of the window */
|
|
306
|
+
/** The position of the window. */
|
|
255
307
|
position?: Vector2;
|
|
256
308
|
fullscreen?: boolean | string;
|
|
257
309
|
options?: object;
|
|
@@ -263,29 +315,27 @@ declare interface WindowOptions {
|
|
|
263
315
|
|
|
264
316
|
declare interface WindowProps extends WindowOptions {
|
|
265
317
|
/**
|
|
266
|
-
* Whether to start the window in fullscreen mode
|
|
318
|
+
* Whether to start the window in fullscreen mode.
|
|
267
319
|
* @default false
|
|
268
320
|
*/
|
|
269
321
|
fullscreen?: boolean;
|
|
270
|
-
/** Function that
|
|
271
|
-
onInteract?: () => void;
|
|
272
|
-
/** Function that sets the title of the window */
|
|
322
|
+
/** Function that sets the title of the window. */
|
|
273
323
|
setTitle?: React.Dispatch<React.SetStateAction<string>>;
|
|
274
|
-
/** Function that sets the icon URL of the window */
|
|
324
|
+
/** Function that sets the icon URL of the window. */
|
|
275
325
|
setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
|
|
276
|
-
/** Function that closes the window */
|
|
277
|
-
close?: (event?: Event) => void;
|
|
278
|
-
/** Function that brings the window in focus */
|
|
279
|
-
focus?: (event
|
|
280
|
-
/** Whether the window is currently focused and should allow interactions */
|
|
326
|
+
/** Function that closes the window. */
|
|
327
|
+
close?: (event?: Event | React.UIEvent<HTMLElement>) => void;
|
|
328
|
+
/** Function that brings the window in focus. */
|
|
329
|
+
focus?: (event?: Event | React.UIEvent<HTMLElement>, force?: boolean) => void;
|
|
330
|
+
/** Whether the window is currently focused and should allow interactions. */
|
|
281
331
|
active?: boolean;
|
|
282
|
-
/** Whether to start the window in minimized mode */
|
|
332
|
+
/** Whether to start the window in minimized mode. */
|
|
283
333
|
minimized?: boolean;
|
|
284
|
-
/** Function that toggles the minimized mode of the window */
|
|
334
|
+
/** Function that toggles the minimized mode of the window. */
|
|
285
335
|
toggleMinimized?: (event?: Event) => void;
|
|
286
|
-
/** The depth value of the window */
|
|
336
|
+
/** The depth value of the window. */
|
|
287
337
|
index?: number;
|
|
288
|
-
/** Whether the window is in standalone mode */
|
|
338
|
+
/** Whether the window is in standalone mode. */
|
|
289
339
|
standalone?: boolean;
|
|
290
340
|
}
|
|
291
341
|
|