morphing-scroll 2.6.0 → 2.7.1

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 CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  ### 〈 About 〉
15
15
 
16
- `morphing-scroll` is a `React` is a React library originally created to address common limitations of the native browser scrollbar, including:
16
+ `morphing-scroll` is a `React` library originally created to address common limitations of the native browser scrollbar, including:
17
17
 
18
18
  - Design customization constraints
19
19
  - Cross-browser compatibility
@@ -49,6 +49,8 @@ Start using the `MorphScroll` component by defining the required `size` prop. Fo
49
49
 
50
50
  > **✦ Note:**
51
51
  > `MorphScroll` supports both **ESM** (`import`) and **CommonJS** (`require`) builds.
52
+ >
53
+ > This library is currently under development. APIs and behavior may change in future releases.
52
54
 
53
55
  <h2></h2>
54
56
 
@@ -65,9 +67,6 @@ Start using the `MorphScroll` component by defining the required `size` prop. Fo
65
67
  ###### **— GENERAL SETTINGS —**
66
68
 
67
69
  <details><summary><b><code>className</code></b></summary><br /><ul><div>
68
- <b>Type:</b><br />
69
- string<br />
70
- <br />
71
70
  <b>Description:</b><em><br />
72
71
  allows you to add additional classes to the component.</em><br />
73
72
  <br />
@@ -84,14 +83,11 @@ allows you to add additional classes to the component.</em><br />
84
83
  <h2></h2>
85
84
 
86
85
  <details><summary><b><code>children</code></b></summary><br /><ul><div>
87
- <b>Type:</b><br />
88
- React.ReactNode<br />
89
- <br />
90
86
  <b>Description:</b><em><br />
91
- allows you to add custom content to the component.<br />
87
+ allows to add custom content to the component.<br />
92
88
  Make sure to provide unique keys for each list item, as per React's rules. The <code>MorphScroll</code> component ensures that the cells it generates will use the same keys as your list items, allowing it to render the correct cells for the current list.<br />
93
- Additionally, <code>MorphScroll</code> handles a passed <b>null</b> value the same way as <b>undefined</b>, rendering nothing in both cases.</em><br />
94
- <br />
89
+ Additionally, <code>MorphScroll</code> handles a passed <b>null</b> value the same way as <b>undefined</b>, rendering nothing in both cases.<br />
90
+ </em><br />
95
91
  <b>Example:</b>
96
92
 
97
93
  ```tsx
@@ -105,21 +101,27 @@ Additionally, <code>MorphScroll</code> handles a passed <b>null</b> value the sa
105
101
  ###### **— SCROLL SETTINGS —**
106
102
 
107
103
  <details><summary><b><code>type</code></b></summary><br /><ul><div>
108
- <b>Type:</b><br />
109
- "scroll" | "slider" | "sliderMenu"<br />
110
- <br />
104
+ <b>Usage:</b><br />
105
+
106
+ ```tsx
107
+ type: "slider"; // or "scroll" | "sliderMenu"
108
+ ```
109
+
111
110
  <b>Default:</b><br />
112
111
  "scroll"<br />
113
112
  <br />
114
113
  <b>Description:</b><em><br />
115
114
  defines how the provided <code>progressElement</code> behaves within <code>progressTrigger</code> and how you interact with it.<br />
116
115
  <br />
117
- <b>scroll</b> - This is the default value and represents a standard scrollbar.<br />
116
+ <code><b>scroll</b></code>:<br />
117
+ the default value and represents a standard scrollbar.<br />
118
118
  <br />
119
- <b>slider</b> - It displays distinct elements indicating the number of full scroll steps within the list.<br />
120
- <br />
121
- <b>sliderMenu</b> - It behaves like a <code>slider</code>, but now the <code>progressElement</code> is a menu, an you can provide custom buttons as an array in the <code>progressElement</code>.</em><br />
119
+ <code><b>slider</b></code>:<br />
120
+ displays distinct elements indicating the number of full scroll steps within the list.<br />
122
121
  <br />
122
+ <code><b>sliderMenu</b></code>:<br />
123
+ like <code>slider</code>, but the <code>progressElement</code> is a menu, an you can provide custom buttons as an array in the <code>progressElement</code>.<br />
124
+ </em><br />
123
125
  <b>Example:</b>
124
126
 
125
127
  ```tsx
@@ -135,9 +137,12 @@ defines how the provided <code>progressElement</code> behaves within <code>progr
135
137
  <h2></h2>
136
138
 
137
139
  <details><summary><b><code>direction</code></b></summary><br /><ul><div>
138
- <b>Type:</b><br />
139
- "x" | "y" | "hybrid"<br />
140
- <br />
140
+ <b>Usage:</b><br />
141
+
142
+ ```tsx
143
+ size: "x"; // or "y" | "hybrid"
144
+ ```
145
+
141
146
  <b>Default:</b><br />
142
147
  "y"<br />
143
148
  <br />
@@ -160,33 +165,47 @@ You can set the value to horizontal, vertical or hybrid positions to customize t
160
165
  <h2></h2>
161
166
 
162
167
  <details><summary><b><code>scrollPosition</code></b></summary><br /><ul><div>
163
- <b>Type:</b><br />
164
- number | "end" | (number | "end")[]<br />
165
- | {<br />
168
+ <b>Usage:</b><br />
169
+
166
170
  <ul>
167
- value: number | "end" | (number | "end")[];<br />
168
- duration?: number;<br />
169
- updater?: boolean;<br />
171
+ <li><b>Simple</b>:<br />
172
+
173
+ ```tsx
174
+ scrollPosition: 10; // or "end" | null | array if direction="hybrid"
175
+ ```
176
+
177
+ </li>
178
+ <li><b>Advanced</b>:<br />
179
+
180
+ ```tsx
181
+ scrollPosition: {
182
+ value: 10; // or "end" | null | array if direction="hybrid"
183
+ duration: 400;
184
+ updater: true;
185
+ }
186
+ ```
187
+
188
+ </li>
170
189
  </ul>
171
- }<br />
172
- <br />
190
+
173
191
  <b>Default:</b><br />
174
192
  { duration: 200; updater: false }<br />
175
193
  <br />
176
194
  <b>Description:</b><em><br />
177
195
  allows you to set custom scroll values.<br />
178
196
  <br />
179
- <code>value</code>:<br />
197
+ <code><b>value</b></code>:<br />
198
+
180
199
  <ul>
181
200
  <li><b>number</b> - Sets position to a specific value.</li>
