vevet 3.3.2 → 3.5.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.
Files changed (167) hide show
  1. package/lib/cjs/base/Component/index.js.map +1 -1
  2. package/lib/cjs/components/AnimationFrame/index.js.map +1 -1
  3. package/lib/cjs/components/BaseTimeline/index.js.map +1 -1
  4. package/lib/cjs/components/Ctx2D/index.js.map +1 -1
  5. package/lib/cjs/components/Ctx2DPrerender/index.js.map +1 -1
  6. package/lib/cjs/components/CustomCursor/index.js.map +1 -1
  7. package/lib/cjs/components/DraggerBase/index.js.map +1 -1
  8. package/lib/cjs/components/DraggerDirection/index.js.map +1 -1
  9. package/lib/cjs/components/DraggerMove/index.js.map +1 -1
  10. package/lib/cjs/components/Preloader/index.js.map +1 -1
  11. package/lib/cjs/components/ProgressPreloader/index.js +4 -1
  12. package/lib/cjs/components/ProgressPreloader/index.js.map +1 -1
  13. package/lib/cjs/components/ScrollBar/index.js.map +1 -1
  14. package/lib/cjs/components/ScrollView/index.js.map +1 -1
  15. package/lib/cjs/components/SectionScrollProgress/index.js.map +1 -1
  16. package/lib/cjs/components/SlideProgress/index.js +185 -0
  17. package/lib/cjs/components/SlideProgress/index.js.map +1 -0
  18. package/lib/cjs/components/SlideProgress/types.js +3 -0
  19. package/lib/cjs/components/SlideProgress/types.js.map +1 -0
  20. package/lib/cjs/components/SmoothScroll/index.js.map +1 -1
  21. package/lib/cjs/components/SmoothScrollDragPlugin/index.js.map +1 -1
  22. package/lib/cjs/components/SmoothScrollKeyboardPlugin/index.js.map +1 -1
  23. package/lib/cjs/components/SplitText/index.js.map +1 -1
  24. package/lib/cjs/components/Timeline/index.js.map +1 -1
  25. package/lib/cjs/components/index.js +1 -0
  26. package/lib/cjs/components/index.js.map +1 -1
  27. package/lib/cjs/version.js +1 -1
  28. package/lib/esm/base/Component/index.js.map +1 -1
  29. package/lib/esm/components/AnimationFrame/index.js.map +1 -1
  30. package/lib/esm/components/BaseTimeline/index.js.map +1 -1
  31. package/lib/esm/components/Ctx2D/index.js.map +1 -1
  32. package/lib/esm/components/Ctx2DPrerender/index.js.map +1 -1
  33. package/lib/esm/components/CustomCursor/index.js.map +1 -1
  34. package/lib/esm/components/DraggerBase/index.js.map +1 -1
  35. package/lib/esm/components/DraggerDirection/index.js.map +1 -1
  36. package/lib/esm/components/DraggerMove/index.js.map +1 -1
  37. package/lib/esm/components/Preloader/index.js.map +1 -1
  38. package/lib/esm/components/ProgressPreloader/index.js +4 -1
  39. package/lib/esm/components/ProgressPreloader/index.js.map +1 -1
  40. package/lib/esm/components/ScrollBar/index.js.map +1 -1
  41. package/lib/esm/components/ScrollView/index.js.map +1 -1
  42. package/lib/esm/components/SectionScrollProgress/index.js.map +1 -1
  43. package/lib/esm/components/SlideProgress/index.js +134 -0
  44. package/lib/esm/components/SlideProgress/index.js.map +1 -0
  45. package/lib/esm/components/SlideProgress/types.js +2 -0
  46. package/lib/esm/components/SlideProgress/types.js.map +1 -0
  47. package/lib/esm/components/SmoothScroll/index.js.map +1 -1
  48. package/lib/esm/components/SmoothScrollDragPlugin/index.js.map +1 -1
  49. package/lib/esm/components/SmoothScrollKeyboardPlugin/index.js.map +1 -1
  50. package/lib/esm/components/SplitText/index.js.map +1 -1
  51. package/lib/esm/components/Timeline/index.js.map +1 -1
  52. package/lib/esm/components/index.js +1 -0
  53. package/lib/esm/components/index.js.map +1 -1
  54. package/lib/esm/version.js +1 -1
  55. package/lib/types/base/Component/index.d.ts.map +1 -1
  56. package/lib/types/components/AnimationFrame/index.d.ts +11 -11
  57. package/lib/types/components/AnimationFrame/index.d.ts.map +1 -1
  58. package/lib/types/components/BaseTimeline/index.d.ts +7 -4
  59. package/lib/types/components/BaseTimeline/index.d.ts.map +1 -1
  60. package/lib/types/components/Ctx2D/index.d.ts +6 -6
  61. package/lib/types/components/Ctx2D/index.d.ts.map +1 -1
  62. package/lib/types/components/Ctx2DPrerender/index.d.ts +1 -1
  63. package/lib/types/components/Ctx2DPrerender/index.d.ts.map +1 -1
  64. package/lib/types/components/CustomCursor/index.d.ts +20 -19
  65. package/lib/types/components/CustomCursor/index.d.ts.map +1 -1
  66. package/lib/types/components/DraggerBase/index.d.ts +11 -10
  67. package/lib/types/components/DraggerBase/index.d.ts.map +1 -1
  68. package/lib/types/components/DraggerDirection/index.d.ts.map +1 -1
  69. package/lib/types/components/DraggerMove/index.d.ts +1 -1
  70. package/lib/types/components/DraggerMove/index.d.ts.map +1 -1
  71. package/lib/types/components/Marquee/index.d.ts +2 -1
  72. package/lib/types/components/Marquee/index.d.ts.map +1 -1
  73. package/lib/types/components/Preloader/index.d.ts +7 -7
  74. package/lib/types/components/Preloader/index.d.ts.map +1 -1
  75. package/lib/types/components/ProgressPreloader/index.d.ts +11 -9
  76. package/lib/types/components/ProgressPreloader/index.d.ts.map +1 -1
  77. package/lib/types/components/ScrollBar/index.d.ts +5 -4
  78. package/lib/types/components/ScrollBar/index.d.ts.map +1 -1
  79. package/lib/types/components/ScrollView/index.d.ts +1 -1
  80. package/lib/types/components/ScrollView/index.d.ts.map +1 -1
  81. package/lib/types/components/SectionScrollProgress/index.d.ts.map +1 -1
  82. package/lib/types/components/SlideProgress/index.d.ts +54 -0
  83. package/lib/types/components/SlideProgress/index.d.ts.map +1 -0
  84. package/lib/types/components/SlideProgress/types.d.ts +67 -0
  85. package/lib/types/components/SlideProgress/types.d.ts.map +1 -0
  86. package/lib/types/components/SmoothScroll/index.d.ts +6 -4
  87. package/lib/types/components/SmoothScroll/index.d.ts.map +1 -1
  88. package/lib/types/components/SmoothScrollDragPlugin/index.d.ts +12 -10
  89. package/lib/types/components/SmoothScrollDragPlugin/index.d.ts.map +1 -1
  90. package/lib/types/components/SmoothScrollKeyboardPlugin/index.d.ts +5 -4
  91. package/lib/types/components/SmoothScrollKeyboardPlugin/index.d.ts.map +1 -1
  92. package/lib/types/components/SplitText/index.d.ts +13 -13
  93. package/lib/types/components/SplitText/index.d.ts.map +1 -1
  94. package/lib/types/components/Timeline/index.d.ts +5 -5
  95. package/lib/types/components/Timeline/index.d.ts.map +1 -1
  96. package/lib/types/components/index.d.ts +1 -0
  97. package/lib/types/components/index.d.ts.map +1 -1
  98. package/lib/types/version.d.ts +1 -1
  99. package/package.json +4 -4
  100. package/src/Application/events/PageLoad/index.ts +1 -1
  101. package/src/Application/events/Viewport/index.ts +3 -3
  102. package/src/Application/index.ts +1 -1
  103. package/src/base/Callbacks/index.ts +2 -2
  104. package/src/base/Component/index.ts +4 -2
  105. package/src/base/Module/index.ts +13 -13
  106. package/src/base/Module/stories/index.tsx +1 -1
  107. package/src/base/MutableProps/index.ts +3 -3
  108. package/src/base/MutableProps/stories/index.tsx +1 -1
  109. package/src/base/Plugin/index.ts +2 -2
  110. package/src/components/AnimationFrame/index.ts +19 -16
  111. package/src/components/BaseTimeline/index.ts +10 -8
  112. package/src/components/BaseTimeline/stories/Nested.tsx +1 -1
  113. package/src/components/Ctx2D/index.ts +7 -7
  114. package/src/components/Ctx2DPrerender/index.ts +6 -3
  115. package/src/components/CustomCursor/index.ts +30 -28
  116. package/src/components/DraggerBase/index.ts +20 -18
  117. package/src/components/DraggerDirection/index.ts +6 -3
  118. package/src/components/DraggerMove/index.ts +9 -7
  119. package/src/components/Marquee/index.ts +3 -3
  120. package/src/components/Preloader/index.ts +12 -10
  121. package/src/components/ProgressPreloader/index.ts +25 -19
  122. package/src/components/ProgressPreloader/utils/preloadCustomElement.ts +1 -1
  123. package/src/components/ProgressPreloader/utils/preloadImage.ts +1 -1
  124. package/src/components/ProgressPreloader/utils/preloadVideo.ts +1 -1
  125. package/src/components/ScrollBar/Bar/index.ts +5 -5
  126. package/src/components/ScrollBar/index.ts +10 -8
  127. package/src/components/ScrollBar/stories/Default.tsx +1 -1
  128. package/src/components/ScrollBar/stories/WithInnerScroll.tsx +1 -1
  129. package/src/components/ScrollBar/stories/WithSmoothScrollComponent.tsx +1 -1
  130. package/src/components/ScrollBar/stories/index.stories.tsx +2 -2
  131. package/src/components/ScrollView/index.ts +13 -11
  132. package/src/components/ScrollView/stories/index.tsx +1 -1
  133. package/src/components/SectionScrollProgress/index.ts +6 -3
  134. package/src/components/SectionScrollProgress/stories/index.stories.tsx +1 -1
  135. package/src/components/SlideProgress/index.ts +226 -0
  136. package/src/components/SlideProgress/stories/index.stories.tsx +13 -0
  137. package/src/components/SlideProgress/stories/index.tsx +66 -0
  138. package/src/components/SlideProgress/types.ts +71 -0
  139. package/src/components/SmoothScroll/AnimatonFrame.ts +2 -2
  140. package/src/components/SmoothScroll/Elements.ts +3 -3
  141. package/src/components/SmoothScroll/index.ts +13 -11
  142. package/src/components/SmoothScroll/stories/Default.tsx +1 -1
  143. package/src/components/SmoothScroll/stories/WithHorizontal.tsx +1 -1
  144. package/src/components/SmoothScroll/stories/WithInnerLerp.tsx +1 -1
  145. package/src/components/SmoothScroll/stories/index.stories.tsx +2 -2
  146. package/src/components/SmoothScrollDragPlugin/index.ts +17 -14
  147. package/src/components/SmoothScrollDragPlugin/stories/index.tsx +1 -1
  148. package/src/components/SmoothScrollKeyboardPlugin/index.ts +11 -8
  149. package/src/components/SmoothScrollKeyboardPlugin/stories/index.tsx +1 -1
  150. package/src/components/SplitText/index.ts +18 -16
  151. package/src/components/Timeline/index.ts +9 -8
  152. package/src/components/Timeline/stories/Nested.tsx +1 -1
  153. package/src/components/index.ts +1 -0
  154. package/src/utils/common/mergeWithoutArrays.ts +1 -1
  155. package/src/utils/common/pickObjectProps.ts +1 -1
  156. package/src/utils/common/times.ts +1 -1
  157. package/src/utils/image/load.ts +2 -2
  158. package/src/utils/image/pathsToProps.ts +1 -1
  159. package/src/utils/listeners/onResize.ts +3 -3
  160. package/src/utils/math/clampScope.ts +1 -1
  161. package/src/utils/math/easing.ts +1 -1
  162. package/src/utils/math/lerp.ts +1 -1
  163. package/src/utils/math/normalizeNestedScope.ts +1 -1
  164. package/src/utils/math/wrap.ts +1 -1
  165. package/src/utils/scroll/getScrollValues.ts +1 -1
  166. package/src/utils/scroll/onScroll.ts +7 -7
  167. package/src/version.ts +1 -1
