diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-20 10:13:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 15:13:57 +0000 |
commit | fe875bbd99980b175fc366a2bfd4395be9cbad72 (patch) | |
tree | 9eacc919cae0aa32c1a5e25b8493a0e86a21f16e /types | |
parent | 0e4ae922451af967c78616057ed26b85ba5d4b5c (diff) |
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
Diffstat (limited to 'types')
-rw-r--r-- | types/ext/display.d.ts | 15 | ||||
-rw-r--r-- | types/ext/dom-data-binder.d.ts | 9 | ||||
-rw-r--r-- | types/ext/frontend.d.ts | 4 | ||||
-rw-r--r-- | types/ext/panel-element.d.ts | 5 | ||||
-rw-r--r-- | types/ext/popup.d.ts | 39 | ||||
-rw-r--r-- | types/ext/translator.d.ts | 6 |
6 files changed, 2 insertions, 76 deletions
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 <https://www.gnu.org/licenses/>. */ -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<TName extends EventNames<Events>> = BaseEventArgument<Events, TName>; -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<T = unknown> = { export type OnErrorCallback<T = unknown> = (error: Error, stale: boolean, element: Element, metadata: T) => void; -export type ConstructorDetails<T = unknown> = { - selector: string; - createElementMetadata: CreateElementMetadataCallback<T>; - compareElementMetadata: CompareElementMetadataCallback<T>; - getValues: GetValuesCallback<T>; - setValues: SetValuesCallback<T>; - onError?: OnErrorCallback<T> | null; -}; - export type ElementObserver<T = unknown> = { 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<TName extends EventNames<Events>> = BaseEventArgument<Events, TName>; - -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 <https://www.gnu.org/licenses/>. */ -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. */ |