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

coupdoeil

v1.1.1

Published

Javascript for Ruby on Rails Coupdoeil gem

Downloads

70

Readme

Coupdoeil

Gem Version

A framework to easily handle popovers.

Documentation

See coupdoeil.org for full documentation.

There is also an introduction article I wrote for the first release.

Overview

What is a Coupdoeil::Popover?

Popovers are ruby objects used to easily build powerful popups (from basic tooltips to full dialog popovers). They are mostly inspired by GitHub popovers (like hovering on a link to a repo, or a username) and Wikipedia popups (when hovering a link to another wikipedia article).

Click to toggle examples

See more use-cases in documentation

The current implementation takes inspiration from both ViewComponent and ActionMailer, to make it as easy as possible to use while offering a wide range of possibilities.

# app/popovers/contact_popover.rb
class ContactPopover < Coupdoeil::Popover
  def details
    @contact = params[:contact]
  end
end
<%# app/popovers/contact_popover/details.html.erb %>
<div class="contact-details">
  <%= image_tag @contact.avatar %>
  <strong><%= @contact.first_name %> <%= @contact.last_name %></strong>
  <!-- ... -->
</div>

Which is embedded by doing so:

<%# app/views/messages/show.html.erb %>
<div>
    <span>From: </span>
    <%= coupdoeil_popover_tag ContactPopover.with(contact: @contact).details do %>
      <span class="contact-pill"><%= @contact.email %></span>
    <% end %>
</div>

Why use Coupdoeil popovers?

The concept of 'quick look' allowed by popovers can really improve UX by avoiding the need to navigate to another page and back again just to check summary for a resource. It also permits to hiding until use some parts of UI like small forms, or quick actions in a list of elements.

The most common examples of such popover are on GitHub (when hovering over a link to a repo, user profile, a PR, etc.) or on Wikipedia (when hovering over a link to another article).

While basic popups implementations can be made with simple helpers, data-attributes, and a bit of JavaScript, it tends to get too complex over time and often not handle enough edge-cases to be used everywhere it could improve UX.

Coupdoeil::Popover offers a way to easily encapsulate and power up popovers rendering logic. It allows a lot of customization possibilities (see options) and promotes re-usability by using an API similar to parameterized ActionMailer (see Why does it look like a mailer?).

This gem also tries to handle all known issues of such popovers, such as the user's mouse quickly leaving and re-entering popover without closing it, preventing opening of a popover if mouse did not stop on it, etc.

Performances

By default, a popover content is not loaded until it is needed. It means the DOM is not cluttered with 'maybe to be used' HTML, hidden in template tags or data-attributes. However, params have to be present in HTML so they are sent for rendering the popover (eg: a record id), so try passing as few as required to build it later during render. Also, popovers are cached so the fetch happens only the first time a popover is open.

When needed, popovers can still be preloaded and included in DOM on initial page load. See preload option.

Licence

Coupdoeil is available as open source under the terms of the MIT License

Contributing

This repository is not yet opened for contributions as the gem's internals are still subject to significant changes, although I guarantee no breaking change while refactoring. However, issues are much welcomed!