react-motion-gallery 2.0.74 → 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.
- package/README.md +52 -4
- 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
|
|
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:
|
|
@@ -254,7 +265,7 @@ Skip: generated sidecar
|
|
|
254
265
|
```text
|
|
255
266
|
User goal: "Build a masonry layout where skeleton text matches real responsive copy."
|
|
256
267
|
Workflow: layoutWithBrowserMeasuredTextSkeleton
|
|
257
|
-
Use: stable selectors -> scaffold_skeleton_text -> generate:skeleton-text-module --analysis-output -> import sidecar
|
|
268
|
+
Use: stable selectors -> probe_render_context -> scaffold_skeleton_text with renderReceiptId -> generate:skeleton-text-module --analysis-output -> import sidecar
|
|
258
269
|
```
|
|
259
270
|
|
|
260
271
|
When a connected agent needs context, it should read `rmg://context/agent-brief`, then use targeted resources such as `rmg://guides/layout-selection`, `rmg://guides/loading-fidelity`, `rmg://guides/browser-measured-skeletons`, `rmg://docs`, `rmg://catalog/demos`, and `rmg://examples/{demoId}`.
|
|
@@ -339,7 +350,7 @@ Call `write_gallery_files` after reviewing generated output. Pass `apply: true`
|
|
|
339
350
|
}
|
|
340
351
|
```
|
|
341
352
|
|
|
342
|
-
Call `scaffold_skeleton_text` to
|
|
353
|
+
Call `scaffold_skeleton_text` as a dry run to get the exact `probe_render_context` call. Apply the browser-measurement manifest only after passing the returned `receiptId` as `renderReceiptId`.
|
|
343
354
|
|
|
344
355
|
```json
|
|
345
356
|
{
|
|
@@ -350,6 +361,7 @@ Call `scaffold_skeleton_text` to create a browser-measurement manifest for the s
|
|
|
350
361
|
"moduleExportName": "pricingSkeletonText",
|
|
351
362
|
"barWidthUnit": "px",
|
|
352
363
|
"includeTextMetrics": true,
|
|
364
|
+
"renderReceiptId": "rmg-render-...",
|
|
353
365
|
"targets": [
|
|
354
366
|
{
|
|
355
367
|
"exportName": "pricingCardTitle",
|
|
@@ -783,6 +795,7 @@ export function BasicSlider() {
|
|
|
783
795
|
| `scroll.strictSnaps` | `boolean` | `false` | Prevents one drag release from settling more than one snap away from where the drag started. Overrides `scroll.skipSnaps`. |
|
|
784
796
|
| `scroll.freeScroll` | `boolean` | `false` | Enables free dragging instead of strict snapping. |
|
|
785
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. |
|
|
786
799
|
|
|
787
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:
|
|
788
801
|
|
|
@@ -1674,6 +1687,37 @@ export function EntryGallery() {
|
|
|
1674
1687
|
}
|
|
1675
1688
|
```
|
|
1676
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
|
+
|
|
1677
1721
|
### Entry loading, decode, and reveal flow
|
|
1678
1722
|
|
|
1679
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.
|
|
@@ -1887,6 +1931,7 @@ export function StandaloneFullscreen() {
|
|
|
1887
1931
|
import * as React from "react";
|
|
1888
1932
|
import { GalleryCore, Slider, useFullscreenController } from "react-motion-gallery";
|
|
1889
1933
|
import { fullscreenSlider } from "react-motion-gallery/fullscreen/slider";
|
|
1934
|
+
import { sliderFullscreen } from "react-motion-gallery/slider/fullscreen";
|
|
1890
1935
|
|
|
1891
1936
|
const slides = [
|
|
1892
1937
|
"https://picsum.photos/id/1015/1600/900",
|
|
@@ -1906,7 +1951,7 @@ function FullscreenAddon() {
|
|
|
1906
1951
|
export function SliderWithFullscreen() {
|
|
1907
1952
|
return (
|
|
1908
1953
|
<GalleryCore layout="slider" fullscreenItems={slides}>
|
|
1909
|
-
<Slider>
|
|
1954
|
+
<Slider plugins={[sliderFullscreen()]}>
|
|
1910
1955
|
{slides.map((src, index) => (
|
|
1911
1956
|
<img key={src} src={src} alt={`Slide ${index + 1}`} style={{ width: "100%" }} />
|
|
1912
1957
|
))}
|
|
@@ -2087,6 +2132,8 @@ The hook returns additional refs and setters for the internal fullscreen runtime
|
|
|
2087
2132
|
| `slider.friction` | `number` | `0.68` | Fullscreen slider friction. |
|
|
2088
2133
|
| `slider.direction` | `"ltr" \| "rtl"` | `"ltr"` | Fullscreen slider interaction direction. |
|
|
2089
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`. |
|
|
2090
2137
|
| `zoom.clickZoomLevel` | `number` | `2.5` | Zoom level used for click-to-zoom. |
|
|
2091
2138
|
| `zoom.maxZoomLevel` | `number` | `3` | Maximum allowed zoom level. |
|
|
2092
2139
|
| `zoom.panDuration` | `number` | `43` | Pan settling duration. |
|
|
@@ -2094,6 +2141,7 @@ The hook returns additional refs and setters for the internal fullscreen runtime
|
|
|
2094
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. |
|
|
2095
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`. |
|
|
2096
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. |
|
|
2097
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. |
|
|
2098
2146
|
| `effects.crossfade.drag` | `boolean` | `false` | Scrubs adjacent fullscreen slides with crossfade during drag instead of moving the track. |
|
|
2099
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.
|
|
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",
|