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

@necraidan/ngx-lightbox

v0.2.0

Published

A zero-dependency Angular lightbox component with zoom and pan support

Readme

@necraidan/ngx-lightbox

A lightweight, accessible lightbox component for Angular 21+.
Zoom, pan, pinch-to-zoom, keyboard navigation - zero external dependencies.

npm CI license Angular

Features

  • Standalone component, Signals API
  • Double-click or scroll to zoom
  • Drag to pan when zoomed
  • Pinch-to-zoom on touch devices
  • Keyboard navigation (Escape to close)
  • i18n - fully customizable labels
  • Configurable via provideNgxLightbox()
  • Zero external dependencies

Installation

npm install @necraidan/ngx-lightbox

Basic usage

app.config.ts

import { provideNgxLightbox } from '@necraidan/ngx-lightbox';

export const appConfig: ApplicationConfig = {
  providers: [provideNgxLightbox()],
};

your.component.ts

import { LightboxComponent, LightboxService, LightboxImage } from '@necraidan/ngx-lightbox';

@Component({
  imports: [LightboxComponent],
  template: `
    <button (click)="open(image)">Open</button>
    <ngx-lightbox />
  `,
})
export class YourComponent {
  private lightbox = inject(LightboxService);

  readonly image: LightboxImage = {
    src: 'https://example.com/photo.jpg',
    alt: 'A beautiful photo',
    width: 1200,
    height: 800,
  };

  open(img: LightboxImage): void {
    this.lightbox.openLightbox(img);
  }
}

i18n

import { provideNgxLightbox } from '@necraidan/ngx-lightbox';

export const appConfig: ApplicationConfig = {
  providers: [
    provideNgxLightbox(
      { showHint: true },
      {
        closeLabel: 'Fermer',
        hint: 'Double-clic pour zoomer · Molette pour ajuster · Glisser pour déplacer',
        hintMobile: 'Pincez pour zoomer · Glisser pour déplacer',
      },
    ),
  ],
};

File / Blob

Pass a File or Blob directly - the lightbox handles createObjectURL / revokeObjectURL automatically:

onFileChange(event: Event): void {
  const file = (event.target as HTMLInputElement).files?.[0];
  if (!file) return;

  const img = new Image();
  const src = URL.createObjectURL(file);
  img.onload = () => {
    this.lightbox.openLightbox({
      src: file,              // File/Blob passed directly
      alt: file.name,
      width: img.naturalWidth,
      height: img.naturalHeight,
    });
    URL.revokeObjectURL(src); // only needed for the temp img above
  };
  img.src = src;
}

Advanced

import { provideNgxLightbox, LightboxConfig, LightboxI18n } from '@necraidan/ngx-lightbox';

const config: Partial<LightboxConfig> = {
  showHint: false, // hide the zoom/pan hint
  maxScale: 8, // allow up to 8x zoom (default: 5)
  zIndex: 9999, // overlay z-index (default: 1000)
};

export const appConfig: ApplicationConfig = {
  providers: [provideNgxLightbox(config)],
};

CSS custom properties:

:root {
  --ngx-lightbox-radius: 0; /* image border-radius (default: 0.5rem) */
  --ngx-lightbox-spacing: 1.5rem; /* close button / hint spacing (default: 1rem) */
}

API Reference

LightboxConfig

| Property | Type | Default | Description | | ---------- | --------- | ------- | ---------------------- | | showHint | boolean | true | Show the zoom/pan hint | | maxScale | number | 5 | Maximum zoom level | | zIndex | number | 1000 | Overlay z-index |

LightboxI18n

| Property | Type | Default | Description | | ------------ | -------- | ------------------------- | ------------------------------- | | closeLabel | string | 'Close' | aria-label for the close button | | hint | string | 'Double-click to zoom…' | Hint text on desktop | | hintMobile | string | 'Pinch to zoom…' | Hint text on touch devices |

LightboxService

| Member | Type | Description | | ---------------------------------------- | ------------------------------- | ----------------------------------------------------------------------- | | openLightbox(img: LightboxImage): void | void | Open the lightbox with the given image | | closeLightbox() | void | Close the lightbox | | lightboxImage() | Signal<LightboxImage \| null> | Currently displayed image | | resolvedSrc() | Signal<string \| null> | Resolved URL string - use this to bind [src] when src may be a Blob | | isZoomed() | Signal<boolean> | Whether the image is zoomed in | | isDragging() | Signal<boolean> | Whether the user is dragging |

LightboxImage

| Property | Type | Description | | -------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | src | string \| Blob | Image source - URL string, blob URL, or a Blob/File object. The lightbox manages createObjectURL / revokeObjectURL automatically. | | alt | string | Accessible description used as the alt attribute and aria-label. | | width | number | Intrinsic width in pixels, used to preserve the aspect ratio before the image loads. | | height | number | Intrinsic height in pixels, used to preserve the aspect ratio before the image loads. |

License

MIT