vevet 5.2.0 → 5.2.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.
Files changed (138) hide show
  1. package/lib/cdn/vevet.iife.min.js +29 -29
  2. package/lib/cjs/base/Callbacks/index.js +6 -3
  3. package/lib/cjs/base/Callbacks/index.js.map +1 -1
  4. package/lib/cjs/base/Module/index.js +12 -10
  5. package/lib/cjs/base/Module/index.js.map +1 -1
  6. package/lib/cjs/components/Canvas/index.js +2 -2
  7. package/lib/cjs/components/Canvas/index.js.map +1 -1
  8. package/lib/cjs/components/CanvasMedia/index.js +2 -2
  9. package/lib/cjs/components/CanvasMedia/index.js.map +1 -1
  10. package/lib/cjs/components/Cursor/index.js +2 -2
  11. package/lib/cjs/components/Cursor/index.js.map +1 -1
  12. package/lib/cjs/components/InView/index.js +2 -2
  13. package/lib/cjs/components/InView/index.js.map +1 -1
  14. package/lib/cjs/components/Marquee/index.js +2 -2
  15. package/lib/cjs/components/Marquee/index.js.map +1 -1
  16. package/lib/cjs/components/Pointers/index.js +2 -2
  17. package/lib/cjs/components/Pointers/index.js.map +1 -1
  18. package/lib/cjs/components/Preloader/index.js +2 -2
  19. package/lib/cjs/components/Preloader/index.js.map +1 -1
  20. package/lib/cjs/components/ProgressPreloader/index.js +2 -2
  21. package/lib/cjs/components/ProgressPreloader/index.js.map +1 -1
  22. package/lib/cjs/components/Raf/index.js +2 -2
  23. package/lib/cjs/components/Raf/index.js.map +1 -1
  24. package/lib/cjs/components/ScrollProgress/index.js +2 -2
  25. package/lib/cjs/components/ScrollProgress/index.js.map +1 -1
  26. package/lib/cjs/components/Scrollbar/index.js +2 -2
  27. package/lib/cjs/components/Scrollbar/index.js.map +1 -1
  28. package/lib/cjs/components/Snap/index.js +2 -2
  29. package/lib/cjs/components/Snap/index.js.map +1 -1
  30. package/lib/cjs/components/SplitText/index.js +2 -2
  31. package/lib/cjs/components/SplitText/index.js.map +1 -1
  32. package/lib/cjs/components/Swipe/index.js +5 -5
  33. package/lib/cjs/components/Swipe/index.js.map +1 -1
  34. package/lib/cjs/components/Timeline/index.js +2 -2
  35. package/lib/cjs/components/Timeline/index.js.map +1 -1
  36. package/lib/cjs/manifest.json +1 -1
  37. package/lib/esm/base/Callbacks/index.js +5 -3
  38. package/lib/esm/base/Callbacks/index.js.map +1 -1
  39. package/lib/esm/base/Module/index.js +10 -8
  40. package/lib/esm/base/Module/index.js.map +1 -1
  41. package/lib/esm/components/Canvas/index.js +2 -2
  42. package/lib/esm/components/Canvas/index.js.map +1 -1
  43. package/lib/esm/components/CanvasMedia/index.js +2 -2
  44. package/lib/esm/components/CanvasMedia/index.js.map +1 -1
  45. package/lib/esm/components/Cursor/index.js +2 -2
  46. package/lib/esm/components/Cursor/index.js.map +1 -1
  47. package/lib/esm/components/InView/index.js +2 -2
  48. package/lib/esm/components/InView/index.js.map +1 -1
  49. package/lib/esm/components/Marquee/index.js +2 -2
  50. package/lib/esm/components/Marquee/index.js.map +1 -1
  51. package/lib/esm/components/Pointers/index.js +2 -2
  52. package/lib/esm/components/Pointers/index.js.map +1 -1
  53. package/lib/esm/components/Preloader/index.js +2 -2
  54. package/lib/esm/components/Preloader/index.js.map +1 -1
  55. package/lib/esm/components/ProgressPreloader/index.js +2 -2
  56. package/lib/esm/components/ProgressPreloader/index.js.map +1 -1
  57. package/lib/esm/components/Raf/index.js +2 -2
  58. package/lib/esm/components/Raf/index.js.map +1 -1
  59. package/lib/esm/components/ScrollProgress/index.js +2 -2
  60. package/lib/esm/components/ScrollProgress/index.js.map +1 -1
  61. package/lib/esm/components/Scrollbar/index.js +2 -2
  62. package/lib/esm/components/Scrollbar/index.js.map +1 -1
  63. package/lib/esm/components/Snap/index.js +2 -2
  64. package/lib/esm/components/Snap/index.js.map +1 -1
  65. package/lib/esm/components/SplitText/index.js +2 -2
  66. package/lib/esm/components/SplitText/index.js.map +1 -1
  67. package/lib/esm/components/Swipe/index.js +5 -5
  68. package/lib/esm/components/Swipe/index.js.map +1 -1
  69. package/lib/esm/components/Timeline/index.js +2 -2
  70. package/lib/esm/components/Timeline/index.js.map +1 -1
  71. package/lib/esm/manifest.json +1 -1
  72. package/lib/types/base/Callbacks/index.d.ts +7 -5
  73. package/lib/types/base/Callbacks/index.d.ts.map +1 -1
  74. package/lib/types/base/Callbacks/types.d.ts +9 -5
  75. package/lib/types/base/Callbacks/types.d.ts.map +1 -1
  76. package/lib/types/base/Module/index.d.ts +5 -5
  77. package/lib/types/base/Module/index.d.ts.map +1 -1
  78. package/lib/types/base/Module/types.d.ts +3 -3
  79. package/lib/types/base/Module/types.d.ts.map +1 -1
  80. package/lib/types/base/Responsive/types.d.ts +2 -2
  81. package/lib/types/base/Responsive/types.d.ts.map +1 -1
  82. package/lib/types/components/Canvas/index.d.ts +5 -5
  83. package/lib/types/components/Canvas/index.d.ts.map +1 -1
  84. package/lib/types/components/CanvasMedia/index.d.ts +5 -5
  85. package/lib/types/components/CanvasMedia/index.d.ts.map +1 -1
  86. package/lib/types/components/Cursor/index.d.ts +5 -5
  87. package/lib/types/components/Cursor/index.d.ts.map +1 -1
  88. package/lib/types/components/InView/index.d.ts +5 -5
  89. package/lib/types/components/InView/index.d.ts.map +1 -1
  90. package/lib/types/components/InView/types.d.ts.map +1 -1
  91. package/lib/types/components/Marquee/index.d.ts +5 -5
  92. package/lib/types/components/Marquee/index.d.ts.map +1 -1
  93. package/lib/types/components/Pointers/index.d.ts +5 -5
  94. package/lib/types/components/Pointers/index.d.ts.map +1 -1
  95. package/lib/types/components/Preloader/index.d.ts +5 -5
  96. package/lib/types/components/Preloader/index.d.ts.map +1 -1
  97. package/lib/types/components/ProgressPreloader/index.d.ts +5 -5
  98. package/lib/types/components/ProgressPreloader/index.d.ts.map +1 -1
  99. package/lib/types/components/Raf/index.d.ts +5 -5
  100. package/lib/types/components/Raf/index.d.ts.map +1 -1
  101. package/lib/types/components/ScrollProgress/index.d.ts +5 -5
  102. package/lib/types/components/ScrollProgress/index.d.ts.map +1 -1
  103. package/lib/types/components/Scrollbar/index.d.ts +5 -5
  104. package/lib/types/components/Scrollbar/index.d.ts.map +1 -1
  105. package/lib/types/components/Snap/index.d.ts +5 -5
  106. package/lib/types/components/Snap/index.d.ts.map +1 -1
  107. package/lib/types/components/SplitText/index.d.ts +5 -5
  108. package/lib/types/components/SplitText/index.d.ts.map +1 -1
  109. package/lib/types/components/Swipe/index.d.ts +5 -5
  110. package/lib/types/components/Swipe/index.d.ts.map +1 -1
  111. package/lib/types/components/Swipe/types.d.ts +5 -0
  112. package/lib/types/components/Swipe/types.d.ts.map +1 -1
  113. package/lib/types/components/Timeline/index.d.ts +5 -5
  114. package/lib/types/components/Timeline/index.d.ts.map +1 -1
  115. package/package.json +1 -1
  116. package/src/base/Callbacks/index.ts +15 -7
  117. package/src/base/Callbacks/types.ts +12 -7
  118. package/src/base/Module/index.ts +24 -15
  119. package/src/base/Module/types.ts +3 -3
  120. package/src/base/Responsive/types.ts +4 -5
  121. package/src/components/Canvas/index.ts +12 -11
  122. package/src/components/CanvasMedia/index.ts +12 -11
  123. package/src/components/Cursor/index.ts +12 -11
  124. package/src/components/InView/index.ts +12 -11
  125. package/src/components/InView/types.ts +2 -6
  126. package/src/components/Marquee/index.ts +12 -11
  127. package/src/components/Pointers/index.ts +12 -11
  128. package/src/components/Preloader/index.ts +12 -11
  129. package/src/components/ProgressPreloader/index.ts +12 -14
  130. package/src/components/Raf/index.ts +14 -13
  131. package/src/components/ScrollProgress/index.ts +12 -13
  132. package/src/components/Scrollbar/index.ts +12 -11
  133. package/src/components/Snap/index.ts +12 -11
  134. package/src/components/SplitText/index.ts +12 -11
  135. package/src/components/Swipe/index.ts +15 -13
  136. package/src/components/Swipe/types.ts +6 -0
  137. package/src/components/Timeline/index.ts +12 -11
  138. package/src/manifest.json +1 -1
