react-motion-gallery 2.0.17 → 2.0.19
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 +297 -32
- package/dist/chunk-5HIHJGIV.mjs +45 -0
- package/dist/chunk-6TPHLAUP.mjs +1 -0
- package/dist/chunk-AKY343WN.mjs +1 -0
- package/dist/chunk-BIDZ4WZB.mjs +2 -0
- package/dist/chunk-DBIFLX6Y.mjs +6 -0
- package/dist/chunk-ECQ74X24.mjs +1 -0
- package/dist/chunk-FJYYM5TH.mjs +1 -0
- package/dist/chunk-GSEIEFRW.mjs +1 -0
- package/dist/chunk-GT6IL37J.mjs +1 -0
- package/dist/chunk-J4E4PKE5.mjs +1 -0
- package/dist/chunk-JD3VAF3N.mjs +4 -0
- package/dist/chunk-JMFDRKTX.mjs +2 -0
- package/dist/chunk-K6PQU6HF.mjs +1 -0
- package/dist/chunk-KSOQWCCL.mjs +6 -0
- package/dist/chunk-NABNX5HB.mjs +1 -0
- package/dist/chunk-NEJ27O2B.mjs +2 -0
- package/dist/chunk-Q2PY6ZMU.mjs +2 -0
- package/dist/chunk-TKPLWDPW.mjs +7 -0
- package/dist/chunk-UAEPMZQY.mjs +1 -0
- package/dist/chunk-UV2SUN5V.mjs +1 -0
- package/dist/chunk-VXSRNAH4.mjs +1 -0
- package/dist/chunk-WLWVKQPL.mjs +4 -0
- package/dist/chunk-WZWMG4ZT.mjs +1 -0
- package/dist/chunk-XOS5AXSR.mjs +4 -0
- package/dist/chunk-ZX5E327W.mjs +1 -0
- package/dist/{elements-Bd1vm4Uk.d.mts → controls-SpWg1Kgt.d.mts} +10 -3
- package/dist/core.d.mts +20 -9
- package/dist/core.mjs +1 -1
- package/dist/entries.css +1 -1
- package/dist/entries.d.mts +41 -11
- package/dist/entries.mjs +1 -1
- package/dist/fullscreen.css +1 -1
- package/dist/fullscreen.d.mts +36 -135
- package/dist/fullscreen.mjs +1 -1
- package/dist/fullscreenThumbnails.css +1 -1
- package/dist/fullscreenThumbnails.d.mts +9 -6
- package/dist/fullscreenThumbnails.mjs +1 -1
- package/dist/grid.css +1 -1
- package/dist/grid.d.mts +18 -115
- package/dist/grid.mjs +1 -1
- package/dist/{index-C0AqfaC3.d.mts → index-CwwxTQKa.d.mts} +3 -3
- package/dist/index.css +1 -1
- package/dist/index.d.mts +19 -15
- package/dist/index.mjs +1 -1
- package/dist/layout-CR6f2aPH.d.mts +95 -0
- package/dist/masonry.css +1 -1
- package/dist/masonry.d.mts +12 -65
- package/dist/masonry.mjs +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/{media-moIXOhT1.d.mts → plyrTypes-Cq4C3ul5.d.mts} +8 -1
- package/dist/responsive-D_xhZmVI.d.mts +186 -0
- package/dist/slider.css +1 -1
- package/dist/slider.d.mts +16 -8
- package/dist/slider.mjs +1 -1
- package/dist/{sliderSub-DDPjywVp.d.mts → sliderSub-Bo6Y8as_.d.mts} +13 -1
- package/dist/text-Cl2tR8oO.d.mts +4 -0
- package/dist/thumbnails.css +1 -1
- package/dist/thumbnails.d.mts +22 -8
- package/dist/thumbnails.mjs +1 -1
- package/dist/{types-Bi2iBbyG.d.mts → types-CHUayqcj.d.mts} +26 -5
- package/dist/{types-9fvdyhuG.d.mts → types-DY058l5M.d.mts} +45 -10
- package/dist/types-Dhh8xfHo.d.mts +18 -0
- package/dist/{types-CQ6I3EfZ.d.mts → types-ROPjU8Nl.d.mts} +24 -12
- package/dist/types-VULXzSa2.d.mts +68 -0
- package/dist/types-XEr8LRal.d.mts +65 -0
- package/dist/{types-ChjyCquV.d.mts → types-_1D0QtfD.d.mts} +24 -8
- package/dist/video.css +1 -1
- package/dist/video.d.mts +2 -2
- package/dist/video.mjs +1 -1
- package/dist/zoomPan.d.mts +16 -0
- package/dist/zoomPan.mjs +1 -0
- package/package.json +11 -22
- package/dist/chunk-2AHLR3V4.mjs +0 -1
- package/dist/chunk-CAYO7NIA.mjs +0 -2
- package/dist/chunk-CROFW72U.mjs +0 -2
- package/dist/chunk-ESF6XBYF.mjs +0 -1
- package/dist/chunk-EV6ZK4QI.mjs +0 -1
- package/dist/chunk-H4BEIJAD.mjs +0 -5
- package/dist/chunk-HHAEEL7K.mjs +0 -10
- package/dist/chunk-KN72Q6DM.mjs +0 -5
- package/dist/chunk-KZUAS63N.mjs +0 -1
- package/dist/chunk-NWU2GBRJ.mjs +0 -1
- package/dist/chunk-O6MJXVAN.mjs +0 -4
- package/dist/chunk-PGF2LSVK.mjs +0 -2
- package/dist/chunk-Q5LUIIWE.mjs +0 -1
- package/dist/chunk-SALMTFMK.mjs +0 -1
- package/dist/chunk-TZGAHWM7.mjs +0 -1
- package/dist/chunk-UOXJOJEY.mjs +0 -59
- package/dist/chunk-X4HEGEZV.mjs +0 -1
- package/dist/chunk-YRQVG3MM.mjs +0 -1
- package/dist/lazy-dGoYpcRa.d.mts +0 -14
- package/dist/plyrTypes-CmP9NWvX.d.mts +0 -8
- package/dist/responsive-CvE5dTnP.d.mts +0 -5
- package/dist/types-tb9Qf2Mj.d.mts +0 -46
package/README.md
CHANGED
|
@@ -9,15 +9,16 @@ This table reports local gzip measurements for each exported runtime surface. Th
|
|
|
9
9
|
<!-- bundle-size:start -->
|
|
10
10
|
| Export | JS gzip |
|
|
11
11
|
| --- | --- |
|
|
12
|
-
| `Entries` |
|
|
13
|
-
| `FullscreenThumbnailSlider` |
|
|
14
|
-
| `GalleryCore` |
|
|
15
|
-
| `Grid` |
|
|
16
|
-
| `Masonry` |
|
|
17
|
-
| `Slider` |
|
|
18
|
-
| `ThumbnailSlider` |
|
|
19
|
-
| `useFullscreenController` |
|
|
20
|
-
| `Video` |
|
|
12
|
+
| `Entries` | 9.3kB |
|
|
13
|
+
| `FullscreenThumbnailSlider` | 18.8kB |
|
|
14
|
+
| `GalleryCore` | 2.5kB |
|
|
15
|
+
| `Grid` | 13.8kB |
|
|
16
|
+
| `Masonry` | 16.2kB |
|
|
17
|
+
| `Slider` | 38.4kB |
|
|
18
|
+
| `ThumbnailSlider` | 17.4kB |
|
|
19
|
+
| `useFullscreenController` | 55.5kB |
|
|
20
|
+
| `Video` | 12.2kB |
|
|
21
|
+
| `ZoomPanImage` | 8.5kB |
|
|
21
22
|
<!-- bundle-size:end -->
|
|
22
23
|
|
|
23
24
|
## Overview
|
|
@@ -41,6 +42,7 @@ Mental model:
|
|
|
41
42
|
- `Entries` renders structured entry data with a custom media container.
|
|
42
43
|
- `GalleryCore` and `useFullscreenController` power fullscreen behavior.
|
|
43
44
|
- `Video` is the gallery-ready video primitive.
|
|
45
|
+
- `ZoomPanImage` attaches click-to-zoom, drag pan, ctrl-wheel pinch, and touch pinch to one clipped image surface.
|
|
44
46
|
|
|
45
47
|
`MediaItem` accepts three shapes:
|
|
46
48
|
|
|
@@ -82,7 +84,29 @@ export function QuickStart() {
|
|
|
82
84
|
|
|
83
85
|
Responsive numeric props in this package accept either a plain number or a breakpoint map like `{ 0: 1, md: 2, 1200: 3 }`. Named breakpoints resolve from the internal map: `xs: 0`, `sm: 600`, `md: 900`, `lg: 1200`, `xl: 1536`.
|
|
84
86
|
|
|
85
|
-
The package root now exports the primary public components, helper functions, and companion prop types. Subpath entrypoints are also available when you want narrower imports: `react-motion-gallery/core`, `react-motion-gallery/slider`, `react-motion-gallery/grid`, `react-motion-gallery/masonry`, `react-motion-gallery/entries`, `react-motion-gallery/fullscreen`, `react-motion-gallery/thumbnails`, `react-motion-gallery/fullscreenThumbnails`, and `react-motion-gallery/
|
|
87
|
+
The package root now exports the primary public components, helper functions, and companion prop types. Subpath entrypoints are also available when you want narrower imports: `react-motion-gallery/core`, `react-motion-gallery/slider`, `react-motion-gallery/grid`, `react-motion-gallery/masonry`, `react-motion-gallery/entries`, `react-motion-gallery/fullscreen`, `react-motion-gallery/thumbnails`, `react-motion-gallery/fullscreenThumbnails`, `react-motion-gallery/video`, and `react-motion-gallery/zoomPan`.
|
|
88
|
+
|
|
89
|
+
## ZoomPanImage
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { ZoomPanImage } from "react-motion-gallery/zoomPan";
|
|
93
|
+
|
|
94
|
+
export function ZoomPanCard() {
|
|
95
|
+
return (
|
|
96
|
+
<ZoomPanImage
|
|
97
|
+
src="https://picsum.photos/id/1035/1600/1200"
|
|
98
|
+
alt="A hiker looking over a canyon at dusk"
|
|
99
|
+
className="zoomCard"
|
|
100
|
+
zoom={{
|
|
101
|
+
clickZoomLevel: 2.35,
|
|
102
|
+
maxZoomLevel: 3.5,
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`ZoomPanImage` is the lightweight standalone zoom surface. The component root is the clipping container, so border radius, aspect ratio, and overflow all live on the same element.
|
|
86
110
|
|
|
87
111
|
## Slider
|
|
88
112
|
|
|
@@ -171,19 +195,124 @@ export function BasicSlider() {
|
|
|
171
195
|
| `auto.play.pauseMs` | `number` | `1000` | Delay after interaction before autoplay resumes. |
|
|
172
196
|
| `auto.play.pauseOnHover` | `boolean` | `true` | Pauses autoplay while hovering. |
|
|
173
197
|
| `auto.scroll.enabled` | `boolean` | `false` | Continuous timed scrolling. |
|
|
174
|
-
| `auto.scroll.speedMs` | `number` | `
|
|
198
|
+
| `auto.scroll.speedMs` | `number` | `0.3` | Continuous auto-scroll speed. |
|
|
175
199
|
| `auto.scroll.pauseMs` | `number` | `1000` | Delay after interaction before auto-scroll resumes. |
|
|
176
200
|
| `auto.scroll.pauseOnHover` | `boolean` | `true` | Pauses while hovering. |
|
|
177
201
|
| `transitions.loading.enabled` | `boolean` | `—` | Enables the loading skeleton layer. |
|
|
178
202
|
| `transitions.loading.force` | `boolean` | `—` | Forces the loading layer to stay visible. |
|
|
179
203
|
| `transitions.loading.skeletonCount` | `number \| Record<string, number>` | `—` | Responsive skeleton slot count. |
|
|
180
204
|
| `transitions.loading.renderLoading` | `({ count }) => ReactNode` | `—` | Custom loading renderer. |
|
|
181
|
-
| `transitions.loading.skeleton` | `SliderSkeletonSpec` | `—` | Built-in skeleton spec. |
|
|
205
|
+
| `transitions.loading.skeleton` | `SliderSkeletonSpec` | `—` | Built-in skeleton spec, including per-slot overrides with `layout.slots` and centered peek support via `centering: "first"`. |
|
|
206
|
+
| `transitions.loading.timing.exitMs` | `number` | `600` | Keeps the loading layer mounted for this long after exit starts. |
|
|
207
|
+
| `transitions.loading.timing.minVisibleMs` | `number` | `220` | Minimum time the loading layer stays visible before exit can begin. |
|
|
182
208
|
| `transitions.intro.renderIntro` | `({ active, containerProps }, content) => ReactNode` | `—` | Custom intro wrapper. |
|
|
183
|
-
| `transitions.intro.staggerMs` | `number` | `—` | Delay between item
|
|
184
|
-
| `transitions.intro.
|
|
185
|
-
| `transitions.intro.
|
|
186
|
-
|
|
209
|
+
| `transitions.intro.staggerMs` | `number` | `—` | Delay between item fade-ins. |
|
|
210
|
+
| `transitions.intro.durationMs` | `number` | `—` | Intro fade duration. |
|
|
211
|
+
| `transitions.intro.easing` | `string` | `—` | Intro fade easing. |
|
|
212
|
+
|
|
213
|
+
### Slider loading skeletons
|
|
214
|
+
|
|
215
|
+
`transitions.loading.skeleton` lets you describe a placeholder layout that mirrors the final slider instead of falling back to generic blocks. This is especially useful for variable-width slides, mixed aspect ratios, and center-aligned peek carousels.
|
|
216
|
+
|
|
217
|
+
`layout.slots` is the per-slide override system. Define the shared placeholder once with `layout.item` and `layout.itemWrapStyle`, then override any individual slot with `slots[index]`. Slot `itemWrapStyle` values merge on top of the base wrap style, while `slot.item` can replace the placeholder node entirely for that slot.
|
|
218
|
+
|
|
219
|
+
`itemWrapStyle` now supports wrapper-only `border` and `boxShadow` values. Wrapper `width`, `height`, and `aspectRatio` are treated as outer border-box dimensions, so the inner placeholder shrinks by the border thickness. Use simple uniform border shorthands such as `1px solid #cbd5e1` when you want the built-in sizing math to account for the border width.
|
|
220
|
+
|
|
221
|
+
`text` nodes render one skeleton bar per `lines` value. `lines` can be a single number or a numeric min-width map such as `{ 0: 3, 767: 2, 1200: 1 }`. Use `lineWidth` to override the shortened final-line width; it defaults to `68%` of the text block width and can also be responsive with numeric min-width keys.
|
|
222
|
+
|
|
223
|
+
`centering: "first"` is designed for center-aligned peek sliders. When the real slider uses `align="center"` and the skeleton uses `mode: "peek"` with `layout.kind: "slider"`, the built-in skeleton renderer inserts the leading spacer needed to center the first visible placeholder. You should not add that spacer manually, and it does not apply when you replace the built-in skeleton with `transitions.loading.renderLoading`.
|
|
224
|
+
|
|
225
|
+
When you provide `transitions.loading.timing`, `exitMs` controls both how long the loading layer remains mounted after exit starts and its opacity transition duration. The real slider intro begins as soon as the loading exit starts; it does not wait for the loading layer to finish unmounting.
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { Slider } from "react-motion-gallery";
|
|
229
|
+
|
|
230
|
+
const slides = [
|
|
231
|
+
{ src: "https://picsum.photos/id/1020/660/960", width: 220, height: 320 },
|
|
232
|
+
{ src: "https://picsum.photos/id/1029/1020/630", width: 340, height: 320 },
|
|
233
|
+
{ src: "https://picsum.photos/id/1039/780/840", width: 260, height: 320 },
|
|
234
|
+
];
|
|
235
|
+
|
|
236
|
+
export function VariableWidthSkeletonSlider() {
|
|
237
|
+
return (
|
|
238
|
+
<Slider
|
|
239
|
+
align="center"
|
|
240
|
+
transitions={{
|
|
241
|
+
loading: {
|
|
242
|
+
skeletonCount: 2,
|
|
243
|
+
skeleton: {
|
|
244
|
+
mode: "peek",
|
|
245
|
+
centering: "first",
|
|
246
|
+
layout: {
|
|
247
|
+
kind: "slider",
|
|
248
|
+
direction: "row",
|
|
249
|
+
style: { gap: 20 },
|
|
250
|
+
item: {
|
|
251
|
+
kind: "rect",
|
|
252
|
+
style: {
|
|
253
|
+
width: "100%",
|
|
254
|
+
height: "100%",
|
|
255
|
+
borderRadius: 12,
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
slots: slides.map((slide) => ({
|
|
259
|
+
itemWrapStyle: {
|
|
260
|
+
width: slide.width,
|
|
261
|
+
height: slide.height,
|
|
262
|
+
},
|
|
263
|
+
})),
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
{slides.map((slide, index) => (
|
|
270
|
+
<img
|
|
271
|
+
key={slide.src}
|
|
272
|
+
src={slide.src}
|
|
273
|
+
alt={`Slide ${index + 1}`}
|
|
274
|
+
style={{ width: slide.width, height: slide.height, objectFit: "cover" }}
|
|
275
|
+
/>
|
|
276
|
+
))}
|
|
277
|
+
</Slider>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
#### `SliderSkeletonSpec`
|
|
283
|
+
|
|
284
|
+
| Field | Type | Notes |
|
|
285
|
+
| --- | --- | --- |
|
|
286
|
+
| `mode` | `"fit" \| "peek"` | `"peek"` preserves partial next or previous slide visibility in the loading state. |
|
|
287
|
+
| `centering` | `"first"` | Adds the leading spacer needed for the first visible slot when using the built-in centered peek skeleton flow. |
|
|
288
|
+
| `className` | `string \| undefined` | Applied to the skeleton overlay root. |
|
|
289
|
+
| `style` | `React.CSSProperties \| undefined` | Inline styles for the skeleton overlay root. |
|
|
290
|
+
| `layout` | `SliderSkeletonNode \| undefined` | Structured placeholder layout tree. Use `kind: "slider"` to model slide tracks. |
|
|
291
|
+
| `backgroundColor` | `string \| undefined` | Overrides the shared skeleton background color token. |
|
|
292
|
+
| `radius` | `number \| string \| undefined` | Overrides the shared skeleton radius token. |
|
|
293
|
+
| `shimmer` | `SkeletonShimmer \| undefined` | Shared shimmer settings for the entire skeleton tree. |
|
|
294
|
+
|
|
295
|
+
#### `SliderSkeletonSliderNode`
|
|
296
|
+
|
|
297
|
+
| Field | Type | Notes |
|
|
298
|
+
| --- | --- | --- |
|
|
299
|
+
| `kind` | `"slider"` | Slider-specific skeleton layout root. |
|
|
300
|
+
| `style` | `SkeletonContainerStyle \| Record<string, SkeletonContainerStyle>` | Track-level container styles such as `gap`, `padding`, `align`, `justify`, `width`, and `maxWidth`. |
|
|
301
|
+
| `count` | `number \| undefined` | Optional explicit slot count for the layout. Falls back to `transitions.loading.skeletonCount`. |
|
|
302
|
+
| `item` | `SkeletonNode` | Default placeholder node rendered in each slot. |
|
|
303
|
+
| `itemWrapStyle` | `SliderSkeletonWrapStyle \| undefined` | Shared wrapper size, margin, border, and box-shadow rules for every slot. Border sizing is border-box. |
|
|
304
|
+
| `slots` | `SliderSkeletonSlot[] \| undefined` | Per-slot overrides for variable widths, heights, aspect ratios, or custom placeholder nodes. |
|
|
305
|
+
| `direction` | `"row" \| "col" \| undefined` | Slot flow direction. `centering: "first"` only affects row layouts. |
|
|
306
|
+
| `children` | `SkeletonNode[] \| undefined` | Optional extra skeleton content rendered after the slider row. It does not affect `--rmg-slider-initial-height` or reserve live layout space. |
|
|
307
|
+
|
|
308
|
+
#### `SliderSkeletonSlot`
|
|
309
|
+
|
|
310
|
+
| Field | Type | Notes |
|
|
311
|
+
| --- | --- | --- |
|
|
312
|
+
| `item` | `SkeletonNode \| undefined` | Replaces the base `layout.item` for one slot. |
|
|
313
|
+
| `itemWrapStyle` | `SliderSkeletonWrapStyle \| undefined` | Merges on top of the base `layout.itemWrapStyle` for one slot, including wrapper borders and shadows. |
|
|
314
|
+
|
|
315
|
+
`SkeletonNode` supports these building blocks: `rect`, `square`, `circle`, `text`, `media`, `row`, `col`, and `stack`. `text.lines` controls how many wrapped skeleton rows render for that text block, and `text.lineWidth` controls the trailing line width.
|
|
187
316
|
|
|
188
317
|
### Slider motion and effect options
|
|
189
318
|
|
|
@@ -199,6 +328,7 @@ export function BasicSlider() {
|
|
|
199
328
|
| `effects.scale.enabled` | `boolean` | `—` | Scales neighboring slides. |
|
|
200
329
|
| `effects.scale.amount` | `number` | `—` | Scale multiplier for the scale effect. |
|
|
201
330
|
| `effects.fade.enabled` | `boolean` | `—` | Fades slides based on position. |
|
|
331
|
+
| `effects.fade.minOpacity` | `number` | `0.36` | Minimum opacity used for the fade effect, clamped from `0` to `1`. |
|
|
202
332
|
|
|
203
333
|
### Slider render callback args
|
|
204
334
|
|
|
@@ -404,12 +534,23 @@ The component forwards a ref to its outer thumbnail shell. The explicit `layout`
|
|
|
404
534
|
| `transitions.loading.enabled` | `boolean` | `true` | Enables the thumbnail loading layer. |
|
|
405
535
|
| `transitions.loading.force` | `boolean` | `false` | Forces the loading layer to remain visible. |
|
|
406
536
|
| `transitions.loading.skeletonCount` | `number \| Record<string, number>` | `—` | Responsive count for the built-in loading placeholders. |
|
|
407
|
-
| `transitions.loading.
|
|
537
|
+
| `transitions.loading.mode` | `"fit" \| "peek"` | `"peek"` | `"peek"` keeps fixed-size thumbnail placeholders when width or height is explicitly set; `"fit"` divides the rail evenly across the visible count. |
|
|
538
|
+
| `transitions.loading.elements.container` | `ElementStyle` | `—` | Class and inline style for the built-in loading overlay container. |
|
|
539
|
+
| `transitions.loading.elements.row` | `ElementStyle` | `—` | Class and inline style for the built-in skeleton row or column wrapper. |
|
|
540
|
+
| `transitions.loading.elements.thumbnail` | `ElementStyle` | `—` | Class and inline style for each built-in thumbnail placeholder. |
|
|
541
|
+
| `transitions.loading.renderLoading` | `({ count }) => ReactNode` | `—` | Replaces the built-in thumbnail loading skeleton and receives the resolved responsive count. |
|
|
542
|
+
| `transitions.loading.timing.exitMs` | `number` | `600` | Keeps the thumbnail loading layer mounted for this long after exit starts. |
|
|
543
|
+
| `transitions.loading.timing.minVisibleMs` | `number` | `220` | Minimum time the loading layer stays visible before exit can begin. |
|
|
408
544
|
| `transitions.intro.renderIntro` | `({ active, containerProps }, inner) => ReactNode` | `—` | Custom intro wrapper for the thumbnail rail. |
|
|
409
|
-
| `transitions.intro.staggerMs` | `number` | `40` | Delay between thumbnail
|
|
410
|
-
| `transitions.intro.
|
|
411
|
-
| `transitions.intro.
|
|
412
|
-
|
|
545
|
+
| `transitions.intro.staggerMs` | `number` | `40` | Delay between thumbnail fade-ins. |
|
|
546
|
+
| `transitions.intro.durationMs` | `number` | `300` | Intro fade duration. |
|
|
547
|
+
| `transitions.intro.easing` | `string` | `"cubic-bezier(.2,.7,.2,1)"` | Intro fade easing. |
|
|
548
|
+
|
|
549
|
+
`transitions.loading.elements.*` only applies to the built-in thumbnail skeleton. If you provide `transitions.loading.renderLoading`, you fully own the loading markup instead.
|
|
550
|
+
|
|
551
|
+
The built-in thumbnail placeholders use the same shimmer variable family as slider skeletons: `--rmg-skel-bg`, `--rmg-skel-shimmer-enabled`, `--rmg-skel-shimmer-opacity`, `--rmg-skel-shimmer-filter`, `--rmg-skel-shimmer-angle`, `--rmg-skel-shimmer-c1`, `--rmg-skel-shimmer-c2`, `--rmg-skel-shimmer-c3`, `--rmg-skel-shimmer-duration`, and `--rmg-skel-shimmer-timing`.
|
|
552
|
+
|
|
553
|
+
For thumbnails, `transitions.loading.timing.exitMs` controls both the mounted exit lifetime and the loading-layer opacity fade. The thumbnail intro can begin as soon as the loading exit starts.
|
|
413
554
|
|
|
414
555
|
### `createThumbnailSyncBridge`
|
|
415
556
|
|
|
@@ -470,15 +611,22 @@ export function BasicGrid() {
|
|
|
470
611
|
| `loading.force` | `boolean` | `—` | Keeps the loading layer visible even when media is ready. |
|
|
471
612
|
| `loading.renderLoading` | `({ count }) => ReactNode` | `—` | Custom loading renderer. |
|
|
472
613
|
| `loading.skeleton` | `GridSkeletonSpec` | `—` | Built-in grid skeleton spec. |
|
|
614
|
+
| `loading.timing.exitMs` | `number` | `600` | Keeps the loading layer mounted for this long after exit starts. |
|
|
615
|
+
| `loading.timing.minVisibleMs` | `number` | `220` | Minimum time the loading layer stays visible before exit can begin. |
|
|
473
616
|
| `intro.renderIntro` | `({ active, containerProps }, content) => ReactNode` | `—` | Custom intro wrapper. |
|
|
474
|
-
| `intro.staggerMs` | `number` | `40` | Reveal stagger. |
|
|
475
|
-
| `intro.
|
|
476
|
-
| `intro.
|
|
477
|
-
| `intro.easing` | `string` | `"cubic-bezier(.2,.7,.2,1)"` | Intro easing. |
|
|
617
|
+
| `intro.staggerMs` | `number` | `40` | Reveal stagger for the fade-in. |
|
|
618
|
+
| `intro.durationMs` | `number` | `300` | Intro fade duration. |
|
|
619
|
+
| `intro.easing` | `string` | `"cubic-bezier(.2,.7,.2,1)"` | Intro fade easing. |
|
|
478
620
|
| `intro.staggerLimit` | `number` | `—` | Optional cap on how many items stagger. |
|
|
479
621
|
|
|
622
|
+
When `lazyLoad.enabled` is true, Grid rewrites trackable image `src` values into `data-rmg-lazy-src`, reveals them on viewport intersection, then fades them in after decode and spinner exit.
|
|
623
|
+
|
|
480
624
|
Grid fullscreen behavior is provided by `GalleryCore` and `useFullscreenController`; Grid itself does not expose a ref-based imperative API.
|
|
481
625
|
|
|
626
|
+
Grid skeleton `text` nodes use the same wrapped-line treatment as slider skeletons, including responsive `lines` maps and the configurable trailing `lineWidth`.
|
|
627
|
+
|
|
628
|
+
Grid uses the same loading timing model as Slider: `loading.timing.exitMs` controls both how long the loading layer stays mounted after exit starts and its opacity transition, and the real grid intro begins as soon as exit starts.
|
|
629
|
+
|
|
482
630
|
## Masonry
|
|
483
631
|
|
|
484
632
|
```typescript
|
|
@@ -517,6 +665,8 @@ export function BasicMasonry() {
|
|
|
517
665
|
| `gap` | `number \| Record<string, number>` | `—` | Responsive gap between columns and items. |
|
|
518
666
|
| `placement` | `"balanced" \| "roundRobin"` | `"balanced"` | `balanced` aims for even column heights. |
|
|
519
667
|
| `estimatedItemHeight` | `number` | `—` | Hint used before measurements settle. |
|
|
668
|
+
| `itemWrapClassName` | `string` | `—` | Class name added to the masonry item wrapper. |
|
|
669
|
+
| `itemWrapStyle` | `React.CSSProperties` | `—` | Inline styles applied to the masonry item wrapper. |
|
|
520
670
|
| `as` | `React.ElementType` | `"div"` | Root HTML element or custom component. |
|
|
521
671
|
| `rootRef` | `React.Ref<HTMLDivElement>` | `—` | Ref to the masonry root. |
|
|
522
672
|
| `classNames.root` | `string` | `—` | Root class name. |
|
|
@@ -531,12 +681,119 @@ export function BasicMasonry() {
|
|
|
531
681
|
| `loading.renderLoading` | `({ count }) => ReactNode` | `—` | Custom loading renderer. |
|
|
532
682
|
| `loading.skeleton` | `MasonrySkeletonSpec` | `—` | Built-in masonry skeleton spec. |
|
|
533
683
|
| `intro.renderIntro` | `({ active, containerProps }, content) => ReactNode` | `—` | Custom intro wrapper. |
|
|
534
|
-
| `intro.staggerMs` | `number` | `40` | Reveal stagger. |
|
|
535
|
-
| `intro.
|
|
536
|
-
| `intro.
|
|
537
|
-
| `intro.easing` | `string` | `"cubic-bezier(.2,.7,.2,1)"` | Intro easing. |
|
|
684
|
+
| `intro.staggerMs` | `number` | `40` | Reveal stagger for the fade-in. |
|
|
685
|
+
| `intro.durationMs` | `number` | `300` | Intro fade duration. |
|
|
686
|
+
| `intro.easing` | `string` | `"cubic-bezier(.2,.7,.2,1)"` | Intro fade easing. |
|
|
538
687
|
| `intro.staggerLimit` | `number` | `—` | Optional cap on how many items stagger. |
|
|
539
688
|
|
|
689
|
+
When `lazyLoad.enabled` is true, Masonry uses the same image shell behavior as Slider: trackable image `src` values move into `data-rmg-lazy-src`, the real images load on intersection, and the item only fades in after decode and spinner exit.
|
|
690
|
+
|
|
691
|
+
Masonry already accepts arbitrary React children, including text-containing JSX. The new wrapper props are only for styling the built-in masonry item shell.
|
|
692
|
+
|
|
693
|
+
Masonry skeletons can now use a structured `layout` spec with the same inner node vocabulary as Grid skeletons, including `text` nodes and `itemWrapStyle`.
|
|
694
|
+
|
|
695
|
+
`layout.slots` gives Masonry the same per-card override escape hatch that slider skeletons have. Use a slot when one card needs a different placeholder tree, wrapper styling, or outer height. `slot.ratio` maps to Masonry's card-height rhythm, while `slot.heightPx` lets you pin a specific shell height when you need an exact placeholder.
|
|
696
|
+
|
|
697
|
+
```typescript
|
|
698
|
+
<Masonry
|
|
699
|
+
columns={{ 0: 1, 700: 2, 1100: 3 }}
|
|
700
|
+
gap={{ 0: 12, 1100: 20 }}
|
|
701
|
+
itemWrapStyle={{
|
|
702
|
+
padding: "6px",
|
|
703
|
+
borderRadius: "28px",
|
|
704
|
+
}}
|
|
705
|
+
loading={{
|
|
706
|
+
enabled: true,
|
|
707
|
+
skeleton: {
|
|
708
|
+
ratios: [118, 126, 102, 146],
|
|
709
|
+
layout: {
|
|
710
|
+
kind: "masonry",
|
|
711
|
+
itemWrapStyle: {
|
|
712
|
+
padding: 14,
|
|
713
|
+
borderRadius: 20,
|
|
714
|
+
boxShadow: "0 18px 36px rgba(15, 23, 42, 0.08)",
|
|
715
|
+
},
|
|
716
|
+
item: {
|
|
717
|
+
kind: "col",
|
|
718
|
+
style: { gap: 12 },
|
|
719
|
+
children: [
|
|
720
|
+
{
|
|
721
|
+
kind: "rect",
|
|
722
|
+
style: { width: "100%", height: 180, borderRadius: 16 },
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
kind: "text",
|
|
726
|
+
fontSize: 12,
|
|
727
|
+
lineHeight: 1.4,
|
|
728
|
+
lines: 1,
|
|
729
|
+
lineWidth: "36%",
|
|
730
|
+
style: { width: "34%", borderRadius: 999 },
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
kind: "text",
|
|
734
|
+
fontSize: 18,
|
|
735
|
+
lineHeight: 1.35,
|
|
736
|
+
lines: { 0: 2, 900: 1 },
|
|
737
|
+
lineWidth: "64%",
|
|
738
|
+
style: { width: "88%" },
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
kind: "text",
|
|
742
|
+
fontSize: 14,
|
|
743
|
+
lineHeight: 1.55,
|
|
744
|
+
lines: 3,
|
|
745
|
+
lineWidth: "74%",
|
|
746
|
+
style: { width: "100%" },
|
|
747
|
+
},
|
|
748
|
+
],
|
|
749
|
+
},
|
|
750
|
+
slots: [
|
|
751
|
+
{
|
|
752
|
+
ratio: 182,
|
|
753
|
+
item: {
|
|
754
|
+
kind: "col",
|
|
755
|
+
style: { gap: 12 },
|
|
756
|
+
children: [
|
|
757
|
+
{
|
|
758
|
+
kind: "rect",
|
|
759
|
+
style: { width: "100%", aspectRatio: "3 / 5", borderRadius: 16 },
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
kind: "text",
|
|
763
|
+
fontSize: 12,
|
|
764
|
+
lineHeight: 1.4,
|
|
765
|
+
lines: 1,
|
|
766
|
+
lineWidth: "36%",
|
|
767
|
+
style: { width: "28%", borderRadius: 999 },
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
kind: "text",
|
|
771
|
+
fontSize: 18,
|
|
772
|
+
lineHeight: 1.35,
|
|
773
|
+
lines: 1,
|
|
774
|
+
lineWidth: "64%",
|
|
775
|
+
style: { width: "72%" },
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
kind: "text",
|
|
779
|
+
fontSize: 14,
|
|
780
|
+
lineHeight: 1.55,
|
|
781
|
+
lines: 2,
|
|
782
|
+
lineWidth: "78%",
|
|
783
|
+
style: { width: "100%" },
|
|
784
|
+
},
|
|
785
|
+
],
|
|
786
|
+
},
|
|
787
|
+
},
|
|
788
|
+
],
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
}}
|
|
792
|
+
>
|
|
793
|
+
{items}
|
|
794
|
+
</Masonry>
|
|
795
|
+
```
|
|
796
|
+
|
|
540
797
|
## Entries
|
|
541
798
|
|
|
542
799
|
`Entries` is the structured-data surface. You pass entry objects, render each media item however you want, and provide a `renderMediaContainer` function that decides whether an entry’s media should be laid out as a slider, grid, or masonry block.
|
|
@@ -643,13 +900,15 @@ export function EntryGallery() {
|
|
|
643
900
|
| `loading.decodeTimeoutMs` | `number` | `8000` | Decode timeout fallback. |
|
|
644
901
|
| `loading.skeletonWrap` | `ElementStyle` | `—` | Styles the skeleton wrapper. |
|
|
645
902
|
| `intro.renderIntro` | `({ active, containerProps }, content) => ReactNode` | `—` | Custom intro wrapper. |
|
|
646
|
-
| `intro.staggerMs` | `number` | `200` | Delay between entry
|
|
647
|
-
| `intro.durationMs` | `number` | `700` | Entry intro duration. |
|
|
648
|
-
| `intro.easing` | `string` | `"cubic-bezier(.2,.7,.2,1)"` | Entry intro easing. |
|
|
903
|
+
| `intro.staggerMs` | `number` | `200` | Delay between entry fade-ins. |
|
|
904
|
+
| `intro.durationMs` | `number` | `700` | Entry intro fade duration. |
|
|
905
|
+
| `intro.easing` | `string` | `"cubic-bezier(.2,.7,.2,1)"` | Entry intro fade easing. |
|
|
649
906
|
| `intro.staggerLimit` | `number` | `6` | Maximum number of entries that receive staggered delays. |
|
|
650
907
|
| `entryList` | `ElementStyle` | `—` | Styles the entry list container. |
|
|
651
908
|
| `entryRow` | `ElementStyle` | `—` | Styles each entry row container. |
|
|
652
909
|
|
|
910
|
+
Entry skeleton `text` nodes also render wrapped line bars via `lines`, matching the slider and grid skeleton behavior, including responsive line counts and configurable trailing `lineWidth`.
|
|
911
|
+
|
|
653
912
|
### Entry-related callback and helper types
|
|
654
913
|
|
|
655
914
|
#### `EntryItem`
|
|
@@ -860,6 +1119,12 @@ The hook returns additional refs and setters for the internal fullscreen runtime
|
|
|
860
1119
|
| `caption.height` | `number` | `—` | Caption area height. |
|
|
861
1120
|
| `caption.breakpoint` | `number` | `—` | Viewport cutoff for switching placement logic. |
|
|
862
1121
|
| `caption.render` | `({ item, index, isZoomed }) => ReactNode` | `—` | Custom caption renderer. |
|
|
1122
|
+
| `caption.layout` | `"overlay" \| "slide"` | `—` | Chooses whether the caption overlays the media or lives in the slide layout. |
|
|
1123
|
+
| `caption.zoomFade` | `boolean` | `true` | Fades captions out on fullscreen zoom-in and back in on zoom-out. |
|
|
1124
|
+
| `caption.zoomFadeDurationMs` | `number` | `300` | Duration for fullscreen caption zoom fades. |
|
|
1125
|
+
| `caption.zoomFadeEasing` | `string` | `"cubic-bezier(.4,0,.22,1)"` | Easing for fullscreen caption zoom fades. |
|
|
1126
|
+
| `caption.zoomInTransform` | `string` | `""` | Optional transform applied while captions fade out on zoom-in. |
|
|
1127
|
+
| `caption.zoomOutTransform` | `string` | `""` | Optional transform used as the starting point when captions fade back in on zoom-out. |
|
|
863
1128
|
| `slider.duration` | `number` | `25` | Fullscreen slider motion duration. |
|
|
864
1129
|
| `slider.friction` | `number` | `0.68` | Fullscreen slider friction. |
|
|
865
1130
|
| `slider.direction` | `"ltr" \| "rtl"` | `"ltr"` | Fullscreen slider interaction direction. |
|