react-motion-gallery 2.0.75 → 2.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +49 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -64,10 +64,15 @@ This table reports local gzip measurements for selected runtime surfaces. Type-o
64
64
 
65
65
  ## Installation
66
66
 
67
- Install the package, then add the optional video peers only if you use `Video`.
67
+ Install the package:
68
68
 
69
69
  ```bash
70
70
  npm install react-motion-gallery
71
+ ```
72
+
73
+ If you use `Video` or fullscreen video playback, also install the optional Plyr peers:
74
+
75
+ ```bash
71
76
  npm install plyr plyr-react
72
77
  ```
73
78
 
@@ -77,6 +82,12 @@ Import the stylesheet. The package uses CSS Modules internally, but consumers on
77
82
  import "react-motion-gallery/styles.css";
78
83
  ```
79
84
 
85
+ Most examples in this README use hooks, event handlers, or browser-only behavior. In Next.js App Router, put those components in a client file with `"use client";`; server components can still prepare media data and pass it down.
86
+
87
+ ## License
88
+
89
+ React Motion Gallery is licensed under `PolyForm-Noncommercial-1.0.0`. Non-commercial use is free. Commercial use requires a paid license; see [react-motion-gallery.com/license](https://react-motion-gallery.com/license).
90
+
80
91
  ## Overview
81
92
 
82
93
  Mental model:
@@ -784,6 +795,7 @@ export function BasicSlider() {
784
795
  | `scroll.strictSnaps` | `boolean` | `false` | Prevents one drag release from settling more than one snap away from where the drag started. Overrides `scroll.skipSnaps`. |
785
796
  | `scroll.freeScroll` | `boolean` | `false` | Enables free dragging instead of strict snapping. |
786
797
  | `scroll.loop` | `boolean` | `false` | Wraps around at the ends. |
798
+ | `scroll.containScroll` | `boolean` | `false` | Clamps start/end snaps so non-looping variable-width or centered sliders do not leave excess empty space at the track edges. |
787
799
 
788
800
  `scroll.groupCells` affects the snap pages used by drag, wheel, arrows, dots, and imperative navigation. Use `true` for automatic fit-to-viewport grouping, or a count for explicit snap pages:
789
801
 
@@ -1675,6 +1687,37 @@ export function EntryGallery() {
1675
1687
  }
1676
1688
  ```
1677
1689
 
1690
+ For common entry media layouts, the exported helper factories can own `renderMediaContainer` for you. Use the slider, grid, or masonry helper that matches `entries.mediaLayout`, then keep custom card and media rendering focused on your data shape.
1691
+
1692
+ ```typescript
1693
+ import {
1694
+ Entries,
1695
+ createEntriesGridMedia,
1696
+ type EntriesOptions,
1697
+ } from "react-motion-gallery/entries";
1698
+
1699
+ const renderEntryGridMedia = createEntriesGridMedia({
1700
+ gridObject: {
1701
+ columns: { 0: 1, 760: 2 },
1702
+ gap: { 0: 10, 760: 14 },
1703
+ },
1704
+ });
1705
+
1706
+ export function EntryGrid({ entries }: { entries: EntriesOptions["items"] }) {
1707
+ return (
1708
+ <Entries
1709
+ entries={{
1710
+ items: entries,
1711
+ mediaLayout: "grid",
1712
+ }}
1713
+ renderMediaContainer={renderEntryGridMedia}
1714
+ />
1715
+ );
1716
+ }
1717
+ ```
1718
+
1719
+ The same pattern works with `createEntriesSliderMedia()` and `createEntriesMasonryMedia()`. Import from `react-motion-gallery/entries/cache` instead when the entry loading skeleton also uses `loading.cache`.
1720
+
1678
1721
  ### Entry loading, decode, and reveal flow
1679
1722
 
1680
1723
  When `loading.enabled` is true, entries use two viewport gates instead of one generic fade-in. `loading.nearMargin` marks a row as near the viewport, mounts the real entry content, and starts the entry media work early. `loading.viewMargin` and `loading.threshold` record when the row has actually entered view.
