{"id":47808999,"url":"https://github.com/necraidan/ngx-lightbox","last_synced_at":"2026-04-03T18:01:25.960Z","repository":{"id":348949874,"uuid":"1200425592","full_name":"necraidan/ngx-lightbox","owner":"necraidan","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-03T16:45:39.000Z","size":124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T17:52:21.594Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/necraidan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-03T11:55:32.000Z","updated_at":"2026-04-03T16:45:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/necraidan/ngx-lightbox","commit_stats":null,"previous_names":["necraidan/ngx-lightbox"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/necraidan/ngx-lightbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necraidan%2Fngx-lightbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necraidan%2Fngx-lightbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necraidan%2Fngx-lightbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necraidan%2Fngx-lightbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/necraidan","download_url":"https://codeload.github.com/necraidan/ngx-lightbox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necraidan%2Fngx-lightbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31368156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T17:53:18.093Z","status":"ssl_error","status_checked_at":"2026-04-03T17:53:17.617Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-03T18:01:24.542Z","updated_at":"2026-04-03T18:01:25.858Z","avatar_url":"https://github.com/necraidan.png","language":"TypeScript","readme":"# @necraidan/ngx-lightbox\n\nA lightweight, accessible lightbox component for Angular 21+.  \nZoom, pan, pinch-to-zoom, keyboard navigation - zero external dependencies.\n\n[![npm](https://img.shields.io/npm/v/@necraidan/ngx-lightbox)](https://www.npmjs.com/package/@necraidan/ngx-lightbox)\n[![CI](https://github.com/necraidan/ngx-lightbox/actions/workflows/ci.yml/badge.svg)](https://github.com/necraidan/ngx-lightbox/actions/workflows/ci.yml)\n[![license](https://img.shields.io/badge/license-MIT-blue)](https://github.com/necraidan/ngx-lightbox/blob/main/LICENSE)\n[![Angular](https://img.shields.io/badge/Angular-21%2B-DD0031)](https://angular.dev)\n\n## Features\n\n- Standalone component, Signals API\n- Double-click or scroll to zoom\n- Drag to pan when zoomed\n- Pinch-to-zoom on touch devices\n- Keyboard navigation (Escape to close)\n- i18n - fully customizable labels\n- Configurable via `provideNgxLightbox()`\n- Zero external dependencies\n\n## Installation\n\n```bash\nnpm install @necraidan/ngx-lightbox\n```\n\n## Basic usage\n\n**app.config.ts**\n\n```ts\nimport { provideNgxLightbox } from '@necraidan/ngx-lightbox';\n\nexport const appConfig: ApplicationConfig = {\n  providers: [provideNgxLightbox()],\n};\n```\n\n**your.component.ts**\n\n```ts\nimport { LightboxComponent, LightboxService, LightboxImage } from '@necraidan/ngx-lightbox';\n\n@Component({\n  imports: [LightboxComponent],\n  template: `\n    \u003cbutton (click)=\"open(image)\"\u003eOpen\u003c/button\u003e\n    \u003cngx-lightbox /\u003e\n  `,\n})\nexport class YourComponent {\n  private lightbox = inject(LightboxService);\n\n  readonly image: LightboxImage = {\n    src: 'https://example.com/photo.jpg',\n    alt: 'A beautiful photo',\n    width: 1200,\n    height: 800,\n  };\n\n  open(img: LightboxImage): void {\n    this.lightbox.openLightbox(img);\n  }\n}\n```\n\n## i18n\n\n```ts\nimport { provideNgxLightbox } from '@necraidan/ngx-lightbox';\n\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    provideNgxLightbox(\n      { showHint: true },\n      {\n        closeLabel: 'Fermer',\n        hint: 'Double-clic pour zoomer · Molette pour ajuster · Glisser pour déplacer',\n        hintMobile: 'Pincez pour zoomer · Glisser pour déplacer',\n      },\n    ),\n  ],\n};\n```\n\n## File / Blob\n\nPass a `File` or `Blob` directly - the lightbox handles `createObjectURL` / `revokeObjectURL` automatically:\n\n```ts\nonFileChange(event: Event): void {\n  const file = (event.target as HTMLInputElement).files?.[0];\n  if (!file) return;\n\n  const img = new Image();\n  const src = URL.createObjectURL(file);\n  img.onload = () =\u003e {\n    this.lightbox.openLightbox({\n      src: file,              // File/Blob passed directly\n      alt: file.name,\n      width: img.naturalWidth,\n      height: img.naturalHeight,\n    });\n    URL.revokeObjectURL(src); // only needed for the temp img above\n  };\n  img.src = src;\n}\n```\n\n## Advanced\n\n```ts\nimport { provideNgxLightbox, LightboxConfig, LightboxI18n } from '@necraidan/ngx-lightbox';\n\nconst config: Partial\u003cLightboxConfig\u003e = {\n  showHint: false, // hide the zoom/pan hint\n  maxScale: 8, // allow up to 8x zoom (default: 5)\n  zIndex: 9999, // overlay z-index (default: 1000)\n};\n\nexport const appConfig: ApplicationConfig = {\n  providers: [provideNgxLightbox(config)],\n};\n```\n\nCSS custom properties:\n\n```css\n:root {\n  --ngx-lightbox-radius: 0; /* image border-radius (default: 0.5rem) */\n  --ngx-lightbox-spacing: 1.5rem; /* close button / hint spacing (default: 1rem) */\n}\n```\n\n## API Reference\n\n### `LightboxConfig`\n\n| Property   | Type      | Default | Description            |\n| ---------- | --------- | ------- | ---------------------- |\n| `showHint` | `boolean` | `true`  | Show the zoom/pan hint |\n| `maxScale` | `number`  | `5`     | Maximum zoom level     |\n| `zIndex`   | `number`  | `1000`  | Overlay z-index        |\n\n### `LightboxI18n`\n\n| Property     | Type     | Default                   | Description                     |\n| ------------ | -------- | ------------------------- | ------------------------------- |\n| `closeLabel` | `string` | `'Close'`                 | aria-label for the close button |\n| `hint`       | `string` | `'Double-click to zoom…'` | Hint text on desktop            |\n| `hintMobile` | `string` | `'Pinch to zoom…'`        | Hint text on touch devices      |\n\n### `LightboxService`\n\n| Member                                   | Type                            | Description                                                             |\n| ---------------------------------------- | ------------------------------- | ----------------------------------------------------------------------- |\n| `openLightbox(img: LightboxImage): void` | `void`                          | Open the lightbox with the given image                                  |\n| `closeLightbox()`                        | `void`                          | Close the lightbox                                                      |\n| `lightboxImage()`                        | `Signal\u003cLightboxImage \\| null\u003e` | Currently displayed image                                               |\n| `resolvedSrc()`                          | `Signal\u003cstring \\| null\u003e`        | Resolved URL string - use this to bind `[src]` when `src` may be a Blob |\n| `isZoomed()`                             | `Signal\u003cboolean\u003e`               | Whether the image is zoomed in                                          |\n| `isDragging()`                           | `Signal\u003cboolean\u003e`               | Whether the user is dragging                                            |\n\n### `LightboxImage`\n\n| Property | Type             | Description                                                                                                                               |\n| -------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| `src`    | `string \\| Blob` | Image source - URL string, blob URL, or a `Blob`/`File` object. The lightbox manages `createObjectURL` / `revokeObjectURL` automatically. |\n| `alt`    | `string`         | Accessible description used as the `alt` attribute and `aria-label`.                                                                      |\n| `width`  | `number`         | Intrinsic width in pixels, used to preserve the aspect ratio before the image loads.                                                      |\n| `height` | `number`         | Intrinsic height in pixels, used to preserve the aspect ratio before the image loads.                                                     |\n\n## License\n\nMIT\n\n## Development\n\n```bash\nnpm install\nnpx ng build ngx-lightbox\nnpx ng serve demo\n```\n","funding_links":[],"categories":["Third Party Components"],"sub_categories":["Images"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnecraidan%2Fngx-lightbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnecraidan%2Fngx-lightbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnecraidan%2Fngx-lightbox/lists"}