From 0b1ae5a31dba4941214d5d21ac9660ed5fb39271 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 26 Feb 2024 14:46:36 +0000 Subject: [PATCH] chore: enable verbatimModuleSyntax (#368) TypeScript 5.0 introduce a new option [verbatimModuleSyntax](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#--verbatimmodulesyntax). --- .github/workflows/build.yml | 2 +- jest.config.cjs | 11 +++++ jest.config.ts | 11 ----- src/background/Application.ts | 10 ++-- src/background/clients/AddonEnabledClient.ts | 2 +- src/background/clients/ConsoleClient.ts | 2 +- src/background/clients/ConsoleFrameClient.ts | 2 +- .../clients/ConsoleMessageSender.ts | 4 +- .../clients/ContentMessageClient.ts | 2 +- .../clients/ContentMessageSender.ts | 4 +- src/background/clients/FindClient.ts | 4 +- src/background/clients/FrameClient.ts | 2 +- src/background/clients/HintClient.ts | 4 +- src/background/clients/ModeClient.ts | 4 +- src/background/clients/NavigateClient.ts | 2 +- src/background/clients/TopFrameClient.ts | 2 +- src/background/command/AddBookmarkCommand.ts | 6 +-- src/background/command/BufferCommand.ts | 6 +-- src/background/command/BufferCommandHelper.ts | 4 +- src/background/command/BufferDeleteCommand.ts | 4 +- .../command/BufferDeletesCommand.ts | 4 +- src/background/command/CommandRegistry.ts | 4 +- src/background/command/HelpCommand.ts | 4 +- src/background/command/OpenCommand.ts | 7 ++- src/background/command/OpenCommandHelper.ts | 6 +-- src/background/command/QuitAllCommand.ts | 3 +- src/background/command/QuitCommand.ts | 3 +- src/background/command/SetCommand.ts | 9 ++-- src/background/command/TabOpenCommand.ts | 7 ++- src/background/command/WindowOpenCommand.ts | 7 ++- src/background/command/index.ts | 12 ++--- .../command/{Command.ts => types.ts} | 6 +-- .../controllers/CommandController.ts | 4 +- .../controllers/ConsoleController.ts | 2 +- src/background/controllers/FindController.ts | 4 +- src/background/controllers/KeyController.ts | 2 +- .../controllers/OperationController.ts | 4 +- .../controllers/SettingsController.ts | 2 +- src/background/db/LocalStorage.ts | 2 +- src/background/di.ts | 6 +-- src/background/domains/GlobalMark.ts | 6 --- src/background/domains/LocalMark.ts | 4 -- src/background/hint/HintActionFactory.ts | 4 +- src/background/hint/HintTarget.ts | 7 --- src/background/hint/OpenCommandHintAction.ts | 7 ++- src/background/hint/OpenHintAction.ts | 7 ++- src/background/hint/OpenImageHintAction.ts | 7 ++- src/background/hint/OpenSourceHintAction.ts | 7 ++- src/background/hint/QuickHintAction.ts | 9 ++-- .../hint/TabopenCommandHintAction.ts | 7 ++- src/background/hint/TabopenHintAction.ts | 7 ++- .../hint/WinopenCommandHintAction.ts | 7 ++- src/background/hint/WinopenHintAction.ts | 7 ++- src/background/hint/YankLinkTextHintAction.ts | 9 ++-- src/background/hint/YankURLHintAction.ts | 9 ++-- .../hint/{HintAction.ts => types.ts} | 10 ++-- .../messaging/BackgroundMessageListener.ts | 4 +- src/background/messaging/RequestContext.ts | 5 -- src/background/messaging/types.ts | 3 ++ src/background/operators/OperatorRegistory.ts | 4 +- .../operators/impls/CancelOperator.ts | 5 +- .../operators/impls/CloseTabOperator.ts | 3 +- .../operators/impls/CloseTabRightOperator.ts | 2 +- .../operators/impls/DisableAddonOperator.ts | 2 +- .../operators/impls/DuplicateTabOperator.ts | 3 +- .../operators/impls/EnableAddonOperator.ts | 2 +- .../operators/impls/FindNextOperator.ts | 3 +- .../operators/impls/FindPrevOperator.ts | 3 +- .../operators/impls/FocusOperator.ts | 5 +- .../impls/HorizontalScrollOperator.ts | 7 ++- .../impls/NavigateHistoryNextOperator.ts | 5 +- .../impls/NavigateHistoryPrevOperator.ts | 5 +- .../impls/NavigateLinkNextOperator.ts | 5 +- .../impls/NavigateLinkPrevOperator.ts | 5 +- .../operators/impls/NavigateParentOperator.ts | 3 +- .../operators/impls/NavigateRootOperator.ts | 3 +- .../impls/OpenCommandHintOperator.ts | 5 +- .../operators/impls/OpenHintOperator.ts | 5 +- .../operators/impls/OpenHomeOperator.ts | 5 +- .../operators/impls/OpenImageHintOperator.ts | 5 +- .../operators/impls/OpenSourceHintOperator.ts | 5 +- .../operators/impls/OpenSourceOperator.ts | 3 +- .../operators/impls/PageScrollOperator.ts | 7 ++- .../operators/impls/PasteOperator.ts | 7 ++- .../operators/impls/PinTabOperator.ts | 2 +- .../operators/impls/QuickHintOperator.ts | 5 +- .../operators/impls/ReloadTabOperator.ts | 3 +- .../operators/impls/ReopenTabOperator.ts | 2 +- .../operators/impls/RepeatLastOperator.ts | 7 ++- .../operators/impls/ScrollToBottomOperator.ts | 7 ++- .../operators/impls/ScrollToEndOperator.ts | 7 ++- .../operators/impls/ScrollToHomeOperator.ts | 7 ++- .../operators/impls/ScrollToTopOperator.ts | 7 ++- .../operators/impls/SelectFirstTabOperator.ts | 2 +- .../operators/impls/SelectLastTabOperator.ts | 2 +- .../SelectPreviousSelectedTabOperator.ts | 4 +- .../operators/impls/SelectTabNextOperator.ts | 2 +- .../operators/impls/SelectTabPrevOperator.ts | 2 +- .../impls/ShowAddBookmarkOperator.ts | 5 +- .../impls/ShowBufferCommandOperator.ts | 5 +- .../operators/impls/ShowCommandOperator.ts | 5 +- .../impls/ShowOpenCommandOperator.ts | 5 +- .../impls/ShowTabOpenCommandOperator.ts | 5 +- .../impls/ShowWinOpenCommandOperator.ts | 5 +- .../operators/impls/StartFindOperator.ts | 5 +- .../operators/impls/StartJumpMarkOperator.ts | 5 +- .../operators/impls/StartSetMarkOperator.ts | 5 +- .../impls/TabopenCommandHintOperator.ts | 5 +- .../operators/impls/TabopenHintOperator.ts | 5 +- .../operators/impls/ToggleAddonOperator.ts | 2 +- .../impls/TogglePinnedTabOperator.ts | 3 +- .../operators/impls/ToggleReaderOperator.ts | 2 +- .../operators/impls/UnpinTabOperator.ts | 2 +- .../operators/impls/VerticalScrollOperator.ts | 7 ++- .../impls/WinopenCommandHintOperator.ts | 5 +- .../operators/impls/WinopenHintOperator.ts | 5 +- .../operators/impls/YankLinkTextOperator.ts | 5 +- .../operators/impls/YankOperator.ts | 7 ++- .../operators/impls/YankURLHintOperator.ts | 5 +- .../operators/impls/ZoomInOperator.ts | 3 +- .../operators/impls/ZoomOutOperator.ts | 3 +- .../operators/impls/ZoomResetOperator.ts | 2 +- src/background/operators/index.ts | 4 +- .../operators/{Operator.ts => types.ts} | 4 +- src/background/presenters/Notifier.ts | 2 +- src/background/presenters/TabPresenter.ts | 2 +- src/background/presenters/ToolbarPresenter.ts | 2 +- .../property/ColorSchemeProperty.ts | 3 +- src/background/property/CompleteProperty.ts | 3 +- src/background/property/FindModeProperty.ts | 3 +- src/background/property/HintcharsProperty.ts | 3 +- src/background/property/IgnoreCaseProperty.ts | 3 +- src/background/property/PropertyRegistry.ts | 4 +- .../property/SmoothScrollProperty.ts | 3 +- src/background/property/index.ts | 27 ++++++----- .../property/{Property.ts => types.ts} | 2 +- .../repositories/AddonEnabledRepository.ts | 4 +- .../repositories/BrowserSettingRepository.ts | 2 +- .../repositories/ClipboardRepository.ts | 2 +- .../repositories/FindHistoryRepository.ts | 4 +- src/background/repositories/FindRepository.ts | 4 +- src/background/repositories/HintRepository.ts | 6 +-- .../repositories/LastSelectedTabRepository.ts | 4 +- src/background/repositories/MarkRepository.ts | 18 +++++-- src/background/repositories/ModeRepository.ts | 6 +-- .../repositories/ReadyFrameRepository.ts | 4 +- .../repositories/RepeatRepository.ts | 6 +-- src/background/settings/PropertySettings.ts | 6 +-- .../settings/SearchEngineSettings.ts | 6 +-- src/background/settings/SettingsRepository.ts | 8 ++-- src/background/settings/StyleSettings.ts | 6 +-- src/background/settings/Validator.ts | 6 +-- .../usecases/AddonEnabledEventUseCase.ts | 6 +-- .../usecases/AddonEnabledUseCase.ts | 4 +- src/background/usecases/CommandUseCase.ts | 8 ++-- src/background/usecases/ConsoleUseCase.ts | 2 +- src/background/usecases/FindUseCase.ts | 12 ++--- src/background/usecases/HintKeyUseCase.ts | 8 ++-- src/background/usecases/HintModeUseCase.ts | 14 +++--- src/background/usecases/MarkJumpUseCase.ts | 8 ++-- src/background/usecases/MarkSetUseCase.ts | 12 +++-- src/background/usecases/ModeUseCase.ts | 6 +-- src/background/usecases/OperationUseCase.ts | 10 ++-- .../usecases/SettingsEventUseCase.ts | 4 +- src/background/usecases/SettingsUseCase.ts | 6 +-- src/background/usecases/VersionUseCase.ts | 2 +- src/console/Completions.ts | 11 ----- src/console/app/contexts.ts | 4 +- src/console/app/recuer.ts | 2 +- .../clients/BackgroundMessageSender.ts | 4 +- src/console/clients/CommandClient.ts | 4 +- src/console/clients/ConsoleFrameClient.ts | 2 +- src/console/clients/FindClient.ts | 4 +- src/console/clients/SettingClient.ts | 2 +- .../completion/components/Completion.tsx | 6 +-- src/console/components/Prompt.tsx | 4 +- src/console/components/PromptInput.tsx | 2 +- src/console/styles/providers.tsx | 2 +- src/content/Application.ts | 2 +- src/content/InputDriver.ts | 2 +- src/content/client/BackgroundKeyClient.ts | 6 +-- src/content/client/BackgroundMessageSender.ts | 4 +- src/content/client/OperationClient.ts | 6 +-- src/content/client/SettingClient.ts | 6 +-- src/content/client/TopFrameClient.ts | 4 +- src/content/client/WindowMessageSender.ts | 4 +- src/content/controllers/FindController.ts | 2 +- src/content/controllers/FocusController.ts | 2 +- src/content/controllers/HintController.ts | 2 +- src/content/controllers/KeyController.ts | 8 ++-- src/content/controllers/ModeController.ts | 4 +- src/content/controllers/ScrollController.ts | 2 +- src/content/controllers/SettingsController.ts | 2 +- src/content/controllers/TopFrameController.ts | 2 +- .../controllers/WindowRequestContext.ts | 3 -- src/content/controllers/types.ts | 3 ++ src/content/di.ts | 2 - src/content/domains/KeySequence.ts | 2 +- .../messaging/WindowMessageListener.ts | 2 +- .../presenters/ConsoleFramePresenter.ts | 2 +- src/content/presenters/FindPresenter.ts | 4 +- src/content/presenters/FocusPresenter.ts | 2 +- src/content/presenters/HintPresenter.ts | 6 +-- src/content/presenters/NavigationPresenter.ts | 2 +- .../presenters/ReadyStatusPresenter.ts | 2 +- src/content/presenters/ScrollPresenter.ts | 2 +- .../repositories/AddonEnabledRepository.ts | 2 +- src/content/repositories/AddressRepository.ts | 2 +- .../repositories/ClipboardRepository.ts | 47 ------------------- src/content/repositories/FrameIdRepository.ts | 2 +- src/content/repositories/KeymapRepository.ts | 4 +- src/content/repositories/ModeRepository.ts | 4 +- src/content/repositories/SettingRepository.ts | 16 +++---- src/content/usecases/AddonEnabledUseCase.ts | 4 +- src/content/usecases/ConsoleFrameUseCase.ts | 4 +- src/content/usecases/FindUseCase.ts | 4 +- src/content/usecases/FrameUseCase.ts | 2 +- src/content/usecases/HintUseCase.ts | 4 +- src/content/usecases/KeymapUseCase.ts | 14 +++--- src/content/usecases/NavigateUseCase.ts | 2 +- src/content/usecases/OperationUseCase.ts | 4 +- src/content/usecases/TopFrameUseCase.ts | 2 +- src/messaging/handler/Receiver.ts | 2 +- src/messaging/handler/ReceiverWithContext.ts | 2 +- src/messaging/handler/Sender.ts | 2 +- src/messaging/handler/SimplexReceiver.ts | 2 +- .../handler/SimplexReceiverWithContext.ts | 2 +- src/messaging/handler/SimplexSender.ts | 2 +- src/messaging/schema/background.ts | 8 ++-- src/messaging/schema/console.ts | 4 +- src/messaging/schema/content.ts | 10 ++-- src/messaging/schema/window.ts | 4 +- src/settings/serdes.ts | 16 +++---- src/shared/Command.ts | 15 ------ src/shared/HTMLElementType.ts | 6 +-- src/shared/Operation.ts | 4 -- src/shared/Settings.ts | 15 ------ src/shared/{Blacklist.ts => blacklist.ts} | 4 +- src/shared/{Completions.ts => completions.ts} | 0 src/shared/{FindQuery.ts => findQuery.ts} | 6 +-- src/shared/{Key.ts => key.ts} | 2 +- src/shared/{Keymaps.ts => keymaps.ts} | 4 +- src/shared/{Mode.ts => mode.ts} | 2 - src/shared/operation.ts | 6 +++ src/shared/{Properties.ts => properties.ts} | 2 +- src/shared/{Search.ts => search.ts} | 2 +- src/shared/settings.ts | 13 +++++ src/shared/{Styles.ts => styles.ts} | 5 +- src/shared/urls.ts | 2 +- .../command/BufferDeleteCommand.test.ts | 2 +- .../command/OpenCommandHelper.test.ts | 4 +- test/background/command/SetCommand.test.ts | 2 +- .../background/mock/MockAddonEnabledClient.ts | 2 +- .../mock/MockAddonEnabledRepository.ts | 2 +- .../mock/MockBrowserSettingRepository.ts | 2 +- .../mock/MockClipboardRepository.ts | 2 +- test/background/mock/MockConsoleClient.ts | 2 +- .../mock/MockContentMessageClient.ts | 2 +- test/background/mock/MockFindClient.ts | 4 +- .../mock/MockFindHistoryRepository.ts | 2 +- test/background/mock/MockFindRepository.ts | 3 +- test/background/mock/MockHintActionFactory.ts | 8 ++-- test/background/mock/MockHintClient.ts | 4 +- test/background/mock/MockHintRepository.ts | 4 +- .../mock/MockLastSelectedTabRepository.ts | 2 +- test/background/mock/MockLocalStorage.ts | 4 +- test/background/mock/MockMarkRepository.ts | 8 ++-- test/background/mock/MockNavigateClient.ts | 2 +- test/background/mock/MockPropertyRegistry.ts | 4 +- test/background/mock/MockPropertySettings.ts | 2 +- .../mock/MockReadyFrameRepository.ts | 2 +- .../background/mock/MockSettingsRepository.ts | 4 +- test/background/mock/MockTabPresenter.ts | 6 ++- test/background/mock/MockToolbarPresenter.ts | 3 +- test/background/mock/MockTopFrameClient.ts | 2 +- test/background/mock/MockWindowPresenter.ts | 7 --- test/background/mock/MockZoomPresenter.ts | 15 ------ .../operators/impls/CancelOperator.test.ts | 2 +- .../impls/DuplicateTabOperator.test.ts | 2 +- .../impls/NavigateHistoryNextOperator.test.ts | 2 +- .../impls/NavigateHistoryPrevOperator.test.ts | 2 +- .../impls/NavigateLinkNextOperator.test.ts | 2 +- .../impls/NavigateLinkPrevOperator.test.ts | 2 +- .../impls/NavigateParentOperator.test.ts | 2 +- .../impls/NavigateRootOperator.test.ts | 2 +- .../operators/impls/OpenHomeOperator.test.ts | 2 +- .../impls/OpenSourceOperator.test.ts | 2 +- .../operators/impls/ReloadTabOperator.test.ts | 2 +- .../impls/RepeatLastOperator.test.ts | 10 ++-- .../impls/ShowAddBookmarkOperator.test.ts | 2 +- .../impls/ShowBufferCommandOperator.test.ts | 2 +- .../impls/ShowCommandOperator.test.ts | 2 +- .../impls/ShowOpenCommandOperator.test.ts | 2 +- .../impls/ShowTabOpenCommandOperator.test.ts | 2 +- .../impls/ShowWinOpenCommandOperator.test.ts | 2 +- .../operators/impls/StartFindOperator.test.ts | 2 +- .../impls/TogglePinnedTabOperator.test.ts | 2 +- .../operators/impls/ZoomInOperator.test.ts | 2 +- .../operators/impls/ZoomOutOperator.test.ts | 2 +- .../property/PropertyRegistry.test.ts | 2 +- .../settings/PropertySettings.test.ts | 5 +- .../settings/SettingsRepository.test.ts | 2 +- test/background/settings/Validator.test.ts | 11 ++--- .../usecases/HintKeyUseCase.test.ts | 2 +- test/console/app/reducer.test.ts | 5 +- test/content/InputDriver.test.ts | 2 +- test/content/domains/KeySequence.test.ts | 2 +- .../mock/MockAddonEnabledRepository.ts | 2 +- .../content/mock/MockConsoleFramePresenter.ts | 2 +- test/content/mock/MockFocusPresenter.ts | 2 +- test/content/mock/MockScrollPresenter.ts | 3 +- test/content/mock/MockSettingRepository.ts | 14 +++--- .../repositories/KeymapRepository.test.ts | 8 ++-- .../repositories/SettingRepository.test.ts | 4 +- test/content/usecases/KeymapUseCase.test.ts | 4 +- .../content/usecases/OperationUseCase.test.ts | 2 +- test/settings/serdes.test.ts | 6 +-- test/shared/Blacklist.test.ts | 4 +- test/shared/Key.test.ts | 2 +- test/shared/Keymaps.test.ts | 2 +- test/shared/Search.test.ts | 2 +- test/shared/urls.test.ts | 2 +- tsconfig.jest.json | 6 +++ tsconfig.json | 14 ++---- 324 files changed, 656 insertions(+), 851 deletions(-) create mode 100644 jest.config.cjs delete mode 100644 jest.config.ts rename src/background/command/{Command.ts => types.ts} (88%) delete mode 100644 src/background/domains/GlobalMark.ts delete mode 100644 src/background/domains/LocalMark.ts delete mode 100644 src/background/hint/HintTarget.ts rename src/background/hint/{HintAction.ts => types.ts} (59%) delete mode 100644 src/background/messaging/RequestContext.ts create mode 100644 src/background/messaging/types.ts rename src/background/operators/{Operator.ts => types.ts} (88%) rename src/background/property/{Property.ts => types.ts} (88%) delete mode 100644 src/console/Completions.ts delete mode 100644 src/content/controllers/WindowRequestContext.ts create mode 100644 src/content/controllers/types.ts delete mode 100644 src/content/repositories/ClipboardRepository.ts delete mode 100644 src/shared/Command.ts delete mode 100644 src/shared/Operation.ts delete mode 100644 src/shared/Settings.ts rename src/shared/{Blacklist.ts => blacklist.ts} (94%) rename src/shared/{Completions.ts => completions.ts} (100%) rename src/shared/{FindQuery.ts => findQuery.ts} (59%) rename src/shared/{Key.ts => key.ts} (98%) rename src/shared/{Keymaps.ts => keymaps.ts} (84%) rename src/shared/{Mode.ts => mode.ts} (83%) create mode 100644 src/shared/operation.ts rename src/shared/{Properties.ts => properties.ts} (54%) rename src/shared/{Search.ts => search.ts} (96%) create mode 100644 src/shared/settings.ts rename src/shared/{Styles.ts => styles.ts} (54%) delete mode 100644 test/background/mock/MockWindowPresenter.ts delete mode 100644 test/background/mock/MockZoomPresenter.ts create mode 100644 tsconfig.jest.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9099c99b..ae3da363 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: node-version-file: 'package.json' cache: 'pnpm' - run: pnpm install --frozen-lockfile - - run: pnpm tsc + - run: pnpm type-checks - run: pnpm lint - run: pnpm test - run: pnpm package diff --git a/jest.config.cjs b/jest.config.cjs new file mode 100644 index 00000000..d0c63e9e --- /dev/null +++ b/jest.config.cjs @@ -0,0 +1,11 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + verbose: true, + testMatch: ["/test/**/*.test.+(ts|tsx|js|jsx)"], + transform: { + // Use isolated tsconfig for jest to disable verbatimModuleSyntax + // https://github.com/kulshekhar/ts-jest/issues/4081 + "^.+\\.(ts|tsx)$": ["ts-jest", { tsconfig: "tsconfig.jest.json" }], + }, + setupFiles: ["./test/main.ts"], +}; diff --git a/jest.config.ts b/jest.config.ts deleted file mode 100644 index e058adf8..00000000 --- a/jest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Config } from "@jest/types"; - -const config: Config.InitialOptions = { - verbose: true, - testMatch: ["**/test/**/*.test.+(ts|tsx|js|jsx)"], - transform: { - "^.+\\.(ts|tsx)$": "ts-jest", - }, - setupFiles: ["./test/main.ts"], -}; -export default config; diff --git a/src/background/Application.ts b/src/background/Application.ts index f43b59bd..26517e09 100644 --- a/src/background/Application.ts +++ b/src/background/Application.ts @@ -2,12 +2,12 @@ import { injectable, inject } from "inversify"; import BackgroundMessageListener from "./messaging/BackgroundMessageListener"; import FindPortListener from "./messaging/FindPortListener"; import VersionUseCase from "./usecases/VersionUseCase"; -import FindRepositoryImpl from "./repositories/FindRepository"; -import ReadyFrameRepository from "./repositories/ReadyFrameRepository"; +import type { FindRepository } from "./repositories/FindRepository"; +import type { ReadyFrameRepository } from "./repositories/ReadyFrameRepository"; import SettingsEventUseCase from "./usecases/SettingsEventUseCase"; -import FrameClient from "./clients/FrameClient"; +import type { FrameClient } from "./clients/FrameClient"; import AddonEnabledEventUseCase from "./usecases/AddonEnabledEventUseCase"; -import LastSelectedTabRepository from "./repositories/LastSelectedTabRepository"; +import type { LastSelectedTabRepository } from "./repositories/LastSelectedTabRepository"; import ModeUseCase from "./usecases/ModeUseCase"; import HintModeUseCase from "./usecases/HintModeUseCase"; @@ -19,7 +19,7 @@ export default class Application { @inject(VersionUseCase) private readonly versionUseCase: VersionUseCase, @inject("FindRepository") - private readonly findRepository: FindRepositoryImpl, + private readonly findRepository: FindRepository, @inject("ReadyFrameRepository") private readonly frameRepository: ReadyFrameRepository, @inject("LastSelectedTabRepository") diff --git a/src/background/clients/AddonEnabledClient.ts b/src/background/clients/AddonEnabledClient.ts index 279da09e..9df76fce 100644 --- a/src/background/clients/AddonEnabledClient.ts +++ b/src/background/clients/AddonEnabledClient.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -export default interface AddonEnabledClient { +export interface AddonEnabledClient { enable(tabId: number): Promise; disable(tabId: number): Promise; diff --git a/src/background/clients/ConsoleClient.ts b/src/background/clients/ConsoleClient.ts index eaef2e6b..6cecd810 100644 --- a/src/background/clients/ConsoleClient.ts +++ b/src/background/clients/ConsoleClient.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; import { newSender } from "./ConsoleMessageSender"; -export default interface ConsoleClient { +export interface ConsoleClient { showCommand(tabId: number, command: string): Promise; showFind(tabId: number): Promise; diff --git a/src/background/clients/ConsoleFrameClient.ts b/src/background/clients/ConsoleFrameClient.ts index adc6c16d..545005a0 100644 --- a/src/background/clients/ConsoleFrameClient.ts +++ b/src/background/clients/ConsoleFrameClient.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -export default interface ConsoleFrameClient { +export interface ConsoleFrameClient { resize(tabId: number, width: number, height: number): Promise; } diff --git a/src/background/clients/ConsoleMessageSender.ts b/src/background/clients/ConsoleMessageSender.ts index 42c324d3..06b1405d 100644 --- a/src/background/clients/ConsoleMessageSender.ts +++ b/src/background/clients/ConsoleMessageSender.ts @@ -1,8 +1,6 @@ import type { Schema, Key, Request } from "../../messaging/schema/console"; import { Sender } from "../../messaging"; -type ConsoleMessageSender = Sender; - export const newSender = (tabId: number, frameId?: number) => { const sender = new Sender((type: Key, args: Request) => { if (process.env.NODE_ENV === "development") { @@ -17,4 +15,4 @@ export const newSender = (tabId: number, frameId?: number) => { return sender; }; -export default ConsoleMessageSender; +export type ConsoleMessageSender = Sender; diff --git a/src/background/clients/ContentMessageClient.ts b/src/background/clients/ContentMessageClient.ts index 4f0cd6c2..aed7f3a9 100644 --- a/src/background/clients/ContentMessageClient.ts +++ b/src/background/clients/ContentMessageClient.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -export default interface ContentMessageClient { +export interface ContentMessageClient { scrollTo( tabId: number, frameId: number, diff --git a/src/background/clients/ContentMessageSender.ts b/src/background/clients/ContentMessageSender.ts index 9657734a..4956c42c 100644 --- a/src/background/clients/ContentMessageSender.ts +++ b/src/background/clients/ContentMessageSender.ts @@ -1,8 +1,6 @@ import type { Schema, Key, Request } from "../../messaging/schema/content"; import { Sender } from "../../messaging"; -type ContentMessageSender = Sender; - export const newSender = (tabId: number, frameId?: number) => { const sender = new Sender((type: Key, args: Request) => { if (process.env.NODE_ENV === "development") { @@ -18,4 +16,4 @@ export const newSender = (tabId: number, frameId?: number) => { return sender; }; -export default ContentMessageSender; +export type ContentMessageSender = Sender; diff --git a/src/background/clients/FindClient.ts b/src/background/clients/FindClient.ts index fd41a49b..cc9cc311 100644 --- a/src/background/clients/FindClient.ts +++ b/src/background/clients/FindClient.ts @@ -1,8 +1,8 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -import type FindQuery from "../../shared/FindQuery"; +import type { FindQuery } from "../../shared/findQuery"; -export default interface FindClient { +export interface FindClient { findNext(tabId: number, frameId: number, query: FindQuery): Promise; findPrev(tabId: number, frameId: number, query: FindQuery): Promise; diff --git a/src/background/clients/FrameClient.ts b/src/background/clients/FrameClient.ts index 741d4115..6f9e3276 100644 --- a/src/background/clients/FrameClient.ts +++ b/src/background/clients/FrameClient.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -export default interface FrameClient { +export interface FrameClient { notifyFrameId(tabId: number, frameId: number): Promise; } diff --git a/src/background/clients/HintClient.ts b/src/background/clients/HintClient.ts index da956176..f93b88ea 100644 --- a/src/background/clients/HintClient.ts +++ b/src/background/clients/HintClient.ts @@ -1,6 +1,6 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -import type HTMLElementType from "../../shared/HTMLElementType"; +import type { HTMLElementType } from "../../shared/HTMLElementType"; export type Point = { x: number; @@ -12,7 +12,7 @@ export type Size = { height: number; }; -export default interface HintClient { +export interface HintClient { lookupTargets( tabId: number, frameId: number, diff --git a/src/background/clients/ModeClient.ts b/src/background/clients/ModeClient.ts index 8572772f..c8a5390f 100644 --- a/src/background/clients/ModeClient.ts +++ b/src/background/clients/ModeClient.ts @@ -1,8 +1,8 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -import Mode from "../../shared/Mode"; +import { Mode } from "../../shared/mode"; -export default interface ModeClient { +export interface ModeClient { setMode(tabid: number, mode: Mode): Promise; } diff --git a/src/background/clients/NavigateClient.ts b/src/background/clients/NavigateClient.ts index 255b4ddf..c60612d9 100644 --- a/src/background/clients/NavigateClient.ts +++ b/src/background/clients/NavigateClient.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; import { newSender } from "./ContentMessageSender"; -export default interface NavigateClient { +export interface NavigateClient { historyNext(tabId: number): Promise; historyPrev(tabId: number): Promise; diff --git a/src/background/clients/TopFrameClient.ts b/src/background/clients/TopFrameClient.ts index 6419b6f8..eb3fbd57 100644 --- a/src/background/clients/TopFrameClient.ts +++ b/src/background/clients/TopFrameClient.ts @@ -11,7 +11,7 @@ export type Point = { y: number; }; -export default interface TopFrameClient { +export interface TopFrameClient { getWindowViewport(tabId: number): Promise; getFramePosition(tabId: number, frameId: number): Promise; diff --git a/src/background/command/AddBookmarkCommand.ts b/src/background/command/AddBookmarkCommand.ts index d1d130bb..c5ed7f7c 100644 --- a/src/background/command/AddBookmarkCommand.ts +++ b/src/background/command/AddBookmarkCommand.ts @@ -1,7 +1,5 @@ -import type Command from "./Command"; -import type { CommandContext } from "./Command"; -import type { Completions } from "./Command"; -import type ConsoleClient from "../clients/ConsoleClient"; +import type { Command, CommandContext, Completions } from "./types"; +import type { ConsoleClient } from "../clients/ConsoleClient"; class AddBookmarkCommand implements Command { constructor(private readonly consoleClient: ConsoleClient) {} diff --git a/src/background/command/BufferCommand.ts b/src/background/command/BufferCommand.ts index 8b320c1f..dc9b38cf 100644 --- a/src/background/command/BufferCommand.ts +++ b/src/background/command/BufferCommand.ts @@ -1,7 +1,5 @@ -import type Command from "./Command"; -import type { CommandContext } from "./Command"; -import type { Completions } from "./Command"; -import type LastSelectedTabRepository from "../repositories/LastSelectedTabRepository"; +import type { Command, CommandContext, Completions } from "./types"; +import type { LastSelectedTabRepository } from "../repositories/LastSelectedTabRepository"; import BufferCommandHelper from "./BufferCommandHelper"; class BufferCommand implements Command { diff --git a/src/background/command/BufferCommandHelper.ts b/src/background/command/BufferCommandHelper.ts index dcf9baeb..be501855 100644 --- a/src/background/command/BufferCommandHelper.ts +++ b/src/background/command/BufferCommandHelper.ts @@ -1,5 +1,5 @@ -import { Completions } from "../../shared/Completions"; -import LastSelectedTabRepository from "../repositories/LastSelectedTabRepository"; +import type { Completions } from "../../shared/completions"; +import type { LastSelectedTabRepository } from "../repositories/LastSelectedTabRepository"; export default class BufferCommandHelper { constructor( diff --git a/src/background/command/BufferDeleteCommand.ts b/src/background/command/BufferDeleteCommand.ts index 48354768..345105d1 100644 --- a/src/background/command/BufferDeleteCommand.ts +++ b/src/background/command/BufferDeleteCommand.ts @@ -1,6 +1,4 @@ -import type Command from "./Command"; -import type { CommandContext } from "./Command"; -import type { Completions } from "./Command"; +import type { Command, CommandContext, Completions } from "./types"; import type BufferCommandHelper from "./BufferCommandHelper"; class BufferDeleteCommand implements Command { diff --git a/src/background/command/BufferDeletesCommand.ts b/src/background/command/BufferDeletesCommand.ts index 161720b9..a76f6ecd 100644 --- a/src/background/command/BufferDeletesCommand.ts +++ b/src/background/command/BufferDeletesCommand.ts @@ -1,6 +1,4 @@ -import type Command from "./Command"; -import type { CommandContext } from "./Command"; -import type { Completions } from "./Command"; +import type { Command, CommandContext, Completions } from "./types"; import type BufferCommandHelper from "./BufferCommandHelper"; class BDeletesCommand implements Command { diff --git a/src/background/command/CommandRegistry.ts b/src/background/command/CommandRegistry.ts index 5b533e1d..5dd59e13 100644 --- a/src/background/command/CommandRegistry.ts +++ b/src/background/command/CommandRegistry.ts @@ -1,6 +1,6 @@ -import Command from "./Command"; +import type { Command } from "./types"; -export default interface CommandRegistry { +export interface CommandRegistry { register(cmd: Command): void; getCommand(name: string): Command | undefined; diff --git a/src/background/command/HelpCommand.ts b/src/background/command/HelpCommand.ts index db521f59..692954f6 100644 --- a/src/background/command/HelpCommand.ts +++ b/src/background/command/HelpCommand.ts @@ -1,6 +1,4 @@ -import type Command from "./Command"; -import type { CommandContext } from "./Command"; -import type { Completions } from "./Command"; +import type { Command, CommandContext, Completions } from "./types"; const url = "https://ueokande.github.io/vimmatic/"; diff --git a/src/background/command/OpenCommand.ts b/src/background/command/OpenCommand.ts index 36f1c488..b3dbccef 100644 --- a/src/background/command/OpenCommand.ts +++ b/src/background/command/OpenCommand.ts @@ -1,8 +1,7 @@ -import type Command from "./Command"; -import type { CommandContext, Completions } from "./Command"; +import type { Command, CommandContext, Completions } from "./types"; import * as urls from "../../shared/urls"; -import type SearchEngineSettings from "../settings/SearchEngineSettings"; -import type PropertySettings from "../settings/PropertySettings"; +import type { SearchEngineSettings } from "../settings/SearchEngineSettings"; +import type { PropertySettings } from "../settings/PropertySettings"; import OpenCommandHelper from "./OpenCommandHelper"; class OpenCommand implements Command { diff --git a/src/background/command/OpenCommandHelper.ts b/src/background/command/OpenCommandHelper.ts index af88dcd4..73eeb839 100644 --- a/src/background/command/OpenCommandHelper.ts +++ b/src/background/command/OpenCommandHelper.ts @@ -1,7 +1,7 @@ -import type { Completions, CompletionItem } from "./Command"; +import type { Completions, CompletionItem } from "./types"; import * as filters from "./filters"; -import type SearchEngineSettings from "../settings/SearchEngineSettings"; -import type PropertySettings from "../settings/PropertySettings"; +import type { SearchEngineSettings } from "../settings/SearchEngineSettings"; +import type { PropertySettings } from "../settings/PropertySettings"; const COMPLETION_ITEM_LIMIT = 10; diff --git a/src/background/command/QuitAllCommand.ts b/src/background/command/QuitAllCommand.ts index 38418297..d6d9ae2c 100644 --- a/src/background/command/QuitAllCommand.ts +++ b/src/background/command/QuitAllCommand.ts @@ -1,5 +1,4 @@ -import type Command from "./Command"; -import type { CommandContext, Completions } from "./Command"; +import type { Command, CommandContext, Completions } from "./types"; class QuitAllCommand implements Command { names(): string[] { diff --git a/src/background/command/QuitCommand.ts b/src/background/command/QuitCommand.ts index 33119560..9b6a5963 100644 --- a/src/background/command/QuitCommand.ts +++ b/src/background/command/QuitCommand.ts @@ -1,5 +1,4 @@ -import type Command from "./Command"; -import type { CommandContext, Completions } from "./Command"; +import type { Completions, Command, CommandContext } from "./types"; class QuitCommand implements Command { names(): string[] { diff --git a/src/background/command/SetCommand.ts b/src/background/command/SetCommand.ts index 7a3e5c28..d03bd721 100644 --- a/src/background/command/SetCommand.ts +++ b/src/background/command/SetCommand.ts @@ -1,8 +1,7 @@ -import type Command from "./Command"; -import type { CommandContext, Completions } from "./Command"; -import type PropertySettings from "../settings/PropertySettings"; -import type PropertyRegistry from "../property/PropertyRegistry"; -import type ConsoleClient from "../clients/ConsoleClient"; +import type { Command, CommandContext, Completions } from "./types"; +import type { PropertySettings } from "../settings/PropertySettings"; +import type { PropertyRegistry } from "../property/PropertyRegistry"; +import type { ConsoleClient } from "../clients/ConsoleClient"; const mustNumber = (v: any): number => { const num = Number(v); diff --git a/src/background/command/TabOpenCommand.ts b/src/background/command/TabOpenCommand.ts index a878d4dc..c22087cf 100644 --- a/src/background/command/TabOpenCommand.ts +++ b/src/background/command/TabOpenCommand.ts @@ -1,8 +1,7 @@ -import type Command from "./Command"; -import type { CommandContext, Completions } from "./Command"; +import type { Command, CommandContext, Completions } from "./types"; import * as urls from "../../shared/urls"; -import type SearchEngineSettings from "../settings/SearchEngineSettings"; -import type PropertySettings from "../settings/PropertySettings"; +import type { SearchEngineSettings } from "../settings/SearchEngineSettings"; +import type { PropertySettings } from "../settings/PropertySettings"; import OpenCommandHelper from "./OpenCommandHelper"; class TabOpenCommand implements Command { diff --git a/src/background/command/WindowOpenCommand.ts b/src/background/command/WindowOpenCommand.ts index 0dd74aef..188c9a35 100644 --- a/src/background/command/WindowOpenCommand.ts +++ b/src/background/command/WindowOpenCommand.ts @@ -1,8 +1,7 @@ -import type Command from "./Command"; -import type { CommandContext, Completions } from "./Command"; +import type { Completions, Command, CommandContext } from "./types"; import * as urls from "../../shared/urls"; -import type SearchEngineSettings from "../settings/SearchEngineSettings"; -import type PropertySettings from "../settings/PropertySettings"; +import type { SearchEngineSettings } from "../settings/SearchEngineSettings"; +import type { PropertySettings } from "../settings/PropertySettings"; import OpenCommandHelper from "./OpenCommandHelper"; class WindowOpenCommand implements Command { diff --git a/src/background/command/index.ts b/src/background/command/index.ts index 22be6d61..b1693eb8 100644 --- a/src/background/command/index.ts +++ b/src/background/command/index.ts @@ -11,12 +11,12 @@ import SetCommand from "./SetCommand"; import TabOpenCommand from "./TabOpenCommand"; import WindowOpenCommand from "./WindowOpenCommand"; import BufferCommandHelper from "./BufferCommandHelper"; -import PropertyRegistry from "../property/PropertyRegistry"; -import PropertySettings from "../settings/PropertySettings"; -import SearchEngineSettings from "../settings/SearchEngineSettings"; -import CommandRegistry, { CommandRegistryImpl } from "./CommandRegistry"; -import LastSelectedTabRepository from "../repositories/LastSelectedTabRepository"; -import ConsoleClient from "../clients/ConsoleClient"; +import type { PropertyRegistry } from "../property/PropertyRegistry"; +import type { PropertySettings } from "../settings/PropertySettings"; +import type { SearchEngineSettings } from "../settings/SearchEngineSettings"; +import { type CommandRegistry, CommandRegistryImpl } from "./CommandRegistry"; +import type { LastSelectedTabRepository } from "../repositories/LastSelectedTabRepository"; +import type { ConsoleClient } from "../clients/ConsoleClient"; @injectable() export class CommandRegistryFactory { diff --git a/src/background/command/Command.ts b/src/background/command/types.ts similarity index 88% rename from src/background/command/Command.ts rename to src/background/command/types.ts index 99c012b8..ff82f057 100644 --- a/src/background/command/Command.ts +++ b/src/background/command/types.ts @@ -2,7 +2,7 @@ import type { Completions as CompletionsType, CompletionGroup as CompletionGroupType, CompletionItem as CompletionItemType, -} from "../../shared/Completions"; +} from "../../shared/completions"; export type Completions = CompletionsType; export type CompletionGroup = CompletionGroupType; @@ -16,7 +16,7 @@ export type CommandContext = { }; }; -interface Command { +export interface Command { names(): string[]; fullname(): string; @@ -27,5 +27,3 @@ interface Command { exec(ctx: CommandContext, force: boolean, args: string): Promise; } - -export default Command; diff --git a/src/background/controllers/CommandController.ts b/src/background/controllers/CommandController.ts index 8934e9d5..b0ea7275 100644 --- a/src/background/controllers/CommandController.ts +++ b/src/background/controllers/CommandController.ts @@ -1,7 +1,7 @@ import { injectable, inject } from "inversify"; -import { Completions } from "../../shared/Completions"; +import type { Completions } from "../../shared/completions"; import CommandUseCase from "../usecases/CommandUseCase"; -import RequestContext from "../messaging/RequestContext"; +import type { RequestContext } from "../messaging/types"; @injectable() export default class CommandController { diff --git a/src/background/controllers/ConsoleController.ts b/src/background/controllers/ConsoleController.ts index cec3c4bf..a71c956a 100644 --- a/src/background/controllers/ConsoleController.ts +++ b/src/background/controllers/ConsoleController.ts @@ -1,6 +1,6 @@ import { injectable, inject } from "inversify"; import ConsoleUseCase from "../usecases/ConsoleUseCase"; -import RequestContext from "../messaging/RequestContext"; +import type { RequestContext } from "../messaging/types"; @injectable() export default class ConsoleController { diff --git a/src/background/controllers/FindController.ts b/src/background/controllers/FindController.ts index 8fa26b53..20faa196 100644 --- a/src/background/controllers/FindController.ts +++ b/src/background/controllers/FindController.ts @@ -1,7 +1,7 @@ import { injectable, inject } from "inversify"; -import { Completions } from "../../shared/Completions"; +import type { Completions } from "../../shared/completions"; import FindUseCase from "../usecases/FindUseCase"; -import RequestContext from "../messaging/RequestContext"; +import type { RequestContext } from "../messaging/types"; @injectable() export default class FindController { diff --git a/src/background/controllers/KeyController.ts b/src/background/controllers/KeyController.ts index 6918a52d..0633288f 100644 --- a/src/background/controllers/KeyController.ts +++ b/src/background/controllers/KeyController.ts @@ -1,5 +1,5 @@ import { injectable, inject } from "inversify"; -import RequestContext from "../messaging/RequestContext"; +import type { RequestContext } from "../messaging/types"; import MarkJumpUseCase from "../usecases/MarkJumpUseCase"; import MarkSetUseCase from "../usecases/MarkSetUseCase"; import HintModeUseCaes from "../usecases/HintModeUseCase"; diff --git a/src/background/controllers/OperationController.ts b/src/background/controllers/OperationController.ts index c343eb14..e029f50a 100644 --- a/src/background/controllers/OperationController.ts +++ b/src/background/controllers/OperationController.ts @@ -1,7 +1,7 @@ import { inject, injectable } from "inversify"; -import type Operation from "../../shared/Operation"; +import type { Operation } from "../../shared/operation"; +import type { RequestContext } from "../messaging/types"; import OperationUseCase from "../usecases/OperationUseCase"; -import RequestContext from "../messaging/RequestContext"; @injectable() export default class OperationController { diff --git a/src/background/controllers/SettingsController.ts b/src/background/controllers/SettingsController.ts index 6a25990f..65703cd7 100644 --- a/src/background/controllers/SettingsController.ts +++ b/src/background/controllers/SettingsController.ts @@ -1,6 +1,6 @@ import { injectable, inject } from "inversify"; import SettingsUseCase from "../usecases/SettingsUseCase"; -import RequestContext from "../messaging/RequestContext"; +import type { RequestContext } from "../messaging/types"; @injectable() export default class SettingsController { diff --git a/src/background/db/LocalStorage.ts b/src/background/db/LocalStorage.ts index ccbc2a7c..dd921c72 100644 --- a/src/background/db/LocalStorage.ts +++ b/src/background/db/LocalStorage.ts @@ -1,4 +1,4 @@ -export default interface LocalCache { +export interface LocalCache { setValue(value: T): Promise; getValue(): Promise; diff --git a/src/background/di.ts b/src/background/di.ts index ca86c7c2..90279a5e 100644 --- a/src/background/di.ts +++ b/src/background/di.ts @@ -38,7 +38,7 @@ import { AddonEnabledRepositoryImpl } from "./repositories/AddonEnabledRepositor import { AddonEnabledClientImpl } from "./clients/AddonEnabledClient"; import { ToolbarPresenterImpl } from "./presenters/ToolbarPresenter"; import { TabPresenterImpl } from "./presenters/TabPresenter"; -import { PropertyRegistryFactry } from "./property"; +import { createPropertyRegistry } from "./property"; import { CommandRegistryFactory } from "./command"; import { OperatorRegistoryFactory } from "./operators"; import { HintActionFactoryImpl } from "./hint/HintActionFactory"; @@ -84,9 +84,7 @@ container.bind("TabPresenter").to(TabPresenterImpl); container.bind("PermanentSettingsRepository").to(PermanentSettingsRepository); container.bind("SettingsRepository").to(TransientSettingsRepository); container.bind("HintActionFactory").to(HintActionFactoryImpl); -container - .bind("PropertyRegistry") - .toConstantValue(new PropertyRegistryFactry().create()); +container.bind("PropertyRegistry").toConstantValue(createPropertyRegistry()); container .bind("CommandRegistry") .toConstantValue(container.resolve(CommandRegistryFactory).create()); diff --git a/src/background/domains/GlobalMark.ts b/src/background/domains/GlobalMark.ts deleted file mode 100644 index b3fa26a1..00000000 --- a/src/background/domains/GlobalMark.ts +++ /dev/null @@ -1,6 +0,0 @@ -export default interface GlobalMark { - readonly tabId: number; - readonly url: string; - readonly x: number; - readonly y: number; -} diff --git a/src/background/domains/LocalMark.ts b/src/background/domains/LocalMark.ts deleted file mode 100644 index 58b186cd..00000000 --- a/src/background/domains/LocalMark.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default interface GlobalMark { - readonly x: number; - readonly y: number; -} diff --git a/src/background/hint/HintActionFactory.ts b/src/background/hint/HintActionFactory.ts index 3f0e7c71..8244abf0 100644 --- a/src/background/hint/HintActionFactory.ts +++ b/src/background/hint/HintActionFactory.ts @@ -1,5 +1,4 @@ import { injectable, inject } from "inversify"; -import type HintAction from "./HintAction"; import QuickHintAction from "./QuickHintAction"; import OpenImageHintAction from "./OpenImageHintAction"; import YankURLHintAction from "./YankURLHintAction"; @@ -11,8 +10,9 @@ import OpenCommandHintAction from "./OpenCommandHintAction"; import TabopenCommandHintAction from "./TabopenCommandHintAction"; import WinopenCommandHintAction from "./WinopenCommandHintAction"; import OpenSourceHintAction from "./OpenSourceHintAction"; +import type { HintAction } from "./types"; -export default interface HintActionFactory { +export interface HintActionFactory { createHintAction(name: string): HintAction; } diff --git a/src/background/hint/HintTarget.ts b/src/background/hint/HintTarget.ts deleted file mode 100644 index eea795d9..00000000 --- a/src/background/hint/HintTarget.ts +++ /dev/null @@ -1,7 +0,0 @@ -type HintTarget = { - frameId: number; - element: string; - tag: string; -}; - -export default HintTarget; diff --git a/src/background/hint/OpenCommandHintAction.ts b/src/background/hint/OpenCommandHintAction.ts index e4955da2..37ad17e1 100644 --- a/src/background/hint/OpenCommandHintAction.ts +++ b/src/background/hint/OpenCommandHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type ConsoleClient from "../clients/ConsoleClient"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { ConsoleClient } from "../clients/ConsoleClient"; @injectable() export default class OpenCommandHintAction implements HintAction { diff --git a/src/background/hint/OpenHintAction.ts b/src/background/hint/OpenHintAction.ts index dc12fd08..e579d34d 100644 --- a/src/background/hint/OpenHintAction.ts +++ b/src/background/hint/OpenHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type TabPresenter from "../presenters/TabPresenter"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { TabPresenter } from "../presenters/TabPresenter"; @injectable() export default class OpenHintAction implements HintAction { diff --git a/src/background/hint/OpenImageHintAction.ts b/src/background/hint/OpenImageHintAction.ts index c3e5cb0e..c46893c3 100644 --- a/src/background/hint/OpenImageHintAction.ts +++ b/src/background/hint/OpenImageHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type TabPresenter from "../presenters/TabPresenter"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { TabPresenter } from "../presenters/TabPresenter"; @injectable() export default class OpenImageHintAction implements HintAction { diff --git a/src/background/hint/OpenSourceHintAction.ts b/src/background/hint/OpenSourceHintAction.ts index f1caf32d..4ac1c612 100644 --- a/src/background/hint/OpenSourceHintAction.ts +++ b/src/background/hint/OpenSourceHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type TabPresenter from "../presenters/TabPresenter"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { TabPresenter } from "../presenters/TabPresenter"; @injectable() export default class OpenSourceHintAction implements HintAction { diff --git a/src/background/hint/QuickHintAction.ts b/src/background/hint/QuickHintAction.ts index 2601017d..25ec3d99 100644 --- a/src/background/hint/QuickHintAction.ts +++ b/src/background/hint/QuickHintAction.ts @@ -1,9 +1,8 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type HTMLElementType from "../../shared/HTMLElementType"; -import type TabPresenter from "../presenters/TabPresenter"; +import type { HintClient } from "../clients/HintClient"; +import type { HTMLElementType } from "../../shared/HTMLElementType"; +import type { TabPresenter } from "../presenters/TabPresenter"; +import type { HintTarget, HintAction } from "./types"; @injectable() export default class QuickHintAction implements HintAction { diff --git a/src/background/hint/TabopenCommandHintAction.ts b/src/background/hint/TabopenCommandHintAction.ts index 43999610..6347e84a 100644 --- a/src/background/hint/TabopenCommandHintAction.ts +++ b/src/background/hint/TabopenCommandHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type ConsoleClient from "../clients/ConsoleClient"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { ConsoleClient } from "../clients/ConsoleClient"; @injectable() export default class TabopenCommandHintAction implements HintAction { diff --git a/src/background/hint/TabopenHintAction.ts b/src/background/hint/TabopenHintAction.ts index 1335f93d..296f5d75 100644 --- a/src/background/hint/TabopenHintAction.ts +++ b/src/background/hint/TabopenHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type TabPresenter from "../presenters/TabPresenter"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { TabPresenter } from "../presenters/TabPresenter"; @injectable() export default class TabopenHintAction implements HintAction { diff --git a/src/background/hint/WinopenCommandHintAction.ts b/src/background/hint/WinopenCommandHintAction.ts index c8cbd8b5..c58982b5 100644 --- a/src/background/hint/WinopenCommandHintAction.ts +++ b/src/background/hint/WinopenCommandHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type ConsoleClient from "../clients/ConsoleClient"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { ConsoleClient } from "../clients/ConsoleClient"; @injectable() export default class WinopenCommandHintAction implements HintAction { diff --git a/src/background/hint/WinopenHintAction.ts b/src/background/hint/WinopenHintAction.ts index fab47dec..af8e3b1e 100644 --- a/src/background/hint/WinopenHintAction.ts +++ b/src/background/hint/WinopenHintAction.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type TabPresenter from "../presenters/TabPresenter"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { TabPresenter } from "../presenters/TabPresenter"; @injectable() export default class WinopenHintAction implements HintAction { diff --git a/src/background/hint/YankLinkTextHintAction.ts b/src/background/hint/YankLinkTextHintAction.ts index e00f5c14..7ea0562b 100644 --- a/src/background/hint/YankLinkTextHintAction.ts +++ b/src/background/hint/YankLinkTextHintAction.ts @@ -1,9 +1,8 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type ClipboardRepository from "../repositories/ClipboardRepository"; -import type ConsoleClient from "../clients/ConsoleClient"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { ClipboardRepository } from "../repositories/ClipboardRepository"; +import type { ConsoleClient } from "../clients/ConsoleClient"; @injectable() export default class YankLinkTextHintAction implements HintAction { diff --git a/src/background/hint/YankURLHintAction.ts b/src/background/hint/YankURLHintAction.ts index b1bc04d6..04f55931 100644 --- a/src/background/hint/YankURLHintAction.ts +++ b/src/background/hint/YankURLHintAction.ts @@ -1,9 +1,8 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "./HintTarget"; -import type HintAction from "./HintAction"; -import type ClipboardRepository from "../repositories/ClipboardRepository"; -import type ConsoleClient from "../clients/ConsoleClient"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget, HintAction } from "./types"; +import type { ClipboardRepository } from "../repositories/ClipboardRepository"; +import type { ConsoleClient } from "../clients/ConsoleClient"; @injectable() export default class YankUrlHintAction implements HintAction { diff --git a/src/background/hint/HintAction.ts b/src/background/hint/types.ts similarity index 59% rename from src/background/hint/HintAction.ts rename to src/background/hint/types.ts index 46820d8c..102ac429 100644 --- a/src/background/hint/HintAction.ts +++ b/src/background/hint/types.ts @@ -1,6 +1,10 @@ -import type HintTarget from "./HintTarget"; +export type HintTarget = { + frameId: number; + element: string; + tag: string; +}; -interface HintAction { +export interface HintAction { lookupTargetSelector(): string; activate( @@ -9,5 +13,3 @@ interface HintAction { opts: { newTab: boolean; background: boolean }, ): Promise; } - -export default HintAction; diff --git a/src/background/messaging/BackgroundMessageListener.ts b/src/background/messaging/BackgroundMessageListener.ts index a648cf1a..3963d180 100644 --- a/src/background/messaging/BackgroundMessageListener.ts +++ b/src/background/messaging/BackgroundMessageListener.ts @@ -5,10 +5,10 @@ import OperationController from "../controllers/OperationController"; import KeyController from "../controllers/KeyController"; import ConsoleController from "../controllers/ConsoleController"; import FindController from "../controllers/FindController"; -import ConsoleClient from "../clients/ConsoleClient"; +import type { ConsoleClient } from "../clients/ConsoleClient"; import { ReceiverWithContext } from "../../messaging"; import type { Schema } from "../../messaging/schema/background"; -import RequestContext from "./RequestContext"; +import type { RequestContext } from "./types"; @injectable() export default class BackgroundMessageListener { diff --git a/src/background/messaging/RequestContext.ts b/src/background/messaging/RequestContext.ts deleted file mode 100644 index 785481c2..00000000 --- a/src/background/messaging/RequestContext.ts +++ /dev/null @@ -1,5 +0,0 @@ -type RequestContext = { - sender: chrome.runtime.MessageSender; -}; - -export default RequestContext; diff --git a/src/background/messaging/types.ts b/src/background/messaging/types.ts new file mode 100644 index 00000000..279d7e27 --- /dev/null +++ b/src/background/messaging/types.ts @@ -0,0 +1,3 @@ +export interface RequestContext { + sender: chrome.runtime.MessageSender; +} diff --git a/src/background/operators/OperatorRegistory.ts b/src/background/operators/OperatorRegistory.ts index f307a7ed..de3e98cb 100644 --- a/src/background/operators/OperatorRegistory.ts +++ b/src/background/operators/OperatorRegistory.ts @@ -1,6 +1,6 @@ -import Operator from "./Operator"; +import type { Operator } from "./types"; -export default interface OperatorRegistory { +export interface OperatorRegistory { register(op: Operator): void; getOperator(name: string): Operator | undefined; diff --git a/src/background/operators/impls/CancelOperator.ts b/src/background/operators/impls/CancelOperator.ts index f807bac3..ee05cf89 100644 --- a/src/background/operators/impls/CancelOperator.ts +++ b/src/background/operators/impls/CancelOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class CancelOperator implements Operator { diff --git a/src/background/operators/impls/CloseTabOperator.ts b/src/background/operators/impls/CloseTabOperator.ts index 44aea75c..604fff2f 100644 --- a/src/background/operators/impls/CloseTabOperator.ts +++ b/src/background/operators/impls/CloseTabOperator.ts @@ -1,7 +1,6 @@ import { injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; @injectable() export default class CloseTabOperator implements Operator { diff --git a/src/background/operators/impls/CloseTabRightOperator.ts b/src/background/operators/impls/CloseTabRightOperator.ts index e46e181e..77a05fec 100644 --- a/src/background/operators/impls/CloseTabRightOperator.ts +++ b/src/background/operators/impls/CloseTabRightOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class CloseTabRightOperator implements Operator { diff --git a/src/background/operators/impls/DisableAddonOperator.ts b/src/background/operators/impls/DisableAddonOperator.ts index 651c0a57..abceca39 100644 --- a/src/background/operators/impls/DisableAddonOperator.ts +++ b/src/background/operators/impls/DisableAddonOperator.ts @@ -1,5 +1,5 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; import AddonEnabledUseCase from "../../usecases/AddonEnabledUseCase"; @injectable() diff --git a/src/background/operators/impls/DuplicateTabOperator.ts b/src/background/operators/impls/DuplicateTabOperator.ts index 0c759e1c..be8b92f6 100644 --- a/src/background/operators/impls/DuplicateTabOperator.ts +++ b/src/background/operators/impls/DuplicateTabOperator.ts @@ -1,6 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; @injectable() export default class DuplicateTabOperator implements Operator { diff --git a/src/background/operators/impls/EnableAddonOperator.ts b/src/background/operators/impls/EnableAddonOperator.ts index 4826c14e..d90c2d52 100644 --- a/src/background/operators/impls/EnableAddonOperator.ts +++ b/src/background/operators/impls/EnableAddonOperator.ts @@ -1,5 +1,5 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; import AddonEnabledUseCase from "../../usecases/AddonEnabledUseCase"; @injectable() diff --git a/src/background/operators/impls/FindNextOperator.ts b/src/background/operators/impls/FindNextOperator.ts index e35e023b..30e2eac5 100644 --- a/src/background/operators/impls/FindNextOperator.ts +++ b/src/background/operators/impls/FindNextOperator.ts @@ -1,6 +1,5 @@ import { inject, injectable } from "inversify"; -import type Operator from "../Operator"; -import type { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import FindUseCase from "../../usecases/FindUseCase"; @injectable() diff --git a/src/background/operators/impls/FindPrevOperator.ts b/src/background/operators/impls/FindPrevOperator.ts index 81a78cbf..71d64f42 100644 --- a/src/background/operators/impls/FindPrevOperator.ts +++ b/src/background/operators/impls/FindPrevOperator.ts @@ -1,6 +1,5 @@ import { inject, injectable } from "inversify"; -import type Operator from "../Operator"; -import type { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import FindUseCase from "../../usecases/FindUseCase"; @injectable() diff --git a/src/background/operators/impls/FocusOperator.ts b/src/background/operators/impls/FocusOperator.ts index 10c0db7a..181db751 100644 --- a/src/background/operators/impls/FocusOperator.ts +++ b/src/background/operators/impls/FocusOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; @injectable() export default class CancelOperator implements Operator { diff --git a/src/background/operators/impls/HorizontalScrollOperator.ts b/src/background/operators/impls/HorizontalScrollOperator.ts index dbe5281f..78a2b73c 100644 --- a/src/background/operators/impls/HorizontalScrollOperator.ts +++ b/src/background/operators/impls/HorizontalScrollOperator.ts @@ -1,9 +1,8 @@ import { injectable, inject } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; -import PropertySettings from "../../settings/PropertySettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; +import type { PropertySettings } from "../../settings/PropertySettings"; @injectable() export default class HorizontalScrollOperator implements Operator { diff --git a/src/background/operators/impls/NavigateHistoryNextOperator.ts b/src/background/operators/impls/NavigateHistoryNextOperator.ts index 38e68902..ebda0f4e 100644 --- a/src/background/operators/impls/NavigateHistoryNextOperator.ts +++ b/src/background/operators/impls/NavigateHistoryNextOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import NavigateClient from "../../clients/NavigateClient"; +import type { Operator, OperatorContext } from "../types"; +import type { NavigateClient } from "../../clients/NavigateClient"; @injectable() export default class NavigateHistoryNextOperator implements Operator { diff --git a/src/background/operators/impls/NavigateHistoryPrevOperator.ts b/src/background/operators/impls/NavigateHistoryPrevOperator.ts index dbb92971..72f6def3 100644 --- a/src/background/operators/impls/NavigateHistoryPrevOperator.ts +++ b/src/background/operators/impls/NavigateHistoryPrevOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import NavigateClient from "../../clients/NavigateClient"; +import type { Operator, OperatorContext } from "../types"; +import type { NavigateClient } from "../../clients/NavigateClient"; @injectable() export default class NavigateHistoryPrevOperator implements Operator { diff --git a/src/background/operators/impls/NavigateLinkNextOperator.ts b/src/background/operators/impls/NavigateLinkNextOperator.ts index 0de13e7f..3b0d243d 100644 --- a/src/background/operators/impls/NavigateLinkNextOperator.ts +++ b/src/background/operators/impls/NavigateLinkNextOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import NavigateClient from "../../clients/NavigateClient"; +import type { Operator, OperatorContext } from "../types"; +import type { NavigateClient } from "../../clients/NavigateClient"; @injectable() export default class NavigateLinkNextOperator implements Operator { diff --git a/src/background/operators/impls/NavigateLinkPrevOperator.ts b/src/background/operators/impls/NavigateLinkPrevOperator.ts index 7e5fef99..12274947 100644 --- a/src/background/operators/impls/NavigateLinkPrevOperator.ts +++ b/src/background/operators/impls/NavigateLinkPrevOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import NavigateClient from "../../clients/NavigateClient"; +import type { Operator, OperatorContext } from "../types"; +import type { NavigateClient } from "../../clients/NavigateClient"; @injectable() export default class NavigateLinkPrevOperator implements Operator { diff --git a/src/background/operators/impls/NavigateParentOperator.ts b/src/background/operators/impls/NavigateParentOperator.ts index c4fcfc24..b719b038 100644 --- a/src/background/operators/impls/NavigateParentOperator.ts +++ b/src/background/operators/impls/NavigateParentOperator.ts @@ -1,6 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; @injectable() export default class NavigateParentOperator implements Operator { diff --git a/src/background/operators/impls/NavigateRootOperator.ts b/src/background/operators/impls/NavigateRootOperator.ts index 73518796..28947576 100644 --- a/src/background/operators/impls/NavigateRootOperator.ts +++ b/src/background/operators/impls/NavigateRootOperator.ts @@ -1,6 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; @injectable() export default class NavigateRootOperator implements Operator { diff --git a/src/background/operators/impls/OpenCommandHintOperator.ts b/src/background/operators/impls/OpenCommandHintOperator.ts index 0d9d40ca..f13e3db3 100644 --- a/src/background/operators/impls/OpenCommandHintOperator.ts +++ b/src/background/operators/impls/OpenCommandHintOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class OpenCommandHintOperator implements Operator { diff --git a/src/background/operators/impls/OpenHintOperator.ts b/src/background/operators/impls/OpenHintOperator.ts index 61b1e8fb..a2194390 100644 --- a/src/background/operators/impls/OpenHintOperator.ts +++ b/src/background/operators/impls/OpenHintOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class OpenHintOperator implements Operator { diff --git a/src/background/operators/impls/OpenHomeOperator.ts b/src/background/operators/impls/OpenHomeOperator.ts index 4e6810a2..d1ca981c 100644 --- a/src/background/operators/impls/OpenHomeOperator.ts +++ b/src/background/operators/impls/OpenHomeOperator.ts @@ -1,8 +1,7 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import BrowserSettingRepository from "../../repositories/BrowserSettingRepository"; +import type { Operator, OperatorContext } from "../types"; +import type { BrowserSettingRepository } from "../../repositories/BrowserSettingRepository"; @injectable() export default class OpenHomeOperator implements Operator { diff --git a/src/background/operators/impls/OpenImageHintOperator.ts b/src/background/operators/impls/OpenImageHintOperator.ts index f191d913..b4804d7d 100644 --- a/src/background/operators/impls/OpenImageHintOperator.ts +++ b/src/background/operators/impls/OpenImageHintOperator.ts @@ -1,10 +1,9 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class OpenImageHintOperator implements Operator { diff --git a/src/background/operators/impls/OpenSourceHintOperator.ts b/src/background/operators/impls/OpenSourceHintOperator.ts index 99819ca0..35555b8c 100644 --- a/src/background/operators/impls/OpenSourceHintOperator.ts +++ b/src/background/operators/impls/OpenSourceHintOperator.ts @@ -1,10 +1,9 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class OpenSourceHintOperator implements Operator { diff --git a/src/background/operators/impls/OpenSourceOperator.ts b/src/background/operators/impls/OpenSourceOperator.ts index 5e0df779..81b5ce62 100644 --- a/src/background/operators/impls/OpenSourceOperator.ts +++ b/src/background/operators/impls/OpenSourceOperator.ts @@ -1,6 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; @injectable() export default class OpenSourceOperator implements Operator { diff --git a/src/background/operators/impls/PageScrollOperator.ts b/src/background/operators/impls/PageScrollOperator.ts index 387736e4..5bc28b93 100644 --- a/src/background/operators/impls/PageScrollOperator.ts +++ b/src/background/operators/impls/PageScrollOperator.ts @@ -1,9 +1,8 @@ import { injectable, inject } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; -import PropertySettings from "../../settings/PropertySettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; +import type { PropertySettings } from "../../settings/PropertySettings"; @injectable() export default class PageScrollOperator implements Operator { diff --git a/src/background/operators/impls/PasteOperator.ts b/src/background/operators/impls/PasteOperator.ts index 355c7e39..b48ee042 100644 --- a/src/background/operators/impls/PasteOperator.ts +++ b/src/background/operators/impls/PasteOperator.ts @@ -1,9 +1,8 @@ import { injectable, inject } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ClipboardRepository from "../../repositories/ClipboardRepository"; -import SearchEngineSettings from "../../settings/SearchEngineSettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ClipboardRepository } from "../../repositories/ClipboardRepository"; +import type { SearchEngineSettings } from "../../settings/SearchEngineSettings"; import * as urls from "../../../shared/urls"; @injectable() diff --git a/src/background/operators/impls/PinTabOperator.ts b/src/background/operators/impls/PinTabOperator.ts index 3364c0ee..df1bf7aa 100644 --- a/src/background/operators/impls/PinTabOperator.ts +++ b/src/background/operators/impls/PinTabOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class PinTabOperator implements Operator { diff --git a/src/background/operators/impls/QuickHintOperator.ts b/src/background/operators/impls/QuickHintOperator.ts index b8495f56..4a47853f 100644 --- a/src/background/operators/impls/QuickHintOperator.ts +++ b/src/background/operators/impls/QuickHintOperator.ts @@ -1,10 +1,9 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class QuickHintOperator implements Operator { diff --git a/src/background/operators/impls/ReloadTabOperator.ts b/src/background/operators/impls/ReloadTabOperator.ts index 829ecaa1..46515db7 100644 --- a/src/background/operators/impls/ReloadTabOperator.ts +++ b/src/background/operators/impls/ReloadTabOperator.ts @@ -1,7 +1,6 @@ import { injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; @injectable() export default class ReloadTabOperator implements Operator { diff --git a/src/background/operators/impls/ReopenTabOperator.ts b/src/background/operators/impls/ReopenTabOperator.ts index e7fa36b3..190bd115 100644 --- a/src/background/operators/impls/ReopenTabOperator.ts +++ b/src/background/operators/impls/ReopenTabOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class ReopenTabOperator implements Operator { diff --git a/src/background/operators/impls/RepeatLastOperator.ts b/src/background/operators/impls/RepeatLastOperator.ts index 6ecaf503..d8130817 100644 --- a/src/background/operators/impls/RepeatLastOperator.ts +++ b/src/background/operators/impls/RepeatLastOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import RepeatRepository from "../../repositories/RepeatRepository"; -import OperatorRegistory from "../../operators/OperatorRegistory"; +import type { Operator, OperatorContext } from "../types"; +import type { RepeatRepository } from "../../repositories/RepeatRepository"; +import type { OperatorRegistory } from "../../operators/OperatorRegistory"; @injectable() export default class RepeatLastOperator implements Operator { diff --git a/src/background/operators/impls/ScrollToBottomOperator.ts b/src/background/operators/impls/ScrollToBottomOperator.ts index 5138c91c..59da8ab0 100644 --- a/src/background/operators/impls/ScrollToBottomOperator.ts +++ b/src/background/operators/impls/ScrollToBottomOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; -import PropertySettings from "../../settings/PropertySettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; +import type { PropertySettings } from "../../settings/PropertySettings"; @injectable() export default class ScrollToBottomOperator implements Operator { diff --git a/src/background/operators/impls/ScrollToEndOperator.ts b/src/background/operators/impls/ScrollToEndOperator.ts index c4deb154..94b28760 100644 --- a/src/background/operators/impls/ScrollToEndOperator.ts +++ b/src/background/operators/impls/ScrollToEndOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; -import PropertySettings from "../../settings/PropertySettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; +import type { PropertySettings } from "../../settings/PropertySettings"; @injectable() export default class ScrollToEndOperator implements Operator { diff --git a/src/background/operators/impls/ScrollToHomeOperator.ts b/src/background/operators/impls/ScrollToHomeOperator.ts index 4b752ede..cceb339e 100644 --- a/src/background/operators/impls/ScrollToHomeOperator.ts +++ b/src/background/operators/impls/ScrollToHomeOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; -import PropertySettings from "../../settings/PropertySettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; +import type { PropertySettings } from "../../settings/PropertySettings"; @injectable() export default class ScrollToHomeOperator implements Operator { diff --git a/src/background/operators/impls/ScrollToTopOperator.ts b/src/background/operators/impls/ScrollToTopOperator.ts index 51d562c8..271090ee 100644 --- a/src/background/operators/impls/ScrollToTopOperator.ts +++ b/src/background/operators/impls/ScrollToTopOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; -import PropertySettings from "../../settings/PropertySettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; +import type { PropertySettings } from "../../settings/PropertySettings"; @injectable() export default class ScrollToTopOperator implements Operator { diff --git a/src/background/operators/impls/SelectFirstTabOperator.ts b/src/background/operators/impls/SelectFirstTabOperator.ts index 5505fa38..67f87792 100644 --- a/src/background/operators/impls/SelectFirstTabOperator.ts +++ b/src/background/operators/impls/SelectFirstTabOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class SelectFirstTabOperator implements Operator { diff --git a/src/background/operators/impls/SelectLastTabOperator.ts b/src/background/operators/impls/SelectLastTabOperator.ts index 1f7f3cc3..f0bfd486 100644 --- a/src/background/operators/impls/SelectLastTabOperator.ts +++ b/src/background/operators/impls/SelectLastTabOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class SelectLastTabOperator implements Operator { diff --git a/src/background/operators/impls/SelectPreviousSelectedTabOperator.ts b/src/background/operators/impls/SelectPreviousSelectedTabOperator.ts index f3c68f53..02ee3ade 100644 --- a/src/background/operators/impls/SelectPreviousSelectedTabOperator.ts +++ b/src/background/operators/impls/SelectPreviousSelectedTabOperator.ts @@ -1,6 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import LastSelectedTabRepository from "../../repositories/LastSelectedTabRepository"; +import type { Operator } from "../types"; +import type { LastSelectedTabRepository } from "../../repositories/LastSelectedTabRepository"; @injectable() export default class SelectPreviousSelectedTabOperator implements Operator { diff --git a/src/background/operators/impls/SelectTabNextOperator.ts b/src/background/operators/impls/SelectTabNextOperator.ts index 5cb004b1..4d539b48 100644 --- a/src/background/operators/impls/SelectTabNextOperator.ts +++ b/src/background/operators/impls/SelectTabNextOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class SelectTabNextOperator implements Operator { diff --git a/src/background/operators/impls/SelectTabPrevOperator.ts b/src/background/operators/impls/SelectTabPrevOperator.ts index e59cf18c..7e64aec9 100644 --- a/src/background/operators/impls/SelectTabPrevOperator.ts +++ b/src/background/operators/impls/SelectTabPrevOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class SelectTabPrevOperator implements Operator { diff --git a/src/background/operators/impls/ShowAddBookmarkOperator.ts b/src/background/operators/impls/ShowAddBookmarkOperator.ts index 5d4282a8..9511b2f5 100644 --- a/src/background/operators/impls/ShowAddBookmarkOperator.ts +++ b/src/background/operators/impls/ShowAddBookmarkOperator.ts @@ -1,8 +1,7 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class ShowAddBookmarkOperator implements Operator { diff --git a/src/background/operators/impls/ShowBufferCommandOperator.ts b/src/background/operators/impls/ShowBufferCommandOperator.ts index ad5d4687..bd9ebf4b 100644 --- a/src/background/operators/impls/ShowBufferCommandOperator.ts +++ b/src/background/operators/impls/ShowBufferCommandOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class ShowBufferCommandOperator implements Operator { diff --git a/src/background/operators/impls/ShowCommandOperator.ts b/src/background/operators/impls/ShowCommandOperator.ts index e2bad9ca..88de3813 100644 --- a/src/background/operators/impls/ShowCommandOperator.ts +++ b/src/background/operators/impls/ShowCommandOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class ShowCommandOperator implements Operator { diff --git a/src/background/operators/impls/ShowOpenCommandOperator.ts b/src/background/operators/impls/ShowOpenCommandOperator.ts index cf68819c..6a49071c 100644 --- a/src/background/operators/impls/ShowOpenCommandOperator.ts +++ b/src/background/operators/impls/ShowOpenCommandOperator.ts @@ -1,8 +1,7 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class ShowOpenCommandOperator implements Operator { diff --git a/src/background/operators/impls/ShowTabOpenCommandOperator.ts b/src/background/operators/impls/ShowTabOpenCommandOperator.ts index 9beb4f92..006a97ca 100644 --- a/src/background/operators/impls/ShowTabOpenCommandOperator.ts +++ b/src/background/operators/impls/ShowTabOpenCommandOperator.ts @@ -1,8 +1,7 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class ShowTabOpenCommandOperator implements Operator { diff --git a/src/background/operators/impls/ShowWinOpenCommandOperator.ts b/src/background/operators/impls/ShowWinOpenCommandOperator.ts index f2dd5822..28fb6cd8 100644 --- a/src/background/operators/impls/ShowWinOpenCommandOperator.ts +++ b/src/background/operators/impls/ShowWinOpenCommandOperator.ts @@ -1,8 +1,7 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class ShowWinOpenCommandOperator implements Operator { diff --git a/src/background/operators/impls/StartFindOperator.ts b/src/background/operators/impls/StartFindOperator.ts index 0a39b09c..f5ef8410 100644 --- a/src/background/operators/impls/StartFindOperator.ts +++ b/src/background/operators/impls/StartFindOperator.ts @@ -1,7 +1,6 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class StartFindOperator implements Operator { diff --git a/src/background/operators/impls/StartJumpMarkOperator.ts b/src/background/operators/impls/StartJumpMarkOperator.ts index f7cd7bc2..8f57d7b9 100644 --- a/src/background/operators/impls/StartJumpMarkOperator.ts +++ b/src/background/operators/impls/StartJumpMarkOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class StartJumpMarkOperator implements Operator { diff --git a/src/background/operators/impls/StartSetMarkOperator.ts b/src/background/operators/impls/StartSetMarkOperator.ts index 425419a1..c462a16e 100644 --- a/src/background/operators/impls/StartSetMarkOperator.ts +++ b/src/background/operators/impls/StartSetMarkOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class StartSetMarkOperator implements Operator { diff --git a/src/background/operators/impls/TabopenCommandHintOperator.ts b/src/background/operators/impls/TabopenCommandHintOperator.ts index 1a839ecb..7a50101a 100644 --- a/src/background/operators/impls/TabopenCommandHintOperator.ts +++ b/src/background/operators/impls/TabopenCommandHintOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class TabopenCommandHintOperator implements Operator { diff --git a/src/background/operators/impls/TabopenHintOperator.ts b/src/background/operators/impls/TabopenHintOperator.ts index fea856f7..d4436e08 100644 --- a/src/background/operators/impls/TabopenHintOperator.ts +++ b/src/background/operators/impls/TabopenHintOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class TabopenHintOperator implements Operator { diff --git a/src/background/operators/impls/ToggleAddonOperator.ts b/src/background/operators/impls/ToggleAddonOperator.ts index debb5b27..bcf77b81 100644 --- a/src/background/operators/impls/ToggleAddonOperator.ts +++ b/src/background/operators/impls/ToggleAddonOperator.ts @@ -1,5 +1,5 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; import AddonEnabledUseCase from "../../usecases/AddonEnabledUseCase"; @injectable() diff --git a/src/background/operators/impls/TogglePinnedTabOperator.ts b/src/background/operators/impls/TogglePinnedTabOperator.ts index 647c3bb8..96164b8a 100644 --- a/src/background/operators/impls/TogglePinnedTabOperator.ts +++ b/src/background/operators/impls/TogglePinnedTabOperator.ts @@ -1,6 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; @injectable() export default class TogglePinnedTabOperator implements Operator { diff --git a/src/background/operators/impls/ToggleReaderOperator.ts b/src/background/operators/impls/ToggleReaderOperator.ts index 976bf947..7e8f8b1b 100644 --- a/src/background/operators/impls/ToggleReaderOperator.ts +++ b/src/background/operators/impls/ToggleReaderOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class ToggleReaderOperator implements Operator { diff --git a/src/background/operators/impls/UnpinTabOperator.ts b/src/background/operators/impls/UnpinTabOperator.ts index c81631f7..4848442c 100644 --- a/src/background/operators/impls/UnpinTabOperator.ts +++ b/src/background/operators/impls/UnpinTabOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class UnpinTabOperator implements Operator { diff --git a/src/background/operators/impls/VerticalScrollOperator.ts b/src/background/operators/impls/VerticalScrollOperator.ts index ac61e197..f62862be 100644 --- a/src/background/operators/impls/VerticalScrollOperator.ts +++ b/src/background/operators/impls/VerticalScrollOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; import { z } from "zod"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ContentMessageClient from "../../clients/ContentMessageClient"; -import PropertySettings from "../../settings/PropertySettings"; +import type { Operator, OperatorContext } from "../types"; +import type { ContentMessageClient } from "../../clients/ContentMessageClient"; +import type { PropertySettings } from "../../settings/PropertySettings"; @injectable() export default class VerticalScrollOperator implements Operator { diff --git a/src/background/operators/impls/WinopenCommandHintOperator.ts b/src/background/operators/impls/WinopenCommandHintOperator.ts index 35787f2a..e771cde6 100644 --- a/src/background/operators/impls/WinopenCommandHintOperator.ts +++ b/src/background/operators/impls/WinopenCommandHintOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class WinopenCommandHintOperator implements Operator { diff --git a/src/background/operators/impls/WinopenHintOperator.ts b/src/background/operators/impls/WinopenHintOperator.ts index 1c3b1bef..09147a06 100644 --- a/src/background/operators/impls/WinopenHintOperator.ts +++ b/src/background/operators/impls/WinopenHintOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class WinopenHintOperator implements Operator { diff --git a/src/background/operators/impls/YankLinkTextOperator.ts b/src/background/operators/impls/YankLinkTextOperator.ts index ff54dd0f..960da074 100644 --- a/src/background/operators/impls/YankLinkTextOperator.ts +++ b/src/background/operators/impls/YankLinkTextOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class YankLinkTextOperator implements Operator { diff --git a/src/background/operators/impls/YankOperator.ts b/src/background/operators/impls/YankOperator.ts index ded2af83..f1864b25 100644 --- a/src/background/operators/impls/YankOperator.ts +++ b/src/background/operators/impls/YankOperator.ts @@ -1,8 +1,7 @@ import { injectable, inject } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; -import ClipboardRepository from "../../repositories/ClipboardRepository"; -import ConsoleClient from "../../clients/ConsoleClient"; +import type { Operator, OperatorContext } from "../types"; +import type { ClipboardRepository } from "../../repositories/ClipboardRepository"; +import type { ConsoleClient } from "../../clients/ConsoleClient"; @injectable() export default class YankOperator implements Operator { diff --git a/src/background/operators/impls/YankURLHintOperator.ts b/src/background/operators/impls/YankURLHintOperator.ts index c9e74b7b..6a94811a 100644 --- a/src/background/operators/impls/YankURLHintOperator.ts +++ b/src/background/operators/impls/YankURLHintOperator.ts @@ -1,9 +1,8 @@ import { inject, injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import HintModeUseCase from "../../usecases/HintModeUseCase"; import ModeUseCase from "../../usecases/ModeUseCase"; -import Mode from "../../../shared/Mode"; +import { Mode } from "../../../shared/mode"; @injectable() export default class YankURLHintOperator implements Operator { diff --git a/src/background/operators/impls/ZoomInOperator.ts b/src/background/operators/impls/ZoomInOperator.ts index c4d6e6b3..1d9dac89 100644 --- a/src/background/operators/impls/ZoomInOperator.ts +++ b/src/background/operators/impls/ZoomInOperator.ts @@ -1,6 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import ZoomHelper from "./ZoomHelper"; @injectable() diff --git a/src/background/operators/impls/ZoomOutOperator.ts b/src/background/operators/impls/ZoomOutOperator.ts index 25211bfc..2156256a 100644 --- a/src/background/operators/impls/ZoomOutOperator.ts +++ b/src/background/operators/impls/ZoomOutOperator.ts @@ -1,6 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; -import { OperatorContext } from "../Operator"; +import type { Operator, OperatorContext } from "../types"; import ZoomHelper from "./ZoomHelper"; @injectable() diff --git a/src/background/operators/impls/ZoomResetOperator.ts b/src/background/operators/impls/ZoomResetOperator.ts index e47a44bf..eae9848f 100644 --- a/src/background/operators/impls/ZoomResetOperator.ts +++ b/src/background/operators/impls/ZoomResetOperator.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import Operator from "../Operator"; +import type { Operator } from "../types"; @injectable() export default class ResetZoomOperator implements Operator { diff --git a/src/background/operators/index.ts b/src/background/operators/index.ts index 958c887c..2cfb9d07 100644 --- a/src/background/operators/index.ts +++ b/src/background/operators/index.ts @@ -1,5 +1,5 @@ import { inject, injectable } from "inversify"; -import type OperatorRegistory from "./OperatorRegistory"; +import type { OperatorRegistory } from "./OperatorRegistory"; import EnableAddonOperator from "./impls/EnableAddonOperator"; import DisableAddonOperator from "./impls/DisableAddonOperator"; import ToggleAddonOperator from "./impls/ToggleAddonOperator"; @@ -63,7 +63,7 @@ import OpenCommandHintOperator from "./impls/OpenCommandHintOperator"; import TabopenCommandHintOperator from "./impls/TabopenCommandHintOperator"; import WinopenCommandHintOperator from "./impls/WinopenCommandHintOperator"; import OpenSourceHintOperator from "./impls/OpenSourceHintOperator"; -import RepeatRepository from "../repositories/RepeatRepository"; +import type { RepeatRepository } from "../repositories/RepeatRepository"; import { OperatorRegistryImpl } from "./OperatorRegistory"; @injectable() diff --git a/src/background/operators/Operator.ts b/src/background/operators/types.ts similarity index 88% rename from src/background/operators/Operator.ts rename to src/background/operators/types.ts index b5f11165..d19cd8f3 100644 --- a/src/background/operators/Operator.ts +++ b/src/background/operators/types.ts @@ -10,12 +10,10 @@ export type OperatorContext = { }; }; -interface Operator { +export interface Operator { name(): string; schema(): PropsSchema | void; run(ctx: OperatorContext, props: Props): Promise; } - -export default Operator; diff --git a/src/background/presenters/Notifier.ts b/src/background/presenters/Notifier.ts index f7b035a2..4aac86f3 100644 --- a/src/background/presenters/Notifier.ts +++ b/src/background/presenters/Notifier.ts @@ -2,7 +2,7 @@ import { injectable } from "inversify"; const NOTIFICATION_ID_UPDATE = "vimmatic-update"; -export default interface Notifier { +export interface Notifier { notifyUpdated(version: string, onclick: () => void): Promise; } diff --git a/src/background/presenters/TabPresenter.ts b/src/background/presenters/TabPresenter.ts index e28e3cfb..a9cfae3c 100644 --- a/src/background/presenters/TabPresenter.ts +++ b/src/background/presenters/TabPresenter.ts @@ -2,7 +2,7 @@ import { injectable } from "inversify"; export type Tab = chrome.tabs.Tab; -export default interface TabPresenter { +export interface TabPresenter { openToTab(url: string, tabId: number): Promise; openNewTab(url: string, openerId: number, background: boolean): Promise; diff --git a/src/background/presenters/ToolbarPresenter.ts b/src/background/presenters/ToolbarPresenter.ts index debc4ff4..447fa974 100644 --- a/src/background/presenters/ToolbarPresenter.ts +++ b/src/background/presenters/ToolbarPresenter.ts @@ -1,6 +1,6 @@ import { injectable } from "inversify"; -export default interface ToolbarPresenter { +export interface ToolbarPresenter { setEnabled(enabled: boolean): Promise; onClick(listener: (arg: chrome.tabs.Tab) => void): void; diff --git a/src/background/property/ColorSchemeProperty.ts b/src/background/property/ColorSchemeProperty.ts index be8066b3..0b0dd3b4 100644 --- a/src/background/property/ColorSchemeProperty.ts +++ b/src/background/property/ColorSchemeProperty.ts @@ -1,5 +1,4 @@ -import type Property from "./Property"; -import type { PropertyType } from "./Property"; +import type { Property, PropertyType } from "./types"; enum ColorScheme { System = "system", diff --git a/src/background/property/CompleteProperty.ts b/src/background/property/CompleteProperty.ts index 132596d0..cdb09bc4 100644 --- a/src/background/property/CompleteProperty.ts +++ b/src/background/property/CompleteProperty.ts @@ -1,5 +1,4 @@ -import type Property from "./Property"; -import type { PropertyType } from "./Property"; +import type { Property, PropertyType } from "./types"; enum Complete { SearchEngines = "s", diff --git a/src/background/property/FindModeProperty.ts b/src/background/property/FindModeProperty.ts index 7b33f5a4..1671cf7c 100644 --- a/src/background/property/FindModeProperty.ts +++ b/src/background/property/FindModeProperty.ts @@ -1,5 +1,4 @@ -import type Property from "./Property"; -import type { PropertyType } from "./Property"; +import type { Property, PropertyType } from "./types"; enum FindMode { Normal = "normal", diff --git a/src/background/property/HintcharsProperty.ts b/src/background/property/HintcharsProperty.ts index 2076bfd4..fadb43a7 100644 --- a/src/background/property/HintcharsProperty.ts +++ b/src/background/property/HintcharsProperty.ts @@ -1,5 +1,4 @@ -import type Property from "./Property"; -import type { PropertyType } from "./Property"; +import type { Property, PropertyType } from "./types"; export default class HintcharsProperty implements Property { name() { diff --git a/src/background/property/IgnoreCaseProperty.ts b/src/background/property/IgnoreCaseProperty.ts index 1ffe7702..d3e904a5 100644 --- a/src/background/property/IgnoreCaseProperty.ts +++ b/src/background/property/IgnoreCaseProperty.ts @@ -1,5 +1,4 @@ -import type Property from "./Property"; -import type { PropertyType } from "./Property"; +import type { Property, PropertyType } from "./types"; export default class IgnoreCaseProperty implements Property { name() { diff --git a/src/background/property/PropertyRegistry.ts b/src/background/property/PropertyRegistry.ts index b973deef..5abc470a 100644 --- a/src/background/property/PropertyRegistry.ts +++ b/src/background/property/PropertyRegistry.ts @@ -1,6 +1,6 @@ -import Property from "./Property"; +import type { Property } from "./types"; -export default interface PropertyRegistry { +export interface PropertyRegistry { register(prop: Property): void; getProperty(name: string): Property | undefined; diff --git a/src/background/property/SmoothScrollProperty.ts b/src/background/property/SmoothScrollProperty.ts index a56ed836..04dc49bb 100644 --- a/src/background/property/SmoothScrollProperty.ts +++ b/src/background/property/SmoothScrollProperty.ts @@ -1,5 +1,4 @@ -import type Property from "./Property"; -import type { PropertyType } from "./Property"; +import type { Property, PropertyType } from "./types"; export default class SmoothScrollProperty implements Property { name() { diff --git a/src/background/property/index.ts b/src/background/property/index.ts index b40b17ba..bf8c29ba 100644 --- a/src/background/property/index.ts +++ b/src/background/property/index.ts @@ -4,17 +4,18 @@ import HintcharsProperty from "./HintcharsProperty"; import SmoothScrollProperty from "./SmoothScrollProperty"; import IgnoreCaseProperty from "./IgnoreCaseProperty"; import FindModeProperty from "./FindModeProperty"; -import PropertyRegistry, { PropertyRegistryImpl } from "./PropertyRegistry"; +import { + type PropertyRegistry, + PropertyRegistryImpl, +} from "./PropertyRegistry"; -export class PropertyRegistryFactry { - create(): PropertyRegistry { - const r = new PropertyRegistryImpl(); - r.register(new HintcharsProperty()); - r.register(new SmoothScrollProperty()); - r.register(new CompleteProperty()); - r.register(new ColorSchemeProperty()); - r.register(new IgnoreCaseProperty()); - r.register(new FindModeProperty()); - return r; - } -} +export const createPropertyRegistry = (): PropertyRegistry => { + const r = new PropertyRegistryImpl(); + r.register(new HintcharsProperty()); + r.register(new SmoothScrollProperty()); + r.register(new CompleteProperty()); + r.register(new ColorSchemeProperty()); + r.register(new IgnoreCaseProperty()); + r.register(new FindModeProperty()); + return r; +}; diff --git a/src/background/property/Property.ts b/src/background/property/types.ts similarity index 88% rename from src/background/property/Property.ts rename to src/background/property/types.ts index a450d4be..04bc781c 100644 --- a/src/background/property/Property.ts +++ b/src/background/property/types.ts @@ -1,7 +1,7 @@ export type PropertyType = string | number | boolean; export type PropertyTypeName = "string" | "number" | "boolean"; -export default interface Property { +export interface Property { name(): string; description(): string; diff --git a/src/background/repositories/AddonEnabledRepository.ts b/src/background/repositories/AddonEnabledRepository.ts index f7394adb..4d1ded89 100644 --- a/src/background/repositories/AddonEnabledRepository.ts +++ b/src/background/repositories/AddonEnabledRepository.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; -export default interface AddonEnabledRepository { +export interface AddonEnabledRepository { enable(): Promise; disable(): Promise; diff --git a/src/background/repositories/BrowserSettingRepository.ts b/src/background/repositories/BrowserSettingRepository.ts index 809d92cd..2edd6169 100644 --- a/src/background/repositories/BrowserSettingRepository.ts +++ b/src/background/repositories/BrowserSettingRepository.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; import * as urls from "../../shared/urls"; -export default interface BrowserSettingRepository { +export interface BrowserSettingRepository { getHomepageUrls(): Promise; } diff --git a/src/background/repositories/ClipboardRepository.ts b/src/background/repositories/ClipboardRepository.ts index 57c315fb..36b4500c 100644 --- a/src/background/repositories/ClipboardRepository.ts +++ b/src/background/repositories/ClipboardRepository.ts @@ -1,6 +1,6 @@ import { injectable } from "inversify"; -export default interface ClipboardRepository { +export interface ClipboardRepository { read(): Promise; write(value: string): Promise; diff --git a/src/background/repositories/FindHistoryRepository.ts b/src/background/repositories/FindHistoryRepository.ts index 8cc3b19e..70d6ea52 100644 --- a/src/background/repositories/FindHistoryRepository.ts +++ b/src/background/repositories/FindHistoryRepository.ts @@ -1,9 +1,9 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; type State = string[]; -export default interface FindHistoryRepository { +export interface FindHistoryRepository { append(keyword: string): Promise; query(prefix: string): Promise; diff --git a/src/background/repositories/FindRepository.ts b/src/background/repositories/FindRepository.ts index fb5c1a44..cd999c24 100644 --- a/src/background/repositories/FindRepository.ts +++ b/src/background/repositories/FindRepository.ts @@ -1,5 +1,5 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; export type FindState = { keyword: string; @@ -11,7 +11,7 @@ type State = { local: { [tabId: number]: FindState }; }; -export default interface FindRepository { +export interface FindRepository { getGlobalKeyword(): Promise; setGlobalKeyword(keyword: string): Promise; diff --git a/src/background/repositories/HintRepository.ts b/src/background/repositories/HintRepository.ts index 2ceb2eae..137d8985 100644 --- a/src/background/repositories/HintRepository.ts +++ b/src/background/repositories/HintRepository.ts @@ -1,8 +1,8 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; -import type HintTarget from "../hint/HintTarget"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; +import type { HintTarget } from "../hint/types"; -export default interface HintRepository { +export interface HintRepository { startHintMode( name: string, opts: { newTab: boolean; background: boolean }, diff --git a/src/background/repositories/LastSelectedTabRepository.ts b/src/background/repositories/LastSelectedTabRepository.ts index 076c937f..0c2336b0 100644 --- a/src/background/repositories/LastSelectedTabRepository.ts +++ b/src/background/repositories/LastSelectedTabRepository.ts @@ -1,7 +1,7 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; -export default interface LastSelectedTabRepository { +export interface LastSelectedTabRepository { getLastSelectedTabId(): Promise; setCurrentTabId(tabId: number): Promise; diff --git a/src/background/repositories/MarkRepository.ts b/src/background/repositories/MarkRepository.ts index f177f387..88152fed 100644 --- a/src/background/repositories/MarkRepository.ts +++ b/src/background/repositories/MarkRepository.ts @@ -1,14 +1,24 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; -import GlobalMark from "../domains/GlobalMark"; -import LocalMark from "../domains/LocalMark"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; + +export type GlobalMark = { + readonly tabId: number; + readonly url: string; + readonly x: number; + readonly y: number; +}; + +export type LocalMark = { + readonly x: number; + readonly y: number; +}; type MarkData = { globals: { [key: string]: GlobalMark }; locals: { [tabId: number]: { [key: string]: LocalMark } }; }; -export default interface MarkRepository { +export interface MarkRepository { getGlobalMark(key: string): Promise; setGlobalMark(key: string, mark: GlobalMark): Promise; diff --git a/src/background/repositories/ModeRepository.ts b/src/background/repositories/ModeRepository.ts index 63f9992a..eb40a948 100644 --- a/src/background/repositories/ModeRepository.ts +++ b/src/background/repositories/ModeRepository.ts @@ -1,8 +1,8 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; -import Mode from "../../shared/Mode"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; +import { Mode } from "../../shared/mode"; -export default interface ModeRepository { +export interface ModeRepository { getMode(): Promise; setMode(mode: Mode): Promise; } diff --git a/src/background/repositories/ReadyFrameRepository.ts b/src/background/repositories/ReadyFrameRepository.ts index 1ef821fb..9141ff35 100644 --- a/src/background/repositories/ReadyFrameRepository.ts +++ b/src/background/repositories/ReadyFrameRepository.ts @@ -1,9 +1,9 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; type State = { [tabId: number]: number[] }; -export default interface ReadyFrameRepository { +export interface ReadyFrameRepository { addFrameId(tabId: number, frameId: number): Promise; removeFrameId(tabId: number, frameId: number): Promise; diff --git a/src/background/repositories/RepeatRepository.ts b/src/background/repositories/RepeatRepository.ts index d8a663f1..d5591d11 100644 --- a/src/background/repositories/RepeatRepository.ts +++ b/src/background/repositories/RepeatRepository.ts @@ -1,8 +1,8 @@ import { injectable } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; -import type Operation from "../../shared/Operation"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; +import type { Operation } from "../../shared/operation"; -export default interface RepeatRepository { +export interface RepeatRepository { getLastOperation(): Promise; setLastOperation(op: Operation): Promise; diff --git a/src/background/settings/PropertySettings.ts b/src/background/settings/PropertySettings.ts index b70b6cf7..f6edd3e8 100644 --- a/src/background/settings/PropertySettings.ts +++ b/src/background/settings/PropertySettings.ts @@ -1,8 +1,8 @@ import { injectable, inject } from "inversify"; -import type PropertyRegistry from "../property/PropertyRegistry"; -import type SettingsRepository from "./SettingsRepository"; +import type { PropertyRegistry } from "../property/PropertyRegistry"; +import type { SettingsRepository } from "./SettingsRepository"; -export default interface PropertySettings { +export interface PropertySettings { setProperty(name: string, value: string | number | boolean): Promise; getProperty(name: string): Promise; diff --git a/src/background/settings/SearchEngineSettings.ts b/src/background/settings/SearchEngineSettings.ts index ade18620..875ebf92 100644 --- a/src/background/settings/SearchEngineSettings.ts +++ b/src/background/settings/SearchEngineSettings.ts @@ -1,9 +1,9 @@ import { injectable, inject } from "inversify"; -import SettingsRepository from "./SettingsRepository"; -import Search from "../../shared/Search"; +import type { SettingsRepository } from "./SettingsRepository"; +import type { Search } from "../../shared/search"; import { defaultSettings } from "../../settings"; -export default interface SearchEngineSettings { +export interface SearchEngineSettings { get(): Promise; } diff --git a/src/background/settings/SettingsRepository.ts b/src/background/settings/SettingsRepository.ts index 11a7d4b0..cf0279e9 100644 --- a/src/background/settings/SettingsRepository.ts +++ b/src/background/settings/SettingsRepository.ts @@ -1,12 +1,12 @@ import { injectable, inject } from "inversify"; -import LocalCache, { LocalCacheImpl } from "../db/LocalStorage"; -import Settings from "../../shared/Settings"; +import { type LocalCache, LocalCacheImpl } from "../db/LocalStorage"; +import type { Settings } from "../../shared/settings"; import { defaultSettings, serialize, deserialize } from "../../settings"; -import { SerializedSettings } from "../../settings/schema"; +import type { SerializedSettings } from "../../settings/schema"; type OnChangeListener = (value: Settings) => unknown; -export default interface SettingsRepository { +export interface SettingsRepository { load(): Promise; save(value: Settings): Promise; diff --git a/src/background/settings/StyleSettings.ts b/src/background/settings/StyleSettings.ts index 93ad49aa..80f79c89 100644 --- a/src/background/settings/StyleSettings.ts +++ b/src/background/settings/StyleSettings.ts @@ -1,9 +1,9 @@ import { injectable, inject } from "inversify"; -import SettingsRepository from "./SettingsRepository"; -import { ComponentName } from "../../shared/Styles"; +import type { SettingsRepository } from "./SettingsRepository"; +import type { ComponentName } from "../../shared/styles"; import { defaultSettings } from "../../settings"; -export default interface StyleSettings { +export interface StyleSettings { getStyle(name: string): Promise>; } diff --git a/src/background/settings/Validator.ts b/src/background/settings/Validator.ts index 663a5219..07eec3bd 100644 --- a/src/background/settings/Validator.ts +++ b/src/background/settings/Validator.ts @@ -1,7 +1,7 @@ import { injectable, inject } from "inversify"; -import Settings from "../../shared/Settings"; -import PropertyRegistry from "../property/PropertyRegistry"; -import OperatorRegistory from "../operators/OperatorRegistory"; +import type { Settings } from "../../shared/settings"; +import type { PropertyRegistry } from "../property/PropertyRegistry"; +import type { OperatorRegistory } from "../operators/OperatorRegistory"; @injectable() export default class Validator { diff --git a/src/background/usecases/AddonEnabledEventUseCase.ts b/src/background/usecases/AddonEnabledEventUseCase.ts index bc7cc4c4..88e44851 100644 --- a/src/background/usecases/AddonEnabledEventUseCase.ts +++ b/src/background/usecases/AddonEnabledEventUseCase.ts @@ -1,8 +1,8 @@ import { inject, injectable } from "inversify"; -import ToolbarPresenter from "../presenters/ToolbarPresenter"; +import type { ToolbarPresenter } from "../presenters/ToolbarPresenter"; import AddonEnabledUseCase from "./AddonEnabledUseCase"; -import AddonEnabledRepository from "../repositories/AddonEnabledRepository"; -import AddonEnabledClient from "../clients/AddonEnabledClient"; +import type { AddonEnabledRepository } from "../repositories/AddonEnabledRepository"; +import type { AddonEnabledClient } from "../clients/AddonEnabledClient"; import EventUseCaseHelper from "./EventUseCaseHelper"; @injectable() diff --git a/src/background/usecases/AddonEnabledUseCase.ts b/src/background/usecases/AddonEnabledUseCase.ts index 5e5a4e84..59b2dc74 100644 --- a/src/background/usecases/AddonEnabledUseCase.ts +++ b/src/background/usecases/AddonEnabledUseCase.ts @@ -1,6 +1,6 @@ import { inject, injectable } from "inversify"; -import ToolbarPresenter from "../presenters/ToolbarPresenter"; -import AddonEnabledRepository from "../repositories/AddonEnabledRepository"; +import type { ToolbarPresenter } from "../presenters/ToolbarPresenter"; +import type { AddonEnabledRepository } from "../repositories/AddonEnabledRepository"; @injectable() export default class AddonEnabledUseCase { diff --git a/src/background/usecases/CommandUseCase.ts b/src/background/usecases/CommandUseCase.ts index b9eb73e0..ea8f55ec 100644 --- a/src/background/usecases/CommandUseCase.ts +++ b/src/background/usecases/CommandUseCase.ts @@ -1,9 +1,9 @@ -import { Completions } from "../../shared/Completions"; import { injectable, inject } from "inversify"; -import CommandRegistry from "../command/CommandRegistry"; +import type { Completions } from "../../shared/completions"; +import type { CommandRegistry } from "../command/CommandRegistry"; +import type { RequestContext } from "../messaging/types"; +import type { CommandContext } from "../command/types"; import { parseCommand, onCommandInputting } from "./parser"; -import RequestContext from "../messaging/RequestContext"; -import { CommandContext } from "../command/Command"; @injectable() export default class CommandUseCase { diff --git a/src/background/usecases/ConsoleUseCase.ts b/src/background/usecases/ConsoleUseCase.ts index 874745ab..ca5ff866 100644 --- a/src/background/usecases/ConsoleUseCase.ts +++ b/src/background/usecases/ConsoleUseCase.ts @@ -1,5 +1,5 @@ import { inject, injectable } from "inversify"; -import ConsoleFrameClient from "../clients/ConsoleFrameClient"; +import type { ConsoleFrameClient } from "../clients/ConsoleFrameClient"; @injectable() export default class ConsoleUseCase { diff --git a/src/background/usecases/FindUseCase.ts b/src/background/usecases/FindUseCase.ts index 268f35f3..a69e4f21 100644 --- a/src/background/usecases/FindUseCase.ts +++ b/src/background/usecases/FindUseCase.ts @@ -1,10 +1,10 @@ import { inject, injectable } from "inversify"; -import ConsoleClient from "../clients/ConsoleClient"; -import FindRepository from "../repositories/FindRepository"; -import FindHistoryRepository from "../repositories/FindHistoryRepository"; -import type PropertySettings from "../settings/PropertySettings"; -import FindClient from "../clients/FindClient"; -import ReadyFrameRepository from "../repositories/ReadyFrameRepository"; +import type { ConsoleClient } from "../clients/ConsoleClient"; +import type { FindRepository } from "../repositories/FindRepository"; +import type { FindHistoryRepository } from "../repositories/FindHistoryRepository"; +import type { PropertySettings } from "../settings/PropertySettings"; +import type { FindClient } from "../clients/FindClient"; +import type { ReadyFrameRepository } from "../repositories/ReadyFrameRepository"; @injectable() export default class FindUseCase { diff --git a/src/background/usecases/HintKeyUseCase.ts b/src/background/usecases/HintKeyUseCase.ts index 3ee3bdb1..ba876a0d 100644 --- a/src/background/usecases/HintKeyUseCase.ts +++ b/src/background/usecases/HintKeyUseCase.ts @@ -1,8 +1,8 @@ import { injectable, inject } from "inversify"; -import type HintClient from "../clients/HintClient"; -import type HintTarget from "../hint/HintTarget"; -import type HintRepository from "../repositories/HintRepository"; -import type HintActionFactory from "../hint/HintActionFactory"; +import type { HintClient } from "../clients/HintClient"; +import type { HintTarget } from "../hint/types"; +import type { HintRepository } from "../repositories/HintRepository"; +import type { HintActionFactory } from "../hint/HintActionFactory"; @injectable() export default class HintKeyUseCase { diff --git a/src/background/usecases/HintModeUseCase.ts b/src/background/usecases/HintModeUseCase.ts index 6bd7bed8..b62b1577 100644 --- a/src/background/usecases/HintModeUseCase.ts +++ b/src/background/usecases/HintModeUseCase.ts @@ -1,11 +1,11 @@ import { injectable, inject } from "inversify"; -import type ReadyFrameRepository from "../repositories/ReadyFrameRepository"; -import type PropertySettings from "../settings/PropertySettings"; -import type TopFrameClient from "../clients/TopFrameClient"; -import type HintTarget from "../hint/HintTarget"; -import type HintClient from "../clients/HintClient"; -import type HintRepository from "../repositories/HintRepository"; -import type HintActionFactory from "../hint/HintActionFactory"; +import type { ReadyFrameRepository } from "../repositories/ReadyFrameRepository"; +import type { PropertySettings } from "../settings/PropertySettings"; +import type { TopFrameClient } from "../clients/TopFrameClient"; +import type { HintTarget } from "../hint/types"; +import type { HintClient } from "../clients/HintClient"; +import type { HintRepository } from "../repositories/HintRepository"; +import type { HintActionFactory } from "../hint/HintActionFactory"; import HintTagProducer from "./HintTagProducer"; @injectable() diff --git a/src/background/usecases/MarkJumpUseCase.ts b/src/background/usecases/MarkJumpUseCase.ts index 5af925db..6eaf8fb8 100644 --- a/src/background/usecases/MarkJumpUseCase.ts +++ b/src/background/usecases/MarkJumpUseCase.ts @@ -1,8 +1,8 @@ import { inject, injectable } from "inversify"; -import MarkRepository from "../repositories/MarkRepository"; -import ContentMessageClient from "../clients/ContentMessageClient"; -import ConsoleClient from "../clients/ConsoleClient"; -import PropertySettings from "../settings/PropertySettings"; +import type { MarkRepository } from "../repositories/MarkRepository"; +import type { ContentMessageClient } from "../clients/ContentMessageClient"; +import type { ConsoleClient } from "../clients/ConsoleClient"; +import type { PropertySettings } from "../settings/PropertySettings"; import MarkHelper from "./MarkHelper"; @injectable() diff --git a/src/background/usecases/MarkSetUseCase.ts b/src/background/usecases/MarkSetUseCase.ts index 65f98a67..4f567639 100644 --- a/src/background/usecases/MarkSetUseCase.ts +++ b/src/background/usecases/MarkSetUseCase.ts @@ -1,9 +1,11 @@ import { inject, injectable } from "inversify"; -import MarkRepository from "../repositories/MarkRepository"; -import ContentMessageClient from "../clients/ContentMessageClient"; -import ConsoleClient from "../clients/ConsoleClient"; -import GlobalMark from "../domains/GlobalMark"; -import LocalMark from "../domains/LocalMark"; +import type { + MarkRepository, + GlobalMark, + LocalMark, +} from "../repositories/MarkRepository"; +import type { ContentMessageClient } from "../clients/ContentMessageClient"; +import type { ConsoleClient } from "../clients/ConsoleClient"; import MarkHelper from "./MarkHelper"; @injectable() diff --git a/src/background/usecases/ModeUseCase.ts b/src/background/usecases/ModeUseCase.ts index f146c506..d5dfa4c1 100644 --- a/src/background/usecases/ModeUseCase.ts +++ b/src/background/usecases/ModeUseCase.ts @@ -1,7 +1,7 @@ import { inject, injectable } from "inversify"; -import Mode from "../../shared/Mode"; -import type ModeClient from "../clients/ModeClient"; -import type ModeRepository from "../repositories/ModeRepository"; +import { Mode } from "../../shared/mode"; +import type { ModeClient } from "../clients/ModeClient"; +import type { ModeRepository } from "../repositories/ModeRepository"; @injectable() export default class ModeUseCase { diff --git a/src/background/usecases/OperationUseCase.ts b/src/background/usecases/OperationUseCase.ts index 3468c8a3..651bb2b5 100644 --- a/src/background/usecases/OperationUseCase.ts +++ b/src/background/usecases/OperationUseCase.ts @@ -1,9 +1,9 @@ import { inject, injectable } from "inversify"; -import type { OperatorContext } from "../operators/Operator"; -import type Operation from "../../shared/Operation"; -import OperatorRegistory from "../operators/OperatorRegistory"; -import RepeatRepository from "../repositories/RepeatRepository"; -import RequestContext from "../messaging/RequestContext"; +import type { OperatorContext } from "../operators/types"; +import type { Operation } from "../../shared/operation"; +import type { OperatorRegistory } from "../operators/OperatorRegistory"; +import type { RepeatRepository } from "../repositories/RepeatRepository"; +import type { RequestContext } from "../messaging/types"; @injectable() export default class OperationUseCase { diff --git a/src/background/usecases/SettingsEventUseCase.ts b/src/background/usecases/SettingsEventUseCase.ts index 2cb49b90..32e66f20 100644 --- a/src/background/usecases/SettingsEventUseCase.ts +++ b/src/background/usecases/SettingsEventUseCase.ts @@ -1,6 +1,6 @@ import { injectable, inject } from "inversify"; -import ContentMessageClient from "../clients/ContentMessageClient"; -import SettingsRepository from "../settings/SettingsRepository"; +import type { ContentMessageClient } from "../clients/ContentMessageClient"; +import type { SettingsRepository } from "../settings/SettingsRepository"; import EventUseCaseHelper from "./EventUseCaseHelper"; @injectable() diff --git a/src/background/usecases/SettingsUseCase.ts b/src/background/usecases/SettingsUseCase.ts index 8b0aa287..96184979 100644 --- a/src/background/usecases/SettingsUseCase.ts +++ b/src/background/usecases/SettingsUseCase.ts @@ -1,8 +1,8 @@ import { injectable, inject } from "inversify"; import { serialize, deserialize } from "../../settings"; -import SettingsRepository from "../settings/SettingsRepository"; -import PropertySettings from "../settings/PropertySettings"; -import StyleSettings from "../settings/StyleSettings"; +import type { SettingsRepository } from "../settings/SettingsRepository"; +import type { PropertySettings } from "../settings/PropertySettings"; +import type { StyleSettings } from "../settings/StyleSettings"; import Validator from "../settings/Validator"; @injectable() diff --git a/src/background/usecases/VersionUseCase.ts b/src/background/usecases/VersionUseCase.ts index f63b8ac1..9f8fe0a6 100644 --- a/src/background/usecases/VersionUseCase.ts +++ b/src/background/usecases/VersionUseCase.ts @@ -1,5 +1,5 @@ import { injectable, inject } from "inversify"; -import Notifier from "../presenters/Notifier"; +import type { Notifier } from "../presenters/Notifier"; @injectable() export default class VersionUseCase { diff --git a/src/console/Completions.ts b/src/console/Completions.ts deleted file mode 100644 index b04e4800..00000000 --- a/src/console/Completions.ts +++ /dev/null @@ -1,11 +0,0 @@ -type Completions = { - readonly name: string; - readonly items: { - readonly primary?: string; - readonly secondary?: string; - readonly value?: string; - readonly icon?: string; - }[]; -}[]; - -export default Completions; diff --git a/src/console/app/contexts.ts b/src/console/app/contexts.ts index 7e4f3237..63102be8 100644 --- a/src/console/app/contexts.ts +++ b/src/console/app/contexts.ts @@ -1,6 +1,6 @@ import React from "react"; -import { State, defaultState } from "./recuer"; -import { AppAction } from "./actions"; +import { type State, defaultState } from "./recuer"; +import type { AppAction } from "./actions"; export const AppStateContext = React.createContext(defaultState); diff --git a/src/console/app/recuer.ts b/src/console/app/recuer.ts index fc6ce132..beeb0b06 100644 --- a/src/console/app/recuer.ts +++ b/src/console/app/recuer.ts @@ -4,7 +4,7 @@ import { SHOW_ERROR, SHOW_FIND, SHOW_INFO, - AppAction, + type AppAction, } from "./actions"; export type State = diff --git a/src/console/clients/BackgroundMessageSender.ts b/src/console/clients/BackgroundMessageSender.ts index d7c17e5e..6a761825 100644 --- a/src/console/clients/BackgroundMessageSender.ts +++ b/src/console/clients/BackgroundMessageSender.ts @@ -1,8 +1,6 @@ import { Sender } from "../../messaging"; import type { Schema, Key, Request } from "../../messaging/schema/background"; -type BackgroundMessageSender = Sender; - export const newSender = () => { const sender = new Sender((type: Key, args: Request) => { return chrome.runtime.sendMessage({ @@ -13,4 +11,4 @@ export const newSender = () => { return sender; }; -export default BackgroundMessageSender; +export type BackgroundMessageSender = Sender; diff --git a/src/console/clients/CommandClient.ts b/src/console/clients/CommandClient.ts index b5acd988..2960ae87 100644 --- a/src/console/clients/CommandClient.ts +++ b/src/console/clients/CommandClient.ts @@ -1,5 +1,5 @@ -import type BackgroundMessageSender from "./BackgroundMessageSender"; -import Completions from "../Completions"; +import type { BackgroundMessageSender } from "./BackgroundMessageSender"; +import type { Completions } from "../../shared/completions"; export default class CommandClient { constructor(private readonly sender: BackgroundMessageSender) {} diff --git a/src/console/clients/ConsoleFrameClient.ts b/src/console/clients/ConsoleFrameClient.ts index bebea71d..b80e2377 100644 --- a/src/console/clients/ConsoleFrameClient.ts +++ b/src/console/clients/ConsoleFrameClient.ts @@ -1,4 +1,4 @@ -import type BackgroundMessageSender from "./BackgroundMessageSender"; +import type { BackgroundMessageSender } from "./BackgroundMessageSender"; export default class ConsoleFrameClient { constructor(private readonly sender: BackgroundMessageSender) {} diff --git a/src/console/clients/FindClient.ts b/src/console/clients/FindClient.ts index 5a9829cb..a0fc7e93 100644 --- a/src/console/clients/FindClient.ts +++ b/src/console/clients/FindClient.ts @@ -1,5 +1,5 @@ -import type BackgroundMessageSender from "./BackgroundMessageSender"; -import Completions from "../Completions"; +import type { BackgroundMessageSender } from "./BackgroundMessageSender"; +import type { Completions } from "../../shared/completions"; export default class FindClient { constructor(private readonly sender: BackgroundMessageSender) {} diff --git a/src/console/clients/SettingClient.ts b/src/console/clients/SettingClient.ts index 50fdf87c..1b6fd7ce 100644 --- a/src/console/clients/SettingClient.ts +++ b/src/console/clients/SettingClient.ts @@ -1,4 +1,4 @@ -import type BackgroundMessageSender from "./BackgroundMessageSender"; +import type { BackgroundMessageSender } from "./BackgroundMessageSender"; export default class SettingClient { constructor(private readonly sender: BackgroundMessageSender) {} diff --git a/src/console/completion/components/Completion.tsx b/src/console/completion/components/Completion.tsx index 83ed3c3b..d508699b 100644 --- a/src/console/completion/components/Completion.tsx +++ b/src/console/completion/components/Completion.tsx @@ -1,6 +1,6 @@ import React from "react"; import styled from "styled-components"; -import type CompletionsType from "../../Completions"; +import type { Completions } from "../../../shared/completions"; import useCompletionKeyBinds from "../hooks/useCompletionKeyBinds"; import useCursor from "../hooks/useCursor"; import CompletionList from "./CompletionList"; @@ -15,7 +15,7 @@ interface Props { maxLineHeight: number; onInputChange: (newValue: string) => void; onInputEnter: (newValue: string) => void; - completions: CompletionsType; + completions: Completions; renderInput: (attrs: InputProps) => React.ReactNode; } @@ -49,7 +49,7 @@ const useAutoInputValue = ( }, [value]); }; -const useFlatten = (completions: CompletionsType) => { +const useFlatten = (completions: Completions) => { return React.useMemo( () => completions.map((g) => g.items).flat(), [completions], diff --git a/src/console/components/Prompt.tsx b/src/console/components/Prompt.tsx index 04963390..c93b64c4 100644 --- a/src/console/components/Prompt.tsx +++ b/src/console/components/Prompt.tsx @@ -1,6 +1,6 @@ -import React, { InputHTMLAttributes } from "react"; +import React, { type InputHTMLAttributes } from "react"; import Completion from "../completion"; -import type CompletionsType from "../Completions"; +import type { Completions as CompletionsType } from "../../shared/completions"; import PromptInput from "./PromptInput"; import useDebounce from "../hooks/useDebounce"; import useAutoResize from "../hooks/useAutoResize"; diff --git a/src/console/components/PromptInput.tsx b/src/console/components/PromptInput.tsx index 63c49a79..d9ddc1ad 100644 --- a/src/console/components/PromptInput.tsx +++ b/src/console/components/PromptInput.tsx @@ -1,4 +1,4 @@ -import React, { InputHTMLAttributes } from "react"; +import React, { type InputHTMLAttributes } from "react"; import styled from "styled-components"; const Container = styled.div` diff --git a/src/console/styles/providers.tsx b/src/console/styles/providers.tsx index b2ab0df8..2f5beb30 100644 --- a/src/console/styles/providers.tsx +++ b/src/console/styles/providers.tsx @@ -1,6 +1,6 @@ import React from "react"; import { DarkTheme, LightTheme } from "./theme"; -import { Style, UpdateStyleContext } from "./contexts"; +import { type Style, UpdateStyleContext } from "./contexts"; import GlobalStyle from "./global"; import { ThemeProvider } from "styled-components"; diff --git a/src/content/Application.ts b/src/content/Application.ts index b42c86ba..76f76b2c 100644 --- a/src/content/Application.ts +++ b/src/content/Application.ts @@ -4,7 +4,7 @@ import ContentMessageListener from "./messaging/ContentMessageListener"; import KeyController from "./controllers/KeyController"; import SettingsController from "./controllers/SettingsController"; import InputDriver from "./InputDriver"; -import ReadyStatusPresenter from "./presenters/ReadyStatusPresenter"; +import type { ReadyStatusPresenter } from "./presenters/ReadyStatusPresenter"; @injectable() export default class Application { diff --git a/src/content/InputDriver.ts b/src/content/InputDriver.ts index 6687481e..ab3f7e8d 100644 --- a/src/content/InputDriver.ts +++ b/src/content/InputDriver.ts @@ -1,5 +1,5 @@ import * as dom from "../shared/utils/dom"; -import Key from "../shared/Key"; +import { Key } from "../shared/key"; const cancelKey = (e: KeyboardEvent): boolean => { if (e.key === "Escape") { diff --git a/src/content/client/BackgroundKeyClient.ts b/src/content/client/BackgroundKeyClient.ts index bade1b17..3c65fc2d 100644 --- a/src/content/client/BackgroundKeyClient.ts +++ b/src/content/client/BackgroundKeyClient.ts @@ -1,8 +1,8 @@ import { injectable, inject } from "inversify"; -import Key from "../../shared/Key"; -import type BackgroundMessageSender from "./BackgroundMessageSender"; +import { Key } from "../../shared/key"; +import type { BackgroundMessageSender } from "./BackgroundMessageSender"; -export default interface BackgroundKeyClient { +export interface BackgroundKeyClient { sendKey(key: Key): Promise; } diff --git a/src/content/client/BackgroundMessageSender.ts b/src/content/client/BackgroundMessageSender.ts index e5c07069..741934ae 100644 --- a/src/content/client/BackgroundMessageSender.ts +++ b/src/content/client/BackgroundMessageSender.ts @@ -1,8 +1,6 @@ import { Sender } from "../../messaging"; import type { Schema, Key, Request } from "../../messaging/schema/background"; -type BackgroundMessageSender = Sender; - export const newSender = () => { const sender = new Sender((type: Key, args: Request) => { if (process.env.NODE_ENV === "development") { @@ -19,4 +17,4 @@ export const newSender = () => { return sender; }; -export default BackgroundMessageSender; +export type BackgroundMessageSender = Sender; diff --git a/src/content/client/OperationClient.ts b/src/content/client/OperationClient.ts index 82735617..2328e2ae 100644 --- a/src/content/client/OperationClient.ts +++ b/src/content/client/OperationClient.ts @@ -1,8 +1,8 @@ import { injectable, inject } from "inversify"; -import type Operation from "../../shared/Operation"; -import type BackgroundMessageSender from "./BackgroundMessageSender"; +import type { Operation } from "../../shared/operation"; +import type { BackgroundMessageSender } from "./BackgroundMessageSender"; -export default interface OperationClient { +export interface OperationClient { execBackgroundOp(op: Operation, repeat: number): Promise; } diff --git a/src/content/client/SettingClient.ts b/src/content/client/SettingClient.ts index 089d7b9c..e1087c17 100644 --- a/src/content/client/SettingClient.ts +++ b/src/content/client/SettingClient.ts @@ -1,9 +1,9 @@ import { injectable, inject } from "inversify"; import { deserialize } from "../../settings"; -import type Settings from "../../shared/Settings"; -import type BackgroundMessageSender from "./BackgroundMessageSender"; +import type { Settings } from "../../shared/settings"; +import type { BackgroundMessageSender } from "./BackgroundMessageSender"; -export default interface SettingClient { +export interface SettingClient { load(): Promise; } diff --git a/src/content/client/TopFrameClient.ts b/src/content/client/TopFrameClient.ts index c35d0bb3..b4b9dcac 100644 --- a/src/content/client/TopFrameClient.ts +++ b/src/content/client/TopFrameClient.ts @@ -1,7 +1,7 @@ import { injectable, inject } from "inversify"; -import type WindowMessageSender from "./WindowMessageSender"; +import type { WindowMessageSender } from "./WindowMessageSender"; -export default interface TopFrameClient { +export interface TopFrameClient { notifyFrameId(frameId: number): Promise; } diff --git a/src/content/client/WindowMessageSender.ts b/src/content/client/WindowMessageSender.ts index e7b2e759..b44a084e 100644 --- a/src/content/client/WindowMessageSender.ts +++ b/src/content/client/WindowMessageSender.ts @@ -1,8 +1,6 @@ import { SimplexSender } from "../../messaging"; import type { Key, Schema, Request } from "../../messaging/schema/window"; -type WindowMessageSender = SimplexSender; - /** * The window.postMessage() is used to identify a frame id of the