@@ -1888,6 +1931,7 @@ export function StandaloneFullscreen() {
1888
1931
  import * as React from "react";
1889
1932
  import { GalleryCore, Slider, useFullscreenController } from "react-motion-gallery";
1890
1933
  import { fullscreenSlider } from "react-motion-gallery/fullscreen/slider";
1934
+ import { sliderFullscreen } from "react-motion-gallery/slider/fullscreen";
1891
1935
 
1892
1936
  const slides = [
1893
1937
  "https://picsum.photos/id/1015/1600/900",
@@ -1907,7 +1951,7 @@ function FullscreenAddon() {
1907
1951
  export function SliderWithFullscreen() {
1908
1952
  return (
1909
1953
  <GalleryCore layout="slider" fullscreenItems={slides}>
1910
- <Slider>
1954
+ <Slider plugins={[sliderFullscreen()]}>
1911
1955
  {slides.map((src, index) => (
1912
1956
  <img key={src} src={src} alt={`Slide ${index + 1}`} style={{ width: "100%" }} />
1913
1957
  ))}
@@ -2088,6 +2132,8 @@ The hook returns additional refs and setters for the internal fullscreen runtime
2088
2132
  | `slider.friction` | `number` | `0.68` | Fullscreen slider friction. |
2089
2133
  | `slider.direction` | `"ltr" \| "rtl"` | `"ltr"` | Fullscreen slider interaction direction. |
2090
2134
  | `slider.gap` | `number \| Record<string, number>` | `0` | Responsive pixel gap between fullscreen slides. Named keys resolve from `GalleryCore.breakpoints`. |
2135
+ | `slider.skipSnaps` | `boolean \| { enabled?: boolean; threshold?: number }` | `false` | Allows fullscreen drag momentum to skip snap points. Object form matches the base slider `scroll.skipSnaps` behavior. |
2136
+ | `slider.strictSnaps` | `boolean` | `false` | Prevents one fullscreen drag release from settling more than one snap away from where the drag started. Overrides `slider.skipSnaps`. |
2091
2137
  | `zoom.clickZoomLevel` | `number` | `2.5` | Zoom level used for click-to-zoom. |
2092
2138
  | `zoom.maxZoomLevel` | `number` | `3` | Maximum allowed zoom level. |
2093
2139
  | `zoom.panDuration` | `number` | `43` | Pan settling duration. |
@@ -2095,6 +2141,7 @@ The hook returns additional refs and setters for the internal fullscreen runtime
2095
2141
  | `effects.introDuration` | `number \| { transform?: number; fade?: number }` | `{ transform: 300, fade: 500 }` | Open and close intro timing. A scalar applies to both paths. Use `transform` for scale/FLIP handoffs and `fade` for opacity-only paths. |
2096
2142
  | `effects.introEasing` | `string \| { transform?: string; fade?: string }` | `"cubic-bezier(.4,0,.22,1)"` | Open and close intro easing. A scalar applies to both paths. Object keys mirror `introDuration`. |
2097
2143
  | `effects.introFade` | `boolean` | `false` | Forces fade intro behavior. |
2144
+ | `effects.introStickyNavSelector` | `string` | `—` | Selector for a sticky navigation element that may cover the source image during scale intro or close path calculations. |
2098
2145
  | `effects.crossfade.controls` | `boolean` | `false` | Uses crossfade transitions for fullscreen arrow navigation and animated slide requests. Also enables wheel crossfade unless `effects.crossfade.wheel` is provided. |
2099
2146
  | `effects.crossfade.drag` | `boolean` | `false` | Scrubs adjacent fullscreen slides with crossfade during drag instead of moving the track. |
2100
2147
  | `effects.crossfade.wheel` | `boolean \| CrossFadeWheelOptions` | `effects.crossfade.controls` | Uses wheel or touchpad travel as a one-slide-at-a-time fullscreen crossfade gesture. Set `false` to keep arrow crossfades while using normal wheel scrolling. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-motion-gallery",
3
- "version": "2.0.75",
3
+ "version": "2.0.76",
4
4
  "description": "React gallery primitives for sliders, carousels, grid, masonry, fullscreen lightbox, entries, video, zoom/pan/pinch, skeleton loading and reveal animations",
5
5
  "keywords": [
6
6
  "react",