182
201
  <li><b>"end"</b> - Sets position to the end of the list.</li>
183
202
  </ul>
184
203
  You can also provide an array of two values to specific positions ( e.g., [ x, y ] axes ) for hybrid directions.</code><br />
185
204
  <br />
186
- <code>duration</code>:<br />
205
+ <code><b>duration</b></code>:<br />
187
206
  property determines the animation speed for scrolling in <b>ms</b>.<br />
188
207
  <br />
189
- <code>updater</code>:<br />
208
+ <code><b>updater</b></code>:<br />
190
209
  property is a helper for the <code>value</code>. When setting the same scroll value repeatedly, React does not register the update and you can use it to force an update</em><br />
191
210
  <br />
192
211
  <b>Example:</b>
@@ -204,11 +223,8 @@ property is a helper for the <code>value</code>. When setting the same scroll va
204
223
  <h2></h2>
205
224
 
206
225
  <details><summary><b><code>onScrollValue</code></b></summary><br /><ul><div>
207
- <b>Type:</b><br />
208
- ( left: number, top: number ) => void<br />
209
- <br />
210
226
  <b>Description:</b><em><br />
211
- accepts a callback function that is triggered on every scroll event. The callback receives the current scroll top and left position as a number. The return value of the callback can be used to determine custom behavior based on the scroll value.</em><br />
227
+ accepts a callback function that is triggered on every scroll event. The callback receives the current scroll top and left position as a <b>number</b>. The return value of the callback can be used to determine custom behavior based on the scroll value.</em><br />
212
228
  <br />
213
229
  <b>Example:</b>
214
230
 
@@ -227,9 +243,6 @@ accepts a callback function that is triggered on every scroll event. The callbac
227
243
  <h2></h2>
228
244
 
229
245
  <details><summary><b><code>isScrolling</code></b></summary><br /><ul><div>
230
- <b>Type:</b><br />
231
- ( motion: boolean ) => void<br />
232
- <br />
233
246
  <b>Description:</b><em><br />
234
247
  accepts a callback function that is triggered whenever the scroll status changes. The callback receives a boolean value, where <code>true</code> indicates that scrolling is in progress, and <code>false</code> indicates that scrolling has stopped. This can be useful for triggering additional actions, such as pausing animations or loading indicators based on the scroll state.</em><br />
235
248
  <br />
@@ -253,16 +266,19 @@ accepts a callback function that is triggered whenever the scroll status changes
253
266
  ###### **— VISUAL SETTINGS —**
254
267
 
255
268
  <details><summary><b><code>size</code></b> REQUIRED</summary><br /><ul><div>
256
- <b>Type:</b><br />
257
- number | number[] | "auto"<br />
258
- <br />
269
+ <b>Usage:</b><br />
270
+
271
+ ```tsx
272
+ size: 100; // or [100, 70] | "auto"
273
+ ```
274
+
259
275
  <b>Description:</b><em><br />
260
276
  sets the width and height of the <code>MorphScroll</code>.<br />
261
277
  <br />
262
- <code>number</code>:<br />
278
+ <code><b>number</b></code>:<br />
263
279
  sets a fixed size in pixels. It can be 1 number if you want to set the same width and height, or an array of 2 numbers.<br />
264
280
  <br />
265
- <code>"auto"</code>:<br />
281
+ <code><b>"auto"</b></code>:<br />
266
282
  adds the <code>ResizeTracker</code> component to measure the width and height of the area where <code>MorphScroll</code> is added. The dimensions will automatically adjust when the container changes.</em><br />
267
283
  <br />
268
284
  <b>Example:</b>
@@ -280,41 +296,31 @@ adds the <code>ResizeTracker</code> component to measure the width and height of
280
296
  <h2></h2>
281
297
 
282
298
  <details><summary><b><code>objectsSize</code></b></summary><br /><ul><div>
283
- <b>Type:</b><br />
284
- number | "size" | "firstChild" | "none"<br />
285
- | ( number | "size" | "firstChild" | "none" )[]<br />
286
- <br />
287
- <b>Default:</b><br />
288
- If you don't provide any value, the default value will be taken from <code>size</code>.<br />
289
- <br />
299
+ <b>Usage:</b><br />
300
+
301
+ ```tsx
302
+ objectsSize: 100; // or [100, 70] | "size" | "firstChild" | "none"
303
+ ```
304
+
290
305
  <b>Description:</b><em><br />
291
306
  defines the <b>[width, height]</b> of cells for each of your objects.<br />
292
307
  <br />
293
308
  <code>number</code>:<br />
294
309
  sets a fixed size for your custom objects.<br />
295
310
  <br />
296
- <code>"size"</code>:<br />
311
+ <code><b>"size"</b></code>:<br />
297
312
  the dimensions will be taken from <code>size</code>.<br />
298
313
  <br />
299
- <code>"firstChild"</code>:<br />
314
+ <code><b>"firstChild"</b></code>:<br />
300
315
  creates a <code>ResizeTracker</code> wrapper for the first child of your list. This wrapper will calculate the size of the first child, and these dimensions will be applied to all cells in the list.<br />
301
316
  This can be useful if you want to change the size of objects in your list dynamically, e.g., when reducing the size of the user's screen.<br />
302
317
  <br />
303
- <code>"none"</code>:<br />
318
+ <code><b>"none"</b></code>:<br />
304
319
  cells will still be created, but <code>MorphScroll</code> will not calculate their sizes-they will simply wrap your objects.<br />
305
320
  <br />
306
- If no value is provided, the default behavior is partially inferred from the <code>size</code> prop:
307
- <ul>
308
- <li>When <code>direction="x"</code>, the height from <code>size</code> will be used, behaving as if you had passed <code>objectsSize=["size", "none"]</code>.</li>
309
- <li>When <code>direction="y"</code>, the width from <code>size</code> will be used, behaving as if you had passed <code>objectsSize=["none", "size"]</code>.</li>
310
- </ul>
311
- <br />
312
321
  ✦ Note:<br />
313
- <ul>
314
- <li>All types can be used as 1 value, or an array of 2 values.</li>
315
- <li><b>"none"</b> is not compatible with <code>render</code>.</li>
316
- </ul></em><br />
317
- <br />
322
+ <b>"none"</b> is not compatible with <code>render</code>.<br />
323
+ </em><br />
318
324
  <b>Example:</b>
319
325
 