@@ -4,6 +4,7 @@ import {
4
4
  IModuleCallbacksMap,
5
5
  IModuleMutableProps,
6
6
  IModuleStaticProps,
7
+ TModuleOnCallbacksProps,
7
8
  } from './types';
8
9
  import { mergeWithNoUndefined } from '@/internal/mergeWithNoUndefined';
9
10
  import { noopIfDestroyed } from '@/internal/noopIfDestroyed';
@@ -65,7 +66,7 @@ export class Module<
65
66
  }
66
67
 
67
68
  /** Callbacks instance */
68
- protected _callbacks: Callbacks<CallbacksMap>;
69
+ protected _callbacks: Callbacks<CallbacksMap, this>;
69
70
 
70
71
  /**
71
72
  * Retrieves the module's callbacks instance.
@@ -80,8 +81,14 @@ export class Module<
80
81
  /**
81
82
  * Creates a new instance of the Module class.
82
83
  */
83
- constructor(props?: StaticProps & MutableProps) {
84
- this._callbacks = new Callbacks();
84
+ constructor(
85
+ props?: StaticProps & MutableProps,
86
+ onCallbacks?: TModuleOnCallbacksProps<
87
+ CallbacksMap,
88
+ Module<CallbacksMap, StaticProps, MutableProps>
89
+ >,
90
+ ) {
91
+ this._callbacks = new Callbacks({ ctx: this });
85
92
 
86
93
  this._props = mergeWithNoUndefined(
87
94
  {
@@ -93,18 +100,20 @@ export class Module<
93
100
 
94
101
  // Initialize callbacks
95
102
 
96
- const callbacksProps = Object.keys(this._props).filter((key) =>
97
- key.startsWith('on'),
98
- );
99
-
100
- callbacksProps.forEach((key) => {
101
- let target = key.slice(2);
102
- target = target.charAt(0).toLowerCase() + target.slice(1);
103
- this._callbacks.on(
104
- target as keyof CallbacksMap,
105
- this._props[key as keyof typeof props],
103
+ if (onCallbacks) {
104
+ const callbacksProps = Object.keys(onCallbacks).filter((key) =>
105
+ key.startsWith('on'),
106
106
  );
107
- });
107
+
108
+ callbacksProps.forEach((key) => {
109
+ let target = key.slice(2);
110
+ target = target.charAt(0).toLowerCase() + target.slice(1);
111
+ this._callbacks.on(
112
+ target as keyof CallbacksMap,
113
+ onCallbacks[key as keyof typeof props],
114
+ );
115
+ });
116
+ }
108
117
  }
109
118
 
110
119
  /**
@@ -150,7 +159,7 @@ export class Module<
150
159
  @noopIfDestroyed
151
160
  public on<T extends keyof CallbacksMap>(
152
161
  target: T,
153
- listener: TCallbacksAction<CallbacksMap[T]>,
162
+ listener: TCallbacksAction<CallbacksMap[T], this>,
154
163
  settings: ICallbacksSettings = {},
155
164
  ) {
156
165
  return this.callbacks.on(target, listener, settings);
@@ -1,4 +1,4 @@
1
- import { ICallbacksMap } from '../Callbacks';
1
+ import { ICallbacksMap, TCallbacksAction } from '../Callbacks';
2
2
 
3
3
  export interface IModuleStaticProps {
4
4
  __staticProp?: null;
@@ -20,6 +20,6 @@ export interface IModuleCallbacksMap extends ICallbacksMap {
20
20
  props: undefined;
21
21
  }
22
22
 
23
- export type TModuleCallbacksProps<T> = Partial<{
24
- [K in keyof T as `on${Capitalize<string & K>}`]: (data: T[K]) => void;
23
+ export type TModuleOnCallbacksProps<T, Ctx> = Partial<{
24
+ [K in keyof T as `on${Capitalize<string & K>}`]: TCallbacksAction<T[K], Ctx>;
25
25
  }>;
@@ -2,8 +2,8 @@ import { Module } from '../Module';
2
2
 
3
3
  export type TResponsiveSource = Record<string, any> | Module;
4
4
 
5
- export type TResponsivePick<T> =
6
- T extends Module<any, any, any>
5
+ export type TResponsivePick<T extends TResponsiveSource> =
6
+ T['_getMutable'] extends Function
7
7
  ? Partial<ReturnType<T['_getMutable']>>
8
8
  : Partial<T>;
9
9
 
@@ -24,6 +24,5 @@ export type TResponsiveRule<T extends TResponsiveSource> = {
24
24
  props: TResponsivePick<T>;
25
25
  };
26
26
 
27
- export type TResponsiveProps<T extends TResponsiveSource> = T extends Module
28
- ? T['props']
29
- : T;
27
+ export type TResponsiveProps<T extends TResponsiveSource> =
28
+ T['_getMutable'] extends Function ? T['props'] : T;
@@ -1,6 +1,6 @@
1
1
  import { TRequiredProps } from '@/internal/requiredProps';
2
2
  import { onResize } from '@/utils/listeners/onResize';
3
- import { Module, TModuleCallbacksProps } from '@/base/Module';
3
+ import { Module, TModuleOnCallbacksProps } from '@/base/Module';
4
4
  import {
5
5
  ICanvasCallbacksMap,
6
6
  ICanvasMutableProps,
@@ -22,12 +22,12 @@ export * from './types';
22
22
  * @group Components
23
23
  */
24
24
  export class Canvas<
25
- CallbacksMap extends ICanvasCallbacksMap = ICanvasCallbacksMap,
26
- StaticProps extends ICanvasStaticProps = ICanvasStaticProps,
27
- MutableProps extends ICanvasMutableProps = ICanvasMutableProps,
28
- > extends Module<CallbacksMap, StaticProps, MutableProps> {
25
+ C extends ICanvasCallbacksMap = ICanvasCallbacksMap,
26
+ S extends ICanvasStaticProps = ICanvasStaticProps,
27
+ M extends ICanvasMutableProps = ICanvasMutableProps,
28
+ > extends Module<C, S, M> {
29
29
  /** Get default static properties */
30
- public _getStatic(): TRequiredProps<StaticProps> {
30
+ public _getStatic(): TRequiredProps<S> {
31
31
  return {
32
32
  ...super._getStatic(),
33
33
  container: null,
@@ -36,17 +36,17 @@ export class Canvas<
36
36
  resizeOnRuntime: false,
37
37
  viewportTarget: 'any',
38
38
  resizeDebounce: 0,
39
- } as TRequiredProps<StaticProps>;
39
+ } as TRequiredProps<S>;
40
40
  }
41
41
 
42
42
  /** Get default mutable properties */
43
- public _getMutable(): TRequiredProps<MutableProps> {
43
+ public _getMutable(): TRequiredProps<M> {
44
44
  return {
45
45
  ...super._getMutable(),
46
46
  width: 'auto',
47
47
  height: 'auto',
48
48
  dpr: 'auto',
49
- } as TRequiredProps<MutableProps>;
49
+ } as TRequiredProps<M>;
50
50
  }
51
51
 
52
52
  /** The canvas element created for rendering */
@@ -108,9 +108,10 @@ export class Canvas<
108
108
  * Constructor for the Ctx2D class.
109
109
  */
110
110
  constructor(
111
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
111
+ props?: S & M,
112
+ onCallbacks?: TModuleOnCallbacksProps<C, Canvas<C, S, M>>,
112
113
  ) {
113
- super(props);
114
+ super(props, onCallbacks as any);
114
115
 
115
116
  const {
116
117
  append: shouldAppend,
@@ -8,7 +8,7 @@ import {
8
8
  import { Canvas, ICanvasRenderArg } from '../Canvas';
9
9
  import { addEventListener } from '@/utils';
10
10
  import { noopIfDestroyed } from '@/internal/noopIfDestroyed';
11
- import { TModuleCallbacksProps } from '@/base';
11
+ import { TModuleOnCallbacksProps } from '@/base';
12
12
 
13
13
  export * from './types';
14
14
 
@@ -21,30 +21,31 @@ export * from './types';
21
21
  * @group Components
22
22
  */
23
23
  export class CanvasMedia<
24
- CallbacksMap extends ICanvasMediaCallbacksMap = ICanvasMediaCallbacksMap,
25
- StaticProps extends ICanvasMediaStaticProps = ICanvasMediaStaticProps,
26
- MutableProps extends ICanvasMediaMutableProps = ICanvasMediaMutableProps,
27
- > extends Canvas<CallbacksMap, StaticProps, MutableProps> {
24
+ C extends ICanvasMediaCallbacksMap = ICanvasMediaCallbacksMap,
25
+ S extends ICanvasMediaStaticProps = ICanvasMediaStaticProps,
26
+ M extends ICanvasMediaMutableProps = ICanvasMediaMutableProps,
27
+ > extends Canvas<C, S, M> {
28
28
  /** Get default static properties */
29
- public _getStatic(): TRequiredProps<StaticProps> {
29
+ public _getStatic(): TRequiredProps<S> {
30
30
  return {
31
31
  ...super._getStatic(),
32
32
  autoRenderVideo: true,
33
- } as TRequiredProps<StaticProps>;
33
+ } as TRequiredProps<S>;
34
34
  }
35
35
 
36
36
  /** Get default mutable properties */
37
- public _getMutable(): TRequiredProps<MutableProps> {
37
+ public _getMutable(): TRequiredProps<M> {
38
38
  return {
39
39
  ...super._getMutable(),
40
40
  rule: 'cover',
41
- } as TRequiredProps<MutableProps>;
41
+ } as TRequiredProps<M>;
42
42
  }
43
43
 
44
44
  constructor(
45
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
45
+ props?: S & M,
46
+ onCallbacks?: TModuleOnCallbacksProps<C, CanvasMedia<C, S, M>>,
46
47
  ) {
47
- super(props);
48
+ super(props, onCallbacks as any);
48
49
 
49
50
  this._setMediaEvents();
50
51
  }
@@ -7,7 +7,7 @@ import {
7
7
  ICursorStaticProps,
8
8
  ICursorType,
9
9
  } from './types';
10
- import { Module, TModuleCallbacksProps } from '@/base/Module';
10
+ import { Module, TModuleOnCallbacksProps } from '@/base/Module';
11
11
  import { Raf } from '../Raf';
12
12
  import { addEventListener } from '@/utils/listeners';
13
13
  import { initVevet } from '@/global/initVevet';
@@ -30,21 +30,21 @@ export * from './types';
30
30
  * @group Components
31
31
  */
32
32
  export class Cursor<
33
- CallbacksMap extends ICursorCallbacksMap = ICursorCallbacksMap,
34
- StaticProps extends ICursorStaticProps = ICursorStaticProps,
35
- MutableProps extends ICursorMutableProps = ICursorMutableProps,
36
- > extends Module<CallbacksMap, StaticProps, MutableProps> {
33
+ C extends ICursorCallbacksMap = ICursorCallbacksMap,
34
+ S extends ICursorStaticProps = ICursorStaticProps,
35
+ M extends ICursorMutableProps = ICursorMutableProps,
36
+ > extends Module<C, S, M> {
37
37
  /** Get default static properties */
38
- public _getStatic(): TRequiredProps<StaticProps> {
38
+ public _getStatic(): TRequiredProps<S> {
39
39
  return {
40
40
  ...super._getStatic(),
41
41
  container: window,
42
42
  hideNative: false,
43
- } as TRequiredProps<StaticProps>;
43
+ } as TRequiredProps<S>;
44
44
  }
45
45
 
46
46
  /** Get default mutable properties */
47
- public _getMutable(): TRequiredProps<MutableProps> {
47
+ public _getMutable(): TRequiredProps<M> {
48
48
  return {
49
49
  ...super._getMutable(),
50
50
  enabled: true,
@@ -52,7 +52,7 @@ export class Cursor<
52
52
  height: 50,
53
53
  lerp: 0.2,
54
54
  autoStop: true,
55
- } as TRequiredProps<MutableProps>;
55
+ } as TRequiredProps<M>;
56
56
  }
57
57
 
58
58
  /**
@@ -177,9 +177,10 @@ export class Cursor<
177
177
  protected _activeTypes: string[];
178
178
 
179
179
  constructor(
180
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
180
+ props?: S & M,
181
+ onCallbacks?: TModuleOnCallbacksProps<C, Cursor<C, S, M>>,
181
182
  ) {
182
- super(props);
183
+ super(props, onCallbacks as any);
183
184
 
184
185
  // Set default variables
185
186
  const { width, height, enabled: isEnabled } = this.props;
@@ -6,7 +6,7 @@ import {
6
6
  IInViewMutableProps,
7
7
  IInViewStaticProps,
8
8
  } from './types';
9
- import { Module, TModuleCallbacksProps } from '@/base/Module';
9
+ import { Module, TModuleOnCallbacksProps } from '@/base/Module';
10
10
  import { initVevet } from '@/global/initVevet';
11
11
  import { noopIfDestroyed } from '@/internal/noopIfDestroyed';
12
12
  import { cnToggle } from '@/internal/cn';
@@ -22,31 +22,31 @@ export * from './types';
22
22
  * @group Components
23
23
  */
24
24
  export class InView<
25
- CallbacksMap extends IInViewCallbacksMap = IInViewCallbacksMap,
26
- StaticProps extends IInViewStaticProps = IInViewStaticProps,
27
- MutableProps extends IInViewMutableProps = IInViewMutableProps,
28
- > extends Module<CallbacksMap, StaticProps, MutableProps> {
25
+ C extends IInViewCallbacksMap = IInViewCallbacksMap,
26
+ S extends IInViewStaticProps = IInViewStaticProps,
27
+ M extends IInViewMutableProps = IInViewMutableProps,
28
+ > extends Module<C, S, M> {
29
29
  /**
30
30
  * Returns default static properties.
31
31
  */
32
- public _getStatic(): TRequiredProps<StaticProps> {
32
+ public _getStatic(): TRequiredProps<S> {
33
33
  return {
34
34
  ...super._getStatic(),
35
35
  hasOut: true,
36
36
  maxInitialDelay: 1000,
37
37
  scrollDirection: 'vertical',
38
- } as TRequiredProps<StaticProps>;
38
+ } as TRequiredProps<S>;
39
39
  }
40
40
 
41
41
  /**
42
42
  * Returns default mutable properties.
43
43
  */
44
- public _getMutable(): TRequiredProps<MutableProps> {
44
+ public _getMutable(): TRequiredProps<M> {
45
45
  return {
46
46
  ...super._getMutable(),
47
47
  enabled: true,
48
48
  rootMargin: '0% 0% -5% 0%',
49
- } as TRequiredProps<MutableProps>;
49
+ } as TRequiredProps<M>;
50
50
  }
51
51
 
52
52
  /** Intersection observer for detecting elements entering the viewport. */
@@ -79,9 +79,10 @@ export class InView<
79
79
  * Initializes the `InView` module.
80
80
  */
81
81
  constructor(
82
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
82
+ props?: S & M,
83
+ onCallbacks?: TModuleOnCallbacksProps<C, InView<C, S, M>>,
83
84
  ) {
84
- super(props);
85
+ super(props, onCallbacks as any);
85
86
 
86
87
  this._setup();
87
88
  }
@@ -51,16 +51,12 @@ export interface IInViewCallbacksMap extends IModuleCallbacksMap {
51
51
  /**
52
52
  * Fires when an element enters the viewport.
53
53
  */
54
- in: {
55
- element: Element;
56
- };
54
+ in: { element: Element };
57
55
 
58
56
  /**
59
57
  * Fires when an element leaves the viewport.
60
58
  */
61
- out: {
62
- element: Element;
63
- };
59
+ out: { element: Element };
64
60
  }
65
61
 
66
62
  /**
@@ -6,7 +6,7 @@ import {
6
6
  IMarqueeMutableProps,
7
7
  IMarqueeStaticProps,
8
8
  } from './types';
9
- import { Module, TModuleCallbacksProps } from '@/base/Module';
9
+ import { Module, TModuleOnCallbacksProps } from '@/base/Module';
10
10
  import { Raf } from '../Raf';
11
11
  import { initVevet } from '@/global/initVevet';
12
12
  import { toPixels } from '@/utils';
@@ -27,23 +27,23 @@ export * from './types';
27
27
  * @group Components
28
28
  */
29
29
  export class Marquee<
30
- CallbacksMap extends IMarqueeCallbacksMap = IMarqueeCallbacksMap,
31
- StaticProps extends IMarqueeStaticProps = IMarqueeStaticProps,
32
- MutableProps extends IMarqueeMutableProps = IMarqueeMutableProps,
33
- > extends Module<CallbacksMap, StaticProps, MutableProps> {
30
+ C extends IMarqueeCallbacksMap = IMarqueeCallbacksMap,
31
+ S extends IMarqueeStaticProps = IMarqueeStaticProps,
32
+ M extends IMarqueeMutableProps = IMarqueeMutableProps,
33
+ > extends Module<C, S, M> {
34
34
  /** Get default static properties. */
35
- public _getStatic(): TRequiredProps<StaticProps> {
35
+ public _getStatic(): TRequiredProps<S> {
36
36
  return {
37
37
  ...super._getStatic(),
38
38
  resizeDebounce: 0,
39
39
  hasWillChange: true,
40
40
  cloneNodes: true,
41
41
  direction: 'horizontal',
42
- } as TRequiredProps<StaticProps>;
42
+ } as TRequiredProps<S>;
43
43
  }
44
44
 
45
45
  /** Get default mutable properties. */
46
- public _getMutable(): TRequiredProps<MutableProps> {
46
+ public _getMutable(): TRequiredProps<M> {
47
47
  return {
48
48
  ...super._getMutable(),
49
49
  speed: 1,
@@ -53,7 +53,7 @@ export class Marquee<
53
53
  centered: false,
54
54
  adjustSpeed: true,
55
55
  pauseOnOut: true,
56
- } as TRequiredProps<MutableProps>;
56
+ } as TRequiredProps<M>;
57
57
  }
58
58
 
59
59
  /** Current container size (width or height depending on direction) */
@@ -124,9 +124,10 @@ export class Marquee<
124
124
  protected _intersection?: IntersectionObserver;
125
125
 
126
126
  constructor(
127
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
127
+ props?: S & M,
128
+ onCallbacks?: TModuleOnCallbacksProps<C, Marquee<C, S, M>>,
128
129
  ) {
129
- super(props);
130
+ super(props, onCallbacks as any);
130
131
 
131
132
  const { container } = this.props;
132
133
  const { isVertical } = this;
@@ -1,4 +1,4 @@
1
- import { Module, TModuleCallbacksProps } from '@/base';
1
+ import { Module, TModuleOnCallbacksProps } from '@/base';
2
2
  import {
3
3
  IPointersCallbacksMap,
4
4
  IPointersItem,
@@ -24,14 +24,14 @@ export * from './types';
24
24
  * @group Components
25
25
  */
26
26
  export class Pointers<
27
- CallbacksMap extends IPointersCallbacksMap = IPointersCallbacksMap,
28
- StaticProps extends IPointersStaticProps = IPointersStaticProps,
29
- MutableProps extends IPointersMutableProps = IPointersMutableProps,
30
- > extends Module<CallbacksMap, StaticProps, MutableProps> {
27
+ C extends IPointersCallbacksMap = IPointersCallbacksMap,
28
+ S extends IPointersStaticProps = IPointersStaticProps,
29
+ M extends IPointersMutableProps = IPointersMutableProps,
30
+ > extends Module<C, S, M> {
31
31
  /**
32
32
  * Returns the default static properties.
33
33
  */
34
- public _getStatic(): TRequiredProps<StaticProps> {
34
+ public _getStatic(): TRequiredProps<S> {
35
35
  return {
36
36
  ...super._getStatic(),
37
37
  buttons: [0],
@@ -39,17 +39,17 @@ export class Pointers<
39
39
  minPointers: 1,
40
40
  maxPointers: 5,
41
41
  disableUserSelect: true,
42
- } as TRequiredProps<StaticProps>;
42
+ } as TRequiredProps<S>;
43
43
  }
44
44
 
45
45
  /**
46
46
  * Returns the default mutable properties.
47
47
  */
48
- public _getMutable(): TRequiredProps<MutableProps> {
48
+ public _getMutable(): TRequiredProps<M> {
49
49
  return {
50
50
  ...super._getMutable(),
51
51
  enabled: true,
52
- } as TRequiredProps<MutableProps>;
52
+ } as TRequiredProps<M>;
53
53
  }
54
54
 
55
55
  /**
@@ -89,9 +89,10 @@ export class Pointers<
89
89
  }
90
90
 
91
91
  constructor(
92
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
92
+ props?: S & M,
93
+ onCallbacks?: TModuleOnCallbacksProps<C, Pointers<C, S, M>>,
93
94
  ) {
94
- super(props);
95
+ super(props, onCallbacks as any);
95
96
 
96
97
  // Defaults
97
98
  this._pointersMap = new Map();
@@ -4,7 +4,7 @@ import {
4
4
  IPreloaderMutableProps,
5
5
  IPreloaderStaticProps,
6
6
  } from './types';
7
- import { Module, TModuleCallbacksProps } from '@/base/Module';
7
+ import { Module, TModuleOnCallbacksProps } from '@/base/Module';
8
8
  import { Timeline } from '../Timeline';
9
9
  import { initVevet } from '@/global/initVevet';
10
10
  import { isNumber } from '@/internal/isNumber';
@@ -20,25 +20,25 @@ export * from './types';
20
20
  * @group Components
21
21
  */
22
22
  export class Preloader<
23
- CallbacksMap extends IPreloaderCallbacksMap = IPreloaderCallbacksMap,
24
- StaticProps extends IPreloaderStaticProps = IPreloaderStaticProps,
25
- MutableProps extends IPreloaderMutableProps = IPreloaderMutableProps,
26
- > extends Module<CallbacksMap, StaticProps, MutableProps> {
23
+ C extends IPreloaderCallbacksMap = IPreloaderCallbacksMap,
24
+ S extends IPreloaderStaticProps = IPreloaderStaticProps,
25
+ M extends IPreloaderMutableProps = IPreloaderMutableProps,
26
+ > extends Module<C, S, M> {
27
27
  /**
28
28
  * Retrieves the default static properties.
29
29
  */
30
- public _getStatic(): TRequiredProps<StaticProps> {
30
+ public _getStatic(): TRequiredProps<S> {
31
31
  return {
32
32
  ...super._getStatic(),
33
33
  hide: 250,
34
- } as TRequiredProps<StaticProps>;
34
+ } as TRequiredProps<S>;
35
35
  }
36
36
 
37
37
  /**
38
38
  * Retrieves the default mutable properties.
39
39
  */
40
- public _getMutable(): TRequiredProps<MutableProps> {
41
- return { ...super._getMutable() } as TRequiredProps<MutableProps>;
40
+ public _getMutable(): TRequiredProps<M> {
41
+ return { ...super._getMutable() } as TRequiredProps<M>;
42
42
  }
43
43
 
44
44
  /** Indicates if the preloader is in the process of being hidden. */
@@ -58,9 +58,10 @@ export class Preloader<
58
58
  }
59
59
 
60
60
  constructor(
61
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
61
+ props?: S & M,
62
+ onCallbacks?: TModuleOnCallbacksProps<C, Preloader<C, S, M>>,
62
63
  ) {
63
- super(props);
64
+ super(props, onCallbacks as any);
64
65
 
65
66
  // Handle page load event
66
67
  const timeout = setTimeout(() => {
@@ -14,9 +14,9 @@ import { Preloader } from '../Preloader';
14
14
  import { Raf } from '../Raf';
15
15
  import { initVevet } from '@/global/initVevet';
16
16
  import { noopIfDestroyed } from '@/internal/noopIfDestroyed';
17
- import { TModuleCallbacksProps } from '@/base';
18
17
  import { cnHas } from '@/internal/cn';
19
18
  import { doc } from '@/internal/env';
19
+ import { TModuleOnCallbacksProps } from '@/base';
20
20
 
21
21
  export * from './types';
22
22
 
@@ -31,17 +31,14 @@ const PAGE_RESOURCE = `vevet-page-${Math.random()}`;
31
31
  * @group Components
32
32
  */
33
33
  export class ProgressPreloader<
34
- CallbacksMap extends
35
- IProgressPreloaderCallbacksMap = IProgressPreloaderCallbacksMap,
36
- StaticProps extends
37
- IProgressPreloaderStaticProps = IProgressPreloaderStaticProps,
38
- MutableProps extends
39
- IProgressPreloaderMutableProps = IProgressPreloaderMutableProps,
40
- > extends Preloader<CallbacksMap, StaticProps, MutableProps> {
34
+ C extends IProgressPreloaderCallbacksMap = IProgressPreloaderCallbacksMap,
35
+ S extends IProgressPreloaderStaticProps = IProgressPreloaderStaticProps,
36
+ M extends IProgressPreloaderMutableProps = IProgressPreloaderMutableProps,
37
+ > extends Preloader<C, S, M> {
41
38
  /**
42
39
  * Retrieves the default static properties.
43
40
  */
44
- public _getStatic(): TRequiredProps<StaticProps> {
41
+ public _getStatic(): TRequiredProps<S> {
45
42
  return {
46
43
  ...super._getStatic(),
47
44
  preloadImages: true,
@@ -50,14 +47,14 @@ export class ProgressPreloader<
50
47
  ignoreClassName: 'js-preload-ignore',
51
48
  lerp: 0.1,
52
49
  endDuration: 500,
53
- } as TRequiredProps<StaticProps>;
50
+ } as TRequiredProps<S>;
54
51
  }
55
52
 
56
53
  /**
57
54
  * Retrieves the default mutable properties.
58
55
  */
59
- public _getMutable(): TRequiredProps<MutableProps> {
60
- return { ...super._getMutable() } as TRequiredProps<MutableProps>;
56
+ public _getMutable(): TRequiredProps<M> {
57
+ return { ...super._getMutable() } as TRequiredProps<M>;
61
58
  }
62
59
 
63
60
  /**
@@ -111,9 +108,10 @@ export class ProgressPreloader<
111
108
  protected _raf: Raf;
112
109
 
113
110
  constructor(
114
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
111
+ props?: S & M,
112
+ onCallbacks?: TModuleOnCallbacksProps<C, ProgressPreloader<C, S, M>>,
115
113
  ) {
116
- super(props);
114
+ super(props, onCallbacks as any);
117
115
 
118
116
  // Initialize animation frame if interpolation is enabled
119
117
  this._raf = new Raf();
@@ -1,5 +1,5 @@
1
1
  import { TRequiredProps } from '@/internal/requiredProps';
2
- import { Module, TModuleCallbacksProps } from '@/base/Module';
2
+ import { Module, TModuleOnCallbacksProps } from '@/base/Module';
3
3
  import { IRafCallbacksMap, IRafMutableProps, IRafStaticProps } from './types';
4
4
  import { noopIfDestroyed } from '@/internal/noopIfDestroyed';
5
5
 
@@ -13,23 +13,23 @@ export * from './types';
13
13
  * @group Components
14
14
  */
15
15
  export class Raf<
16
- CallbacksMap extends IRafCallbacksMap = IRafCallbacksMap,
17
- StaticProps extends IRafStaticProps = IRafStaticProps,
18
- MutableProps extends IRafMutableProps = IRafMutableProps,
19
- > extends Module<CallbacksMap, StaticProps, MutableProps> {
16
+ C extends IRafCallbacksMap = IRafCallbacksMap,
17
+ S extends IRafStaticProps = IRafStaticProps,
18
+ M extends IRafMutableProps = IRafMutableProps,
19
+ > extends Module<C, S, M> {
20
20
  /** Get default static properties */
21
- public _getStatic(): TRequiredProps<StaticProps> {
22
- return { ...super._getStatic() } as TRequiredProps<StaticProps>;
21
+ public _getStatic(): TRequiredProps<S> {
22
+ return { ...super._getStatic() } as TRequiredProps<S>;
23
23
  }
24
24
 
25
25
  /** Get default mutable properties */
26
- public _getMutable(): TRequiredProps<MutableProps> {
26
+ public _getMutable(): TRequiredProps<M> {
27
27
  return {
28
28
  ...super._getMutable(),
29
29
  fps: 'auto',
30
30
  enabled: false,
31
31
  fpsRecalcFrames: 10,
32
- } as TRequiredProps<MutableProps>;
32
+ } as TRequiredProps<M>;
33
33
  }
34
34
 
35
35
  /** Indicates if the animation frame is currently running */
@@ -84,9 +84,10 @@ export class Raf<
84
84
  }
85
85
 
86
86
  constructor(
87
- props?: StaticProps & MutableProps & TModuleCallbacksProps<CallbacksMap>,
87
+ props?: S & M,
88
+ onCallbacks?: TModuleOnCallbacksProps<C, Raf<C, S, M>>,
88
89
  ) {
89
- super(props);
90
+ super(props, onCallbacks as any);
90
91
 
91
92
  // Initialize FPS
92
93
  this._fps = this.props.fps === 'auto' ? this._fps : this.props.fps;
@@ -117,7 +118,7 @@ export class Raf<
117
118
  return;
118
119
  }
119
120
 
120
- this.updateProps({ enabled: true } as MutableProps);
121
+ this.updateProps({ enabled: true } as M);
121
122
  }
122
123
 
123
124
  /** Internal method to start the loop */
@@ -141,7 +142,7 @@ export class Raf<
141
142
  return;
142
143
  }
143
144
 
144
- this.updateProps({ enabled: false } as MutableProps);
145
+ this.updateProps({ enabled: false } as M);
145
146
  }
146
147
 
147
148
  /** Internal method to pause the loop */