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

@geolibre/embed

v3.0.0

Published

Typed client for GeoLibre's iframe embed API

Readme

@geolibre/embed

npm version npm downloads license

Typed, dependency-free client for driving a GeoLibre map embedded in an <iframe> from the page around it.

URL parameters configure a GeoLibre embed once, at load. This package is for everything after that: fly to the record someone just clicked in your own UI, toggle a layer, apply a filter, export the map as a PNG, and hear what the user does inside the map. It speaks GeoLibre's versioned postMessage protocol, and handles the two parts that are easy to get wrong by hand: the origin checks in both directions, and correlating each command with its acknowledgement so several can be in flight at once.

Source repo: opengeos/GeoLibre. The package version tracks the app version, since both ship from the same release.

Install

npm install @geolibre/embed

Usage

import { connect } from "@geolibre/embed";

const iframe = document.querySelector("iframe");
const map = await connect(iframe, { origin: "https://gis.example.com" });

await map.setView({ center: [-95.7, 37.1], zoom: 5 });
await map.setLayerVisibility("roads", false);

const layers = await map.listLayers();
console.log(layers.map((layer) => layer.name));

map.on("selectionChanged", ({ featureIds }) => showRecordFor(featureIds[0]));

connect resolves once the app reports that it is ready, so there is no handshake to write yourself. Pass the app's origin, not your own: it is both the target of every outbound message and the filter on inbound ones.

API

connect(iframe, options)Promise<GeoLibreEmbedClient>

| Option | Default | Description | | ------------------- | ------- | --------------------------------------- | | origin | — | Required. Exact origin hosting the app. | | timeoutMs | 15000 | How long to wait for ready. | | requestTimeoutMs | 15000 | How long to wait for each command. |

| Method | Resolves with | | -------------------------------------- | ----------------------- | | loadProject(url) | void | | setView(target) | void | | highlightFeature({ layerId, … }) | void | | openTool(id, params?) | void | | setLayerVisibility(layerId, visible) | void | | listLayers() | LayerSummary[] | | setFilter(layerId, expression) | void | | getViewport() | Viewport | | addLayer(spec) | the new layer's id | | addData(url, options?) | the new layer ids | | exportImage() | a PNG data: URL | | on(event, listener) | an unsubscribe function | | disconnect() | not a promise |

Commands reject rather than resolving falsely: a rejected request rejects with the app's own error message, and one that goes unanswered rejects with a timeout. Call disconnect() when the iframe goes away, so a pending promise cannot hang for the life of the page.

Events: ready, ack, projectLoaded, selectionChanged, viewChanged, toolCompleted, serverFileWritten.

The API is off unless the deployment opts in

A GeoLibre deployment ignores this protocol until it names the origins it trusts, so a public instance can never be driven by whatever page frames it. For the Docker image that is one environment variable:

docker run --rm -p 8080:80 \
  -e GEOLIBRE_EMBED_ORIGINS="https://portal.example.com" \
  ghcr.io/opengeos/geolibre:latest

For a static build, bake it in with VITE_GEOLIBRE_EMBED_ORIGINS="https://portal.example.com" npm run build. The public web.geolibre.app build sets no allowlist, so the runtime API is for your own hosted deployment.

Documentation

See Embedding & Sharing for the allowlist, the URL parameters, the full protocol reference, and a raw postMessage example for hosts that would rather not take a dependency.

License

MIT