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

@processhub-lib/map-sdk

v0.0.2

Published

SDK de mapas para aplicações de agricultura de precisão. Fornece uma camada de domínio (talhões, amostras, trajetos) sobre um motor de mapa concreto hoje [Leaflet](https://leafletjs.com/) sem que as telas precisem importar `leaflet` diretamente.

Readme

@processhub-lib/map-sdk

SDK de mapas para aplicações de agricultura de precisão. Fornece uma camada de domínio (talhões, amostras, trajetos) sobre um motor de mapa concreto hoje Leaflet sem que as telas precisem importar leaflet diretamente.

O que ele faz

  • Vocabulário de domínio, não de motor de mapa. As telas trabalham com Map, Feature, Layer, Style — nunca com L.polygon, LatLngBounds ou divIcon.
  • Geometrias prontas para uso. Pontos, linhas, polígonos, círculos, retângulos e GeoJSON arbitrário via factories (Feature.point, Feature.polygon, ...) e uma API fluente (map.polygon().fill(...).add()).
  • Organização em camadas. Layers com visibilidade, ordem, bloqueio de edição e filtros.
  • Estilos e ícones nomeados. Registre uma vez (map.styles.register, map.icons.register), referencie por string em qualquer tela.
  • Seleção, desenho e edição. Multi-seleção, desenho de geometrias, edição, mover, girar, unir e dividir features.
  • Medição e grade de amostragem. Área, distância e perímetro via Turf; geração de grades quadradas/hexagonais e pontos de coleta (aleatórios ou sistemáticos) dentro de um talhão.
  • Undo/redo de graça. Toda mutação de domínio passa por um sistema de comandos com histórico.
  • Eventos tipados (feature:click, selection:select, draw:complete, ...) e hooks React (useMap, useSelection, useFeature, ...) para integrar tudo isso a componentes.
  • Motor de mapa substituível. A abstração é feita com Ports & Adapters: o domínio define a interface MapEngine; LeafletMapEngine é o adapter padrão hoje. Trocar de motor no futuro (ex.: MapLibre) significa escrever um novo adapter, não reescrever telas.

Instalação

npm install @processhub-lib/map-sdk leaflet

react e react-dom (^18.2.0) são peer dependencies, já devem existir na aplicação host. leaflet é dependency direta do pacote (é o motor usado pelo adapter padrão).

No ponto de entrada da aplicação, importe o CSS do Leaflet uma vez (o pacote não o reexporta):

import "leaflet/dist/leaflet.css";

Uso rápido

import { MapView, Feature, useMap } from "@processhub-lib/map-sdk";

function TelaTalhao({ talhaoGeoJson }: { talhaoGeoJson: GeoJSON.Geometry }) {
  return (
    <MapView
      options={{ center: { lat: -15.78, lng: -47.93 }, zoom: 13 }}
      className="h-[600px]"
    >
      <ConteudoDoMapa talhaoGeoJson={talhaoGeoJson} />
    </MapView>
  );
}

function ConteudoDoMapa({
  talhaoGeoJson,
}: {
  talhaoGeoJson: GeoJSON.Geometry;
}) {
  const map = useMap();

  useEffect(() => {
    const talhao = Feature.geojson(talhaoGeoJson, {
      style: "sample-collected",
    });
    map.add(talhao);
  }, [talhaoGeoJson]);

  return null;
}

<MapView> monta o Map (a fachada do SDK) sobre um LeafletMapEngine por padrão e o expõe via contexto React — useMap() dá acesso a essa instância dentro da árvore de filhos do MapView.

Documentação

  • docs/guide/: guia de uso completo: features e layers, styles/icons/markers, seleção/desenho/medição/grade, comandos e eventos, hooks React, como trocar o motor de mapa.

Desenvolvimento do pacote

npm run typecheck:ci  # tsc --noEmit para verificar tipagem sem gerar arquivos
npm run build:ci      # vite build gera dist/index.{es,cjs}.js + .d.ts

O build usa vite-plugin-dts para gerar as declarações de tipo e não empacota react/react-dom (external, resolvidos pela aplicação host via peer dependency).