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

image-mark-tile

v0.4.5

Published

项目地址(使用参考README): https://gitlab.meitu.com/innovate-frontend/image-mark-tile

Readme

图片标注库

支持工具

拖动图片:点击后可对图片进行拖动

矩形工具:点击后可在图上画矩形,可支持调整线框大小颜色以及是否空心,参考截图工具

椭圆形工具:同矩形工具,但形状为椭圆形

箭头:点击后可在图上画箭头

文字:点击后可在图上插入文本框

install

 npm install @meitu/image-mark --registry http://npm.meitu-int.com

Usage

import ImageMark from '@meitu/image-mark';
type PanzoomDataInfoType = {
  scale:number;
  x:number;
  y:number;
  isInit:boolean; // true:初始拖拽缩放;false:用户修改后
}
  const [imageInfo, setImageInfo] = useState({
        url: '', // 示例 URL
        json: {}
    });

  const [zoomInfo, setZoomInfo] = useState<PanzoomDataInfoType>({
    scale:1,
    x:0,
    y:0,
    isInit:true // 是否初始缩放
  });

    const onCanvasUpdate = (data:any,zoomDataInfo:PanzoomDataInfoType)=>{
    console.log('画布通知更新数据 data',data);
    console.log('画布通知更新数据 zoomDataInfo',zoomDataInfo);
    setZoomInfo(zoomDataInfo);
    setImageInfo({url:curUrl6,json: data})
  }
    return (
    <div className='app'>
      <div className="imageMarkWrap">
      <!-- 需要为 imageMarkWrap 设置宽高  -->
      <ImageMark isCanEdit={true} zoomInfo={zoomInfo} imageInfo={imageInfo} onCanvasUpdate={onCanvasUpdate} />
      </div>
    </div>
  )

目录介绍 /dist 打包后的文件目录 /lib 源码文件 /src 开发所需的资源文件目录 /package.json 命令行配置文件 /vite.config.ts vite 打包配置文件


推荐 node 版本: v20.11.1

本地包测试

1 生成 /dist 文件 npm run build

2 建立软链接,在开发的 npm 包项目中执行 npm link

tips:这将会把当前目录中的包注册到全局的 npm 包中,并建立一个全局的软链接

3 业务项目中使用本地软链接 npm link @meitu/image-mark

tips:这将创建一个到全局 npm 包软链接的本地依赖。现在,目标项目中使用这个包的地方将直接指向你本地开发的包

4 测试完毕,释放目标项目中软链接 npm unlink @meitu/image-mark


验证本地包内容: 生成一个 .tgz 文件,你可以打开它来查看打包内容

mac vips 生成切片图: vips dzsave large_image.jpg tiles

npm pack

发包准备

1 登录账号

npm login

检查 package.json 字段,假设此时包的名称为 @lqq2/demo

{
  name: '@lqq2/demo',
  version: '1.0.0',
  main: './dist/xxx.umd.cjs',
}

2 发包

npm publish

版本记录

@meitu/image-mark

v1.0.27: 线上稳定版本

v1.0.28-beta.4: 缩放中也监听位移坐标

v1.0.28: 支持鼠标触摸板缩放;不支持原图,原图有卡顿,添加可编辑文字会造成插件崩溃

组件改为切片加载方式,重新命名

@meitu/image-mark-tile

v0.0.7: 支持切片

v0.0.8: fix:组件卸载报错问题

v0.0.9: fabric cdn 引入,接入方打包时 docker 太慢

v0.0.10: 保存优化

v0.0.11: 保存优化,避免重复重新渲染插件 openSeadragon 和 fabricjsOverlay

v0.0.12: openSeadragonRef.current.fabricjsOverlay({scale: 1000})

v0.1.0: 根据原始图片比例和 fabricjsOverlay({scale: 1000}),计算 fabric 裁剪区域### ### v0.1.1: afterTileSources 变化,先销毁 openSeadragon,再重新初始化

v0.2.1: 支持对比图模式,传入 beforeTileSources 即可

v0.2.2: 支持对比图模式,使用 openSeadragonScaleBaseRef.current 计算 fabric 剩余裁剪区域

v0.2.5: 拖拽滑块增加 switchDiv

v0.2.6: 对比图模式,支持使用 ctrl+m 快捷键切换是否可使用滑竿

v0.2.7: 对比图模式,支持使用 shift+z 快捷键切换为对比模式和拖拽模式

v0.2.8: 对比图模式,afterTileSources 和 beforeTileSources 改变都重新渲染 openSeadragon

v0.2.9: 对比图模式,不可编辑状态也支持显示对比图标

v0.3.0: 对比图模式,左侧工具栏才展示对比菜单

v0.3.1: 对比图模式,根据图片高度动态设置切换对比开关的宽高

v0.3.2: 对比图模式:tips:对比图片高度不一致将导致滑竿异常,请确认对比图片是否正确

v0.3.3: 使用 antd message 提示,配置 antd 不打包进库的依赖

v0.3.4: open 事件可能会触发多次,避免重复创建 viewEleRef.current

v0.3.5: 销毁 openSeadragon 的时候也要销毁 viewEleRef.current,toolsObj 改为响应式对象

v0.3.6: 重新渲染后,重新定位工具为拖拽工具 drag

v0.3.7: antd 版本和项目中有冲突,使用 react-hot-toast 的 toast 提示

v0.3.8: antd 版本和项目中有冲突,使用 react-toastify 的 toast 提示

v0.3.9: 对比模式下,自动切换工具为对比工具

v0.4.0: 对比模式下,自动切换工具为对比工具,优化拖动对比滑竿时圆球的位置

v0.4.1: 对比模式下,useEffect 只监听 beforeTileSources ,不监听 imageInfo 对象,否则绘图工具操作完,会自动定位到 对比工具上

v0.4.2: 升级 [email protected] 版本,配置支持 webgl

v0.4.3: 设置 crossOriginPolicy: undefined 根据浏览器同源策略决定是否携带凭证