From e937da34a4b5a0ec8f98ab16897d4eae4e34fb1a Mon Sep 17 00:00:00 2001 From: EnderDev Date: Fri, 2 Feb 2024 21:48:29 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Add=20types=20for=20ini?= =?UTF-8?q?tialising=20new=20MouseEvents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- third_party/dothq/gecko-types/index.d.ts | 106 +++++++++++++++++------ 1 file changed, 79 insertions(+), 27 deletions(-) diff --git a/third_party/dothq/gecko-types/index.d.ts b/third_party/dothq/gecko-types/index.d.ts index 6677417f87..18726aaa67 100755 --- a/third_party/dothq/gecko-types/index.d.ts +++ b/third_party/dothq/gecko-types/index.d.ts @@ -46,10 +46,22 @@ declare global { * Create a XUL element of a specific type. Right now this function * only refines iframes, but more tags could be added. */ - createXULElement: ((type: "iframe", options?: ElementCreationOptions) => XULIframeElement) & - ((type: "browser", options?: ElementCreationOptions) => Gecko.ChromeBrowser) & - ((type: "menupopup", options?: ElementCreationOptions) => Gecko.XULPopupElement) & - ((type: string, options?: ElementCreationOptions) => XULElement); + createXULElement: (( + type: "iframe", + options?: ElementCreationOptions + ) => XULIframeElement) & + (( + type: "browser", + options?: ElementCreationOptions + ) => Gecko.ChromeBrowser) & + (( + type: "menupopup", + options?: ElementCreationOptions + ) => Gecko.XULPopupElement) & + (( + type: string, + options?: ElementCreationOptions + ) => XULElement); /** * Determines whether we have had a valid user gesture activation @@ -58,9 +70,11 @@ declare global { nodePrincipal: any; - ownerGlobal: Window; + ownerGlobal: Window; - createEvent(eventInterface: "xulcommandevent"): XULCommandEvent; + createEvent( + eventInterface: "xulcommandevent" + ): XULCommandEvent; } /** @@ -82,15 +96,25 @@ declare global { interface ChromeWindow extends Window { openWebLinkIn: ( url: string, - where: "current" | "tab" | "tabshifted" | "window" | "save", + where: + | "current" + | "tab" + | "tabshifted" + | "window" + | "save", // TS-TODO - params?: unknown, + params?: unknown ) => void; openTrustedLinkIn: ( url: string, - where: "current" | "tab" | "tabshifted" | "window" | "save", + where: + | "current" + | "tab" + | "tabshifted" + | "window" + | "save", // TS-TODO - params?: unknown, + params?: unknown ) => void; isChromeWindow: boolean; } @@ -105,32 +129,57 @@ declare global { interface XULCommandEvent extends KeyboardEvent { target: XULElement; - initCommandEvent: ( - type: string, - canBubble: boolean, - cancelable: boolean, - view: Window, - detail: number, - ctrlKey: boolean, - altKey: boolean, - shiftKey: boolean, - metaKey: boolean, - button: number, - sourceEvent: Event, - inputSource: number - ) => void; + initCommandEvent: ( + type: string, + canBubble: boolean, + cancelable: boolean, + view: Window, + detail: number, + ctrlKey: boolean, + altKey: boolean, + shiftKey: boolean, + metaKey: boolean, + button: number, + sourceEvent: Event, + inputSource: number + ) => void; + } + + interface MouseEvent { + inputSource: number; + pressure: number; + + initNSMouseEvent: ( + type: string, + canBubble: boolean, + cancelable: boolean, + view: Window, + detail: number, + screenX: number, + screenY: number, + clientX: number, + clientY: number, + ctrlKey: boolean, + altKey: boolean, + shiftKey: boolean, + metaKey: boolean, + button: number, + relatedTarget: EventTarget, + pressure: number, + inputSource: number + ) => void; } interface XULElementWithCommandHandler { addEventListener: ( type: "command", handler: (event: XULCommandEvent) => void, - isCapture?: boolean, + isCapture?: boolean ) => void; removeEventListener: ( type: "command", handler: (event: XULCommandEvent) => void, - isCapture?: boolean, + isCapture?: boolean ) => void; } @@ -148,6 +197,9 @@ declare global { } interface CustomElementRegistry { - setElementCreationCallback(name: string, callback: () => void): void; + setElementCreationCallback( + name: string, + callback: () => void + ): void; } }