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

watermark-core

v1.1.4

Published

Watermark components that can be manually controlled, updated, and destroyed. Supports text watermarking, multi-line text watermarking, and image watermarking. Supports watermark rotation and automatically calculates the watermark size according to the te

Readme

更新说明

1.1.4 更新内容

  • 清理 console.log

1.1.3 更新内容

  • 修复配置项 rotate 传 0 时的取值问题
  • 修复 textAlign 为 lef 时,绘制文本的 x 取值不正确。

1.1.2更新内容

  • 修复 offset 配置项第二个值为 0 时取了第一个值的问题。

使用说明

安装

  npm i watermark-core

或者

  <script src="./watermark.umd.js"></script>

使用

vue2/3、react、javascript 的不同使用示例都在 watermark仓库/examples/* 目录下。 进入各个目录(js 目录除外,可直接打开 index.html)后执行以下命令启动示例项目查看。

  npm i
  npm run dev

以下示例为 html + javascript

html 结构:

<div id="testBox">
  <h1>xxxxx</h1>
  <h2>xxxxxxxxxxx</h2>
  <p>nihao</p>
  <!-- ... -->
  <button class="J_toggleWatermarkContentBtn">切换水印内容</button>
  <button class="J_showWatermarkBtn">显示水印</button>
  <button class="J_hiddenWatermarkBtn">隐藏水印</button>
</div>

script:

  let content = ['watermark1(水印 1)', 'watermark2(水印 2)', 'watermark3(水印 3)'],

  const getContainer = () => document.querySelector('#testBox')

  const watermark = new Watermark({
    content,
    getContainer
  })

  watermark.draw()

  document.querySelector('.J_toggleWatermarkContentBtn').addEventListener('click', () => {

    content = ['这是新的水印']

    watermark.draw({
      content,
      getContainer
    })
  })
  document.querySelector('.J_showWatermarkBtn').addEventListener('click', () => {
    watermark.draw({
      content,
      getContainer
    })
  })
  document.querySelector('.J_hiddenWatermarkBtn').addEventListener('click', () => {
    watermark.destroy()
  })

样式:

  #testBox {
    position: relative;
    width: 500px;
    height: 500px;
    margin: 100px auto;
    border: 1px solid #ddd
  }