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

@umon752/web-password

v1.0.2

Published

A Web Component for password visibility toggle

Readme

web-password

一個用於密碼顯示/隱藏切換的 Web Component。

安裝

NPM

npm install @umon752/web-password

CDN

<!-- unpkg -->
<script type="module" src="https://unpkg.com/@umon752/web-password"></script>

<!-- 或 jsDelivr -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@umon752/web-password"></script>

使用方式

ES Module

import '@umon752/web-password';

HTML

<web-password-controller>
  <input type="password" id="password" name="password" placeholder="請輸入密碼">
  
  <web-password-button>
    <!-- 密碼可見時顯示 -->
    <div slot="on" aria-label="顯示密碼">👁️</div>
    <!-- 密碼隱藏時顯示 -->
    <div slot="off" aria-label="隱藏密碼">👁️‍🗨️</div>
  </web-password-button>
</web-password-controller>

API

<web-password-controller>

容器元件,用於包裹 <input><web-password-button>

CSS 變數

| 變數名稱 | 預設值 | 說明 | |---------|--------|------| | --password-controller-gap | 8px | 子元素間距 |

<web-password-button>

密碼顯示/隱藏切換按鈕。

屬性 (Attributes)

| 屬性名稱 | 類型 | 預設值 | 說明 | |---------|------|--------|------| | password-visible | 'on' | 'off' | 'off' | 控制密碼顯示狀態 |

方法 (Methods)

| 方法名稱 | 說明 | |---------|------| | on() | 顯示密碼 | | off() | 隱藏密碼 | | kill() | 移除元件並觸發 web-password-controller:kill 事件 |

CSS 變數

| 變數名稱 | 預設值 | 說明 | |---------|--------|------| | --password-button-width | 24px | 按鈕寬度 | | --password-button-height | 24px | 按鈕高度 |

Slots

| Slot 名稱 | 說明 | |----------|------| | on | 密碼可見時顯示的內容 | | off | 密碼隱藏時顯示的內容 |

事件 (Events)

| 事件名稱 | 說明 | |---------|------| | web-password-controller:kill | 當呼叫 kill() 方法時觸發 |

TypeScript 支援

此套件包含完整的 TypeScript 型別定義。

import { WebPasswordController, WebPasswordButton } from 'web-password';

// 型別會自動識別
const button = document.querySelector('web-password-button');
button?.on();

瀏覽器支援

支援所有現代瀏覽器(Chrome、Firefox、Safari、Edge)。

License

MIT