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

ngx-radial-menu

v1.0.2

Published

This library is an Angular adaptation of yandongCoder's circular-menu library: https://www.npmjs.com/package/circular-menu

Downloads

14

Readme

NgxRadialMenu

This library is an Angular adaptation of yandongCoder's circular-menu library: https://www.npmjs.com/package/circular-menu

Features

  • Customizable: The menu component accepts a number of configuration options, allowing for different visual presentation.
  • Submenus: Menu items may have submenus that fly out around that menu item.
  • Material Icons: Works seamlessly with material icons, either font icons, or svg icons. (compatibility with other icon sets is an option I hope to add)
  • Contexual Data: It also allows data to be passed in when the menu is called, which will be automatically passed to any of the menu items' callback (click) functions.
  • Dynamic Menu Items: It also allows menu items to be filtered out based on an array passed at the time show() is called. You can use the filter to create a menu that is responsive to the context, only containing certain menu items if the click target meets certain criteria.

Installation

npm install ngx-radial-menu

Peer Dependencies

@angular/material - used for mat-icons

Component Usage

<ngx-radial-menu [config]="menuConfig"></ngx-radial-menu>

Config

[config] Apply a Partial<MenuConfig> object with any of the properties under options below.

Options

  • totalAngle: The total arc of the menu (i.e. 180 is a half circle)
    • value: 0-360 (unit is unnecessary)
    • default: 360deg (complete circle)
  • spaceDeg: The space between menu items
    • value: number (0-5 is suitable)
    • default: 0 (The default is good)
  • background:
    • value: Acceptable CSS color value
    • default: #323232
  • backgroundHover:
    • value: Acceptable CSS color value
    • default: #515151
  • pageBackground (For antialiasing):
    • value: Acceptable CSS color value ( You should pass the color of your page. )
    • default: transparent
  • diameter(circular menu radius):
    • value: number (unit is unnecessary)
    • default: 300px
  • position:
    • value: "top" | "left" | "right" | "bottom"
    • default: "top"
  • start:
    • value: 0-360 (unit is unnecessary)
    • default: 0 deg
  • horizontal :
    • value: boolean
    • default: true
  • hideAfterClick (Whether hide menu after click):
    • value: boolean
    • default: true
  • menus: MenuItem[] (see Menu Items)

Menu Items

  • title: string (Title is not too long, otherwise it will overflow container)
  • icon: uses mat-icon, compatible with font icons or svg icons
    • fontIcon: string for using mat-icon font icons
    • fontSet: string font set for font icons only
    • svgIcon: string name of svgIcon, may include namespace
    • color: Any acceptable CSS color
  • href: string (url, like "http://google.com" or "#hash")
  • target: '_self' | '_blank' | '_parent' | '_top' for href links
  • click: (event: MouseEvent, data: any) => void (click callback function)
    • Data passed by show(...) will be provided to callback functions as the second argument
  • disabled: boolean | () => boolean (boolean value, or a boolean valued function)

Methods

  • hide(): hide menus

  • show (coordinates: {x: number, y: number}, data?: any, filter?: string[]):show menus

    • coordinates: The location to open the menu, usually derived from event.clientX and event.clientY of a MouseEvent
    • data: any data you want to make available to the click functions. This data is set once when the menu is generated, and used by all click callbacks, so if different functions need different data items, be sure to structure your data input here to accommodate that.
    • filter: an array of the titles of MenuItems that should not display at all for this call.

Here is an example of how you might use show with all of its arguments:

public showRadialMenu(event:MouseEvent, vertex: Vertex) {
  let filter = [];  
  if (vertex.pinned) filter.push('pin')
  else filter.push('unpin')
  this.ngxRadialMenu.show({x:event.clientX,y:event.clientY}, vertex, filter)
 }

This will ensure that the 'unpin' menu item is only available when the vertex is pinned, and the pin option is available when it is not already pinned. Passing the vertex in as the data object allows all of the menu callback functions to act on that specific vertex, or to make use properties of that vertex.