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

@lightgallery/headless

v3.0.0-beta.2

Published

The framework-free core of lightGallery 3: everything a gallery needs to *decide*, with none of the rendering. State machine, settings resolution, gesture verdicts, spring physics, zoom and thumbnail math, justified layout, responsive image selection, vid

Readme

@lightgallery/headless

The framework-free core of lightGallery 3: everything a gallery needs to decide, with none of the rendering. State machine, settings resolution, gesture verdicts, spring physics, zoom and thumbnail math, justified layout, responsive image selection, video URL builders, share links, URL drivers. No DOM, no framework — the package's tsconfig excludes the DOM lib, so window and document do not even typecheck here.

@lightgallery/react, @lightgallery/vue, @lightgallery/angular and the vanilla lightgallery package are all renderers over this core. Use it directly to build a gallery for another framework or a custom UI.

npm install @lightgallery/headless

What it exports

| Area | Exports | Notes | | --- | --- | --- | | State | createGalleryState, galleryReducer, clampIndex | Pure reducer over OPEN, CLOSE, NEXT, PREV, GO_TO … actions | | Settings | resolveSettings, coreSettingsDefaults | Merges user settings, mobile settings and per-key strings over the defaults | | Items | getSlideType | Image, video, iframe or inline, from an item's fields | | Slide windowing | getSlideIndexesInDom, getPreloadIndexes, getSlidePoolIndexes | Which slides to mount and preload, including virtualization | | Gestures | getSwipeAxis, getSwipeReleaseVerdict, getHorizontalDragTransforms, getVerticalDragEffects, shouldCloseOnVerticalDrag, getEdgeFrictionedDelta, upsertPointer, removePointer | Axis lock, flick detection, boundary friction, drag-to-close | | Physics | stepSpring, isSpringSettled, project, getWindowedVelocity, pushVelocitySample | Closed-form damped spring, momentum projection, windowed release velocity | | Zoom | getPinchScale, getPinchPan, getPointZoomPan, clampScale, clampPan, getPanBounds, shouldCloseOnPinch, getActualSizeScale | Focal-point pinch, pan bounds with friction, pinch-to-close | | Thumbnails | getThumbWindow, getThumbCorridorWindow, getActiveThumbTranslate, clampThumbTranslate, getElasticThumbTranslate, getScrubThumbIndex, getScrubThumbTranslate | Strip windowing, centering, elastic edges, scrubbing | | Layout | getJustifiedLayout | Row-justified box layout for trigger grids | | Responsive | parseSrcset, resolveImageSource, resolveSizes, matchesMedia, awaitDecode | srcset/sizes selection and decode gating | | Origin animation | getOriginTransform, fitImageSize, parseImageSize | Open-from-trigger transforms | | Origin crop | getOriginWindow, getOriginCropFlight, parseObjectFit, parseBackgroundFit, parseCssPosition | The origin crop plugin's flight from a cropped thumbnail | | Video | getVideoInfo, getYouTubeEmbedUrl, getVimeoEmbedUrl, getWistiaEmbedUrl, getYouTubePosterUrl, getFacadePoster | Provider detection, embed URLs, facade posters | | Share | getSharePayload, canNativeShare, getXShareLink, getFacebookShareLink, getPinterestShareLink | Web Share payload and social fallbacks | | URL drivers | createHashDriver, createHistoryHashDriver, createNavigationHashDriver | One interface over hash, history and the Navigation API | | Plugin slices | initialZoomSlice, applyZoom, initialRotateSlice, rotateLeft, rotateRight, flipHorizontal, flipVertical, initialAutoplaySlice | Per-plugin state reducers | | Accessibility | formatSlideAnnouncement | Live-region text from a template string | | Icons | coreDefaultIcons, zoomDefaultIcons, … , LgIconName | The built-in inline SVG icon sets, grouped by feature | | Events | createEmitter | A typed emitter for renderers |

Each module is independent; import only what your renderer needs.

Example

import {
    createGalleryState,
    galleryReducer,
    getSlideIndexesInDom,
    getSwipeReleaseVerdict,
    resolveSettings,
} from '@lightgallery/headless';

const settings = resolveSettings({ loop: true, speed: 400 });

let state = createGalleryState({ slidesCount: 5, loop: settings.loop });
state = galleryReducer(state, { type: 'OPEN', index: 2 });
state = galleryReducer(state, { type: 'NEXT' });

// Which slides should be mounted right now (current ± preload window).
const mounted = getSlideIndexesInDom(state.index, 5, settings);

Every transition is pure and covered by node-environment tests. Renderers wrap the reducer in their own reactivity and own all DOM concerns.

Documentation

  • Guide: https://www.lightgalleryjs.com/docs/headless/
  • Markdown index for tools and agents: https://www.lightgalleryjs.com/llms.txt

License

GPL-3.0-only, matching lightGallery's licensing model — commercial licenses via lightgalleryjs.com.