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

es6dialog

v1.3.5

Published

**ES6 Dialog** is a minimal and easy-to-use dialog plugin, which uses the ``<dialog>`` html element. It is written in ECMAScript 9 Object-Oriented Javascript (OOJS).

Downloads

13

Readme

es6dialog

ES6 Dialog is a minimal and easy-to-use dialog plugin, which uses the <dialog> html element. It is written in ECMAScript 9 Object-Oriented Javascript (OOJS).

How to

  1. Download the es6dialog.js script and include es6dialog.js in your webpage.

    <script src="es6dialog.js"></script>

    Or install via npm install es6dialog --save or yarn add es6dialog --save and import it:

    import dialog from "es6dialog"
    // Note: you will still need to manually import the es6dialog.(s)css file in your project
  2. An ES6 Dialog can be triggered as follows :

    HTML triggered

    import dialog from "es6dialog"
    dialog.init() // Adds a listener on all the .js-dialog links
    <!-- This js-dialog element targets the data-dialog value -->
    <a href="#" class="js-dialog" data-dialog="myDialog">Show dialog</a>
    
    <dialog id="myDialog">
      <h2>My Dialog</h2>
      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. </p>
    </dialog>

    JS triggered (import/require needed):

    import { es6Dialog } from "es6dialog"
    myDialog = new es6Dialog(element).open()

    JS triggered through Window Object (no import/require needed):

    <script src="es6dialog.min.js"></script>
    new window.es6Dialog(myDialog).open()

Demo with code examples Netlify Status

Can be seen here.

JS API - methods

Note: You will need to import/require es6dialog in order to use these methods.

dialog.init(settings, callback)

The dialog.init() will automatically detect all the html elements which have the .js-dialog class, and will open the matching dialog on user's click.

dialog.init();

Note: you can set your own settings like that :

dialog.init({
  selector: "js-customDialog",
  width: "500px"
}, () => {
  console.log('Callback')
});

open()

The open() method enables you to trigger a dialog element.

const element = document.querySelector("#amazingDialog")
// The simple way
const amazingDialog = new es6Dialog(element)
amazingDialog.open()

// Or the advanced way
const bigFixedDialog = new es6Dialog(element, {
  width: "1000px",
  fixed: true
})
bigFixedDialog.open()

close()

The close() method closes the dialog :

bigFixedDialog.close()

Here is the list of settings :

  • selector (default: ".js-dialog")
  • closeText
  • scroll (default: true)
  • height (default: "auto")
  • width (default: "600px")
  • shadow (default: false)
  • fixed (default: (false)
  • elementClass (default: "dialog")