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

smf-dialog

v1.0.1

Published

Dialog JavaScript library for Smartface

Downloads

1

Readme

 ____                       _    __                      _       
/ ___| _ __ ___   __ _ _ __| |_ / _| __ _  ___ ___      (_) ___  
\___ \| '_ ` _ \ / _` | '__| __| |_ / _` |/ __/ _ \     | |/ _ \ 
 ___) | | | | | | (_| | |  | |_|  _| (_| | (_|  __/  _  | | (_) |
|____/|_| |_| |_|\__,_|_|   \__|_|  \__,_|\___\___| (_) |_|\___/ 
-----------------------------------------------------------------

Dialog

This library is a Smartface library. It is intended to display an dialog alike container that blocks interaction except it self.

Install

npm i smf-dialog

Smartface

If you are within a Smartface workspace first switch to scripts folder. Here is a script that does it all:

(cd ~/workspace/scripts && npm i smf-dialog)

Usage

This library provides a Dialog constructor and a static wait dialog.

  • Dialog class/constructor can be used to create new Dialog's.
  • Dialog.showWait & Dialog.removeWait is used to display/hide wait dialog

It is both possible to use require or include or load functions to run this library.

Examples

In every example below it is assumed to this library has been running using following code:

var Dialog = require("smf-dialog");

Wait dialog

//start network activity
Dialog.showWait();

//when activity completes
Dialog.removeWait();

Dialog basics

var d = new Dialog();

var lbl = new SMF.UI.Label();
d.overlay.add(lbl);


//to show the dialog:
d.show();


//to hide the dialog:
d.hide();


//it is possible to show it on another page:
d.show(Pages.page2);
Pages.page2.show();
//it cannot be shown on two pages. Showing it on another page, removes it from the earlier page:
Pages.back();
d.show();
Pages.page2.show();

Dialog background

When dialog is created the background of it can be customized by the following ways:

var d = new Dialog({ //passes the defaults for background rectangle constructor
    background: {
        alpha: 0.2,
        width: "70%",
        height: "40%",
        left: "15%",
        top: "30%"
    }
});

d.background //gives you to access to the rectangle object

Dialog overlay container

All child objects of the dialog should be added to overlay container of the dialog. By default it has size defaults as:

  • top: "15%"
  • left: "30%"
  • height: "70%"
  • width: "40%"
var d = new Dialog({ //passes the defaults for overlay container constructor
    overlay: { //makes the whole overlay as fullscreen
        width: "100%",
        height: "100%",
        left: 0
        top: 0,
        onShow: function(e) {
            //add your onShow logic for the dialog
        }
    }
});

d.overlay //gives you to access to the overlay container object