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

watermark-component-for-react

v1.0.0

Published

A novel react component for watermark

Downloads

163

Readme

Install

npm install --save watermark-component-for-react

Usage

import React from 'react';
import WaterMark from 'watermark-component-for-react';
import * as styles from './index.css';

class ReactDemo extends React.Component{
  render () {
    const content = `内部文档,请勿外传 by-前端小黑`;
    return (
      <WaterMark content={content}>
        <div className={styles.wrapper}>hello world</div>
      </WaterMark>
    );
  }
}
export default ReactDemo;

Props

| 成员 | 说明 | 类型 | 默认值 | | ----- | :--------: | :---------: | :---------: | | style | watermark最外层组件内联样式 | undefined | object | undefined | | container | 容器 | HTMLDivElement | document.body | | width | canvas元素宽 | string | 300 | | height | canvas元素高 | string |200 | | textAlign | 绘制文本的对齐方式 | string |left | | textBaseline | 文本基准线 | string | bottom | | font | 字体大小及样式 | string | 16px Microsoft Yahei | | fillStyle | 自定义水印的颜色 | string | black | | content | 水印内容 | string | 内部文档,请勿外传 | | globalAlpha | 设置图形和图像透明度的值 | number | 0.1 | | rotate | 文字旋转角度 | number | 16 | | zIndex | 元素堆叠顺序 | number | 1000 |

Feature

  1. 使用 MutationObserve 监视 DOM 的变动,水印不可被删除、且属性不可被修改。
  2. 丰富的 props 使得水印组件可实现定制化需求。