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

keystone-dashboard-layout-core

v1.0.1

Published

Framework-agnostic grid-layout algorithms (bin-packing, collision detection, compaction, responsive breakpoints, alignment guides) shared by the Vue, React, and Angular packages in this monorepo. Zero framework dependency — every function takes plain data

Readme

CI code style: prettier npm NPM

Framework-agnostic grid-layout algorithms — bin-packing, collision detection, compaction, responsive breakpoint resolution, alignment guides, magnetic snapping, and a native Pointer-Events-based drag/ resize engine — shared by the Vue, React, and Angular packages in this family. Every function here takes plain data in and returns plain data out — no framework dependency, no live DOM required for the vast majority of it (drag/resize itself is the one exception; see below).

Most people building a dashboard should install the Vue, React, or Angular package instead — each already depends on this one and re-exports the pieces you'll actually touch (layout types, ECompactType, ICompactor, ARIA label types, and so on). Install this package directly only if you're validating or manipulating a layout server-side, running a batch job against layout data, or building a UI layer for a framework not covered by the three above.

Install

npm install keystone-dashboard-layout-core

No peer dependencies — this package has zero runtime dependencies of its own.

Usage

import { collides, compactLayout, moveElement } from 'keystone-dashboard-layout-core';
import type { TLayout } from 'keystone-dashboard-layout-core';

const layout: TLayout = [
  { i: 'a', x: 0, y: 0, w: 2, h: 2 },
  { i: 'b', x: 2, y: 0, w: 2, h: 2 },
];

const compacted = compactLayout(layout, 12);

Everything operates on the same TLayout/ILayoutItem shape the Vue, React, and Angular packages render directly — a plain, JSON-serializable array of { i, x, y, w, h, ... } objects, with no hidden framework state attached.

What's in here

  • Collision & movement — collides, getAllCollisions, getFirstCollision, findFirstFitSlot (bin-packing), moveElement, moveToCorrectPlace, moveElementAwayFromCollision
  • Compaction — compactLayout (and its horizontal/overlap variants), plus the pluggable ICompactor interface and getCompactor() factory the framework packages' own compactor prop/input accepts (verticalCompactor, horizontalCompactor, noCompactor, verticalOverlapCompactor, horizontalOverlapCompactor, matching every ECompactType value)
  • Responsive breakpoints — findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, correctBounds
  • Alignment & snapping — findAlignmentGuides, findSnapAdjustment, findSpacingIndicators, computeAlignAdjustments/computeDistributeAdjustments (the multi-select align/distribute commands), computeRangeSelection (Shift-click range selection)
  • Grid-unit ↔ pixel math — calcXY, calcGridItemWH, calcColWidth, setTransform/setTransformRtl/setTopLeft/ setTopRight
  • Serialization & export — serializeLayout/deserializeLayout, exportLayoutAsSvg (a dependency-free layout-to-SVG renderer), readOutsideDropPayload
  • Validators — layoutValidator, keysValidator, breakpointsValidator, marginValidator — the same ones the framework packages run internally, reachable standalone (e.g. validating a layout that came from an API response before ever handing it to a grid component)
  • Localizable ARIA strings — resolveAriaLabels/ DEFAULT_ARIA_LABELS, the three-layer merge (built-in defaults ← grid-wide override ← per-item override) every framework package's own ariaLabels prop/input uses
  • The native drag/resize engine — createNativeDraggable/ createNativeResizable/createNativeAutoScroll, built on the plain Pointer Events API with zero framework-specific code. This is the one part of this package that needs a real browser DOM to do anything at all; every other export above works equally well in Node (validating layouts server-side, for instance).

See src/index.ts for the complete, current export list — every public export is re-exported from that single entry point, so anything importable from keystone-dashboard-layout-core is documented there directly.

Why a separate package

Collision detection, compaction, and responsive breakpoint math are the hard, easy-to-get-subtly-wrong parts of a drag/resize grid layout — exactly the kind of logic that's expensive to get right once and wasteful to re-derive per framework. Keeping it in one framework-agnostic package means the Vue, React, and Angular packages share one implementation and one test suite for that logic, rather than three independently-maintained copies that could quietly drift out of sync with each other.

Changelog

See CHANGELOG.md for release history.

License

MIT