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

@zzdandanzz/deckgl-draw

v0.4.0

Published

A lightweight, developer-friendly, plug-and-play drawing library for Deck.gl.

Readme

@zzdandanzz/deckgl-draw

A lightweight, developer-friendly, plug-and-play drawing library for Deck.gl.

npm version license

https://github.com/user-attachments/assets/a1cd2355-b0bc-4673-9a4e-e0ef00d04351

Inspired by the simplicity of mapbox-gl-draw, this library provides an opinionated, easy-to-use React component and Deck.gl layer to enable drawing and editing of basic geometries with minimal configuration.

✨ Features

  • Plug-and-Play Architecture: Easily integrate drawing capabilities into your Deck.gl map without digging into complex layer states.
  • Core Geometries: Create and edit Points, LineStrings, and Polygons.
  • Built-in React UI: Includes a fully styled, customizable DrawToolbar component out of the box.
  • Snapping: Support for vertex and edge snapping with a configurable pixel radius.
  • Feature Manipulation: Move, edit vertices, add midpoints.
  • Keyboard Shortcuts: Escape (finishes drawing and switches to pan), Enter (finishes drawing and keeps the current tool active), and Delete / Backspace (removes the selected feature or vertex).

📦 Installation

npm install @zzdandanzz/deckgl-draw

Peer Dependencies Ensure you have the required peer dependencies installed in your project:

npm install @deck.gl/core @deck.gl/layers @deck.gl/react react react-dom

🚀 Quick Start

💡 Looking for a complete, working example? Check out the Full Interactive Demo in the repository (src/demo/Demo.tsx) to see it in action right away.

If you just want to get a feel for how it works, the snippet below provides a high-level overview of the main parts. Most of what you need is handled by the EditableLayer and the DrawToolbar.

Pass your GeoJSON FeatureCollection and manage the edit mode via standard React state. (Note: State management and basic callbacks are omitted here for brevity to highlight the core wiring).

import { EditableLayer, DrawToolbar } from "@zzdandanzz/deckgl-draw";
import type { EditMode, EditableLayerEvent } from "@zzdandanzz/deckgl-draw";

export default function App() {
    // 1. Manage your state (mode, data, selections) here...

    // 2. Initialize the layer
    const editableLayer = new EditableLayer({
        id: "editable-drawing-layer",
        data,
        mode,
        selectedFeatureIds,
        onChange: handleChange,
        onSelect: (featureIds) => setSelectedFeatureIds(featureIds),
    });

    return (
        <div style={{ position: "relative", width: "100vw", height: "100vh" }}>
            {/* 3. Add the Toolbar UI */}
            <DrawToolbar
                data={data}
                mode={mode}
                onChange={handleChange}
                onModeChange={setMode}
                onSelect={(featureIds) => setSelectedFeatureIds(featureIds)}
                selectedFeatureIds={selectedFeatureIds}
            />

            {/* 4. Render the Map */}
            <DeckGL
                initialViewState={{
                    longitude: -122.4,
                    latitude: 37.74,
                    zoom: 11,
                }}
                controller={true}
                layers={[editableLayer]}
            >
                <Map mapStyle={OSM_STYLE as StyleSpecification} />
            </DeckGL>
        </div>
    );
}

🗺️ Roadmap

This library has just hatched. Some edge cases have not been handled

While functional for basic use cases, there are several areas planned for future improvement:

  • [ ] Add support for Multi-Geometries (MultiPolygon, MultiLineString).
  • [ ] Handle complex polgyons (polygons containing inner rings)
  • [ ] Implement spatial indexing (e.g., R-trees) to optimize snapping performance on datasets with thousands of vertices.
  • [ ] Refactor UI styling to utilize CSS variables, making custom theming and icon replacement effortless.