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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ember-cli-x-popup

v0.1.0

Published

A simple popup component with smart relative positioning

Readme

ember-cli-x-popup

This addon is intended to provide a smart, highly customisable, positional wrapper for popups/tooltips/dialogs.

Installation

ember install ember-cli-x-popup

Usage

This addon consists of two components, namely: {{x-popup}} and {{x-popup-trigger}}.

{{x-popup}} is the core component and can be used in isolation, if visibility is controlled by you, in the following way:

{{#x-popup isOpen=myCustomProperty position="top-center"}}
  ...
    I will show top-center if myCustomProperty is true
  ...
{{/x-popup}}

Alternatively, an optional trigger wrapper is included which will manage visibility for you, based on hover and click states:

  {{#x-popup-trigger as |popup|}}
    <span>My trigger element</span>
    {{#x-popup isOpen=popup.isOpen bottom=100 left=50 x=-50}}
      ...
        I will show left-center on hover and click, after 500ms
      ...
    {{/x-popup}}
  {{/x-popup-trigger}}

API

position

Positions can be set via a preset position, or alternatively with more specific, CSS corresponding, values:

| Preset | Values | |:--------------- |:------------------------------- | | top-center | bottom: 100, left: 50, x: -50 | | top-left | bottom: 100 | | top-right | bottom: 100, right: 0 | | right-center | left: 100, top: 50, y: -50 | | right-bottom | bottom: 0, left: 100 | | right-top | top: 0, left: 100 | | bottom-center | top: 100, left: 50, x: -50 | | bottom-right | top: 100, right: 0 | | bottom-left | top: 100 | | left-center | top: 50, right: 100, y: -50 | | left-top | top: 0, right: 100 | | left-bottom | bottom: 0, right: 100 |

Note that x and y corresponds to translate values in CSS.

unit

Used to calculate positioning, defaults to %, can be any CSS valid unit.

reposition

The addon will detect if the preferred position is possible and display it so, unless it cannot due to the size of the popup content or position of the trigger element in relation to the viewport, in which case it will fallback to the most viable alternative, or in impossible cases error out in the console. It will also binds an .error class. Defaults to true.

pinned

Components can be pinned to keep them open, and pinning will take preference over normal hover states. On devices without mouse events, this is how they are openend.

triggerDelay

Sets the delay on the {{x-popup-trigger}} in ms before showing any popups on hover. Defaults to 300.

delay

Sets the delay in ms on the {{x-popup}} component itself. Not related to any specific gestures. Will compound with value of triggerDelay if both are set. Will also delay on touch by default. Defaults to 300.

isOpen

This is exposed both in the wrapping {{x-popup-trigger}} component and core {{x-popup}} components and can be managed from there programmatically.

forceOpen

Useful to override the open state in both components. Takes preference.

Tips

Animations

The .x-popup element is by default set to display:none. If you would like to animate it in, simply set it to display:block; and manage the visiblity using visibility and opacity,

Example:

.x-popup{
  display: block;
  visibility: hidden;
  opacity: 0;
  transition: transform ease 200ms 0ms, opacity linear 200ms 0ms, visibility linear 200ms 0ms;
  will-change: opacity,transform,visibility;
  &.is-open{
    visibility: visible;
    opacity: 1;
    transition: transform ease 200ms 200ms, opacity linear 200ms 200ms, visibility linear 200ms 200ms;
  }
}

Contributing

Feel free to create a PR for any contributions.