@prozilla-os/core 2.0.2 → 3.0.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/README.md +105 -113
- package/dist/chunks/afire-DlRwSfiJ.js +68 -0
- package/dist/chunks/afire-DlRwSfiJ.js.map +1 -0
- package/dist/chunks/banner-jSvYkuqB.js +351 -0
- package/dist/chunks/banner-jSvYkuqB.js.map +1 -0
- package/dist/chunks/cat-B_KOgu80.js +37 -0
- package/dist/chunks/cat-B_KOgu80.js.map +1 -0
- package/dist/chunks/clear-C8xhqHmC.js +12 -0
- package/dist/chunks/clear-C8xhqHmC.js.map +1 -0
- package/dist/chunks/compgen-2kLzA1wV.js +11 -0
- package/dist/chunks/compgen-2kLzA1wV.js.map +1 -0
- package/dist/chunks/{cowsay-hTKzWScw.js → cowsay-CTLxUPtF.js} +13 -13
- package/dist/chunks/cowsay-CTLxUPtF.js.map +1 -0
- package/dist/chunks/date-CA1ub92R.js +33 -0
- package/dist/chunks/date-CA1ub92R.js.map +1 -0
- package/dist/chunks/dir-w2XNd6oI.js +11 -0
- package/dist/chunks/dir-w2XNd6oI.js.map +1 -0
- package/dist/chunks/doubleBracket-B5nqIccY.js +78 -0
- package/dist/chunks/doubleBracket-B5nqIccY.js.map +1 -0
- package/dist/chunks/{echo-Gmh-b8f5.js → echo-_hDVbupR.js} +5 -5
- package/dist/chunks/echo-_hDVbupR.js.map +1 -0
- package/dist/chunks/{eval-DINS_Vhl.js → eval-4uLqmhXl.js} +5 -5
- package/dist/chunks/eval-4uLqmhXl.js.map +1 -0
- package/dist/chunks/false-D6AWAlcU.js +12 -0
- package/dist/chunks/false-D6AWAlcU.js.map +1 -0
- package/dist/chunks/{fortune-DkIZpYa_.js → fortune-D8ZK6xtX.js} +7 -7
- package/dist/chunks/fortune-D8ZK6xtX.js.map +1 -0
- package/dist/chunks/grep-DZO92KaH.js +41 -0
- package/dist/chunks/grep-DZO92KaH.js.map +1 -0
- package/dist/chunks/head-C_bbNyUc.js +50 -0
- package/dist/chunks/head-C_bbNyUc.js.map +1 -0
- package/dist/chunks/help-OHTeCzgo.js +19 -0
- package/dist/chunks/help-OHTeCzgo.js.map +1 -0
- package/dist/chunks/history-DeQor0w1.js +17 -0
- package/dist/chunks/history-DeQor0w1.js.map +1 -0
- package/dist/chunks/hostname-B-lPyRps.js +10 -0
- package/dist/chunks/hostname-B-lPyRps.js.map +1 -0
- package/dist/chunks/install-D2im81Ke.js +27 -0
- package/dist/chunks/install-D2im81Ke.js.map +1 -0
- package/dist/chunks/less-wELkkcQx.js +98 -0
- package/dist/chunks/less-wELkkcQx.js.map +1 -0
- package/dist/chunks/{lolcat-Dyjbg15t.js → lolcat-xpDAXsIt.js} +20 -20
- package/dist/chunks/lolcat-xpDAXsIt.js.map +1 -0
- package/dist/chunks/{ls-DnmR50y0.js → ls-D2Ln7mue.js} +7 -7
- package/dist/chunks/ls-D2Ln7mue.js.map +1 -0
- package/dist/chunks/man-CAthVoAG.js +58 -0
- package/dist/chunks/man-CAthVoAG.js.map +1 -0
- package/dist/chunks/nano-DsRjsQ-k.js +79 -0
- package/dist/chunks/nano-DsRjsQ-k.js.map +1 -0
- package/dist/chunks/neofetch-CgwDNr-T.js +46 -0
- package/dist/chunks/neofetch-CgwDNr-T.js.map +1 -0
- package/dist/chunks/pipes-CQ-pK6Kv.js +89 -0
- package/dist/chunks/pipes-CQ-pK6Kv.js.map +1 -0
- package/dist/chunks/posh-MaU_ieMp.js +23 -0
- package/dist/chunks/posh-MaU_ieMp.js.map +1 -0
- package/dist/chunks/printenv-Cq-skM9d.js +22 -0
- package/dist/chunks/printenv-Cq-skM9d.js.map +1 -0
- package/dist/chunks/pwd-CZ9IWAfu.js +11 -0
- package/dist/chunks/pwd-CZ9IWAfu.js.map +1 -0
- package/dist/chunks/rain-DT-V01dD.js +63 -0
- package/dist/chunks/rain-DT-V01dD.js.map +1 -0
- package/dist/chunks/reload-CE3ZVq6O.js +10 -0
- package/dist/chunks/reload-CE3ZVq6O.js.map +1 -0
- package/dist/chunks/rev-C5m1qeoZ.js +15 -0
- package/dist/chunks/rev-C5m1qeoZ.js.map +1 -0
- package/dist/chunks/rm-Uxuv-dEz.js.map +1 -1
- package/dist/chunks/rmdir-BYWer3pb.js.map +1 -1
- package/dist/chunks/{sl-CLAmugya.js → sl-BGOMkvAR.js} +23 -23
- package/dist/chunks/sl-BGOMkvAR.js.map +1 -0
- package/dist/chunks/sleep-hEBW30R3.js +26 -0
- package/dist/chunks/sleep-hEBW30R3.js.map +1 -0
- package/dist/chunks/snow-DAlyPPxX.js +76 -0
- package/dist/chunks/snow-DAlyPPxX.js.map +1 -0
- package/dist/chunks/tail-BLlaoTxA.js +50 -0
- package/dist/chunks/tail-BLlaoTxA.js.map +1 -0
- package/dist/chunks/terminalUIApp-Bmiaqvd9.js +63 -0
- package/dist/chunks/terminalUIApp-Bmiaqvd9.js.map +1 -0
- package/dist/chunks/textEditorApp-BM3EiMoV.js +56 -0
- package/dist/chunks/textEditorApp-BM3EiMoV.js.map +1 -0
- package/dist/chunks/true-j1Uf2Nz9.js +12 -0
- package/dist/chunks/true-j1Uf2Nz9.js.map +1 -0
- package/dist/chunks/uniq-LncLpnFY.js +44 -0
- package/dist/chunks/uniq-LncLpnFY.js.map +1 -0
- package/dist/chunks/uptime-pYltXMOi.js +10 -0
- package/dist/chunks/uptime-pYltXMOi.js.map +1 -0
- package/dist/chunks/vi-Cgo3qLR9.js +121 -0
- package/dist/chunks/vi-Cgo3qLR9.js.map +1 -0
- package/dist/chunks/watch-B4Tgzgbn.js +53 -0
- package/dist/chunks/watch-B4Tgzgbn.js.map +1 -0
- package/dist/chunks/whatis-BPKA-MNF.js +17 -0
- package/dist/chunks/whatis-BPKA-MNF.js.map +1 -0
- package/dist/chunks/whoami-BS3xdQEI.js +10 -0
- package/dist/chunks/whoami-BS3xdQEI.js.map +1 -0
- package/dist/chunks/yes-ilM2l2xq.js +18 -0
- package/dist/chunks/yes-ilM2l2xq.js.map +1 -0
- package/dist/main.d.ts +1160 -94
- package/dist/main.js +4845 -29914
- package/dist/main.js.map +1 -1
- package/package.json +28 -20
- package/dist/chunks/cat-DH-kPf08.js +0 -44
- package/dist/chunks/cat-DH-kPf08.js.map +0 -1
- package/dist/chunks/clear-DC-frUcf.js +0 -13
- package/dist/chunks/clear-DC-frUcf.js.map +0 -1
- package/dist/chunks/compgen-OhvISbst.js +0 -11
- package/dist/chunks/compgen-OhvISbst.js.map +0 -1
- package/dist/chunks/cowsay-hTKzWScw.js.map +0 -1
- package/dist/chunks/date-D8cnHZuY.js +0 -33
- package/dist/chunks/date-D8cnHZuY.js.map +0 -1
- package/dist/chunks/dir-BmNeEPzy.js +0 -11
- package/dist/chunks/dir-BmNeEPzy.js.map +0 -1
- package/dist/chunks/echo-Gmh-b8f5.js.map +0 -1
- package/dist/chunks/eval-DINS_Vhl.js.map +0 -1
- package/dist/chunks/fortune-DkIZpYa_.js.map +0 -1
- package/dist/chunks/grep-CR3FMStR.js +0 -41
- package/dist/chunks/grep-CR3FMStR.js.map +0 -1
- package/dist/chunks/help-Drx0UDCY.js +0 -19
- package/dist/chunks/help-Drx0UDCY.js.map +0 -1
- package/dist/chunks/history-BEJhnsrb.js +0 -17
- package/dist/chunks/history-BEJhnsrb.js.map +0 -1
- package/dist/chunks/hostname-D8sxyWIy.js +0 -10
- package/dist/chunks/hostname-D8sxyWIy.js.map +0 -1
- package/dist/chunks/lolcat-Dyjbg15t.js.map +0 -1
- package/dist/chunks/ls-DnmR50y0.js.map +0 -1
- package/dist/chunks/man-7W6T7lda.js +0 -60
- package/dist/chunks/man-7W6T7lda.js.map +0 -1
- package/dist/chunks/neofetch--vHMIS9v.js +0 -40
- package/dist/chunks/neofetch--vHMIS9v.js.map +0 -1
- package/dist/chunks/printenv-6OpJKd7g.js +0 -24
- package/dist/chunks/printenv-6OpJKd7g.js.map +0 -1
- package/dist/chunks/pwd-9JYDUbov.js +0 -11
- package/dist/chunks/pwd-9JYDUbov.js.map +0 -1
- package/dist/chunks/reload-CjTJVt5Z.js +0 -10
- package/dist/chunks/reload-CjTJVt5Z.js.map +0 -1
- package/dist/chunks/rev--2pyt1P8.js +0 -12
- package/dist/chunks/rev--2pyt1P8.js.map +0 -1
- package/dist/chunks/sh-B67OTc-j.js +0 -15
- package/dist/chunks/sh-B67OTc-j.js.map +0 -1
- package/dist/chunks/sl-CLAmugya.js.map +0 -1
- package/dist/chunks/uniq-Dx_4r3B5.js +0 -44
- package/dist/chunks/uniq-Dx_4r3B5.js.map +0 -1
- package/dist/chunks/uptime-DjJ5V7hu.js +0 -10
- package/dist/chunks/uptime-DjJ5V7hu.js.map +0 -1
- package/dist/chunks/watch-BjJ8bCnP.js +0 -52
- package/dist/chunks/watch-BjJ8bCnP.js.map +0 -1
- package/dist/chunks/whatis-CFZWdHZ4.js +0 -17
- package/dist/chunks/whatis-CFZWdHZ4.js.map +0 -1
- package/dist/chunks/whoami-D-es0JvS.js +0 -10
- package/dist/chunks/whoami-D-es0JvS.js.map +0 -1
package/dist/main.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
1
2
|
import { Context } from 'react';
|
|
3
|
+
import { Dispatch } from 'react';
|
|
2
4
|
import { EventEmitter } from '@prozilla-os/shared';
|
|
3
5
|
import { FC } from 'react';
|
|
4
6
|
import { ForwardRefExoticComponent } from 'react';
|
|
5
7
|
import { HTMLAttributeAnchorTarget } from 'react';
|
|
6
8
|
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
7
9
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
10
|
+
import { KeyboardEvent as KeyboardEvent_2 } from 'react';
|
|
8
11
|
import { Listener } from '@prozilla-os/shared';
|
|
9
12
|
import { MemoExoticComponent } from 'react';
|
|
13
|
+
import { MergeValues } from '@prozilla-os/shared';
|
|
10
14
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
11
15
|
import { MutableRefObject } from 'react';
|
|
12
16
|
import { NamedExoticComponent } from 'react';
|
|
@@ -14,6 +18,7 @@ import { ReactElement } from 'react';
|
|
|
14
18
|
import { ReactNode } from 'react';
|
|
15
19
|
import { RefAttributes } from 'react';
|
|
16
20
|
import { RefObject } from 'react';
|
|
21
|
+
import { Result } from '@prozilla-os/shared';
|
|
17
22
|
import { Skin } from '@prozilla-os/skins';
|
|
18
23
|
import { Snapshot } from 'valtio';
|
|
19
24
|
import { UaEventOptions } from 'react-ga4/types/ga4';
|
|
@@ -83,9 +88,9 @@ export declare interface AlertParams {
|
|
|
83
88
|
single?: boolean;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
export declare const ANSI_ASCII_LOGO:
|
|
91
|
+
export declare const ANSI_ASCII_LOGO = "\n * \n **** \n **** ***** \n **: @@@@@@ @@@@@@@ \n ** @@@@@@@@@@@@ @@@@@@@@@%\n:**+@@@@@ +@@@@ @@@@ : \n : @@@* @@@ %@@@@@@@ \n ** @@@@ @@@ *@@@@@@@\n:***#@@@@ @@@@ @ @@@@\n **=@@@@@@@@@@% @@@@@@@@@@@\n **- :@@@@@@: :@@@@@@@: \n ";
|
|
87
92
|
|
|
88
|
-
export declare const ANSI_LOGO_COLOR:
|
|
93
|
+
export declare const ANSI_LOGO_COLOR: "\u001B[36m";
|
|
89
94
|
|
|
90
95
|
/**
|
|
91
96
|
* An application that can be ran by ProzillaOS.
|
|
@@ -149,6 +154,16 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
|
|
|
149
154
|
* @default false
|
|
150
155
|
*/
|
|
151
156
|
showDesktopIcon: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Defines the overrides to apply to this app based on the current skin.
|
|
159
|
+
*
|
|
160
|
+
* For each entry, if the key is (a subclass of) the current type of skin, the overrides are applied to this app.
|
|
161
|
+
* If multiple entries match the current skin, they are merged.
|
|
162
|
+
*
|
|
163
|
+
* @see {@link setSkinOverrides}
|
|
164
|
+
* @see {@link addSkinOverride}
|
|
165
|
+
*/
|
|
166
|
+
skinOverrides?: Map<typeof Skin, AppSkinOverrides<AppProps>>;
|
|
152
167
|
isActive: boolean;
|
|
153
168
|
isPinned?: boolean;
|
|
154
169
|
isInstalled: boolean;
|
|
@@ -205,18 +220,44 @@ export declare class App<AppProps extends WindowProps = WindowProps> {
|
|
|
205
220
|
* Sets the default options for the {@link App.windowContent} component.
|
|
206
221
|
*/
|
|
207
222
|
setWindowOptions(windowOptions: Partial<AppProps> & DefaultWindowOptions): this;
|
|
223
|
+
/**
|
|
224
|
+
* Replaces any existing skin overrides with the given overrides.
|
|
225
|
+
* @param skinOverrides - The skin overrides to assign to this app.
|
|
226
|
+
* @see {@link skinOverrides}
|
|
227
|
+
*/
|
|
228
|
+
setSkinOverrides(skinOverrides: App<AppProps>["skinOverrides"]): this;
|
|
229
|
+
/**
|
|
230
|
+
* Adds skin overrides to this app.
|
|
231
|
+
*
|
|
232
|
+
* If there is already an existing entry for the same skin, it is merged with the new overrides.
|
|
233
|
+
*
|
|
234
|
+
* @see {@link skinOverrides}
|
|
235
|
+
*/
|
|
236
|
+
addSkinOverride(skin: typeof Skin, overrides: AppSkinOverrides<AppProps>): this;
|
|
237
|
+
applySkin(skin: Skin): void;
|
|
238
|
+
private applySkinOverrides;
|
|
208
239
|
}
|
|
209
240
|
|
|
210
241
|
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"];
|
|
211
242
|
|
|
212
243
|
export declare interface AppMetadata {
|
|
213
|
-
name
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
244
|
+
/** The display name of this application. */
|
|
245
|
+
name?: string;
|
|
246
|
+
/** The version of this application. */
|
|
247
|
+
version?: string;
|
|
248
|
+
/** The author of this application. */
|
|
249
|
+
author?: string;
|
|
250
|
+
/** Screenshots of this application. */
|
|
251
|
+
screenshots?: string[];
|
|
252
|
+
/** Website of this application or its developer. */
|
|
253
|
+
website?: string;
|
|
254
|
+
/** Release date of this application. */
|
|
255
|
+
releaseDate?: string;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export declare class AppsConfig extends EventEmitter<AppsConfigEvents> {
|
|
219
259
|
apps: AppsConfigOptions["apps"];
|
|
260
|
+
static readonly APPS_CHANGE_EVENT = "appsChange";
|
|
220
261
|
static APP_ROLES: {
|
|
221
262
|
fileExplorer: string;
|
|
222
263
|
terminal: string;
|
|
@@ -226,7 +267,22 @@ export declare class AppsConfig {
|
|
|
226
267
|
browser: string;
|
|
227
268
|
};
|
|
228
269
|
constructor(options?: Partial<AppsConfigOptions>);
|
|
270
|
+
/**
|
|
271
|
+
* Returns a list of all installed apps.
|
|
272
|
+
*/
|
|
229
273
|
get installedApps(): App<WindowProps>[];
|
|
274
|
+
onAppsChange(listener: () => void): () => void;
|
|
275
|
+
addApp(app: App<WindowProps>, systemManager: SystemManager): void;
|
|
276
|
+
removeApp(id: string): boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Load an app from a URL or npm package and register it in the system.
|
|
279
|
+
* If an app with the same ID is already registered but uninstalled,
|
|
280
|
+
* it will be re-enabled instead of loaded again.
|
|
281
|
+
* @param target - The npm package name or URL to load the app from.
|
|
282
|
+
* @returns The loaded (or re-enabled) app.
|
|
283
|
+
*/
|
|
284
|
+
installApp(target: string, systemManager: SystemManager, options?: LoadAppOptions): Promise<App<WindowProps>>;
|
|
285
|
+
uninstallApp(id: string): boolean;
|
|
230
286
|
/**
|
|
231
287
|
* @param id - The ID of the app.
|
|
232
288
|
* @param includeUninstalled - Include apps that are not currently installed.
|
|
@@ -246,6 +302,10 @@ export declare class AppsConfig {
|
|
|
246
302
|
getAppsByCategory(category: typeof APP_CATEGORIES[number]): App[];
|
|
247
303
|
}
|
|
248
304
|
|
|
305
|
+
export declare interface AppsConfigEvents {
|
|
306
|
+
appsChange: [];
|
|
307
|
+
}
|
|
308
|
+
|
|
249
309
|
export declare interface AppsConfigOptions {
|
|
250
310
|
/**
|
|
251
311
|
* An array of applications.
|
|
@@ -253,10 +313,145 @@ export declare interface AppsConfigOptions {
|
|
|
253
313
|
apps: App<WindowProps>[];
|
|
254
314
|
}
|
|
255
315
|
|
|
256
|
-
|
|
316
|
+
/** @interface */
|
|
317
|
+
export declare type AppSkinOverrides<AppProps extends WindowProps = WindowProps> = Partial<Pick<App<AppProps>, "name" | "description" | "windowContent" | "windowOptions" | "iconUrl" | "metadata">>;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* A sequence of strings and expansion nodes that form a single argument.
|
|
321
|
+
*/
|
|
322
|
+
declare type Argument = (string | ExpansionNode)[];
|
|
323
|
+
|
|
324
|
+
export declare interface ArithmeticEnvironment {
|
|
325
|
+
get(name: string): string | undefined;
|
|
326
|
+
set(name: string, value: string): void;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Represents an arithmetic expansion (e.g., `$(( i++ ))`).
|
|
331
|
+
*/
|
|
332
|
+
declare interface ArithmeticExpansionNode extends BaseNode {
|
|
333
|
+
type: NodeType.ArithmeticExpansion;
|
|
334
|
+
content: ArithmeticNode;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
declare interface ArithmeticNode extends BaseNode {
|
|
338
|
+
type: NodeType.Arithmetic;
|
|
339
|
+
/** The math expression. */
|
|
340
|
+
expression: string;
|
|
341
|
+
/** Whether this node is used as a condition. */
|
|
342
|
+
isCondition: boolean;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export declare class ArithmeticParser {
|
|
346
|
+
private readonly env;
|
|
347
|
+
private tokens;
|
|
348
|
+
private position;
|
|
349
|
+
constructor(env: ArithmeticEnvironment);
|
|
350
|
+
evaluate(expression: string): ArithmeticParserResult;
|
|
351
|
+
private peek;
|
|
352
|
+
private pop;
|
|
353
|
+
private match;
|
|
354
|
+
private expect;
|
|
355
|
+
private consume;
|
|
356
|
+
private readVar;
|
|
357
|
+
private writeVar;
|
|
358
|
+
private parseAssignment;
|
|
359
|
+
private applyAssign;
|
|
360
|
+
private parseTernary;
|
|
361
|
+
private whileMatch;
|
|
362
|
+
private parseOr;
|
|
363
|
+
private parseAnd;
|
|
364
|
+
private parseBitOr;
|
|
365
|
+
private parseBitXor;
|
|
366
|
+
private parseBitAnd;
|
|
367
|
+
private parseEquality;
|
|
368
|
+
private parseCompare;
|
|
369
|
+
private parseShift;
|
|
370
|
+
private parseAdd;
|
|
371
|
+
private parseMultiplication;
|
|
372
|
+
private parseExponent;
|
|
373
|
+
private parseUnary;
|
|
374
|
+
private parsePrimary;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export declare type ArithmeticParserResult = Result<number, string>;
|
|
378
|
+
|
|
379
|
+
export declare const ASCII_LOGO = "\n * \n **** \n **** ***** \n **: @@@@@@ @@@@@@@ \n ** @@@@@@@@@@@@ @@@@@@@@@%\n:**+@@@@@ +@@@@ @@@@ : \n : @@@* @@@ %@@@@@@@ \n ** @@@@ @@@ *@@@@@@@\n:***#@@@@ @@@@ @ @@@@\n **=@@@@@@@@@@% @@@@@@@@@@@\n **- :@@@@@@: :@@@@@@@: \n ";
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Represents an assignment of an environment variable.
|
|
383
|
+
*/
|
|
384
|
+
declare interface AssignmentNode extends BaseNode {
|
|
385
|
+
type: NodeType.Assignment;
|
|
386
|
+
/** The name of the environment variable to assign. */
|
|
387
|
+
name: string;
|
|
388
|
+
/** The value to assign to the variable. */
|
|
389
|
+
value: Argument;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Attaches slot components to a root component as properties and names them.
|
|
394
|
+
* @param root - The root component.
|
|
395
|
+
* @param slots - The slot components.
|
|
396
|
+
* @param name - The name of the root component. Usually matches the name passed to {@link createSlots}. Defaults to the displayName or the function name of {@link root}.
|
|
397
|
+
* @returns The root component with the slot components attached to it.
|
|
398
|
+
* @example
|
|
399
|
+
* ```tsx
|
|
400
|
+
* const Accordion = attachSlots(AccordionRoot, {
|
|
401
|
+
* Summary: AccordionSummary,
|
|
402
|
+
* Details: AccordionDetails,
|
|
403
|
+
* });
|
|
404
|
+
* ```
|
|
405
|
+
* ### Usage
|
|
406
|
+
* ```tsx
|
|
407
|
+
* <Accordion>
|
|
408
|
+
* <Accordion.Summary/>
|
|
409
|
+
* <Accordion.Details/>
|
|
410
|
+
* </Accordion>
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
export declare function attachSlots<T extends FC<Record<string, FC>>, S extends Record<string, FC> = InferSlots<ComponentProps<T>>>(root: T, slots: S, name?: string): T & S;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @inheritdoc attachSlots
|
|
417
|
+
*/
|
|
418
|
+
export declare function attachSlots<T extends FC, S extends Record<string, FC>>(root: T, slots: S, name?: string): T & S;
|
|
257
419
|
|
|
258
420
|
export declare const AUDIO_EXTENSIONS: string[];
|
|
259
421
|
|
|
422
|
+
/**
|
|
423
|
+
* An abstract node that uses a condition.
|
|
424
|
+
*/
|
|
425
|
+
declare interface BaseConditionNode extends BaseNode {
|
|
426
|
+
condition: ExecutableNode;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Represents a node that repeatedly executes a block of code.
|
|
431
|
+
*/
|
|
432
|
+
declare interface BaseLoopNode extends BaseRedirectionNode {
|
|
433
|
+
/** The block to execute for every iteration. */
|
|
434
|
+
body: Block;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
declare interface BaseNode {
|
|
438
|
+
/** The type of this node. */
|
|
439
|
+
type: NodeType;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* An abstract node that can handle I/O redirections.
|
|
444
|
+
*/
|
|
445
|
+
declare interface BaseRedirectionNode extends BaseNode {
|
|
446
|
+
/** An optional list of redirections to apply to this execution unit. */
|
|
447
|
+
redirections?: RedirectionNode[];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* A sequence of AST nodes representing a block of code.
|
|
452
|
+
*/
|
|
453
|
+
declare type Block = Node_2[];
|
|
454
|
+
|
|
260
455
|
export declare function Button({ className, href, children, icon, target, ...props }: ButtonProps): JSX_2.Element;
|
|
261
456
|
|
|
262
457
|
export declare interface ButtonProps {
|
|
@@ -268,9 +463,9 @@ export declare interface ButtonProps {
|
|
|
268
463
|
[key: string]: unknown;
|
|
269
464
|
}
|
|
270
465
|
|
|
271
|
-
declare type CategorizedOptions = Record<string, Record<string, ShortcutHandler>>;
|
|
466
|
+
export declare type CategorizedOptions = Record<string, Record<string, ShortcutHandler>>;
|
|
272
467
|
|
|
273
|
-
declare type CategorizedShortcuts = Record<string, Record<string, string[]>>;
|
|
468
|
+
export declare type CategorizedShortcuts = Record<string, Record<string, string[]>>;
|
|
274
469
|
|
|
275
470
|
export declare const ClickAction: MemoExoticComponent<({ actionId, label, shortcut, disabled, onTrigger, icon }: ClickActionProps) => JSX_2.Element>;
|
|
276
471
|
|
|
@@ -303,38 +498,122 @@ export declare class Command {
|
|
|
303
498
|
/**
|
|
304
499
|
* Sets the command name and initializes the default usage string if not already set.
|
|
305
500
|
*/
|
|
306
|
-
setName(name?: string):
|
|
501
|
+
setName(name?: string): this;
|
|
502
|
+
matches(name: string): boolean;
|
|
307
503
|
get name(): string;
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
504
|
+
get aliases(): string[];
|
|
505
|
+
setExecute(execute: Execute): this;
|
|
506
|
+
setRequireArgs(value: boolean): this;
|
|
507
|
+
setRequireOptions(value: boolean): this;
|
|
508
|
+
setManual({ purpose, usage, description, options }: Manual): this;
|
|
312
509
|
/**
|
|
313
510
|
* Registers a new option/flag for this command.
|
|
314
511
|
*/
|
|
315
|
-
addOption({ short, long, isInput }: Omit<Option_2, "isInput"> &
|
|
316
|
-
isInput?: boolean;
|
|
317
|
-
}): Command;
|
|
512
|
+
addOption({ short, long, isInput }: Omit<Option_2, "isInput"> & Partial<Pick<Option_2, "isInput">>): this;
|
|
318
513
|
/**
|
|
319
514
|
* Retrieves an option definition by either its short or long name.
|
|
320
515
|
*/
|
|
321
516
|
getOption(key: string): Option_2 | undefined;
|
|
517
|
+
addAlias(alias: string): this;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Represents a basic shell command to be executed.
|
|
522
|
+
*/
|
|
523
|
+
declare interface CommandNode extends BaseRedirectionNode {
|
|
524
|
+
type: NodeType.Command;
|
|
525
|
+
/** The individual arguments of the command, each potentially containing expansions. */
|
|
526
|
+
args: Argument[];
|
|
322
527
|
}
|
|
323
528
|
|
|
324
529
|
export declare type CommandOutput = number | undefined | void;
|
|
325
530
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
531
|
+
/**
|
|
532
|
+
* Represents a node that gets replaced with the output of a block of code.
|
|
533
|
+
*/
|
|
534
|
+
declare interface CommandSubstitutionNode extends BaseNode {
|
|
535
|
+
type: NodeType.CommandSubstitution;
|
|
536
|
+
/** The node to execute for substitution. */
|
|
537
|
+
content: Block;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Represents a pairing of a condition and a code block.
|
|
542
|
+
* Used for the primary IF branch and subsequent ELIF branches.
|
|
543
|
+
*/
|
|
544
|
+
declare interface ConditionalBlockNode extends BaseConditionNode {
|
|
545
|
+
type: NodeType.ConditionalBlock;
|
|
546
|
+
/** The block to execute if the condition returns {@link EXIT_CODE.success}. */
|
|
547
|
+
thenBranch: Block;
|
|
332
548
|
}
|
|
333
549
|
|
|
334
550
|
export declare type ContextMenuHandler = (event: MouseEvent_2<HTMLElement, MouseEvent_2>, params?: object) => Modal;
|
|
335
551
|
|
|
336
552
|
export declare function copyToClipboard(string: string, onSuccess?: (value: void) => void, onFail?: (value: void) => void): void;
|
|
337
553
|
|
|
554
|
+
/**
|
|
555
|
+
* Creates a context for slots and a provider that renders the slots and provides the context to them.
|
|
556
|
+
*
|
|
557
|
+
* Communication between the root component and its slots happens via the context.
|
|
558
|
+
* The root component renders the provider returned by this function and passes the context value to it, as well as any slots or children it receives.
|
|
559
|
+
* The provider then renders the children of the root component using {@link SlotsView}.
|
|
560
|
+
* Slots can then use the hook to retrieve the context value from the root component.
|
|
561
|
+
*
|
|
562
|
+
* @see {@link SlotsView}
|
|
563
|
+
* @param name - The name of the component associated with these slots.
|
|
564
|
+
* @typeParam C - The type of the context value.
|
|
565
|
+
* @returns A {@link SlotSystem} containing the hook and provider component for the slot system.
|
|
566
|
+
* @example
|
|
567
|
+
* ```tsx
|
|
568
|
+
* const { useSlotsContext, SlotsProvider } = createSlots<{ value: string, setValue: Dispatch<string> }>("MyComponent");
|
|
569
|
+
*
|
|
570
|
+
* // By default, the slot renders the value from the context as simple text.
|
|
571
|
+
* function MyDefaultSlot() {
|
|
572
|
+
* const { value } = useSlotsContext();
|
|
573
|
+
* return <p>{value}</p>;
|
|
574
|
+
* }
|
|
575
|
+
*
|
|
576
|
+
* // We can create a custom slot with an input field that can change the value via the context.
|
|
577
|
+
* function MyCustomSlot() {
|
|
578
|
+
* const { value, setValue } = useSlotsContext();
|
|
579
|
+
* return <input value={value} onChange={(event) => setValue(event.target.value)}/>;
|
|
580
|
+
* }
|
|
581
|
+
*
|
|
582
|
+
* const DEFAULT_SLOTS = { Slot: MyDefaultSlot };
|
|
583
|
+
*
|
|
584
|
+
* // This is the root component.
|
|
585
|
+
* function MyComponent({ children, ...slots }: PropsWithSlots<{ Slot: FC }>) {
|
|
586
|
+
* const [value, setValue] = useState("No value set");
|
|
587
|
+
* const context = useMemo(() => ({ value, setValue }), [value]);
|
|
588
|
+
*
|
|
589
|
+
* return <SlotsProvider
|
|
590
|
+
* context={context}
|
|
591
|
+
* defaults={DEFAULT_SLOTS}
|
|
592
|
+
* slots={slots}
|
|
593
|
+
* >
|
|
594
|
+
* {children}
|
|
595
|
+
* </SlotsProvider>;
|
|
596
|
+
* }
|
|
597
|
+
* ```
|
|
598
|
+
* We use `useMemo()` here to avoid re-rendering all slots on every re-render of `<MyComponent/>`.
|
|
599
|
+
* ### Usage
|
|
600
|
+
* ```tsx
|
|
601
|
+
* // We can use the component without any props and it will render the default slot.
|
|
602
|
+
* <MyComponent/>
|
|
603
|
+
*
|
|
604
|
+
* // We can pass our custom slot to replace the default slot with.
|
|
605
|
+
* <MyComponent renderSlot={MyCustomSlot}/>
|
|
606
|
+
*
|
|
607
|
+
* // We can also replace all slots with any content (including slots) by giving the component children.
|
|
608
|
+
* <MyComponent>
|
|
609
|
+
* <h1>Hello world</h1>
|
|
610
|
+
* <MyDefaultSlot/>
|
|
611
|
+
* <MyCustomSlot/>
|
|
612
|
+
* </MyComponent>
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
export declare function createSlots<C>(name: string, defaultValue?: C): SlotSystem<C>;
|
|
616
|
+
|
|
338
617
|
export declare function DefaultRoute(): JSX_2.Element;
|
|
339
618
|
|
|
340
619
|
export declare interface DefaultWindowOptions {
|
|
@@ -424,6 +703,62 @@ export declare interface DropdownButtonProps {
|
|
|
424
703
|
shortcuts: Record<string, string[]>;
|
|
425
704
|
}
|
|
426
705
|
|
|
706
|
+
/**
|
|
707
|
+
* An executable command or file.
|
|
708
|
+
*/
|
|
709
|
+
export declare type Executable = Command | VirtualFile;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Represents a node that acts as an executable unit capable of
|
|
713
|
+
* handling standard input and output streams and returning an exit code.
|
|
714
|
+
*/
|
|
715
|
+
declare type ExecutableNode = CommandNode | LogicalNode | PipelineNode | IfNode | WhileNode | ForInNode | ForExpressionNode | AssignmentNode | ArithmeticNode;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Represent the result of the resolution of an executable.
|
|
719
|
+
*/
|
|
720
|
+
export declare type ExecutableResolutionResult = Result<Executable, string>;
|
|
721
|
+
|
|
722
|
+
export declare class ExecutableResolver {
|
|
723
|
+
static builtins: Command[];
|
|
724
|
+
private static loadingTask;
|
|
725
|
+
static readonly NOT_FOUND_ERROR = "Command not found";
|
|
726
|
+
static readonly IS_DIRECTORY_ERROR = "Is a directory";
|
|
727
|
+
/**
|
|
728
|
+
* Finds the executable with the given name.
|
|
729
|
+
* @param name - The name of the executable.
|
|
730
|
+
* @param env - The environment to read the path variable from.
|
|
731
|
+
* @param workingDirectory - The directory to search in.
|
|
732
|
+
*/
|
|
733
|
+
static resolve(name: string, env: ShellEnvironment, workingDirectory: VirtualFolder): Promise<ExecutableResolutionResult>;
|
|
734
|
+
/**
|
|
735
|
+
* Resolves a specific path to a {@link VirtualFile}.
|
|
736
|
+
* @param path - The path to navigate to.
|
|
737
|
+
* @param workingDirectory - The directory to start the navigation from.
|
|
738
|
+
* @returns The resolved file or a failure if this is a directory or does not exist.
|
|
739
|
+
*/
|
|
740
|
+
private static resolvePath;
|
|
741
|
+
/**
|
|
742
|
+
* Attempts to resolve an executable by searching through the directories defined in the PATH variable.
|
|
743
|
+
* @param name - The name of the executable.
|
|
744
|
+
* @param env - The environment containing the PATH variable.
|
|
745
|
+
* @param workingDirectory - The directory to use for path resolution.
|
|
746
|
+
* @returns The first matching executable found in the PATH.
|
|
747
|
+
*/
|
|
748
|
+
private static resolveFromPathVariable;
|
|
749
|
+
/**
|
|
750
|
+
* Finds the builtin command with the given name.
|
|
751
|
+
* @param name - The name of the builtin.
|
|
752
|
+
* @returns The builtin with the given name, or `null` if there is none.
|
|
753
|
+
*/
|
|
754
|
+
static getBuiltin(name: string): Command | null;
|
|
755
|
+
/**
|
|
756
|
+
* Loads all builtins.
|
|
757
|
+
* @returns A promise that resolves when all builtins have finished loading.
|
|
758
|
+
*/
|
|
759
|
+
static loadBuiltins(): Promise<void>;
|
|
760
|
+
}
|
|
761
|
+
|
|
427
762
|
export declare type Execute = (args: string[], context: ShellContext) => Promise<CommandOutput> | CommandOutput;
|
|
428
763
|
|
|
429
764
|
export declare const EXIT_CODE: {
|
|
@@ -433,9 +768,11 @@ export declare const EXIT_CODE: {
|
|
|
433
768
|
readonly commandNotExecutable: 126;
|
|
434
769
|
readonly commandNotFound: 127;
|
|
435
770
|
readonly invalidExitArgument: 128;
|
|
436
|
-
readonly
|
|
771
|
+
readonly interrupted: 130;
|
|
437
772
|
};
|
|
438
773
|
|
|
774
|
+
declare type ExpansionNode = ParameterExpansionNode | ArithmeticExpansionNode | CommandSubstitutionNode;
|
|
775
|
+
|
|
439
776
|
export declare const FILE_SCHEMES: {
|
|
440
777
|
external: string;
|
|
441
778
|
app: string;
|
|
@@ -443,12 +780,73 @@ export declare const FILE_SCHEMES: {
|
|
|
443
780
|
|
|
444
781
|
export declare type FileEventHandler = (event: Event, file: VirtualFile) => void;
|
|
445
782
|
|
|
446
|
-
|
|
783
|
+
/**
|
|
784
|
+
* A stream that reads content from a {@link VirtualFile} and pushes it into the stream buffer.
|
|
785
|
+
*/
|
|
786
|
+
export declare class FileInputStream extends Stream {
|
|
787
|
+
private file;
|
|
788
|
+
constructor(file: VirtualFile);
|
|
789
|
+
private init;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* A stream that collects written data and saves it to a {@link VirtualFile} upon completion.
|
|
794
|
+
*/
|
|
795
|
+
export declare class FileOutputStream extends Stream {
|
|
796
|
+
private file;
|
|
797
|
+
private writeBuffer;
|
|
798
|
+
constructor(file: VirtualFile);
|
|
799
|
+
}
|
|
447
800
|
|
|
448
|
-
declare type
|
|
801
|
+
export declare type FlatOptions = Record<string, ShortcutHandler>;
|
|
802
|
+
|
|
803
|
+
export declare type FlatShortcuts = Record<string, string[]>;
|
|
449
804
|
|
|
450
805
|
export declare type FolderEventHandler = (event: Event, folder: VirtualFolder) => void;
|
|
451
806
|
|
|
807
|
+
export declare interface FontMetrics {
|
|
808
|
+
/** The dimensions of a single character, in pixels. */
|
|
809
|
+
charSize: Vector2;
|
|
810
|
+
/** The dimensions of the container, in rows and columns. */
|
|
811
|
+
containerSize: Vector2;
|
|
812
|
+
/** The element to attach to the container, used for doing measurements. */
|
|
813
|
+
sentinel: ReactElement;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
export declare interface FontMetricsParams {
|
|
817
|
+
/** A reactive reference to the container element. */
|
|
818
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
819
|
+
/**
|
|
820
|
+
* The string to use for character measurements.
|
|
821
|
+
* @default "M".repeat(100)
|
|
822
|
+
*/
|
|
823
|
+
testString?: string;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* A C-style `for` loop structure with a setup, condition and step.
|
|
828
|
+
*/
|
|
829
|
+
declare interface ForExpressionNode extends BaseLoopNode {
|
|
830
|
+
type: NodeType.ForExpression;
|
|
831
|
+
/** The node to execute before the loop. */
|
|
832
|
+
setup: ArithmeticNode;
|
|
833
|
+
/** The condition that determines whether the loop should continue. */
|
|
834
|
+
condition: ArithmeticNode;
|
|
835
|
+
/** The node to execute after each iteration of the loop. */
|
|
836
|
+
step: ArithmeticNode;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Represents a `for` loop structure for iterating over a list of items.
|
|
841
|
+
*/
|
|
842
|
+
declare interface ForInNode extends BaseLoopNode {
|
|
843
|
+
type: NodeType.ForIn;
|
|
844
|
+
/** The name of the environment variable assigned to the current item. */
|
|
845
|
+
variableName: string;
|
|
846
|
+
/** The list of raw strings or patterns to iterate over. */
|
|
847
|
+
items: Argument[];
|
|
848
|
+
}
|
|
849
|
+
|
|
452
850
|
/**
|
|
453
851
|
* Formats a shortcut (combination of keys) into a human-readable format.
|
|
454
852
|
*
|
|
@@ -475,18 +873,34 @@ export declare function HeaderMenu({ children, ...props }: ActionsProps): JSX_2.
|
|
|
475
873
|
* Represents a single entry in the shell's output history.
|
|
476
874
|
*/
|
|
477
875
|
export declare interface HistoryEntry {
|
|
478
|
-
/** The text content to display. */
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
876
|
+
/** The text content to display in the terminal. */
|
|
877
|
+
displayText?: string;
|
|
878
|
+
/** The raw input string of the command in this entry. */
|
|
879
|
+
input?: string;
|
|
880
|
+
flags: HistoryFlags;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
export declare enum HistoryFlags {
|
|
884
|
+
None = 0,
|
|
885
|
+
Command = 1,
|
|
886
|
+
Clear = 2
|
|
486
887
|
}
|
|
487
888
|
|
|
488
889
|
export declare const HOSTNAME = "prozilla-os";
|
|
489
890
|
|
|
891
|
+
/**
|
|
892
|
+
* Represents a conditional branching structure.
|
|
893
|
+
*/
|
|
894
|
+
declare interface IfNode extends BaseRedirectionNode {
|
|
895
|
+
type: NodeType.If;
|
|
896
|
+
/** The primary conditional branch. */
|
|
897
|
+
ifBranch: ConditionalBlockNode;
|
|
898
|
+
/** An array of additional conditional branches. */
|
|
899
|
+
elifBranches: ConditionalBlockNode[];
|
|
900
|
+
/** The block to execute if no conditions are met. */
|
|
901
|
+
elseBranch: Block;
|
|
902
|
+
}
|
|
903
|
+
|
|
490
904
|
declare function Image_2({ className, src, ...props }: ImageProps): JSX_2.Element;
|
|
491
905
|
export { Image_2 as Image }
|
|
492
906
|
|
|
@@ -506,6 +920,45 @@ export declare interface ImageProps {
|
|
|
506
920
|
[key: string]: unknown;
|
|
507
921
|
}
|
|
508
922
|
|
|
923
|
+
/**
|
|
924
|
+
* Infers the dictionary that maps slot names to components from the props of a component with slots (e.g., a component with props of type {@link PropsWithSlots}).
|
|
925
|
+
* @example
|
|
926
|
+
* ### From props
|
|
927
|
+
* This can be used to infer the slots from the props of a component with slots:
|
|
928
|
+
* ```ts
|
|
929
|
+
* type MyProps = PropsWithSlots<{ SlotA: FC; SlotB: FC }>;
|
|
930
|
+
* type MySlots = InferSlots<MyProps>; // Result: { SlotA: FC; SlotB: FC }
|
|
931
|
+
* ```
|
|
932
|
+
* ### From a component
|
|
933
|
+
* This can also be used in combination with `ComponentProps` to infer the slots directly from a component with slots.
|
|
934
|
+
* ```ts
|
|
935
|
+
* function MyComponent(props: PropsWithSlots<{ SlotA: FC; SlotB: FC }>) {
|
|
936
|
+
* // ...
|
|
937
|
+
* }
|
|
938
|
+
*
|
|
939
|
+
* type MySlots = InferSlots<ComponentProps<typeof MyComponent>>; // Result: { SlotA: FC; SlotB: FC }
|
|
940
|
+
* ```
|
|
941
|
+
*/
|
|
942
|
+
export declare type InferSlots<T extends Slots<Record<string, FC>>> = {
|
|
943
|
+
[K in keyof T & string as K extends `render${infer Key}` ? Key : never]: Exclude<T[K], undefined>;
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
export declare interface InputStream<T = string> {
|
|
947
|
+
read(): Promise<Result<T | null, StreamError>>;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
export declare interface InstalledAppsOptions {
|
|
951
|
+
/**
|
|
952
|
+
* Comparator function (defaults to alphabetical by name) or a boolean.
|
|
953
|
+
* If the value is `true`, the default sorting function is used, if it is `false`, the sorting step is skipped.
|
|
954
|
+
*/
|
|
955
|
+
sort?: ((a: App, b: App) => number) | boolean;
|
|
956
|
+
/**
|
|
957
|
+
* Optional predicate to narrow the list.
|
|
958
|
+
*/
|
|
959
|
+
filter?: (app: App) => boolean;
|
|
960
|
+
}
|
|
961
|
+
|
|
509
962
|
/**
|
|
510
963
|
* Button component that handles single and double clicks.
|
|
511
964
|
*/
|
|
@@ -520,7 +973,35 @@ export declare interface InteractableProps {
|
|
|
520
973
|
[key: string]: unknown;
|
|
521
974
|
}
|
|
522
975
|
|
|
523
|
-
|
|
976
|
+
/**
|
|
977
|
+
* Statically checks whether the given {@link ReactNode} contains no renderable content, without actually rendering it.
|
|
978
|
+
* @param node - The node to check.
|
|
979
|
+
* @returns `true` if there is no renderable child.
|
|
980
|
+
*/
|
|
981
|
+
export declare function isEmpty(node: ReactNode): boolean;
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Load an app from either a URL or an npm package name (auto-detected).
|
|
985
|
+
*/
|
|
986
|
+
export declare function loadApp(appNameOrUrl: string, options?: LoadAppOptions): Promise<App<WindowProps>>;
|
|
987
|
+
|
|
988
|
+
export declare interface LoadAppOptions {
|
|
989
|
+
/**
|
|
990
|
+
* The name of the export that contains the App instance.
|
|
991
|
+
* If not specified, checks `app` first, then `default`.
|
|
992
|
+
*/
|
|
993
|
+
exportName?: string;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Represents logical execution flow (`&&` or `||`).
|
|
998
|
+
*/
|
|
999
|
+
declare interface LogicalNode extends BaseRedirectionNode {
|
|
1000
|
+
type: NodeType.Logical;
|
|
1001
|
+
left: ExecutableNode;
|
|
1002
|
+
operator: "&&" | "||";
|
|
1003
|
+
right: ExecutableNode;
|
|
1004
|
+
}
|
|
524
1005
|
|
|
525
1006
|
/**
|
|
526
1007
|
* Documentation metadata used by the `help` or `man` commands.
|
|
@@ -533,7 +1014,7 @@ export declare interface Manual {
|
|
|
533
1014
|
/** A detailed explanation of the command's behavior. */
|
|
534
1015
|
description?: string;
|
|
535
1016
|
/** A mapping of option names to their descriptions for the help output. */
|
|
536
|
-
options?:
|
|
1017
|
+
options?: Record<string, string>;
|
|
537
1018
|
}
|
|
538
1019
|
|
|
539
1020
|
export declare const MAX_WIDTH = 50;
|
|
@@ -693,6 +1174,28 @@ export declare type ModalsManagerState = ModalsManager | undefined;
|
|
|
693
1174
|
*/
|
|
694
1175
|
export declare const ModalsView: MemoExoticComponent<() => JSX_2.Element>;
|
|
695
1176
|
|
|
1177
|
+
/**
|
|
1178
|
+
* Represents a node in the shell's Abstract Syntax Tree (AST).
|
|
1179
|
+
*/
|
|
1180
|
+
declare type Node_2 = ExecutableNode | ConditionalBlockNode | ExpansionNode;
|
|
1181
|
+
|
|
1182
|
+
declare enum NodeType {
|
|
1183
|
+
Command = "command",
|
|
1184
|
+
Logical = "logical",
|
|
1185
|
+
Pipeline = "pipeline",
|
|
1186
|
+
If = "if",
|
|
1187
|
+
ConditionalBlock = "conditionalBlock",
|
|
1188
|
+
While = "while",
|
|
1189
|
+
ForIn = "forIn",
|
|
1190
|
+
ForExpression = "forExpression",
|
|
1191
|
+
Assignment = "assignment",
|
|
1192
|
+
Arithmetic = "arithmetic",
|
|
1193
|
+
ParameterExpansion = "parameterExpansion",
|
|
1194
|
+
ArithmeticExpansion = "arithmeticExpansion",
|
|
1195
|
+
CommandSubstitution = "commandSubstitution",
|
|
1196
|
+
Redirection = "redirection"
|
|
1197
|
+
}
|
|
1198
|
+
|
|
696
1199
|
export declare function NoRoute(): JSX_2.Element;
|
|
697
1200
|
|
|
698
1201
|
export declare interface NoRouteProps {
|
|
@@ -736,9 +1239,9 @@ export declare interface OpenWindowedModalParams {
|
|
|
736
1239
|
*/
|
|
737
1240
|
declare interface Option_2 {
|
|
738
1241
|
/** The full name of the option (e.g., `"all"` for `--all`). */
|
|
739
|
-
long
|
|
1242
|
+
long?: string;
|
|
740
1243
|
/** The single-character alias (e.g., `"a"` for `-a`). */
|
|
741
|
-
short
|
|
1244
|
+
short?: string;
|
|
742
1245
|
/** If true, the shell expects a value to follow this option (e.g., `--file <name>`). */
|
|
743
1246
|
isInput: boolean;
|
|
744
1247
|
}
|
|
@@ -746,6 +1249,10 @@ export { Option_2 as Option }
|
|
|
746
1249
|
|
|
747
1250
|
export declare type OptionalStringProperty = string | null | undefined;
|
|
748
1251
|
|
|
1252
|
+
export declare interface OutputStream<T = string> {
|
|
1253
|
+
write(data: T): Promise<Result<void, StreamError>>;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
749
1256
|
/**
|
|
750
1257
|
* Component that calls a function when the user clicks outside of it.
|
|
751
1258
|
*/
|
|
@@ -757,6 +1264,31 @@ export declare interface OutsideClickListenerProps {
|
|
|
757
1264
|
children: ReactNode;
|
|
758
1265
|
}
|
|
759
1266
|
|
|
1267
|
+
/**
|
|
1268
|
+
* Represents a parameter expansion (e.g., `${HOME}`).
|
|
1269
|
+
*/
|
|
1270
|
+
declare interface ParameterExpansionNode extends BaseNode {
|
|
1271
|
+
type: NodeType.ParameterExpansion;
|
|
1272
|
+
/** The name of the variable (e.g., `"HOME"` in `${HOME}`). */
|
|
1273
|
+
name: string;
|
|
1274
|
+
/** The expansion operator. */
|
|
1275
|
+
operator?: "-" | "=" | "+" | "?";
|
|
1276
|
+
/** The optional argument following the operator, which may contain further expansions. */
|
|
1277
|
+
argument?: Argument;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
/**
|
|
1281
|
+
* Represents a sequence of commands where the output of one is piped to the next.
|
|
1282
|
+
*/
|
|
1283
|
+
declare interface PipelineNode extends BaseRedirectionNode {
|
|
1284
|
+
type: NodeType.Pipeline;
|
|
1285
|
+
/**
|
|
1286
|
+
* A list of executable nodes where the `stdout` of one
|
|
1287
|
+
* is connected to the `stdin` of the next.
|
|
1288
|
+
*/
|
|
1289
|
+
commands: ExecutableNode[];
|
|
1290
|
+
}
|
|
1291
|
+
|
|
760
1292
|
/**
|
|
761
1293
|
* Represents an active or pending process within the shell.
|
|
762
1294
|
*/
|
|
@@ -777,6 +1309,8 @@ export declare interface ProcessIO {
|
|
|
777
1309
|
stdout: Stream;
|
|
778
1310
|
/** The stream used to output error messages. */
|
|
779
1311
|
stderr: Stream;
|
|
1312
|
+
/** The environment the process may read from or write to. */
|
|
1313
|
+
env: ShellEnvironment;
|
|
780
1314
|
}
|
|
781
1315
|
|
|
782
1316
|
/**
|
|
@@ -796,6 +1330,20 @@ export declare interface ProgressBarProps {
|
|
|
796
1330
|
className?: string;
|
|
797
1331
|
}
|
|
798
1332
|
|
|
1333
|
+
/**
|
|
1334
|
+
* The props of a component that supports slots.
|
|
1335
|
+
*
|
|
1336
|
+
* @typeParam S - A dictionary mapping each slot name to a component.
|
|
1337
|
+
*/
|
|
1338
|
+
export declare type PropsWithSlots<S extends Record<string, FC>> = Slots<S> & {
|
|
1339
|
+
/**
|
|
1340
|
+
* The content to render instead of the slots.
|
|
1341
|
+
*
|
|
1342
|
+
* If this is an empty value, the slots will be rendered instead.
|
|
1343
|
+
*/
|
|
1344
|
+
children?: ReactNode;
|
|
1345
|
+
};
|
|
1346
|
+
|
|
799
1347
|
/**
|
|
800
1348
|
* Main component that contains everything .
|
|
801
1349
|
*/
|
|
@@ -831,15 +1379,24 @@ export declare interface RadioActionProps extends ActionProps {
|
|
|
831
1379
|
initialIndex?: number;
|
|
832
1380
|
}
|
|
833
1381
|
|
|
1382
|
+
/**
|
|
1383
|
+
* Represents a file descriptor redirection.
|
|
1384
|
+
*/
|
|
1385
|
+
declare interface RedirectionNode extends BaseNode {
|
|
1386
|
+
type: NodeType.Redirection;
|
|
1387
|
+
/** The file descriptor to redirect (e.g., 0 for stdin, 1 for stdout, 2 for stderr). */
|
|
1388
|
+
fileDescriptor: number;
|
|
1389
|
+
/** The redirection operator. */
|
|
1390
|
+
operator: ">" | ">>" | "<" | "<&" | ">&";
|
|
1391
|
+
/** The target of the redirection, usually a file path or another file descriptor. */
|
|
1392
|
+
target: Argument;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
834
1395
|
/**
|
|
835
1396
|
* Reloads the viewport.
|
|
836
1397
|
*/
|
|
837
1398
|
export declare function reloadViewport(): void;
|
|
838
1399
|
|
|
839
|
-
export declare function removeBaseUrl(url: string): string;
|
|
840
|
-
|
|
841
|
-
export declare function removeUrlProtocol(url: string): string;
|
|
842
|
-
|
|
843
1400
|
export declare function Router({ path, homePage, fallbackPage, children }: RouterProps): JSX_2.Element;
|
|
844
1401
|
|
|
845
1402
|
export declare interface RouterProps {
|
|
@@ -880,7 +1437,7 @@ export declare class Settings {
|
|
|
880
1437
|
* Virtual path to the virtual drive settings.
|
|
881
1438
|
*/
|
|
882
1439
|
static readonly VIRTUAL_DRIVE: string;
|
|
883
|
-
constructor(virtualRoot: VirtualRoot, path: string);
|
|
1440
|
+
constructor(settingsManager: SettingsManager, virtualRoot: VirtualRoot, path: string);
|
|
884
1441
|
/**
|
|
885
1442
|
* Reads the xml doc from the given path and assigns it to itself.
|
|
886
1443
|
*/
|
|
@@ -936,7 +1493,8 @@ export declare class SettingsManager {
|
|
|
936
1493
|
static VIRTUAL_PATHS: {
|
|
937
1494
|
[s: string]: string;
|
|
938
1495
|
};
|
|
939
|
-
|
|
1496
|
+
enableWarning: boolean;
|
|
1497
|
+
constructor(virtualRoot: VirtualRoot, enableWarnings?: boolean);
|
|
940
1498
|
getSettings(path: string): Settings;
|
|
941
1499
|
}
|
|
942
1500
|
|
|
@@ -953,7 +1511,7 @@ export declare function setViewportTitle(title: string): void;
|
|
|
953
1511
|
export declare function Share({ modal, params, ...props }: ModalProps): JSX_2.Element;
|
|
954
1512
|
|
|
955
1513
|
/**
|
|
956
|
-
* A
|
|
1514
|
+
* A Bash-like shell emulator, called Posh (ProzillaOS shell), that handles command parsing, environment management,
|
|
957
1515
|
* autocompletion, and process I/O.
|
|
958
1516
|
*/
|
|
959
1517
|
export declare class Shell {
|
|
@@ -965,7 +1523,6 @@ export declare class Shell {
|
|
|
965
1523
|
env: ShellEnvironment;
|
|
966
1524
|
/** The logic handler for parsing and executing command strings. */
|
|
967
1525
|
interpreter: ShellInterpreter;
|
|
968
|
-
static readonly COMMAND_NOT_FOUND_ERROR = "Command not found";
|
|
969
1526
|
static readonly MISSING_ARGS_ERROR = "requires at least 1 argument";
|
|
970
1527
|
static readonly MISSING_OPTIONS_ERROR = "requires at least 1 option";
|
|
971
1528
|
static readonly COMMAND_FAILED_ERROR = "Command failed";
|
|
@@ -973,8 +1530,16 @@ export declare class Shell {
|
|
|
973
1530
|
static readonly INVALID_PATH_ERROR = "No such file or directory";
|
|
974
1531
|
static readonly SUDO_COMMAND = "sudo";
|
|
975
1532
|
/** Regex used to strip specific ANSI escape codes from the TTY buffer. */
|
|
976
|
-
static readonly STRIP_ANSI_REGEX
|
|
1533
|
+
private static readonly STRIP_ANSI_REGEX;
|
|
1534
|
+
private static readonly CURSOR_REGEX;
|
|
1535
|
+
private static readonly KEY_TO_ANSI;
|
|
977
1536
|
constructor(config: ShellConfig);
|
|
1537
|
+
handleKeyDown(event: Pick<KeyboardEvent_2, "key" | "preventDefault"> & Partial<Pick<KeyboardEvent_2, "ctrlKey" | "metaKey" | "shiftKey">>): Promise<void>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Toggles raw mode, which forwards all keystrokes directly to the active stream.
|
|
1540
|
+
* @param rawMode - Whether to enable raw mode.
|
|
1541
|
+
*/
|
|
1542
|
+
setRawMode(rawMode: boolean): void;
|
|
978
1543
|
/**
|
|
979
1544
|
* Sends a signal to the shell or the currently active foreground process.
|
|
980
1545
|
* @param signal - The signal to send. Defaults to `"SIGTERM"`.
|
|
@@ -991,9 +1556,9 @@ export declare class Shell {
|
|
|
991
1556
|
*/
|
|
992
1557
|
kill(): void;
|
|
993
1558
|
/**
|
|
994
|
-
*
|
|
1559
|
+
* Refreshes the prompt string based on the current user, hostname, and working directory.
|
|
995
1560
|
*/
|
|
996
|
-
updatePrompt(): void
|
|
1561
|
+
updatePrompt(): Promise<void>;
|
|
997
1562
|
/**
|
|
998
1563
|
* Updates the text in the current input line.
|
|
999
1564
|
* @param value - The new string value or a function that receives the previous value.
|
|
@@ -1010,11 +1575,16 @@ export declare class Shell {
|
|
|
1010
1575
|
*/
|
|
1011
1576
|
write(text: string): void;
|
|
1012
1577
|
/**
|
|
1013
|
-
*
|
|
1578
|
+
* Commits the current input line and executes the given command string.
|
|
1014
1579
|
* @param input - The command string to execute.
|
|
1015
1580
|
* @returns A promise that resolves with the final exit code of the execution.
|
|
1016
1581
|
*/
|
|
1017
1582
|
run(input: string): Promise<number>;
|
|
1583
|
+
/**
|
|
1584
|
+
* Commits the current line or the given input string.
|
|
1585
|
+
* @param input - The input string.
|
|
1586
|
+
*/
|
|
1587
|
+
commitLine(input?: string): void;
|
|
1018
1588
|
/**
|
|
1019
1589
|
* Clears the current input line and resets the history search offset.
|
|
1020
1590
|
*/
|
|
@@ -1039,6 +1609,28 @@ export declare class Shell {
|
|
|
1039
1609
|
* If multiple are found, it lists them in the history.
|
|
1040
1610
|
*/
|
|
1041
1611
|
autoComplete(): void;
|
|
1612
|
+
/**
|
|
1613
|
+
* Sets the shell to raw mode, listens for input on stdin.
|
|
1614
|
+
* @param stdin - The standard input stream.
|
|
1615
|
+
* @param onData - The callback to handle incoming data chunks.
|
|
1616
|
+
*/
|
|
1617
|
+
readRawInput(stdin: Stream, onData: (data: string) => void | Promise<void>): Promise<void>;
|
|
1618
|
+
/**
|
|
1619
|
+
* Processes a list of paths, falling back to standard input if the list is empty or contains "-".
|
|
1620
|
+
* @param params
|
|
1621
|
+
* @param params.paths - The list of file paths or "-" for stdin.
|
|
1622
|
+
* @param params.workingDirectory - The directory to resolve paths against.
|
|
1623
|
+
* @param params.commandName - The name of the command invoking this utility.
|
|
1624
|
+
* @param params.onContent - Callback for file content.
|
|
1625
|
+
* @param params.onStdinData - Callback for standard input data.
|
|
1626
|
+
*/
|
|
1627
|
+
readFiles({ paths, workingDirectory, stdin, stderr, commandName, onContent, onStdinData, }: {
|
|
1628
|
+
paths: string[];
|
|
1629
|
+
workingDirectory: VirtualFolder;
|
|
1630
|
+
commandName: string;
|
|
1631
|
+
onContent: (content: string) => void | Promise<void>;
|
|
1632
|
+
onStdinData: (data: string) => void | Promise<void>;
|
|
1633
|
+
} & Pick<ProcessIO, "stdin" | "stderr">): Promise<number>;
|
|
1042
1634
|
/**
|
|
1043
1635
|
* Utility to write a formatted error message to a stream and return an exit code.
|
|
1044
1636
|
* @param stream - The stream to receive the error output.
|
|
@@ -1047,12 +1639,21 @@ export declare class Shell {
|
|
|
1047
1639
|
* @param exitCode - The numerical exit code to return.
|
|
1048
1640
|
* @returns `exitCode`.
|
|
1049
1641
|
*/
|
|
1050
|
-
static writeError(stream: Stream, commandName: string, error?: string | string[], exitCode?: number): number
|
|
1642
|
+
static writeError(stream: Stream, commandName: string, error?: string | string[], exitCode?: number): Promise<number>;
|
|
1643
|
+
/**
|
|
1644
|
+
* Executes a task repeatedly and writes its output to `stdout`.
|
|
1645
|
+
* @returns A promise that resolves when the loop is finished.
|
|
1646
|
+
*/
|
|
1647
|
+
static loop({ stdout, stdin, task, delay, maxIterations }: Pick<ProcessIO, "stdout" | "stdin"> & {
|
|
1648
|
+
task: () => string;
|
|
1649
|
+
delay?: number;
|
|
1650
|
+
maxIterations?: number;
|
|
1651
|
+
}): Promise<0>;
|
|
1051
1652
|
/**
|
|
1052
1653
|
* Executes a frame-based animation in the terminal using the Alternate Screen Buffer.
|
|
1053
1654
|
* @returns A promise that resolves when the animation is stopped.
|
|
1054
1655
|
*/
|
|
1055
|
-
static animate({ stdout, stdin, render, delay, clear, stopOnBlank }: Pick<
|
|
1656
|
+
static animate({ stdout, stdin, render, delay, clear, stopOnBlank, useAltBuffer }: Pick<ProcessIO, "stdout" | "stdin"> & {
|
|
1056
1657
|
/** The function that renders each frame. */
|
|
1057
1658
|
render: (frame: number) => string;
|
|
1058
1659
|
/** The delay between each frame, in ms. */
|
|
@@ -1061,6 +1662,8 @@ export declare class Shell {
|
|
|
1061
1662
|
clear?: boolean;
|
|
1062
1663
|
/** Whether to stop the animation when the rendered frame is blank. */
|
|
1063
1664
|
stopOnBlank?: boolean;
|
|
1665
|
+
/** Whether to use the alt buffer while rendering this animation. */
|
|
1666
|
+
useAltBuffer?: boolean;
|
|
1064
1667
|
}): Promise<0>;
|
|
1065
1668
|
/**
|
|
1066
1669
|
* Reads input data. If `rawLine` is provided, it processes it immediately via the callback.
|
|
@@ -1069,7 +1672,43 @@ export declare class Shell {
|
|
|
1069
1672
|
* @param stdin - The input stream to fall back on.
|
|
1070
1673
|
* @param callback - Function to process the collected input data.
|
|
1071
1674
|
*/
|
|
1072
|
-
static readInput(rawLine: string, stdin: Stream, callback: (data: string) => CommandOutput): Promise<CommandOutput>;
|
|
1675
|
+
static readInput(rawLine: string, stdin: Stream, callback: (data: string) => Promise<CommandOutput> | CommandOutput): Promise<CommandOutput>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Utility function that writes `text` followed by a newline (`"\n"`) to `stream`.
|
|
1678
|
+
* @param stream - The stream to write to.
|
|
1679
|
+
* @param text - The text to write.
|
|
1680
|
+
*/
|
|
1681
|
+
static printLn(stream: Stream, text?: string): Promise<void>;
|
|
1682
|
+
static quote(text: string): string;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
export declare namespace ShellAST {
|
|
1686
|
+
export {
|
|
1687
|
+
NodeType,
|
|
1688
|
+
BaseNode,
|
|
1689
|
+
BaseConditionNode,
|
|
1690
|
+
BaseRedirectionNode,
|
|
1691
|
+
ConditionalBlockNode,
|
|
1692
|
+
Argument,
|
|
1693
|
+
ParameterExpansionNode,
|
|
1694
|
+
ArithmeticExpansionNode,
|
|
1695
|
+
CommandSubstitutionNode,
|
|
1696
|
+
ExpansionNode,
|
|
1697
|
+
RedirectionNode,
|
|
1698
|
+
CommandNode,
|
|
1699
|
+
LogicalNode,
|
|
1700
|
+
PipelineNode,
|
|
1701
|
+
IfNode,
|
|
1702
|
+
BaseLoopNode,
|
|
1703
|
+
WhileNode,
|
|
1704
|
+
ForInNode,
|
|
1705
|
+
ForExpressionNode,
|
|
1706
|
+
AssignmentNode,
|
|
1707
|
+
ArithmeticNode,
|
|
1708
|
+
ExecutableNode,
|
|
1709
|
+
Node_2 as Node,
|
|
1710
|
+
Block
|
|
1711
|
+
}
|
|
1073
1712
|
}
|
|
1074
1713
|
|
|
1075
1714
|
/**
|
|
@@ -1136,16 +1775,19 @@ export declare interface ShellContext extends ProcessIO {
|
|
|
1136
1775
|
*/
|
|
1137
1776
|
export declare class ShellEnvironment {
|
|
1138
1777
|
store: Record<string, string>;
|
|
1139
|
-
parent
|
|
1140
|
-
exportedKeys
|
|
1778
|
+
private parent;
|
|
1779
|
+
private exportedKeys;
|
|
1141
1780
|
static readonly USER = "USER";
|
|
1142
1781
|
static readonly HOSTNAME = "HOSTNAME";
|
|
1143
1782
|
static readonly WORKING_DIRECTORY = "PWD";
|
|
1144
1783
|
static readonly PREVIOUS_WORKING_DIRECTORY = "OLDPWD";
|
|
1784
|
+
static readonly HOME = "HOME";
|
|
1785
|
+
static readonly PROMPT = "PS1";
|
|
1786
|
+
static readonly SHELL = "SHELL";
|
|
1145
1787
|
static readonly EXIT_CODE = "?";
|
|
1146
1788
|
static readonly ARGUMENT_COUNT = "#";
|
|
1147
1789
|
static readonly PROCESS_ID = "$";
|
|
1148
|
-
/**
|
|
1790
|
+
/** Array of variables that should never be exported. */
|
|
1149
1791
|
static readonly INTERNAL_VARS: string[];
|
|
1150
1792
|
constructor(initialVars?: Record<string, string>, parent?: ShellEnvironment | null);
|
|
1151
1793
|
get(key: string): string | undefined;
|
|
@@ -1155,14 +1797,16 @@ export declare class ShellEnvironment {
|
|
|
1155
1797
|
*/
|
|
1156
1798
|
export(key: string): void;
|
|
1157
1799
|
/**
|
|
1158
|
-
* Replaces variable placeholders in a string with their corresponding values.
|
|
1800
|
+
* Replaces variable placeholders in a string with their corresponding values based on a pre-parsed node.
|
|
1801
|
+
* The expandedArgument must be pre-resolved by the interpreter to handle nested expansions.
|
|
1159
1802
|
*/
|
|
1160
|
-
expand(
|
|
1803
|
+
expand(node: ShellAST.ParameterExpansionNode, expandedArgument?: string): string;
|
|
1161
1804
|
/**
|
|
1162
1805
|
* Parses an assignment string (e.g., KEY=VALUE) and updates the environment.
|
|
1163
1806
|
* @returns `true` if the string was a valid assignment.
|
|
1164
1807
|
*/
|
|
1165
1808
|
parseAssignment(input: string): boolean;
|
|
1809
|
+
setCommandArguments(commandName: string, args: string[]): void;
|
|
1166
1810
|
/**
|
|
1167
1811
|
* Returns only variables that are marked for export.
|
|
1168
1812
|
*/
|
|
@@ -1184,6 +1828,7 @@ export declare class ShellEnvironment {
|
|
|
1184
1828
|
export declare class ShellInterpreter {
|
|
1185
1829
|
private shell;
|
|
1186
1830
|
pipeline: Process[];
|
|
1831
|
+
private static readonly PROMPT_ESCAPES;
|
|
1187
1832
|
constructor(shell: Shell);
|
|
1188
1833
|
/**
|
|
1189
1834
|
* Sends a termination signal to all processes currently in the pipeline.
|
|
@@ -1192,29 +1837,206 @@ export declare class ShellInterpreter {
|
|
|
1192
1837
|
terminatePipeline(signal: StreamSignal): void;
|
|
1193
1838
|
/**
|
|
1194
1839
|
* Parses and executes a shell script.
|
|
1195
|
-
* @param
|
|
1840
|
+
* @param input - The script content or a virtual file.
|
|
1841
|
+
* @param io - Optional output streams to override default TTY behavior.
|
|
1196
1842
|
* @returns The exit code of the last command executed in the script.
|
|
1197
1843
|
*/
|
|
1198
|
-
|
|
1844
|
+
execute(input: string | VirtualFile, io?: Partial<ProcessIO>): Promise<number>;
|
|
1199
1845
|
/**
|
|
1200
|
-
*
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1846
|
+
* Executes a block of nodes, passing along stream overrides.
|
|
1847
|
+
*/
|
|
1848
|
+
private executeBlock;
|
|
1849
|
+
/**
|
|
1850
|
+
* Dispatches an AST node to its specific execution logic.
|
|
1851
|
+
*/
|
|
1852
|
+
private executeNode;
|
|
1853
|
+
private executeLogicalNode;
|
|
1854
|
+
private executeAssignmentNode;
|
|
1855
|
+
private executeIfNode;
|
|
1856
|
+
private executeWhileNode;
|
|
1857
|
+
private executeForInNode;
|
|
1858
|
+
private executeForExpressionNode;
|
|
1859
|
+
/**
|
|
1860
|
+
* Handles the piping logic for any list of executable nodes.
|
|
1204
1861
|
*/
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1862
|
+
private executeCommands;
|
|
1863
|
+
private createPipeline;
|
|
1864
|
+
private linkStreams;
|
|
1865
|
+
private evaluateArgument;
|
|
1866
|
+
private captureCommandOutput;
|
|
1867
|
+
private removeQuotes;
|
|
1868
|
+
/**
|
|
1869
|
+
* Evaluates an arithmetic expression using an {@link ArithmeticParser} and returns an exit code.
|
|
1870
|
+
* @param node - The arithmetic operation.
|
|
1871
|
+
* @param env - The {@link ShellEnvironment} used for variable resolution within this instance.
|
|
1872
|
+
* @returns `EXIT_CODE.success` if the {@link ArithmeticParserResult} is successful and non-zero,
|
|
1873
|
+
* or `EXIT_CODE.generalError` otherwise.
|
|
1874
|
+
*/
|
|
1875
|
+
evaluateArithmetic(node: ShellAST.ArithmeticNode, env: ShellEnvironment): number;
|
|
1876
|
+
private executeRedirections;
|
|
1209
1877
|
/**
|
|
1210
1878
|
* Resolves a command, parses flags/options, and executes the command logic.
|
|
1211
1879
|
* @returns The resulting exit code from the command execution.
|
|
1212
1880
|
*/
|
|
1213
|
-
spawn
|
|
1881
|
+
private spawn;
|
|
1214
1882
|
/**
|
|
1215
|
-
*
|
|
1883
|
+
* Evaluates a prompt string by resolving escape sequences and shell expansions.
|
|
1216
1884
|
*/
|
|
1217
|
-
|
|
1885
|
+
evaluatePrompt(format: string, env?: ShellEnvironment): Promise<string>;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* A static utility class for parsing shell scripts into an Abstract Syntax Tree (AST).
|
|
1890
|
+
* Handles tokenization, control flow parsing (if, while, for), and shell-specific expansions.
|
|
1891
|
+
* @hideconstructor
|
|
1892
|
+
*/
|
|
1893
|
+
export declare class ShellParser {
|
|
1894
|
+
static readonly KEYWORD_IF = "if";
|
|
1895
|
+
static readonly KEYWORD_THEN = "then";
|
|
1896
|
+
static readonly KEYWORD_ELIF = "elif";
|
|
1897
|
+
static readonly KEYWORD_ELSE = "else";
|
|
1898
|
+
static readonly KEYWORD_FI = "fi";
|
|
1899
|
+
static readonly KEYWORD_WHILE = "while";
|
|
1900
|
+
static readonly KEYWORD_FOR = "for";
|
|
1901
|
+
static readonly KEYWORD_DO = "do";
|
|
1902
|
+
static readonly KEYWORD_DONE = "done";
|
|
1903
|
+
static readonly KEYWORD_IN = "in";
|
|
1904
|
+
static readonly ARITHMETIC_PREFIX_TOKEN = "((";
|
|
1905
|
+
static readonly ARITHMETIC_SUFFIX_TOKEN = "))";
|
|
1906
|
+
/**
|
|
1907
|
+
* High-level method to transform a raw script string into a structured AST.
|
|
1908
|
+
* @param script - The raw shell script string.
|
|
1909
|
+
* @returns An array of AST nodes representing the script execution flow.
|
|
1910
|
+
*/
|
|
1911
|
+
static parseScript(script: string): ShellAST.Block;
|
|
1912
|
+
private static tokenizeLine;
|
|
1913
|
+
/**
|
|
1914
|
+
* Splits an input string into tokens.
|
|
1915
|
+
* @param input - The raw string to tokenize.
|
|
1916
|
+
* @returns An array of trimmed, non-empty token strings.
|
|
1917
|
+
*/
|
|
1918
|
+
private static tokenize;
|
|
1919
|
+
/**
|
|
1920
|
+
* Iteratively parses lines into AST nodes until an end token is reached or lines run out.
|
|
1921
|
+
* @param lines - The array of tokenized lines.
|
|
1922
|
+
* @param startIndex - The index to start parsing from.
|
|
1923
|
+
* @param endTokens - Tokens that signal the end of a block (e.g., `fi`, `done`).
|
|
1924
|
+
* @returns An object containing the parsed nodes and the stopping context.
|
|
1925
|
+
*/
|
|
1926
|
+
private static parseStatements;
|
|
1927
|
+
/**
|
|
1928
|
+
* If `keyword` appears on `lines[index]` and has trailing content, rewrites the line to
|
|
1929
|
+
* start at that content and returns the same index (so it gets re-processed). Otherwise
|
|
1930
|
+
* advances past the keyword-only line and returns the incremented index.
|
|
1931
|
+
*/
|
|
1932
|
+
private static advancePastKeyword;
|
|
1933
|
+
/**
|
|
1934
|
+
* Parses `if`/`elif`/`else` blocks into an {@link ShellAST.IfNode}.
|
|
1935
|
+
* @param lines - The array of tokenized lines.
|
|
1936
|
+
* @param startIndex - The line index where the `if` starts.
|
|
1937
|
+
* @returns The generated {@link ShellAST.IfNode} and the index to resume parsing.
|
|
1938
|
+
*/
|
|
1939
|
+
private static parseIf;
|
|
1940
|
+
/**
|
|
1941
|
+
* Parses an `elif` branch, returning the branch data and the end token that stopped it.
|
|
1942
|
+
*/
|
|
1943
|
+
private static parseElifBranch;
|
|
1944
|
+
/**
|
|
1945
|
+
* Parses an `else` branch of an `if` block, returning its body and the end token (`fi`).
|
|
1946
|
+
*/
|
|
1947
|
+
private static parseElseBranch;
|
|
1948
|
+
/**
|
|
1949
|
+
* Parses a while-loop structure into a {@link ShellAST.WhileNode}.
|
|
1950
|
+
* @param lines - The tokenized lines.
|
|
1951
|
+
* @param startIndex - The line index where the `while` starts.
|
|
1952
|
+
* @returns The generated {@link ShellAST.WhileNode} and next index.
|
|
1953
|
+
*/
|
|
1954
|
+
private static parseWhile;
|
|
1955
|
+
/**
|
|
1956
|
+
* Parses a for-loop structure into a {@link ShellAST.ForNode}, extracting the iterator variable and items.
|
|
1957
|
+
* @param lines - The tokenized lines.
|
|
1958
|
+
* @param startIndex - The line index where the `for` starts.
|
|
1959
|
+
* @returns The generated {@link ShellAST.ForNode} and next index.
|
|
1960
|
+
*/
|
|
1961
|
+
private static parseFor;
|
|
1962
|
+
/**
|
|
1963
|
+
* Converts an array of lines into a {@link ShellAST.ForExpressionNode}.
|
|
1964
|
+
*/
|
|
1965
|
+
private static parseForExpression;
|
|
1966
|
+
/**
|
|
1967
|
+
* Converts an array of lines into a {@link ShellAST.ForInNode}.
|
|
1968
|
+
*/
|
|
1969
|
+
private static parseForIn;
|
|
1970
|
+
/**
|
|
1971
|
+
* Extracts redirection nodes from a sequence of tokens, returning the remaining
|
|
1972
|
+
* arguments and the extracted redirections.
|
|
1973
|
+
*/
|
|
1974
|
+
private static parseRedirections;
|
|
1975
|
+
/**
|
|
1976
|
+
* Converts a line into an {@link ShellAST.AssignmentNode}.
|
|
1977
|
+
*/
|
|
1978
|
+
private static parseAssignment;
|
|
1979
|
+
/**
|
|
1980
|
+
* Converts an expression string into an {@link ShellAST.ArithmeticNode}.
|
|
1981
|
+
*/
|
|
1982
|
+
private static parseArithmetic;
|
|
1983
|
+
/**
|
|
1984
|
+
* Converts a condition string into an {@link ShellAST.ExecutableNode}.
|
|
1985
|
+
*/
|
|
1986
|
+
private static resolveCondition;
|
|
1987
|
+
private static splitByOperators;
|
|
1988
|
+
/**
|
|
1989
|
+
* Converts an input string into a {@link ShellAST.ExecutableNode}.
|
|
1990
|
+
*/
|
|
1991
|
+
private static parseCommand;
|
|
1992
|
+
/**
|
|
1993
|
+
* Converts an input string into a {@link ShellAST.ExecutableNode},
|
|
1994
|
+
* that might contain logical operators.
|
|
1995
|
+
*/
|
|
1996
|
+
private static parseLogical;
|
|
1997
|
+
/**
|
|
1998
|
+
* Converts an input string into a {@link ShellAST.ExecutableNode},
|
|
1999
|
+
* that might contain pipes.
|
|
2000
|
+
*/
|
|
2001
|
+
private static parsePipeline;
|
|
2002
|
+
/**
|
|
2003
|
+
* Converts an input string into a {@link ShellAST.CommandNode}.
|
|
2004
|
+
*/
|
|
2005
|
+
private static parseSimpleCommand;
|
|
2006
|
+
/**
|
|
2007
|
+
* Converts an input string into a {@link ShellAST.ParameterExpansionNode}.
|
|
2008
|
+
*/
|
|
2009
|
+
private static parseParameterExpansion;
|
|
2010
|
+
/**
|
|
2011
|
+
* Converts an input string into an {@link ShellAST.ArithmeticExpansionNode}.
|
|
2012
|
+
*/
|
|
2013
|
+
private static parseArithmeticExpansion;
|
|
2014
|
+
/**
|
|
2015
|
+
* Converts an input string into a {@link ShellAST.CommandSubstitutionNode}.
|
|
2016
|
+
*/
|
|
2017
|
+
private static parseCommandSubstitution;
|
|
2018
|
+
/**
|
|
2019
|
+
* Converts an input string into an {@link ShellAST.Argument}.
|
|
2020
|
+
*/
|
|
2021
|
+
static parseArgument(input: string): ShellAST.Argument;
|
|
2022
|
+
/**
|
|
2023
|
+
* Expands braces in a shell argument (e.g., `"file{1..3}.txt"` or `"img.{jpg,png}"`).
|
|
2024
|
+
* Supports nested expansion and numeric sequences.
|
|
2025
|
+
* @param input - The raw string.
|
|
2026
|
+
* @returns An array of strings with all permutations expanded.
|
|
2027
|
+
*/
|
|
2028
|
+
static expandBraces(input: string): string[];
|
|
2029
|
+
/**
|
|
2030
|
+
* Parses flags and options out of a mutable args array, returning the collected options and
|
|
2031
|
+
* input values. Flag args are removed from `commandArgs` in place as a side-effect.
|
|
2032
|
+
* @param command - The command used to validate and look up option definitions.
|
|
2033
|
+
* @param commandArgs - The mutable argument list to parse from. Modified in place.
|
|
2034
|
+
* @returns An object containing the parsed option keys and any input values keyed by the option's short name.
|
|
2035
|
+
*/
|
|
2036
|
+
static parseOptions(command: Command, commandArgs: string[]): {
|
|
2037
|
+
options: string[];
|
|
2038
|
+
inputs: Record<string, string>;
|
|
2039
|
+
};
|
|
1218
2040
|
}
|
|
1219
2041
|
|
|
1220
2042
|
/**
|
|
@@ -1239,9 +2061,91 @@ export declare interface ShellState {
|
|
|
1239
2061
|
isUsingAltScreen: boolean;
|
|
1240
2062
|
/** A reactive view of the current environment variables. */
|
|
1241
2063
|
env: Record<string, string>;
|
|
2064
|
+
/** Indicates whether the shell is currently in raw mode, forwarding all keystrokes directly to the active stream. */
|
|
2065
|
+
isRawMode: boolean;
|
|
2066
|
+
/** The position of the cursor in raw mode. */
|
|
2067
|
+
cursorPosition: Vector2;
|
|
1242
2068
|
}
|
|
1243
2069
|
|
|
1244
|
-
declare type ShortcutHandler = (event: KeyboardEvent) => void;
|
|
2070
|
+
export declare type ShortcutHandler = (event: KeyboardEvent) => void;
|
|
2071
|
+
|
|
2072
|
+
/**
|
|
2073
|
+
* Utility functions related to slots.
|
|
2074
|
+
* @see {@link SlotsView}
|
|
2075
|
+
* @see {@link createSlots}
|
|
2076
|
+
*/
|
|
2077
|
+
export declare namespace Slot {
|
|
2078
|
+
/**
|
|
2079
|
+
* An empty slot with no content.
|
|
2080
|
+
* @example
|
|
2081
|
+
* Using an empty slot to hide the apps in the taskbar:
|
|
2082
|
+
* ```tsx
|
|
2083
|
+
* <Taskbar renderApps={Slot.Empty}/>
|
|
2084
|
+
* ```
|
|
2085
|
+
*/
|
|
2086
|
+
const Empty: FC;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
/**
|
|
2090
|
+
* Slots are components that can override or enhance parts of a root component.
|
|
2091
|
+
*
|
|
2092
|
+
* The value of each entry is the component that will be rendered in the slot associated with the corresponding key.
|
|
2093
|
+
*
|
|
2094
|
+
* {@link SlotsView} can be used to render slots.
|
|
2095
|
+
* Slots are ignored if this components has any children.
|
|
2096
|
+
* Any missing slots will be replaced with a default component.
|
|
2097
|
+
*
|
|
2098
|
+
* {@link createSlots} produces a context and provider that can be used to create a component with slots and give them access to a shared context.
|
|
2099
|
+
*
|
|
2100
|
+
* @typeParam S - A dictionary mapping each slot name to a component.
|
|
2101
|
+
*/
|
|
2102
|
+
export declare type Slots<S extends Record<string, FC>> = {
|
|
2103
|
+
[K in keyof S & string as `render${Capitalize<K>}`]?: FC;
|
|
2104
|
+
};
|
|
2105
|
+
|
|
2106
|
+
/**
|
|
2107
|
+
* Props for {@link SlotsView}.
|
|
2108
|
+
*/
|
|
2109
|
+
declare interface SlotsViewProps<S extends Record<string, FC>> {
|
|
2110
|
+
/** The default components to render in each slot if no override is given. */
|
|
2111
|
+
defaults: S;
|
|
2112
|
+
/** Slot components that replace the respective default component with a matching key. */
|
|
2113
|
+
slots: Slots<S>;
|
|
2114
|
+
/** Callback function that renders the resolved slots in a custom layout instead of rendering them in their order in {@link defaults}. */
|
|
2115
|
+
layout?: (slots: S) => ReactNode;
|
|
2116
|
+
/** Replaces all slots if not empty. */
|
|
2117
|
+
children?: ReactNode;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* System that allows you to create root components and slot components.
|
|
2122
|
+
*
|
|
2123
|
+
* @see {@link createSlots}
|
|
2124
|
+
* @typeParam C - The type of the context value.
|
|
2125
|
+
*/
|
|
2126
|
+
export declare interface SlotSystem<C> {
|
|
2127
|
+
/**
|
|
2128
|
+
* A hook that returns the current context value from the {@link SlotsProvider}.
|
|
2129
|
+
*
|
|
2130
|
+
* @throws If called outside of a {@link SlotsProvider}.
|
|
2131
|
+
*/
|
|
2132
|
+
useSlotsContext: () => C;
|
|
2133
|
+
/**
|
|
2134
|
+
* Renders the slots or children with the given context value.
|
|
2135
|
+
*
|
|
2136
|
+
* Usually placed inside a root component that accepts the props specified by {@link PropsWithSlots} and passes them to this component.
|
|
2137
|
+
*
|
|
2138
|
+
* If {@link props.children} is not an empty value, they are rendered instead of the slots.
|
|
2139
|
+
*
|
|
2140
|
+
* @typeParam S - A dictionary mapping each slot name to a component.
|
|
2141
|
+
*/
|
|
2142
|
+
SlotsProvider: <S extends Record<string, FC>>(props: SlotsViewProps<S> & {
|
|
2143
|
+
/**
|
|
2144
|
+
* The context value to provide to slots via {@link useSlotsContext}.
|
|
2145
|
+
*/
|
|
2146
|
+
context: C;
|
|
2147
|
+
}) => ReactNode;
|
|
2148
|
+
}
|
|
1245
2149
|
|
|
1246
2150
|
export declare function StandaloneRoute({ app }: StandaloneRouteProps): JSX_2.Element;
|
|
1247
2151
|
|
|
@@ -1331,34 +2235,40 @@ export { StorageManager_2 as StorageManager }
|
|
|
1331
2235
|
* A communication channel for process I/O, supporting event-based data transmission,
|
|
1332
2236
|
* signaling, and piping between streams.
|
|
1333
2237
|
*/
|
|
1334
|
-
export declare class Stream<T = string> extends EventEmitter<StreamEvents<T>> {
|
|
1335
|
-
|
|
2238
|
+
export declare class Stream<T = string> extends EventEmitter<StreamEvents<T>> implements InputStream<T>, OutputStream<T> {
|
|
2239
|
+
private isClosed;
|
|
2240
|
+
private readonly buffer;
|
|
2241
|
+
private readonly pendingReads;
|
|
2242
|
+
private currentSignal;
|
|
1336
2243
|
static readonly DATA_EVENT = "data";
|
|
1337
|
-
static readonly
|
|
1338
|
-
static readonly STOP_EVENT = "stop";
|
|
2244
|
+
static readonly END_EVENT = "end";
|
|
1339
2245
|
static readonly SIGNAL_EVENT = "signal";
|
|
2246
|
+
static readonly ERROR_EVENT = "error";
|
|
2247
|
+
static readonly INTERRUPTED = "interrupted";
|
|
2248
|
+
static readonly CLOSED = "closed";
|
|
2249
|
+
private static readonly TERMINATING_SIGNALS;
|
|
1340
2250
|
/**
|
|
1341
|
-
*
|
|
2251
|
+
* Closes the stream (EOF). Subsequent calls to write will be rejected.
|
|
1342
2252
|
*/
|
|
1343
|
-
|
|
2253
|
+
end(): this;
|
|
1344
2254
|
/**
|
|
1345
|
-
*
|
|
2255
|
+
* Emits a control signal. Standard termination signals will automatically close the stream.
|
|
1346
2256
|
*/
|
|
1347
|
-
|
|
2257
|
+
signal(signal: StreamSignal): this;
|
|
1348
2258
|
/**
|
|
1349
|
-
*
|
|
2259
|
+
* Broadcasts data to all listeners if the stream is open.
|
|
1350
2260
|
*/
|
|
1351
|
-
|
|
2261
|
+
write(data: T): Promise<Result<void, StreamError>>;
|
|
1352
2262
|
/**
|
|
1353
|
-
*
|
|
2263
|
+
* Resolves with the next available chunk, or null if the stream is closed (EOF).
|
|
1354
2264
|
*/
|
|
1355
|
-
|
|
2265
|
+
read(): Promise<Result<T | null, StreamError>>;
|
|
1356
2266
|
/**
|
|
1357
|
-
* Forwards data,
|
|
2267
|
+
* Forwards data, end events, and signals from this stream to another.
|
|
1358
2268
|
* @param destination - The stream that will receive the forwarded data.
|
|
1359
2269
|
* @returns The destination stream to allow for chainable piping.
|
|
1360
2270
|
*/
|
|
1361
|
-
pipe(destination: Stream<T
|
|
2271
|
+
pipe(destination: Stream<T>, propagateEnd?: boolean): Stream<T>;
|
|
1362
2272
|
/**
|
|
1363
2273
|
* Returns a promise that resolves when the stream is stopped.
|
|
1364
2274
|
*/
|
|
@@ -1368,16 +2278,27 @@ export declare class Stream<T = string> extends EventEmitter<StreamEvents<T>> {
|
|
|
1368
2278
|
* @param value - Value to return when the promise resolves.
|
|
1369
2279
|
*/
|
|
1370
2280
|
wait<U>(value: U): Promise<U>;
|
|
2281
|
+
/**
|
|
2282
|
+
* Iterates over a readable string stream and yields each line.
|
|
2283
|
+
*/
|
|
2284
|
+
static readLines(stream: InputStream): AsyncGenerator<Result<string, StreamError>>;
|
|
1371
2285
|
}
|
|
1372
2286
|
|
|
2287
|
+
export declare type StreamError = {
|
|
2288
|
+
type: typeof Stream.INTERRUPTED;
|
|
2289
|
+
signal: StreamSignal;
|
|
2290
|
+
} | {
|
|
2291
|
+
type: typeof Stream.CLOSED;
|
|
2292
|
+
};
|
|
2293
|
+
|
|
1373
2294
|
export declare interface StreamEvents<T = string> {
|
|
1374
2295
|
data: [T];
|
|
1375
|
-
|
|
1376
|
-
stop: [];
|
|
2296
|
+
end: [];
|
|
1377
2297
|
signal: [StreamSignal];
|
|
2298
|
+
error: [StreamError];
|
|
1378
2299
|
}
|
|
1379
2300
|
|
|
1380
|
-
export declare type StreamSignal = "SIGINT" | "SIGKILL" | "SIGTERM" | "SIGINFO";
|
|
2301
|
+
export declare type StreamSignal = "SIGINT" | "SIGKILL" | "SIGTERM" | "SIGINFO" | "SIGHUP" | "SIGQUIT" | "SIGPIPE";
|
|
1381
2302
|
|
|
1382
2303
|
export declare class SystemManager {
|
|
1383
2304
|
#private;
|
|
@@ -1417,9 +2338,24 @@ export declare interface SystemManagerParams {
|
|
|
1417
2338
|
}
|
|
1418
2339
|
|
|
1419
2340
|
/**
|
|
1420
|
-
* Component that renders the
|
|
2341
|
+
* Component that renders the home menu, search menu, pinned and active applications and various indicators.
|
|
1421
2342
|
*/
|
|
1422
|
-
export declare const Taskbar:
|
|
2343
|
+
export declare const Taskbar: typeof TaskbarRoot & InferSlots<Slots< {
|
|
2344
|
+
Home: FC;
|
|
2345
|
+
Search: FC;
|
|
2346
|
+
Apps: FC;
|
|
2347
|
+
Indicators: FC;
|
|
2348
|
+
}> & {
|
|
2349
|
+
children?: ReactNode;
|
|
2350
|
+
}>;
|
|
2351
|
+
|
|
2352
|
+
export declare interface TaskbarAppsProps {
|
|
2353
|
+
renderApp?: FC<{
|
|
2354
|
+
app: App;
|
|
2355
|
+
active: boolean;
|
|
2356
|
+
visible: boolean;
|
|
2357
|
+
}>;
|
|
2358
|
+
}
|
|
1423
2359
|
|
|
1424
2360
|
export declare class TaskbarConfig {
|
|
1425
2361
|
height: TaskbarConfigOptions["height"];
|
|
@@ -1434,6 +2370,47 @@ export declare interface TaskbarConfigOptions {
|
|
|
1434
2370
|
height: number;
|
|
1435
2371
|
}
|
|
1436
2372
|
|
|
2373
|
+
/**
|
|
2374
|
+
* Context for {@link Taskbar}.
|
|
2375
|
+
*/
|
|
2376
|
+
export declare interface TaskbarContext {
|
|
2377
|
+
/** The current active menu in the taskbar. */
|
|
2378
|
+
activeMenu: "home" | "search" | "indicator" | null;
|
|
2379
|
+
/** Sets the current active menu in the taskbar. */
|
|
2380
|
+
setActiveMenu: (menu: TaskbarContext["activeMenu"]) => void;
|
|
2381
|
+
/** Toggles the active state of a menu in the taskbar. */
|
|
2382
|
+
toggleMenu: (menu: TaskbarContext["activeMenu"], active?: boolean) => void;
|
|
2383
|
+
/** The search query for the search menu in the taskbar. */
|
|
2384
|
+
searchQuery: string;
|
|
2385
|
+
/** Sets the search query for the search menu in the taskbar. */
|
|
2386
|
+
setSearchQuery: Dispatch<string>;
|
|
2387
|
+
searchInputRef: RefObject<HTMLInputElement>;
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
export declare type TaskbarIndicatorsProps = PropsWithSlots<{
|
|
2391
|
+
Battery: FC;
|
|
2392
|
+
Network: FC;
|
|
2393
|
+
Volume: FC;
|
|
2394
|
+
Calendar: FC;
|
|
2395
|
+
DesktopButton: FC;
|
|
2396
|
+
}>;
|
|
2397
|
+
|
|
2398
|
+
/**
|
|
2399
|
+
* Props for {@link Taskbar}.
|
|
2400
|
+
*/
|
|
2401
|
+
export declare type TaskbarProps = PropsWithSlots<{
|
|
2402
|
+
Home: FC;
|
|
2403
|
+
Search: FC;
|
|
2404
|
+
Apps: FC;
|
|
2405
|
+
Indicators: FC;
|
|
2406
|
+
}>;
|
|
2407
|
+
|
|
2408
|
+
declare function TaskbarRoot({ children, ...slots }: TaskbarProps): ReactNode;
|
|
2409
|
+
|
|
2410
|
+
export declare const TaskbarSlotsProvider: <S extends Record<string, FC>>(props: SlotsViewProps<S> & {
|
|
2411
|
+
context: TaskbarContext;
|
|
2412
|
+
}) => ReactNode;
|
|
2413
|
+
|
|
1437
2414
|
export declare function TextDisplay({ children }: TextDisplayProps): JSX_2.Element;
|
|
1438
2415
|
|
|
1439
2416
|
export declare interface TextDisplayProps {
|
|
@@ -1527,6 +2504,12 @@ export declare interface UseContextMenuParams {
|
|
|
1527
2504
|
Actions: FC<ActionsProps>;
|
|
1528
2505
|
}
|
|
1529
2506
|
|
|
2507
|
+
/**
|
|
2508
|
+
* Calculates the dimensions of a character and the dimensions
|
|
2509
|
+
* of its container in rows and columns.
|
|
2510
|
+
*/
|
|
2511
|
+
export declare function useFontMetrics({ containerRef, testString, }: FontMetricsParams): FontMetrics;
|
|
2512
|
+
|
|
1530
2513
|
/**
|
|
1531
2514
|
* Returns an object that handles stateful history with undo and redo methods.
|
|
1532
2515
|
*/
|
|
@@ -1545,6 +2528,28 @@ export declare function useHistory<Type>(initialState: Type): {
|
|
|
1545
2528
|
redoAvailable: boolean;
|
|
1546
2529
|
};
|
|
1547
2530
|
|
|
2531
|
+
/**
|
|
2532
|
+
* Returns a reactive list of all currently installed apps.
|
|
2533
|
+
*
|
|
2534
|
+
* The list stays in sync with `appsConfig.installedApps`, it updates
|
|
2535
|
+
* automatically when apps are installed, uninstalled, or added.
|
|
2536
|
+
*
|
|
2537
|
+
* **Note:** `sort` and `filter` must be stable references.
|
|
2538
|
+
* Passing inline functions will recreate them on every render,
|
|
2539
|
+
* causing an infinite render loop (`Maximum update depth exceeded`).
|
|
2540
|
+
* @example
|
|
2541
|
+
* ```tsx
|
|
2542
|
+
* const installedApps = useInstalledApps();
|
|
2543
|
+
*
|
|
2544
|
+
* const filter = useCallback((app: App) => app.name.includes(query), [query]);
|
|
2545
|
+
* const searchResults = useInstalledApps({ filter });
|
|
2546
|
+
*
|
|
2547
|
+
* const sort = useCallback((a, b) => (a.metadata?.releaseDate ?? "").localeCompare(b.metadata?.releaseDate ?? ""), []);
|
|
2548
|
+
* const sortedByDate = useInstalledApps({ sort });
|
|
2549
|
+
* ```
|
|
2550
|
+
*/
|
|
2551
|
+
export declare function useInstalledApps(options?: InstalledAppsOptions): App<WindowProps>[];
|
|
2552
|
+
|
|
1548
2553
|
/**
|
|
1549
2554
|
* Returns the integer value of a setting and a function to update it.
|
|
1550
2555
|
* @param path - The path of the settings file.
|
|
@@ -1708,6 +2713,34 @@ export declare function useSingleton<T>(create: () => T): T;
|
|
|
1708
2713
|
|
|
1709
2714
|
export declare function useSkin(): Skin;
|
|
1710
2715
|
|
|
2716
|
+
/**
|
|
2717
|
+
* Computes the override for the current skin.
|
|
2718
|
+
*
|
|
2719
|
+
* For each entry, if the key is (a subclass of) the current type of skin, the override is applied.
|
|
2720
|
+
* If multiple entries match the current skin, they are merged.
|
|
2721
|
+
*
|
|
2722
|
+
* @param overrides - The overrides to check.
|
|
2723
|
+
* @typeParam Override - The type of override.
|
|
2724
|
+
* @returns All matching overrides merged, or `undefined` if none match.
|
|
2725
|
+
* @see {@link useSkin}
|
|
2726
|
+
*/
|
|
2727
|
+
export declare function useSkinOverrides<Override>(overrides: Map<typeof Skin, Override>): Override | undefined;
|
|
2728
|
+
|
|
2729
|
+
/**
|
|
2730
|
+
* Computes the override for the current skin.
|
|
2731
|
+
*
|
|
2732
|
+
* For each entry, if the key is (a subclass of) the current type of skin, the override is applied.
|
|
2733
|
+
* If one or more entries match the current skin, they are all merged with the default value.
|
|
2734
|
+
*
|
|
2735
|
+
* @param overrides - The overrides to check.
|
|
2736
|
+
* @param defaultValue - The default value to merge the matching overrides with.
|
|
2737
|
+
* @typeParam Default - The type of the default value.
|
|
2738
|
+
* @typeParam Override - The type of override.
|
|
2739
|
+
* @returns The default value, merged with all overrides that match.
|
|
2740
|
+
* @see {@link useSkin}
|
|
2741
|
+
*/
|
|
2742
|
+
export declare function useSkinOverrides<Default, Override = undefined>(overrides: Map<typeof Skin, Override>, defaultValue: Default): Default | MergeValues<Default, Override>;
|
|
2743
|
+
|
|
1711
2744
|
/**
|
|
1712
2745
|
* Generates static class name using BEM notation.
|
|
1713
2746
|
* @param block - The name of the block.
|
|
@@ -1729,6 +2762,8 @@ export declare function useStringSetting(path: SettingsPath, key: string, defaul
|
|
|
1729
2762
|
|
|
1730
2763
|
export declare function useSystemManager(): SystemManager;
|
|
1731
2764
|
|
|
2765
|
+
export declare const useTaskbarContext: () => TaskbarContext;
|
|
2766
|
+
|
|
1732
2767
|
export declare function useTrackingManager(): TrackingManagerState;
|
|
1733
2768
|
|
|
1734
2769
|
export declare function useVirtualRoot(): VirtualRootState;
|
|
@@ -1816,6 +2851,7 @@ export declare class VirtualBase<E extends VirtualBaseEvents = VirtualBaseEvents
|
|
|
1816
2851
|
getRoot(): VirtualRoot;
|
|
1817
2852
|
isFile(): this is VirtualFile;
|
|
1818
2853
|
isFolder(): this is VirtualFolder;
|
|
2854
|
+
isLink(): this is VirtualFileLink | VirtualFolderLink;
|
|
1819
2855
|
toJSON(): VirtualBaseJson | null;
|
|
1820
2856
|
toString(): string | null;
|
|
1821
2857
|
}
|
|
@@ -1869,6 +2905,16 @@ export declare interface VirtualDriveConfigOptions {
|
|
|
1869
2905
|
* @default true
|
|
1870
2906
|
*/
|
|
1871
2907
|
includePicturesFolder?: boolean;
|
|
2908
|
+
/**
|
|
2909
|
+
* Include audio folder in default data.
|
|
2910
|
+
* @default true
|
|
2911
|
+
*/
|
|
2912
|
+
includeAudioFolder?: boolean;
|
|
2913
|
+
/**
|
|
2914
|
+
* Include video folder in default data.
|
|
2915
|
+
* @default true
|
|
2916
|
+
*/
|
|
2917
|
+
includeVideoFolder?: boolean;
|
|
1872
2918
|
/**
|
|
1873
2919
|
* Include documents folder in default data.
|
|
1874
2920
|
* @default true
|
|
@@ -1889,6 +2935,11 @@ export declare interface VirtualDriveConfigOptions {
|
|
|
1889
2935
|
* @default true
|
|
1890
2936
|
*/
|
|
1891
2937
|
includeAppsFolder?: boolean;
|
|
2938
|
+
/**
|
|
2939
|
+
* Include scripts folder in default data.
|
|
2940
|
+
* @default true
|
|
2941
|
+
*/
|
|
2942
|
+
includeScriptsFolder?: boolean;
|
|
1892
2943
|
loadData?: (virtualRoot: VirtualRoot) => void;
|
|
1893
2944
|
};
|
|
1894
2945
|
}
|
|
@@ -1963,6 +3014,7 @@ export declare class VirtualFileLink extends VirtualFile {
|
|
|
1963
3014
|
setLinkedPath(path: string): VirtualFileLink;
|
|
1964
3015
|
isValid(): boolean;
|
|
1965
3016
|
toJSON(): VirtualFileLinkJson | null;
|
|
3017
|
+
isLink(): this is VirtualFileLink;
|
|
1966
3018
|
setAlias(...args: Parameters<VirtualFile["setAlias"]>): this;
|
|
1967
3019
|
setSource(...args: Parameters<VirtualFile["setSource"]>): this;
|
|
1968
3020
|
setContent(...args: Parameters<VirtualFile["setContent"]>): this;
|
|
@@ -2054,10 +3106,11 @@ export declare class VirtualFolder<E extends VirtualBaseEvents = VirtualBaseEven
|
|
|
2054
3106
|
* Removes a file or folder from this folder.
|
|
2055
3107
|
*/
|
|
2056
3108
|
remove(child: VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink): this;
|
|
3109
|
+
create(relativePath: string): VirtualFolder<VirtualBaseEvents> | VirtualFile | null;
|
|
2057
3110
|
/**
|
|
2058
3111
|
* Returns the file or folder at a relative path or null if it doesn't exist.
|
|
2059
3112
|
*/
|
|
2060
|
-
navigate(relativePath: string): VirtualFile | VirtualFolder | null;
|
|
3113
|
+
navigate(relativePath: string, createIfMissing?: boolean): VirtualFile | VirtualFolder | null;
|
|
2061
3114
|
navigateToFolder(relativePath: string): VirtualFolder | null;
|
|
2062
3115
|
navigateToFile(relativePath: string): VirtualFile | null;
|
|
2063
3116
|
/**
|
|
@@ -2104,6 +3157,7 @@ export declare class VirtualFolderLink extends VirtualFolder {
|
|
|
2104
3157
|
isValid(): boolean;
|
|
2105
3158
|
getIconUrl(): string;
|
|
2106
3159
|
toJSON(): VirtualFolderLinkJson | null;
|
|
3160
|
+
isLink(): this is VirtualFolderLink;
|
|
2107
3161
|
setAlias(...args: Parameters<VirtualFolder["setAlias"]>): this;
|
|
2108
3162
|
createFile(...args: Parameters<VirtualFolder["createFile"]>): this;
|
|
2109
3163
|
createFiles(...args: Parameters<VirtualFolder["createFiles"]>): this;
|
|
@@ -2149,6 +3203,7 @@ export declare class VirtualRoot extends VirtualFolder<VirtualRootEvents> {
|
|
|
2149
3203
|
* Adds a shortcut to a file or folder.
|
|
2150
3204
|
*/
|
|
2151
3205
|
addShortcut(name: string, destination: VirtualFile | VirtualFileLink | VirtualFolder | VirtualFolderLink): this;
|
|
3206
|
+
readSource(source: string): Promise<string | null>;
|
|
2152
3207
|
/**
|
|
2153
3208
|
* Tells the storage manager to clear all data and reloads the window.
|
|
2154
3209
|
*/
|
|
@@ -2189,6 +3244,13 @@ export declare interface WebViewProps extends WindowProps {
|
|
|
2189
3244
|
|
|
2190
3245
|
export declare const WELCOME_MESSAGE: string;
|
|
2191
3246
|
|
|
3247
|
+
/**
|
|
3248
|
+
* Represents a `while` loop structure.
|
|
3249
|
+
*/
|
|
3250
|
+
declare interface WhileNode extends BaseLoopNode, BaseConditionNode {
|
|
3251
|
+
type: NodeType.While;
|
|
3252
|
+
}
|
|
3253
|
+
|
|
2192
3254
|
export declare function WindowedModal({ modal, params, children, ...props }: ModalProps): JSX_2.Element;
|
|
2193
3255
|
|
|
2194
3256
|
export declare interface WindowOptions {
|
|
@@ -2288,6 +3350,10 @@ export declare class WindowsManager {
|
|
|
2288
3350
|
* Close a window.
|
|
2289
3351
|
*/
|
|
2290
3352
|
close(windowId: string): void;
|
|
3353
|
+
/**
|
|
3354
|
+
* Close all windows of a specific app.
|
|
3355
|
+
*/
|
|
3356
|
+
closeAppWindows(appId: string): void;
|
|
2291
3357
|
/**
|
|
2292
3358
|
* Focus on a specific window.
|
|
2293
3359
|
*/
|