320
326
  ```tsx
@@ -330,9 +336,6 @@ If no value is provided, the default behavior is partially inferred from the <co
330
336
  <h2></h2>
331
337
 
332
338
  <details><summary><b><code>crossCount</code></b></summary><br /><ul><div>
333
- <b>Type:</b><br />
334
- number<br />
335
- <br />
336
339
  <b>Description:</b><em><br />
337
340
  defines the number of <b>columns</b> or <b>rows</b>.<br />
338
341
  <br />
@@ -357,15 +360,15 @@ defines the number of <b>columns</b> or <b>rows</b>.<br />
357
360
  <h2></h2>
358
361
 
359
362
  <details><summary><b><code>gap</code></b></summary><br /><ul><div>
360
- <b>Type:</b><br />
361
- number | number[]<br />
362
- <br />
363
+ <b>Usage:</b><br />
364
+
365
+ ```tsx
366
+ gap: 10; // or [20, 10]
367
+ ```
368
+
363
369
  <b>Description:</b><em><br />
364
370
  allows you to set spacing in pixels between list items for rows and columns.<br />
365
- <br />
366
- ✦ Note:<br />
367
- it can be 1 number or an array of 2 numbers.</em><br />
368
- <br />
371
+ </em><br />
369
372
  <b>Example:</b>
370
373
 
371
374
  ```tsx
@@ -381,15 +384,15 @@ it can be 1 number or an array of 2 numbers.</em><br />
381
384
  <h2></h2>
382
385
 
383
386
  <details><summary><b><code>wrapperMargin</code></b></summary><br /><ul><div>
384
- <b>Type:</b><br />
385
- number | number[]<br />
386
- <br />
387
+ <b>Usage:</b><br />
388
+
389
+ ```tsx
390
+ wrapperMargin: 10; // or [v, h] | [t, r, b, l]
391
+ ```
392
+
387
393
  <b>Description:</b><em><br />
388
394
  defines the spacing between the list items and their wrapper, effectively increasing the width or height of the scrollable area.<br />
389
- <br />
390
- ✦ Note:<br />
391
- can be 1 number or an array of 2 or 4 numbers in pixels.</em><br />
392
- <br />
395
+ </em><br />
393
396
  <b>Example:</b>
394
397
 
395
398
  ```tsx
@@ -405,15 +408,32 @@ can be 1 number or an array of 2 or 4 numbers in pixels.</em><br />
405
408
  <h2></h2>
406
409
 
407
410
  <details><summary><b><code>wrapperMinSize</code></b></summary><br /><ul><div>
408
- <b>Type:</b><br />
409
- number | "full" | (number | "full")[]<br />
410
- <br />
411
+ <b>Usage:</b><br />
412
+
413
+ <ul>
414
+ <li><b>Simple</b>:<br />
415
+
416
+ ```tsx
417
+ wrapperMinSize: 10; // or "full"
418
+ ```
419
+
420
+ </li>
421
+ <li><b>Advanced</b>:<br />
422
+
423
+ ```tsx
424
+ // if direction="hybrid"
425
+ wrapperMinSize: [
426
+ "full",
427
+ 10,
428
+ ] // or one value for both sides
429
+ ```
430
+
431
+ </li>
432
+ </ul>
433
+
411
434
  <b>Description:</b><em><br />
412
435
  defines the minimum height or width of the <b>.ms-objects-wrapper</b>, to which CSS properties like <code>min-height</code> or <code>min-width</code> will be applied.<br />
413
- <br />
414
- ✦ Note:<br />
415
- can be used as 1 value, or an array of 2 values.</em><br />
416
- <br />
436
+ </em><br />
417
437
  <b>Example:</b>
418
438
 
419
439
  ```tsx
@@ -429,19 +449,34 @@ can be used as 1 value, or an array of 2 values.</em><br />
429
449
  <h2></h2>
430
450
 
431
451
  <details><summary><b><code>wrapperAlign</code></b></summary><br /><ul><div>
432
- <b>Type:</b><br />
433
- "start" | "center" | "end"<br />
434
- | ("start" | "center" | "end")[]<br />
435
- <br />
452
+ <b>Usage:</b><br />
453
+
454
+ <ul>
455
+ <li><b>Simple</b>:<br />
456
+
457
+ ```tsx
458
+ wrapperAlign: "center"; // or "start" | "end"
459
+ ```
460
+
461
+ </li>
462
+ <li><b>Advanced</b>:<br />
463
+
464
+ ```tsx
465
+ wrapperAlign: [
466
+ "center",
467
+ "start",
468
+ ] // or one value for both axes
469
+ ```
470
+
471
+ </li>
472
+ </ul>
473
+
436
474
  <b>Default:</b><br />
437
475
  "start"<br />
438
476
  <br />
439
477
  <b>Description:</b><em><br />
440
478
  aligns the <b>.ms-objects-wrapper</b>, which contains all the provided elements, relative to the scroll or the <code>size</code>.<br />
441
- <br />
442
- ✦ Note:<br />
443
- use 1 value to align one or both axes, or an array of 2 values to align both axes.</em><br />
444
- <br />
479
+ </em><br />
445
480
  <b>Example:</b>
446
481
 
