vevet 4.3.1 → 4.4.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 (84) hide show
  1. package/lib/cjs/components/CustomScrollDragPlugin/index.js +3 -0
  2. package/lib/cjs/components/CustomScrollDragPlugin/index.js.map +1 -1
  3. package/lib/cjs/components/DraggerBase/index.js +29 -114
  4. package/lib/cjs/components/DraggerBase/index.js.map +1 -1
  5. package/lib/cjs/components/DraggerDirection/index.js +7 -8
  6. package/lib/cjs/components/DraggerDirection/index.js.map +1 -1
  7. package/lib/cjs/components/DraggerMove/index.js +81 -62
  8. package/lib/cjs/components/DraggerMove/index.js.map +1 -1
  9. package/lib/cjs/components/Marquee/index.js +2 -0
  10. package/lib/cjs/components/Marquee/index.js.map +1 -1
  11. package/lib/cjs/components/ScrollBar/Bar/index.js +1 -2
  12. package/lib/cjs/components/ScrollBar/Bar/index.js.map +1 -1
  13. package/lib/cjs/components/SlideProgress/index.js +32 -58
  14. package/lib/cjs/components/SlideProgress/index.js.map +1 -1
  15. package/lib/cjs/utils/common/PCancelable.js +1 -1
  16. package/lib/cjs/utils/common/PCancelable.js.map +1 -1
  17. package/lib/cjs/utils/scroll/index.js +0 -1
  18. package/lib/cjs/utils/scroll/index.js.map +1 -1
  19. package/lib/cjs/version.js +1 -1
  20. package/lib/esm/components/CustomScrollDragPlugin/index.js +3 -0
  21. package/lib/esm/components/CustomScrollDragPlugin/index.js.map +1 -1
  22. package/lib/esm/components/DraggerBase/index.js +29 -105
  23. package/lib/esm/components/DraggerBase/index.js.map +1 -1
  24. package/lib/esm/components/DraggerDirection/index.js +7 -8
  25. package/lib/esm/components/DraggerDirection/index.js.map +1 -1
  26. package/lib/esm/components/DraggerMove/index.js +81 -62
  27. package/lib/esm/components/DraggerMove/index.js.map +1 -1
  28. package/lib/esm/components/Marquee/index.js +2 -0
  29. package/lib/esm/components/Marquee/index.js.map +1 -1
  30. package/lib/esm/components/ScrollBar/Bar/index.js +1 -2
  31. package/lib/esm/components/ScrollBar/Bar/index.js.map +1 -1
  32. package/lib/esm/components/SlideProgress/index.js +33 -57
  33. package/lib/esm/components/SlideProgress/index.js.map +1 -1
  34. package/lib/esm/utils/common/PCancelable.js +1 -1
  35. package/lib/esm/utils/common/PCancelable.js.map +1 -1
  36. package/lib/esm/utils/scroll/index.js +0 -1
  37. package/lib/esm/utils/scroll/index.js.map +1 -1
  38. package/lib/esm/version.js +1 -1
  39. package/lib/types/components/CustomScrollDragPlugin/index.d.ts.map +1 -1
  40. package/lib/types/components/DraggerBase/index.d.ts +5 -56
  41. package/lib/types/components/DraggerBase/index.d.ts.map +1 -1
  42. package/lib/types/components/DraggerBase/types.d.ts +5 -9
  43. package/lib/types/components/DraggerBase/types.d.ts.map +1 -1
  44. package/lib/types/components/DraggerDirection/index.d.ts +3 -3
  45. package/lib/types/components/DraggerDirection/index.d.ts.map +1 -1
  46. package/lib/types/components/DraggerMove/index.d.ts +27 -22
  47. package/lib/types/components/DraggerMove/index.d.ts.map +1 -1
  48. package/lib/types/components/DraggerMove/types.d.ts +7 -10
  49. package/lib/types/components/DraggerMove/types.d.ts.map +1 -1
  50. package/lib/types/components/Marquee/index.d.ts.map +1 -1
  51. package/lib/types/components/ScrollBar/Bar/index.d.ts.map +1 -1
  52. package/lib/types/components/SlideProgress/index.d.ts +2 -13
  53. package/lib/types/components/SlideProgress/index.d.ts.map +1 -1
  54. package/lib/types/components/SlideProgress/types.d.ts +3 -1
  55. package/lib/types/components/SlideProgress/types.d.ts.map +1 -1
  56. package/lib/types/utils/common/PCancelable.d.ts +1 -1
  57. package/lib/types/utils/common/PCancelable.d.ts.map +1 -1
  58. package/lib/types/utils/scroll/index.d.ts +0 -1
  59. package/lib/types/utils/scroll/index.d.ts.map +1 -1
  60. package/lib/types/version.d.ts +1 -1
  61. package/package.json +2 -2
  62. package/src/components/CustomScrollDragPlugin/index.ts +4 -0
  63. package/src/components/DraggerBase/index.ts +41 -142
  64. package/src/components/DraggerBase/types.ts +5 -11
  65. package/src/components/DraggerDirection/index.ts +12 -11
  66. package/src/components/DraggerDirection/stories/index.tsx +1 -0
  67. package/src/components/DraggerMove/index.ts +100 -77
  68. package/src/components/DraggerMove/stories/index.stories.tsx +3 -1
  69. package/src/components/DraggerMove/stories/index.tsx +7 -4
  70. package/src/components/DraggerMove/types.ts +8 -11
  71. package/src/components/Marquee/index.ts +3 -0
  72. package/src/components/ScrollBar/Bar/index.ts +0 -3
  73. package/src/components/SlideProgress/index.ts +40 -78
  74. package/src/components/SlideProgress/types.ts +3 -1
  75. package/src/utils/common/PCancelable.ts +1 -1
  76. package/src/utils/scroll/index.ts +0 -1
  77. package/src/version.ts +1 -1
  78. package/lib/cjs/utils/scroll/isPageScrolling.js +0 -73
  79. package/lib/cjs/utils/scroll/isPageScrolling.js.map +0 -1
  80. package/lib/esm/utils/scroll/isPageScrolling.js +0 -69
  81. package/lib/esm/utils/scroll/isPageScrolling.js.map +0 -1
  82. package/lib/types/utils/scroll/isPageScrolling.d.ts +0 -25
  83. package/lib/types/utils/scroll/isPageScrolling.d.ts.map +0 -1
  84. package/src/utils/scroll/isPageScrolling.ts +0 -80
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ScrollBar/Bar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAQpC;;GAEG;AACH,qBAAa,GAAG;IA0GF,OAAO,CAAC,MAAM;IAzG1B,oDAAoD;IACpD,OAAO,CAAC,MAAM,CAAc;IAE5B;;OAEG;IACH,IAAI,KAAK,gBAER;IAED,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAc;IAE5B;;OAEG;IACH,IAAI,KAAK,gBAER;IAED,mDAAmD;IACnD,OAAO,CAAC,YAAY,CAAK;IAEzB,kDAAkD;IAClD,OAAO,CAAC,WAAW,CAAK;IAExB,yBAAyB;IACzB,OAAO,CAAC,YAAY,CAAK;IAEzB,wBAAwB;IACxB,OAAO,CAAC,WAAW,CAAK;IAExB,sDAAsD;IACtD,OAAO,CAAC,gBAAgB,CAAK;IAE7B,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAAmC;IAE7D,yCAAyC;IACzC,OAAO,CAAC,UAAU,CAAsB;IAExC,+BAA+B;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAa;IAElC,8CAA8C;IAC9C,OAAO,CAAC,cAAc,CAAC,CAAiB;IAExC,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,CAAc;IAE/B;;OAEG;IACH,IAAI,YAAY,YAEf;IAED;;OAEG;IACH,IAAI,UAAU,YAEb;IAED;;OAEG;IACH,IAAI,aAAa,sLAIhB;IAED;;OAEG;IACH,IAAI,UAAU,WAMb;IAED;;OAEG;IACH,IAAI,WAAW,WAEd;IAED;;OAEG;IACH,IAAI,YAAY,WAEf;IAED;;OAEG;IACH,IAAI,KAAK,cAER;gBAEmB,MAAM,EAAE,SAAS;IAyBrC;;;OAGG;IACH,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACH,OAAO,CAAC,UAAU;IA6BlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAKpB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAoCrB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAoCxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACI,MAAM;IA4Cb;;OAEG;IACI,OAAO;CASf"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ScrollBar/Bar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAQpC;;GAEG;AACH,qBAAa,GAAG;IA0GF,OAAO,CAAC,MAAM;IAzG1B,oDAAoD;IACpD,OAAO,CAAC,MAAM,CAAc;IAE5B;;OAEG;IACH,IAAI,KAAK,gBAER;IAED,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAc;IAE5B;;OAEG;IACH,IAAI,KAAK,gBAER;IAED,mDAAmD;IACnD,OAAO,CAAC,YAAY,CAAK;IAEzB,kDAAkD;IAClD,OAAO,CAAC,WAAW,CAAK;IAExB,yBAAyB;IACzB,OAAO,CAAC,YAAY,CAAK;IAEzB,wBAAwB;IACxB,OAAO,CAAC,WAAW,CAAK;IAExB,sDAAsD;IACtD,OAAO,CAAC,gBAAgB,CAAK;IAE7B,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAAmC;IAE7D,yCAAyC;IACzC,OAAO,CAAC,UAAU,CAAsB;IAExC,+BAA+B;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAa;IAElC,8CAA8C;IAC9C,OAAO,CAAC,cAAc,CAAC,CAAiB;IAExC,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,CAAc;IAE/B;;OAEG;IACH,IAAI,YAAY,YAEf;IAED;;OAEG;IACH,IAAI,UAAU,YAEb;IAED;;OAEG;IACH,IAAI,aAAa,sLAIhB;IAED;;OAEG;IACH,IAAI,UAAU,WAMb;IAED;;OAEG;IACH,IAAI,WAAW,WAEd;IAED;;OAEG;IACH,IAAI,YAAY,WAEf;IAED;;OAEG;IACH,IAAI,KAAK,cAER;gBAEmB,MAAM,EAAE,SAAS;IAyBrC;;;OAGG;IACH,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACH,OAAO,CAAC,UAAU;IA6BlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAKpB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAoCrB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAiCxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAapB;;OAEG;IACI,MAAM;IA4Cb;;OAEG;IACI,OAAO;CASf"}
@@ -1,11 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { Component as ComponentClass } from '../../base/Component';
3
3
  import { NSlideProgress } from './types';
