spiegel-keyman/web/source/osk/defaultLayouts.ts

342 lines
No EOL
17 KiB
TypeScript

/***
KeymanWeb 10.0
Copyright 2017 SIL International
***/
namespace com.keyman.osk {
// The following types provide type definitions for the full JSON format we use for visual keyboard definitions.
export type LayoutKey = {
"id"?: string,
"text"?: string,
"sp"?: number|"0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"10",
"width"?: string,
"nextlayer"?: string,
"pad"?: string,
"sk"?: LayoutKey[]
}
export type LayoutRow = {
"id": string, // represents a number, though...
"key": LayoutKey[]
};
export type LayoutLayer = {
"id": string,
"row": LayoutRow[]
}
export type LayoutFormFactor = {
"font": string,
"layer": LayoutLayer[]
}
export type LayoutSpec = {
"desktop"?: LayoutFormFactor,
"phone"?: LayoutFormFactor,
"tablet"?: LayoutFormFactor
}
// This class manages default layout construction for consumption by OSKs without a specified layout.
export class Layouts {
// Defines the default visual layout for a keyboard.
static dfltLayout: LayoutSpec = {
"desktop":
{
"font": "Tahoma,Helvetica",
"layer": [
{
"id": "default",
"row": [
{
"id": "1",
"key": [
{ "id": "K_BKQUOTE" },
{ "id": "K_1" },
{ "id": "K_2" },
{ "id": "K_3" },
{ "id": "K_4" },
{ "id": "K_5" },
{ "id": "K_6" },
{ "id": "K_7" },
{ "id": "K_8" },
{ "id": "K_9" },
{ "id": "K_0" },
{ "id": "K_HYPHEN" },
{ "id": "K_EQUAL" },
{ "id": "K_BKSP", "text": "*BkSp*", "sp": "1", "width": "130" }
]
},
{
"id": "2",
"key": [
{ "id": "K_TAB", "text": "*Tab*", "sp": "1", "width": "130" },
{ "id": "K_Q" },
{ "id": "K_W" },
{ "id": "K_E" },
{ "id": "K_R" },
{ "id": "K_T" },
{ "id": "K_Y" },
{ "id": "K_U" },
{ "id": "K_I" },
{ "id": "K_O" },
{ "id": "K_P" },
{ "id": "K_LBRKT" },
{ "id": "K_RBRKT" },
{ "id": "K_BKSLASH" }
]
},
{
"id": "3",
"key": [
{ "id": "K_CAPS", "text": "*Caps*", "sp": "1", "width": "165" },
{ "id": "K_A" },
{ "id": "K_S" },
{ "id": "K_D" },
{ "id": "K_F" },
{ "id": "K_G" },
{ "id": "K_H" },
{ "id": "K_J" },
{ "id": "K_K" },
{ "id": "K_L" },
{ "id": "K_COLON" },
{ "id": "K_QUOTE" },
{ "id": "K_ENTER", "text": "*Enter*", "sp": "1", "width": "165" }
]
},
{
"id": "4",
"key": [
{ "id": "K_SHIFT", "text": "*Shift*", "sp": "1", "width": "130" },
{ "id": "K_oE2" },
{ "id": "K_Z" },
{ "id": "K_X" },
{ "id": "K_C" },
{ "id": "K_V" },
{ "id": "K_B" },
{ "id": "K_N" },
{ "id": "K_M" },
{ "id": "K_COMMA" },
{ "id": "K_PERIOD" },
{ "id": "K_SLASH" },
{ "id": "K_RSHIFT", "text": "*Shift*", "sp": "1", "width": "130" }
]
},
{
"id": "5",
"key": [
{ "id": "K_LCONTROL", "text": "*Ctrl*", "sp": "1", "width": "170" },
{ "id": "K_LALT", "text": "*Alt*", "sp": "1", "width": "160" },
{ "id": "K_SPACE", "text": "", "width": "770" },
{ "id": "K_RALT", "text": "*Alt*", "sp": "1", "width": "160" },
{ "id": "K_RCONTROL", "text": "*Ctrl*", "sp": "1", "width": "170" }
]
}
]
}
]
},
"tablet":
{
"font": "Tahoma,Helvetica",
"layer": [
{
"id": "default",
"row": [
{
"id": "0",
"key": [
{ "id": "K_1" },
{ "id": "K_2" },
{ "id": "K_3" },
{ "id": "K_4" },
{ "id": "K_5" },
{ "id": "K_6" },
{ "id": "K_7" },
{ "id": "K_8" },
{ "id": "K_9" },
{ "id": "K_0" },
{ "id": "K_HYPHEN" },
{ "id": "K_EQUAL" },
{ "sp": "10", "width": "1" }
]
},
{
"id": "1",
"key": [
{ "id": "K_Q", "pad": "25" },
{ "id": "K_W" },
{ "id": "K_E" },
{ "id": "K_R" },
{ "id": "K_T" },
{ "id": "K_Y" },
{ "id": "K_U" },
{ "id": "K_I" },
{ "id": "K_O" },
{ "id": "K_P" },
{ "id": "K_LBRKT" },
{ "id": "K_RBRKT" },
{ "sp": "10", "width": "1" }
]
},
{
"id": "2",
"key": [
{ "id": "K_A", "pad": "50" },
{ "id": "K_S" },
{ "id": "K_D" },
{ "id": "K_F" },
{ "id": "K_G" },
{ "id": "K_H" },
{ "id": "K_J" },
{ "id": "K_K" },
{ "id": "K_L" },
{ "id": "K_COLON" },
{ "id": "K_QUOTE" },
{ "id": "K_BKSLASH", "width": "90" }
]
},
{
"id": "3",
"key": [
{ "id": "K_oE2", "width": "90" },
{ "id": "K_Z" },
{ "id": "K_X" },
{ "id": "K_C" },
{ "id": "K_V" },
{ "id": "K_B" },
{ "id": "K_N" },
{ "id": "K_M" },
{ "id": "K_COMMA" },
{ "id": "K_PERIOD" },
{ "id": "K_SLASH" },
{ "id": "K_BKQUOTE" },
{ "sp": "10", "width": "1" }
]
},
{
"id": "4",
"key": [
{
"id": "K_SHIFT", "text": "*Shift*", "sp": "1", "width": "200", "sk": [
{ "id": "K_LCONTROL", "text": "*Ctrl*", "sp": "1", "width": "50", "nextlayer": "ctrl" },
{ "id": "K_LCONTROL", "text": "*LCtrl*", "sp": "1", "width": "50", "nextlayer": "leftctrl" },
{ "id": "K_RCONTROL", "text": "*RCtrl*", "sp": "1", "width": "50", "nextlayer": "rightctrl" },
{ "id": "K_LALT", "text": "*Alt*", "sp": "1", "width": "50", "nextlayer": "alt" },
{ "id": "K_LALT", "text": "*LAlt*", "sp": "1", "width": "50", "nextlayer": "leftalt" },
{ "id": "K_RALT", "text": "*RAlt*", "sp": "1", "width": "50", "nextlayer": "rightalt" },
{ "id": "K_ALTGR", "text": "*AltGr*", "sp": "1", "width": "50", "nextlayer": "ctrl-alt" }]
},
{ "id": "K_LOPT", "text": "*Menu*", "sp": "1", "width": "150" },
{ "id": "K_SPACE", "text": "", "width": "570" },
{ "id": "K_BKSP", "text": "*BkSp*", "sp": "1", "width": "150" },
{ "id": "K_ENTER", "text": "*Enter*", "sp": "1", "width": "200" }
]
}
]
}
]
},
"phone":
{
"font": "Tahoma,Helvetica",
"layer": [
{
"id": "default",
"row": [
{
"id": "0",
"key": [
{ "id": "K_1" },
{ "id": "K_2" },
{ "id": "K_3" },
{ "id": "K_4" },
{ "id": "K_5" },
{ "id": "K_6" },
{ "id": "K_7" },
{ "id": "K_8" },
{ "id": "K_9" },
{ "id": "K_0" },
{ "id": "K_HYPHEN" },
{ "id": "K_EQUAL" },
{ "sp": "10", "width": "1" }
]
},
{
"id": "1",
"key": [
{ "id": "K_Q", "pad": "25" },
{ "id": "K_W" },
{ "id": "K_E" },
{ "id": "K_R" },
{ "id": "K_T" },
{ "id": "K_Y" },
{ "id": "K_U" },
{ "id": "K_I" },
{ "id": "K_O" },
{ "id": "K_P" },
{ "id": "K_LBRKT" },
{ "id": "K_RBRKT" },
{ "sp": "10", "width": "1" }
]
},
{
"id": "2",
"key": [
{ "id": "K_A", "pad": "50" },
{ "id": "K_S" },
{ "id": "K_D" },
{ "id": "K_F" },
{ "id": "K_G" },
{ "id": "K_H" },
{ "id": "K_J" },
{ "id": "K_K" },
{ "id": "K_L" },
{ "id": "K_COLON" },
{ "id": "K_QUOTE" },
{ "id": "K_BKSLASH", "width": "90" }
]
},
{
"id": "3",
"key": [
{ "id": "K_oE2", "width": "90" },
{ "id": "K_Z" },
{ "id": "K_X" },
{ "id": "K_C" },
{ "id": "K_V" },
{ "id": "K_B" },
{ "id": "K_N" },
{ "id": "K_M" },
{ "id": "K_COMMA" },
{ "id": "K_PERIOD" },
{ "id": "K_SLASH" },
{ "id": "K_BKQUOTE" },
{ "sp": "10", "width": "1" }
]
},
{
"id": "4",
"key": [
{
"id": "K_SHIFT", "text": "*Shift*", "sp": "1", "width": "200", "sk": [
{ "id": "K_LCONTROL", "text": "*Ctrl*", "sp": "1", "width": "50", "nextlayer": "ctrl" },
{ "id": "K_LCONTROL", "text": "*LCtrl*", "sp": "1", "width": "50", "nextlayer": "leftctrl" },
{ "id": "K_RCONTROL", "text": "*RCtrl*", "sp": "1", "width": "50", "nextlayer": "rightctrl" },
{ "id": "K_LALT", "text": "*Alt*", "sp": "1", "width": "50", "nextlayer": "alt" },
{ "id": "K_LALT", "text": "*LAlt*", "sp": "1", "width": "50", "nextlayer": "leftalt" },
{ "id": "K_RALT", "text": "*RAlt*", "sp": "1", "width": "50", "nextlayer": "rightalt" },
{ "id": "K_ALTGR", "text": "*AltGr*", "sp": "1", "width": "50", "nextlayer": "ctrl-alt" }]
},
{ "id": "K_LOPT", "text": "*Menu*", "width": "150", "sp": "1" },
{ "id": "K_SPACE", "width": "570", "text": "" },
{ "id": "K_BKSP", "text": "*BkSp*", "width": "150", "sp": "1" },
{ "id": "K_ENTER", "text": "*Enter*", "width": "200", "sp": "1" }
]
}
]
}
]
}
};
}
}