447
482
  ```tsx
@@ -457,9 +492,12 @@ use 1 value to align one or both axes, or an array of 2 values to align both axe
457
492
  <h2></h2>
458
493
 
459
494
  <details><summary><b><code>elementsAlign</code></b></summary><br /><ul><div>
460
- <b>Type:</b><br />
461
- "start" | "center" | "end"<br />
462
- <br />
495
+ <b>Usage:</b><br />
496
+
497
+ ```tsx
498
+ elementsAlign: "center"; // or "start" | "end"
499
+ ```
500
+
463
501
  <b>Default:</b><br />
464
502
  "start"<br />
465
503
  <br />
@@ -478,9 +516,12 @@ use 1 value to align one or both axes, or an array of 2 values to align both axe
478
516
  <h2></h2>
479
517
 
480
518
  <details><summary><b><code>elementsDirection</code></b></summary><br /><ul><div>
481
- <b>Type:</b><br />
482
- "row" | "column"<br />
483
- <br />
519
+ <b>Usage:</b><br />
520
+
521
+ ```tsx
522
+ elementsDirection: "row"; // or "column"
523
+ ```
524
+
484
525
  <b>Default:</b><br />
485
526
  "row"<br />
486
527
  <br />
@@ -502,22 +543,42 @@ changes the order of the provided elements based on the provided value.</em><br
502
543
  <h2></h2>
503
544
 
504
545
  <details><summary><b><code>edgeGradient</code></b></summary><br /><ul><div>
505
- <b>Type:</b><br />
506
- boolean | string | { color?: string; size?: number }<br />
507
- <br />
508
- <b>Default:</b><br />
509
- { size: 40 }<br />
510
- <br />
546
+ <b>Usage:</b><br />
547
+
548
+ <ul>
549
+ <li><b>Simple</b>:<br />
550
+
551
+ ```tsx
552
+ edgeGradient: true; // or "#fff"
553
+ ```
554
+
555
+ </li>
556
+ <li><b>Advanced</b>:<br />
557
+
558
+ ```tsx
559
+ edgeGradient: {
560
+ color: "#fff",
561
+ size: 60, // default 40px
562
+ }
563
+ ```
564
+
565
+ </li>
566
+ </ul>
567
+
511
568
  <b>Description:</b><em><br />
512
- parameter creates two edge elements responsible for darkening the edges of the scroll when it overflows.<br />
569
+ parameter creates several edge elements responsible for darkening the edges of the scroll when it overflows.<br />
513
570
  <br />
514
- <code>color</code>:<br />
571
+ <code><b>color</b></code>:<br />
515
572
  property accepts any valid color format.
516
573
  If you provide it, the library will generate a gradient transitioning from the custom color to transparent.
517
574
  If you provide just <b>true</b>, the edge elements will have no color, allowing for custom styling via CSS class <code>.ms-edge</code>.<br />
518
575
  <br />
519
- <code>size</code>:<br />
520
- property changes the height of the edges for the horizontal and the width of the edges for the vertical.</em><br />
576
+ <code><b>size</b></code>:<br />
577
+ property changes the height of the edges for the horizontal and the width of the edges for the vertical.<br />
578
+ <br />
579
+ If the edge element is inactive, it gets the <code>"ms-disabled"</code> class.<br />
580
+ Also, each edge element gets the <code>--edge-visibility</code> variable in the styles with value 0 or 1.
581
+ </em><br />
521
582
  <br />
522
583
  <b>Example:</b>
523
584
 
@@ -537,24 +598,43 @@ property changes the height of the edges for the horizontal and the width of the
537
598
  <h2></h2>
538
599
 
539
600
  <details><summary><b><code>progressTrigger</code></b></summary><br /><ul><div>
540
- <b>Type:</b><br />
541
- {<br />
542
- <ul>
543
- wheel?: boolean | { changeDirection?: boolean; changeDirectionKey?: string };<br />
544
- content?: boolean;<br />
545
- progressElement?: boolean | React.ReactNode | React.ReactNode[];<br />
546
- arrows?: boolean | React.ReactNode<br />
547
- | {<br />
548
- <ul>
549
- element?: React.ReactNode;<br />
550
- size?: number;<br />
551
- contentReduce?: boolean;<br />
552
- loop?: boolean;<br />
553
- </ul>
554
- };<br />
555
- </ul>
556
- }<br />
557
- <br />
601
+ <b>Usage:</b><br />
602
+
603
+ <ul>
604
+ <li><b>Simple</b>:<br />
605
+
606
+ ```tsx
607
+ progressTrigger: {
608
+ wheel: true,
609
+ content: true,
610
+ progressElement: true, // or <ScrollThumbComponent />
611
+ arrows: true, // or <ArrowComponent />
612
+ }
613
+ ```
614
+
615
+ </li>
616
+ <li><b>Advanced</b>:<br />
617
+
618
+ ```tsx
619
+ progressTrigger: {
620
+ wheel: {
621
+ // if direction="hybrid"
622
+ changeDirection: true,
623
+ changeDirectionKey: "someKay" // default "KeyX"
624
+ },
625
+ progressElement: [<Elem1 />, <Elem2 />, <Elem3 />],
626
+ arrows: {
627
+ element: <ArrowComponent />,
628
+ size: 60, // default 40px
629
+ contentReduce: true;
630
+ loop: true,
631
+ }
632
+ }
633
+ ```
634
+
635
+ </li>
636
+ </ul>
637
+
558
638
  <b>Default:</b><br />
559
639
  { wheel: true }<br />
560
640
  <br />
@@ -563,17 +643,22 @@ this is one of the most important properties, allowing you to define how users i
563
643
  <br />
564
644
  <code><b>wheel</b></code>:<br />
565
645
  determines whether the progress bar responds to mouse wheel scrolling<br />
566
- <br />
567
646
  If you use <code>direction="hybrid"</code>, you can use:<br />
647
+
568
648
  <ul>
569
649
  <li><code>changeDirection</code>: allows switching the scroll direction with the mouse wheel.</li><br />
570
- <li><code>changeDirectionKey</code>: enables switching the scroll direction by pressing a specific key (default: <b>"KeyX"</b>).<br />
650
+ <li><code>changeDirectionKey</code>: enables switching the scroll direction by pressing a specific key.<br />
571
651
  To disable this behavior, pass an empty string.<br />
572
652
  <a href="https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values">more about keys</a></li>
573
653
  </ul>
574
654
  <br />
575
655
  <code><b>content</b></code>:<br />
576
656
  enables interaction by clicking and dragging anywhere within the scrollable content to move it.<br />
657
+ By using <code>content</code> drag scrolling will not work in these cases:<br />
658
+ interactive elements:<br />
659
+ <code>input</code>, <code>textarea</code>, <code>select</code>, <code>button</code>, <code>a</code><br />
660
+ elements with attribute:<br />
661
+ <code>[draggable="true"]</code>, <code>[contenteditable]</code> and custom attribute - <code>[data-ms-no-drag]</code><br />
577
662
  <br />
578
663
  <code><b>progressElement</b></code>:<br />
579
664
  determines how the scroll progress is managed<br />
@@ -589,17 +674,11 @@ allows you to add custom arrows to the progress bar<br />
589
674
  <br />
590
675
  <ul>
591
676
  <li><code>element</code>: the custom arrow element.</li><br />
592
- <li><code>size</code>: adds a custom size to the arrow.</li><br />
677
+ <li><code>size</code>: adds a custom size to the <b>.ms-arrow-box</b>.</li><br />
593
678
  <li><code>contentReduce</code>: this parameter reduces the size of the scroll content by the arrow size.</li><br />
594
679
  <li><code>loop</code>: enables infinite scrolling.</li>
595
- </ul>
596
- You can either specify a <code>size</code> for the arrows and provide a custom element.
597
- <br />
598
- ✦ Note:<br />
599
- <ul>
600
- <li><code>progressTrigger</code> can only create or provide elements, but you must make the design for them yourself.</li>
601
- <li>The Library scroll element in browser automatically receives <code>:focus</code> when you start scrolling with the mouse wheel.</li>
602
- </ul></em><br />
680
+ </ul><br />
681
+ </em><br />
603
682
  <b>Example:</b>
604
683
 
605
684
  ```tsx
