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

navgroups

v0.0.35

Published

NavGroup is a flexible and powerful react component for creating UI navigation base around big screen tv's. It allows you to quickly map out a web layout that can be controlled via a keyboard, similar to the type of experience you might find on tv's.

Downloads

13

Readme

NavGroups

In Development

NavGroup is a flexible and powerful react component for creating ui navigation base around big screen TV's. It allows you to quickly map out a web layout that can be controlled via a keyboard, similar to the type of experience you might find on TV's.

Built With

React: A JavaScript library for building user interfaces

TypeScript: JavaScript that scales.

Setup

For production use install NavGroups using NPM and include it in your own React build process using webpack.

bash $ npm install -save NavGroups

import * as React from "react";
import * as ReactDOM from "react-dom";
import { NgController, NavGroup, NavItem } from "nav-groups";

Development

$ git clone https://github.com/Devine-Davies/NavGroups.git
$ cd NavGroups
$ npm install
$ npm run dev        - Deployment environment
$ npm run start      - Deployment environment
$ npm run prepublish - Deployment environment

HTML Markup & Props

Below illustrates the type of markup used to construct the navgroups react componant. The exsample is given in the from of TSX

index.tsx

import * as React from "react";
import * as ReactDOM from "react-dom";
import { NgController, NavGroup, NavItem } from "nav-groups";

const App = () => (
    <div className='window' >
        <NavGroup name="main-menu" direction="vertical" onLeft="" onRight="ng:last"  >
            <NavItem>Movies</NavItem>
            <NavItem>Music</NavItem>
            <NavItem>Profile</NavItem>
            <NavItem >Setting</NavItem>
        </NavGroup>
        <NavGroup name="movie-list" onLeft="ng:main-menu" onLeft="" >
            <NavItem>Movie .01</NavItem>
            <NavItem>Movie .02</NavItem>
            <NavItem>Movie .03</NavItem>
            <NavItem>Movie .04</NavItem>
        </NavGroup>
    </div>
);

ReactDOM.render(<App />, document.getElementById("example") );

Setting Props for NavGroup && NavItem

| Setting props | Avalable | Type | Description | |------------------ |------------|------------|-----------------------------------------------------------------| | name | NG & NI | String | The name you wish to give the navitem/navgroup. If none given a random one will be generated. | | activeClassName | NG & NI | String | Class name given to an active navgroup/navitem | | direction | NG | String | Can except "horizontal" or "vertical" the key binding will the change depending on the direction specified | | indicateActiveItem | NG | Boolean | When decleard on a group attr, the group will add the class of the item name to it's self | | historyItem | NG | Boolean | Tells the navgroup to remember to remember the last selected navitem and use that as the first selected navitem when entering. | | startingPoint | NI | Boolean | Is the main item that will be select when first entering the group. | | entryPoint | NI | Boolean | Use this navitem as the first selected item wehn entering a navgroup, takes priority over historyItem. |

Action Props & Instructions

Action props define what type of interaction you want the navgroup/navitem and every action needs an instruction. The Example below show's how these actions are binded to either the NavGroup and NavItem components.

<NavGroup name="movie-list" onLeft="" >
    <NavItem onLeft="" onDown="" >Movie .01</NavItem>
</NavGroup>

Action Props

| Action prop | Avalable | Description | |------------------ |----------|---------------------------------------------| | onEnter | NG & NI | Invoked via the enterkey (↵) | | onBack | NG & NI | Invoked via the backkey (←) is invoked | | onUp | NG & NI | Invoked via the up arrow key (▲) or W | | onRight | NG & NI | Invoked via the right arrow key(►) or D | | onDown | NG & NI | Invoked via the down arrow key(▼) or S | | onLeft | NG & NI | Invoked via the left aorrow key(◄) or A |

Default actions are applied and change occordadly depending on the direction of navgroup.

| Action prop | Vertical | Horizontal | |------------------ |----------|------------| | onUp | ni:prev | ng:prev | | onRight | ng:next | ni:next | | onDown | ni:next | ng:next | | onLeft | ng:prev | ni:prev |

Action instructions

Instructions contain infromation on how the navgroup/navitem should respond when an action has been invoked.

Navgroup instructions

| Instructions | is default | Description | |---------------|------------|-----------------------------------------------------------------------| | ng:next | default | next navgroup | | ng:prev | default | previous navgroup | | ng:last | | Go to last selected navgroup | | ng:{{#}} | | Go to the given navgroup by index | | ng:{{name}} | | Go to the navgroup by name | | hook:{{name}} | | add the name of your custom hook (must be set up in custom methods ) |

Navitem instructions

| Instructions | is default | Description | |---------------|------------|-----------------------------------------------------------------------| | ni:next | default | next navitem | | ni:prev | default | previous navitem | | ni:last | | Go to last item | | ni:first | | Go to first item | | ni:{{#}} | | Go to the given index of an item | | ni:{{name}} | | Go to the item with that name |

It's important to note that NavItem's take priority over NavGroup's instructions.

Instructions can be concatenated together by using the pipe operator (| ) For example ng:{{#}}|ni:{{#}}

Programmatically run instruction

Instructions can be invoke via the NgController by calling the run_instructions() methord and then passing the instruction string.

import { NgController, NavGroup, NavItem } from "navgroups";

NgController.run_instructions( 'ng:menu|ni:profile' )

Authors

Rhys Devine-Davies - Profile

License

This project is licensed under the MIT License - see the LICENSE.md file for details`