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

bannery

v0.0.7

Published

> A really easy-to-use component for generating fully customized banners. You can take advantage of it in order to show, for example, a cookie consent banner or even to announce an upcoming event.

Downloads

14

Readme

Bannery

A really easy-to-use component for generating fully customized banners. You can take advantage of it in order to show, for example, a cookie consent banner or even to announce an upcoming event.

⭐️ Features

  • Options from external source
  • Markdown support
  • Start/End date
  • One-time display
  • Callbacks
  • CSS customization
  • Custom CSS animation

⚙️ Usage

Install

npm -i bannery
// or
yarn add bannery

ES Module

import Bannery from 'bannery';

import 'bannery/dist/style.css';
import 'bannery/dist/theme.css'; // or use "css" option

Bannery({ url: 'https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/example.json' });

CDN

Alternatively, you can include it via jsDelivr CDN:

UMD:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/theme.css">

<script src="https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/bannery.umd.js"></script>
<script>
  Bannery({ url: 'https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/example.json' });
</script>

ES module:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/theme.css">

<script type="module">
  import Bannery from "https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/bannery.es.js";

  Bannery({
    url: "https://cdn.jsdelivr.net/gh/embedmode/bannery/dist/example.json"
  });
</script>

Parameters

  • External source options will be deep-merged with passed by parameter.

| Attribute | Type | Default | Description | | ----------------- | -------- | --------- | ---------------------------------------------------------------------------------------------------------------------- | | key | string | | Banner identity. It will be used as DOM element id, part of cookie name and passed as a query string for data requests | | url | string | | Provide an external options source. Must return a valid JSON body. | | options | object | see below | Local options | | hooks.onOptions | function | | After getting and merging options, you can use this hook to modify them | | hooks.onOpen | function | | Sets banner to show or hide | | hooks.onPrimary | function | | Triggers when primary button is clicked. Native event passed | | hooks.onSecondary | function | | Triggers when secondary button is clicked. Native event passed |

Options

example.json

| Key | Type | Default | Description | | --------------------- | ------- | --------------------- | ----------------------------------------------------------------------------------------------- | | enabled | boolean | true | First thing checked in order to display our banner | | title | string | | Support markdown without html, only rendered if exists | | description | string | | Support markdown without html, only rendered if exists | | position | string | bottom | [top|bottom] Banner display position | | display.startDate | date | | Banner will be shown if current date is later than startDate, regardless of endDate | | display.endDate | date | | Banner will be shown if current date is before endDate, regardless of startDate | | display.mode | string | | [cookie|session] Enables one-time banner display, storing a value in cookies or sessionStorage | | buttons.primaryLink | string | | Primary button link, usually used as a confirm button | | buttons.primaryText | string | | Primary button text, usually used as a confirm button as well | | buttons.secondaryText | string | | Secondary button text, normally used as a close button | | themeClass | string | bannery-default-theme | Root element class name used as a theme class name | | css | string | | css string injected as a style tag | | animation | string | | css animation class name |

🌐 Browser support

| IE / Edge | Firefox | Chrome | Safari | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Edge | >= 52 | >= 59 | >= 11 |

🙌 Contributing

To learn how to setup a development environment and for contribution guidelines, see CONTRIBUTING.md.

🚧 Development

yarn install

// Compiles and hot-reloads for development
yarn serve

// Lints and fixes files
yarn lint

// Compiles and minifies for production
yarn build

📜 Changelog

We use GitHub releases.

🔐 Security

To report a security vulnerability, please use the Tidelift security contact.

📄 License

This project is licensed under the terms of the MIT license.