@@ -619,18 +698,15 @@ You can either specify a <code>size</code> for the arrows and provide a custom e
619
698
  <h2></h2>
620
699
 
621
700
  <details><summary><b><code>progressReverse</code></b></summary><br /><ul><div>
622
- <b>Type:</b><br />
623
- boolean | boolean[]<br />
624
- <br />
625
- <b>Default:</b><br />
626
- false<br />
627
- <br />
701
+ <b>Usage:</b><br />
702
+
703
+ ```tsx
704
+ progressReverse: true; // or [true, false] if direction="hybrid"
705
+ ```
706
+
628
707
  <b>Description:</b><em><br />
629
708
  this parameter changes the position of the progress bar in the opposite direction and depends on the <code>direction</code> property.<br />
630
- <br />
631
- ✦ Note:<br />
632
- use it like an array to set different values for each direction when using <code>direction="hybrid"</code>.</em><br />
633
- <br />
709
+ </em><br />
634
710
  <b>Example:</b>
635
711
 
636
712
  ```tsx
@@ -646,16 +722,16 @@ use it like an array to set different values for each direction when using <code
646
722
  <h2></h2>
647
723
 
648
724
  <details><summary><b><code>scrollBarOnHover</code></b></summary><br /><ul><div>
649
- <b>Type:</b><br />
650
- boolean<br />
651
- <br />
652
- <b>Default:</b><br />
653
- false<br />
654
- <br />
725
+ <b>Usage:</b><br />
726
+
727
+ ```tsx
728
+ scrollBarOnHover: true;
729
+ ```
730
+
655
731
  <b>Description:</b><em><br />
656
732
  this parameter controls the visibility of the progress bar regardless of the <code>type</code> value.<br />
657
- When you use it, the <b>"hover"</b> class is applied to the <b>.ms-bar</b> when the cursor is over it (or the finger touches it on touchscreens), and <b>"leave"</b> is applied when it is no longer hovered. This allows you to easily customize its appearance on interaction.</em><br />
658
- <br />
733
+ When you use it, the <b>"hover"</b> class is applied to the <b>.ms-bar</b> when the cursor is over it (or the finger touches it on touchscreens), and <b>"leave"</b> is applied when it is no longer hovered. This allows you to easily customize its appearance on interaction.<br />
734
+ </em><br />
659
735
  <b>Example:</b>
660
736
 
661
737
  ```tsx
@@ -671,16 +747,18 @@ When you use it, the <b>"hover"</b> class is applied to the <b>.ms-bar</b> when
671
747
  <h2></h2>
672
748
 
673
749
  <details><summary><b><code>scrollBarEdge</code></b></summary><br /><ul><div>
674
- <b>Type:</b><br />
675
- number | number[]<br />
676
- <br />
750
+ <b>Usage:</b><br />
751
+
752
+ ```tsx
753
+ scrollBarEdge: 10; // or [10, 20] for control each bar if direction="hybrid"
754
+ ```
755
+
677
756
  <b>Description:</b><em><br />
678
- defines the margin (in pixels) applied to the edges of the scroll bar, effectively reducing its size.<br />
679
- If you use <code>direction="hybrid"</code>, you can also pass an array of numbers to control each bar individually.<br />
757
+ defines the margin (in <b>px</b>) applied to the edges of the scroll bar, effectively reducing its size.<br />
680
758
  <br />
681
759
  ✦ Note:<br />
682
- this parameter is only used when <code>type="scroll"</code> is set.</em><br />
683
- <br />
760
+ this parameter is only used when <code>type="scroll"</code> is set.<br />
761
+ </em><br />
684
762
  <b>Example:</b>
685
763
 
686
764
  ```tsx
@@ -696,18 +774,15 @@ this parameter is only used when <code>type="scroll"</code> is set.</em><br />
696
774
  <h2></h2>
697
775
 
698
776
  <details><summary><b><code>thumbMinSize</code></b></summary><br /><ul><div>
699
- <b>Type:</b><br />
700
- number<br />
701
- <br />
702
777
  <b>Default:</b><br />
703
- 30<br />
778
+ 30px<br />
704
779
  <br />
705
780
  <b>Description:</b><em><br />
706
- if the scrollable content is long, this option sets the minimum size (in pixels) of the scroll bar thumb automatically.<br />
781
+ if the scrollable content is long, this option sets the minimum size (in <b>px</b>) of the scroll bar thumb automatically.<br />
707
782
  <br />
708
783
  ✦ Note:<br />
709
- this parameter is only used when <code>type="scroll"</code> is set.</em><br />
710
- <br />
784
+ this parameter is only used when <code>type="scroll"</code> is set.<br />
785
+ </em><br />
711
786
  <b>Example:</b>
712
787
 
713
788
  ```tsx
@@ -725,35 +800,52 @@ this parameter is only used when <code>type="scroll"</code> is set.</em><br />
725
800
  ###### **— OPTIMIZATIONS —**
726
801
 
727
802
  <details><summary><b><code>render</code></b></summary><br /><ul><div>
728
- <b>Type:</b><br />
729
- "lazy" | "virtual"<br />
730
- | {<br />
803
+ <b>Usage:</b><br />
731
804
  <ul>
732
- type: "lazy" | "virtual";<br />
733
- rootMargin?: number | number[];<br />
734
- stopLoadOnScroll?: boolean;<br />
805
+ <li><b>Simple</b>:<br />
806
+
807
+ ```tsx
808
+ render: "lazy"; // or "virtual"
809
+ ```
810
+
811
+ </li>
812
+ <li><b>Advanced</b>:<br />
813
+
814
+ ```tsx
815
+ render: {
816
+ type: "lazy", // or "virtual" (required)
817
+ rootMargin: 100, // or [v, h] | [t, r, b, l]
818
+ stopLoadOnScroll: true,
819
+ trackVisibility: true
820
+ }
821
+ ```
822
+
823
+ </li>
735
824
  </ul>
736
- }<br />
737
- <br />
825
+
738
826
  <b>Description:</b><em><br />
