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

@m1z23r/maps-core

v1.1.0

Published

Self-owned canvas map of Serbia — framework-agnostic engine

Readme

@m1z23r/maps-core

A self-owned canvas map of Serbia — a framework-agnostic engine drawn on <canvas> from vector tiles (no MapLibre/Leaflet/Google). Zero runtime dependencies; ships ESM + .d.ts.

npm i @m1z23r/maps-core

Quickstart

import { MapView } from '@m1z23r/maps-core';

const map = new MapView(document.getElementById('map')!, {
  apiUrl: '/api/v1',        // same-origin; or 'https://maps.dimitrije.dev/api/v1'
  theme: 'dark',
});

map.on('ready', () => {
  // A price badge pinned to a world point (EPSG:32634 meters).
  map.pins.set([{ id: 1, x: 457396, y: 4962263, kind: 'badge', label: '€120' }]);
  // Coarse privacy display: highlight a whole settlement, not an exact address.
  void map.showLocation({ level: 'settlement', settlementId: 12345, label: 'Vračar' });
});

map.on('pinclick', ({ pin }) => console.log('clicked', pin.data));

The container element sizes the map (it fills width/height: 100%); a ResizeObserver keeps the canvas in sync.

Config

| Field | Default | Meaning | |---|---|---| | apiUrl | — (required) | base URL of the maps API, e.g. /api/v1 | | apiKey | — | sent as X-Api-Key on every request (keyed tier) | | theme | 'light' | 'light' or 'dark' | | showRegions | false | region tint overlay | | interactive | true | pan/zoom/click handling | | styleOverrides | — | deep-partial overrides of the style tables |

Engine API (MapView)

  • on/off(event, cb) — see events below.
  • setTheme(t), theme, setShowRegions(b), showRegions, setStyle(overrides)
  • getCamera(), flyTo({ x, y, mpp }), fitBounds(bbox), resize()
  • pins.set(pins) / pins.clear() — screen-space markers ('dot' | 'pin' | 'badge')
  • overlays.set(overlays) / overlays.clear() — filled/stroked world-space geometry
  • showLocation(spec) / clearLocation() — privacy-level display (address pin, street highlight, settlement/municipality blob)
  • setHighlight(geometry | null), placeTag(x, y, label?), clearTag()
  • api — the configured MapsApi client (convenience)
  • destroy()

Events

| Event | Payload | |---|---| | ready | void (once, after first paint) | | click | { x, y } (world meters) | | labelclick | { kind, name, wx, wy }kind: street \| place \| settlement \| municipality | | pinclick | { pin } | | move | { x, y, mpp } | | render | { mpp, level, featureCount, drawMs } |

Headless API client (MapsApi)

Usable without a map — autocomplete, geocode, geometry:

import { MapsApi, MapsApiError } from '@m1z23r/maps-core';

const api = new MapsApi({ apiUrl: '/api/v1', apiKey: 'optional' });
const hits = await api.municipalities('nis');
try {
  const loc = await api.locate(457396, 4962263);
} catch (e) {
  if (e instanceof MapsApiError && e.quotaExceeded) { /* free-tier 429 */ }
}

API keys go in as apiKeyX-Api-Key. On the keyless free tier, exceeding the daily quota throws MapsApiError with .quotaExceeded === true (HTTP 429).

Coordinates

Everything is EPSG:32634 (UTM zone 34N) world meters. Convert to/from WGS84 with the exported helpers:

import { wgs84ToWorld, worldToWgs84 } from '@m1z23r/maps-core';
const { x, y } = wgs84ToWorld(44.8125, 20.4612); // Belgrade → ~457396, ~4962263
const { lat, lon } = worldToWgs84(x, y);

Theming

theme: 'dark' | 'light' selects an embedded palette; styleOverrides deep-merges on top. setStyle(overrides) and setTheme(t) re-skin a live map.

Interaction

Pan with one finger / mouse drag, zoom with the wheel or a double-click/tap. On touch, two fingers pinch to zoom (and pan by their midpoint).