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

ember-right-click-menu

v0.8.0

Published

An easy and flexible addon to add context menus anywhere in your application

Downloads

251

Readme

Build Status Ember Observer Score Maintainability

Ember Right Click Menu

An easy and flexible addon to add context menus anywhere in your application

Compatibility

This addon is made for Ember Octane, with glimmer components

  • Ember.js v3.20 or above
  • Ember CLI v3.20 or above
  • Node.js v12 or above

Installation

ember install ember-right-click-menu

Setup

The right click menu needs some styling, which must be included manually. Add one of the following imports to your application. If you don't want any custom styling and style the right click menu on your own, you can just import the default.

  @import 'ember-right-click-menu';
  @import 'ember-right-click-menu-default'; /* without any additional styling */

If you don't want to include material icons, you can add the following lines to your styling instead

.ember-right-click-menu {
  display: none;
}

.ember-right-click-menu[data-show] {
  display: block;
}

In oder to make the context-menu work, you need to include the following line in your application. For example in the index.html or application.hbs.

<div id="ember-right-click-menu-wormhole"></div>

Preview

Ember Right Click Menu

Live demo: https://fabriquartz.github.io/ember-right-click-menu/

Usage

The right click menu will be applied to its parent element. Options for the right click menu are added via a simple list of objects that contain a name, an action and a property to make it disabled. You can nest options to create a multi level context menu.

items = [
  { title: "Link", action: this.saveHyrule },
  { title: "Zelda", action: this.petEpona, disabled: true },
  { title: "Navi", items: [
    { title: "Annoy the gamer", action: this.sayHeyListen },
    { title: "Help Link out", action: this.sayHeyListen },
    { title: "Yell for attention", action: this.sayHeyListen },
  ]}
]
<span>
  Element with context menu
  <RightClickMenu @items={{this.items}} />
</span>

The following attributes can be used to add your items:

  • action (function to trigger on click)
  • class (string to add classnames to the list item)
  • disabled (boolean to enable/disable a list item)
  • divider (boolean to add a visual divider after the list item it's on)
  • title (string to show in the list item)

Customize

You can render your own template or component in the menu item by passing as shown in the example below. Add anything you like to your list of objects (as shown before) to be able to use it in your template.

<span>
  Element with context menu
  <RightClickMenu @items={{this.items}} as |item|>
    <div>
      <PaperIcon @icon={{@item.iconName}}>
      <label>
        {{@item.title}}
      </label>
      <span class="subtitle">
        {{@item.subtitle}}
      </span>
    </div>
  </RightClickMenu>
</span>

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.