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

callout-alert

v1.0.1

Published

Markdown Callouts, as a Web Component, written in Tram-Lite

Downloads

7

Readme

callout-alert

A Github / Obsidian inspired web component for displaying a callout in your page.

Live Example on Codepen

How to use

<script src="https://unpkg.com/callout-alert@1"></script>

<callout-alert type="tip">
  Optional information to help a user be more successful.
</callout-alert>

Types of Alerts

The following types are available by default:

| type | color | icon | title | | ----------- | ------ | ---------------- | --------- | | note | blue | info circle | Note | | tip | green | lightbulb | Tip | | important | purple | report comment | Important | | warning | yellow | warning triangle | Warning | | caution | red | report octogon | Caution | | Default | grey | document icon | Note |

You can also configure the Color, Icon, and Title using CSS variables or slots.

CSS API

The following CSS variables can be used to control the presentation of the component:

You can set some or all of these for a specific callout-alert instance, or at a page level.

<style>
  callout-alert {
    --callout-color: 0, 200, 225;
    --callout-icon: 'bolt';
    --callout-title: 'Alert';
  }
</style>

<callout-alert> Watch out for Lightning bolts! </callout-alert>

Slot API

You can use the following slot names to change the icon or title of the callout.

You can set some or all of these inside a callout-alert instance.

<callout-alert type="tip">
  <span slot="icon">📦</span>
  <span slot="title">Slots</span>
  This is a custom alert, that uses slots to set the icon and title.
</callout-alert>

Known Limitations

Below are a list of known limitations. While there may be available solutions here, an effort has been made to make the code as straight-forward as possible.

Colors

Until relative CSS colors are universally supported, the colors are defined as three numbers. Ideally, once relative colors are supported, we would allow any CSS color (this will be marked as a breaking change, if introduced).

Icon Library

By default, this component loads Google's Material Icon font in the owner document using javascript. Sadly, it's currently not possible to load font-families from a web component context, or from a stylesheet in a component.

Development

This component was built using Tram-Lite, you can read more about the project at https://tram-one.io/tram-lite/.

You can load all the component variants, plus a slot and CSS variable example by running:

npm ci
npm run build
npm start

Then, navigate to the listed IP address /example.