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

tile-grid-util

v0.3.4

Published

🔷 javascript utility library to manage tile grids.

Readme

Tile Grid Util (Unstable)

npm i tile-grid-util

This javascript utility library allows you to create tile grids, add/remove rows, resize the grid, and more.

tile grids...tile grids everywhere! 🤯

import {TileGrid,Grid,Rect} from "tile-grid-util"

Rect

Internal base rectangle class, contains x1,x2,y1,y2 properties for setting up search bounds and grid/tile sizes. both grid and tile classes extend this class.

rect = new Rect(x1,x2,y1,y2) //set the vertices of the rectangle

Tile{Rect}

var tile = new Tile({
	width: 4, //tile size in grid units
	height: 6 //tile size in grid units
	item: reference to the object of your app that you want to associate with
})

TileGrid{Rect}

var grid = new TileGrid({
	width: 4, //width in grid units
	height: 6 //height in grid units
})

Grid.full{Rect}

a Rect class containing full first and last rows/columns of the grid.

Grid.crop(x1,x2,y1,y2,callback)

crop and return all itetms in specific bounds x1: left, x2: right, y1: top, y2: bottom

grid.crop(0,grid.x2,0,grid.y2,callback) // callback(item,x,y)

Grid.set(x1,x2,y1,y2)

set the bounds of the grid. x1: left, x2: right, y1: top, y2: bottom

grid.set(grid.x1 - 1,grid.x2 + 1,grid.y1 - 1,grid.y2 + 1) //add one unit to each side of the grid

Grid.pad(x1,x2,y1,y2)

same as set but will add the new values to the already existing bounds

grid.set(1,1,1,1) //add one unit to each side of the grid (left,right,top,bottom)

Grid.addTile(tile,x1,x2,y1,y2)

add a tile to first free spot within the specified bound Rect. returns false if no free spot has been found.

	// prepend items
	function update_prepend_search_bounds(){
		bound_start_x = grid.full.x1
		bound_end_x = 0
		bound_start_y = grid.full.y1
		bound_end_y = 0
	}


	// append items
	function update_append_search_bounds(){
		bound_start_x = grid.full.x2
		bound_end_x = grid.x2
		bound_start_y = grid.full.y2
		bound_end_y = grid.y2
	}


	//append an item
	while(!grid.addTile(tile,bound_start_x,bound_end_x,bound_start_y,bound_end_y)){ //try to add an item
		grid.pad(0,0,0,10) //pad the grid a bit until you can
		set_append_search_bounds() // update the search bounds so you dont loop over the same search bounds forever
	}


	//prepend an item
	while(!grid.addTile(tile,bound_start_x,bound_end_x,bound_start_y,bound_end_y)){ //try to add an item
		grid.pad(0,0,10,0) //pad the grid a bit until you can
		update_prepend_search_bounds() // update the search bounds so you dont loop over the same search bounds forever
	}

npm run build compile coffeescript file