All files / virtual-keyboard/src/layouts dvorak.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                                1x                                                                                              
import { createLayout } from "../engine/createLayout";
import { ck } from "./latin";
import { BACKSPACE_KEY, ENTER_KEY, LAYER_KEY, SHIFT_KEY, SPACE_KEY } from "./qwerty";
 
/**
 * **Dvorak** simplified layout — vowels and the most common consonants sit on
 * the home row (`aoeuidhtns`) for reduced finger travel. The top row leads with
 * the apostrophe, comma and period. Shift/Caps and the `?123` symbol layer work
 * as on {@link qwertyLayout}; vowel accents are available as long-press variants.
 *
 * @example
 * ```tsx
 * import { VirtualKeyboard, dvorakLayout } from "@usefy/virtual-keyboard";
 * <VirtualKeyboard layouts={dvorakLayout} />;
 * ```
 */
export const dvorakLayout = createLayout({
  name: "dvorak",
  label: "Dvorak",
  rows: [
    [
      { key: "'", type: "char", layerKey: "1" },
      { key: ",", type: "char", layerKey: "2" },
      { key: ".", type: "char", layerKey: "3" },
      ck("p", "4"),
      ck("y", "5"),
      ck("f", "6"),
      ck("g", "7"),
      ck("c", "8"),
      ck("r", "9"),
      ck("l", "0"),
    ],
    [
      ck("a", "@"),
      ck("o", "#"),
      ck("e", "$"),
      ck("u", "_"),
      ck("i", "&"),
      ck("d", "-"),
      ck("h", "+"),
      ck("t", "("),
      ck("n", ")"),
      ck("s", "?"),
    ],
    // Dvorak's bottom letter row has 9 keys; with Shift + Backspace that would be
    // 11 keys — one more than the other layouts and wide enough to overflow the
    // container. Backspace stays top-right (where it is expected) and Shift joins
    // the mode keys on the bottom row, keeping every row at ≤ 10 keys.
    [
      ck("q", "*"),
      ck("j", '"'),
      ck("k", ":"),
      ck("x", ";"),
      ck("b", "!"),
      ck("m", "="),
      ck("w", "/"),
      ck("v", "\\"),
      ck("z", "~"),
      BACKSPACE_KEY,
    ],
    [SHIFT_KEY, LAYER_KEY, SPACE_KEY, ENTER_KEY],
  ],
});