@@ -0,0 +1,66 @@
1
+ /* eslint-disable no-param-reassign */
2
+ import React, { FC, useEffect, useRef } from 'react';
3
+ import { SlideProgress } from '..';
4
+
5
+ export const Component: FC = () => {
6
+ const containerRef = useRef<HTMLDivElement>(null);
7
+
8
+ const colors = ['#A8E6CF', '#DCEDC1', '#FFD3B6', '#FFAAA5', '#FF8B94'];
9
+ const { length } = colors;
10
+
11
+ useEffect(() => {
12
+ if (!containerRef.current) {
13
+ return undefined;
14
+ }
15
+
16
+ const instance = new SlideProgress({
17
+ container: containerRef.current,
18
+ min: 0,
19
+ max: length - 1,
20
+ step: 0.5,
21
+ });
22
+
23
+ const elements = Array.from(containerRef.current.children) as HTMLElement[];
24
+
25
+ instance.addCallback('render', () => {
26
+ elements.forEach((element, index) => {
27
+ const y = instance.progress * -100 + index * 100;
28
+ element.style.transform = `translate(0, ${y}%)`;
29
+ });
30
+ });
31
+
32
+ instance.render();
33
+
34
+ return () => instance.destroy();
35
+ }, [length]);
36
+
37
+ return (
38
+ <>
39
+ <p>Scroll the block below</p>
40
+
41
+ <div
42
+ ref={containerRef}
43
+ style={{
44
+ position: 'relative',
45
+ width: 300,
46
+ height: 300,
47
+ overflow: 'hidden',
48
+ }}
49
+ >
50
+ {colors.map((color) => (
51
+ <div
52
+ key={color}
53
+ style={{
54
+ position: 'absolute',
55
+ top: '0',
56
+ left: '0',
57
+ width: '100%',
58
+ height: '100%',
59
+ backgroundColor: color,
60
+ }}
61
+ />
62
+ ))}
63
+ </div>
64
+ </>
65
+ );
66
+ };
@@ -0,0 +1,71 @@
1
+ import { NComponent } from '@/base/Component/types';
2
+ import { NTimeline } from '../Timeline';
3
+
4
+ export namespace NSlideProgress {
5
+ export interface IStaticProps extends NComponent.IStaticProps {
6
+ /** HTML Container */
7
+ container: HTMLElement;
8
+ }
9
+
10
+ export interface IChangeableProps extends NComponent.IChangeableProps {
11
+ /** Minimum progress value */
12
+ min: number;
13
+ /** Maximum progress value */
14
+ max: number;
15
+ /** Progress step */
16
+ step: number;
17
+ /**
18
+ * Linear interpolation ease
19
+ * @default 0.1
20
+ */
21
+ ease?: number;
22
+ /**
23
+ * Linear interpolation friction
24
+ * @default 0.5
25
+ */
26
+ friction?: number;
27
+ /**
28
+ * Use drag events
29
+ * @default true
30
+ */
31
+ hasDrag?: boolean;
32
+ /**
33
+ * Dragger speed
34
+ * @default 1
35
+ */
36
+ dragSpeed?: number;
37
+ /**
38
+ * Dragger direction
39
+ * @default 'y'
40
+ */
41
+ dragDirection?: 'x' | 'y';
42
+ /**
43
+ * Use wheel events
44
+ * @default true
45
+ */
46
+ hasWheel?: boolean;
47
+ /**
48
+ * Wheel speed
49
+ * @default 1
50
+ */
51
+ wheelSpeed?: number;
52
+ }
53
+
54
+ export interface ICallbacksTypes extends NComponent.ICallbacksTypes {
55
+ render: undefined;
56
+ step: undefined;
57
+ }
58
+
59
+ export interface IWithLerp {
60
+ current: number;
61
+ target: number;
62
+ }
63
+
64
+ export interface IToProps {
65
+ value: number;
66
+ /** @default 500 */
67
+ duration?: number;
68
+ onProgress?: (props: NTimeline.ICallbacksTypes['progress']) => void;
69
+ onEnd?: () => void;
70
+ }
71
+ }
@@ -32,7 +32,7 @@ export class AnimationFrame {
32
32
  this._animationFrameEvent = this.props.outerAnimationFrame.addCallback(
33
33
  'frame',
34
34
  () => this.props.callback(),
35
- { name: 'SmoothScroll' }
35
+ { name: 'SmoothScroll' },
36
36
  );
37
37
  }
38
38
 
@@ -43,7 +43,7 @@ export class AnimationFrame {
43
43
  if (!this._innerAnimationFrame) {
44
44
  this._innerAnimationFrame = new AnimationFrameClass({ fps: 'auto' });
45
45
  this._innerAnimationFrame.addCallback('frame', () =>
46
- this.props.callback()
46
+ this.props.callback(),
47
47
  );
48
48
  }
49
49
 
@@ -61,8 +61,8 @@ export class Elements {
61
61
  this._elements = Array.from(
62
62
  selectAll(
63
63
  this.props.elements,
64
- this.props.container
65
- ) as NodeListOf<NSmoothScroll.IElement>
64
+ this.props.container,
65
+ ) as NodeListOf<NSmoothScroll.IElement>,
66
66
  );
67
67
  } else {
68
68
  this._elements = [this._wrapper as NSmoothScroll.IElement];
@@ -123,7 +123,7 @@ export class Elements {
123
123
  return array.every(
124
124
  ({ smoothScrollLeft, smoothScrollTop }) =>
125
125
  smoothScrollLeft === array[0].smoothScrollLeft &&
126
- smoothScrollTop === array[0].smoothScrollTop
126
+ smoothScrollTop === array[0].smoothScrollTop,
127
127
  );
128
128
  }
129
129
 
@@ -15,8 +15,10 @@ export type { NSmoothScroll };
15
15
  */
16
16
  export class SmoothScroll<
17
17
  StaticProps extends NSmoothScroll.IStaticProps = NSmoothScroll.IStaticProps,
18
- ChangeableProps extends NSmoothScroll.IChangeableProps = NSmoothScroll.IChangeableProps,
19
- CallbacksTypes extends NSmoothScroll.ICallbacksTypes = NSmoothScroll.ICallbacksTypes
18
+ ChangeableProps extends
19
+ NSmoothScroll.IChangeableProps = NSmoothScroll.IChangeableProps,
20
+ CallbacksTypes extends
21
+ NSmoothScroll.ICallbacksTypes = NSmoothScroll.ICallbacksTypes,
20
22
  >
21
23
  extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes>
22
24
  implements IScrollLike
@@ -48,14 +50,14 @@ export class SmoothScroll<
48
50
  }
49
51
 
50
52
  /** Scroll container */
51
- private _container: HTMLElement;
53
+ protected _container: HTMLElement;
52
54
 
53
55
  /** Scroll container */
54
56
  get container() {
55
57
  return this._container;
56
58
  }
57
59
 
58
- private _elements: Elements;
60
+ protected _elements: Elements;
59
61
 
60
62
  /**
61
63
  * Scroll wrapper. If the element does not exist indide the `container`,
@@ -194,7 +196,7 @@ export class SmoothScroll<
194
196
  protected _isInstant?: boolean;
195
197
 
196
198
  /** Animation frame */
197
- private _animationFrame: AnimationFrame;
199
+ protected _animationFrame: AnimationFrame;
198
200
 
199
201
  /** Frame index */
200
202
  protected _frameIndex: number;
@@ -288,7 +290,7 @@ export class SmoothScroll<
288
290
 
289
291
  // wheel
290
292
  this.addEventListener(this.container, 'wheel', (event) =>
291
- this.handleWheel(event)
293
+ this.handleWheel(event),
292
294
  );
293
295
 
294
296
  // prevent native scroll
@@ -299,7 +301,7 @@ export class SmoothScroll<
299
301
  }
300
302
 
301
303
  /** Set resize events */
302
- private _setResize() {
304
+ protected _setResize() {
303
305
  const { viewportTarget, resizeDebounce } = this.props;
304
306
 
305
307
  // resize handler
@@ -324,7 +326,7 @@ export class SmoothScroll<
324
326
  this._recalculateScrollSizes();
325
327
  }
326
328
  }) as any,
327
- { isProtected: true, name: this.name }
329
+ { isProtected: true, name: this.name },
328
330
  );
329
331
  }
330
332
  }
@@ -365,7 +367,7 @@ export class SmoothScroll<
365
367
  /** Resize the scene */
366
368
  protected _resize(
367
369
  /** If the method was called natively on window resize */
368
- isNative = false
370
+ isNative = false,
369
371
  ) {
370
372
  const { container, wrapper } = this;
371
373
 
@@ -507,13 +509,13 @@ export class SmoothScroll<
507
509
  element.smoothScrollLeft = this._lerp(
508
510
  element.smoothScrollLeft,
509
511
  this._targetLeft,
510
- elementLerp
512
+ elementLerp,
511
513
  );
512
514
 
513
515
  element.smoothScrollTop = this._lerp(
514
516
  element.smoothScrollTop,
515
517
  this._targetTop,
516
- elementLerp
518
+ elementLerp,
517
519
  );
518
520
  }
519
521
  }
@@ -55,7 +55,7 @@ export const DefaultComponent: FC = () => {
55
55
  dolores placeat mollitia illum?
56
56
  </div>
57
57
  ),
58
- 40
58
+ 40,
59
59
  )}
60
60
  </div>
61
61
  </div>
@@ -80,7 +80,7 @@ export const WithHorizontalComponent: FC = () => {
80
80
  Lorem ipsum
81
81
  </div>
82
82
  ),
83
- 20
83
+ 20,
84
84
  )}
85
85
  </div>
86
86
  </div>
@@ -60,7 +60,7 @@ export const WithInnerLerpComponent: FC = () => {
60
60
  dolores placeat mollitia illum?
61
61
  </div>
62
62
  ),
63
- 40
63
+ 40,
64
64
  )}
65
65
  </div>
66
66
  </div>
@@ -15,9 +15,9 @@ export const Default: StoryFn<typeof DefaultComponent> = (props) => (
15
15
  );
16
16
 
17
17
  export const WithInnerLerp: StoryFn<typeof WithInnerLerpComponent> = (
18
- props
18
+ props,
19
19
  ) => <WithInnerLerpComponent {...props} />;
20
20
 
21
21
  export const WithHorizontal: StoryFn<typeof WithHorizontalComponent> = (
22
- props
22
+ props,
23
23
  ) => <WithHorizontalComponent {...props} />;
@@ -10,9 +10,12 @@ export type { NSmoothScrollDragPlugin };
10
10
  * Add dragger to `SmoothScroll`
11
11
  */
12
12
  export class SmoothScrollDragPlugin<
13
- StaticProp extends NSmoothScrollDragPlugin.IStaticProps = NSmoothScrollDragPlugin.IStaticProps,
14
- ChangeableProp extends NSmoothScrollDragPlugin.IChangeableProps = NSmoothScrollDragPlugin.IChangeableProps,
15
- CallbacksTypes extends NSmoothScrollDragPlugin.ICallbacksTypes = NSmoothScrollDragPlugin.ICallbacksTypes
13
+ StaticProp extends
14
+ NSmoothScrollDragPlugin.IStaticProps = NSmoothScrollDragPlugin.IStaticProps,
15
+ ChangeableProp extends
16
+ NSmoothScrollDragPlugin.IChangeableProps = NSmoothScrollDragPlugin.IChangeableProps,
17
+ CallbacksTypes extends
18
+ NSmoothScrollDragPlugin.ICallbacksTypes = NSmoothScrollDragPlugin.ICallbacksTypes,
16
19
  > extends Plugin<
17
20
  StaticProp,
18
21
  ChangeableProp,
@@ -31,10 +34,10 @@ export class SmoothScrollDragPlugin<
31
34
  }
32
35
 
33
36
  /** Dragger component */
34
- private _dragger?: DraggerMove;
37
+ protected _dragger?: DraggerMove;
35
38
 
36
39
  /** Component callbacks */
37
- private _componentCallbacks?: NCallbacks.IAddedCallback[];
40
+ protected _componentCallbacks?: NCallbacks.IAddedCallback[];
38
41
 
39
42
  /** If is dragging at the moment */
40
43
  get isDragging() {
@@ -44,7 +47,7 @@ export class SmoothScrollDragPlugin<
44
47
  /**
45
48
  * Current lerp of SmoothScroll
46
49
  */
47
- private _prevComponentLerp?: number;
50
+ protected _prevComponentLerp?: number;
48
51
 
49
52
  /** Initialize the class */
50
53
  protected _init() {
@@ -60,7 +63,7 @@ export class SmoothScrollDragPlugin<
60
63
  }
61
64
 
62
65
  /** Add or remove dragger */
63
- private _toggleDragger() {
66
+ protected _toggleDragger() {
64
67
  if (this.props.isEnabled) {
65
68
  this._addDragger();
66
69
  } else {
@@ -69,7 +72,7 @@ export class SmoothScrollDragPlugin<
69
72
  }
70
73
 
71
74
  /** Add dragger */
72
- private _addDragger() {
75
+ protected _addDragger() {
73
76
  if (this._dragger) {
74
77
  return;
75
78
  }
@@ -93,12 +96,12 @@ export class SmoothScrollDragPlugin<
93
96
  this._componentCallbacks.push(
94
97
  component.addCallback('wheel', () => this._dragger?.cancel(), {
95
98
  name: this.name,
96
- })
99
+ }),
97
100
  );
98
101
  }
99
102
 
100
103
  /** Remove dragger */
101
- private _removeDragger() {
104
+ protected _removeDragger() {
102
105
  if (!this._dragger) {
103
106
  return;
104
107
  }
@@ -111,7 +114,7 @@ export class SmoothScrollDragPlugin<
111
114
  }
112
115
 
113
116
  /** Check if dragging is available */
114
- private _getIsDragAvailable() {
117
+ protected _getIsDragAvailable() {
115
118
  const { component } = this;
116
119
 
117
120
  if (!component.props.isEnabled) {
@@ -130,7 +133,7 @@ export class SmoothScrollDragPlugin<
130
133
  }
131
134
 
132
135
  /** Callback on dragging start */
133
- private _handleDragStart() {
136
+ protected _handleDragStart() {
134
137
  if (!this._getIsDragAvailable()) {
135
138
  return;
136
139
  }
@@ -148,7 +151,7 @@ export class SmoothScrollDragPlugin<
148
151
  }
149
152
 
150
153
  /** Callback on drag move */
151
- private _handleDragMove({
154
+ protected _handleDragMove({
152
155
  event,
153
156
  coords,
154
157
  start,
@@ -199,7 +202,7 @@ export class SmoothScrollDragPlugin<
199
202
  /**
200
203
  * Callback on dragging end
201
204
  */
202
- private _handleDragEnd() {
205
+ protected _handleDragEnd() {
203
206
  const { component } = this;
204
207
 
205
208
  // update styles
@@ -65,7 +65,7 @@ export const Component: FC = () => {
65
65
  <button type="button">Test button</button>
66
66
  </div>
67
67
  ),
68
- 40
68
+ 40,
69
69
  )}
70
70
 
71
71
  <button type="button">Test button</button>
@@ -9,9 +9,12 @@ export type { NSmoothScrollKeyboardPlugin };
9
9
  * Add keyboard navigation
10
10
  */
11
11
  export class SmoothScrollKeyboardPlugin<
12
- StaticProps extends NSmoothScrollKeyboardPlugin.IStaticProps = NSmoothScrollKeyboardPlugin.IStaticProps,
13
- ChangeableProps extends NSmoothScrollKeyboardPlugin.IChangeableProps = NSmoothScrollKeyboardPlugin.IChangeableProps,
14
- CallbacksTypes extends NSmoothScrollKeyboardPlugin.ICallbacksTypes = NSmoothScrollKeyboardPlugin.ICallbacksTypes
12
+ StaticProps extends
13
+ NSmoothScrollKeyboardPlugin.IStaticProps = NSmoothScrollKeyboardPlugin.IStaticProps,
14
+ ChangeableProps extends
15
+ NSmoothScrollKeyboardPlugin.IChangeableProps = NSmoothScrollKeyboardPlugin.IChangeableProps,
16
+ CallbacksTypes extends
17
+ NSmoothScrollKeyboardPlugin.ICallbacksTypes = NSmoothScrollKeyboardPlugin.ICallbacksTypes,
15
18
  > extends Plugin<
16
19
  StaticProps,
17
20
  ChangeableProps,
@@ -25,19 +28,19 @@ export class SmoothScrollKeyboardPlugin<
25
28
  };
26
29
  }
27
30
 
28
- private _tabDebounceTimeout?: NodeJS.Timeout;
31
+ protected _tabDebounceTimeout?: NodeJS.Timeout;
29
32
 
30
33
  /** Initialize the class */
31
34
  protected _init() {
32
35
  super._init();
33
36
 
34
37
  this.addEventListener(window, 'keydown', (event) =>
35
- this._handleKeydown(event)
38
+ this._handleKeydown(event),
36
39
  );
37
40
  }
38
41
 
39
42
  /** Check if keyboard events may be ignored */
40
- private _canIgnoreKeyboardEvents() {
43
+ protected _canIgnoreKeyboardEvents() {
41
44
  const { activeElement } = document;
42
45
 
43
46
  return (
@@ -48,7 +51,7 @@ export class SmoothScrollKeyboardPlugin<
48
51
  }
49
52
 
50
53
  /** Check if scroll container is in viewport */
51
- private _checkScrollContainerInViewport() {
54
+ protected _checkScrollContainerInViewport() {
52
55
  const { viewport } = this.app;
53
56
 
54
57
  const bounding = this.component.container.getBoundingClientRect();
@@ -62,7 +65,7 @@ export class SmoothScrollKeyboardPlugin<
62
65
  }
63
66
 
64
67
  /** Check if scroll ended */
65
- private _checkIsEndOfScroll() {
68
+ protected _checkIsEndOfScroll() {
66
69
  const { component } = this;
67
70
 
68
71
  return (
@@ -65,7 +65,7 @@ export const Component: FC = () => {
65
65
  <button type="button">Test button</button>
66
66
  </div>
67
67
  ),
68
- 40
68
+ 40,
69
69
  )}
70
70
 
71
71
  <button type="button">Test button</button>
@@ -11,8 +11,10 @@ export type { NSplitText };
11
11
  */
12
12
  export class SplitText<
13
13
  StaticProps extends NSplitText.IStaticProps = NSplitText.IStaticProps,
14
- ChangeableProps extends NSplitText.IChangeableProps = NSplitText.IChangeableProps,
15
- CallbacksTypes extends NSplitText.ICallbacksTypes = NSplitText.ICallbacksTypes
14
+ ChangeableProps extends
15
+ NSplitText.IChangeableProps = NSplitText.IChangeableProps,
16
+ CallbacksTypes extends
17
+ NSplitText.ICallbacksTypes = NSplitText.ICallbacksTypes,
16
18
  > extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
17
19
  protected _getDefaultProps() {
18
20
  return {
@@ -31,16 +33,16 @@ export class SplitText<
31
33
  }
32
34
 
33
35
  /** Initial text */
34
- private _initialText: string;
36
+ protected _initialText: string;
35
37
 
36
38
  /** Initial HTML content */
37
- private _initialHTML: string;
39
+ protected _initialHTML: string;
38
40
 
39
41
  /** If the text is already split into letters and words */
40
- private _isBaseSplit: boolean;
42
+ protected _isBaseSplit: boolean;
41
43
 
42
44
  /** Text container */
43
- private _container: HTMLElement;
45
+ protected _container: HTMLElement;
44
46
 
45
47
  /** Text container */
46
48
  get container() {
@@ -48,7 +50,7 @@ export class SplitText<
48
50
  }
49
51
 
50
52
  /** Letters */
51
- private _letters: NSplitText.ILetter[];
53
+ protected _letters: NSplitText.ILetter[];
52
54
 
53
55
  /** Letters */
54
56
  get letters() {
@@ -56,7 +58,7 @@ export class SplitText<
56
58
  }
57
59
 
58
60
  /** Words */
59
- private _words: NSplitText.IWord[];
61
+ protected _words: NSplitText.IWord[];
60
62
 
61
63
  /** Words */
62
64
  get words() {
@@ -64,7 +66,7 @@ export class SplitText<
64
66
  }
65
67
 
66
68
  /** Lines */
67
- private _lines: NSplitText.ILine[];
69
+ protected _lines: NSplitText.ILine[];
68
70
 
69
71
  /** Lines */
70
72
  get lines() {
@@ -88,7 +90,7 @@ export class SplitText<
88
90
  this._initialText = this._initialText.replace(/\s+\n/gm, '\n');
89
91
  this._initialText = this._initialText.replace(
90
92
  /<br( ?)(\/?)>/gm,
91
- String.fromCharCode(10)
93
+ String.fromCharCode(10),
92
94
  );
93
95
 
94
96
  // a11y
@@ -112,7 +114,7 @@ export class SplitText<
112
114
  }
113
115
 
114
116
  /** Set resize events */
115
- private _setResize() {
117
+ protected _setResize() {
116
118
  const { viewportTarget, resizeDebounce, hasLines } = this.props;
117
119
 
118
120
  if (!hasLines) {
@@ -156,7 +158,7 @@ export class SplitText<
156
158
  }
157
159
 
158
160
  /** Split the text into words */
159
- private _splitIntoWords() {
161
+ protected _splitIntoWords() {
160
162
  const chars = this._initialText.split('');
161
163
 
162
164
  // create words
@@ -244,7 +246,7 @@ export class SplitText<
244
246
  }
245
247
 
246
248
  /** Split the text into letters */
247
- private _splitIntoLetters() {
249
+ protected _splitIntoLetters() {
248
250
  // check if need to have letters
249
251
  if (!this.props.hasLetters) {
250
252
  return;
@@ -283,7 +285,7 @@ export class SplitText<
283
285
  }
284
286
 
285
287
  /** Append split words to the container */
286
- private _appendWords() {
288
+ protected _appendWords() {
287
289
  this._words.forEach((word) => {
288
290
  this.container.appendChild(word.element);
289
291
 
@@ -298,7 +300,7 @@ export class SplitText<
298
300
  }
299
301
 
300
302
  /** Split the text into lines */
301
- private _splitIntoLines() {
303
+ protected _splitIntoLines() {
302
304
  // first of all, remove all previous lines
303
305
  this._removeLines();
304
306
 
@@ -371,7 +373,7 @@ export class SplitText<
371
373
  }
372
374
 
373
375
  /** Remove all lines */
374
- private _removeLines() {
376
+ protected _removeLines() {
375
377
  this._lines.forEach(({ element }) => element.remove());
376
378
  this._lines = [];
377
379
 
@@ -9,8 +9,9 @@ export type { NTimeline };
9
9
  */
10
10
  export class Timeline<
11
11
  StaticProps extends NTimeline.IStaticProps = NTimeline.IStaticProps,
12
- ChangeableProps extends NTimeline.IChangeableProps = NTimeline.IChangeableProps,
13
- CallbacksTypes extends NTimeline.ICallbacksTypes = NTimeline.ICallbacksTypes
12
+ ChangeableProps extends
13
+ NTimeline.IChangeableProps = NTimeline.IChangeableProps,
14
+ CallbacksTypes extends NTimeline.ICallbacksTypes = NTimeline.ICallbacksTypes,
14
15
  > extends BaseTimeline<StaticProps, ChangeableProps, CallbacksTypes> {
15
16
  protected _getDefaultProps() {
16
17
  return {
@@ -21,10 +22,10 @@ export class Timeline<
21
22
  }
22
23
 
23
24
  /** The animation frame */
24
- private _animationFrame?: number;
25
+ protected _animationFrame?: number;
25
26
 
26
27
  /** Last time when animationFrame callback has been called */
27
- private _animationFrameLastTime: number;
28
+ protected _animationFrameLastTime: number;
28
29
 
29
30
  /** Timeline is playing */
30
31
  get isPlaying() {
@@ -32,7 +33,7 @@ export class Timeline<
32
33
  }
33
34
 
34
35
  /** Timeline is reversed */
35
- private _isReversed: boolean;
36
+ protected _isReversed: boolean;
36
37
 
37
38
  /** Timeline is reversed */
38
39
  get isReversed() {
@@ -40,7 +41,7 @@ export class Timeline<
40
41
  }
41
42
 
42
43
  /** Timeline is paused */
43
- private _isPaused: boolean;
44
+ protected _isPaused: boolean;
44
45
 
45
46
  /** Timeline is paused */
46
47
  get isPaused() {
@@ -116,7 +117,7 @@ export class Timeline<
116
117
  }
117
118
 
118
119
  /** Start animation */
119
- private _animate() {
120
+ protected _animate() {
120
121
  if (this.isPaused) {
121
122
  return;
122
123
  }
@@ -148,7 +149,7 @@ export class Timeline<
148
149
 
149
150
  // continue animation
150
151
  this._animationFrame = window.requestAnimationFrame(
151
- this._animate.bind(this)
152
+ this._animate.bind(this),
152
153
  );
153
154
  }
154
155
 
@@ -25,7 +25,7 @@ export const Nested: FC = () => {
25
25
 
26
26
  if (containerRef.current) {
27
27
  const children = Array.from(
28
- containerRef.current.children
28
+ containerRef.current.children,
29
29
  ) as HTMLElement[];
30
30
 
31
31
  const scopes = spreadScope(children.length, 0.9);
@@ -11,6 +11,7 @@ export * from './ProgressPreloader';
11
11
  export * from './ScrollBar';
12
12
  export * from './ScrollView';
13
13
  export * from './SectionScrollProgress';
14
+ export * from './SlideProgress';
14
15
  export * from './SmoothScroll';
15
16
  export * from './SmoothScrollDragPlugin';
16
17
  export * from './SmoothScrollKeyboardPlugin';