forked from davidtodd/landmarks
-
Notifications
You must be signed in to change notification settings - Fork 7
/
globals.d.ts
44 lines (38 loc) · 1.54 KB
/
globals.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
declare namespace chrome {
declare namespace sidebarAction {
function toggle(): void
}
}
var browser: typeof chrome
// NOTE: Must match build script
var BROWSER: 'firefox' | 'chrome' | 'opera' | 'edge'
var INTERFACE: 'popup' | 'sidebar' | 'devtools'
var DEBUG: boolean
type LabelFontColour = 'black' | 'white'
type PageWarning = 'lintNoMain' | 'lintManyMains' | 'lintManyVisibleMainElements' | 'lintDuplicateUnlabelled'
// NOTE: The '| null' pattern is used to keep the shape of the objects consistent, for perf.
// TODO: Check whether switching to '<key>?: <primary-type>' definitions affects perf.
// TODO: ...and adjust the '?' properties accordingly.
type LandmarkEntry = {
type: 'landmark'
element: HTMLElement
selector: string
role: string
roleDescription: string | null
label: string | null
guessed: boolean
previous?: LandmarkEntry // TODO: should only be in Tree entry?
next?: LandmarkEntry // TODO: should only be in Tree entry?
warnings?: PageWarning[]
selectorWasUpdated?: boolean
index?: number // NOTE: only on list entries
contains: LandmarkEntry[]
debug: string
level: LandmarkEntry[]
index?: number
}
type LandmarkElementInfo = Pick<LandmarkEntry, "element" | "role" | "roleDescription" | "label" | "guessed">
type FilteredLandmarkEntry = Omit<LandmarkEntry, "debug" | "level" | "element" | "selectorWasUpdated" | "previous" | "next" | "contains">
interface FilteredLandmarkTreeEntry extends Omit<LandmarkEntry, "debug" | "level" | "element" | "selectorWasUpdated" | "previous" | "next"> {
contains: FilteredLandmarkTreeEntry[]
}