morphing-scroll 1.5.22 → 2.1.0

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/index.d.ts DELETED
@@ -1,333 +0,0 @@
1
- import React from "react";
2
-
3
- // RESIZE_TRACKER
4
- type ResizeTrackerT = {
5
- /**---
6
- * *Render-prop function receiving the container's size.*
7
- *
8
- * @param rect - The current dimensions of the container
9
- * @example
10
- * ```tsx
11
- * <ResizeTracker>
12
- * {( rect ) => (
13
- * <p>Width: {rect.width}, Height: {rect.height}</p>
14
- * )}
15
- * </ResizeTracker>
16
- * ```
17
- * */
18
- children: (rect: DOMRectReadOnly) => React.ReactNode;
19
- /**---
20
- * *Custom inline styles for the ResizeTracker.*
21
- * @example
22
- * ```tsx
23
- * <ResizeTracker
24
- * style={{ backgroundColor: "blue" }}
25
- * >
26
- * // render-prop function
27
- * </ResizeTracker>
28
- * ```
29
- */
30
- style?: React.CSSProperties;
31
- /**---
32
- * *Defines size measurement behavior*
33
- * #### Options:
34
- * - `"inner"`: Fits content.
35
- * - `"outer"`: Fills parent.
36
- * - `"all"`: Combines both.
37
- *
38
- * @default-"inner"
39
- */
40
- measure?: "inner" | "outer" | "all";
41
- /**---
42
- * *Callback on dimension change.*
43
- *
44
- * @param rect - The dimensions of the container
45
- * @example
46
- * ```tsx
47
- * <ResizeTracker
48
- * onResize={(rect) => console.log(rect)
49
- * }
50
- * {( rect ) => (
51
- * <p>Width: {rect.width}, Height: {rect.height}</p>
52
- * )}
53
- * </ResizeTracker>
54
- * ```
55
- */
56
- onResize?: (rect: Partial<DOMRectReadOnly>) => void;
57
- };
58
-
59
- /**
60
- * ## *ResizeTracker component*〈♦〉
61
- *
62
- * ---
63
- * ## PROPS:
64
- * - `children` ***REQUIRED***
65
- * - `style`
66
- * - `measure`
67
- * - `onResize`
68
- * ##### ! MORE DETAILS IN PROPS OR LINKS !
69
- *
70
- * ---
71
- * ## RETURNS:
72
- * React component.
73
- *
74
- * ---
75
- * ## LINKS:
76
- * [ResizeTracker Documentation](https://github.com/voodoofugu/morphing-scroll?tab=readme-ov-file#-resizetracker-)
77
- *
78
- * [MDN Reference for Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)
79
- */
80
- declare const ResizeTracker: React.FC<ResizeTrackerT>;
81
-
82
- // INTERSECTION_TRACKER
83
- type IntersectionTrackerT = {
84
- /**---
85
- * *Child elements to be rendered when visible.*
86
- */
87
- children: React.ReactNode;
88
- /**---
89
- * *Custom inline styles for the IntersectionTracker component.*
90
- */
91
- style?: React.CSSProperties;
92
- /**---
93
- * *The root element for IntersectionObserver.*
94
- * @default-viewport
95
- */
96
- root?: Element | null;
97
- /**---
98
- * *Margin around the root.
99
- * Can be a single number or an array of up to 4 numbers (top, right, bottom, left).*
100
- */
101
- rootMargin?: number[] | number;
102
- /**---
103
- * Visibility threshold for triggering intersection events.
104
- * A value between 0.0 (out of view) and 1.0 (fully visible).
105
- */
106
- threshold?: number;
107
- /**---
108
- * Renders children regardless of their visibility in the viewport.
109
- * @default-false
110
- */
111
- visibleContent?: boolean;
112
- /**---
113
- * Callback function triggered when `children` become visible.
114
- * @param key - The key of the first child element
115
- */
116
- onVisible?: (key: string) => void;
117
- };
118
-
119
- /**
120
- * ## *IntersectionTracker component*〈♦〉
121
- *
122
- * ---
123
- * ## PROPS:
124
- * - `children` ***REQUIRED***
125
- * - `style`
126
- * - `root`
127
- * - `rootMargin`
128
- * - `threshold`
129
- * - `visibleContent`
130
- * - `onVisible`
131
- * ##### ! MORE DETAILS IN PROPS OR LINKS !
132
- *
133
- * ---
134
- * ## RETURNS:
135
- * React component.
136
- *
137
- * ---
138
- * ## LINKS:
139
- * [IntersectionTracker Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
140
- *
141
- * [MDN Reference for Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
142
- */
143
- declare const IntersectionTracker: React.FC<IntersectionTrackerT>;
144
-
145
- // MORPH_SCROLL
146
- export type MorphScrollT = {
147
- /**---
148
- * *Additional class for the component.*
149
- */
150
- className?: string;
151
- /**---
152
- * *Custom user content.*
153
- */
154
- children?: React.ReactNode;
155
- /**---
156
- * *Type of progress element.*
157
- * @default-"scroll"
158
- */
159
- type?: "scroll" | "slider";
160
- /**---
161
- * *Scrolling direction.*
162
- * @default-"y"
163
- */
164
- direction?: "x" | "y";
165
- /**---
166
- * *Scroll position and animation duration.*
167
- */
168
- scrollTop?: {
169
- value: number | "end" | null;
170
- duration?: number;
171
- updater?: boolean;
172
- };
173
- /**---
174
- * *Stop loading when scrolling.*
175
- * @default-false
176
- */
177
- stopLoadOnScroll?: boolean;
178
- /**---
179
- * *Callback for scroll value.*
180
- * @example
181
- * `onScrollValue={
182
- * (scroll) => scroll > 200 && console.log("scroll > 200")
183
- * }`
184
- */
185
- onScrollValue?: (scroll: number) => void;
186
- /**---
187
- * *Callback for scroll status.*
188
- * @example `isScrolling={(value) => console.log(value)}`
189
- */
190
- isScrolling?: (motion: boolean) => void;
191
- /**---
192
- * *MorphScroll width and height.*
193
- */
194
- size?: number[];
195
- /**---
196
- * *Required: Size of cells for each object.*
197
- */
198
- objectsSize: (number | "none" | "firstChild")[];
199
- /**---
200
- * *Gap between cells.*
201
- */
202
- gap?: number[] | number;
203
- /**---
204
- * *Padding for the `objectsWrapper`.*
205
- */
206
- padding?: number[] | number;
207
- /**---
208
- * *Aligns the content when it is smaller than the MorphScroll `size`.*
209
- */
210
- contentAlign?: ["start" | "center" | "end", "start" | "center" | "end"];
211
- /**---
212
- * *Aligns the objects within the `objectsWrapper`.*
213
- */
214
- elementsAlign?: "start" | "center" | "end";
215
- /**---
216
- * *Edge gradient.*
217
- * @default if true { color: "rgba(0,0,0,0.4)", size: 40 }
218
- */
219
- edgeGradient?: boolean | { color?: string; size?: number };
220
- /**---
221
- * *Reverse the progress bar direction.*
222
- * @default false
223
- */
224
- progressReverse?: boolean;
225
- /**---
226
- * *Visibility of the progress bar.*
227
- * @default "visible"
228
- */
229
- progressVisibility?: "visible" | "hover" | "hidden";
230
- /**---
231
- * *Sets the `min-height` CSS property of the `objectsWrapper` to match the height of the MorphScroll.*
232
- */
233
- objectsWrapFullMinSize?: boolean;
234
- /**---
235
- * *Triggers for the progress bar.*
236
- * @default-{ wheel: true }
237
- * @example
238
- * `progressTrigger={
239
- * wheel: true,
240
- * content: true,
241
- * progressElement: true // false // <YourProgressComponent/>,
242
- * arrows: true // { size: number, element: <YourArrowComponent/> }
243
- * }`
244
- */
245
- progressTrigger?: {
246
- wheel?: boolean;
247
- content?: boolean;
248
- progressElement?: boolean | React.ReactNode;
249
- arrows?: boolean | { size?: number; element?: React.ReactNode };
250
- };
251
- /**---
252
- * *Types of rendering for optimization.*
253
- * @default-{ type: "default" }
254
- */
255
- render?:
256
- | { type: "default" }
257
- | {
258
- type: "lazy";
259
- rootMargin?: number | number[];
260
- onVisible?: (key: string) => void;
261
- }
262
- | { type: "virtual"; rootMargin?: number | number[] };
263
- /**---
264
- * *Handling of empty scroll elements.*
265
- */
266
- emptyElements?:
267
- | {
268
- mode: "clear";
269
- clickTrigger?: { selector: string; delay?: number };
270
- }
271
- | {
272
- mode: "fallback";
273
- element?: React.ReactNode;
274
- clickTrigger?: { selector: string; delay?: number };
275
- };
276
- /**---
277
- * *Adds React Suspense.*
278
- */
279
- suspending?: boolean;
280
- /**---
281
- * *Fallback element.*
282
- */
283
- fallback?: React.ReactNode;
284
- };
285
-
286
- /**
287
- * ## *MorphScroll component*〈♦〉
288
- *
289
- * ---
290
- * ## PROPS:
291
- * #### • GENERAL SETTINGS:
292
- * - `className`
293
- * - `children`
294
- *
295
- * #### • SCROLL SETTINGS:
296
- * - `type`
297
- * - `direction`
298
- * - `scrollTop`
299
- * - `stopLoadOnScroll`
300
- * - `onScrollValue`
301
- * - `isScrolling`
302
- *
303
- * #### • VISUAL SETTINGS:
304
- * - `size`
305
- * - `objectsSize` ***REQUIRED***
306
- * - `gap`
307
- * - `padding`
308
- * - `contentAlign`
309
- * - `elementsAlign`
310
- * - `edgeGradient`
311
- * - `progressReverse`
312
- * - `progressVisibility`
313
- * - `objectsWrapFullMinSize`
314
- *
315
- * #### • PROGRESS AND RENDERING:
316
- * - `progressTrigger`
317
- * - `render`
318
- * - `emptyElements`
319
- * - `suspending`
320
- * - `fallback`
321
- * ##### ! MORE DETAILS IN PROPS OR LINKS !
322
- *
323
- * ---
324
- * ## RETURNS:
325
- * React component.
326
- *
327
- * ---
328
- * ## LINKS:
329
- * [MorphScroll Documentation](https://github.com/voodoofugu/morphing-scroll?tab=readme-ov-file#-scroll)
330
- */
331
- declare const MorphScroll: React.FC<MorphScrollT>;
332
-
333
- export { MorphScroll, ResizeTracker, IntersectionTracker };