4
- import { createIsPageScrolling } from '../../utils/scroll/isPageScrolling';
5
4
  import { AnimationFrame } from '../AnimationFrame';
6
5
  import { DraggerMove, NDraggerMove } from '../DraggerMove';
7
6
  import { Timeline } from '../Timeline';
8
- import { NDraggerBase } from '../DraggerBase';
9
7
  export type { NSlideProgress };
10
8
  /**
11
9
  * Slide progress handler.
@@ -32,7 +30,7 @@ export declare class SlideProgress<StaticProps extends NSlideProgress.IStaticPro
32
30
  dragThreshold: number;
33
31
  };
34
32
  /** Animation frame for smooth animations */
35
- protected _animationFrame: AnimationFrame;
33
+ protected _raf: AnimationFrame;
36
34
  /** Dragging behavior manager */
37
35
  protected _dragger: DraggerMove;
38
36
  /** Stores the current and target progress values */
@@ -46,19 +44,15 @@ export declare class SlideProgress<StaticProps extends NSlideProgress.IStaticPro
46
44
  */
47
45
  get steppedProgress(): number;
48
46
  /** Timeline for smooth transitions */
49
- protected _timelineTo?: Timeline;
47
+ protected _timeline?: Timeline;
50
48
  /** Timeout for sticky behavior at the end */
