-
-
Notifications
You must be signed in to change notification settings - Fork 263
/
Copy pathbase.omni.d.ts
62 lines (60 loc) · 1.73 KB
/
base.omni.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/// <reference path="../typings/lib/window.d.ts" />
declare namespace VomnibarNS {
interface BaseFgOptions extends Pick<CmdOptions[kFgCmd.vomnibar], "s" | "t"> {
w: [hostInnerWidth: number, hostInnerHeight: number, devicePixelRatio: number]
p: "" | FgRes[kFgReq.parseSearchUrl];
}
interface FgOptions extends BaseFgOptions, Partial<GlobalOptions> {
url?: string | null;
}
type MessageData = [id: "VimiumC", secret: string, options: FgOptions | null]
interface Msg<T extends (kCReq | kFReq) & number> { N: T }
const enum kCReq {
activate, hide, focus,
_mask = "",
}
const enum kFReq {
hide, focus, style, iframeIsAlive, hud,
evalJS, scroll, scrollGoing, stopScroll, broken,
unload, scaled_old_cr,
_mask = "",
}
interface CReq {
[kCReq.activate]: FgOptions & Msg<kCReq.activate>;
[kCReq.hide]: kCReq.hide;
[kCReq.focus]: kCReq.focus;
}
interface FReq {
[kFReq.hide]: {
};
[kFReq.scroll]: {
/** key */ k: string;
/** keybody */ b: kChar;
};
[kFReq.style]: {
// unit: physical pixel (if C<52)
/** current height */ h: number
};
[kFReq.hud]: { k: kTip };
[kFReq.focus]: {
/** lastKey */ l: kKeyCode;
};
[kFReq.evalJS]: {
u: string;
};
[kFReq.broken]: {};
[kFReq.stopScroll]: {}
[kFReq.scrollGoing]: {};
[kFReq.unload]: {};
[kFReq.iframeIsAlive]: { /** hasOptionsPassed */ o: BOOL };
[kFReq.scaled_old_cr]: { t: string }
}
interface IframePort {
postMessage<K extends keyof FReq> (this: IframePort, msg: FReq[K] & Msg<K>): void | 1;
onmessage (this: void, msg: { data: CReq[keyof CReq] }): void | 1;
}
type FgOptionsToFront = CReq[kCReq.activate];
interface ContentOptions extends GlobalOptions {
/** on Firefox and has filter (maybe from dark reader's Filter(+) mode) */ d?: boolean | 0
}
}