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

autotoast.js

v3.0.5

Published

轻量化的小弹窗

Readme

一个轻量化小弹窗,无需任何依赖,一行代码即可弹出,并自动管理状态。

安装

pnpm i autotoast.js

使用

import autotoast from "autotoast.js";

autotoast.log("Hello World", "success", 2500);
// 其中 "success" 和 2500 都是可选项

自定义 icon

支持 svg 字符串,iconfont 类名,通过 createautotoast 方法创建自定义实例。

自定义 icon 时,autotoast 将优先使用你的自定义 icon,也就是说,你可以通过覆盖默认 icon 来修改预设图标。

autotoast 在创建弹窗元素时,会将 自定义 icon 的 key 作为 class 添加到 span 元素上,你可以通过 css 来自定义样式。如 autotoast-customSvgautotoast-iconfont

import { createautotoast } from "autotoast.js";
const autotoast = createautotoast({
 svgIcons: {
     customSvg: `<svg>...</svg>`,
     iconfont: "icon-xxx"
 }
});

自定义样式

autotoast.js 提供了最简单的 css 和 预设图标,你可以通过覆盖默认样式来自定义弹窗样式。

这是全部的默认样式:

#autotoast {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
  width: 100vw;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 20px;
  z-index: 9999999;
  cursor: pointer;
  transition: 0.2s;
}

#autotoast > span {
  pointer-events: auto;
  width: max-content;
  animation: fadein 0.4s;
  animation-delay: 0s;
  border-radius: 6px;
  padding: 10px 20px;
  box-shadow: 0 0 10px 6px rgba(0, 0, 0, 0.1);
  margin: 4px;
  transition: 0.2s;
  z-index: 9999999;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: max-content;
  overflow: hidden;
  background-color: #fafafa;
}

#autotoast > span > span {
  max-width: 50vw;
}

#autotoast span.hide {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  height: 0;
  padding: 0;
  margin: 0;
}

#autotoast > .autotoast-warn {
  background-color: #fffaec;
  color: #e29505;
}

#autotoast > .autotoast-error {
  background-color: #fde7e7;
  color: #d93025;
}

#autotoast > .autotoast-info {
  background-color: #e6f7ff;
  color: #0e6eb8;
}

#autotoast > .autotoast-success {
  background-color: #e9f7e7;
  color: #1a9e2c;
}

#autotoast > .autotoast- {
  background-color: #fafafa;
  color: #333;
}

@keyframes fadein {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}