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")
SRC_PATH = os.path.join("src", "zen", "@types")
def update_ts_types():
os.system("cd engine && ./mach ts build && ./mach ts update")
# 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('\n')
if __name__ == "__main__":
update_ts_types()
print("Updated TypeScript types.")

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

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

File diff suppressed because it is too large Load diff

View file

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

View file

@ -17,16 +17,16 @@ interface ChromeWindow extends Window {
}
interface Document {
createXULElement(name: "browser"): XULBrowserElement;
createXULElement(name: 'browser'): XULBrowserElement;
}
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> = {
[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 {
// Overloads that define `data` arg as required, since it's ~always expected.
@ -52,31 +52,30 @@ interface nsISupports {
}
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>;
(...any): nsQIResult<T extends keyof IIDs ? IIDs[T] : T>;
}
};
}
interface ComponentsExceptionOptions {
result?: number,
stack?: nsIStackFrame,
data?: object,
result?: number;
stack?: nsIStackFrame;
data?: object;
}
interface nsIException extends 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 {
(uuid: string): nsID
(uuid: string): nsID;
}
interface nsIXPCComponents_utils_Sandbox {
@ -87,7 +86,7 @@ interface nsXPCComponents_Classes {
[cid: string]: {
createInstance<T>(aID: T): nsQIResult<T>;
getService<T>(aID?: T): unknown extends T ? nsISupports : nsQIResult<T>;
}
};
}
// Generic overloads.

View file

@ -5,7 +5,6 @@
*/
declare global {
// https://searchfox.org/mozilla-central/source/toolkit/components/aboutthirdparty/nsIAboutThirdParty.idl
interface nsIInstalledApplication extends nsISupports {
@ -36,7 +35,6 @@ interface nsIAboutWindowsMessages extends nsISupports {
}
// https://searchfox.org/mozilla-central/source/toolkit/components/alerts/nsIWindowsAlertsService.idl
} // global
declare enum nsIWindowsAlertNotification_ImagePlacement {
@ -46,7 +44,6 @@ declare enum nsIWindowsAlertNotification_ImagePlacement {
}
declare global {
namespace nsIWindowsAlertNotification {
type ImagePlacement = nsIWindowsAlertNotification_ImagePlacement;
}
@ -72,7 +69,14 @@ interface nsIDefaultAgent extends nsISupports {
getDefaultBrowser(): string;
getReplacePreviousDefaultBrowser(aCurrentBrowser: string): 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;
setDefaultBrowserUserChoiceAsync(aAumid: string, aExtraFileExtensions: string[]): Promise<any>;
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/browser/components/shell/nsIWindowsShellService.idl
} // global
declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator {
@ -111,13 +114,23 @@ declare enum nsIWindowsShellService_LaunchOnLoginEnabledEnumerator {
}
declare global {
namespace nsIWindowsShellService {
type LaunchOnLoginEnabledEnumerator = nsIWindowsShellService_LaunchOnLoginEnabledEnumerator;
}
interface nsIWindowsShellService 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>;
interface nsIWindowsShellService
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[];
pinCurrentAppToStartMenuAsync(aCheckOnly: boolean): Promise<any>;
isCurrentAppPinnedToStartMenuAsync(): Promise<any>;
@ -198,7 +211,7 @@ interface nsITaskbarPreviewButton extends nsISupports {
type nsITaskbarPreviewCallback = Callable<{
done(aCanvas: nsISupports, aDrawBorder: boolean): void;
}>
}>;
interface nsITaskbarPreviewController extends nsISupports {
readonly width: u32;
@ -356,7 +369,6 @@ interface nsIXPCComponents_Interfaces {
nsIWindowsRegKey: nsJSIID<nsIWindowsRegKey>;
nsIWinAppHelper: nsJSIID<nsIWinAppHelper>;
}
} // global
// Typedefs from xpidl.
@ -375,6 +387,6 @@ type OutParam<T> = { value?: T };
type Enums<enums> = Partial<Pick<enums, keyof enums>>;
/** 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 {};

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.
* 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;
prototype: iface;
}
};
/** A union type of all known interface IIDs. */
type nsIID = nsIXPCComponents_Interfaces[keyof nsIXPCComponents_Interfaces];