[Feat] Early support for PLS & Use JSDoc (Partially)

This commit is contained in:
Minoricew
2025-05-25 22:40:12 +08:00
parent 502da5ba9a
commit 12f1040884
71 changed files with 1470 additions and 185 deletions

33
src/aura/types/main/core.d.ts vendored Executable file
View File

@@ -0,0 +1,33 @@
import { WebContents } from "electron";
type SeewoHugoCentralLambda = any;
type SeewoHugoGlobalConfig = Record<any, any>;
type WindowName = string;
interface LauncherArgs {
central: SeewoHugoCentralLambda;
windowName: WindowName;
config: SeewoHugoGlobalConfig;
}
interface HookedWindow {
webContents: WebContents;
domReadyListener: any;
destroyedListener: any;
}
type HookedWindowsMap = Map<WindowName, HookedWindow>;
type HookRequire = any;
type HooksMap = Map<WindowName, HookRequire>;
interface MainProcessGlobal {
hookedWindows: HookedWindowsMap;
hooks: HooksMap;
configInit: boolean;
plsStats: PLSStatus | null;
plsSettings: Record<any, any> | null;
plsRules: Record<any, any> | null;
}

10
src/aura/types/main/electron.d.ts vendored Executable file
View File

@@ -0,0 +1,10 @@
import { IpcMain, WebContents } from "electron";
interface AuraIPCMain extends IpcMain {
send: (
windowKey: string,
channel: string,
data: any,
grep?: WebContents
) => void;
}

14
src/aura/types/render/global.d.ts vendored Executable file
View File

@@ -0,0 +1,14 @@
interface HugoAuraGlobal {
utils: Record<any, any>;
}
interface AssistantHugoAuraGlobal extends HugoAuraGlobal {
plsStatus: PLSStatus;
plsRules: Record<any, any>;
plsSettings: Record<any, any>;
}
interface DesktopAssistantHugoAuraGlobal extends HugoAuraGlobal {
plsWs: WebSocket | null;
plsStats: PLSStatus;
}

25
src/aura/types/render/uiHook.d.ts vendored Executable file
View File

@@ -0,0 +1,25 @@
import { WindowName } from "../main/core";
interface UIHookTarget {
active: boolean;
pageURI: string;
pageScript: string;
pageSelector: string;
selectorMode: "insertAfter" | "insertBefore" | "appendChild";
pageCSS: string;
revive?: boolean;
}
type AuraElementUID = string;
type OnLoadedEvalJS = string;
interface UIHookConfig {
targets: Record<AuraElementUID, UIHookTarget>;
globalStyles: string[];
globalJS: string[];
onLoaded: OnLoadedEvalJS;
}
interface UIHookConfigFin extends UIHookConfig {
windowName: WindowName;
}

9
src/aura/types/shared/pls/status.d.ts vendored Executable file
View File

@@ -0,0 +1,9 @@
interface PLSStatus {
installed: boolean;
detached: boolean;
connected: boolean;
launched: boolean;
status: string;
version: string;
authToken: string;
}

18
src/aura/types/shared/pls/websocket.d.ts vendored Executable file
View File

@@ -0,0 +1,18 @@
interface ClientPLSRequest {
method: string;
data: Record<any, any>;
eventId: string;
}
interface PLSResponse {
success: boolean;
code: number;
data: Record<any, any>;
eventId: string;
}
interface PLSPush {
success: boolean;
type: string;
data: Record<any, any>;
}