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

@caoguo/map-editor

v0.0.1

Published

草果地图大屏可视化编辑器 —— 拖拽式大屏搭建工具,零代码创建游戏式地图大屏

Readme

@caoguo/map-editor

草果地图大屏可视化编辑器 —— 零代码、拖拽式搭建「游戏式地图大屏」。对应 docs/prd/prd/visual-editor.md

功能范围(本阶段)

  • 编辑器框架:顶部工具栏 + 左侧组件面板 + 中央画布 + 右侧属性面板 + 底部图层列表。
  • 组件面板:5 大类 24 个组件(基础 / 设备 / 数据卡片 / 图表 / 容器),可拖入画布。
  • 画布交互:拖拽放置、移动、缩放、选中、网格吸附(snapToGrid + gridSize)、缩放比例。
  • 属性面板:按组件类型动态渲染配置表单(地图 / 设备层 / 数据卡 / 图表等)、数据源表单(static/rest/websocket/binding)、通用位置大小与样式。
  • 图层列表:显隐 / 锁定 / 层级上下移 / 删除。
  • 工具栏:场景切换、新增场景、新增地图、撤销/重做(Ctrl+Z/Ctrl+Y)、导入/导出 JSON、保存(localStorage + 下载)、预览模式。
  • 模板系统:6 套行业模板(农业 / 管网 / 电网 / 水网 / 交通 / 空白)。
  • JSON SchemaDashboardConfig 与 PRD 第五章完全对应,可作为运行引擎的源配置。

数据模型(核心)

interface DashboardConfig {
  version: string;
  theme: 'dark' | 'light';
  canvas: { width; height; background };
  scenes: Scene[];   // 每个场景 = 一个页面,含 map + layers + components
}
  • MapLayer:渲染在地图上的图层(如 device-layermap)。
  • ComponentNode:叠加在地图上的 UI 组件(设备列表 / 数据卡 / 图表 / 容器等)。

使用

<script setup>
import { Editor } from '@caoguo/map-editor';
import '@caoguo/map-editor/style.css';
</script>

<template>
  <div style="height: 100vh">
    <Editor />
  </div>
</template>

以编程方式创建配置:

import { useEditor, TEMPLATES } from '@caoguo/map-editor';
const { setConfig } = useEditor();
setConfig(TEMPLATES[0].build()); // 套用农业模板

构建

pnpm build   # vue-tsc 生成 d.ts + vite 库构建(ESM/CJS/style.css)

后续阶段(TODO,见 PRD)

  • W3 渲染引擎:根据 DashboardConfig 真实渲染地图底图(maplibre)、设备标记、图表、联动与下钻。
  • W4 交互逻辑:设备点击联动、筛选、详情面板、数据驱动的实时更新。
  • W5 协作/发布:多端大屏、导出部署、版本管理。

目录

src/
  types.ts               # DashboardConfig 等类型(= JSON Schema)
  components.ts          # 组件注册表(24 个组件定义)
  templates.ts           # 行业模板注册表
  store/
    useEditor.ts         # 全局状态(配置/场景/选中/节点增删)
    useHistory.ts        # 撤销/重做
    useDragDrop.ts       # 拖拽/移动/缩放
  editor/
    Editor.vue           # 主容器
    Toolbar.vue          # 顶部工具栏
    ComponentPanel.vue   # 左侧组件面板
    Canvas.vue           # 中央画布
    PropertyPanel.vue    # 右侧属性面板
    LayerList.vue        # 底部图层列表
    properties/          # 配置/数据源/通用属性表单