npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@madtyping/keyboard-localizations

v0.1.5

Published

Keyboard layout definitions and types for physical and logical keyboard layouts

Readme

@madtyping/keyboard-localizations

A comprehensive library of keyboard localization layouts providing physical layouts (ANSI, ISO) and regional/language-specific character mappings with full TypeScript support.

Installation

npm install @madtyping/keyboard-localizations

Usage

Importing Types

import {
  KeyboardLayout,
  PhysicalLayout,
  LogicalLayout,
  KeyMapping,
  CharacterMapping,
  KeyDefinition,
  OSType
} from '@madtyping/keyboard-localizations';

Working with Layouts

import {
  getKeyboardLayout,
  getKeyboardLocalizationById,
  keyboardLocalizations,
  ansiPhysicalLayout,
  isoPhysicalLayout,
  ansiMacPhysicalLayout,
  isoMacPhysicalLayout,
  extendKeyboardLayout,
  mergeLogicalLayouts,
  createKeyboardLayout,
  validateKeyboardLayout,
  getDeadKeys,
  getCharactersForKey,
  modifierCodes
} from '@madtyping/keyboard-localizations';

// Get a specific layout by ID
const usLayout = getKeyboardLayout('en-us-iso-windows');

// Get all available layouts
const allLayouts = keyboardLocalizations;

// Work with physical layouts
const ansiLayout = ansiPhysicalLayout;
const isoLayout = isoPhysicalLayout;

Layout Structure

Physical Layouts

Define the physical arrangement of keys including:

  • Key positions and dimensions
  • Factor-based sizing for scalable rendering
  • Support for different form factors (ANSI, ISO, etc.)

Localization Layouts

Define regional/language-specific character mappings including:

  • Base characters and shifted variants
  • AltGr (Alt Graph) combinations
  • Dead key sequences for accented characters
  • OS-specific modifier combinations

Complete Layouts

Combine physical and localization layouts for complete keyboard definitions ready for rendering or input processing.

Contributing

We welcome contributions of new keyboard layouts! To contribute:

  1. Fork the repository
  2. Generate layout JSON files using the Keyboard Layout Builder by typing on your physical keyboard
  3. Convert the JSON to TypeScript files and add them to the appropriate directories:
    • src/physicalLayouts/ for physical layouts
    • src/localizations/ for complete keyboard localizations
  4. Update the index files to import your layouts
  5. Submit a pull request

Layout Generation

Available Layouts

Physical Layouts

  • ansiPhysicalLayout - Standard ANSI layout
  • isoPhysicalLayout - Standard ISO layout
  • ansiMacPhysicalLayout - ANSI layout for Mac
  • isoMacPhysicalLayout - ISO layout for Mac

Keyboard Localizations

  • en-us-iso-windows - English (US) with ISO physical layout for Windows
  • cs-cz-iso-windows - Czech with ISO physical layout for Windows

Utility Functions

  • extendKeyboardLayout() - Extend a layout with additional character mappings
  • mergeLogicalLayouts() - Merge two logical layouts
  • createKeyboardLayout() - Create a new keyboard layout
  • validateKeyboardLayout() - Validate layout against physical definition
  • getDeadKeys() - Get all dead keys from a layout
  • getCharactersForKey() - Get all characters for a specific key
  • modifierCodes - Map of available modifier key codes

Types Reference

KeyMapping

Represents all possible characters a single physical key can produce:

type KeyMapping = {
  chars: CharacterMapping[];
};

CharacterMapping

Defines how a character is produced:

type CharacterMapping = {
  char: string;
  modifiers: string[][]; // e.g., [['ShiftLeft']]
  sequence?: string; // For dead keys: 'ctrl+alt+digit5→e'
  isDead?: true;
};

PhysicalLayout

Defines the physical arrangement of keys:

type PhysicalLayout = {
  label: string; // e.g., 'ANSI'
  id: string;
  definition: KeyDefinition[];
};

LogicalLayout

Maps key codes to localized character outputs:

type LogicalLayout = Record<string, KeyMapping>;

KeyboardLayout

Complete keyboard definition:

type KeyboardLayout = {
  label: string; // e.g., 'English (US) - ISO (windows)'
  id: string; // e.g., 'en-us-iso-windows'
  physical: PhysicalLayout;
  logical: LogicalLayout;
  os: OSType;
};

License

MIT License - See LICENSE file for details.

Repository

https://github.com/madtyping/keyboard-localizations