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

maplibre-gl-inspect

v0.0.8

Published

UI inspect control for MapLibre GL JS maps

Readme

maplibre-gl-inspect

CI npm JSR npm bundle size npm type definitions GitHub release

Add an inspect control to maplibre-gl-js to view all features of the vector sources and allows hovering over features to see their properties.

Requires maplibre-gl-js >= 5.0.0

Maplibre GL Inspect Preview

Install

# npm
npm install maplibre-gl-inspect maplibre-gl

# bun
bun add maplibre-gl-inspect maplibre-gl

Usage

import maplibregl from 'maplibre-gl';
import { MaplibreInspect } from 'maplibre-gl-inspect';
import 'maplibre-gl-inspect/dist/style.css';

const map = new maplibregl.Map({
  container: 'map',
  style: 'https://demotiles.maplibre.org/style.json',
});

map.addControl(new MaplibreInspect());

Show Inspection Map by Default

map.addControl(
  new MaplibreInspect({
    showInspectMap: true,
  }),
);

Inspect Only Mode

map.addControl(
  new MaplibreInspect({
    showInspectMap: true,
    showInspectButton: false,
  }),
);

Disable Popup

map.addControl(
  new MaplibreInspect({
    showInspectMapPopup: false,
    showMapPopup: false,
  }),
);

Custom Popup

map.addControl(
  new MaplibreInspect({
    renderPopup(features) {
      return `<h1>${features.length}</h1>`;
    },
  }),
);

Custom Colors

const colors = ['#FC49A3', '#CC66FF', '#66CCFF', '#66FFCC'];
map.addControl(
  new MaplibreInspect({
    backgroundColor: '#000',
    assignLayerColor(_layerId, _alpha) {
      return colors[Math.floor(Math.random() * colors.length)];
    },
  }),
);

Popup on Click Only

map.addControl(
  new MaplibreInspect({
    showMapPopup: true,
    showMapPopupOnHover: false,
    showInspectMapPopupOnHover: false,
  }),
);

Query Parameters

Filter which layers show in the popup using queryRenderedFeatures parameters.

map.addControl(
  new MaplibreInspect({
    queryParameters: {
      layers: ['road_line'],
    },
  }),
);

Toggle Callback

map.addControl(
  new MaplibreInspect({
    toggleCallback(showInspectMap) {
      console.log(`Inspect mode: ${showInspectMap}`);
    },
  }),
);

Theming

Supports light, dark, and system (auto-detect) themes. By default, the theme is system which follows prefers-color-scheme.

// Use dark theme
const inspect = new MaplibreInspect({
  theme: 'dark',
});
map.addControl(inspect);

// Switch theme at runtime
inspect.setTheme('light');

Custom Theme Colors

import type { ThemeColors } from 'maplibre-gl-inspect';

const inspect = new MaplibreInspect({
  theme: 'system',
  lightColors: {
    popupText: '#1a1a1a',
    popupBorder: '#e0e0e0',
    buttonIcon: '#1a1a1a',
    inspectBackground: '#fafafa',
  },
  darkColors: {
    popupText: '#f0f0f0',
    popupBorder: '#555555',
    buttonIcon: '#f0f0f0',
    inspectBackground: '#111827',
  },
});

The following CSS custom properties are available for manual override:

| Variable | Description | | ------------------------ | ----------------------------- | | --inspect-popup-text | Popup text color | | --inspect-popup-border | Popup feature border color | | --inspect-button-icon | Toggle button icon color | | --inspect-background | Inspect mode background color |

Develop

bun install
bun run build

Run the example locally:

cd example
bun install
bun run dev

Credits

Fork of @acalcutt's maplibre-gl-inspect, which is a fork of @lukasmartinelli's mapbox-gl-inspect.

License

MIT