mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
6f83bc6da5
- Create PublicAPI class to encapsulate module initialization - Move search config types to modules/search/types.ts - Rename ui.ts to global.ts for clarity - Simplify pagefind engine (remove normalizeSortOrder, toObject) - Move pagefind config to top-level in FixItConfig - Add TSDoc comments and @param tags - Update PagefindConfig.sortOrder type to 'asc' | 'desc' - Improve pagefind detection warning message
103 lines
2.6 KiB
TypeScript
103 lines
2.6 KiB
TypeScript
/** Service interfaces for all FixIt modules. */
|
|
import type { FixItConfig, MaskOverlayHandler } from '../types'
|
|
import type { TypedEventBus } from './event-bus'
|
|
|
|
// ─── CoreService ───
|
|
export interface CoreService {
|
|
readonly config: FixItConfig
|
|
readonly version: string
|
|
isDark: boolean
|
|
themeMode: string
|
|
registerMaskOverlay: (name: string, handlers: MaskOverlayHandler) => void
|
|
openMaskOverlay: (name: string) => void
|
|
closeMaskOverlay: (name: string, skipSync?: boolean) => void
|
|
toggleMaskOverlay: (name: string) => void
|
|
closeActiveMaskOverlay: () => void
|
|
syncMaskState: () => void
|
|
}
|
|
|
|
// ─── ThemeService ───
|
|
export interface ThemeService {
|
|
setThemeMode: (mode: string, persist?: boolean) => void
|
|
initThemeColor: () => void
|
|
initSwitchTheme: () => void
|
|
}
|
|
|
|
// ─── MenuService ───
|
|
export interface MenuService {
|
|
initMenu: () => void
|
|
}
|
|
|
|
// ─── SearchService ───
|
|
export interface SearchService {
|
|
initSearch: () => void
|
|
}
|
|
|
|
// ─── CodeService ───
|
|
export interface CodeService {
|
|
initCodeWrapper: () => void
|
|
initCodeTabs: () => void
|
|
initDiagramCopyBtn: () => void
|
|
}
|
|
|
|
// ─── TocService ───
|
|
export interface TocService {
|
|
syncTocHeight: () => void
|
|
syncTocActiveState: () => void
|
|
initToc: () => void
|
|
setup: () => void
|
|
}
|
|
|
|
// ─── EncryptionService ───
|
|
export interface EncryptionService {
|
|
initFixItDecryptor: () => void
|
|
}
|
|
|
|
// ─── ContentService ───
|
|
export interface ContentService {
|
|
initSVGIcon: () => void
|
|
initLinkGuardDialog: (target?: Element | Document) => void
|
|
initContent: (target?: Element | Document) => void
|
|
setup: () => void
|
|
}
|
|
|
|
// ─── MiscService ───
|
|
export interface MiscService {
|
|
initSiteTime: () => void
|
|
initServiceWorker: () => void
|
|
initAutoMark: () => void
|
|
initReward: () => void
|
|
initPostChatUser: () => void
|
|
initComment: () => void
|
|
}
|
|
|
|
// ─── EventsService ───
|
|
export interface EventsService {
|
|
onScroll: () => void
|
|
onResize: () => void
|
|
onClickMask: () => void
|
|
initPrint: () => void
|
|
}
|
|
|
|
// ─── FixItPublicAPI ───
|
|
export interface FixItPublicAPI {
|
|
readonly config: FixItConfig
|
|
readonly version: string
|
|
readonly themeMode: string
|
|
readonly isDark: boolean
|
|
// Modules
|
|
readonly core: CoreService
|
|
readonly theme: ThemeService
|
|
readonly code: CodeService
|
|
readonly toc: TocService
|
|
readonly menu: MenuService
|
|
readonly search: SearchService
|
|
readonly enc: EncryptionService
|
|
readonly misc: MiscService
|
|
readonly content: ContentService
|
|
readonly events: EventsService
|
|
readonly eventBus: TypedEventBus
|
|
// Methods
|
|
setThemeMode: (mode: string, persist?: boolean) => void
|
|
}
|