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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ng-librarian

v0.0.12

Published

Micro-framework for component library abstraction.

Readme

ng-librarian

Micro-framework for component library abstraction.

  • framework: standard component abstractions
  • structure: domain-driven project folder structure
  • databinds: simplified databinding directives
  • extension: productive prototype extensions
  • samplings: template-driven encapsulation
  • lifecycle: unified lifecycle methods
  • servicing: jwt, api and idb services

Structure

Isolated app screen components (branching) from lib control components (tranversal) for reuse purpose.

APP                             LIB
 ├ home/                         ├ classes/
 │  ├ home.component.html        │  ├ sample.ts
 │  ├ home.component.css         │  └ index.ts   
 │  ├ home.component.ts          ├ components/
 │  └ index.ts                   ├ directives/
 ├ app.component.html            ├ extensions/
 ├ app.component.css             ├ services/
 ├ app.component.ts              └ shareds/
 ├ app.service.ts                   ├ interfaces.ts
 └ app.module.ts                    ├ modules.ts
                                    └ index.ts  

Abstractions

Lean component abstractions useful facade resources in base ControlComponent and specialized abstraction as below.

                   [ControlComponent]  
                           ▲
          ┌────────────────┼─────────────────┐
   [InputComponent] [OutputComponent] [ThruputComponent]
      read-write        read-only       wrapper/parent

Example of component abstraction usage.

@Component({selector: 'field', template: '<b>It works!</b>' })
export class FieldComponent extends InputComponent  { ... }

Control components with its main attributes:

  • InputComponent (name, fail, info, rows)
  • OutputComponent (that, wrap, path)
  • ThruputComponent (side, gaps)

The base control component contains guid, html, data, bind, size, click, style, class, hidden, disabled, on(stage), fix(attrs), render(...). Some those members is a facade for some usual resources:

  • guid: autogenerated id attribute
  • html: the current HTML element
  • bind: formControlName equivalent
  • data: ngModel/formGroup equivalent
  • on(stage): facade for life-cycle hooks
  • fix(attrs): fix boolean attributes as HTML flags
  • render(...): easy page refresh with changeDetectorRef.detectChanges

| size | cast | hidden | view | gone | done | |:-:|:-:|:-:|:-:|:-:|:-:| | ngOnInit | ngAfterContentInit | ngOnChanges | ngAfterViewInit | ngOnDestroy | ApplicationRef.isStable |

Bindings

Simplified reactive form data binding directives with [data] and [bind] (it doesn't require to tranform data in FormGroup), and also works as template-driven.

<!-- simplified reactive form -->
<form [(data)]="car"> 
   <input bind="model">
</form>

<!-- template-driven -->
<input bind="car.model">

Stylings

All components inherits class and style hostbinding and is based in those CSS variables --default, --primary, --inverse, --success, --warning, --failure, also with some font variables as font-size, font-name, font-color. Default styles could be add in angular.json as './node_modules/ng-librarian/lib/index.css' in "styles".

...
"styles": ["./app/styles.css", "./node_modules/ng-librarian/lib/index.css"],
...

Extension

It has self-generate unique id for each HTML element of component (extensible by guidfy method) and prototype extensions helpers

| Class | Prototype method extensions | |-|-| | String | encrypt(); decrypt(); equals(that); equalize()**; contains(that); toDate(); toObject(format); toBoolean(); toCamelCase() | | Array | take(); distinct(); toObject(); remove(f); min(f); max(f); sum(f); flatMap(f) | | Date | getLastMonthDay(); toDateTimeString(dateType, timeType); toDateString(type); toTimeString(type); toDateModel(); toTimeModel(); toNumber(); toArray() | | Number | toDate(); format(); toMoney(digits, typing); toBoolean() | | Object | let(field, value); stringify(); dictionarify() | | Element* | toObject(); toArray(); toComponent(); maskfy(); databind(data); toMoney(digits); isCommandKey(); get value; set value; get refer; |

Also some static class members helpers

// global label to render boolean values
Boolean.TRUE = "yes"
Boolean.FALSE = "no"

// validate any kind of data as Date
Date.isDate(value)

// some static object key helpers
Object.hasKeys(obj, 'field1', 'field2')
Object.hasTypeOf(obj, 'field1', 'string')
Object.hasInstanceOf(obj, 'field2', Date)

Servicing

Some common service already implemented.

  • idb: IndexedDB async facade
  • jwt: HTTP interceptor for Axios
  • sso: authentication service
  • app: alerts and loading state
  • api: common API service

Lifecycle

Hooks are unified in 'on' method with Stage argument as aliases for Angular life-cycle hooks:

| init | load | bind | view | gone | done | |:-:|:-:|:-:|:-:|:-:|:-:| | ngOnInit | ngAfterContentInit | ngOnChanges | ngAfterViewInit | ngOnDestroy | ApplicationRef.isStable |

public override on(stage: Stage): void { if (stage == "gone") { /* Something in ngOnDestroy */ }  }

Samplings

Sample library for template-driven component library abstraction by concrete class extensions.

a) InputComponent (name, fail, info, rows)

| tag | variations | attributes | |-|-|-| | field | text, coin, date, time , mail, pass | mask, hint, cent, test, type, auto | | combo | select, option, toggle | none, type, multiple | | range | number, slider, switch | min, max, step, type | | agenda | day, week, month (?) | week, month, current, selected |

b) OutputComponent (that, wrap, path)

| tag | variations | attributes | |-|-|-| | icon | font, file | Spin, fill, type | | alert | success, failure, warning | type, text, manager |

c) ThruputComponent (side, gaps)

| tag | nestings | attributes or contents | |-|-|-| | form[data] | input, output | aside | | tab-manager | [tab] | ... | | menubar | menu, submenu | route, label, roles, menus |