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

map-tools-vue-viewer

v0.1.0

Published

地图画布只读展示组件:接口拉取地图数据 + 业务脚本控制展示(与 map-tools 编辑器配套)

Readme

map-tools-vue-viewer

map-tools 后端配套的 Vue3 地图只读展示组件:通过接口加载地图 JSON,在业务项目中用脚本驱动 setElement 更新展示(与编辑器里「预览脚本」同一套 API)。

安装

npm install map-tools-vue-viewer
# 或本地路径 / 私有源
npm install file:../packages/map-tools-vue-viewer

Vue ^3.4,peer dependency。

构建产物见 dist/;开发联调可 Vite alias 到包的 src/index.js

快速使用

import { createApp } from 'vue';
import MapToolsViewer from 'map-tools-vue-viewer';

const app = createApp(App);
app.use(MapToolsViewer); // 注册全局 <MapViewer />

或按需:

<script setup>
import { MapViewer } from 'map-tools-vue-viewer';
</script>
<template>
  <MapViewer
    api-base="/api"
    :map-id="1"
    :get-headers="() => ({ Token: 'your-token' })"
    height="100vh"
  />
</template>

Props

| 属性 | 说明 | |------|------| | apiBase | 接口根路径,需能访问 GET /maps/:idGET /custom-componentsGET /resources/proxy | | mapId | 地图 ID(与 mapData 二选一) | | mapData | 直接传入与 GET /maps/:id 相同结构的对象,可不请求接口 | | getHeaders | () => ({ Token: '...' }) 等与编辑器一致的鉴权头 | | script | 业务脚本字符串;不传则用地图内嵌 script;传 '' 禁用脚本 | | scriptInterval | 脚本轮询间隔 ms;不传则沿用地图内嵌配置 | | loadCustomComponents | 是否请求自定义组件列表(默认 true) | | height | 容器高度,默认 100% |

脚本 API(与编辑器预览一致)

脚本体内可写:

(function () {
  const els = getElements();
  const el = els.find((e) => e.type === 'text');
  if (el) setElement(el.id, { content: 'Hello' });
})();

实际由组件注入:getTokenrequest(fetch,自动带 getHeaders)、setElement(id, patch)getElements()

工具方法

import { fetchMapData, parseMapRecord } from 'map-tools-vue-viewer';

发布到 npm

cd packages/map-tools-vue-viewer
npm run build
npm publish

(若包名占用可改为 @your-scope/map-tools-vue-viewer 并修改 package.jsonname。)