51
49
  protected _stickyEndTimeout?: NodeJS.Timeout;
52
- /** Determines if dragging is allowed */
53
- protected _canDragMove: boolean;
54
50
  /** Direction of progress */
55
51
  protected _direction: 1 | -1;
56
52
  /** Intensity of wheel interaction */
57
53
  protected _wheelIntensity: number;
58
54
  /** Current handler for user interactions: 'wheel' or 'drag' */
59
55
  protected _currentHandler: 'wheel' | 'drag';
60
- /** Checks if the page is scrolling */
61
- protected _createIsPageScrolling: ReturnType<typeof createIsPageScrolling>;
62
56
  constructor(initialProps?: StaticProps & ChangeableProps, canInit?: boolean);
63
57
  /**
64
58
  * Handles mutation of properties.
@@ -69,11 +63,6 @@ export declare class SlideProgress<StaticProps extends NSlideProgress.IStaticPro
69
63
  * @param event - The wheel event.
70
64
  */
71
65
  protected _handleWheel(event: WheelEvent): void;
72
- /**
73
- * Checks if dragging is allowed.
74
- * @param absDiff - Absolute difference in dragging distance.
75
- */
76
- protected _checkCanDragMove(absDiff: NDraggerBase.IVector2): boolean;
77
66
  /**
78
67
  * Handles the drag movement for adjusting progress.
79
68
  * @param data - The drag event data.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/SlideProgress/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B;;;;;;;GAOG;AACH,qBAAa,aAAa,CACxB,WAAW,SAAS,cAAc,CAAC,YAAY,GAAG,cAAc,CAAC,YAAY,EAC7E,eAAe,SACb,cAAc,CAAC,gBAAgB,GAAG,cAAc,CAAC,gBAAgB,EACnE,cAAc,SACZ,cAAc,CAAC,eAAe,GAAG,cAAc,CAAC,eAAe,CACjE,SAAQ,cAAc,CAAC,WAAW,EAAE,eAAe,EAAE,cAAc,CAAC;IACpE,SAAS,CAAC,gBAAgB;;;;;;;;;;;;;;;IAmB1B,4CAA4C;IAC5C,SAAS,CAAC,eAAe,EAAE,cAAc,CAAC;IAE1C,gCAAgC;IAChC,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC;IAEhC,oDAAoD;IACpD,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC,SAAS,CAA6B;IAE9E;;OAEG;IACH,IAAI,QAAQ,WAEX;IAED;;OAEG;IACH,IAAI,eAAe,WAElB;IAED,sCAAsC;IACtC,SAAS,CAAC,WAAW,CAAC,EAA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D,SAAS,CAAC,eAAe,EAAE,OAAO,GAAG,MAAM,CAAW;gBAE1C,YAAY,CAAC,EAAE,WAAW,GAAG,eAAe,EAAE,OAAO,UAAO;IAkCxE;;OAEG;IACH,SAAS,CAAC,cAAc;IAUxB;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,UAAU;IAwCxC;;;OAGG;IACH,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,cAAc;IA6BvD;;OAEG;IACH,OAAO,CAAC,cAAc;IAOtB;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM;IAyBvC;;OAEG;IACH,SAAS,CAAC,qBAAqB;IA4B/B;;OAEG;IACI,MAAM;IAIb;;;OAGG;IACH,SAAS,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM;IAc7C;;OAEG;IACH,SAAS,CAAC,YAAY;IAuBtB;;OAEG;IACI,EAAE,CAAC,EACR,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,YAAkB,EAC5B,UAAU,EACV,KAAK,GACN,EAAE,cAAc,CAAC,QAAQ;IAoC1B;;OAEG;IACH,SAAS,CAAC,QAAQ;CAanB"}
@@ -61,7 +61,7 @@ export declare namespace NSlideProgress {
61
61
  stickyEndDuration?: TDuration | null;
62
62
  /**
63
63
  * Minimum threshold for drag movements (in pixels).
64
- * @default 3
64
+ * @default 5
65
65
  */
