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

ng-focus-selector

v0.0.4

Published

For device like `candy`, `qwerty`, `tv apps`, `stb` etc where element selection happens with keypad (or) remote, selection of element across the application will become complex.

Downloads

4

Readme

ng-focus-selector

For device like candy, qwerty, tv apps, stb etc where element selection happens with keypad (or) remote, selection of element across the application will become complex.

ng-focus-selector tag wraps application and listen to key events like UP, DOWN, RIGHT & LEFT.

focus-selector class helps in finding out all focusable elements on page.

Based on row and column definition of elements ng-focus-selector understand how to navigate in the page.

Installation

Install via Package managers such as npm or yarn

npm install ng-focus-selector --save
# or
yarn add ng-focus-selector

How to use

Import NgFocusSelectorModule

import { NgFocusSelectorModule } from 'ng-focus-selector';

@NgModule({
  imports: [ NgFocusSelectorModule ]
})

Then in HTML, wrap the app into <ng-focus-selector></ng-focus-selector>

Then in TS to give focus to the desired element


import { FocusSelectorComponent } from 'ng-focus-selector';

constructor(
@Inject(FocusSelectorComponent) private focusSelectorComponent
) {}

ngAfterViewInit() {
this.focusSelectorComponent.setActiveIndex(1);
}

Or focus can be given to element after any async operation

this.httpClient.get().subscribe((data) => {
if(data) {
  this.content = data;

    setTimeout(() => {
      this.focusSelectorComponent.setActiveIndex(1);
    });
  }
})

References

Row & Column Reference

<div class="focus-selector"  row="0">
  ROW 0
</div>

<div
  class="focus-selector"
  *ngFor="let data of [1, 2]; let i = index"
  row="1"
  [attr.column]="i"
>
ROW 1 <br /> COLUMN {{ i }}
</div>

Grid Reference

arr = [
  {row: 0, column:0}, { row: 0, column:1 }, { row: 0, column:2},
  {row: 1, column:0}, { row: 1, column:1 }, { row: 1, column:2},
  {row: 2, column:0}, { row: 2, column:1 }, { row: 2, column:2}
];
<div
  class="focus-selector"
  [attr.row]="data.row"
  isgrid="true"
  [column]="data.column"
  *ngFor="let data of arr; let i = index"
>
</div>

Menu Reference

<ul>
  <li
    class="focus-selector"
    [attr.row]="i"
    column="0"
    *ngFor="let data of [0, 1, 2, 3, 4, 5]; let i = index"
  >
  MENU ITEM {{ i + 1}}
  </li>
</ul>

Page with Tabs & Header Reference

<section>
  <div class="focus-selector" row="0">
    <img src="search" alt="search" />
  </div>
   <div
      class="tabs"
      *ngFor="let tab of tabs; let i = index"
      row="1"
      [column]="i"
      [attr.tabfocus]="false"
      istabheader="true"
      [attr.taburl]="tab.url"
      >
        {{ tab.title | translate }}
    </div>
    <div class="filter">
      ALL
    </div>
    <div
      *ngFor="let content of tabContent; let i = index"
      class="focus-selector"
      column="0"
      [attr.row]="i + 3"
      istabitem="true"
    >
    ROW {{ i }} <br />
    TABINDEX {{ tabIndex }}
    </div>

</section>