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

bunnn-web-screenshot

v1.0.0

Published

A frontend scaffolding for screenshot based on html2canvas

Downloads

10

Readme

WebScreenshot

English | 中文

基于 html2canvas 的轻量级前端手动截屏插件。支持手动框选区域、截图预览、多语言等功能。

✨ 特性

  • 🟦 TypeScript 支持:提供完整的类型定义。
  • 🖐 手动框选:支持拖拽框选截图区域。
  • 🔄 操作便捷:支持重置选区、取消截图。
  • 🔒 滚动锁定:截图过程中自动锁定页面滚动。
  • 📍 智能定位:操作按钮组根据视口空间自动调整位置。
  • 🌐 国际化:支持中文和英文(默认为中文)。

📦 安装

npm install bunnn-web-screenshot

🚀 使用方法

1. 引入插件和样式

import { WebScreenshot } from 'bunnn-web-screenshot';
// 如果你的构建工具没有自动处理样式,可能需要手动引入 CSS
import 'bunnn-web-screenshot/dist/style.css';

2. 基本用法

const screenshot = new WebScreenshot();

// 开始截图
screenshot.start((blob) => {
  if (!blob) return;
  // 截图成功后的回调,返回一个 Blob 对象
  const img = document.createElement('img');
  img.src = URL.createObjectURL(blob);
  document.body.appendChild(img);
});

3. 国际化配置

默认使用中文界面。如果需要英文界面,可以在初始化时配置:

const screenshot = new WebScreenshot({
  lang: 'en' // 'zh' | 'en'
});

📚 API 文档

new WebScreenshot(options?)

创建一个截图实例。

| 参数 | 类型 | 默认值 | 描述 | | --- | --- | --- | --- | | options | WebScreenshotOptions | {} | 配置选项 | | options.lang | 'zh' \| 'en' | 'zh' | 界面语言 |

instance.start(callback)

开始截图流程。

| 参数 | 类型 | 描述 | | --- | --- | --- | | callback | (blob: Blob \| null) => void | 截图完成后的回调函数,接收生成的 Blob 对象 |

📄 License

ISC