From fe875bbd99980b175fc366a2bfd4395be9cbad72 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 20 Feb 2024 10:13:57 -0500 Subject: Constructor simplification (#713) * Update AudioDownloader * Update Translator * Update ClipboardMonitor * Update ClipboardReader * Update PanelElement * Update QueryParser * Update DisplayGenerator * Update DisplayHistory * Update DOMDataBinder * Remove unnecessary cast * Update Popup types * One declaration per line * Remove optionals from Frontend constructor * Fix Translator constructor --- types/ext/display.d.ts | 15 --------------- types/ext/dom-data-binder.d.ts | 9 --------- types/ext/frontend.d.ts | 4 ++-- types/ext/panel-element.d.ts | 5 ----- types/ext/popup.d.ts | 39 --------------------------------------- types/ext/translator.d.ts | 6 ------ 6 files changed, 2 insertions(+), 76 deletions(-) (limited to 'types') diff --git a/types/ext/display.d.ts b/types/ext/display.d.ts index a2e61209..61e1aac5 100644 --- a/types/ext/display.d.ts +++ b/types/ext/display.d.ts @@ -15,10 +15,6 @@ * along with this program. If not, see . */ -import type {DisplayContentManager} from '../../ext/js/display/display-content-manager'; -import type {HotkeyHelpController} from '../../ext/js/input/hotkey-help-controller'; -import type {TextSourceGenerator} from '../../ext/js/dom/text-source-generator'; -import type {API} from '../../ext/js/comm/api'; import type * as Dictionary from './dictionary'; import type * as Extension from './extension'; import type * as Settings from './settings'; @@ -127,12 +123,6 @@ export type SearchMode = null | 'popup' | 'action-popup'; export type GetSearchContextCallback = TextScannerTypes.GetSearchContextCallbackSync; -export type QueryParserConstructorDetails = { - api: API; - getSearchContext: GetSearchContextCallback; - textSourceGenerator: TextSourceGenerator; -}; - export type QueryParserOptions = { selectedParser: string | null; termSpacing: boolean; @@ -170,11 +160,6 @@ export type Events = { export type EventArgument> = BaseEventArgument; -export type DisplayGeneratorConstructorDetails = { - contentManager: DisplayContentManager; - hotkeyHelpController?: HotkeyHelpController | null; -}; - // Direct API export type DirectApiSurface = { diff --git a/types/ext/dom-data-binder.d.ts b/types/ext/dom-data-binder.d.ts index 4835d686..3f12a455 100644 --- a/types/ext/dom-data-binder.d.ts +++ b/types/ext/dom-data-binder.d.ts @@ -38,15 +38,6 @@ export type SetValuesDetails = { export type OnErrorCallback = (error: Error, stale: boolean, element: Element, metadata: T) => void; -export type ConstructorDetails = { - selector: string; - createElementMetadata: CreateElementMetadataCallback; - compareElementMetadata: CompareElementMetadataCallback; - getValues: GetValuesCallback; - setValues: SetValuesCallback; - onError?: OnErrorCallback | null; -}; - export type ElementObserver = { element: Element; type: NormalizedElementType; diff --git a/types/ext/frontend.d.ts b/types/ext/frontend.d.ts index ca07e30c..b831deae 100644 --- a/types/ext/frontend.d.ts +++ b/types/ext/frontend.d.ts @@ -36,11 +36,11 @@ export type ConstructorDetails = { /** Whether or not proxy popups should be used. */ useProxyPopup: boolean; /** Whether or not window popups can be used. */ - canUseWindowPopup?: boolean; + canUseWindowPopup: boolean; /** Whether or not popups can be hosted in the root frame. */ allowRootFramePopupProxy: boolean; /** Whether popups can create child popups or not. */ - childrenSupported?: boolean; + childrenSupported: boolean; /** A HotkeyHandler instance. */ hotkeyHandler: HotkeyHandler; }; diff --git a/types/ext/panel-element.d.ts b/types/ext/panel-element.d.ts index c61b6358..f1d83349 100644 --- a/types/ext/panel-element.d.ts +++ b/types/ext/panel-element.d.ts @@ -27,8 +27,3 @@ export type Events = { }; export type EventArgument> = BaseEventArgument; - -export type ConstructorDetails = { - node: HTMLElement; - closingAnimationDuration: number; -}; diff --git a/types/ext/popup.d.ts b/types/ext/popup.d.ts index 1ea25c15..88c457ae 100644 --- a/types/ext/popup.d.ts +++ b/types/ext/popup.d.ts @@ -18,8 +18,6 @@ import type {Popup} from '../../ext/js/app/popup'; import type {PopupProxy} from '../../ext/js/app/popup-proxy'; import type {PopupWindow} from '../../ext/js/app/popup-window'; -import type {FrameOffsetForwarder} from '../../ext/js/comm/frame-offset-forwarder'; -import type {Application} from '../../ext/js/application'; import type * as DocumentUtil from './document-util'; import type * as Settings from './settings'; import type {EventNames, EventArgument as BaseEventArgument} from './core'; @@ -92,43 +90,6 @@ export type ValidSize = { valid: boolean; }; -export type PopupConstructorDetails = { - /** The main application instance. */ - application: Application; - /** The ID of the popup. */ - id: string; - /** The depth of the popup. */ - depth: number; - /** The ID of the host frame. */ - frameId: number; - /** Whether or not the popup is able to show child popups. */ - childrenSupported: boolean; -}; - -export type PopupWindowConstructorDetails = { - /** The main application instance. */ - application: Application; - /** The ID of the popup. */ - id: string; - /** The depth of the popup. */ - depth: number; - /** The ID of the host frame. */ - frameId: number; -}; - -export type PopupProxyConstructorDetails = { - /** The main application instance. */ - application: Application; - /** The ID of the popup. */ - id: string; - /** The depth of the popup. */ - depth: number; - /** The ID of the host frame. */ - frameId: number; - /** A `FrameOffsetForwarder` instance which is used to determine frame positioning. */ - frameOffsetForwarder: FrameOffsetForwarder | null; -}; - export type Events = { customOuterCssChanged: { node: HTMLStyleElement | HTMLLinkElement | null; diff --git a/types/ext/translator.d.ts b/types/ext/translator.d.ts index 5d552ca8..fb8d1142 100644 --- a/types/ext/translator.d.ts +++ b/types/ext/translator.d.ts @@ -15,15 +15,9 @@ * along with this program. If not, see . */ -import type {DictionaryDatabase} from '../../ext/js/dictionary/dictionary-database'; import type * as Dictionary from './dictionary'; import type * as DictionaryDatabaseTypes from './dictionary-database'; -export type ConstructorDetails = { - /** An instance of DictionaryDatabase. */ - database: DictionaryDatabase; -}; - /** * Information about how popup content should be shown, specifically related to the outer popup frame. */ -- cgit v1.2.3