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

@_nu/css-toast

v0.0.6

Published

NU 「 no-ui 」 组件库系统 nu-system 「 Toast 组件 」

Downloads

32

Readme

nu-vanilla-toast

npm package

NU 「 no-ui 」 组件库系统 nu-system 「 Toast 组件 」

怎么用?

yarn add @_nu/css-toast
<link src="https://cdn.jsdelivr.net/npm/@_nu/css-toast/css/core.min.css" />
<link src="https://cdn.jsdelivr.net/npm/@_nu/css-toast/css/skins/bootstrap.min.css" />
@_nu/css-toast/css
├── core.css           // 核心样式
└── skins
    └── bootstrap.css  // 借用 bootstrap alert 的样式

因为组件只有最基础的交互样式,所以在实际使用需要根据设计需求进行二次样式封装。

Dom 结构

<div class="nu_toast">
  <div class="nu_toast_in">
    <!-- 这是放toast文字的地方 -->
  </div>
</div>

为了拓展性这边约定需要创建两层 dom 并且名称为 nu_toastnu_toast_in

Api

| 选择器 | 功能 | |:----------|-------------:| | .nu_toast._open | 是否显示toast | | .nu_dialog._[skins] | toast 的皮肤 |

这边约定用 _open 来控制 toast 的显示隐藏。

对于设计系统我们推荐 UI 是收敛的,所以建议只需要实现 _success,_warning,_danger 即可。

当然如果你有自定义需求,建议采用 bootstrap 的颜色方案:

_priamry,_secondary,_success,_warning,_danger,_info,_light,_dark

如何添加动效?

.nu_toast{
  visibility: hidden;
  opacity: 0;
  transform: translate(0, -10px);
  transition: 200ms;
}

.nu_toast._open {
  visibility: visible;
  opacity: 1;
  transform: translate(0, 0);
}

如何添加皮肤 ?

.nu_toast {
  border-radius: .25rem;
  padding: .75rem 1.25rem;
  color: #004085;
  background-color: #cce5ff;
  border: 1px solid #b8daff;
}

.nu_toast._danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.nu_toast._warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
}

.nu_toast._success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

Logic Only