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

kle-serial-alt

v0.1.0

Published

Alternative KLE (Keyboard Layout Editor) raw data parser with rx/ry rotation cluster fixes. Drop-in replacement for @ijprest/kle-serial.

Readme

kle-serial-alt

npm license

Alternative parser for Keyboard Layout Editor (KLE) raw data, written in TypeScript.

Drop-in replacement for @ijprest/kle-serial with rotation-cluster bugfixes that bring the output in line with KLE's own serial.js.

Why this fork-ish alternative?

@ijprest/kle-serial 0.15.1 (and older) mishandles rx / ry rotation cluster origins:

  • The first key of a rotation cluster lands at (0, 0) instead of (rx, ry)
  • When only one of rx / ry changes, the other axis of the cursor is not snapped back to the cluster origin

Both of these break real layouts that declare many single-key rotation clusters (e.g. highly ergonomic designs). kle-serial-alt re-implements the parser so rotation behaviour matches KLE's own runtime.

Install

npm install kle-serial-alt

Peer: Node 18+ / modern browsers (ESM + CJS builds included).

Usage

import { deserialize, parse, Serial } from 'kle-serial-alt'

// From an already-parsed array
const keyboard = deserialize([
  { name: 'Sample' },
  ['0,0', '0,1'],
  ['1,0', '1,1'],
])

// From a JSON / JSON5 string (KLE "Raw data" tab often uses JSON5 syntax)
const fromString = parse(`[
  { name: "Sample" },
  ["0,0", "0,1",],
  ["1,0", "1,1",],
]`)

// Compatible namespace for drop-in migration from @ijprest/kle-serial
const alsoOk = Serial.deserialize([...])

for (const k of keyboard.keys) {
  console.log(k.x, k.y, k.width, k.rotation_angle, k.labels[0])
}

Type exports

import type { Key, Keyboard, KeyboardMetadata } from 'kle-serial-alt'

API

deserialize(rows: unknown[]): Keyboard

Parses an array of rows (the native KLE raw shape) and returns a Keyboard.

Throws KleDeserializeError for structurally invalid input (e.g. rotation specified on a non-first key, metadata object not at the head).

parse(json: string): Keyboard

Parses a JSON / JSON5 string. KLE's "Raw data" tab emits JSON5 (unquoted keys, trailing commas), so use parse when you have the raw tab contents. For already-valid JSON, deserialize(JSON.parse(s)) works too.

Serial

Namespace object re-exporting { deserialize, parse } — convenient for drop-in migration from @ijprest/kle-serial via:

// before
import { Serial } from '@ijprest/kle-serial'

// after
import { Serial } from 'kle-serial-alt'

Classes

  • Key — per-key shape matching kle-serial (x, y, width, height, x2, y2, width2, height2, rotation_x, rotation_y, rotation_angle, color, labels[], textColor[], textSize[], decal, ghost, stepped, nub, profile, sm, sb, st).
  • KeyboardMetadata — top-level metadata (name, author, notes, backcolor, switchBrand, switchMount, switchType, radii, css, pcb, plate).
  • Keyboard{ meta: KeyboardMetadata, keys: Key[] }.

Differences from @ijprest/kle-serial

| Aspect | @ijprest/kle-serial 0.15.1 | kle-serial-alt | |---|---|---| | rx resets current.x | ❌ | ✅ | | ry resets current.y | ❌ | ✅ | | Only rx specified → current.y snaps to rotation_y | ❌ | ✅ | | Only ry specified → current.x snaps to rotation_x | ❌ | ✅ | | Return shape (Key, Keyboard) | matches | matches | | JSON5 input | via Serial.parse | via parse / Serial.parse | | License | MIT | MIT |

Field names and the shape of returned objects are otherwise identical, so swapping in kle-serial-alt typically requires only changing the import specifier.

License

MIT — derived in part from kle-serial (MIT, © Ian Prest).