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

@pharos-lab/blink

v0.1.2

Published

<a name="readme-top"></a>

Downloads

3

Readme

About The Project

Blink is a tool for quickly add tooltip, pop-up and more in your project within few lines of code.

Getting Started

All you need is installing the Blink package and add few lines of code.

Prerequisites

You just need npm installed to get Blink.

  • npm
    npm install npm@latest -g

Installation

Install NPM package

npm install @pharos-lab/blink

Usage

All you need to create a pop-up or else is two element at least:

  • A trigger, like a button or any element you wish
  • A popper, the element you want to appear based on the event you choose (hover or click)

Then, in your js file, you can import the Blink class and use the create method to create your pop-up, tooltip or whatever element you want to make appearance.

Here is a exemple:

In html file

<!DOCTYPE html>
<title>Popper example</title>

<button id="button" >I'm a button</button>
<div id="tooltip">I'm a tooltip</div>

In Js file

import { Blink } from '@pharos-lab/blink'

const button = document.getElementById('button')
const tooltip = document.getElementById('tooltip')

Blink.create(button, tooltip)

Use it with VUE

<template>
<title>Popper example</title>

<button id="button" ref="trigger">I'm a button</button>
<div id="tooltip" ref="popper">I'm a tooltip</div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { Blink } from '@pharos-lab/blink'

const button = ref()
const tooltip = ref()

onMounted(() => {
  Blink.create(button.value, tooltip.value)
})

</script>

Use it with REACT

import { Blink } from 'pharos-lab/blink'
import { React } from 'react'

class MyComponent extends React.Component {
   constructor(props) {
    super(props);
    this.trigger = React.createRef();
    this.popper = React.createRef();
  }

  componentDidMount() {
    Blink.create(this.trigger.current, this.popper.current);
  }

  render() {
    return (
      <div>
        <!-- your component JSX -->

        <p>Lorem ipsum dolor sit amet <span ref={this.trigger}>adipiscing</span> elit, sed do</p>

        <div className="popper" ref={this.popper}>
          I'm a tooltip
        </div>
      </div>
    );
  }
}

Customization

placement

The Blink create method will place your pop-up automatically based on the place available in the viewport.

By default, it will try at top of the trigger, then bottom, right and finally left. But you can choose by adding an option object as 3rd argument to create method.

Example
const options = {
  placement: 'top'
}

Blink.create(trigger, tooltip, options)

You may choose the placement among these values: top, bottom, right, left, auto.

auto is the default option

Event

In addition to the placement option, you can choose what kind of event will trigger the pop-up with the event option

Example
const options = {
  event: 'click'
}

Blink.create(trigger, tooltip, options)

You may choose the event among these values: click, hover.

hover is the default option

Arrow

Finally, you can add an arrow to the pop-up for UI/UX appreciation with the arrow option

Example
const options = {
  arrow: true
}

Blink.create(trigger, tooltip, options)

You may choose the arrow option among these values: true, false.

false is the default option

Dropdown

If you want to create a dropdown that is right or left aligned with your trigger, you can use the dropdown option.

Example
const options = {
  dropdown: 'right'
}

Blink.create(trigger, tooltip, options)

You may choose the dropdown option among these values: right, left, none.

none is the default option

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License.

Contact

pharos-lab - @pharOsLab - [email protected]

Project Link: https://github.com/pharos-lab/blink