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

mwhiteboard

v1.0.3

Published

## 插件安装 ```shell npm install mwhiteboard --save ```

Readme

mwihitebard

插件安装

npm install mwhiteboard --save

插件使用

<template>
    <div class="white-board-box" ref="whiteboardBox">
        <WhiteBoard :options="options" ref="whiteboard" />
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";
import WhiteBoard, { OPTION_TYPE } from "mwhiteboard";

const whiteboard = ref();
const whiteboardBox = ref();
const options = ref({
    offsetX: 0,
    offsetY: 0
});

const resize = () => {
    // 窗口发生变化重新计算距离
    const { x, y } = whiteboardBox.value.getBoundingClientRect();
    options.value = {
        offsetX: x,
        offsetY: y
    };
}

onMounted(() => {
    // 初始化黑板
    resize();
    window.addEventListener("resize", resize);
    whiteboard.value.setOptionType(OPTION_TYPE.PEN);
});
</script>

<style>
.white-board-box {
    width: 100%;
    height: 600px;
}
</style>

黑板操作模式

export enum OPTION_TYPE {
    PEN = "PEN", // 画笔
    MOUSE = "MOUSE", // 移动和缩放
    CLEAR = "CLEAR", // 清空画板
    ERASER = "ERASER", // 橡皮擦
    COMPASS = "COMPASS", // 圆规
    RULER = "RULER", // 直尺
    PROTRACTOR = "PROTRACTOR", // 量角器
}

黑板属性

| 属性 | 描述 | 类型 | 默认 | | ----------- | ----------- | ----------- | ----------- | | options | 配置参数(浏览器可视区域左上角距离) | { offsetX: number; offsetX: number; } | { offsetX: 0, offsetY: 0 } |

黑板事件

| 事件名 | 描述 | 回调参数 | | ----------- | ----------- | ----------- | | scrollChange | 当发生滚动是触发回调 | (scroll: { scrollX: number, scrollY: number }) | | zoomChange | 当发生缩放是触发回调 | (zoom: number) | | closeTool | 当工具关闭是触发 | - |

黑板开放的方法

| 方法 | 描述 | 类型 | | ----------- | ----------- | ----------- | | setScroll | 设置画布上下左右的滑动 | (x: number, y: number) => void | | setZoom | 设置画布缩放(最小0.1) | (zoom: number) => void | | setOptionType | 设置绘制的模式 | (type: OPTION_TYPE) => void | | setToolTypes | 设置工具 | (type: OPTION_TYPE) => void | | setLineWidth | 设置画笔粗细 | (width: number) => void | | setDrawColor | 设置画笔颜色 | (color: string) => void | | render | 绘制渲染 | () => void | | getElements | 获取绘制元素集合 | () => IElement[] | | setElements | 设置绘制元素集合 | (elements: IElement[]) => void | | reset | 复位 | () => void | | clear | 清空元素 | () => void | | undo | 撤销 | () => void | | redo | 恢复 | () => void | | canUndo | 是否允许撤销 | boolean | | canRedo | 是否允许恢复 | boolean |


【注】使用黑板时不要存在滚动轴。