style: Formatted the project, b=(no-bug), c=scripts

This commit is contained in:
Mr. M 2025-04-21 00:05:34 +02:00
parent e65991aa03
commit 8136387a75
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
11 changed files with 41339 additions and 33414 deletions

View file

@ -19,6 +19,7 @@ FILES = [
ENGINE_PATH = os.path.join("engine", "tools", "@types") ENGINE_PATH = os.path.join("engine", "tools", "@types")
SRC_PATH = os.path.join("src", "zen", "@types") SRC_PATH = os.path.join("src", "zen", "@types")
def update_ts_types(): def update_ts_types():
os.system("cd engine && ./mach ts build && ./mach ts update") os.system("cd engine && ./mach ts build && ./mach ts update")
# copy the files from engine/tools/@types to src/@types # copy the files from engine/tools/@types to src/@types
@ -36,6 +37,7 @@ def update_ts_types():
f.write('/// <reference types="./zen.d.ts" />\n') f.write('/// <reference types="./zen.d.ts" />\n')
f.write('\n') f.write('\n')
if __name__ == "__main__": if __name__ == "__main__":
update_ts_types() update_ts_types()
print("Updated TypeScript types.") print("Updated TypeScript types.")

View file

@ -34,4 +34,3 @@ declare global {
export {}; export {};
/// <reference types="./zen.d.ts" /> /// <reference types="./zen.d.ts" />

View file

@ -5,11 +5,9 @@
*/ */
declare global { declare global {
// https://searchfox.org/mozilla-central/source/accessible/interfaces/nsIAccessibleMacInterface.idl // https://searchfox.org/mozilla-central/source/accessible/interfaces/nsIAccessibleMacInterface.idl
interface nsIAccessibleMacNSObjectWrapper extends nsISupports { interface nsIAccessibleMacNSObjectWrapper extends nsISupports {}
}
interface nsIAccessibleMacInterface extends nsISupports { interface nsIAccessibleMacInterface extends nsISupports {
readonly attributeNames: string[]; readonly attributeNames: string[];
@ -61,7 +59,7 @@ interface nsIMacDockSupport extends nsISupports {
type nsIMacFinderProgressCanceledCallback = Callable<{ type nsIMacFinderProgressCanceledCallback = Callable<{
canceled(): void; canceled(): void;
}> }>;
interface nsIMacFinderProgress extends nsISupports { interface nsIMacFinderProgress extends nsISupports {
init(path: string, canceledCallback: nsIMacFinderProgressCanceledCallback): void; init(path: string, canceledCallback: nsIMacFinderProgressCanceledCallback): void;
@ -87,7 +85,7 @@ interface nsIMacUserActivityUpdater extends nsISupports {
type nsITrashAppCallback = Callable<{ type nsITrashAppCallback = Callable<{
trashAppFinished(rv: nsresult): void; trashAppFinished(rv: nsresult): void;
}> }>;
interface nsIMacWebAppUtils extends nsISupports { interface nsIMacWebAppUtils extends nsISupports {
pathForAppWithIdentifier(bundleIdentifier: string): string; pathForAppWithIdentifier(bundleIdentifier: string): string;
@ -135,7 +133,7 @@ interface nsITouchBarHelper extends nsISupports {
type nsITouchBarInputCallback = Callable<{ type nsITouchBarInputCallback = Callable<{
onCommand(): void; onCommand(): void;
}> }>;
interface nsITouchBarInput extends nsISupports { interface nsITouchBarInput extends nsISupports {
readonly key: string; readonly key: string;
@ -204,7 +202,6 @@ interface nsIXPCComponents_Interfaces {
nsIMacPreferencesReader: nsJSIID<nsIMacPreferencesReader>; nsIMacPreferencesReader: nsJSIID<nsIMacPreferencesReader>;
nsILocalFileMac: nsJSIID<nsILocalFileMac>; nsILocalFileMac: nsJSIID<nsILocalFileMac>;
} }
} // global } // global
// Typedefs from xpidl. // Typedefs from xpidl.
@ -223,6 +220,6 @@ type OutParam<T> = { value?: T };
type Enums<enums> = Partial<Pick<enums, keyof enums>>; type Enums<enums> = Partial<Pick<enums, keyof enums>>;
/** Callable accepts either form of a [function] interface. */ /** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function> type Callable<iface> = iface | Extract<iface[keyof iface], Function>;
export {}; export {};

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,6 @@
*/ */
declare global { declare global {
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIGNOMEShellService.idl // https://searchfox.org/mozilla-central/source/browser/components/shell/nsIGNOMEShellService.idl
interface nsIGNOMEShellService extends nsIShellService { interface nsIGNOMEShellService extends nsIShellService {
@ -24,7 +23,7 @@ interface nsIOpenTabsProvider extends nsISupports {
type nsIApplicationChooserFinishedCallback = Callable<{ type nsIApplicationChooserFinishedCallback = Callable<{
done(handlerApp: nsIHandlerApp): void; done(handlerApp: nsIHandlerApp): void;
}> }>;
interface nsIApplicationChooser extends nsISupports { interface nsIApplicationChooser extends nsISupports {
init(parent: mozIDOMWindowProxy, title: string): void; init(parent: mozIDOMWindowProxy, title: string): void;
@ -57,7 +56,6 @@ interface nsIXPCComponents_Interfaces {
nsIGtkTaskbarProgress: nsJSIID<nsIGtkTaskbarProgress>; nsIGtkTaskbarProgress: nsJSIID<nsIGtkTaskbarProgress>;
nsITaskbarProgress: nsJSIID<nsITaskbarProgress>; nsITaskbarProgress: nsJSIID<nsITaskbarProgress>;
} }
} // global } // global
// Typedefs from xpidl. // Typedefs from xpidl.
@ -77,6 +75,6 @@ type OutParam<T> = { value?: T };
type Enums<enums> = Partial<Pick<enums, keyof enums>>; type Enums<enums> = Partial<Pick<enums, keyof enums>>;
/** Callable accepts either form of a [function] interface. */ /** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function> type Callable<iface> = iface | Extract<iface[keyof iface], Function>;
export {}; export {};

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,6 @@
*/ */
interface nsIXPCComponents_Results { interface nsIXPCComponents_Results {
// Error Message definitions. // Error Message definitions.
// xpconnect specific codes (from nsIXPConnect.h) // xpconnect specific codes (from nsIXPConnect.h)

View file

@ -17,16 +17,16 @@ interface ChromeWindow extends Window {
} }
interface Document { interface Document {
createXULElement(name: "browser"): XULBrowserElement; createXULElement(name: 'browser'): XULBrowserElement;
} }
type nsIGleanPingNoReason = { type nsIGleanPingNoReason = {
[K in keyof nsIGleanPing]: K extends "submit" ? (_?: never) => void : nsIGleanPing[K]; [K in keyof nsIGleanPing]: K extends 'submit' ? (_?: never) => void : nsIGleanPing[K];
} };
type nsIGleanPingWithReason<T> = { type nsIGleanPingWithReason<T> = {
[K in keyof nsIGleanPing]: K extends "submit" ? (reason: T) => void : nsIGleanPing[K]; [K in keyof nsIGleanPing]: K extends 'submit' ? (reason: T) => void : nsIGleanPing[K];
} };
interface MessageListenerManagerMixin { interface MessageListenerManagerMixin {
// Overloads that define `data` arg as required, since it's ~always expected. // Overloads that define `data` arg as required, since it's ~always expected.
@ -52,31 +52,30 @@ interface nsISupports {
} }
interface nsIXPCComponents_Constructor { interface nsIXPCComponents_Constructor {
<const T, IIDs = nsIXPCComponents_Interfaces>(cid, id: T, init?): { <const T, IIDs = nsIXPCComponents_Interfaces>(
cid,
id: T,
init?
): {
new (...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>; new (...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>;
(...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>; (...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>;
} };
} }
interface ComponentsExceptionOptions { interface ComponentsExceptionOptions {
result?: number, result?: number;
stack?: nsIStackFrame, stack?: nsIStackFrame;
data?: object, data?: object;
} }
interface nsIException extends Exception {} interface nsIException extends Exception {}
interface nsIXPCComponents_Exception { interface nsIXPCComponents_Exception {
( (message?: string, resultOrOptions?: number | ComponentsExceptionOptions, stack?: nsIStackFrame, data?: object): nsIException;
message?: string,
resultOrOptions?: number | ComponentsExceptionOptions,
stack?: nsIStackFrame,
data?: object
): nsIException;
} }
interface nsIXPCComponents_ID { interface nsIXPCComponents_ID {
(uuid: string): nsID (uuid: string): nsID;
} }
interface nsIXPCComponents_utils_Sandbox { interface nsIXPCComponents_utils_Sandbox {
@ -87,7 +86,7 @@ interface nsXPCComponents_Classes {
[cid: string]: { [cid: string]: {
createInstance<T>(aID: T): nsQIResult<T>; createInstance<T>(aID: T): nsQIResult<T>;
getService<T>(aID?: T): unknown extends T ? nsISupports : nsQIResult<T>; getService<T>(aID?: T): unknown extends T ? nsISupports : nsQIResult<T>;
} };
} }
// Generic overloads. // Generic overloads.

View file

@ -5,7 +5,6 @@
*/ */
declare global { declare global {
// https://searchfox.org/mozilla-central/source/toolkit/components/aboutthirdparty/nsIAboutThirdParty.idl // https://searchfox.org/mozilla-central/source/toolkit/components/aboutthirdparty/nsIAboutThirdParty.idl
interface nsIInstalledApplication extends nsISupports { interface nsIInstalledApplication extends nsISupports {
@ -36,7 +35,6 @@ interface nsIAboutWindowsMessages extends nsISupports {
} }
// https://searchfox.org/mozilla-central/source/toolkit/components/alerts/nsIWindowsAlertsService.idl // https://searchfox.org/mozilla-central/source/toolkit/components/alerts/nsIWindowsAlertsService.idl
} // global } // global
declare enum nsIWindowsAlertNotification_ImagePlacement { declare enum nsIWindowsAlertNotification_ImagePlacement {
@ -46,7 +44,6 @@ declare enum nsIWindowsAlertNotification_ImagePlacement {
} }
declare global { declare global {
namespace nsIWindowsAlertNotification { namespace nsIWindowsAlertNotification {
type ImagePlacement = nsIWindowsAlertNotification_ImagePlacement; type ImagePlacement = nsIWindowsAlertNotification_ImagePlacement;
} }
@ -72,7 +69,14 @@ interface nsIDefaultAgent extends nsISupports {
getDefaultBrowser(): string; getDefaultBrowser(): string;
getReplacePreviousDefaultBrowser(aCurrentBrowser: string): string; getReplacePreviousDefaultBrowser(aCurrentBrowser: string): string;
getDefaultPdfHandler(): string; getDefaultPdfHandler(): string;
sendPing(aCurrentBrowser: string, aPreviousBrowser: string, aPdfHandler: string, aNotificationShown: string, aNotificationAction: string, daysSinceLastAppLaunch: u32): void; sendPing(
aCurrentBrowser: string,
aPreviousBrowser: string,
aPdfHandler: string,
aNotificationShown: string,
aNotificationAction: string,
daysSinceLastAppLaunch: u32
): void;
setDefaultBrowserUserChoice(aAumid: string, aExtraFileExtensions: string[]): void; setDefaultBrowserUserChoice(aAumid: string, aExtraFileExtensions: string[]): void;
setDefaultBrowserUserChoiceAsync(aAumid: string, aExtraFileExtensions: string[]): Promise<any>; setDefaultBrowserUserChoiceAsync(aAumid: string, aExtraFileExtensions: string[]): Promise<any>;
setDefaultExtensionHandlersUserChoice(aAumid: string, aFileExtensions: string[]): void; setDefaultExtensionHandlersUserChoice(aAumid: string, aFileExtensions: string[]): void;
@ -100,7 +104,6 @@ interface nsIGeolocationUIUtilsWin extends nsISupports {
// https://searchfox.org/mozilla-central/source/netwerk/socket/nsINamedPipeService.idl // https://searchfox.org/mozilla-central/source/netwerk/socket/nsINamedPipeService.idl
// https://searchfox.org/mozilla-central/source/browser/components/shell/nsIWindowsShellService.idl // https://searchfox.org/mozilla-central/source/browser/components/shell/nsIWindowsShellService.idl
} // global } // global
declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator { declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator {
@ -111,13 +114,23 @@ declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator {
} }
declare global { declare global {
namespace nsIWindowsShellService { namespace nsIWindowsShellService {
type LaunchOnLoginEnabledEnumerator = nsIWindowsShellService_LaunchOnLoginEnabledEnumerator; type LaunchOnLoginEnabledEnumerator = nsIWindowsShellService_LaunchOnLoginEnabledEnumerator;
} }
interface nsIWindowsShellService extends nsIShellService, Enums<typeof nsIWindowsShellService_LaunchOnLoginEnabledEnumerator> { interface nsIWindowsShellService
createShortcut(aBinary: nsIFile, aArguments: string[], aDescription: string, aIconFile: nsIFile, aIconIndex: u16, aAppUserModelId: string, aShortcutFolder: string, aShortcutName: string): Promise<any>; extends nsIShellService,
Enums<typeof nsIWindowsShellService_LaunchOnLoginEnabledEnumerator> {
createShortcut(
aBinary: nsIFile,
aArguments: string[],
aDescription: string,
aIconFile: nsIFile,
aIconIndex: u16,
aAppUserModelId: string,
aShortcutFolder: string,
aShortcutName: string
): Promise<any>;
getLaunchOnLoginShortcuts(): string[]; getLaunchOnLoginShortcuts(): string[];
pinCurrentAppToStartMenuAsync(aCheckOnly: boolean): Promise<any>; pinCurrentAppToStartMenuAsync(aCheckOnly: boolean): Promise<any>;
isCurrentAppPinnedToStartMenuAsync(): Promise<any>; isCurrentAppPinnedToStartMenuAsync(): Promise<any>;
@ -198,7 +211,7 @@ interface nsITaskbarPreviewButton extends nsISupports {
type nsITaskbarPreviewCallback = Callable<{ type nsITaskbarPreviewCallback = Callable<{
done(aCanvas: nsISupports, aDrawBorder: boolean): void; done(aCanvas: nsISupports, aDrawBorder: boolean): void;
}> }>;
interface nsITaskbarPreviewController extends nsISupports { interface nsITaskbarPreviewController extends nsISupports {
readonly width: u32; readonly width: u32;
@ -356,7 +369,6 @@ interface nsIXPCComponents_Interfaces {
nsIWindowsRegKey: nsJSIID<nsIWindowsRegKey>; nsIWindowsRegKey: nsJSIID<nsIWindowsRegKey>;
nsIWinAppHelper: nsJSIID<nsIWinAppHelper>; nsIWinAppHelper: nsJSIID<nsIWinAppHelper>;
} }
} // global } // global
// Typedefs from xpidl. // Typedefs from xpidl.
@ -375,6 +387,6 @@ type OutParam<T> = { value?: T };
type Enums<enums> = Partial<Pick<enums, keyof enums>>; type Enums<enums> = Partial<Pick<enums, keyof enums>>;
/** Callable accepts either form of a [function] interface. */ /** Callable accepts either form of a [function] interface. */
type Callable<iface> = iface | Extract<iface[keyof iface], Function> type Callable<iface> = iface | Extract<iface[keyof iface], Function>;
export {}; export {};

File diff suppressed because it is too large Load diff

View file

@ -15,10 +15,12 @@ interface nsID<uuid = string> {
* and expose constants defined on the class, including variants from enums. * and expose constants defined on the class, including variants from enums.
* https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#45 * https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCJSID.cpp#45
*/ */
type nsJSIID<iface, enums = {}> = nsID & Constants<iface> & enums & { type nsJSIID<iface, enums = {}> = nsID &
Constants<iface> &
enums & {
new (_: never): void; new (_: never): void;
prototype: iface; prototype: iface;
} };
/** A union type of all known interface IIDs. */ /** A union type of all known interface IIDs. */
type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces]; type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces];