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

@wefterjs/dialog

v0.0.1

Published

Official Wefter plugin for native alert, confirm, prompt, and toast dialogs on Android & iOS. No permissions. No hardware. Pure UI.

Readme

@wefterjs/dialog

Official Wefter plugin for native alert, confirm, prompt, and toast dialogs on Android & iOS.
No permissions. No hardware. Pure UI.


Features

  • 🔔 Alert — Native blocking alert with a single dismiss button.
  • ✅ Confirm — OK / Cancel dialog that resolves with { value: boolean }.
  • ✏️ Prompt — Input dialog that resolves with the user's text (or cancelled: true).
  • 🍞 Toast — Lightweight non-blocking notification that auto-dismisses.

Platform implementation

| Method | Android | iOS | |-----------|--------------------------------------|------------------------------------------------| | alert | AlertDialog.Builder | UIAlertController (.alert) | | confirm | AlertDialog.Builder | UIAlertController (.alert) | | prompt | AlertDialog.Builder + EditText | UIAlertController + addTextField | | toast | Toast.makeText() | Custom UILabel overlay with fade animations |

No Gradle or CocoaPods dependencies required.


Installation

wefter add @wefterjs/dialog
wefter sync

Permissions

None. Dialog and toast APIs are pure UI — they require no runtime permissions on either platform.


JavaScript API Reference

import { Dialog } from "@wefterjs/dialog";

Dialog.alert(options)

Shows a native alert with a single dismiss button. Resolves when the user taps it.

interface AlertOptions {
  title?: string;       // Bold title above the message
  message: string;      // Body text
  buttonText?: string;  // Dismiss button label (default: "OK")
}

await Dialog.alert({ title: "Done", message: "Your file was saved." });
// → { value: true }

Dialog.confirm(options)

Shows a native two-button confirm dialog. Resolves with { value: true } (OK) or { value: false } (Cancel).

interface ConfirmOptions {
  title?: string;
  message: string;
  okText?: string;      // Default: "OK"
  cancelText?: string;  // Default: "Cancel"
}

const { value } = await Dialog.confirm({ message: "Delete this item?" });
if (value) {
  // user tapped OK
}

Dialog.prompt(options)

Shows a native text-input dialog. Resolves with the user's typed value or cancelled: true if dismissed.

type InputType = "text" | "email" | "password" | "number" | "url" | "tel";

interface PromptOptions {
  title?: string;
  message: string;
  okText?: string;       // Default: "OK"
  cancelText?: string;   // Default: "Cancel"
  placeholder?: string;  // Ghost text in the field
  inputType?: InputType; // Keyboard / input mode (default: "text")
  defaultValue?: string; // Pre-filled text
}

interface PromptResult {
  cancelled: boolean;
  value: string;         // "" when cancelled
}

const { cancelled, value } = await Dialog.prompt({
  message: "Enter your username",
  placeholder: "e.g. johndoe",
});

if (!cancelled) {
  console.log("Username:", value);
}

Dialog.toast(options)

Shows a brief, non-blocking toast notification that disappears automatically.

type ToastDuration = "short" | "long" | number; // number = ms (Android) / s (iOS, normalised)
type ToastPosition = "top" | "center" | "bottom";

interface ToastOptions {
  text: string;
  duration?: ToastDuration;  // Default: "short" (≈ 2 s)
  position?: ToastPosition;  // Default: "bottom"
}

await Dialog.toast({ text: "Changes saved!", duration: "short", position: "bottom" });
// → { shown: true }

Note: toast resolves immediately after the toast is shown, not after it auto-dismisses — consistent with Flutter's ScaffoldMessenger.showSnackBar.


Complete Usage Example

import { Dialog } from "@wefterjs/dialog";

export async function deleteAccount() {
  // 1. Confirm intent
  const { value: confirmed } = await Dialog.confirm({
    title: "Delete account",
    message: "This action is permanent and cannot be undone.",
    okText: "Delete",
    cancelText: "Keep account",
  });

  if (!confirmed) return;

  // 2. Collect reason via prompt
  const { cancelled, value: reason } = await Dialog.prompt({
    title: "One last thing",
    message: "Why are you leaving? (optional)",
    placeholder: "Your reason",
  });

  if (cancelled) return;

  // 3. Perform deletion … then confirm with toast
  await Dialog.toast({ text: "Account deleted.", duration: "long" });
}

Error Handling

Errors surfaced from the native layer are thrown as WefterBridgeError:

import { WefterBridgeError } from "@wefterjs/core";

try {
  await Dialog.toast({ text: "" }); // empty text → INVALID_TEXT
} catch (err) {
  if (err instanceof WefterBridgeError) {
    console.error(err.code, err.message); // "INVALID_TEXT" "toast text must not be empty"
  }
}

Error codes

| Code | Method | Cause | |----------------|---------|----------------------------------| | INVALID_TEXT | toast | text is blank or empty string |