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

enerthya.dev-toast

v1.0.0

Published

Common toast notification layer for the Enerthya ecosystem. Inspired by Loritta's luna:toast-common module. Framework-agnostic types, constants, factory and dark-glass style presets.

Readme

enerthya.dev-toast

Camada comum de notificações toast para o ecossistema Enerthya. Inspirado em luna:toast-common (Loritta/MrPowerGamerBR).

Framework-agnostic — define tipos, constantes, factory e estilos dark-glass. A dashboard conecta ao react-hot-toast; qualquer outro consumidor pode adaptar livremente.


Instalação

npm install enerthya.dev-toast

O que está incluído

Constantes

const { TOAST_TYPES, TOAST_TYPE_VALUES, TOAST_DURATION, TOAST_DURATION_PERSISTENT } = require("enerthya.dev-toast");

TOAST_TYPES.SUCCESS   // "success"
TOAST_TYPES.ERROR     // "error"
TOAST_TYPES.WARNING   // "warning"
TOAST_TYPES.INFO      // "info"

TOAST_TYPE_VALUES     // ["success", "error", "warning", "info"]

TOAST_DURATION.success  // 3000ms
TOAST_DURATION.error    // 4500ms
TOAST_DURATION.warning  // 3500ms
TOAST_DURATION.info     // 3000ms

TOAST_DURATION_PERSISTENT  // Infinity — toast não fecha sozinho

Factory

const { createToast, createSuccessToast, createErrorToast, createWarningToast, createInfoToast, isToast } = require("enerthya.dev-toast");

// Cria um objeto toast normalizado:
// { id, type, message, duration, payload }
const t = createToast("success", "Salvo com sucesso!");

// Shorthands:
createSuccessToast("Salvo!");
createErrorToast("Algo deu errado.");
createWarningToast("Atenção.", { duration: 5000 });
createInfoToast("Sabia que...", { id: "meu-id-unico" });

// Type guard:
isToast(t) // true

Opções do createToast

| Campo | Tipo | Descrição | |-------|------|-----------| | duration | number | Override da duração padrão (ms) | | id | string | ID explícito (útil para deduplicação) | | payload | any | Dado extra livre |


Estilos (dark-glass)

const { TOAST_STYLES, TOAST_STYLE_BASE, TOAST_ICON_EMOJI, getToastStyle, getToastEmoji, buildToastOptions } = require("enerthya.dev-toast");

// Objeto de style pronto para react-hot-toast:
getToastStyle("success")  // { background, color, border, backdropFilter, ... }
getToastStyle("error")    // idem, com border vermelho

// Emoji textual por tipo:
getToastEmoji("success")  // "✅"
getToastEmoji("error")    // "❌"
getToastEmoji("warning")  // "⚠️"
getToastEmoji("info")     // "ℹ️"

// Monta as options do react-hot-toast a partir de um objeto toast:
const opts = buildToastOptions(t);
// opts = { duration, id, style }
// Pronto para: toast.success(t.message, opts)

Uso na dashboard (com react-hot-toast)

Hook useToast

import { useToast } from "@hooks/useToast";

const { showSuccess, showError, showWarning, showInfo } = useToast();

showSuccess("Configurações salvas!");
showError("Sem permissão para salvar.");
showWarning("Atenção: canal não encontrado.");
showInfo("Dica: ative o módulo primeiro.");

Integração direta

import toast from "react-hot-toast";
import { createSuccessToast, buildToastOptions } from "enerthya.dev-toast";

const t = createSuccessToast("Salvo!");
toast.success(t.message, buildToastOptions(t));

Testes

node test.js
# Total: 42 | ✅ 42 passed | ❌ 0 failed

Inspiração

luna:toast-common — módulo interno da Loritta (MrPowerGamerBR). Adaptado de Kotlin/KMP para JavaScript/Node.js com foco na dashboard da Enerthya.