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

planogram-tools

v0.1.0

Published

可视化编辑/生成卧柜(chest cabinet) planogram JSON 的 npx 工具:定义柜体尺寸 → 划分列(shelf) → 划分 basket → 填充 products(skuId),支持双向导入渲染与手动调整。

Readme

planogram-tools

可视化编辑 / 生成 卧柜 (chest cabinet) planogramnpx 小工具。零依赖、启动即用。

  • 正向:定义柜体尺寸 → 划分列(shelf) → 每列划分 basket → 在 basket 中填 skuId → 填写 planogramId / planogramRefMedia → 导出符合目标 schema 的 JSON。
  • 反向:导入一份已有的 planogram JSON,直接在画布上渲染出来,拖拽 / 编辑手动调整后再导出。

使用

# 新建一个空白 planogram
npx planogram-tools

# 载入已有文件编辑(可直接“保存到文件”写回同一路径)
npx planogram-tools examples/case3.json

# 指定端口 / 不自动打开浏览器
npx planogram-tools case3.json --port 5000 --no-open

在本仓库内可直接运行:

node bin/cli.js examples/case3.json

启动后浏览器打开 http://localhost:4173/

界面与操作

  • 左栏planogramIdplanogramRefMedia,柜体 blockx/y/w/h,加列 / 删列,以及“参考底图”(仅用于描摹对位,不写入 JSON)。
  • 画布
    • 拖动列之间的竖线调整列宽;
    • 拖动 basket 之间的横线调整高度;
    • 点击某个 basket 选中并编辑。
  • 右栏:编辑选中列的宽度 / 增删 basket;编辑选中 basket 的高度与 skuId(逗号分隔,可多个);底部 原始 JSON 文本框可实时查看,也可粘贴 JSON 后点“从文本框应用”。
  • 顶栏:新建 / 导入 JSON / 下载 JSON / 复制 JSON / 保存到文件(仅当启动时带了文件参数)。

数据模型与不变量

编辑器内部以「柜体 + 每列宽度 + 每 basket 高度」为可编辑量,位置(x/y)在渲染时自动顺排,因此始终满足:

  • 所有列宽之和 = 柜体宽 block.w
  • 每一列内所有 basket 高度之和 = 柜体高 block.h

整数分配采用「最大余数法」,保证像素相加严格等于总量。对于连续排布的数据(如示例),导入 → 导出完全无损(已用 examples/case3.json 验证一致)。

导出格式

{
  "planogramId": "...",
  "planogramRefMedia": "...",
  "blocks": [
    {
      "blockNumber": 1,
      "blockBoundingBox": { "x": 54, "y": 20, "w": 498, "h": 191 },
      "shelves": [
        {
          "shelfNumber": 1,
          "shelfBoundingBox": { "x": 54, "y": 20, "w": 82, "h": 191 },
          "baskets": [
            {
              "basketNumber": 1,
              "basketBoundingBox": { "x": 54, "y": 20, "w": 82, "h": 64 },
              "products": [ { "skuId": "486709" } ]
            }
          ]
        }
      ]
    }
  ]
}
  • 一个 basket 内多个 SKU 输出为单个 product、skuId 用逗号连接(如 "486699,486674"),与示例一致。
  • 导入时会把每个 product 的 skuId 按逗号拆分收集;当前编辑器聚焦单柜体(blocks[0])。