66
66
  dragThreshold?: number;
67
67
  }
@@ -74,6 +74,8 @@ export declare namespace NSlideProgress {
74
74
  wheel: TNormalizeWheel;
75
75
  /** Fired when a drag event moves the slider */
76
76
  dragMove: NDraggerMove.IMoveParameter;
77
+ /** Fired when dragging ends */
78
+ dragEnd: undefined;
77
79
  }
78
80
  interface IWithLerp {
79
81
  /** Current progress value */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/SlideProgress/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,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bobrov/p-cancelable';
1
+ import PCancelable from 'p-cancelable';
2
2
  export { PCancelable };
3
3
  /**
4
4
  * This module imports and re-exports the `PCancelable` class from the `@anton.bobrov/p-cancelable` package.
@@ -1 +1 @@
1
- {"version":3,"file":"PCancelable.d.ts","sourceRoot":"","sources":["../../../../src/utils/common/PCancelable.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;;;;;;;;;;;;;;GAeG"}
1
+ {"version":3,"file":"PCancelable.d.ts","sourceRoot":"","sources":["../../../../src/utils/common/PCancelable.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;;;;;;;;;;;;;;GAeG"}
@@ -1,5 +1,4 @@
1
1
  export * from './getScrollValues';
2
- export * from './isPageScrolling';
3
2
  export * from './normalizeWheel';
4
3
  export * from './onScroll';
5
4
  export * from './scrollTo';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/scroll/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/scroll/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
@@ -1,3 +1,3 @@
1
- declare const version = "4.3.1";
1
+ declare const version = "4.4.1";
2
2
  export default version;
3
3
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vevet",
3
- "version": "4.3.1",
3
+ "version": "4.4.1",
4
4
  "description": "Vevet is a flexible JavaScript library designed for creative web development",
5
5
  "scripts": {
6
6
  "storybook": "storybook dev -p 6006",
@@ -59,12 +59,12 @@
59
59
  "author": "Anton Bobrov <anton.bobrov@hotmail.com>",
60
60
  "license": "MIT",
61
61
  "dependencies": {
62
- "@anton.bobrov/p-cancelable": "^4.0.1-1",
63
62
  "detect-browser": "^5.3.0",
64
63
  "easing-progress": "^1.0.0",
65
64
  "get-image-pos": "^0.0.11",
66
65
  "ismobilejs": "^1.1.1",
67
66
  "normalize-wheel": "^1.0.1",
67
+ "p-cancelable": "^4.0.1",
68
68
  "ts-essentials": "^9.3.2"
69
69
  },
70
70
  "devDependencies": {
@@ -58,6 +58,8 @@ export class CustomScrollDragPlugin<
58
58
  super._init();
59
59
 
60
60
  this._toggleDragger();
61
+
62
+ this.component.container.style.touchAction = 'none';
61
63
  }
62
64
 
63
65
  protected _onPropsMutate() {
@@ -89,6 +91,8 @@ export class CustomScrollDragPlugin<
89
91
 
90
92
  this._dragger = new DraggerMove({
91
93
  container: component.container,
94
+ threshold: 0,
95
+ preventDefault: false,
92
96
  });
93
97
 
94
98
  this._dragger.addCallback('start', () => this._handleDragStart());
@@ -25,8 +25,8 @@ export abstract class DraggerBase<
25
25
  return {
26
26
  ...super._getDefaultProps(),
27
27
  container: `#${this.prefix}`,
28
- isPassive: false,
29
28
  isEnabled: true,
29
+ preventDefault: true,
30
30
  };
31
31
  }
32
32
 
@@ -58,18 +58,6 @@ export abstract class DraggerBase<
58
58
  return this._runtimeListeners.length > 0;
59
59
  }
60
60
 
61
- /**
62
- * Stores the pointer ID of the current drag operation.
63
- */
64
- protected _pointerID: number | null;
65
-
66
- /**
67
- * Returns the current pointer ID.
68
- */
69
- protected get pointerID() {
70
- return this._pointerID;
71
- }
72
-
73
61
  /**
74
62
  * The current coordinates of the pointer during dragging.
75
63
  */
@@ -111,30 +99,13 @@ export abstract class DraggerBase<
111
99
  /**
112
100
  * The coordinates where the drag operation started.
113
101
  */
114
- protected _startCoords: NDraggerBase.IVector2;
102
+ protected _start: NDraggerBase.IVector2;
115
103
 
116
104
  /**
117
105
  * Returns the starting pointer coordinates at the beginning of the drag.
118
106
  */
119
- get startCoords() {
120
- return this._startCoords;
121
- }
122
-
123
- /**
124
- * Timeout handler for handling drag end events.
125
- */
126
- protected _handleEndTimeout?: NodeJS.Timeout;
127
-
128
- /**
129
- * The type of drag event, either 'mouse' or 'touch'.
130
- */
131
- protected _type?: 'mouse' | 'touch';
132
-
133
- /**
134
- * Returns the type of event ('mouse' or 'touch') being handled.
135
- */
136
- get type() {
137
- return this._type;
107
+ get start() {
108
+ return this._start;
138
109
  }
139
110
 
140
111
  /**
@@ -153,10 +124,9 @@ export abstract class DraggerBase<
153
124
 
154
125
  // Initialize default variables
155
126
  this._runtimeListeners = [];
156
- this._pointerID = null;
157
127
  this._coords = { x: 0, y: 0 };
158
128
  this._prevCoords = { x: 0, y: 0 };
159
- this._startCoords = { x: 0, y: 0 };
129
+ this._start = { x: 0, y: 0 };
160
130
 
161
131
  // Set styles to prevent user-select during drag
162
132
  this._fixStyles = document.createElement('style');
@@ -179,16 +149,16 @@ export abstract class DraggerBase<
179
149
  protected _setEvents() {
180
150
  this.addEventListener(
181
151
  this.container,
182
- 'mousedown',
152
+ 'pointerdown',
183
153
  (event) => this._handleStart(event),
184
- { passive: this.props.isPassive },
154
+ { passive: false },
185
155
  );
186
156
 
187
157
  this.addEventListener(
188
158
  this.container,
189
- 'touchstart',
190
- (event) => this._handleStart(event),
191
- { passive: this.props.isPassive },
159
+ 'dragstart',
160
+ (event) => event.preventDefault(),
161
+ { passive: false },
192
162
  );
193
163
  }
194
164
 
@@ -196,29 +166,24 @@ export abstract class DraggerBase<
196
166
  * Adds runtime events for mouseup, touchend, and other events during dragging.
197
167
  */
198
168
  protected _addRuntimeEvents() {
199
- const { isPassive } = this.props;
200
-
201
- this._runtimeListeners.push(
202
- addEventListener(window, 'mouseup', (event) => this.handleEnd(event), {
203
- passive: isPassive,
204
- }),
205
- );
206
-
207
169
  this._runtimeListeners.push(
208
- addEventListener(window, 'touchend', (event) => this.handleEnd(event), {
209
- passive: isPassive,
170
+ addEventListener(window, 'pointerup', (event) => this._handleEnd(event), {
171
+ passive: false,
210
172
  }),
211
173
  );
212
174
 
213
175
  this._runtimeListeners.push(
214
- addEventListener(window, 'touchcancel', () => this.cancel(), {
215
- passive: isPassive,
216
- }),
176
+ addEventListener(
177
+ window,
178
+ 'pointercancel',
179
+ (event) => this._handleEnd(event),
180
+ { passive: false },
181
+ ),
217
182
  );
218
183
 
219
184
  this._runtimeListeners.push(
220
- addEventListener(window, 'blur', () => this.cancel(), {
221
- passive: isPassive,
185
+ addEventListener(window, 'blur', () => this._handleEnd(null), {
186
+ passive: false,
222
187
  }),
223
188
  );
224
189
  }
@@ -232,120 +197,58 @@ export abstract class DraggerBase<
232
197
  this._runtimeListeners = [];
233
198
  }
234
199
 
235
- /**
236
- * Normalizes event coordinates based on the event type (mouse or touch).
237
- *
238
- * @param event - The event from which to extract coordinates.
239
- * @returns The pointer coordinates and pointer ID.
240
- */
241
- protected _getEventCoords(event: NDraggerBase.TEvent) {
242
- if (event.type.includes('touch')) {
243
- const evt = event as TouchEvent;
244
- const touch = evt.targetTouches[0] || evt.changedTouches[0];
245
-
246
- return {
247
- x: touch.clientX,
248
- y: touch.clientY,
249
- pointerId: touch.identifier,
250
- };
251
- }
252
-
253
- const evt = event as MouseEvent;
254
-
255
- return {
256
- x: evt.clientX,
257
- y: evt.clientY,
258
- pointerId: null,
259
- };
260
- }
261
-
262
200
  /**
263
201
  * Handles the start of a drag event.
264
- *
265
- * @param event - The event that initiated the drag (mouse or touch).
266
- * @returns A boolean indicating whether the drag started successfully.
267
202
  */
268
- protected _handleStart(event: NDraggerBase.TEvent) {
203
+ protected _handleStart(event: PointerEvent) {
269
204
  if (!this.props.isEnabled || this.isDragging) {
270
- return false;
205
+ return;
271
206
  }
272
207
 
273
- if (event.type === 'touchstart') {
274
- this._type = 'touch';
275
- } else {
276
- this._type = 'mouse';
208
+ // prevent right click
209
+ if (event.button === 2) {
210
+ return;
277
211
  }
278
212
 
279
- if (event.type === 'mousedown') {
280
- if (event.which === 1) {
281
- event.stopPropagation();
282
- } else {
283
- return false;
284
- }
213
+ if (this.props.preventDefault) {
214
+ event.preventDefault();
285
215
  }
286
216
 
287
217
  // Update coordinates
288
- const { x, y, pointerId } = this._getEventCoords(event);
218
+ const { clientX: x, clientY: y } = event;
289
219
  this._coords = { x, y };
290
220
  this._prevCoords = { x, y };
291
- this._startCoords = { x, y };
292
- this._pointerID = pointerId;
221
+ this._start = { x, y };
293
222
 
294
223
  // Add runtime events for drag
295
224
  this._addRuntimeEvents();
296
225
 
226
+ // reset selection
227
+ window.getSelection()?.empty();
228
+ window.getSelection()?.removeAllRanges();
229
+
297
230
  // Apply styles to prevent user-select
298
231
  getApp().body.append(this._fixStyles);
299
232
 
300
233
  // Trigger start callback
301
234
  this.callbacks.tbt('start', {
302
235
  event,
303
- start: this.startCoords,
236
+ start: this.start,
304
237
  coords: this.coords,
305
238
  });
306
-
307
- return true;
308
239
  }
309
240
 
310
241
  /**
311
242
  * Handles the end of a drag event and initiates cleanup.
312
- *
313
- * @param event - The event that ended the drag (mouse or touch).
314
- */
315
- protected handleEnd(event: NDraggerBase.TEvent) {
316
- if (this._handleEndTimeout) {
317
- return;
318
- }
319
-
320
- this._handleEndTimeout = setTimeout(() => {
321
- const { pointerId } = this._getEventCoords(event);
322
-
323
- if (!this.isDragging || pointerId !== this.pointerID) {
324
- return;
325
- }
326
-
327
- this._handleEnd(event);
328
-
329
- this._handleEndTimeout = undefined;
330
- }, 1);
331
- }
332
-
333
- /**
334
- * Handles the cleanup process when dragging ends.
335
- *
336
- * @param event - The event that ended the drag.
337
- */
338
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
339
- protected _handleEnd(event: NDraggerBase.TEvent) {
340
- this.cancel();
341
- }
342
-
343
- /**
344
- * Cancels the current drag operation and removes runtime events and styles.
345
243
  */
346
- public cancel() {
244
+ protected _handleEnd(event: PointerEvent | null) {
347
245
  this._removeRuntimeEvents();
348
246
 
247
+ // Update coordinates
248
+ if (event) {
249
+ this._coords = { x: event.clientX, y: event.clientY };
250
+ }
251
+
349
252
  // remove styles fix
350
253
  this._fixStyles.remove();
351
254
 
@@ -357,14 +260,10 @@ export abstract class DraggerBase<
357
260
  * Destroys the dragger component, removing events and cleaning up resources.
358
261
  */
359
262
  protected _destroy() {
360
- this.cancel();
263
+ this._handleEnd(null);
361
264
 
362
265
  super._destroy();
363
266
 
364
267
  this._removeRuntimeEvents();
365
-
366
- if (this._handleEndTimeout) {
367
- clearTimeout(this._handleEndTimeout);
368
- }
369
268
  }
370
269
  }
@@ -7,12 +7,11 @@ export namespace NDraggerBase {
7
7
  * @default '#v-dragger'
8
8
  */
9
9
  container?: string | Element | Window;
10
-
11
10
  /**
12
- * Whether to use passive event listeners for the drag events. If set to `true`, the events will be passive, which can improve performance but prevents the default behavior from being blocked.
13
- * @default false
11
+ * If need to prevent default events
12
+ * @default true
14
13
  */
15
- isPassive?: boolean;
14
+ preventDefault?: boolean;
16
15
  }
17
16
 
18
17
  export interface IChangeableProps extends NComponent.IChangeableProps {
@@ -35,16 +34,11 @@ export namespace NDraggerBase {
35
34
  end: undefined;
36
35
  }
37
36
 
38
- /**
39
- * Type representing a drag event, which can be either a `MouseEvent` or a `TouchEvent`.
40
- */
41
- export type TEvent = MouseEvent | TouchEvent;
42
-
43
37
  export interface IStartParameter {
44
38
  /**
45
- * The event that initiated the drag (either `MouseEvent` or `TouchEvent`).
39
+ * The event that initiated the drag.
46
40
  */
47
- event: TEvent;
41
+ event: PointerEvent;
48
42
 
49
43
  /**
50
44
  * The coordinates where the drag started.
@@ -1,4 +1,4 @@
1
- import { DraggerBase, NDraggerBase } from '../DraggerBase';
1
+ import { DraggerBase } from '../DraggerBase';
2
2
  import { NDraggerDirection } from './types';
3
3
 
4
4
  export type { NDraggerDirection };
@@ -30,33 +30,34 @@ export class DraggerDirection<
30
30
  * Handles the end of the drag event and detects the swipe direction by comparing the start and end coordinates.
31
31
  * If the drag distance is greater than or equal to `minLength`, the corresponding direction callback is triggered.
32
32
  */
33
- protected _handleEnd(event: NDraggerBase.TEvent) {
34
- const { x, y } = this._getEventCoords(event);
35
- const { startCoords } = this;
33
+ protected _handleEnd(event: PointerEvent | null) {
34
+ super._handleEnd(event);
35
+
36
+ const { start, coords } = this;
37
+ const { x, y } = coords;
38
+
36
39
  const min = Math.abs(this.props.minLength);
37
40
 
38
41
  // Detect swipe direction
42
+
39
43
  // Swipe up
40
- if (startCoords.y > y && Math.abs(y - startCoords.y) >= min) {
44
+ if (start.y > y && Math.abs(y - start.y) >= min) {
41
45
  this.callbacks.tbt('up', undefined);
42
46
  }
43
47
 
44
48
  // Swipe down
45
- if (startCoords.y < y && Math.abs(y - startCoords.y) >= min) {
49
+ if (start.y < y && Math.abs(y - start.y) >= min) {
46
50
  this.callbacks.tbt('down', undefined);
47
51
  }
48
52
 
49
53
  // Swipe left
50
- if (startCoords.x > x && Math.abs(x - startCoords.x) >= min) {
54
+ if (start.x > x && Math.abs(x - start.x) >= min) {
51
55
  this.callbacks.tbt('left', undefined);
52
56
  }
53
57
 
54
58
  // Swipe right
55
- if (startCoords.x < x && Math.abs(x - startCoords.x) >= min) {
59
+ if (start.x < x && Math.abs(x - start.x) >= min) {
56
60
  this.callbacks.tbt('right', undefined);
57
61
  }
58
-
59
- // Call the parent class's `_handleEnd` method for further cleanup
60
- super._handleEnd(event);
61
62
  }
62
63
  }
@@ -50,6 +50,7 @@ export const Component: FC = () => {
50
50
  justifyContent: 'center',
51
51
  alignItems: 'center',
52
52
  background: '#ccc',
53
+ touchAction: 'none',
53
54
  }}
54
55
  >
55
56
  {direction}