739
827
  this parameter adds a gradual rendering of the content as it enters the viewport.<br />
740
828
  When used, a container is created for each scrollable object, and its absolute positioning is calculated based on scroll position and area dimensions.<br />
741
829
  <br />
742
- <code>type</code>:<br />
830
+ <code><b>type</b></code>:
831
+
743
832
  <ul>
744
- <li><b>"lazy"</b> - content is not deleted when it leaves the viewport.</li>
745
- <li><b>"virtual"</b> - content is deleted when it leaves the viewport.</li>
833
+ <li><b>"lazy"</b> - render once when visible.</li>
834
+ <li><b>"virtual"</b> - render only when visible.</li>
746
835
  </ul>
747
836
  <br />
748
- <code>rootMargin</code>:<br />
749
- controls the threshold for loading content. It can be a single number or an array of 2 or 4 numbers. It is the distance for loading from the root element ( <b>.ms-element</b> ) in pixels.<br />
837
+ <code><b>rootMargin</b></code>:<br />
838
+ controls the threshold for loading content. It is the distance for loading from the root element (<b>.ms-element</b>) in px.<br />
750
839
  <br />
751
- <code>stopLoadOnScroll</code>:<br />
840
+ <code><b>stopLoadOnScroll</b></code>:<br />
752
841
  controls whether to stop loading content when scrolling.<br />
753
842
  <br />
754
- ✦ Note:<br />
755
- <code>render</code> is not compatible with <code>objectsSize: "none"</code>.</em><br />
843
+ <code><b>trackVisibility</b></code>:<br />
844
+ sets the <code>--content-visibility</code> variable for list item wrapper styles, which is very useful for styling such as <code>opacity: var(--content-visibility);</code>.<br />
756
845
  <br />
846
+ ✦ Note:<br />
847
+ <code>render</code> is not compatible with <code>objectsSize: "none"</code>.<br />
848
+ </em><br />
757
849
  <b>Example:</b>
758
850
 
759
851
  ```tsx
@@ -769,26 +861,44 @@ controls whether to stop loading content when scrolling.<br />
769
861
  <h2></h2>
770
862
 
771
863
  <details><summary><b><code>emptyElements</code></b></summary><br /><ul><div>
772
- <b>Type:</b><br />
773
- {<br />
864
+ <b>Usage:</b><br />
774
865
  <ul>
775
- mode: "clear" | "fallback" | { fallback: React.ReactNode };<br />
776
- clickTrigger?: string | { selector: string; delay?: number };<br />
866
+ <li><b>Simple</b>:<br />
867
+
868
+ ```tsx
869
+ emptyElements: "clear"; // or "fallback" | <FallbackComponent />
870
+ ```
871
+
872
+ </li>
873
+ <li><b>Advanced</b>:<br />
874
+
875
+ ```tsx
876
+ emptyElements: {
877
+ mode: "clear", // or "fallback" | <FallbackComponent /> (required)
878
+ clickTrigger: ".btn-class", // or { selector: ".btn-class"; delay: 100 };
879
+ }
880
+ ```
881
+
882
+ </li>
777
883
  </ul>
778
- }<br />
779
- <br />
884
+
780
885
  <b>Description:</b><em><br />
781
- this option will allow you to delete or replace empty list items during the first rendering, or to start this process by clicking<br />
886
+ this option allows you to remove or replace empty list items during the initial render, or trigger this process via a click action<br />
782
887
  <br />
783
- <code>mode</code>:<br />
888
+ <code><b>mode</b></code>:<br />
889
+
784
890
  <ul>
785
891
  <li><b>"clear"</b> – automatically removes empty elements.</li>
786
892
  <li><b>"fallback"</b> – replaces empty elements with the value from the <code>fallback</code> props.</li>
787
- <li><b>{ fallback: React.ReactNode }</b> – if you need a different element than in <code>fallback</code> to replace empty elements, you can use this option.</li>
893
+ <li><b>{ fallback: React.ReactNode }</b> – allows you to override the default <code>fallback</code> content for this instance.</li>
788
894
  </ul>
789
895
  <br />
790
- <code>clickTrigger</code>:<br />
791
- in case if elements are removed via a click action, use this option. It accepts an object with a <code>selector</code> ( such as a delete button’s class ) and <code>delay</code> ( in <b>ms</b> ) to wait before removing the elements.<br />
896
+ <code><b>clickTrigger</b></code>:<br />
897
+ use this option if removal should be triggered by a click action.<br />
898
+ <ul>
899
+ <li><b>"selector"</b> – CSS selector that triggers the removal.</li>
900
+ <li><b>"delay"</b> – delay before removal ( in <b>ms</b> ).</li>
901
+ </ul>
792
902
  <br />
793
903
  ✦ Note:<br />
794
904
  <ul>
@@ -796,18 +906,12 @@ in case if elements are removed via a click action, use this option. It accepts
796
906
  <li>If you use <code>clickTrigger</code>:<br />
797
907
  - consider increasing <code>delay</code>, since the cleanup may run before removal.<br />
798
908
  - the wrapper <code>.ms-object-box</code> also gets the <code>remove</code> class, which you can use e.g. for fade-out animations.</li>
799
- </ul></em>
800
- <br />
909
+ </ul>
910
+ </em><br />
801
911
  <b>Example:</b>
802
912
 
803
913
  ```tsx
804
- <MorphScroll
805
- {...props}
806
- emptyElements={{
807
- mode: "clear",
808
- clickTrigger: ".close-button",
809
- }}
810
- >
914
+ <MorphScroll {...props} emptyElements="clear">
811
915
  {children}
812
916
  </MorphScroll>
813
917
  ```
@@ -819,9 +923,12 @@ in case if elements are removed via a click action, use this option. It accepts
819
923
  <h2></h2>
820
924
 
821
925
  <details><summary><b><code>suspending</code></b></summary><br /><ul><div>
822
- <b>Type:</b><br />
823
- boolean<br />
824
- <br />
926
+ <b>Usage:</b><br />
927
+
928
+ ```tsx
929
+ suspending: true;
930
+ ```
931
+
825
932
  <b>Default:</b><br />
826
933
  false<br />
827
934
  <br />
@@ -841,19 +948,17 @@ adds React Suspense to the MorphScroll component for async rendering.</em><br />
841
948
  <h2></h2>
842
949
 
843
950
  <details><summary><b><code>fallback</code></b></summary><br /><ul><div>
844
- <b>Type:</b><br />
845
- React.ReactNode<br />
846
- <br />
847
951
  <b>Description:</b><em><br />
848
952
  sets the fallback element to display during loading or placeholder.<br />
849
953
  <br />
850
954
  It will be used when:
955
+
851
956
  <ul>
852
957
  <li><code>suspending</code> is set to <b>true</b>.</li>
853
958
  <li><code>render.stopLoadOnScroll</code> is set to <b>true</b>.</li>
854
959
  <li><code>emptyElements.mode</code> is set to <b>"fallback"</b>.</li>
855
- </ul></em><br />
856
- <br />
960
+ </ul>
961
+ </em><br />
857
962
  <b>Example:</b>
858
963
 
859
964
  ```tsx
@@ -876,12 +981,9 @@ It will be used when:
876
981
  <ul><div>
877
982
 
878
983
  <details><summary><b><code>className</code></b></summary><br /><ul><div>
879
- <b>Type:</b><br />
880
- string<br />
881
- <br />
882
984
  <b>Description:</b><em><br />
883
- allows you to add additional classes to the component.</em><br />
884
- <br />
985
+ allows to add additional classes to the component.<br />
986
+ </em><br />
885
987
  <b>Example:</b>
886
988
 
887
989
  ```tsx
@@ -893,12 +995,9 @@ allows you to add additional classes to the component.</em><br />
893
995
  <h2></h2>
894
996
 
895
997
  <details><summary><b><code>children</code></b></summary><br /><ul><div>
896
- <b>Type:</b><br />
897
- React.ReactNode<br />
898
- <br />
899
998
  <b>Description:</b><em><br />
900
- allows you to add custom content to the component.</em><br />
901
- <br />
999
+ allows to add custom content to the component.<br />
1000
+ </em><br />
902
1001
  <b>Example:</b>
903
1002
 
904
1003
  ```tsx
@@ -910,9 +1009,9 @@ allows you to add custom content to the component.</em><br />
910
1009
  <h2></h2>
911
1010
 
912
1011
  <details><summary><b><code>style</code></b></summary><br /><ul><div>
913
- <b>Type:</b><br />
914
- React.CSSProperties<br />
915
- <br />
1012
+ <b>Description:</b><em><br />
1013
+ allows to add custom inline styles.<br />
1014
+ </em><br />
916
1015
  <b>Example:</b>
917
1016
 
918
1017
  ```tsx
@@ -924,20 +1023,26 @@ React.CSSProperties<br />
924
1023
  <h2></h2>
925
1024
 
926
1025
  <details><summary><b><code>measure</code></b></summary><br /><ul><div>
927
- <b>Type:</b><br />
928
- "inner" | "outer" | "all"<br />
929
- <br />
1026
+ <b>Usage:</b><br />
1027
+
1028
+ ```tsx
1029
+ measure: "outer"; // or "inner" | "all"
1030
+ ```
1031
+
930
1032
  <b>Default:</b><br />
931
1033
  "inner"<br />
932
1034
  <br />
933
1035
  <b>Description:</b><em><br />
934
1036
  determines what is being measured by automatically applying inline styles that affect width and height.<br />
935
1037
  <br />
936
- <ul>
937
- <li><b>"inner"</b> sets <code>width: "max-content"</code> and <code>height: "max-content"</code>, measuring the size of child elements.</li>
938
- <li><b>"outer"</b> measures the parent element by setting <code>minWidth: "100%"</code> and <code>minHeight: "100%"</code>.</li>
939
- <li><b>"all"</b> value combines the styles of both <code>"inner"</code> and <code>"outer"</code>, allowing measurement of both the parent and child elements.</li>
940
- </ul>
1038
+ <code><b>"inner"</b></code>:<br />
1039
+ sets <code>width: "max-content"</code> and <code>height: "max-content"</code>, measuring the size of child elements.<br />
1040
+ <br />
1041
+ <code><b>"outer"</b></code>:<br />
1042
+ measures the parent element by setting <code>minWidth: "100%"</code> and <code>minHeight: "100%"</code>.<br />
1043
+ <br />
1044
+ <code><b>"all"</b></code>:<br />
1045
+ value combines the styles of both <code>"inner"</code> and <code>"outer"</code>, allowing measurement of both the parent and child elements.<br />
941
1046
  <br />
942
1047
  ✦ Note: <br />
943
1048
  Be cautious when overriding styles via the <code>style</code> prop, as it may interfere with the styles applied by <code>measure</code>, leading to unexpected behavior.</em><br />
@@ -953,13 +1058,10 @@ Be cautious when overriding styles via the <code>style</code> prop, as it may in
953
1058
  <h2></h2>
954
1059
 
955
1060
  <details><summary><b><code>onResize</code></b></summary><br /><ul><div>
956
- <b>Type:</b><br />
957
- (rect: Partial<DOMRectReadOnly>) => void<br />
958
- <br />
959
1061
  <b>Description:</b><em><br />
960
1062
  callback function that is triggered whenever the observed element's dimensions change.<br />
961
- The function receives an object containing the updated size properties.</em><br />
962
- <br />
1063
+ The function receives an object of type <b>Partial<DOMRectReadOnly></b> that containing updated size properties.<br />
1064
+ </em><br />
963
1065
  <b>Example:</b>
964
1066
 
965
1067
  ```tsx
@@ -993,12 +1095,9 @@ The function receives an object containing the updated size properties.</em><br
993
1095
  <ul><div>
994
1096
 
995
1097
  <details><summary><b><code>className</code></b></summary><br /><ul><div>
996
- <b>Type:</b><br />
997
- string<br />
998
- <br />
999
1098
  <b>Description:</b><em><br />
1000
- allows you to add additional classes to the component.</em><br />
1001
- <br />
1099
+ allows to add additional classes to the component.<br />
1100
+ </em><br />
1002
1101
  <b>Example:</b>
1003
1102
 
1004
1103
  ```tsx
@@ -1010,9 +1109,9 @@ allows you to add additional classes to the component.</em><br />
1010
1109
  <h2></h2>
1011
1110
 
1012
1111
  <details><summary><b><code>children</code></b></summary><br /><ul><div>
1013
- <b>Type:</b><br />
1014
- React.ReactNode<br />
1015
- <br />
1112
+ <b>Description:</b><em><br />
1113
+ allows to add custom content to the component.<br />
1114
+ </em><br />
1016
1115
  <b>Example:</b>
1017
1116
 
1018
1117
  ```tsx
@@ -1024,9 +1123,9 @@ React.ReactNode<br />
1024
1123
  <h2></h2>
