@fxi/projversor

中文文档
0.6.5发布于 2026/11/12MITTypeScriptES Module构建来源已验证近 30 天下载 3596

GeoVideo archives on a sphere that morphs between world projections, rendered with zartigl primitives

原始使用文档
文档目录5 节
  1. Install
  2. API
  3. Development
  4. Docker
  5. Releases

projversor

Catalog data on a sphere that morphs between world projections (globe, Equal Earth, Mollweide, polar…), for standalone pages and stories. GeoVideo archives play as particles or rasters, with small GeoJSON and georeferenced images on top. Rendering primitives and the catalog come from zartigl (@fxi/zartigl/engine, /catalog, /story); projversor never touches MapLibre. In MapX, use zartigl's MapLibre layer instead.

Install

npm install @fxi/projversor @fxi/zartigl

An ES module with its types. @fxi/zartigl is a peer dependency, so a page that also imports zartigl loads one copy. d3 stays a dependency; the detailed coastlines load on demand.

API

import { Projversor } from "@fxi/projversor";

const pv = new Projversor(root, {
  preset: "globe", // projection preset; also rotate, zoom
  time: Date.parse("2025-03-15"), // playhead; default the latest month
  playing: true,
  interactive: true, // drag, pinch, wheel
  colors: { ocean: "#111d23" }, // over the css custom properties
  waitForLandDetail: true, // false: init() resolves before the 50m coastline
});
await pv.init(); // canvases in root, WebGL2; rejects without it

const currents = await pv.add("currents", "particles", {
  source: "ocean-current-velocity", // projversor layer id or catalog entry id
  tint: null, // particles colored by speed; or a scalar entry id
  style: { palette: "viridis" },
});
await pv.add("sst", "scalar", {
  source: "sea-water-temperature",
  timeRange: { start: "2026-05-01", end: "2026-10-31" }, // as zartigl's
});
await pv.add("photo", "image", {
  image: "https://example.org/map.png", // or a loaded image or canvas
  bounds: [120, -30, 240, 30], // west, south, east, north
  style: { opacity: 0.8 },
});
await pv.add("regions", "geojson", { data, style: { label: "name" } });

await currents.update({ particles: { density: 0.5 } }); // style override
await pv.replace("currents", "particles", { source: "surface-wind" });
await pv.update({ preset: "world", time, playing: false, speed: 2 });
pv.view.zoomBy(1.5); // goTo, rotateBy, setInset, outline, northAngle…
pv.on("month", ({ id, month }) => {}); // also status, palette, playing,
// preset, north, frame
await pv.remove("sst");
pv.destroy();
  • Layers. Fields and images draw in the order added; GeoJSON (lines, fill, points with radius, labels) always above them. One particles layer at a time.
  • Views. goTo onto the view already shown, and setInset to the current inset, do nothing: construct with the first view's preset, rotate and zoom to open on it without a morph.
  • Time. One playhead. The first field layer drives it through its months; the others follow and load their own months. Its timeRange, the same as zartigl's ({ start?, end? } or { trailing: "P6M" }), loops playback over that window instead of the whole archive; null clears it. Share links carry it as tr=2026-05-01/2026-10-31 or tr=P6M.
  • replace switches a layer's source, tint or style in place: the shown layer stays until the new month is decoded. A later call supersedes one still loading; a failed one keeps the shown layer.
  • Look. Three canvases: ocean and land below, WebGL data in between, graticule, coastlines and GeoJSON above. Colors come from the css custom properties --ocean, --land, --coast, --graticule, --equator and --outline, read at init(); colors (option or update) overrides them at any time.
  • Stories. ProjversorStoryView adapts a projversor to the @fxi/zartigl/story registry; a view config may carry a geojson and a timeRange.

Development

zartigl comes from npm. To work on both at once, link the sibling repository, then reinstall to return to the npm version:

npm run --prefix ../zartigl build:lib && npm link ../zartigl
npm install
npm test                # unit tests
npm run quality         # prettier, eslint, tsc
npm run build:lib       # dist/: the published package
npm run test:browser    # reference renders and app smoke tests
npm run dev:explorer    # also dev:story, dev:site, dev:minimal

Apps: apps/explorer (every catalog layer on the sphere), apps/story (a story), apps/site (home page with a scroll story) and apps/minimal (sea surface temperature anomaly and the Niño regions, the smallest page). npm run dev:explorer and the like serve each one; npm run build:apps builds them all into dist-apps/<name>/.

Docker

The image serves the apps with nginx on port 8080: the explorer at /, the story at /story/, the site at /site/ and the minimal page at /minimal/ (/healthz for health checks).

docker compose up -d --build   # from this folder; open http://localhost:8080
docker compose pull && docker compose up -d   # the published image

CI publishes ghcr.io/fxi/projversor from main (latest) and from v* tags.

The same apps are published to GitHub Pages from main (https://fxi.github.io/projversor/, story/, site/, minimal/).

Releases

npm run release:minor   # or release:patch, release:major

npm version bumps package.json, commits and tags vX.Y.Z, then the script pushes main with the tag. The tag publishes the package to npm (publish.yml, after quality, tests and build:lib) and the app image.

版本与发布记录

@fxi/projversor 共发布 20 个版本,首次发布于 2026/10/23;过去 12 个月发布了 20 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.6.5latest2026/11/123 天前
0.6.42026/11/106 天前
0.6.32026/11/096 天前
0.6.22026/11/0511 天前
0.6.12026/11/0411 天前
0.6.02026/11/0411 天前

关于 @fxi/projversor 的常见问题

@fxi/projversor 是什么?

GeoVideo archives on a sphere that morphs between world projections, rendered with zartigl primitives

如何安装 @fxi/projversor?

在项目目录运行 npm install @fxi/projversor,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@fxi/zartigl(^0.16.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fxi/projversor 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fxi/projversor 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fxi/projversor 可以商用吗?

@fxi/projversor 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fxi/projversor 的下载量有多少?

根据 npm 官方下载统计,@fxi/projversor 在 2026/10/16 – 2026/11/14 这 30 天内被下载 3,596 次,日均约 120 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fxi/projversor 还在维护吗?

最新版本 0.6.5 发布于 2026/11/12(3 天前);至今共发布 20 个版本,其中过去 12 个月发布了 20 个;首次发布于 2026/10/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。