mirror of https://github.com/jetkvm/kvm.git
File formatting pass
This commit is contained in:
parent
b2d657beaa
commit
2037c9d478
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"mounts": [
|
"mounts": [
|
||||||
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
|
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
|
||||||
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
|
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
|
||||||
],
|
],
|
||||||
"onCreateCommand": ".devcontainer/install-deps.sh",
|
"onCreateCommand": ".devcontainer/install-deps.sh",
|
||||||
"customizations": {
|
"customizations": {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
"action_bar_web_terminal": "网页终端",
|
"action_bar_web_terminal": "网页终端",
|
||||||
"action_bar_wake_on_lan": "局域网唤醒",
|
"action_bar_wake_on_lan": "局域网唤醒",
|
||||||
"action_bar_virtual_keyboard": "虚拟键盘",
|
"action_bar_virtual_keyboard": "虚拟键盘",
|
||||||
"action_bar_extension": "扩展",
|
"action_bar_extension": "扩展",
|
||||||
"action_bar_connection_stats": "连接统计",
|
"action_bar_connection_stats": "连接统计",
|
||||||
"action_bar_settings": "设置",
|
"action_bar_settings": "设置",
|
||||||
"action_bar_fullscreen": "全屏",
|
"action_bar_fullscreen": "全屏",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export const DEFAULT_DELAY = 50;
|
export const DEFAULT_DELAY = 50;
|
||||||
export const MAX_STEPS_PER_MACRO = 10;
|
export const MAX_STEPS_PER_MACRO = 10;
|
||||||
export const MAX_KEYS_PER_STEP = 10;
|
export const MAX_KEYS_PER_STEP = 10;
|
||||||
export const MAX_TOTAL_MACROS = 25;
|
export const MAX_TOTAL_MACROS = 25;
|
||||||
export const COPY_SUFFIX = "(copy)";
|
export const COPY_SUFFIX = "(copy)";
|
||||||
|
|
@ -270,9 +270,8 @@ export class KeyboardMacroReportMessage extends RpcMessage {
|
||||||
...keys,
|
...keys,
|
||||||
...fromUint16toUint8(step.delay),
|
...fromUint16toUint8(step.delay),
|
||||||
]);
|
]);
|
||||||
const offset = 6 + i * 9;
|
|
||||||
|
|
||||||
|
const offset = 6 + i * 9;
|
||||||
data.set(macroBinary, offset);
|
data.set(macroBinary, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,10 @@ export interface UIState {
|
||||||
|
|
||||||
export const useUiStore = create<UIState>(set => ({
|
export const useUiStore = create<UIState>(set => ({
|
||||||
terminalType: "none",
|
terminalType: "none",
|
||||||
setTerminalType: (type: UIState["terminalType"]) => set({ terminalType: type }),
|
setTerminalType: (type: UIState["terminalType"]) => set({ terminalType: type }),
|
||||||
|
|
||||||
sidebarView: null,
|
sidebarView: null,
|
||||||
setSidebarView: (view: AvailableSidebarViews | null) => set({ sidebarView: view }),
|
setSidebarView: (view: AvailableSidebarViews | null) => set({ sidebarView: view }),
|
||||||
|
|
||||||
disableVideoFocusTrap: false,
|
disableVideoFocusTrap: false,
|
||||||
setDisableVideoFocusTrap: (enabled: boolean) => set({ disableVideoFocusTrap: enabled }),
|
setDisableVideoFocusTrap: (enabled: boolean) => set({ disableVideoFocusTrap: enabled }),
|
||||||
|
|
@ -195,7 +195,7 @@ export const useRTCStore = create<RTCState>(set => ({
|
||||||
videoStreamStatsHistory: new Map(),
|
videoStreamStatsHistory: new Map(),
|
||||||
|
|
||||||
isTurnServerInUse: false,
|
isTurnServerInUse: false,
|
||||||
setTurnServerInUse: (inUse: boolean) => set({ isTurnServerInUse: inUse }),
|
setTurnServerInUse: (inUse: boolean) => set({ isTurnServerInUse: inUse }),
|
||||||
|
|
||||||
inboundRtpStats: new Map(),
|
inboundRtpStats: new Map(),
|
||||||
appendInboundRtpStats: (stats: RTCInboundRtpStreamStats) => {
|
appendInboundRtpStats: (stats: RTCInboundRtpStreamStats) => {
|
||||||
|
|
@ -461,11 +461,11 @@ export const hidKeyBufferSize = 6;
|
||||||
export const hidErrorRollOver = 0x01;
|
export const hidErrorRollOver = 0x01;
|
||||||
|
|
||||||
export interface KeysDownState {
|
export interface KeysDownState {
|
||||||
modifier: number;
|
modifier: number;
|
||||||
keys: number[];
|
keys: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type USBStates =
|
export type USBStates =
|
||||||
| "configured"
|
| "configured"
|
||||||
| "attached"
|
| "attached"
|
||||||
| "not attached"
|
| "not attached"
|
||||||
|
|
@ -493,7 +493,7 @@ export const useHidStore = create<HidState>(set => ({
|
||||||
keyboardLedState: { num_lock: false, caps_lock: false, scroll_lock: false, compose: false, kana: false, shift: false } as KeyboardLedState,
|
keyboardLedState: { num_lock: false, caps_lock: false, scroll_lock: false, compose: false, kana: false, shift: false } as KeyboardLedState,
|
||||||
setKeyboardLedState: (ledState: KeyboardLedState): void => set({ keyboardLedState: ledState }),
|
setKeyboardLedState: (ledState: KeyboardLedState): void => set({ keyboardLedState: ledState }),
|
||||||
|
|
||||||
keysDownState: { modifier: 0, keys: [0,0,0,0,0,0] } as KeysDownState,
|
keysDownState: { modifier: 0, keys: [0, 0, 0, 0, 0, 0] } as KeysDownState,
|
||||||
setKeysDownState: (state: KeysDownState): void => set({ keysDownState: state }),
|
setKeysDownState: (state: KeysDownState): void => set({ keysDownState: state }),
|
||||||
|
|
||||||
isVirtualKeyboardEnabled: false,
|
isVirtualKeyboardEnabled: false,
|
||||||
|
|
@ -521,34 +521,34 @@ export type UpdateModalViews =
|
||||||
| "error";
|
| "error";
|
||||||
|
|
||||||
export interface OtaState {
|
export interface OtaState {
|
||||||
updating: boolean;
|
updating: boolean;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
|
|
||||||
metadataFetchedAt: string | null;
|
metadataFetchedAt: string | null;
|
||||||
|
|
||||||
// App update
|
// App update
|
||||||
appUpdatePending: boolean;
|
appUpdatePending: boolean;
|
||||||
|
|
||||||
appDownloadProgress: number;
|
appDownloadProgress: number;
|
||||||
appDownloadFinishedAt: string | null;
|
appDownloadFinishedAt: string | null;
|
||||||
|
|
||||||
appVerificationProgress: number;
|
appVerificationProgress: number;
|
||||||
appVerifiedAt: string | null;
|
appVerifiedAt: string | null;
|
||||||
|
|
||||||
appUpdateProgress: number;
|
appUpdateProgress: number;
|
||||||
appUpdatedAt: string | null;
|
appUpdatedAt: string | null;
|
||||||
|
|
||||||
// System update
|
// System update
|
||||||
systemUpdatePending: boolean;
|
systemUpdatePending: boolean;
|
||||||
|
|
||||||
systemDownloadProgress: number;
|
systemDownloadProgress: number;
|
||||||
systemDownloadFinishedAt: string | null;
|
systemDownloadFinishedAt: string | null;
|
||||||
|
|
||||||
systemVerificationProgress: number;
|
systemVerificationProgress: number;
|
||||||
systemVerifiedAt: string | null;
|
systemVerifiedAt: string | null;
|
||||||
|
|
||||||
systemUpdateProgress: number;
|
systemUpdateProgress: number;
|
||||||
systemUpdatedAt: string | null;
|
systemUpdatedAt: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface UpdateState {
|
export interface UpdateState {
|
||||||
|
|
@ -603,7 +603,7 @@ export type UsbConfigModalViews =
|
||||||
| "updateUsbConfigSuccess";
|
| "updateUsbConfigSuccess";
|
||||||
|
|
||||||
export interface UsbConfigModalState {
|
export interface UsbConfigModalState {
|
||||||
modalView: UsbConfigModalViews ;
|
modalView: UsbConfigModalViews;
|
||||||
errorMessage: string | null;
|
errorMessage: string | null;
|
||||||
setModalView: (view: UsbConfigModalViews) => void;
|
setModalView: (view: UsbConfigModalViews) => void;
|
||||||
setErrorMessage: (message: string | null) => void;
|
setErrorMessage: (message: string | null) => void;
|
||||||
|
|
@ -620,7 +620,7 @@ export interface UsbConfigState {
|
||||||
export const useUsbConfigModalStore = create<UsbConfigModalState>(set => ({
|
export const useUsbConfigModalStore = create<UsbConfigModalState>(set => ({
|
||||||
modalView: "updateUsbConfig",
|
modalView: "updateUsbConfig",
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
setModalView: (view: UsbConfigModalViews) => set({ modalView: view }),
|
setModalView: (view: UsbConfigModalViews) => set({ modalView: view }),
|
||||||
setErrorMessage: (message: string | null) => set({ errorMessage: message }),
|
setErrorMessage: (message: string | null) => set({ errorMessage: message }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -633,13 +633,13 @@ export type LocalAuthModalViews =
|
||||||
| "updateSuccess";
|
| "updateSuccess";
|
||||||
|
|
||||||
export interface LocalAuthModalState {
|
export interface LocalAuthModalState {
|
||||||
modalView:LocalAuthModalViews;
|
modalView: LocalAuthModalViews;
|
||||||
setModalView: (view:LocalAuthModalViews) => void;
|
setModalView: (view: LocalAuthModalViews) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useLocalAuthModalStore = create<LocalAuthModalState>(set => ({
|
export const useLocalAuthModalStore = create<LocalAuthModalState>(set => ({
|
||||||
modalView: "createPassword",
|
modalView: "createPassword",
|
||||||
setModalView: (view: LocalAuthModalViews) => set({ modalView: view }),
|
setModalView: (view: LocalAuthModalViews) => set({ modalView: view }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export interface DeviceState {
|
export interface DeviceState {
|
||||||
|
|
@ -779,12 +779,12 @@ export interface MacrosState {
|
||||||
loadMacros: () => Promise<void>;
|
loadMacros: () => Promise<void>;
|
||||||
saveMacros: (macros: KeySequence[]) => Promise<void>;
|
saveMacros: (macros: KeySequence[]) => Promise<void>;
|
||||||
sendFn:
|
sendFn:
|
||||||
| ((
|
| ((
|
||||||
method: string,
|
method: string,
|
||||||
params: unknown,
|
params: unknown,
|
||||||
callback?: ((resp: JsonRpcResponse) => void) | undefined,
|
callback?: ((resp: JsonRpcResponse) => void) | undefined,
|
||||||
) => void)
|
) => void)
|
||||||
| null;
|
| null;
|
||||||
setSendFn: (
|
setSendFn: (
|
||||||
sendFn: (
|
sendFn: (
|
||||||
method: string,
|
method: string,
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ export function useHidRpc(onHidRpcMessage?: (payload: RpcMessage) => void) {
|
||||||
}: sendMessageParams = {},
|
}: sendMessageParams = {},
|
||||||
) => {
|
) => {
|
||||||
if (hidRpcDisabled) return;
|
if (hidRpcDisabled) return;
|
||||||
if (rpcHidChannel?.readyState !== "open") return;
|
if (rpcHidChannel?.readyState !== "open") return;
|
||||||
if (!rpcHidReady && !ignoreHandshakeState) return;
|
if (!rpcHidReady && !ignoreHandshakeState) return;
|
||||||
|
|
||||||
let data: Uint8Array | undefined;
|
let data: Uint8Array | undefined;
|
||||||
|
|
@ -163,7 +163,7 @@ export function useHidRpc(onHidRpcMessage?: (payload: RpcMessage) => void) {
|
||||||
(message: HandshakeMessage) => {
|
(message: HandshakeMessage) => {
|
||||||
if (hidRpcDisabled) return;
|
if (hidRpcDisabled) return;
|
||||||
|
|
||||||
if (!message.version) {
|
if (!message.version) {
|
||||||
console.error("Received handshake message without version", message);
|
console.error("Received handshake message without version", message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -238,7 +238,7 @@ export function useHidRpc(onHidRpcMessage?: (payload: RpcMessage) => void) {
|
||||||
setRpcHidProtocolVersion,
|
setRpcHidProtocolVersion,
|
||||||
sendHandshake,
|
sendHandshake,
|
||||||
handleHandshake,
|
handleHandshake,
|
||||||
hidRpcDisabled,
|
hidRpcDisabled,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export function useJsonRpc(onRequest?: (payload: JsonRpcRequest) => void) {
|
||||||
rpcDataChannel.removeEventListener("message", messageHandler);
|
rpcDataChannel.removeEventListener("message", messageHandler);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[rpcDataChannel, onRequest]);
|
[rpcDataChannel, onRequest]);
|
||||||
|
|
||||||
return { send };
|
return { send };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,8 @@ export default function useKeyboard() {
|
||||||
// support the keyPressReport API. In that case, we need to handle the key presses locally
|
// support the keyPressReport API. In that case, we need to handle the key presses locally
|
||||||
// and send the full state to the device, so it can behave like a real USB HID keyboard.
|
// and send the full state to the device, so it can behave like a real USB HID keyboard.
|
||||||
// This flag indicates whether the keyPressReport API is available on the device which is
|
// This flag indicates whether the keyPressReport API is available on the device which is
|
||||||
// dynamically set when the device responds to the first key press event or reports its // keysDownState when queried since the keyPressReport was introduced together with the
|
// dynamically set when the device responds to the first key press event or reports its
|
||||||
|
// keysDownState when queried since the keyPressReport was introduced together with the
|
||||||
// getKeysDownState API.
|
// getKeysDownState API.
|
||||||
|
|
||||||
// HidRPC is a binary format for exchanging keyboard and mouse events
|
// HidRPC is a binary format for exchanging keyboard and mouse events
|
||||||
|
|
@ -277,7 +278,6 @@ export default function useKeyboard() {
|
||||||
cancelKeepAlive();
|
cancelKeepAlive();
|
||||||
}, [cancelKeepAlive]);
|
}, [cancelKeepAlive]);
|
||||||
|
|
||||||
|
|
||||||
// executeMacro is used to execute a macro consisting of multiple steps.
|
// executeMacro is used to execute a macro consisting of multiple steps.
|
||||||
// Each step can have multiple keys, multiple modifiers and a delay.
|
// Each step can have multiple keys, multiple modifiers and a delay.
|
||||||
// The keys and modifiers are pressed together and held for the delay duration.
|
// The keys and modifiers are pressed together and held for the delay duration.
|
||||||
|
|
@ -306,6 +306,7 @@ export default function useKeyboard() {
|
||||||
|
|
||||||
sendKeyboardMacroEventHidRpc(macro);
|
sendKeyboardMacroEventHidRpc(macro);
|
||||||
}, [sendKeyboardMacroEventHidRpc]);
|
}, [sendKeyboardMacroEventHidRpc]);
|
||||||
|
|
||||||
const executeMacroClientSide = useCallback(async (steps: MacroSteps) => {
|
const executeMacroClientSide = useCallback(async (steps: MacroSteps) => {
|
||||||
const promises: (() => Promise<void>)[] = [];
|
const promises: (() => Promise<void>)[] = [];
|
||||||
|
|
||||||
|
|
@ -355,6 +356,7 @@ export default function useKeyboard() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, [sendKeystrokeLegacy, resetKeyboardState, setAbortController]);
|
}, [sendKeystrokeLegacy, resetKeyboardState, setAbortController]);
|
||||||
|
|
||||||
const executeMacro = useCallback(async (steps: MacroSteps) => {
|
const executeMacro = useCallback(async (steps: MacroSteps) => {
|
||||||
if (rpcHidReady) {
|
if (rpcHidReady) {
|
||||||
return executeMacroRemote(steps);
|
return executeMacroRemote(steps);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export default function useKeyboardLayout() {
|
||||||
const selectedKeyboard = useMemo(() => {
|
const selectedKeyboard = useMemo(() => {
|
||||||
// fallback to original behaviour of en-US if no isoCode given or matching layout not found
|
// fallback to original behaviour of en-US if no isoCode given or matching layout not found
|
||||||
return keyboards.find(keyboard => keyboard.isoCode === isoCode)
|
return keyboards.find(keyboard => keyboard.isoCode === isoCode)
|
||||||
?? keyboards.find(keyboard => keyboard.isoCode === "en-US")!;
|
?? keyboards.find(keyboard => keyboard.isoCode === "en-US")!;
|
||||||
}, [isoCode]);
|
}, [isoCode]);
|
||||||
|
|
||||||
return { keyboardOptions, isoCode, selectedKeyboard };
|
return { keyboardOptions, isoCode, selectedKeyboard };
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,4 @@ import { nb_NO } from "@/keyboardLayouts/nb_NO"
|
||||||
import { sv_SE } from "@/keyboardLayouts/sv_SE"
|
import { sv_SE } from "@/keyboardLayouts/sv_SE"
|
||||||
import { da_DK } from "@/keyboardLayouts/da_DK"
|
import { da_DK } from "@/keyboardLayouts/da_DK"
|
||||||
|
|
||||||
export const keyboards: KeyboardLayout[] = [ cs_CZ, de_CH, de_DE, en_UK, en_US, es_ES, fr_BE, fr_CH, fr_FR, it_IT, nb_NO, sv_SE, da_DK ];
|
export const keyboards: KeyboardLayout[] = [cs_CZ, de_CH, de_DE, en_UK, en_US, es_ES, fr_BE, fr_CH, fr_FR, it_IT, nb_NO, sv_SE, da_DK];
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ const chars = {
|
||||||
z: { key: "KeyZ" },
|
z: { key: "KeyZ" },
|
||||||
"ż": { key: "KeyZ", accentKey: keyOverdot },
|
"ż": { key: "KeyZ", accentKey: keyOverdot },
|
||||||
";": { key: "Backquote" },
|
";": { key: "Backquote" },
|
||||||
"°": { key: "Backquote", shift: true, deadKey: true },
|
"°": { key: "Backquote", shift: true, deadKey: true },
|
||||||
"+": { key: "Digit1" },
|
"+": { key: "Digit1" },
|
||||||
1: { key: "Digit1", shift: true },
|
1: { key: "Digit1", shift: true },
|
||||||
"ě": { key: "Digit2" },
|
"ě": { key: "Digit2" },
|
||||||
|
|
@ -251,7 +251,7 @@ export const cs_CZ: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
@ -6,10 +6,10 @@ export const name = "Dansk";
|
||||||
const isoCode = "da-DK";
|
const isoCode = "da-DK";
|
||||||
|
|
||||||
const keyTrema = { key: "BracketRight" }
|
const keyTrema = { key: "BracketRight" }
|
||||||
const keyAcute = { key: "Equal", altRight: true }
|
const keyAcute = { key: "Equal", altRight: true }
|
||||||
const keyHat = { key: "BracketRight", shift: true }
|
const keyHat = { key: "BracketRight", shift: true }
|
||||||
const keyGrave = { key: "Equal", shift: true }
|
const keyGrave = { key: "Equal", shift: true }
|
||||||
const keyTilde = { key: "BracketRight", altRight: true }
|
const keyTilde = { key: "BracketRight", altRight: true }
|
||||||
|
|
||||||
export const chars = {
|
export const chars = {
|
||||||
A: { key: "KeyA", shift: true },
|
A: { key: "KeyA", shift: true },
|
||||||
|
|
@ -61,8 +61,8 @@ export const chars = {
|
||||||
V: { key: "KeyV", shift: true },
|
V: { key: "KeyV", shift: true },
|
||||||
W: { key: "KeyW", shift: true },
|
W: { key: "KeyW", shift: true },
|
||||||
X: { key: "KeyX", shift: true },
|
X: { key: "KeyX", shift: true },
|
||||||
Y: { key: "KeyY", shift: true },
|
Y: { key: "KeyY", shift: true },
|
||||||
Z: { key: "KeyZ", shift: true },
|
Z: { key: "KeyZ", shift: true },
|
||||||
a: { key: "KeyA" },
|
a: { key: "KeyA" },
|
||||||
"ä": { key: "KeyA", accentKey: keyTrema },
|
"ä": { key: "KeyA", accentKey: keyTrema },
|
||||||
"á": { key: "KeyA", accentKey: keyAcute },
|
"á": { key: "KeyA", accentKey: keyAcute },
|
||||||
|
|
@ -115,7 +115,7 @@ export const chars = {
|
||||||
x: { key: "KeyX" },
|
x: { key: "KeyX" },
|
||||||
y: { key: "KeyY" }, // <-- corrected
|
y: { key: "KeyY" }, // <-- corrected
|
||||||
z: { key: "KeyZ" }, // <-- corrected
|
z: { key: "KeyZ" }, // <-- corrected
|
||||||
"½": { key: "Backquote" },
|
"½": { key: "Backquote" },
|
||||||
"§": { key: "Backquote", shift: true },
|
"§": { key: "Backquote", shift: true },
|
||||||
1: { key: "Digit1" },
|
1: { key: "Digit1" },
|
||||||
"!": { key: "Digit1", shift: true },
|
"!": { key: "Digit1", shift: true },
|
||||||
|
|
@ -163,11 +163,11 @@ export const chars = {
|
||||||
"_": { key: "Slash", shift: true },
|
"_": { key: "Slash", shift: true },
|
||||||
"<": { key: "IntlBackslash" },
|
"<": { key: "IntlBackslash" },
|
||||||
">": { key: "IntlBackslash", shift: true },
|
">": { key: "IntlBackslash", shift: true },
|
||||||
"~": { key: "BracketRight", deadKey: true, altRight: true },
|
"~": { key: "BracketRight", deadKey: true, altRight: true },
|
||||||
"^": { key: "BracketRight", deadKey: true, shift: true },
|
"^": { key: "BracketRight", deadKey: true, shift: true },
|
||||||
"¨": { key: "BracketRight", deadKey: true, },
|
"¨": { key: "BracketRight", deadKey: true, },
|
||||||
"|": { key: "Equal", deadKey: true, altRight: true},
|
"|": { key: "Equal", deadKey: true, altRight: true },
|
||||||
"`": { key: "Equal", deadKey: true, shift: true, },
|
"`": { key: "Equal", deadKey: true, shift: true, },
|
||||||
"´": { key: "Equal", deadKey: true, },
|
"´": { key: "Equal", deadKey: true, },
|
||||||
" ": { key: "Space" },
|
" ": { key: "Space" },
|
||||||
"\n": { key: "Enter" },
|
"\n": { key: "Enter" },
|
||||||
|
|
@ -181,7 +181,7 @@ export const da_DK: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ export const de_CH: KeyboardLayout = {
|
||||||
isoCode: isoCode,
|
isoCode: isoCode,
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
keyDisplayMap: keyDisplayMap,
|
keyDisplayMap: keyDisplayMap,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ export const en_UK: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
@ -113,7 +113,7 @@ export const chars = {
|
||||||
"~": { key: "Backquote", shift: true },
|
"~": { key: "Backquote", shift: true },
|
||||||
"§": { key: "IntlBackslash" },
|
"§": { key: "IntlBackslash" },
|
||||||
"±": { key: "IntlBackslash", shift: true },
|
"±": { key: "IntlBackslash", shift: true },
|
||||||
" ": { key: "Space" },
|
" ": { key: "Space" },
|
||||||
"\n": { key: "Enter" },
|
"\n": { key: "Enter" },
|
||||||
Enter: { key: "Enter" },
|
Enter: { key: "Enter" },
|
||||||
Escape: { key: "Escape" },
|
Escape: { key: "Escape" },
|
||||||
|
|
@ -264,13 +264,13 @@ export const virtualKeyboard = {
|
||||||
},
|
},
|
||||||
control: {
|
control: {
|
||||||
default: [
|
default: [
|
||||||
"PrintScreen ScrollLock Pause",
|
"PrintScreen ScrollLock Pause",
|
||||||
"Insert Home PageUp",
|
"Insert Home PageUp",
|
||||||
"Delete End PageDown"
|
"Delete End PageDown"
|
||||||
],
|
],
|
||||||
shift: [
|
shift: [
|
||||||
"(PrintScreen) ScrollLock (Pause)",
|
"(PrintScreen) ScrollLock (Pause)",
|
||||||
"Insert Home PageUp",
|
"Insert Home PageUp",
|
||||||
"Delete End PageDown"
|
"Delete End PageDown"
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -303,7 +303,7 @@ export const en_US: KeyboardLayout = {
|
||||||
isoCode,
|
isoCode,
|
||||||
name,
|
name,
|
||||||
chars,
|
chars,
|
||||||
keyDisplayMap,
|
keyDisplayMap,
|
||||||
modifierDisplayMap,
|
modifierDisplayMap,
|
||||||
virtualKeyboard
|
virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,8 @@ const chars = {
|
||||||
y: { key: "KeyY" },
|
y: { key: "KeyY" },
|
||||||
z: { key: "KeyZ" },
|
z: { key: "KeyZ" },
|
||||||
"º": { key: "Backquote" },
|
"º": { key: "Backquote" },
|
||||||
"ª": { key: "Backquote", shift: true },
|
"ª": { key: "Backquote", shift: true },
|
||||||
"\\": { key: "Backquote", altRight: true },
|
"\\": { key: "Backquote", altRight: true },
|
||||||
1: { key: "Digit1" },
|
1: { key: "Digit1" },
|
||||||
"!": { key: "Digit1", shift: true },
|
"!": { key: "Digit1", shift: true },
|
||||||
"|": { key: "Digit1", altRight: true },
|
"|": { key: "Digit1", altRight: true },
|
||||||
|
|
@ -175,7 +175,7 @@ export const es_ES: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
@ -174,7 +174,7 @@ export const fr_BE: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
@ -29,7 +29,7 @@ export const fr_CH: KeyboardLayout = {
|
||||||
isoCode: isoCode,
|
isoCode: isoCode,
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
keyDisplayMap: keyDisplayMap,
|
keyDisplayMap: keyDisplayMap,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
modifierDisplayMap: de_CH.modifierDisplayMap,
|
modifierDisplayMap: de_CH.modifierDisplayMap,
|
||||||
virtualKeyboard: de_CH.virtualKeyboard
|
virtualKeyboard: de_CH.virtualKeyboard
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ export const fr_FR: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
@ -60,7 +60,7 @@ const chars = {
|
||||||
y: { key: "KeyY" },
|
y: { key: "KeyY" },
|
||||||
z: { key: "KeyZ" },
|
z: { key: "KeyZ" },
|
||||||
"\\": { key: "Backquote" },
|
"\\": { key: "Backquote" },
|
||||||
"|": { key: "Backquote", shift: true },
|
"|": { key: "Backquote", shift: true },
|
||||||
1: { key: "Digit1" },
|
1: { key: "Digit1" },
|
||||||
"!": { key: "Digit1", shift: true },
|
"!": { key: "Digit1", shift: true },
|
||||||
2: { key: "Digit2" },
|
2: { key: "Digit2" },
|
||||||
|
|
@ -120,7 +120,7 @@ export const it_IT: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
@ -115,7 +115,7 @@ const chars = {
|
||||||
x: { key: "KeyX" },
|
x: { key: "KeyX" },
|
||||||
y: { key: "KeyZ" },
|
y: { key: "KeyZ" },
|
||||||
z: { key: "KeyY" },
|
z: { key: "KeyY" },
|
||||||
"|": { key: "Backquote" },
|
"|": { key: "Backquote" },
|
||||||
"§": { key: "Backquote", shift: true },
|
"§": { key: "Backquote", shift: true },
|
||||||
1: { key: "Digit1" },
|
1: { key: "Digit1" },
|
||||||
"!": { key: "Digit1", shift: true },
|
"!": { key: "Digit1", shift: true },
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ const chars = {
|
||||||
y: { key: "KeyY" },
|
y: { key: "KeyY" },
|
||||||
z: { key: "KeyZ" },
|
z: { key: "KeyZ" },
|
||||||
"§": { key: "Backquote" },
|
"§": { key: "Backquote" },
|
||||||
"½": { key: "Backquote", shift: true },
|
"½": { key: "Backquote", shift: true },
|
||||||
1: { key: "Digit1" },
|
1: { key: "Digit1" },
|
||||||
"!": { key: "Digit1", shift: true },
|
"!": { key: "Digit1", shift: true },
|
||||||
2: { key: "Digit2" },
|
2: { key: "Digit2" },
|
||||||
|
|
@ -171,7 +171,7 @@ export const sv_SE: KeyboardLayout = {
|
||||||
name: name,
|
name: name,
|
||||||
chars: chars,
|
chars: chars,
|
||||||
// TODO need to localize these maps and layouts
|
// TODO need to localize these maps and layouts
|
||||||
keyDisplayMap: en_US.keyDisplayMap,
|
keyDisplayMap: en_US.keyDisplayMap,
|
||||||
modifierDisplayMap: en_US.modifierDisplayMap,
|
modifierDisplayMap: en_US.modifierDisplayMap,
|
||||||
virtualKeyboard: en_US.virtualKeyboard
|
virtualKeyboard: en_US.virtualKeyboard
|
||||||
};
|
};
|
||||||
|
|
@ -121,7 +121,7 @@ export const keys = {
|
||||||
Hanja: 0x91,
|
Hanja: 0x91,
|
||||||
Katakana: 0x92,
|
Katakana: 0x92,
|
||||||
Hiragana: 0x93,
|
Hiragana: 0x93,
|
||||||
ZenkakuHankaku:0x94,
|
ZenkakuHankaku: 0x94,
|
||||||
LockingCapsLock: 0x82,
|
LockingCapsLock: 0x82,
|
||||||
LockingNumLock: 0x83,
|
LockingNumLock: 0x83,
|
||||||
LockingScrollLock: 0x84,
|
LockingScrollLock: 0x84,
|
||||||
|
|
@ -279,7 +279,7 @@ export const hidKeyToModifierMask = {
|
||||||
export const latchingKeys = ["CapsLock", "ScrollLock", "NumLock", "Meta", "Compose", "Kana"];
|
export const latchingKeys = ["CapsLock", "ScrollLock", "NumLock", "Meta", "Compose", "Kana"];
|
||||||
|
|
||||||
export function decodeModifiers(modifier: number) {
|
export function decodeModifiers(modifier: number) {
|
||||||
return {
|
return {
|
||||||
isShiftActive: (modifier & (modifiers.ShiftLeft | modifiers.ShiftRight)) !== 0,
|
isShiftActive: (modifier & (modifiers.ShiftLeft | modifiers.ShiftRight)) !== 0,
|
||||||
isControlActive: (modifier & (modifiers.ControlLeft | modifiers.ControlRight)) !== 0,
|
isControlActive: (modifier & (modifiers.ControlLeft | modifiers.ControlRight)) !== 0,
|
||||||
isAltActive: (modifier & (modifiers.AltLeft | modifiers.AltRight)) !== 0,
|
isAltActive: (modifier & (modifiers.AltLeft | modifiers.AltRight)) !== 0,
|
||||||
|
|
|
||||||
|
|
@ -41,14 +41,14 @@ export const formatters = {
|
||||||
amount: number;
|
amount: number;
|
||||||
name: Intl.RelativeTimeFormatUnit;
|
name: Intl.RelativeTimeFormatUnit;
|
||||||
}[] = [
|
}[] = [
|
||||||
{ amount: 60, name: "seconds" },
|
{ amount: 60, name: "seconds" },
|
||||||
{ amount: 60, name: "minutes" },
|
{ amount: 60, name: "minutes" },
|
||||||
{ amount: 24, name: "hours" },
|
{ amount: 24, name: "hours" },
|
||||||
{ amount: 7, name: "days" },
|
{ amount: 7, name: "days" },
|
||||||
{ amount: 4.34524, name: "weeks" },
|
{ amount: 4.34524, name: "weeks" },
|
||||||
{ amount: 12, name: "months" },
|
{ amount: 12, name: "months" },
|
||||||
{ amount: Number.POSITIVE_INFINITY, name: "years" },
|
{ amount: Number.POSITIVE_INFINITY, name: "years" },
|
||||||
];
|
];
|
||||||
|
|
||||||
let duration = (date.valueOf() - new Date().valueOf()) / 1000;
|
let duration = (date.valueOf() - new Date().valueOf()) / 1000;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue