vevet 5.0.11 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -17
- 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 +93 -37
- 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 +241 -65
- package/lib/cjs/components/Snap/Wheel/index.js.map +1 -1
- package/lib/cjs/components/Snap/index.js +75 -39
- 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 +14 -7
- package/lib/cjs/components/Swipe/index.js.map +1 -1
- package/lib/cjs/components/Timeline/index.js +6 -2
- package/lib/cjs/components/Timeline/index.js.map +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/closest.js +3 -0
- package/lib/cjs/utils/common/closest.js.map +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/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 +92 -36
- 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 +218 -66
- package/lib/esm/components/Snap/Wheel/index.js.map +1 -1
- package/lib/esm/components/Snap/index.js +62 -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 +14 -7
- package/lib/esm/components/Swipe/index.js.map +1 -1
- package/lib/esm/components/Timeline/index.js +6 -2
- package/lib/esm/components/Timeline/index.js.map +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/closest.js +3 -0
- package/lib/esm/utils/common/closest.js.map +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/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 +10 -1
- package/lib/types/components/Snap/Swipe/index.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 +6 -6
- 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 +1 -1
- package/lib/types/components/Swipe/index.d.ts.map +1 -1
- package/lib/types/components/Swipe/types.d.ts +9 -0
- package/lib/types/components/Swipe/types.d.ts.map +1 -1
- package/lib/types/components/Timeline/index.d.ts +1 -1
- package/lib/types/components/Timeline/index.d.ts.map +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/closest.d.ts.map +1 -1
- 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/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 +121 -49
- package/src/components/Snap/Track/index.ts +15 -1
- package/src/components/Snap/Wheel/index.ts +285 -73
- package/src/components/Snap/Wheel/types.ts +7 -7
- package/src/components/Snap/index.ts +54 -38
- package/src/components/Snap/types.ts +24 -5
- package/src/components/SplitText/index.ts +1 -1
- package/src/components/Swipe/index.ts +25 -7
- package/src/components/Swipe/types.ts +12 -0
- package/src/components/Timeline/index.ts +8 -2
- package/src/internal/mergeWithNoUndefined.ts +20 -0
- package/src/manifest.json +1 -1
- package/src/utils/common/closest.ts +4 -0
- package/src/utils/common/toPixels.ts +2 -0
- package/src/utils/listeners/onResize.ts +2 -1
- package/src/utils/math/inRange.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/Swipe/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,gCAAgC;IAChC,SAAS,EAAE,WAAW,GAAG,UAAU,CAAC;IAEpC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC;IAEjD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,gBAAgB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
|
@@ -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
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Timeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAGjB,cAAc,SAAS,CAAC;AAExB;;;;;;;GAOG;AACH,qBAAa,QAAQ,CACnB,YAAY,SAAS,qBAAqB,GAAG,qBAAqB,EAClE,WAAW,SAAS,oBAAoB,GAAG,oBAAoB,EAC/D,YAAY,SAAS,qBAAqB,GAAG,qBAAqB,CAClE,SAAQ,MAAM,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;IACvD,qCAAqC;IAC9B,UAAU,IAAI,cAAc,CAAC,WAAW,CAAC;IAIhD,sCAAsC;IAC/B,WAAW,IAAI,cAAc,CAAC,YAAY,CAAC;IAQlD,wDAAwD;IACxD,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,IAAI,QAAQ,IAIM,MAAM,CAFvB;IAED,IAAI,QAAQ,CAAC,GAAG,EAAE,MAAM,EAIvB;IAED,+EAA+E;IAC/E,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,IAAI,KAAK,WAER;IAED,4DAA4D;IAC5D,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAExB,qDAAqD;IAC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M,CAAC;IAExB,qDAAqD;IACrD,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,IAAI,SAAS,YAEZ;IAED,4DAA4D;IAC5D,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,IAAI,UAAU,YAEb;IAED,gDAAgD;IAChD,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,IAAI,QAAQ,YAEX;IAED;;OAEG;IACH,IAAI,QAAQ,WAQX;gBAEW,KAAK,CAAC,EAAE,WAAW,GAAG,YAAY;IAY9C;;;OAGG;IACI,IAAI;IAcX;;;OAGG;IACI,OAAO;IAcd;;OAEG;IACI,KAAK;IAcZ;;OAEG;IACI,KAAK;IASZ;;OAEG;IACH,SAAS,CAAC,QAAQ;IAqClB;;OAEG;IACH,SAAS,CAAC,SAAS;IAmBnB;;OAEG;IACH,SAAS,CAAC,QAAQ;CAKnB"}
|
|
@@ -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":"closest.d.ts","sourceRoot":"","sources":["../../../../src/utils/common/closest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"closest.d.ts","sourceRoot":"","sources":["../../../../src/utils/common/closest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAQvD"}
|
|
@@ -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"}
|
|
@@ -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.
|
|
3
|
+
"version": "5.1.1",
|
|
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
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Snap } from '..';
|
|
2
|
-
import { ISwipeCoords, Swipe } from '@/components/Swipe';
|
|
2
|
+
import { ISwipeCoords, ISwipeMatrix, Swipe } from '@/components/Swipe';
|
|
3
3
|
import { clamp } from '@/utils';
|
|
4
4
|
|
|
5
5
|
export class SnapSwipe {
|
|
@@ -15,44 +15,32 @@ export class SnapSwipe {
|
|
|
15
15
|
constructor(protected snap: Snap) {
|
|
16
16
|
snap.on('destroy', () => this._destroy(), { protected: true });
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const { props, activeIndex } = snap;
|
|
19
|
+
|
|
20
|
+
this._startIndex = activeIndex;
|
|
19
21
|
this._startTime = 0;
|
|
20
22
|
|
|
21
23
|
this._swipe = new Swipe({
|
|
22
24
|
container: snap.eventsEmitter,
|
|
23
|
-
enabled:
|
|
24
|
-
grabCursor:
|
|
25
|
-
minTime:
|
|
26
|
-
threshold:
|
|
25
|
+
enabled: props.swipe,
|
|
26
|
+
grabCursor: props.grabCursor,
|
|
27
|
+
minTime: props.swipeMinTime,
|
|
28
|
+
threshold: props.swipeThreshold,
|
|
27
29
|
axis: this.axis,
|
|
28
|
-
inertia:
|
|
29
|
-
inertiaDuration:
|
|
30
|
-
inertiaRatio:
|
|
31
|
-
velocityModifier: (
|
|
32
|
-
|
|
33
|
-
return source;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const { coord, size: slideSize } = snap.activeSlide;
|
|
37
|
-
|
|
38
|
-
snap.track.target = snap.track.current;
|
|
39
|
-
|
|
40
|
-
const output = {
|
|
41
|
-
...source,
|
|
42
|
-
[this.axis]: clamp(
|
|
43
|
-
source[this.axis],
|
|
44
|
-
-coord,
|
|
45
|
-
snap.domSize - slideSize - coord,
|
|
46
|
-
),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return output;
|
|
50
|
-
},
|
|
30
|
+
inertia: false,
|
|
31
|
+
inertiaDuration: props.swipeInertiaDuration,
|
|
32
|
+
inertiaRatio: props.swipeInertiaRatio,
|
|
33
|
+
velocityModifier: this._handleVelocityModifier.bind(this),
|
|
34
|
+
inertiaDistanceThreshold: 5,
|
|
51
35
|
});
|
|
52
36
|
|
|
53
37
|
this._swipe.on('start', (data) => this._handleSwipeStart(data));
|
|
54
38
|
this._swipe.on('move', (data) => this._handleSwipeMove(data));
|
|
55
39
|
this._swipe.on('end', (data) => this._handleSwipeEnd(data));
|
|
40
|
+
this._swipe.on('inertiaStart', () => this._handleSwipeInertiaStart());
|
|
41
|
+
this._swipe.on('inertiaEnd', () => this._handleSwipeInertiaEnd());
|
|
42
|
+
this._swipe.on('inertiaFail', () => this._handleSwipeInertiaFail());
|
|
43
|
+
this._swipe.on('inertiaCancel', () => this._handleSwipeInertiaCancel());
|
|
56
44
|
|
|
57
45
|
// on props change
|
|
58
46
|
snap.on(
|
|
@@ -64,7 +52,8 @@ export class SnapSwipe {
|
|
|
64
52
|
minTime: snap.props.swipeMinTime,
|
|
65
53
|
threshold: snap.props.swipeThreshold,
|
|
66
54
|
axis: this.axis,
|
|
67
|
-
|
|
55
|
+
inertiaDuration: snap.props.swipeInertiaDuration,
|
|
56
|
+
inertiaRatio: snap.props.swipeInertiaRatio,
|
|
68
57
|
});
|
|
69
58
|
},
|
|
70
59
|
{ protected: true },
|
|
@@ -111,6 +100,47 @@ export class SnapSwipe {
|
|
|
111
100
|
return this.axis === 'x' ? this._swipe.diff.x : this._swipe.diff.y;
|
|
112
101
|
}
|
|
113
102
|
|
|
103
|
+
protected _handleVelocityModifier(source: ISwipeMatrix) {
|
|
104
|
+
const { props, track, activeSlide, domSize } = this.snap;
|
|
105
|
+
const { coord, size: slideSize } = activeSlide;
|
|
106
|
+
|
|
107
|
+
// Simple freemode
|
|
108
|
+
|
|
109
|
+
if (props.freemode === true) {
|
|
110
|
+
return source;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Update target coordinate
|
|
114
|
+
|
|
115
|
+
track.target = track.current;
|
|
116
|
+
|
|
117
|
+
// Sticky freemode
|
|
118
|
+
|
|
119
|
+
if (props.freemode === 'sticky' && !track.isSlideScrolling) {
|
|
120
|
+
const virtualCoord = track.loopedCurrent - source[this.axis];
|
|
121
|
+
|
|
122
|
+
const magnet = this.snap.getNearestMagnet(virtualCoord);
|
|
123
|
+
|
|
124
|
+
if (!magnet) {
|
|
125
|
+
return source;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const newVelocity = track.loopedCurrent - virtualCoord - magnet.diff;
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
...source,
|
|
132
|
+
[this.axis]: newVelocity,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Freemode: false, when slides are scrolled
|
|
137
|
+
|
|
138
|
+
const value = clamp(source[this.axis], -coord, domSize - slideSize - coord);
|
|
139
|
+
const output = { ...source, [this.axis]: value };
|
|
140
|
+
|
|
141
|
+
return output;
|
|
142
|
+
}
|
|
143
|
+
|
|
114
144
|
/**
|
|
115
145
|
* Handles swipe `start` event.
|
|
116
146
|
*/
|
|
@@ -137,30 +167,28 @@ export class SnapSwipe {
|
|
|
137
167
|
*/
|
|
138
168
|
protected _handleSwipeMove(coords: ISwipeCoords) {
|
|
139
169
|
const { snap } = this;
|
|
140
|
-
const {
|
|
170
|
+
const { props, track, callbacks } = snap;
|
|
171
|
+
const { followSwipe: shouldFollow } = props;
|
|
141
172
|
|
|
142
|
-
if (
|
|
143
|
-
!shouldFollow &&
|
|
144
|
-
!snap.props.followSwipe &&
|
|
145
|
-
!snap.track.isSlideScrolling
|
|
146
|
-
) {
|
|
173
|
+
if (!shouldFollow && !track.isSlideScrolling) {
|
|
147
174
|
return;
|
|
148
175
|
}
|
|
149
176
|
|
|
150
|
-
// Normalize
|
|
177
|
+
// Normalize swipe delta
|
|
151
178
|
const swipeDelta = this.axis === 'x' ? coords.step.x : coords.step.y;
|
|
152
|
-
const
|
|
179
|
+
const speed = this.hasInertia ? 1 : props.swipeSpeed;
|
|
180
|
+
const delta = swipeDelta * -speed;
|
|
153
181
|
|
|
154
182
|
// Update track target
|
|
155
|
-
|
|
183
|
+
track.iterateTarget(delta);
|
|
156
184
|
|
|
157
|
-
// Clamp target if inertia
|
|
185
|
+
// Clamp target if inertia is animating
|
|
158
186
|
if (this._swipe.hasInertia) {
|
|
159
|
-
|
|
187
|
+
track.clampTarget();
|
|
160
188
|
}
|
|
161
189
|
|
|
162
190
|
// Emit move callbacks
|
|
163
|
-
|
|
191
|
+
callbacks.emit('swipe', coords);
|
|
164
192
|
}
|
|
165
193
|
|
|
166
194
|
/** Handles swipe `end` event */
|
|
@@ -174,13 +202,46 @@ export class SnapSwipe {
|
|
|
174
202
|
this.snap.callbacks.emit('swipeEnd', coords);
|
|
175
203
|
}
|
|
176
204
|
|
|
205
|
+
/** Handles swipe inertia start */
|
|
206
|
+
protected _handleSwipeInertiaStart() {
|
|
207
|
+
this.snap.callbacks.emit('swipeInertiaStart', undefined);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** Handles swipe inertia end */
|
|
211
|
+
protected _handleSwipeInertiaEnd() {
|
|
212
|
+
this.snap.callbacks.emit('swipeInertiaEnd', undefined);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Handles swipe inertia fail */
|
|
216
|
+
protected _handleSwipeInertiaFail() {
|
|
217
|
+
const { snap } = this;
|
|
218
|
+
|
|
219
|
+
if (snap.props.freemode === 'sticky' && !snap.track.isSlideScrolling) {
|
|
220
|
+
if (this.isShort) {
|
|
221
|
+
this._endShort();
|
|
222
|
+
} else {
|
|
223
|
+
snap.stick();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this.snap.callbacks.emit('swipeInertiaFail', undefined);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Handles swipe inertia cancel */
|
|
231
|
+
protected _handleSwipeInertiaCancel() {
|
|
232
|
+
this.snap.callbacks.emit('swipeInertiaCancel', undefined);
|
|
233
|
+
}
|
|
234
|
+
|
|
177
235
|
/** End swipe action */
|
|
178
236
|
protected _end() {
|
|
179
237
|
const { snap, _swipe: swipe } = this;
|
|
180
238
|
const { props, track } = snap;
|
|
181
239
|
|
|
182
|
-
//
|
|
240
|
+
// Handle freemode
|
|
183
241
|
if (props.freemode) {
|
|
242
|
+
this._swipe.updateProps({ inertia: true });
|
|
243
|
+
|
|
244
|
+
// Clamp & stick if out of bounds
|
|
184
245
|
if (
|
|
185
246
|
!track.canLoop &&
|
|
186
247
|
(track.target < track.min || track.target > track.max)
|
|
@@ -189,32 +250,43 @@ export class SnapSwipe {
|
|
|
189
250
|
snap.stick();
|
|
190
251
|
}
|
|
191
252
|
|
|
253
|
+
// End short swipe
|
|
254
|
+
if (this.isShort && props.freemode === 'sticky') {
|
|
255
|
+
this._swipe.updateProps({ inertia: false });
|
|
256
|
+
swipe.cancelInertia();
|
|
257
|
+
|
|
258
|
+
this._endShort();
|
|
259
|
+
}
|
|
260
|
+
|
|
192
261
|
return;
|
|
193
262
|
}
|
|
194
263
|
|
|
195
|
-
//
|
|
264
|
+
// Enable inertia if active slide is being scrolled
|
|
196
265
|
if (track.isSlideScrolling) {
|
|
197
266
|
this._swipe.updateProps({ inertia: true });
|
|
198
267
|
|
|
199
268
|
return;
|
|
200
269
|
}
|
|
201
270
|
|
|
202
|
-
//
|
|
271
|
+
// Disable inertia
|
|
203
272
|
this._swipe.updateProps({ inertia: false });
|
|
204
273
|
|
|
205
|
-
//
|
|
274
|
+
// Return if followSwipe is disabled
|
|
206
275
|
if (!props.followSwipe) {
|
|
207
276
|
this._endNoFollow();
|
|
208
277
|
|
|
209
278
|
return;
|
|
210
279
|
}
|
|
211
280
|
|
|
212
|
-
//
|
|
281
|
+
// Short swipe
|
|
213
282
|
if (this.isShort) {
|
|
214
283
|
this._endShort();
|
|
215
|
-
|
|
216
|
-
|
|
284
|
+
|
|
285
|
+
return;
|
|
217
286
|
}
|
|
287
|
+
|
|
288
|
+
// Or just stick to the nearest slide
|
|
289
|
+
snap.stick();
|
|
218
290
|
}
|
|
219
291
|
|
|
220
292
|
/** End short swipe */
|
|
@@ -44,7 +44,7 @@ export class SnapTrack {
|
|
|
44
44
|
|
|
45
45
|
/** Get looped current value */
|
|
46
46
|
get loopedCurrent() {
|
|
47
|
-
return this.
|
|
47
|
+
return this.loopCoord(this.current);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/** Get track offset */
|
|
@@ -59,6 +59,11 @@ export class SnapTrack {
|
|
|
59
59
|
return Math.floor(this.current / this.max);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** Loop a coordinate if can loop */
|
|
63
|
+
public loopCoord(coord: number) {
|
|
64
|
+
return this.canLoop ? loop(coord, this.min, this.max) : coord;
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
/** Interpolate the current track value */
|
|
63
68
|
public lerp(factor: number) {
|
|
64
69
|
let { target } = this;
|
|
@@ -83,6 +88,15 @@ export class SnapTrack {
|
|
|
83
88
|
|
|
84
89
|
// Interpolate current value
|
|
85
90
|
|
|
91
|
+
const rest = Math.abs(this.current - target);
|
|
92
|
+
const fastThreshold = 5;
|
|
93
|
+
|
|
94
|
+
if (rest < fastThreshold) {
|
|
95
|
+
const fastProgress = 1 - rest / fastThreshold;
|
|
96
|
+
const additionalFactor = (1 - factor) / 3;
|
|
97
|
+
factor += additionalFactor * fastProgress;
|
|
98
|
+
}
|
|
99
|
+
|
|
86
100
|
this.current = lerp(this.current, target, factor, 0.000001);
|
|
87
101
|
}
|
|
88
102
|
|