1025
1124
 
1026
1125
  <details><summary><b><code>style</code></b></summary><br /><ul><div>
1027
- <b>Type:</b><br />
1028
- React.CSSProperties<br />
1029
- <br />
1126
+ <b>Description:</b><em><br />
1127
+ allows to add custom inline styles.<br />
1128
+ </em><br />
1030
1129
  <b>Example:</b>
1031
1130
 
1032
1131
  ```tsx
@@ -1040,16 +1139,13 @@ React.CSSProperties<br />
1040
1139
  <h2></h2>
1041
1140
 
1042
1141
  <details><summary><b><code>root</code></b></summary><br /><ul><div>
1043
- <b>Type:</b><br />
1044
- Element | null<br />
1045
- <br />
1046
1142
  <b>Default:</b><br />
1047
- null (window)<br />
1143
+ null (browser window)<br />
1048
1144
  <br />
1049
1145
  <b>Description:</b><em><br />
1050
1146
  specifies the element that serves as the bounding box for the intersection observation.
1051
- If provided, it must be an ancestor of the observed element.</em><br />
1052
- <br />
1147
+ If provided, it must be an ancestor of the observed element.<br />
1148
+ </em><br />
1053
1149
  <b>Example:</b>
1054
1150
 
1055
1151
  ```tsx
@@ -1063,15 +1159,15 @@ If provided, it must be an ancestor of the observed element.</em><br />
1063
1159
  <h2></h2>
1064
1160
 
1065
1161
  <details><summary><b><code>rootMargin</code></b></summary><br /><ul><div>
1066
- <b>Type:</b><br />
1067
- number | number[]<br />
1068
- <br />
1162
+ <b>Usage:</b><br />
1163
+
1164
+ ```tsx
1165
+ rootMargin: 10; // or [v, h] | [t, r, b, l]
1166
+ ```
1167
+
1069
1168
  <b>Description:</b><em><br />
1070
1169
  defines an offset around the root element, expanding or shrinking the observed area.<br />
1071
- <br />
1072
- ✦ Note:<br />
1073
- it can be a single number or an array of 2 <b>[ top-bottom, left-right ]</b> or 4 <b>[ top, right, bottom, left ]</b> numbers.</em><br />
1074
- <br />
1170
+ </em><br />
1075
1171
  <b>Example:</b>
1076
1172
 
1077
1173
  ```tsx
@@ -1083,16 +1179,20 @@ it can be a single number or an array of 2 <b>[ top-bottom, left-right ]</b> or
1083
1179
  <h2></h2>
1084
1180
 
1085
1181
  <details><summary><b><code>threshold</code></b></summary><br /><ul><div>
1086
- <b>Type:</b><br />
1087
- number | number[]<br />
1088
- <br />
1182
+ <b>Usage:</b><br />
1183
+
1184
+ ```tsx
1185
+ threshold: 0.5; // or [0, 0.5, 1]
1186
+ ```
1187
+
1089
1188
  <b>Default:</b><br />
1090
1189
  0<br />
1091
1190
  <br />
1092
1191
  <b>Description:</b><em><br />
1093
- specifies at what percentage of the observed element’s visibility the callback should be executed.<br />
1192
+ specifies at what percentage of the observed element’s visibility the callback <code>onIntersection</code> should be executed.<br />
1094
1193
  <br />
1095
1194
  ✦ Note:<br />
1195
+
1096
1196
  <ul>
1097
1197
  <li>A value of <code>0</code> means the callback fires when any part of the element appears, while <code>1</code> means the element must be fully visible.</li>
1098
1198
  <li>An array (e.g., <code>[0, 0.5, 1]</code>) triggers the callback multiple times at different visibility levels.</li>
@@ -1109,9 +1209,12 @@ specifies at what percentage of the observed element’s visibility the callback
1109
1209
  <h2></h2>
1110
1210
 
1111
1211
  <details><summary><b><code>visibleContent</code></b></summary><br /><ul><div>
1112
- <b>Type:</b><br />
1113
- boolean<br />
1114
- <br />
1212
+ <b>Usage:</b><br />
1213
+
1214
+ ```tsx
1215
+ visibleContent: true;
1216
+ ```
1217
+
1115
1218
  <b>Default:</b><br />
1116
1219
  false<br />
1117
1220
  <br />
@@ -1130,21 +1233,18 @@ This is useful for testing purposes or when using the <code>onIntersection</code
1130
1233
  <h2></h2>
1131
1234
 
1132
1235
  <details><summary><b><code>onIntersection</code></b></summary><br /><ul><div>
1133
- <b>Type:</b><br />
1134
- (entry: IntersectionObserverEntry) => void<br />
1135
- <br />
1136
1236
  <b>Description:</b><em><br />
1137
1237
  callback function that is called when the observed element enters or leaves the viewport or the area defined by the <code>root</code> property. This can be used to load new list items for <code>MorphScroll</code>.<br />
1138
1238
  <br />
1139
1239
  ✦ Note:<br />
1140
- the <code>IntersectionObserverEntry</code> object provides details about the intersection state, including:<br />
1240
+ <code>entry</code> is an object of type <b>IntersectionObserverEntry</b> that provides details about the intersection state, including:<br />
1141
1241
  <ul>
1142
- <li><code>boundingClientRect</code>: The bounding rectangle of the element relative to the viewport.</li>
1143
- <li><code>intersectionRatio</code>: The percentage of the element that is visible in the viewport.</li>
1144
- <li><code>intersectionRect</code>: The intersection rectangle between the element and the viewport.</li>
1145
- <li><code>rootBounds</code>: The bounding rectangle of the root element relative to the viewport.</li>
1146
- <li><code>target</code>: The observed element.</li>
1147
- <li><code>time</code>: The timestamp when the intersection state changed.</li>
1242
+ <li><code>boundingClientRect</code>: bounding rectangle of the element relative to the viewport.</li>
1243
+ <li><code>intersectionRatio</code>: percentage of the element that is visible in the viewport.</li>
1244
+ <li><code>intersectionRect</code>: intersection rectangle between the element and the viewport.</li>
1245
+ <li><code>rootBounds</code>: bounding rectangle of the root element relative to the viewport.</li>
1246
+ <li><code>target</code>: observed element.</li>
1247
+ <li><code>time</code>: timestamp when the intersection state changed.</li>
1148
1248
  </ul></em>
1149
1249
  <br />
1150
1250
  <b>Example:</b>