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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wecity/watermark

v1.0.1

Published

## 前端水印方案

Downloads

4

Readme

@wecity/watermark

前端水印方案

概述

  • 1、使用canvas动态创建水印内容,输出base64
  • 2、利用css:background属性,自动排列水印图片单元
  • 3、使用MutationObserver进行dom移除以及样式修改监听

快速使用

yarn add @wecity/watermark
import WaterMark from 'watermark'

new WaterMark({
  width: 500,
  height: 300,
  rotation: -30,
  shadow: true,
  fontSize: 24,
  color: 'rgba(255, 255, 255, 0.1)',
  text: [
    'text word 1',
    'text word 2'
  ]
})

配置参数

| 名称 | 必须 | 说明 | 类型 | 默认值 | |--| -- |--|-- |-- | | text | 是 | 水印内容,换行请使用数组模式 | Array | -- | | id | 否 | 水印外层容器id | String | watermark | | width | 否 | 水印单元宽度 | Number | 200 | | height | 否 | 水印单元高度 | Number | 100 | | shadow | 否 | 水印字体阴影 | Boolean | false | | color | 否 | 水印字体颜色 | String | rgba(255, 255, 255, 0.1) | | font | 否 | 水印字体 | String | 微软雅黑 | | rotation | 否 | 水印旋转角度,顺时针方向旋转,单位角度 | Number | -15 | | onlyBase64 | 否 | 仅用于创建base64,不会添加水印容器到全局 | Boolean | false | | onlyWaterDOM | 否 | 仅用于创建base64以及水印内层容器,不会添加水印容器到全局 | Boolean | false | | forceVisible | 否 | 是否开启dom移除样式修改守护,若监听到非法操作,组件会重新渲染水印内容,禁止手动移除 | Boolean | false |

API

| 名称 | 说明 | | -- | -- | | toggle | 开关,切换水印可见与否,通过此api操作水印可见合法,不会触发守护功能 | | getBase64 | 获取当前水印的base64字符串 | | getWaterContent | 获取当前水印内层容器的outerHTML字符串,可用于自定义添加到任何父容器内 |