Repository navigation
Expand file tree
/
Copy pathkeyboardLayout.ts
More file actions
130 lines (120 loc) · 3.06 KB
/
Copy pathkeyboardLayout.ts
File metadata and controls
130 lines (120 loc) · 3.06 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
export const LETTER_ROWS: string[][] = [
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
["a", "s", "d", "f", "g", "h", "j", "k", "l"],
["z", "x", "c", "v", "b", "n", "m"],
];
export type T9Key = {
digit: string;
letters: string;
};
export const T9_KEYS: T9Key[] = [
{ digit: "1", letters: "@./" },
{ digit: "2", letters: "ABC" },
{ digit: "3", letters: "DEF" },
{ digit: "4", letters: "GHI" },
{ digit: "5", letters: "JKL" },
{ digit: "6", letters: "MNO" },
{ digit: "7", letters: "PQRS" },
{ digit: "8", letters: "TUV" },
{ digit: "9", letters: "WXYZ" },
];
export const NUMERIC_SYMBOLS = [
{ label: "+", value: "+" },
{ label: "-", value: "-" },
{ label: "×", value: "*" },
{ label: "/", value: "/" },
{ label: "(", value: "(" },
{ label: ")", value: ")" },
{ label: ".", value: "." },
{ label: "=", value: "=" },
{ label: ",", value: "," },
{ label: "#", value: "#" },
{ label: ":", value: ":" },
{ label: "_", value: "_" },
{ label: "?", value: "?" },
{ label: "¥", value: "¥" },
];
export const NATIVE_NUMERIC_MAIN_ROWS = [
"1234567890".split(""),
["-", "/", ":", ";", "(", ")", "$", "@", "“", "”"],
];
export const NATIVE_NUMERIC_ENGLISH_SYMBOL_ROW = [
"-", "/", ":", ";", "(", ")", "$", "@", '"', "'",
];
export const NATIVE_NUMERIC_LAST_ROW = {
chinese: ["#+=", "°", ",", "、", "?", "!", "。", "{delete}"],
english: ["#+=", "°", ",", "\\", "?", "!", ".", "{delete}"],
};
export const NATIVE_NUMERIC_MORE_ROWS = {
chinese: [
["【", "】", "{", "}", "#", "%", "^", "*", "+", "="],
["_", "—", "\\", "|", "~", "《", "》", "€", "&", "·"],
["123", "…", ",", "^_^", "?", "!", "’", "{delete}"],
],
english: [
["[", "]", "{", "}", "#", "%", "^", "*", "+", "="],
["_", "\\", "|", "~", "<", ">", "€", "£", "¥", "•"],
["123", ".", ",", "?", "!", "'", "{delete}"],
],
};
export function nativeNumericKeyId(
label: string,
rowIndex: number,
index: number,
moreSymbols: boolean,
fromEnglish: boolean,
) {
if (rowIndex === 3) {
return ["numeric-abc", "numeric-space", "numeric-enter"][index];
}
if (label === "{delete}") return "numeric-backspace";
if (label === "=") return "numeric-equal";
if (rowIndex === 0) return `numeric-${label}`;
return `native-numeric-${fromEnglish ? "english-" : ""}${
moreSymbols ? "more" : "main"
}-${rowIndex}-${index}`;
}
export const NATIVE_NUMERIC_RIME_INPUT: Record<string, string> = {
"“": '"',
"”": '"',
"【": "[",
"】": "]",
"—": "-",
"~": "~",
"《": "<",
"》": ">",
",": ",",
"、": "\\",
"。": ".",
"·": ".",
"…": "...",
"’": "'",
};
export const BACKSLASH_SYMBOLS: Record<string, string> = {
a: "[a]",
b: "【b】",
c: "❲c❳",
d: "〔d〕",
e: "⟮e⟯",
f: "⟦f⟧",
g: "「g」",
h: "#",
i: "『i』",
j: "<j>",
k: "《k》",
l: "〈l〉",
m: "‹m›",
n: "«n»",
o: "⦅o⦆",
p: "⦇p⦈",
q: "(q)",
r: "儿",
s: "[s]",
t: "⟨t⟩",
u: "[u]",
v: "❰v❱",
w: "(w)",
x: "{x}",
y: "⟪y⟫",
z: "{z}",
};