vevet 5.0.10 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -16
- package/lib/cdn/vevet.iife.min.js +9 -9
- package/lib/cjs/base/Module/index.js +2 -1
- package/lib/cjs/base/Module/index.js.map +1 -1
- package/lib/cjs/components/Canvas/index.js +1 -1
- package/lib/cjs/components/CanvasMedia/index.js +1 -1
- package/lib/cjs/components/Cursor/index.js +28 -13
- package/lib/cjs/components/Cursor/index.js.map +1 -1
- package/lib/cjs/components/InView/index.js +1 -1
- package/lib/cjs/components/Marquee/index.js +1 -1
- package/lib/cjs/components/Pointers/index.js +4 -1
- package/lib/cjs/components/Pointers/index.js.map +1 -1
- package/lib/cjs/components/Preloader/index.js +1 -1
- package/lib/cjs/components/ProgressPreloader/index.js +1 -1
- package/lib/cjs/components/Raf/index.js +1 -1
- package/lib/cjs/components/ScrollProgress/index.js +1 -1
- package/lib/cjs/components/Scrollbar/index.js +2 -1
- package/lib/cjs/components/Scrollbar/index.js.map +1 -1
- package/lib/cjs/components/Snap/Slide/index.js +1 -0
- package/lib/cjs/components/Snap/Slide/index.js.map +1 -1
- package/lib/cjs/components/Snap/Swipe/index.js +120 -23
- package/lib/cjs/components/Snap/Swipe/index.js.map +1 -1
- package/lib/cjs/components/Snap/Track/index.js +12 -1
- package/lib/cjs/components/Snap/Track/index.js.map +1 -1
- package/lib/cjs/components/Snap/Wheel/index.js +247 -54
- package/lib/cjs/components/Snap/Wheel/index.js.map +1 -1
- package/lib/cjs/components/Snap/index.js +98 -40
- package/lib/cjs/components/Snap/index.js.map +1 -1
- package/lib/cjs/components/SplitText/index.js +1 -1
- package/lib/cjs/components/Swipe/index.js +97 -47
- package/lib/cjs/components/Swipe/index.js.map +1 -1
- package/lib/cjs/components/Timeline/index.js +1 -1
- package/lib/cjs/internal/mergeWithNoUndefined.js +24 -0
- package/lib/cjs/internal/mergeWithNoUndefined.js.map +1 -0
- package/lib/cjs/manifest.json +1 -1
- package/lib/cjs/utils/common/toPixels.js +3 -0
- package/lib/cjs/utils/common/toPixels.js.map +1 -1
- package/lib/cjs/utils/listeners/onResize.js +1 -1
- package/lib/cjs/utils/listeners/onResize.js.map +1 -1
- package/lib/cjs/utils/math/clamp.js +3 -1
- package/lib/cjs/utils/math/clamp.js.map +1 -1
- package/lib/cjs/utils/math/inRange.js +4 -4
- package/lib/esm/base/Module/index.js +2 -1
- package/lib/esm/base/Module/index.js.map +1 -1
- package/lib/esm/components/Canvas/index.js +1 -1
- package/lib/esm/components/CanvasMedia/index.js +1 -1
- package/lib/esm/components/Cursor/index.js +28 -13
- package/lib/esm/components/Cursor/index.js.map +1 -1
- package/lib/esm/components/InView/index.js +1 -1
- package/lib/esm/components/Marquee/index.js +1 -1
- package/lib/esm/components/Pointers/index.js +4 -1
- package/lib/esm/components/Pointers/index.js.map +1 -1
- package/lib/esm/components/Preloader/index.js +1 -1
- package/lib/esm/components/ProgressPreloader/index.js +1 -1
- package/lib/esm/components/Raf/index.js +1 -1
- package/lib/esm/components/ScrollProgress/index.js +1 -1
- package/lib/esm/components/Scrollbar/index.js +2 -1
- package/lib/esm/components/Scrollbar/index.js.map +1 -1
- package/lib/esm/components/Snap/Slide/index.js +1 -0
- package/lib/esm/components/Snap/Slide/index.js.map +1 -1
- package/lib/esm/components/Snap/Swipe/index.js +104 -23
- package/lib/esm/components/Snap/Swipe/index.js.map +1 -1
- package/lib/esm/components/Snap/Track/index.js +12 -1
- package/lib/esm/components/Snap/Track/index.js.map +1 -1
- package/lib/esm/components/Snap/Wheel/index.js +224 -55
- package/lib/esm/components/Snap/Wheel/index.js.map +1 -1
- package/lib/esm/components/Snap/index.js +84 -29
- package/lib/esm/components/Snap/index.js.map +1 -1
- package/lib/esm/components/SplitText/index.js +1 -1
- package/lib/esm/components/Swipe/index.js +93 -43
- package/lib/esm/components/Swipe/index.js.map +1 -1
- package/lib/esm/components/Timeline/index.js +1 -1
- package/lib/esm/internal/mergeWithNoUndefined.js +10 -0
- package/lib/esm/internal/mergeWithNoUndefined.js.map +1 -0
- package/lib/esm/manifest.json +1 -1
- package/lib/esm/utils/common/toPixels.js +3 -0
- package/lib/esm/utils/common/toPixels.js.map +1 -1
- package/lib/esm/utils/listeners/onResize.js +1 -1
- package/lib/esm/utils/listeners/onResize.js.map +1 -1
- package/lib/esm/utils/math/clamp.js +3 -1
- package/lib/esm/utils/math/clamp.js.map +1 -1
- package/lib/esm/utils/math/inRange.js +4 -4
- package/lib/types/base/Module/index.d.ts.map +1 -1
- package/lib/types/components/Canvas/index.d.ts +1 -1
- package/lib/types/components/CanvasMedia/index.d.ts +1 -1
- package/lib/types/components/Cursor/index.d.ts +5 -1
- package/lib/types/components/Cursor/index.d.ts.map +1 -1
- package/lib/types/components/InView/index.d.ts +1 -1
- package/lib/types/components/Marquee/index.d.ts +1 -1
- package/lib/types/components/Pointers/index.d.ts +1 -1
- package/lib/types/components/Pointers/index.d.ts.map +1 -1
- package/lib/types/components/Preloader/index.d.ts +1 -1
- package/lib/types/components/ProgressPreloader/index.d.ts +1 -1
- package/lib/types/components/Raf/index.d.ts +1 -1
- package/lib/types/components/ScrollProgress/index.d.ts +1 -1
- package/lib/types/components/Scrollbar/index.d.ts +1 -1
- package/lib/types/components/Scrollbar/index.d.ts.map +1 -1
- package/lib/types/components/Snap/Slide/index.d.ts.map +1 -1
- package/lib/types/components/Snap/Swipe/index.d.ts +12 -1
- package/lib/types/components/Snap/Swipe/index.d.ts.map +1 -1
- package/lib/types/components/Snap/Swipe/types.d.ts +10 -0
- package/lib/types/components/Snap/Swipe/types.d.ts.map +1 -1
- package/lib/types/components/Snap/Track/index.d.ts +2 -0
- package/lib/types/components/Snap/Track/index.d.ts.map +1 -1
- package/lib/types/components/Snap/Wheel/index.d.ts +28 -6
- package/lib/types/components/Snap/Wheel/index.d.ts.map +1 -1
- package/lib/types/components/Snap/Wheel/types.d.ts +9 -3
- package/lib/types/components/Snap/Wheel/types.d.ts.map +1 -1
- package/lib/types/components/Snap/index.d.ts +12 -8
- package/lib/types/components/Snap/index.d.ts.map +1 -1
- package/lib/types/components/Snap/types.d.ts +19 -5
- package/lib/types/components/Snap/types.d.ts.map +1 -1
- package/lib/types/components/SplitText/index.d.ts +1 -1
- package/lib/types/components/Swipe/index.d.ts +3 -7
- package/lib/types/components/Swipe/index.d.ts.map +1 -1
- package/lib/types/components/Swipe/types.d.ts +16 -2
- package/lib/types/components/Swipe/types.d.ts.map +1 -1
- package/lib/types/components/Timeline/index.d.ts +1 -1
- package/lib/types/internal/mergeWithNoUndefined.d.ts +2 -0
- package/lib/types/internal/mergeWithNoUndefined.d.ts.map +1 -0
- package/lib/types/utils/common/toPixels.d.ts.map +1 -1
- package/lib/types/utils/listeners/onResize.d.ts +1 -0
- package/lib/types/utils/listeners/onResize.d.ts.map +1 -1
- package/lib/types/utils/math/clamp.d.ts.map +1 -1
- package/lib/types/utils/math/inRange.d.ts +4 -4
- package/package.json +1 -1
- package/src/base/Module/index.ts +8 -5
- package/src/components/Canvas/index.ts +1 -1
- package/src/components/CanvasMedia/index.ts +1 -1
- package/src/components/Cursor/index.ts +35 -15
- package/src/components/InView/index.ts +1 -1
- package/src/components/Marquee/index.ts +1 -1
- package/src/components/Pointers/index.ts +5 -1
- package/src/components/Preloader/index.ts +1 -1
- package/src/components/ProgressPreloader/index.ts +1 -1
- package/src/components/Raf/index.ts +1 -1
- package/src/components/ScrollProgress/index.ts +1 -1
- package/src/components/Scrollbar/index.ts +2 -1
- package/src/components/Snap/Slide/index.ts +1 -0
- package/src/components/Snap/Swipe/index.ts +138 -25
- package/src/components/Snap/Swipe/types.ts +12 -0
- package/src/components/Snap/Track/index.ts +15 -1
- package/src/components/Snap/Wheel/index.ts +291 -60
- package/src/components/Snap/Wheel/types.ts +10 -3
- package/src/components/Snap/index.ts +81 -39
- package/src/components/Snap/types.ts +24 -5
- package/src/components/SplitText/index.ts +1 -1
- package/src/components/Swipe/index.ts +123 -55
- package/src/components/Swipe/types.ts +20 -2
- package/src/components/Timeline/index.ts +1 -1
- package/src/internal/mergeWithNoUndefined.ts +20 -0
- package/src/manifest.json +1 -1
- package/src/utils/common/toPixels.ts +2 -0
- package/src/utils/listeners/onResize.ts +2 -1
- package/src/utils/math/clamp.ts +4 -1
- package/src/utils/math/inRange.ts +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module } from '../../base';
|
|
2
2
|
import { Timeline } from '../Timeline';
|
|
3
|
-
import { ISnapCallbacksMap, ISnapMagnet, ISnapMutableProps, ISnapNexPrevArg, ISnapStaticProps, ISnapToSlideArg } from './types';
|
|
3
|
+
import { ISnapCallbacksMap, ISnapMagnet, ISnapMutableProps, ISnapNexPrevArg, ISnapStaticProps, ISnapToSlideArg, ISnapTransitionArg } from './types';
|
|
4
4
|
import { TRequiredProps } from '../../internal/requiredProps';
|
|
5
5
|
import { Raf } from '../Raf';
|
|
6
6
|
import { IOnResize } from '../../utils';
|
|
@@ -17,7 +17,7 @@ export * from './Slide';
|
|
|
17
17
|
*
|
|
18
18
|
* Please not that the class does not apply any styles to the slides, it only handles the logic.
|
|
19
19
|
*
|
|
20
|
-
* [Documentation](https://
|
|
20
|
+
* [Documentation](https://vevetjs.com/docs/Snap)
|
|
21
21
|
*
|
|
22
22
|
* @group Components
|
|
23
23
|
*/
|
|
@@ -80,12 +80,14 @@ export declare class Snap<CallbacksMap extends ISnapCallbacksMap = ISnapCallback
|
|
|
80
80
|
get track(): SnapTrack;
|
|
81
81
|
/** If transition in progress */
|
|
82
82
|
get isTransitioning(): boolean;
|
|
83
|
+
/** If swipe in progress */
|
|
84
|
+
get isSwiping(): boolean;
|
|
83
85
|
/** Reflow: update static values of slides */
|
|
84
86
|
protected _reflow(): void;
|
|
85
87
|
/** Handle RAF update, interpolate track values */
|
|
86
88
|
protected _handleRaf(): void;
|
|
87
|
-
/** Render slides
|
|
88
|
-
|
|
89
|
+
/** Render slides */
|
|
90
|
+
render(frameDuration?: number): void;
|
|
89
91
|
/** Update slides values */
|
|
90
92
|
protected _updateSlidesCoords(): void;
|
|
91
93
|
/** Get first slide size */
|
|
@@ -94,18 +96,20 @@ export declare class Snap<CallbacksMap extends ISnapCallbacksMap = ISnapCallback
|
|
|
94
96
|
protected _updateSlidesProgress(): void;
|
|
95
97
|
/** Get nearest magnet */
|
|
96
98
|
protected get magnet(): ISnapMagnet | undefined;
|
|
99
|
+
/** Get nearest magnet to the current position */
|
|
100
|
+
getNearestMagnet(coord: number): ISnapMagnet | undefined;
|
|
97
101
|
/** Cancel sticky behavior */
|
|
98
102
|
cancelTransition(): void;
|
|
99
103
|
/** Stick to the nearest magnet */
|
|
100
104
|
stick(): void;
|
|
101
105
|
/** Go to a definite coordinate */
|
|
102
|
-
toCoord(coordinate: number,
|
|
106
|
+
toCoord(coordinate: number, options?: ISnapTransitionArg): boolean;
|
|
103
107
|
/** Go to a slide by index */
|
|
104
|
-
toSlide(targetIndex: number, { direction,
|
|
108
|
+
toSlide(targetIndex: number, { direction, ...options }?: ISnapToSlideArg): boolean;
|
|
105
109
|
/** Go to next slide */
|
|
106
|
-
next({
|
|
110
|
+
next({ skip, ...options }?: ISnapNexPrevArg): boolean;
|
|
107
111
|
/** Go to previous slide */
|
|
108
|
-
prev({
|
|
112
|
+
prev({ skip, ...options }?: ISnapNexPrevArg): boolean;
|
|
109
113
|
/**
|
|
110
114
|
* Destroys the component and clears all timeouts and resources.
|
|
111
115
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Snap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","s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kDAAkD;IAClD,SAAS,CAAC,UAAU;IAyBpB,oBAAoB;IACb,MAAM,CAAC,aAAa,SAAI;IAuD/B,2BAA2B;IAC3B,SAAS,CAAC,mBAAmB;IAiC7B,2BAA2B;IAC3B,IAAI,cAAc,WAEjB;IAED,6BAA6B;IAC7B,SAAS,CAAC,qBAAqB;IAiB/B,yBAAyB;IACzB,SAAS,KAAK,MAAM,IAAI,WAAW,GAAG,SAAS,CAI9C;IAED,iDAAiD;IAC1C,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAkB/D,6BAA6B;IACtB,gBAAgB;IAKvB,kCAAkC;IAC3B,KAAK;IAUZ,kCAAkC;IAC3B,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB;IAgE/D,6BAA6B;IACtB,OAAO,CACZ,WAAW,EAAE,MAAM,EACnB,EAAE,SAAgB,EAAE,GAAG,OAAO,EAAE,GAAE,eAAoB;IA+DxD,uBAAuB;IAChB,IAAI,CAAC,EAAE,IAAQ,EAAE,GAAG,OAAO,EAAE,GAAE,eAAoB;IAU1D,2BAA2B;IACpB,IAAI,CAAC,EAAE,IAAQ,EAAE,GAAG,OAAO,EAAE,GAAE,eAAoB;IAU1D;;OAEG;IACH,SAAS,CAAC,QAAQ;CAWnB"}
|
|
@@ -53,10 +53,10 @@ export interface ISnapMutableProps extends IModuleMutableProps, ISnapWheelProps,
|
|
|
53
53
|
*/
|
|
54
54
|
lerp?: number;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* Enables freemode, with or without sticky magnets.
|
|
57
57
|
* @default false
|
|
58
58
|
*/
|
|
59
|
-
freemode?: boolean;
|
|
59
|
+
freemode?: boolean | 'sticky';
|
|
60
60
|
/**
|
|
61
61
|
* Stick to the nearest slide on window resize
|
|
62
62
|
* @default true
|
|
@@ -66,7 +66,7 @@ export interface ISnapMutableProps extends IModuleMutableProps, ISnapWheelProps,
|
|
|
66
66
|
* Friction that makes the slides tend to the nearest slide magnet. The value is a number between 0 and 1
|
|
67
67
|
* which is multiplied by the `lerp` value.
|
|
68
68
|
* 0 disables friction
|
|
69
|
-
* @default 0
|
|
69
|
+
* @default 0
|
|
70
70
|
*/
|
|
71
71
|
friction?: number;
|
|
72
72
|
/**
|
|
@@ -127,6 +127,14 @@ export interface ISnapCallbacksMap extends IModuleCallbacksMap {
|
|
|
127
127
|
timelineUpdate: ITimelineProgressArg;
|
|
128
128
|
/** Fired on timeline animation end */
|
|
129
129
|
timelineEnd: undefined;
|
|
130
|
+
/** Fired on inertia start */
|
|
131
|
+
swipeInertiaStart: undefined;
|
|
132
|
+
/** Fired on inertia end */
|
|
133
|
+
swipeInertiaEnd: undefined;
|
|
134
|
+
/** Fired on inertia cancel */
|
|
135
|
+
swipeInertiaCancel: undefined;
|
|
136
|
+
/** Fired on inertia fail */
|
|
137
|
+
swipeInertiaFail: undefined;
|
|
130
138
|
}
|
|
131
139
|
export type TSnapDuration = number | ((distance: number) => number);
|
|
132
140
|
export interface ISnapMagnet {
|
|
@@ -137,11 +145,17 @@ export interface ISnapMagnet {
|
|
|
137
145
|
/** Difference with current coordinate */
|
|
138
146
|
diff: number;
|
|
139
147
|
}
|
|
140
|
-
export interface
|
|
148
|
+
export interface ISnapTransitionArg {
|
|
141
149
|
duration?: TSnapDuration;
|
|
150
|
+
easing?: TEasingType;
|
|
151
|
+
onStart?: () => void;
|
|
152
|
+
onUpdate?: (data: ITimelineProgressArg) => void;
|
|
153
|
+
onEnd?: () => void;
|
|
154
|
+
}
|
|
155
|
+
export interface ISnapNexPrevArg extends ISnapTransitionArg {
|
|
142
156
|
skip?: number;
|
|
143
157
|
}
|
|
144
|
-
export interface ISnapToSlideArg {
|
|
158
|
+
export interface ISnapToSlideArg extends ISnapTransitionArg {
|
|
145
159
|
direction?: 'next' | 'prev' | null;
|
|
146
160
|
duration?: TSnapDuration;
|
|
147
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Snap/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,+CAA+C;AAC/C,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,sBAAsB;IACtB,SAAS,EAAE,WAAW,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,gDAAgD;AAChD,MAAM,WAAW,iBACf,SAAQ,mBAAmB,EACzB,eAAe,EACf,eAAe;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,GAAG,SAAS,CAAC,EAAE,GAAG,KAAK,CAAC;IAE7C;;;OAGG;IACH,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAEtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types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AC5B,gBAAgB,EAAE,SAAS,CAAC;CAC7B;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,YAAY;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B"}
|
|
@@ -15,7 +15,7 @@ export * from './types';
|
|
|
15
15
|
*
|
|
16
16
|
* **Note**: Apply `fontKerning: none` to prevent layout shifts.
|
|
17
17
|
*
|
|
18
|
-
* [Documentation](https://
|
|
18
|
+
* [Documentation](https://vevetjs.com/docs/SplitText)
|
|
19
19
|
*
|
|
20
20
|
* @group Components
|
|
21
21
|
*/
|
|
@@ -14,7 +14,7 @@ export * from './types';
|
|
|
14
14
|
* - Does not transform elements, only computes coordinates.
|
|
15
15
|
* - Does not persist state after swipe completion.
|
|
16
16
|
*
|
|
17
|
-
* [Documentation](https://
|
|
17
|
+
* [Documentation](https://vevetjs.com/docs/Swipe)
|
|
18
18
|
*
|
|
19
19
|
* @group Components
|
|
20
20
|
*/
|
|
@@ -78,16 +78,12 @@ export declare class Swipe<CallbacksMap extends ISwipeCallbacksMap = ISwipeCallb
|
|
|
78
78
|
protected _handleEnd(): void;
|
|
79
79
|
/** Reset swipe states */
|
|
80
80
|
protected _reset(): void;
|
|
81
|
+
/** Returns current velocity */
|
|
82
|
+
protected get velocity(): ISwipeMatrix;
|
|
81
83
|
/** Apply inertia-based movement */
|
|
82
84
|
protected _endWithInertia(): void;
|
|
83
85
|
/** Destroy inertia animation */
|
|
84
86
|
cancelInertia(): void;
|
|
85
|
-
/** Returns current velocity */
|
|
86
|
-
protected get velocity(): {
|
|
87
|
-
x: number;
|
|
88
|
-
y: number;
|
|
89
|
-
angle: number;
|
|
90
|
-
} | undefined;
|
|
91
87
|
/** Start coordinate */
|
|
92
88
|
get start(): ISwipeMatrix;
|
|
93
89
|
/** Previous coordinate */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Swipe/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,cAAc,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Swipe/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,YAAY,EAC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 -95,7 +95,7 @@ export interface ISwipeMutableProps extends IModuleMutableProps {
|
|
|
95
95
|
inertia?: boolean;
|
|
96
96
|
/**
|
|
97
97
|
* Inertia duration.
|
|
98
|
-
* @default `(distance) => clamp(distance,
|
|
98
|
+
* @default `(distance) => clamp(distance, 500, 2000)`
|
|
99
99
|
*/
|
|
100
100
|
inertiaDuration?: (distance: number) => number;
|
|
101
101
|
/**
|
|
@@ -103,11 +103,21 @@ export interface ISwipeMutableProps extends IModuleMutableProps {
|
|
|
103
103
|
* @default EaseOutCubic
|
|
104
104
|
*/
|
|
105
105
|
inertiaEasing?: TEasingType;
|
|
106
|
+
/**
|
|
107
|
+
* Final velocity modifier.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
velocityModifier?: false | ((velocity: ISwipeMatrix) => ISwipeMatrix);
|
|
106
111
|
/**
|
|
107
112
|
* Inertia strength.
|
|
108
|
-
* @default
|
|
113
|
+
* @default 1
|
|
109
114
|
*/
|
|
110
115
|
inertiaRatio?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Minimum calculated distance to trigger inertia.
|
|
118
|
+
* @default 50
|
|
119
|
+
*/
|
|
120
|
+
inertiaDistanceThreshold?: number;
|
|
111
121
|
}
|
|
112
122
|
export interface ISwipeCallbacksMap extends IModuleCallbacksMap {
|
|
113
123
|
/** Swipe start event. */
|
|
@@ -140,6 +150,10 @@ export interface ISwipeCallbacksMap extends IModuleCallbacksMap {
|
|
|
140
150
|
inertia: undefined;
|
|
141
151
|
/** Triggered on inertia end. */
|
|
142
152
|
inertiaEnd: undefined;
|
|
153
|
+
/** Triggered when inertia fails to start because of lack of momentum. */
|
|
154
|
+
inertiaFail: undefined;
|
|
155
|
+
/** Triggered when inertia is cancelled. */
|
|
156
|
+
inertiaCancel: undefined;
|
|
143
157
|
}
|
|
144
158
|
export interface ISwipeVec2 {
|
|
145
159
|
x: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceR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C;IAChC,UAAU,EAAE,SAAS,CAAC;IAEtB,yEAAyE;IACzE,WAAW,EAAE,SAAS,CAAC;IAEvB,2CAA2C;IAC3C,aAAa,EAAE,SAAS,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,KAAK,EAAE,YAAY,CAAC;IACpB,yBAAyB;IACzB,IAAI,EAAE,YAAY,CAAC;IACnB,wBAAwB;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,kCAAkC;IAClC,IAAI,EAAE,YAAY,CAAC;IACnB,8CAA8C;IAC9C,IAAI,EAAE,YAAY,CAAC;IACnB,kCAAkC;IAClC,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
|
@@ -6,7 +6,7 @@ export * from './types';
|
|
|
6
6
|
* A timeline class for managing animations with easing and precise progress control.
|
|
7
7
|
* It provides methods for playing, reversing, pausing, and resetting the timeline.
|
|
8
8
|
*
|
|
9
|
-
* [Documentation](https://
|
|
9
|
+
* [Documentation](https://vevetjs.com/docs/Timeline)
|
|
10
10
|
*
|
|
11
11
|
* @group Components
|
|
12
12
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeWithNoUndefined.d.ts","sourceRoot":"","sources":["../../../src/internal/mergeWithNoUndefined.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,mCAgBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPixels.d.ts","sourceRoot":"","sources":["../../../../src/utils/common/toPixels.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,oBAAoB,EAAE,MAAM,CAAC;KAC9B;CACF;AAID;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"toPixels.d.ts","sourceRoot":"","sources":["../../../../src/utils/common/toPixels.ts"],"names":[],"mappings":"AAEA,KAAK,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,oBAAoB,EAAE,MAAM,CAAC;KAC9B;CACF;AAID;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,UA4C9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onResize.d.ts","sourceRoot":"","sources":["../../../../src/utils/listeners/onResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,MAAM,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAErC
|
|
1
|
+
{"version":3,"file":"onResize.d.ts","sourceRoot":"","sources":["../../../../src/utils/listeners/onResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,MAAM,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAErC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,qBAAqB,CAAC;IAE7C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB;;OAEG;IACH,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,OAAO,EACP,cAAwB,EACxB,cAAkB,EAClB,IAAI,GACL,EAAE,cAAc,GAAG,SAAS,CAsD5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../../../../src/utils/math/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAI,EAAE,GAAG,SAAI,
|
|
1
|
+
{"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../../../../src/utils/math/clamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAI,EAAE,GAAG,SAAI,UAKpD"}
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
* @group Utils
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
*
|
|
12
|
+
* inRange(0, 0, 1);
|
|
13
13
|
* // => true (0 is within the range [0, 1])
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* inRange(1, 0, 1);
|
|
16
16
|
* // => true (1 is within the range [0, 1])
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* inRange(2, 0, 1);
|
|
19
19
|
* // => false (2 is outside the range [0, 1])
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* inRange(-1, 0, 1);
|
|
22
22
|
* // => false (-1 is outside the range [0, 1])
|
|
23
23
|
*/
|
|
24
24
|
export declare function inRange(value: number, min?: number, max?: number): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vevet",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"storybook": "storybook dev -p 6006",
|
package/src/base/Module/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
IModuleMutableProps,
|
|
6
6
|
IModuleStaticProps,
|
|
7
7
|
} from './types';
|
|
8
|
+
import { mergeWithNoUndefined } from '@/internal/mergeWithNoUndefined';
|
|
8
9
|
|
|
9
10
|
// todo: jsdoc
|
|
10
11
|
|
|
@@ -79,11 +80,13 @@ export class Module<
|
|
|
79
80
|
constructor(props?: StaticProps & MutableProps) {
|
|
80
81
|
this._callbacks = new Callbacks();
|
|
81
82
|
|
|
82
|
-
this._props =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
this._props = mergeWithNoUndefined(
|
|
84
|
+
{
|
|
85
|
+
...this._getStatic(),
|
|
86
|
+
...this._getMutable(),
|
|
87
|
+
},
|
|
88
|
+
{ ...props },
|
|
89
|
+
) as TRequiredProps<MutableProps & StaticProps>;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
/**
|
|
@@ -14,7 +14,7 @@ export * from './types';
|
|
|
14
14
|
/**
|
|
15
15
|
* A class for managing an HTML5 Canvas element and its 2D context.
|
|
16
16
|
*
|
|
17
|
-
* [Documentation](https://
|
|
17
|
+
* [Documentation](https://vevetjs.com/docs/Canvas)
|
|
18
18
|
*
|
|
19
19
|
* @group Components
|
|
20
20
|
*/
|
|
@@ -14,7 +14,7 @@ export * from './types';
|
|
|
14
14
|
* The `CanvasMedia` class allows pre-rendering of media (such as images or video) onto a canvas.
|
|
15
15
|
* This can be useful for reducing payloads by preparing the media for further use in a more optimized form.
|
|
16
16
|
*
|
|
17
|
-
* [Documentation](https://
|
|
17
|
+
* [Documentation](https://vevetjs.com/docs/CanvasMedia)
|
|
18
18
|
*
|
|
19
19
|
* @group Components
|
|
20
20
|
*/
|
|
@@ -20,7 +20,7 @@ export * from './types';
|
|
|
20
20
|
* A customizable custom cursor component with smooth animations and hover interactions.
|
|
21
21
|
* Supports dynamic appearance changes and enhanced user interaction.
|
|
22
22
|
*
|
|
23
|
-
* [Documentation](https://
|
|
23
|
+
* [Documentation](https://vevetjs.com/docs/Cursor)
|
|
24
24
|
*
|
|
25
25
|
* @group Components
|
|
26
26
|
*/
|
|
@@ -377,24 +377,22 @@ export class Cursor<
|
|
|
377
377
|
* @returns Returns a destructor
|
|
378
378
|
*/
|
|
379
379
|
public attachElement(settings: ICursorHoveredElement, enterTimeout = 100) {
|
|
380
|
-
const
|
|
380
|
+
const data: ICursorHoveredElement = {
|
|
381
381
|
width: null,
|
|
382
382
|
height: null,
|
|
383
383
|
...settings,
|
|
384
384
|
};
|
|
385
385
|
|
|
386
|
-
const { element } =
|
|
386
|
+
const { element } = data;
|
|
387
387
|
|
|
388
388
|
let timeout: NodeJS.Timeout | undefined;
|
|
389
389
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
390
|
+
if (element.matches(':hover')) {
|
|
391
|
+
this._handleElementEnter(data);
|
|
392
|
+
}
|
|
393
393
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
}, enterTimeout);
|
|
394
|
+
const mouseEnter = addEventListener(element, 'mouseenter', () => {
|
|
395
|
+
timeout = setTimeout(() => this._handleElementEnter(data), enterTimeout);
|
|
398
396
|
});
|
|
399
397
|
|
|
400
398
|
const mouseLeave = addEventListener(element, 'mouseleave', () => {
|
|
@@ -402,11 +400,7 @@ export class Cursor<
|
|
|
402
400
|
clearTimeout(timeout);
|
|
403
401
|
}
|
|
404
402
|
|
|
405
|
-
this.
|
|
406
|
-
|
|
407
|
-
if (final.type) {
|
|
408
|
-
this._toggleType(final.type, false);
|
|
409
|
-
}
|
|
403
|
+
this._handleElementLeave(data);
|
|
410
404
|
});
|
|
411
405
|
|
|
412
406
|
const remove = () => {
|
|
@@ -427,6 +421,32 @@ export class Cursor<
|
|
|
427
421
|
return () => remove();
|
|
428
422
|
}
|
|
429
423
|
|
|
424
|
+
/** Handle element enter */
|
|
425
|
+
protected _handleElementEnter(data: ICursorHoveredElement) {
|
|
426
|
+
this.hoveredElement = { ...data };
|
|
427
|
+
|
|
428
|
+
if (data.type) {
|
|
429
|
+
this._toggleType(data.type, true);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (this.props.enabled) {
|
|
433
|
+
this._raf.play();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** Handle element leave */
|
|
438
|
+
protected _handleElementLeave(data: ICursorHoveredElement) {
|
|
439
|
+
this.hoveredElement = undefined;
|
|
440
|
+
|
|
441
|
+
if (data.type) {
|
|
442
|
+
this._toggleType(data.type, false);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (this.props.enabled) {
|
|
446
|
+
this._raf.play();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
430
450
|
/**
|
|
431
451
|
* Registers a cursor type.
|
|
432
452
|
*/
|
|
@@ -15,7 +15,7 @@ export * from './types';
|
|
|
15
15
|
* InView is a visibility detection utility that leverages the `IntersectionObserver` API to monitor when elements enter or leave the viewport.
|
|
16
16
|
* It provides customizable options for triggering events, delaying visibility changes, and dynamically adding CSS classes to elements based on their visibility state.
|
|
17
17
|
*
|
|
18
|
-
* [Documentation](https://
|
|
18
|
+
* [Documentation](https://vevetjs.com/docs/InView)
|
|
19
19
|
*
|
|
20
20
|
* @group Components
|
|
21
21
|
*/
|
|
@@ -19,7 +19,7 @@ export * from './types';
|
|
|
19
19
|
* This component is designed to loop elements horizontally within a container,
|
|
20
20
|
* with support for customization such as speed, gap, pause on hover, and more.
|
|
21
21
|
*
|
|
22
|
-
* [Documentation](https://
|
|
22
|
+
* [Documentation](https://vevetjs.com/docs/Marquee)
|
|
23
23
|
*
|
|
24
24
|
* @group Components
|
|
25
25
|
*/
|
|
@@ -19,7 +19,7 @@ export * from './types';
|
|
|
19
19
|
* For proper functionality, ensure the container has an appropriate
|
|
20
20
|
* [touch-action](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) property.
|
|
21
21
|
*
|
|
22
|
-
* [Documentation](https://
|
|
22
|
+
* [Documentation](https://vevetjs.com/docs/Pointers)
|
|
23
23
|
*
|
|
24
24
|
* @group Components
|
|
25
25
|
*/
|
|
@@ -259,6 +259,10 @@ export class Pointers<
|
|
|
259
259
|
pointer.prev = { ...pointer.current };
|
|
260
260
|
pointer.current = { x, y };
|
|
261
261
|
|
|
262
|
+
// Update diff
|
|
263
|
+
pointer.diff.x = pointer.current.x - pointer.start.x;
|
|
264
|
+
pointer.diff.y = pointer.current.y - pointer.start.y;
|
|
265
|
+
|
|
262
266
|
// Update step
|
|
263
267
|
pointer.step.x = pointer.current.x - pointer.prev.x;
|
|
264
268
|
pointer.step.y = pointer.current.y - pointer.prev.y;
|
|
@@ -14,7 +14,7 @@ export * from './types';
|
|
|
14
14
|
* Page preloader component that manages the visibility and lifecycle of a loading screen.
|
|
15
15
|
* The module does not provide styling for the container.
|
|
16
16
|
*
|
|
17
|
-
* [Documentation](https://
|
|
17
|
+
* [Documentation](https://vevetjs.com/docs/Preloader)
|
|
18
18
|
*
|
|
19
19
|
* @group Components
|
|
20
20
|
*/
|
|
@@ -22,7 +22,7 @@ const PAGE_RESOURCE = `vevet-page-${Math.random()}`;
|
|
|
22
22
|
* Page preloader for calculating and displaying the loading progress of resources (images, videos, custom elements).
|
|
23
23
|
* Provides smooth progress transitions.
|
|
24
24
|
*
|
|
25
|
-
* [Documentation](https://
|
|
25
|
+
* [Documentation](https://vevetjs.com/docs/ProgressPreloader)
|
|
26
26
|
*
|
|
27
27
|
* @group Components
|
|
28
28
|
*/
|
|
@@ -7,7 +7,7 @@ export * from './types';
|
|
|
7
7
|
/**
|
|
8
8
|
* Manages an animation frame loop with configurable FPS and playback controls.
|
|
9
9
|
*
|
|
10
|
-
* [Documentation](https://
|
|
10
|
+
* [Documentation](https://vevetjs.com/docs/Raf)
|
|
11
11
|
*
|
|
12
12
|
* @group Components
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@ export * from './types';
|
|
|
16
16
|
*
|
|
17
17
|
* This component can be used for creating scroll-based animations such as parallax effects.
|
|
18
18
|
*
|
|
19
|
-
* [Documentation](https://
|
|
19
|
+
* [Documentation](https://vevetjs.com/docs/ScrollProgress)
|
|
20
20
|
*
|
|
21
21
|
* @group Components
|
|
22
22
|
*/
|
|
@@ -15,7 +15,7 @@ export * from './types';
|
|
|
15
15
|
/**
|
|
16
16
|
* A custom scrollbar component. Supports both `window` and `HTMLElement` containers.
|
|
17
17
|
*
|
|
18
|
-
* [Documentation](https://
|
|
18
|
+
* [Documentation](https://vevetjs.com/docs/Scrollbar)
|
|
19
19
|
*
|
|
20
20
|
* @group Components
|
|
21
21
|
*/
|
|
@@ -288,6 +288,7 @@ export class Scrollbar<
|
|
|
288
288
|
|
|
289
289
|
return onResize({
|
|
290
290
|
element: [this.track, this.parent, this.scrollElement, ...children],
|
|
291
|
+
viewportTarget: 'width',
|
|
291
292
|
resizeDebounce: this.props.resizeDebounce,
|
|
292
293
|
callback: () => this.resize(),
|
|
293
294
|
});
|