@prozilla-os/dev-tools 1.1.14 → 1.2.0

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,185 +1,64 @@
1
- import { FC } from 'react';
2
- import { JSX as JSX_2 } from 'react/jsx-runtime';
3
- import { Plugin as Plugin_2 } from 'rollup';
4
- import { Plugin as Plugin_3 } from 'vite';
1
+ import { AppsConfig } from '@prozilla-os/core';
2
+ import { Assertion } from 'vitest';
3
+ import { InspectionOptions } from '@prozilla-os/shared/logging';
4
+ import { Plugin as Plugin_2 } from 'vite';
5
+ import { PluginOption } from 'vite';
5
6
  import { TestAPI } from 'vitest';
6
7
  import { UserConfig } from 'vite';
7
8
 
8
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
+ * Vite plugin that automatically adds metadata to ProzillaOS apps.
13
11
  */
14
- declare class App<AppProps extends WindowProps = WindowProps> {
15
- /**
16
- * The display name of this application.
17
- */
18
- name: string;
19
- /**
20
- * The unique ID of this application.
21
- */
22
- id: string;
23
- /**
24
- * Main component that renders this app inside a window.
25
- */
26
- windowContent: FC<AppProps> | null;
27
- /**
28
- * Default options that get passed to the {@link App.windowContent} component.
29
- */
30
- windowOptions?: Partial<AppProps> & DefaultWindowOptions;
31
- /**
32
- * Description of this application.
33
- */
34
- description: string | null;
35
- /**
36
- * URL of the icon of this application.
37
- */
38
- iconUrl: string | null;
39
- /**
40
- * Defines what the app can handle and how it can be used elsewhere in the system.
41
- */
42
- role: string | null;
43
- /**
44
- * An array of file extensions that this application can interpret.
45
- */
46
- associatedExtensions: string[];
47
- /**
48
- * Determines whether the app is pinned by default.
49
- * @default true
50
- */
51
- pinnedByDefault: boolean;
52
- /**
53
- * Determines whether the app is launched at startup.
54
- * @default false
55
- */
56
- launchAtStartup: boolean;
57
- /**
58
- * The category the app belongs to.
59
- */
60
- category: typeof APP_CATEGORIES[number] | null;
61
- /**
62
- * Metadata of the app's package.
63
- */
64
- metadata: AppMetadata | null;
65
- /**
66
- * Determines whether a desktop icon is added to the default data.
67
- * @default false
68
- */
69
- showDesktopIcon: boolean;
70
- isActive: boolean;
71
- isPinned?: boolean;
72
- isInstalled: boolean;
73
- constructor(name: App["name"], id: App["id"], windowContent: App<AppProps>["windowContent"], windowOptions?: Partial<AppProps> & DefaultWindowOptions);
74
- /**
75
- * Returns the component that renders the content of a window for this app.
76
- */
77
- WindowContent: (props: AppProps) => JSX_2.Element | null;
78
- /**
79
- * Sets the display name of this application.
80
- */
81
- setName(name: string): this;
82
- /**
83
- * Sets the description of this application.
84
- */
85
- setDescription(description: App["description"]): this;
86
- /**
87
- * Sets the URL of the icon of this application.
88
- */
89
- setIconUrl(iconUrl: App["iconUrl"]): this;
90
- /**
91
- * Sets the role of this application.
92
- */
93
- setRole(role: string | null): this;
94
- /**
95
- * Sets the associated extensions of this application.
96
- */
97
- setAssociatedExtensions(extensions: string[] | null): this;
98
- /**
99
- * Changes whether this application is pinned by default or not.
100
- */
101
- setPinnedByDefault(pinnedByDefault: boolean): this;
102
- /**
103
- * Changes whether this application is launched at startup or not.
104
- */
105
- setLaunchAtStartup(launchAtStartup: boolean): this;
106
- /**
107
- * Changes whether this application is installed by default or not.
108
- */
109
- setInstalled(installed: boolean): this;
110
- /**
111
- * Sets the category this application belongs to.
112
- */
113
- setCategory(category: typeof APP_CATEGORIES[number] | null): this;
114
- /**
115
- * Sets the metadata for this application.
116
- */
117
- setMetadata(metadata: AppMetadata | null): this;
118
- /**
119
- * Changes whether this application has a desktop icon in the default data.
120
- */
121
- setShowDesktopIcon(showDesktopIcon: boolean): this;
12
+ export declare function appMetadataPlugin({ entryPath, appClass }: AppMetadataPluginOptions): Plugin_2;
13
+
14
+ /**
15
+ * Options for the {@link appMetadataPlugin}.
16
+ */
17
+ export declare interface AppMetadataPluginOptions {
18
+ /** Path to the app's entry file, relative to the project root. */
19
+ entryPath: string;
122
20
  /**
123
- * Sets the default options for the {@link App.windowContent} component.
21
+ * Name of the app class.
22
+ * @default "App"
124
23
  */
125
- setWindowOptions(windowOptions: Partial<AppProps> & DefaultWindowOptions): this;
126
- }
127
-
128
- 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"];
129
-
130
- declare interface AppMetadata {
131
- name: string;
132
- version: `${number}.${number}.${number}`;
133
- author: string;
24
+ appClass?: string;
134
25
  }
135
26
 
136
- export declare function appMetadataPlugin({ entryPath, appClass }: AppMetadataPluginOptions): Plugin_3;
27
+ /**
28
+ * Vite plugin for building ProzillaOS apps.
29
+ * @example
30
+ * ```ts
31
+ * import { defineConfig } from "vite";
32
+ * import { appPlugin } from "@prozilla-os/dev-tools";
33
+ *
34
+ * export default defineConfig({
35
+ * plugins: [appPlugin({ entryPath: "src/main.ts" })],
36
+ * });
37
+ * ```
38
+ */
39
+ export declare function appPlugin(options: AppPluginOptions): PluginOption[];
137
40
 
138
- declare interface AppMetadataPluginOptions {
41
+ /**
42
+ * Options for the {@link appPlugin}.
43
+ */
44
+ export declare interface AppPluginOptions {
45
+ /** Path to the app's entry file, relative to the project root. */
139
46
  entryPath: string;
47
+ /** CSS class name for the app's root element. */
140
48
  appClass?: string;
141
- }
142
-
143
- declare class AppsConfig {
144
- apps: AppsConfigOptions["apps"];
145
- static APP_ROLES: {
146
- fileExplorer: string;
147
- terminal: string;
148
- textEditor: string;
149
- settings: string;
150
- mediaViewer: string;
151
- browser: string;
152
- };
153
- constructor(options?: Partial<AppsConfigOptions>);
154
- get installedApps(): App<WindowProps>[];
155
- /**
156
- * @param id - The ID of the app.
157
- * @param includeUninstalled - Include apps that are not currently installed.
158
- */
159
- getAppById(id: string, includeUninstalled?: boolean): App | null;
160
- /**
161
- * Get the app associated with a file extension.
162
- */
163
- getAppByFileExtension(fileExtension: string): App | null;
164
- /**
165
- * Get the app with a specific role.
166
- */
167
- getAppByRole(role: string): App | null;
168
- /**
169
- * Get all applications (including uninstalled apps) that belong to a category.
170
- */
171
- getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
172
- }
173
-
174
- declare interface AppsConfigOptions {
175
- /**
176
- * An array of applications.
177
- */
178
- apps: App<WindowProps>[];
49
+ /** Path to the TypeScript build config. Defaults to "tsconfig.build.json". */
50
+ tsconfigPath?: string;
51
+ /** Shared package specifiers to mark as external. Auto-discovered from package.json when omitted. */
52
+ sharedPackages?: string[];
53
+ /** Additional external patterns (strings or RegExps) beyond the shared package specifiers. */
54
+ externalPatterns?: (string | RegExp)[];
179
55
  }
180
56
 
181
57
  /**
182
58
  * Creates a Vite configuration for ProzillaOS apps.
59
+ *
60
+ * @deprecated Use {@link appPlugin} instead.
61
+ *
183
62
  * @param basePath - The path of the base directory.
184
63
  * @param entryPath - The path of the library entry.
185
64
  * @returns The Vite configuration.
@@ -187,35 +66,308 @@ declare interface AppsConfigOptions {
187
66
  */
188
67
  export declare const appViteConfig: (basePath: string, entryPath: string, appClass?: string) => UserConfig;
189
68
 
69
+ /**
70
+ * Defines the matching criteria for a test case using an assertion.
71
+ * @see {@link Matcher}
72
+ * @see {@link CustomTestAPI.assert}
73
+ */
74
+ export declare interface AssertionMatcher<R> {
75
+ readonly [MATCH_ASSERTION]: true;
76
+ /** The assertion that defines the matching criteria for this test. */
77
+ readonly assert: (actual: Assertion<R>) => void;
78
+ /** The name of this assertion. */
79
+ readonly name?: string;
80
+ }
81
+
82
+ /**
83
+ * Utility functions built on top of Vitest's API to make writing tests easier.
84
+ * @see {@link extend}
85
+ */
190
86
  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;
87
+ /**
88
+ * A shorthand for {@link CustomTestAPI.cases} that tests a function with a single parameter.
89
+ * @param func - The function to test.
90
+ * @param cases - An array of tuples. Each tuple consisting of a parameter and the corresponding matching criteria.
91
+ * @typeParam A - The type of parameter the function accepts.
92
+ * @typeParam R - The type of value the function returns.
93
+ * @example
94
+ * test.simpleCases(isEven, [
95
+ * [0, true],
96
+ * [1, false],
97
+ * [2, true],
98
+ * ]);
99
+ */
100
+ simpleCases: <A = unknown, R = undefined>(func: (arg: A) => R, cases: [A, Matcher<R>][]) => void;
101
+ /**
102
+ * A shorthand for {@link CustomTestAPI.case} that tests a function with a single parameter.
103
+ * @param func - The function to test.
104
+ * @param arg - The parameter to pass to the function.
105
+ * @param matcher - The matching criteria.
106
+ * @typeParam A - The type of parameter the function accepts.
107
+ * @typeParam R - The type of value the function returns.
108
+ */
109
+ simpleCase: <A = unknown, R = undefined>(func: (arg: A) => R, arg: A, matcher: Matcher<R>) => void;
110
+ /**
111
+ * Tests each case in the array by calling the function with the first element of the tuple and checking its behaviour
112
+ * or return value against the matching criteria in the second element.
113
+ *
114
+ * This is a wrapper around {@link TestAPI.each} that handles test naming, function calling and assertions for you,
115
+ * so you can write more parameterized tests with less code.
116
+ * @param func - The function to test.
117
+ * @param cases - An array of tuples. Each tuple consisting of an array of parameters and the corresponding matching criteria.
118
+ * @typeParam A - The types of parameters the function accepts.
119
+ * @typeParam R - The type of value the function returns.
120
+ * @example
121
+ * ```ts
122
+ * test.cases(isEqual, [
123
+ * [[0, 1], false],
124
+ * [[2, 3], false],
125
+ * [[4, 4], true],
126
+ * ]);
127
+ * ```
128
+ * ### Comparison with Vitest
129
+ * Most functions will have simple unit tests like this:
130
+ * ```ts
131
+ * test.each([
132
+ * [1, 1, 2],
133
+ * [1, 2, 3],
134
+ * [2, 1, 3],
135
+ * ])("add(%i, %i) -> %i", (a, b, expected) => {
136
+ * expect(a + b).toBe(expected)
137
+ * })
138
+ * ```
139
+ * This is the same test, but using the `cases` wrapper instead:
140
+ * ```ts
141
+ * test.cases(add, [
142
+ * [[1, 1], 2],
143
+ * [[1, 2], 3],
144
+ * [[2, 1], 3]
145
+ * ]);
146
+ * ```
147
+ */
148
+ cases: <A extends unknown[] = [], R = undefined>(func: (...args: A) => R, cases: [A, Matcher<R>][]) => void;
149
+ /**
150
+ * Tests a single case by calling the function with the given parameters and checking its behaviour
151
+ * or return value against the matching criteria.
152
+ *
153
+ * This is the equivalent of {@link CustomTestAPI.cases}, but for a single test case.
154
+ * @param func - The function to test.
155
+ * @param args - The parameters to pass to the function.
156
+ * @param matcher - The matching criteria.
157
+ * @typeParam A - The types of parameters the function accepts.
158
+ * @typeParam R - The type of value the function returns.
159
+ */
160
+ case: <A extends unknown[] = [], R = undefined>(func: (...args: A) => R, args: A, matcher: Matcher<R>) => void;
161
+ /**
162
+ * Creates matching criteria for a test case that expects an error to be thrown.
163
+ * @param error - The type of error to expect.
164
+ * @param message - The error message to expect.
165
+ * @see {@link CustomTestAPI.cases}
166
+ */
167
+ throws: (error: new (...args: never[]) => Error, message?: string | RegExp) => ErrorMatcher;
168
+ /**
169
+ * Creates matching criteria for a test case where the actual value is verified by the given assertion,
170
+ * instead of simply being compared with an expected return value.
171
+ * @param assert - The function that verifies the actual return value.
172
+ * @param name - The name of the assertion.
173
+ * @see {@link CustomTestAPI.cases}
174
+ */
175
+ assert: <R>(assert: (actual: Assertion<R>) => void, name?: string) => AssertionMatcher<R>;
176
+ /** Creates matching criteria for a test case that expects the actual value to be nullish (`null` or `undefined`). */
177
+ nullish: <R>() => AssertionMatcher<R>;
178
+ /** Creates matching criteria for a test case that expects the actual value to be [`falsy`](https://developer.mozilla.org/en-US/docs/Glossary/Falsy). */
179
+ falsy: <R>() => AssertionMatcher<R>;
180
+ /** Creates matching criteria for a test case that expects the actual value to be [`truthy`](https://developer.mozilla.org/en-US/docs/Glossary/Truthy). */
181
+ truthy: <R>() => AssertionMatcher<R>;
182
+ /** Negates the proceding matching criteria for a test case. */
183
+ not: Pick<CustomTestAPI, "nullish" | "falsy" | "truthy">;
184
+ }
185
+
186
+ /**
187
+ * Configuration options for the {@link CustomTestAPI}.
188
+ */
189
+ export declare interface CustomTestConfig {
190
+ /** Options for the formatting of test names. */
191
+ format?: InspectionOptions;
193
192
  }
194
193
 
195
- declare interface DefaultWindowOptions {
196
- size?: Vector2;
197
- [key: string]: unknown;
194
+ /**
195
+ * Defines the matching criteria for a test case that expects the function to throw an error.
196
+ * @see {@link Matcher}
197
+ * @see {@link CustomTestAPI.throws}
198
+ */
199
+ export declare interface ErrorMatcher {
200
+ readonly [MATCH_ERROR]: true;
201
+ /** The type of error the function should throw. */
202
+ readonly error: new (...args: never[]) => Error;
203
+ /** The message the error thrown by the function should have. */
204
+ readonly message?: string | RegExp;
198
205
  }
199
206
 
200
207
  /**
201
208
  * Extends Vitest's {@link TestAPI} with functions from the {@link CustomTestAPI}.
202
209
  * @param test - The Vitest test API.
210
+ * @param config - The configuration options.
203
211
  * @returns The extended test API.
204
212
  * @example
213
+ * You can call this function in one file and export the result.
214
+ * ```ts
215
+ * // index.ts
216
+ * import { test as base } from "vitest";
217
+ *
218
+ * export const test = extend(base);
219
+ * ```
220
+ * Then import and use it across your test files.
221
+ * ```ts
222
+ * // isEven.test.ts
223
+ * import { test } from "./index";
224
+ *
225
+ * test.simpleCases(isEven, [
226
+ * [0, true],
227
+ * [1, false],
228
+ * [2, true],
229
+ * ]);
230
+ * ```
231
+ * ### With configuration
232
+ * ```ts
205
233
  * import { test as base } from "vitest";
206
234
  *
207
- * const test = extend(base);
235
+ * export const test = extend(base, {
236
+ * format: {
237
+ * colors: false,
238
+ * singleQuotes: true,
239
+ * spaceAfterComma: false,
240
+ * },
241
+ * });
242
+ * ```
243
+ */
244
+ export declare function extend<C = object>(test: TestAPI<C>, config?: CustomTestConfig): ExtendedTestAPI<C>;
245
+
246
+ /**
247
+ * The combination of Vitest's {@link TestAPI} and the {@link CustomTestAPI}.
248
+ */
249
+ export declare type ExtendedTestAPI<ExtraContext = object> = TestAPI<ExtraContext> & CustomTestAPI;
250
+
251
+ /**
252
+ * Vite plugin that generates an import map in order to support dynamically installing apps into ProzillaOS.
253
+ */
254
+ export declare function importMapPlugin(options?: ImportMapPluginOptions): PluginOption;
255
+
256
+ /**
257
+ * Options for the {@link importMapPlugin}.
258
+ */
259
+ export declare interface ImportMapPluginOptions {
260
+ /** Packages to expose via import map. When omitted, auto-discovered from the project's package.json. */
261
+ sharedPackages?: SharedPackage[];
262
+ /** Dev-mode import map overrides for packages not handled by CommonJS shims. */
263
+ devImports?: Record<string, string>;
264
+ }
265
+
266
+ /**
267
+ * Represents a choice in an {@link interactiveListPrompt}.
268
+ */
269
+ export declare interface InteractiveListChoice {
270
+ /** The name to display in the list. */
271
+ name: string;
272
+ /** The value to return if this is submitted. */
273
+ value: string;
274
+ /** The keyboard shortcut that submits this choice. */
275
+ key: string;
276
+ }
277
+
278
+ /**
279
+ * Configuration for {@link interactiveListPrompt}.
280
+ */
281
+ export declare interface InteractiveListConfig {
282
+ /** The message to display at the top of the list. */
283
+ message: string;
284
+ /** The list of choices. */
285
+ choices: Array<InteractiveListChoice>;
286
+ /** The default value to select. Defaults to the first choice. A value of `null` represents no selection. */
287
+ default?: string | null;
288
+ /** Function that renders the selected choice. */
289
+ renderSelected?: (choice: InteractiveListChoice, index: number) => string;
290
+ /** Functions that renders the unselected choices. */
291
+ renderUnselected?: (choice: InteractiveListChoice, index: number) => string;
292
+ /**
293
+ * Whether to hide the cursor during selection.
294
+ * @default true
295
+ */
296
+ hideCursor?: boolean;
297
+ /**
298
+ * Whether to horizontally align the shortcuts in the list of choices.
299
+ * @default false
300
+ */
301
+ alignShortcuts?: boolean;
302
+ }
303
+
304
+ /**
305
+ * Creates an interactive list of choices that supports selection via arrow keys + enter or via pressing a key associated with a choice.
306
+ *
307
+ * This is based on {@link https://github.com/pgibler/inquirer-interactive-list-prompt pgibler/inquirer-interactive-list-prompt}.
308
+ * @example
309
+ * ```ts
310
+ * const answer = await interactiveListPrompt({
311
+ * message: "Select an option:",
312
+ * choices: [
313
+ * { name: "Option A", value: "A", key: "a" },
314
+ * { name: "Option B", value: "B", key: "b" },
315
+ * { name: "Option C", value: "C", key: "c" },
316
+ * ],
317
+ * });
318
+ * ```
208
319
  */
209
- export declare function extend(test: TestAPI): ExtendedTestAPI;
320
+ export declare const interactiveListPrompt: (config: InteractiveListConfig) => Promise<string>;
210
321
 
211
- export declare type ExtendedTestAPI = TestAPI & CustomTestAPI;
322
+ /**
323
+ * Returns a list of all files and folders in a directory.
324
+ * @param path - The path of the directory.
325
+ * @returns The contents of the directory.
326
+ */
327
+ export declare function listDirectory(path: string): string[];
328
+
329
+ declare const MATCH_ASSERTION: unique symbol;
330
+
331
+ declare const MATCH_ERROR: unique symbol;
332
+
333
+ /**
334
+ * Defines the matching criteria for a test case.
335
+ *
336
+ * This can either be a plain return value, in which case the test will fail if the function returns a different value,
337
+ * or more complex criteria that determines whether the test will fail.
338
+ * E.g., an {@link ErrorMatcher} will fail if the function does not throw an error of a certain type and with a certain message.
339
+ * @param R - The type of value the function being tested returns.
340
+ * @see {@link CustomTestAPI.cases}
341
+ */
342
+ export declare type Matcher<R = undefined> = R | ErrorMatcher | AssertionMatcher<R>;
212
343
 
213
344
  /**
214
- * @deprecated Use {@link Logger} instead.
345
+ * @deprecated Use {@link @prozilla-os/shared!Logger | Logger} instead.
215
346
  */
216
347
  declare function print_2(message: string, status?: Status, newLine?: boolean): void;
217
348
  export { print_2 as print }
218
349
 
350
+ export declare interface SharedPackage {
351
+ specifier: string;
352
+ chunkName?: string;
353
+ isCommonJS?: boolean;
354
+ }
355
+
356
+ /**
357
+ * Vite plugin that combines `@vitejs/plugin-react-swc`, {@link importMapPlugin} and {@link stageSitePlugin}.
358
+ *
359
+ * This plugin can be used to build a website with ProzillaOS.
360
+ */
361
+ export declare function sitePlugin(options: SitePluginOptions): PluginOption[];
362
+
363
+ /**
364
+ * Options for the {@link sitePlugin}.
365
+ */
366
+ export declare type SitePluginOptions = StageOptions & ImportMapPluginOptions;
367
+
368
+ /**
369
+ * Options for the {@link stageSitePlugin}.
370
+ */
219
371
  export declare interface StageOptions {
220
372
  appsConfig: AppsConfig;
221
373
  /**
@@ -245,98 +397,11 @@ export declare interface StageOptions {
245
397
  imageUrls?: string[];
246
398
  }
247
399
 
400
+ /**
401
+ * Vite plugin that prepares the build of a website that uses ProzillaOS.
402
+ */
248
403
  export declare function stageSitePlugin(options: StageOptions): Plugin_2;
249
404
 
250
405
  export declare type Status = "error" | "info" | "file" | "success" | "start";
251
406
 
252
- declare class Vector2 {
253
- x: number;
254
- y: number;
255
- constructor(xy: number);
256
- constructor(x: number, y?: number);
257
- static get ZERO(): Vector2;
258
- get clone(): Vector2;
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;
268
- getDistance(x: number, y?: number): number;
269
- getDistance(vector2: Vector2): number;
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;
283
- static scale(vector2: Vector2, scalar: number): Vector2;
284
- static normalize(vector2: Vector2): Vector2;
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
- };
294
- }
295
-
296
- declare interface WindowOptions {
297
- /** The ID of the window. */
298
- id?: string;
299
- /** The app associated with the window. */
300
- app?: App;
301
- /**
302
- * The size of the window.
303
- * @default new Vector2(700, 400)
304
- */
305
- size?: Vector2;
306
- /** The position of the window. */
307
- position?: Vector2;
308
- fullscreen?: boolean | string;
309
- options?: object;
310
- isFocused?: boolean;
311
- lastInteraction?: number;
312
- minimized?: boolean;
313
- [key: string]: unknown;
314
- }
315
-
316
- declare interface WindowProps extends WindowOptions {
317
- /**
318
- * Whether to start the window in fullscreen mode.
319
- * @default false
320
- */
321
- fullscreen?: boolean;
322
- /** Function that sets the title of the window. */
323
- setTitle?: React.Dispatch<React.SetStateAction<string>>;
324
- /** Function that sets the icon URL of the window. */
325
- setIconUrl?: React.Dispatch<React.SetStateAction<string>>;
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. */
331
- active?: boolean;
332
- /** Whether to start the window in minimized mode. */
333
- minimized?: boolean;
334
- /** Function that toggles the minimized mode of the window. */
335
- toggleMinimized?: (event?: Event) => void;
336
- /** The depth value of the window. */
337
- index?: number;
338
- /** Whether the window is in standalone mode. */
339
- standalone?: boolean;
340
- }
341
-
342
407
  export { }