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

@madebylars.com/mbl-mapman

v1.0.3

Published

Nuxt 4 module — label-free world map with searchable city markers and a full hover/click event API

Downloads

90

Readme

mbl-mapman

npm version npm downloads License Nuxt

A portable Nuxt 4 module that provides a clean, label-free world map with searchable city markers. Drop it into any Nuxt 4 app, search for cities by name, pin them as markers, and attach your own data and event handlers to each one.

Features

  • Clean SVG world map — no city names, no country labels
  • Search cities by name (powered by OpenStreetMap Nominatim, no API key needed)
  • Attach arbitrary custom data to any marker (flags, descriptions, stats, etc.)
  • Full event API: marker-mouseenter, marker-mouseleave, marker-click
  • Responsive — redraws automatically when the container resizes
  • Fully typed with TypeScript

Installation

From npm (once published)

npm install mbl-mapman

Local / monorepo

// your-app/package.json
{
  "dependencies": {
    "mbl-mapman": "file:../mbl-mapman"
  }
}

Then register the module in your Nuxt config:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['mbl-mapman'],
})

That's it. <WorldMap> and useMapman() are auto-imported everywhere in your app.


Quick start

<script setup lang="ts">
const { markers, searchCities, addMarker, removeMarker } = useMapman()

const results = ref([])

async function search(query: string) {
  results.value = await searchCities(query)
}
</script>

<template>
  <!-- Search box -->
  <input placeholder="Search city…" @change="search($event.target.value)" />
  <button v-for="city in results" :key="city.id" @click="addMarker(city)">
    {{ city.name }}
  </button>

  <!-- Map fills its container -->
  <div style="height: 600px;">
    <WorldMap
      :markers="markers"
      @marker-click="m => removeMarker(m.id)"
    />
  </div>
</template>

Attaching custom data to markers

Every marker accepts a data field — a free-form object you define. Whatever you put in comes back on every event, so your app can render tooltips, panels, or anything else without the module needing to know about your data shape.

addMarker({
  id: city.id,
  name: city.name,
  lat: city.lat,
  lng: city.lng,
  data: {
    flag: '🇸🇪',
    population: '975 000',
    founded: '1252',
    description: 'Capital of Sweden',
  },
})

Then use it in events:

<script setup lang="ts">
import type { MapMarker } from 'mbl-mapman/runtime/types'

const tooltip = ref<{ marker: MapMarker; x: number; y: number } | null>(null)
</script>

<template>
  <WorldMap
    :markers="markers"
    @marker-mouseenter="(m, e) => tooltip = { marker: m, x: e.clientX, y: e.clientY }"
    @marker-mouseleave="tooltip = null"
    @marker-click="m => openPanel(m)"
  />

  <div
    v-if="tooltip"
    class="tooltip"
    :style="{ position: 'fixed', left: tooltip.x + 12 + 'px', top: tooltip.y + 'px' }"
  >
    <strong>{{ tooltip.marker.data.flag }} {{ tooltip.marker.name }}</strong>
    <p>{{ tooltip.marker.data.description }}</p>
    <small>Pop. {{ tooltip.marker.data.population }}</small>
  </div>
</template>

Admin / public split

A common pattern is to put the search and marker management in an admin route, and show the map read-only on public pages. Because useMapman() returns reactive state, wire it through a Pinia store or an API to share markers across routes.

Admin route — full control:

<script setup>
const { markers, searchCities, addMarker, removeMarker } = useMapman()
</script>

<template>
  <CitySearch @pick="addMarker" />
  <WorldMap :markers="markers" @marker-click="m => removeMarker(m.id)" />
</template>

Public route — display only:

<script setup>
// markers come from a store or API — no search, no mutation
const { markers } = useMapStore()
</script>

<template>
  <WorldMap
    :markers="markers"
    @marker-mouseenter="(m, e) => showTooltip(m, e)"
    @marker-mouseleave="hideTooltip"
  />
</template>

API reference

useMapman()

const {
  markers,       // Ref<MapMarker[]>  — reactive list of pinned markers
  searchCities,  // (query: string) => Promise<CitySearchResult[]>
  addMarker,     // (marker: MapMarker) => void   — no-op if id already exists
  removeMarker,  // (id: string) => void
  updateMarker,  // (id: string, updates: Partial<Omit<MapMarker, 'id'>>) => void
  clearMarkers,  // () => void
} = useMapman()

<WorldMap> props

| Prop | Type | Default | Description | |---|---|---|---| | markers | MapMarker[] | [] | Markers to display | | highlightedMarkerId | string | undefined | Renders the matching marker in its hover state (size + color) | | landColor | string | #2d5a3d | Fill colour for land | | seaColor | string | #1a3a5c | Fill colour for the ocean | | borderColor | string | rgba(255,255,255,0.2) | Country border stroke | | markerColor | string | #ff6b6b | Default marker fill | | markerRadius | number | 6 | Marker radius in pixels | | markerHoverColor | string | #ff3333 | Marker fill on hover | | markerHoverRadius | number | 9 | Marker radius on hover |

<WorldMap> events

| Event | Payload | Description | |---|---|---| | marker-mouseenter | (marker: MapMarker, event: MouseEvent) | Pointer entered a marker | | marker-mouseleave | (marker: MapMarker, event: MouseEvent) | Pointer left a marker | | marker-click | (marker: MapMarker, event: MouseEvent) | Marker was clicked |

Types

interface MapMarker {
  id: string
  name: string
  lat: number
  lng: number
  color?: string                   // overrides the markerColor prop for this marker
  hoverColor?: string              // overrides hover color — falls back to color, then markerHoverColor prop
  data?: Record<string, unknown>   // your custom payload
}

interface CitySearchResult {
  id: string
  name: string        // short city name
  displayName: string // full Nominatim display string
  lat: number
  lng: number
}

Module development

# Install dependencies
npm install

# Generate type stubs and prepare the playground
npm run dev:prepare

# Start the playground dev server
npm run dev

# Type-check
npm run test:types

# Lint
npm run lint

# Build for publishing
npm run prepack