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-window-component

v0.1.0

Published

Lightweight window layer component for Angular

Downloads

19

Readme

ngx-window MIT license

Note: This is essentially a beta version of sorts. It's just been released and will soon start to be tested in a real life application. Until this note is removed, expect bugs, performance issues and incomplete documentation. You're more than welcome to help by Contributing.

A generic, light weight, window layer component for Angular 2+ to allow front layer windows such as: dropdowns, popups, modals, tooltips, etc.

ngx-window-1 ngx-window-scrshot-2

Features

  • Windows are not affected by attributes of the reference element's hierarchy, e.g. overflow, display, position, etc.
  • Controlled from the component using it, and can be opened, closed or toggled programmatically
  • Enables closing from within using the WindowCloser directive
  • Supports alignment to the viewport, or the reference element (when exists) according to several anchor points (future plans include automatic alignment based on available viewport space), including an offset from the anchor point
  • Configurable automatic closing when:
    • Clicked elsewhere
    • Reference element is off view
  • Automatic position adjustments upon:
    • Reference element move
    • Reference element resize
    • Reference element scroll (or container)
    • Window resize
  • Fires events when the window becomes visible/invisible

Dependencies

Latest version available for each version of Angular

| ngx-window-component | Angular | | -------------------- | ------- | | 0.1.0 | 18.x | | 0.0.10 | 17.x | | 0.0.7 | 16.x | | 0.0.5 | 13.x |

Install

npm install ngx-window-component --save

Run demo application

Clone this repository and then:

npm install
npm run start

Use

App module definition:

@NgModule({
    imports: [ NgxWindowModule ],
    declarations: [ AppComponent ],
    bootstrap: [AppComponent]
    ...
})
export class AppModule {}

Drop down component template:

<button (click)="dropDownWindow.toggle()" #dropDownButton>Toggle dropdown</button>
<ngx-window [refElement]="dropDownButton" [options]="{ alignment: { reference: { vertical: 'bottom' } } }"
    [width]="200" [height]="250" (visibleChange)="onVisibleChange($event)" #dropDownWindow>
    <div class="drop-down-content">
        <ng-content></ng-content>
    </div>
</ngx-window>

Note: The NgxWindowModule should only be imported once and only in the module that bootstraps the application.

Options

| Option | Type | Default | Description | | ---------------------------------- | -------------------------------------- | ------- | --------------------------------------------------------------------------------- | | visibility.startOpen | boolean | false | The window will be become visible automatically | | visibility.keepOpen.onClickOutside | boolean | false | Stay open even will clicked outside of the window hierarchy or reference element | | visibility.keepOpen.onIntersection | boolean | false | Stay open when the reference element gets out of view | | alignment.window.horizontal | union see below | 'left' | Align the window according to its specified horizontal anchor | | alignment.window.vertical | union see below | 'top' | Align the window according to its specified vertical anchor | | alignment.reference.horizontal | union see below | 'left' | Align the window according to the reference element's specified horizontal anchor | | alignment.reference.vertical | union see below | 'top' | Align the window according to the reference element's specified vertical anchor |

Horizontal Anchors

export type HorizontalAnchor = 'left' | 'center' | 'right';

Vertical Anchors

export type VerticalAnchor = 'top' | 'center' | 'bottom';

Functions

| Function | Parameters | Description | | -------- | ---------- | ------------------------------------------------ | | Open | none | Opens (shows) the window | | Close | none | Closes (hides) the window | | Toggle | none | Opens the window if closed, or closes it if open |

Events

Contributor Covenant