-
Notifications
You must be signed in to change notification settings - Fork 18
/
accessibility.ts
48 lines (41 loc) · 1.25 KB
/
accessibility.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
namespace accessibility {
export interface AccessibilityMessage {
type: "text" | "tile" | "rule" | "led" | "note"
force?: boolean
}
export interface TextAccessibilityMessage extends AccessibilityMessage {
type: "text"
value: string
}
export interface LEDAccessibilityMessage extends AccessibilityMessage {
type: "led"
on: boolean
x: number
y: number
}
export interface NoteAccessibilityMessage extends AccessibilityMessage {
type: "note"
on: boolean
index: number
}
export interface TileAccessibilityMessage extends AccessibilityMessage {
type: "tile"
value: string
}
export interface RuleAccessibilityMessage extends AccessibilityMessage {
type: "rule"
dos: string[]
whens: string[]
}
/**
* Notifies web application about the current content.
*/
//% shim=TD_ID
export function setLiveContent(msg: AccessibilityMessage) {
const data = Buffer.fromUTF8(JSON.stringify(msg))
control.simmessages.send("accessibility", data)
}
export function ariaToTooltip(ariaId: string) {
return microcode.resolveTooltip(ariaId).replaceAll("_", " ")
}
}