components/keyboard-layout
import { … } from 'zidane-ui'ui/src/components/keyboard-layout.ts
Functions#
_resetKeyboardLayoutFunction#
Tests: drop the cached layout (and re-request on next use), or install a fake one.
function _resetKeyboardLayout(next?: LayoutMapLike | null): voidParameters
| Name | Type | Default | Description |
|---|---|---|---|
| next? | LayoutMapLike | null | null | A layout map to use instead (no request is made then); |
layoutKeyLabelFunction#
How to label spec key name on this layout: for a punctuation key whose
physical key types a stand-in (typesStandIn), that character, so the
keycap names exactly what the matcher accepts; otherwise name.
function layoutKeyLabel(name: string): stringParameters
| Name | Type | Description |
|---|---|---|
| name | string | A binding spec's key name ( |
Returns
stringtypesStandInFunction#
Whether key (an event.key or a layout character) stands in for the
spec key at its physical position: a dead key or a single character other
than printable ASCII (never a named key like Process). The one rule shared by the matcher and keycap labels.
function typesStandIn(key: string): booleanParameters
| Name | Type | Description |
|---|---|---|
| key | string | An |
Returns
booleanuseKeyboardLayoutFunction#
Re-renders once the keyboard layout is known (for keycap labels).
function useKeyboardLayout(enabled?: boolean): voidParameters
| Name | Type | Default | Description |
|---|---|---|---|
| enabled? | boolean | true |
|
Constants#
PUNCTUATION_CODESConstant#
Spec character → physical keys. macOS ISO keyboards swap Backquote and IntlBackslash.
const PUNCTUATION_CODES: Readonly<Record<string, readonly string[]>>