vevet 3.3.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/base/Component/index.js.map +1 -1
- package/lib/cjs/components/AnimationFrame/index.js.map +1 -1
- package/lib/cjs/components/BaseTimeline/index.js.map +1 -1
- package/lib/cjs/components/Ctx2D/index.js.map +1 -1
- package/lib/cjs/components/Ctx2DPrerender/index.js.map +1 -1
- package/lib/cjs/components/CustomCursor/index.js.map +1 -1
- package/lib/cjs/components/DraggerBase/index.js.map +1 -1
- package/lib/cjs/components/DraggerDirection/index.js.map +1 -1
- package/lib/cjs/components/DraggerMove/index.js.map +1 -1
- package/lib/cjs/components/Preloader/index.js.map +1 -1
- package/lib/cjs/components/ProgressPreloader/index.js +4 -1
- package/lib/cjs/components/ProgressPreloader/index.js.map +1 -1
- package/lib/cjs/components/ScrollBar/index.js.map +1 -1
- package/lib/cjs/components/ScrollView/index.js.map +1 -1
- package/lib/cjs/components/SectionScrollProgress/index.js.map +1 -1
- package/lib/cjs/components/SlideProgress/index.js +185 -0
- package/lib/cjs/components/SlideProgress/index.js.map +1 -0
- package/lib/cjs/components/SlideProgress/types.js +3 -0
- package/lib/cjs/components/SlideProgress/types.js.map +1 -0
- package/lib/cjs/components/SmoothScroll/index.js.map +1 -1
- package/lib/cjs/components/SmoothScrollDragPlugin/index.js.map +1 -1
- package/lib/cjs/components/SmoothScrollKeyboardPlugin/index.js.map +1 -1
- package/lib/cjs/components/SplitText/index.js.map +1 -1
- package/lib/cjs/components/Timeline/index.js.map +1 -1
- package/lib/cjs/components/index.js +1 -0
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/base/Component/index.js.map +1 -1
- package/lib/esm/components/AnimationFrame/index.js.map +1 -1
- package/lib/esm/components/BaseTimeline/index.js.map +1 -1
- package/lib/esm/components/Ctx2D/index.js.map +1 -1
- package/lib/esm/components/Ctx2DPrerender/index.js.map +1 -1
- package/lib/esm/components/CustomCursor/index.js.map +1 -1
- package/lib/esm/components/DraggerBase/index.js.map +1 -1
- package/lib/esm/components/DraggerDirection/index.js.map +1 -1
- package/lib/esm/components/DraggerMove/index.js.map +1 -1
- package/lib/esm/components/Preloader/index.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/index.js +4 -1
- package/lib/esm/components/ProgressPreloader/index.js.map +1 -1
- package/lib/esm/components/ScrollBar/index.js.map +1 -1
- package/lib/esm/components/ScrollView/index.js.map +1 -1
- package/lib/esm/components/SectionScrollProgress/index.js.map +1 -1
- package/lib/esm/components/SlideProgress/index.js +134 -0
- package/lib/esm/components/SlideProgress/index.js.map +1 -0
- package/lib/esm/components/SlideProgress/types.js +2 -0
- package/lib/esm/components/SlideProgress/types.js.map +1 -0
- package/lib/esm/components/SmoothScroll/index.js.map +1 -1
- package/lib/esm/components/SmoothScrollDragPlugin/index.js.map +1 -1
- package/lib/esm/components/SmoothScrollKeyboardPlugin/index.js.map +1 -1
- package/lib/esm/components/SplitText/index.js.map +1 -1
- package/lib/esm/components/Timeline/index.js.map +1 -1
- package/lib/esm/components/index.js +1 -0
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/base/Component/index.d.ts.map +1 -1
- package/lib/types/components/AnimationFrame/index.d.ts +11 -11
- package/lib/types/components/AnimationFrame/index.d.ts.map +1 -1
- package/lib/types/components/BaseTimeline/index.d.ts +7 -4
- package/lib/types/components/BaseTimeline/index.d.ts.map +1 -1
- package/lib/types/components/Ctx2D/index.d.ts +6 -6
- package/lib/types/components/Ctx2D/index.d.ts.map +1 -1
- package/lib/types/components/Ctx2DPrerender/index.d.ts +1 -1
- package/lib/types/components/Ctx2DPrerender/index.d.ts.map +1 -1
- package/lib/types/components/CustomCursor/index.d.ts +20 -19
- package/lib/types/components/CustomCursor/index.d.ts.map +1 -1
- package/lib/types/components/DraggerBase/index.d.ts +11 -10
- package/lib/types/components/DraggerBase/index.d.ts.map +1 -1
- package/lib/types/components/DraggerDirection/index.d.ts.map +1 -1
- package/lib/types/components/DraggerMove/index.d.ts +1 -1
- package/lib/types/components/DraggerMove/index.d.ts.map +1 -1
- package/lib/types/components/Marquee/index.d.ts +2 -1
- package/lib/types/components/Marquee/index.d.ts.map +1 -1
- package/lib/types/components/Preloader/index.d.ts +7 -7
- package/lib/types/components/Preloader/index.d.ts.map +1 -1
- package/lib/types/components/ProgressPreloader/index.d.ts +11 -9
- package/lib/types/components/ProgressPreloader/index.d.ts.map +1 -1
- package/lib/types/components/ScrollBar/index.d.ts +5 -4
- package/lib/types/components/ScrollBar/index.d.ts.map +1 -1
- package/lib/types/components/ScrollView/index.d.ts +1 -1
- package/lib/types/components/ScrollView/index.d.ts.map +1 -1
- package/lib/types/components/SectionScrollProgress/index.d.ts.map +1 -1
- package/lib/types/components/SlideProgress/index.d.ts +54 -0
- package/lib/types/components/SlideProgress/index.d.ts.map +1 -0
- package/lib/types/components/SlideProgress/types.d.ts +67 -0
- package/lib/types/components/SlideProgress/types.d.ts.map +1 -0
- package/lib/types/components/SmoothScroll/index.d.ts +6 -4
- package/lib/types/components/SmoothScroll/index.d.ts.map +1 -1
- package/lib/types/components/SmoothScrollDragPlugin/index.d.ts +12 -10
- package/lib/types/components/SmoothScrollDragPlugin/index.d.ts.map +1 -1
- package/lib/types/components/SmoothScrollKeyboardPlugin/index.d.ts +5 -4
- package/lib/types/components/SmoothScrollKeyboardPlugin/index.d.ts.map +1 -1
- package/lib/types/components/SplitText/index.d.ts +13 -13
- package/lib/types/components/SplitText/index.d.ts.map +1 -1
- package/lib/types/components/Timeline/index.d.ts +5 -5
- package/lib/types/components/Timeline/index.d.ts.map +1 -1
- package/lib/types/components/index.d.ts +1 -0
- package/lib/types/components/index.d.ts.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/Application/events/PageLoad/index.ts +1 -1
- package/src/Application/events/Viewport/index.ts +3 -3
- package/src/Application/index.ts +1 -1
- package/src/base/Callbacks/index.ts +2 -2
- package/src/base/Component/index.ts +4 -2
- package/src/base/Module/index.ts +13 -13
- package/src/base/Module/stories/index.tsx +1 -1
- package/src/base/MutableProps/index.ts +3 -3
- package/src/base/MutableProps/stories/index.tsx +1 -1
- package/src/base/Plugin/index.ts +2 -2
- package/src/components/AnimationFrame/index.ts +19 -16
- package/src/components/BaseTimeline/index.ts +10 -8
- package/src/components/BaseTimeline/stories/Nested.tsx +1 -1
- package/src/components/Ctx2D/index.ts +7 -7
- package/src/components/Ctx2DPrerender/index.ts +6 -3
- package/src/components/CustomCursor/index.ts +30 -28
- package/src/components/DraggerBase/index.ts +20 -18
- package/src/components/DraggerDirection/index.ts +6 -3
- package/src/components/DraggerMove/index.ts +9 -7
- package/src/components/Marquee/index.ts +3 -3
- package/src/components/Preloader/index.ts +12 -10
- package/src/components/ProgressPreloader/index.ts +25 -19
- package/src/components/ProgressPreloader/utils/preloadCustomElement.ts +1 -1
- package/src/components/ProgressPreloader/utils/preloadImage.ts +1 -1
- package/src/components/ProgressPreloader/utils/preloadVideo.ts +1 -1
- package/src/components/ScrollBar/Bar/index.ts +5 -5
- package/src/components/ScrollBar/index.ts +10 -8
- package/src/components/ScrollBar/stories/Default.tsx +1 -1
- package/src/components/ScrollBar/stories/WithInnerScroll.tsx +1 -1
- package/src/components/ScrollBar/stories/WithSmoothScrollComponent.tsx +1 -1
- package/src/components/ScrollBar/stories/index.stories.tsx +2 -2
- package/src/components/ScrollView/index.ts +13 -11
- package/src/components/ScrollView/stories/index.tsx +1 -1
- package/src/components/SectionScrollProgress/index.ts +6 -3
- package/src/components/SectionScrollProgress/stories/index.stories.tsx +1 -1
- package/src/components/SlideProgress/index.ts +226 -0
- package/src/components/SlideProgress/stories/index.stories.tsx +13 -0
- package/src/components/SlideProgress/stories/index.tsx +66 -0
- package/src/components/SlideProgress/types.ts +71 -0
- package/src/components/SmoothScroll/AnimatonFrame.ts +2 -2
- package/src/components/SmoothScroll/Elements.ts +3 -3
- package/src/components/SmoothScroll/index.ts +13 -11
- package/src/components/SmoothScroll/stories/Default.tsx +1 -1
- package/src/components/SmoothScroll/stories/WithHorizontal.tsx +1 -1
- package/src/components/SmoothScroll/stories/WithInnerLerp.tsx +1 -1
- package/src/components/SmoothScroll/stories/index.stories.tsx +2 -2
- package/src/components/SmoothScrollDragPlugin/index.ts +17 -14
- package/src/components/SmoothScrollDragPlugin/stories/index.tsx +1 -1
- package/src/components/SmoothScrollKeyboardPlugin/index.ts +11 -8
- package/src/components/SmoothScrollKeyboardPlugin/stories/index.tsx +1 -1
- package/src/components/SplitText/index.ts +18 -16
- package/src/components/Timeline/index.ts +9 -8
- package/src/components/Timeline/stories/Nested.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/utils/common/mergeWithoutArrays.ts +1 -1
- package/src/utils/common/pickObjectProps.ts +1 -1
- package/src/utils/common/times.ts +1 -1
- package/src/utils/image/load.ts +2 -2
- package/src/utils/image/pathsToProps.ts +1 -1
- package/src/utils/listeners/onResize.ts +3 -3
- package/src/utils/math/clampScope.ts +1 -1
- package/src/utils/math/easing.ts +1 -1
- package/src/utils/math/lerp.ts +1 -1
- package/src/utils/math/normalizeNestedScope.ts +1 -1
- package/src/utils/math/wrap.ts +1 -1
- package/src/utils/scroll/getScrollValues.ts +1 -1
- package/src/utils/scroll/onScroll.ts +7 -7
- package/src/version.ts +1 -1
|
@@ -12,7 +12,7 @@ export type { NCtx2D };
|
|
|
12
12
|
export class Ctx2D<
|
|
13
13
|
StaticProps extends NCtx2D.IStaticProps = NCtx2D.IStaticProps,
|
|
14
14
|
ChangeableProps extends NCtx2D.IChangeableProps = NCtx2D.IChangeableProps,
|
|
15
|
-
CallbacksTypes extends NCtx2D.ICallbacksTypes = NCtx2D.ICallbacksTypes
|
|
15
|
+
CallbacksTypes extends NCtx2D.ICallbacksTypes = NCtx2D.ICallbacksTypes,
|
|
16
16
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
17
17
|
protected _getDefaultProps() {
|
|
18
18
|
return {
|
|
@@ -35,7 +35,7 @@ export class Ctx2D<
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/** The Canvas element itself */
|
|
38
|
-
|
|
38
|
+
protected _canvas: HTMLCanvasElement;
|
|
39
39
|
|
|
40
40
|
/** The Canvas element itself */
|
|
41
41
|
get canvas() {
|
|
@@ -43,7 +43,7 @@ export class Ctx2D<
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/** 2D Context */
|
|
46
|
-
|
|
46
|
+
protected _ctx: CanvasRenderingContext2D;
|
|
47
47
|
|
|
48
48
|
/** 2D Context */
|
|
49
49
|
get ctx() {
|
|
@@ -51,7 +51,7 @@ export class Ctx2D<
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/* Canvas width (with DPR) */
|
|
54
|
-
|
|
54
|
+
protected _width: number;
|
|
55
55
|
|
|
56
56
|
/* Canvas width (with DPR) */
|
|
57
57
|
get width() {
|
|
@@ -64,7 +64,7 @@ export class Ctx2D<
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/* Canvas height (with DPR) */
|
|
67
|
-
|
|
67
|
+
protected _height: number;
|
|
68
68
|
|
|
69
69
|
/* Canvas height (with DPR) */
|
|
70
70
|
get height() {
|
|
@@ -77,7 +77,7 @@ export class Ctx2D<
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** Device pixel ratio */
|
|
80
|
-
|
|
80
|
+
protected _dpr: number;
|
|
81
81
|
|
|
82
82
|
/** Device pixel ratio */
|
|
83
83
|
get dpr() {
|
|
@@ -135,7 +135,7 @@ export class Ctx2D<
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/** Set resize events */
|
|
138
|
-
|
|
138
|
+
protected _setResize() {
|
|
139
139
|
const { hasInitialResize, hasResize, viewportTarget, resizeDebounce } =
|
|
140
140
|
this.props;
|
|
141
141
|
|
|
@@ -8,9 +8,12 @@ export type { NCtx2DPrerender } from './types';
|
|
|
8
8
|
* The class allows you to prerender media for further use with reduced payloads.
|
|
9
9
|
*/
|
|
10
10
|
export class Ctx2DPrerender<
|
|
11
|
-
StaticProps extends
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
StaticProps extends
|
|
12
|
+
NCtx2DPrerender.IStaticProps = NCtx2DPrerender.IStaticProps,
|
|
13
|
+
ChangeableProps extends
|
|
14
|
+
NCtx2DPrerender.IChangeableProps = NCtx2DPrerender.IChangeableProps,
|
|
15
|
+
CallbacksTypes extends
|
|
16
|
+
NCtx2DPrerender.ICallbacksTypes = NCtx2DPrerender.ICallbacksTypes,
|
|
14
17
|
> extends Ctx2D<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
15
18
|
protected _getDefaultProps() {
|
|
16
19
|
return {
|
|
@@ -11,8 +11,10 @@ export type { NCustomCursor };
|
|
|
11
11
|
*/
|
|
12
12
|
export class CustomCursor<
|
|
13
13
|
StaticProps extends NCustomCursor.IStaticProps = NCustomCursor.IStaticProps,
|
|
14
|
-
ChangeableProps extends
|
|
15
|
-
|
|
14
|
+
ChangeableProps extends
|
|
15
|
+
NCustomCursor.IChangeableProps = NCustomCursor.IChangeableProps,
|
|
16
|
+
CallbacksTypes extends
|
|
17
|
+
NCustomCursor.ICallbacksTypes = NCustomCursor.ICallbacksTypes,
|
|
16
18
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
17
19
|
protected _getDefaultProps() {
|
|
18
20
|
return {
|
|
@@ -38,10 +40,10 @@ export class CustomCursor<
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
/** Cursor container */
|
|
41
|
-
|
|
43
|
+
protected _container: Element | Window;
|
|
42
44
|
|
|
43
45
|
/** The container is window */
|
|
44
|
-
|
|
46
|
+
protected _isContainerWindow: boolean;
|
|
45
47
|
|
|
46
48
|
/** DOM parent for the cursor element */
|
|
47
49
|
get domContainer(): HTMLElement {
|
|
@@ -58,7 +60,7 @@ export class CustomCursor<
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/** Outer cursor element */
|
|
61
|
-
|
|
63
|
+
protected _outerElement!: HTMLElement;
|
|
62
64
|
|
|
63
65
|
/** Cursor element (inner element) */
|
|
64
66
|
get innerElement() {
|
|
@@ -66,10 +68,10 @@ export class CustomCursor<
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
/** Inner cursor element */
|
|
69
|
-
|
|
71
|
+
protected _innerElement!: HTMLElement;
|
|
70
72
|
|
|
71
73
|
/** Hovered element */
|
|
72
|
-
|
|
74
|
+
protected _hoveredElement?: NCustomCursor.IHoveredElement | undefined;
|
|
73
75
|
|
|
74
76
|
/** Hovered element */
|
|
75
77
|
get hoveredElement(): NCustomCursor.IHoveredElement | undefined {
|
|
@@ -82,10 +84,10 @@ export class CustomCursor<
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
/** Animation frame */
|
|
85
|
-
|
|
87
|
+
protected _animationFrame!: AnimationFrame;
|
|
86
88
|
|
|
87
89
|
/** Current cursor coordinates */
|
|
88
|
-
|
|
90
|
+
protected _coords: NCustomCursor.ICoords;
|
|
89
91
|
|
|
90
92
|
/** Current cursor coordinates */
|
|
91
93
|
get coords() {
|
|
@@ -93,7 +95,7 @@ export class CustomCursor<
|
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
/** Target cursor coordinates */
|
|
96
|
-
|
|
98
|
+
protected _targetCoords: NCustomCursor.ICoords;
|
|
97
99
|
|
|
98
100
|
/** Target cursor coordinates */
|
|
99
101
|
get targetCoords() {
|
|
@@ -180,7 +182,7 @@ export class CustomCursor<
|
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
/** Create custom cursor */
|
|
183
|
-
|
|
185
|
+
protected _createCursor() {
|
|
184
186
|
const { container, domContainer } = this;
|
|
185
187
|
|
|
186
188
|
// hide native cursor
|
|
@@ -197,7 +199,7 @@ export class CustomCursor<
|
|
|
197
199
|
class: this.className(
|
|
198
200
|
'',
|
|
199
201
|
container instanceof Window ? '-in-window' : '-in-element',
|
|
200
|
-
'-disabled'
|
|
202
|
+
'-disabled',
|
|
201
203
|
),
|
|
202
204
|
parent: domContainer,
|
|
203
205
|
});
|
|
@@ -225,7 +227,7 @@ export class CustomCursor<
|
|
|
225
227
|
}
|
|
226
228
|
|
|
227
229
|
/** Set module events */
|
|
228
|
-
|
|
230
|
+
protected _setEvents() {
|
|
229
231
|
const { domContainer } = this;
|
|
230
232
|
|
|
231
233
|
this._animationFrame = new AnimationFrame();
|
|
@@ -235,38 +237,38 @@ export class CustomCursor<
|
|
|
235
237
|
this.addEventListener(
|
|
236
238
|
domContainer,
|
|
237
239
|
'mouseenter',
|
|
238
|
-
this._handleMouseEnter.bind(this)
|
|
240
|
+
this._handleMouseEnter.bind(this),
|
|
239
241
|
);
|
|
240
242
|
|
|
241
243
|
this.addEventListener(
|
|
242
244
|
domContainer,
|
|
243
245
|
'mouseleave',
|
|
244
|
-
this._handleMouseLeave.bind(this)
|
|
246
|
+
this._handleMouseLeave.bind(this),
|
|
245
247
|
);
|
|
246
248
|
|
|
247
249
|
this.addEventListener(
|
|
248
250
|
domContainer,
|
|
249
251
|
'mousemove',
|
|
250
|
-
this._handleMouseMove.bind(this)
|
|
252
|
+
this._handleMouseMove.bind(this),
|
|
251
253
|
);
|
|
252
254
|
|
|
253
255
|
this.addEventListener(
|
|
254
256
|
domContainer,
|
|
255
257
|
'mousedown',
|
|
256
|
-
this._handleMouseDown.bind(this)
|
|
258
|
+
this._handleMouseDown.bind(this),
|
|
257
259
|
);
|
|
258
260
|
|
|
259
261
|
this.addEventListener(
|
|
260
262
|
domContainer,
|
|
261
263
|
'mouseup',
|
|
262
|
-
this._handleMouseUp.bind(this)
|
|
264
|
+
this._handleMouseUp.bind(this),
|
|
263
265
|
);
|
|
264
266
|
|
|
265
267
|
this.addEventListener(window, 'blur', this._handleWindowBlur.bind(this));
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
/** Event on mouse enter */
|
|
269
|
-
|
|
271
|
+
protected _handleMouseEnter(evt: MouseEvent) {
|
|
270
272
|
this._coords.x = evt.clientX;
|
|
271
273
|
this._coords.y = evt.clientY;
|
|
272
274
|
this._targetCoords.x = evt.clientX;
|
|
@@ -276,12 +278,12 @@ export class CustomCursor<
|
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
/** Event on mouse leave */
|
|
279
|
-
|
|
281
|
+
protected _handleMouseLeave() {
|
|
280
282
|
this.outerElement.classList.remove(this.className('-in-action'));
|
|
281
283
|
}
|
|
282
284
|
|
|
283
285
|
/** Event on mouse move */
|
|
284
|
-
|
|
286
|
+
protected _handleMouseMove(evt: MouseEvent) {
|
|
285
287
|
this._targetCoords.x = evt.clientX;
|
|
286
288
|
this._targetCoords.y = evt.clientY;
|
|
287
289
|
|
|
@@ -293,7 +295,7 @@ export class CustomCursor<
|
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
/** Event on mouse down */
|
|
296
|
-
|
|
298
|
+
protected _handleMouseDown(evt: MouseEvent) {
|
|
297
299
|
if (evt.which === 1) {
|
|
298
300
|
this.outerElement.classList.add(this.className('-click'));
|
|
299
301
|
this.innerElement.classList.add(this.className('-click'));
|
|
@@ -301,20 +303,20 @@ export class CustomCursor<
|
|
|
301
303
|
}
|
|
302
304
|
|
|
303
305
|
/** Event on mouse up */
|
|
304
|
-
|
|
306
|
+
protected _handleMouseUp() {
|
|
305
307
|
this.outerElement.classList.remove(this.className('-click'));
|
|
306
308
|
this.innerElement.classList.remove(this.className('-click'));
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
/** Event on window blur */
|
|
310
|
-
|
|
312
|
+
protected _handleWindowBlur() {
|
|
311
313
|
this._handleMouseUp();
|
|
312
314
|
}
|
|
313
315
|
|
|
314
316
|
/** Set hover events on an element */
|
|
315
317
|
public addHoverElement(
|
|
316
318
|
settingsProp: NCustomCursor.IHoveredElement,
|
|
317
|
-
enterTimeout = 100
|
|
319
|
+
enterTimeout = 100,
|
|
318
320
|
) {
|
|
319
321
|
const settings: NCustomCursor.IHoveredElement = {
|
|
320
322
|
width: 'auto',
|
|
@@ -387,7 +389,7 @@ export class CustomCursor<
|
|
|
387
389
|
}
|
|
388
390
|
|
|
389
391
|
/** Recalculate current coordinates */
|
|
390
|
-
|
|
392
|
+
protected _calculateCoords() {
|
|
391
393
|
const { targetCoords, _coords: coords } = this;
|
|
392
394
|
|
|
393
395
|
coords.x = this._lerp(coords.x, targetCoords.x);
|
|
@@ -397,7 +399,7 @@ export class CustomCursor<
|
|
|
397
399
|
}
|
|
398
400
|
|
|
399
401
|
/** Linear interpolation */
|
|
400
|
-
|
|
402
|
+
protected _lerp(current: number, target: number) {
|
|
401
403
|
const { isFpsNormalized, lerp: ease } = this.props;
|
|
402
404
|
|
|
403
405
|
const fpsMultiplier = isFpsNormalized
|
|
@@ -410,7 +412,7 @@ export class CustomCursor<
|
|
|
410
412
|
}
|
|
411
413
|
|
|
412
414
|
/** Render elements */
|
|
413
|
-
|
|
415
|
+
protected _renderElements(): NCustomCursor.ICoords {
|
|
414
416
|
const { domContainer, outerElement } = this;
|
|
415
417
|
let { x, y } = this.coords;
|
|
416
418
|
const { width, height } = this.coords;
|
|
@@ -15,8 +15,10 @@ export type { NDraggerBase };
|
|
|
15
15
|
*/
|
|
16
16
|
export abstract class DraggerBase<
|
|
17
17
|
StaticProps extends NDraggerBase.IStaticProps = NDraggerBase.IStaticProps,
|
|
18
|
-
ChangeableProps extends
|
|
19
|
-
|
|
18
|
+
ChangeableProps extends
|
|
19
|
+
NDraggerBase.IChangeableProps = NDraggerBase.IChangeableProps,
|
|
20
|
+
CallbacksTypes extends
|
|
21
|
+
NDraggerBase.ICallbacksTypes = NDraggerBase.ICallbacksTypes,
|
|
20
22
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
21
23
|
protected _getDefaultProps() {
|
|
22
24
|
return {
|
|
@@ -32,7 +34,7 @@ export abstract class DraggerBase<
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/** Preloader container */
|
|
35
|
-
|
|
37
|
+
protected _container: Element | Window;
|
|
36
38
|
|
|
37
39
|
/** Preloader container */
|
|
38
40
|
get container() {
|
|
@@ -48,7 +50,7 @@ export abstract class DraggerBase<
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
/** Current pointer id */
|
|
51
|
-
|
|
53
|
+
protected _pointerID: number | null;
|
|
52
54
|
|
|
53
55
|
/** Current pointer id */
|
|
54
56
|
protected get pointerID() {
|
|
@@ -56,7 +58,7 @@ export abstract class DraggerBase<
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/** Current coordinates */
|
|
59
|
-
|
|
61
|
+
protected _coords: NDraggerBase.IVector2;
|
|
60
62
|
|
|
61
63
|
/** Current coordinates */
|
|
62
64
|
get coords() {
|
|
@@ -69,7 +71,7 @@ export abstract class DraggerBase<
|
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
/** Last coordinates */
|
|
72
|
-
|
|
74
|
+
protected _prevCoords: NDraggerBase.IVector2;
|
|
73
75
|
|
|
74
76
|
/** Last coordinates */
|
|
75
77
|
get prevCoords() {
|
|
@@ -82,7 +84,7 @@ export abstract class DraggerBase<
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
/** Coordinates on drag start */
|
|
85
|
-
|
|
87
|
+
protected _startCoords: NDraggerBase.IVector2;
|
|
86
88
|
|
|
87
89
|
/** Coordinates on drag start */
|
|
88
90
|
get startCoords() {
|
|
@@ -90,10 +92,10 @@ export abstract class DraggerBase<
|
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
/** Timeout of `handleEnd` */
|
|
93
|
-
|
|
95
|
+
protected _handleEndTimeout?: NodeJS.Timeout;
|
|
94
96
|
|
|
95
97
|
/** Current event type */
|
|
96
|
-
|
|
98
|
+
protected _type?: 'mouse' | 'touch';
|
|
97
99
|
|
|
98
100
|
/** Current event type */
|
|
99
101
|
get type() {
|
|
@@ -132,14 +134,14 @@ export abstract class DraggerBase<
|
|
|
132
134
|
this.container,
|
|
133
135
|
'mousedown',
|
|
134
136
|
(event) => this._handleStart(event),
|
|
135
|
-
{ passive: this.props.isPassive }
|
|
137
|
+
{ passive: this.props.isPassive },
|
|
136
138
|
);
|
|
137
139
|
|
|
138
140
|
this.addEventListener(
|
|
139
141
|
this.container,
|
|
140
142
|
'touchstart',
|
|
141
143
|
(event) => this._handleStart(event),
|
|
142
|
-
{ passive: this.props.isPassive }
|
|
144
|
+
{ passive: this.props.isPassive },
|
|
143
145
|
);
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -150,30 +152,30 @@ export abstract class DraggerBase<
|
|
|
150
152
|
this._runtimeListeners.push(
|
|
151
153
|
addEventListener(window, 'mouseup', (event) => this.handleEnd(event), {
|
|
152
154
|
passive: isPassive,
|
|
153
|
-
})
|
|
155
|
+
}),
|
|
154
156
|
);
|
|
155
157
|
|
|
156
158
|
this._runtimeListeners.push(
|
|
157
159
|
addEventListener(window, 'touchend', (event) => this.handleEnd(event), {
|
|
158
160
|
passive: isPassive,
|
|
159
|
-
})
|
|
161
|
+
}),
|
|
160
162
|
);
|
|
161
163
|
|
|
162
164
|
this._runtimeListeners.push(
|
|
163
165
|
addEventListener(window, 'touchcancel', () => this.cancel(), {
|
|
164
166
|
passive: isPassive,
|
|
165
|
-
})
|
|
167
|
+
}),
|
|
166
168
|
);
|
|
167
169
|
|
|
168
170
|
this._runtimeListeners.push(
|
|
169
171
|
addEventListener(window, 'blur', () => this.cancel(), {
|
|
170
172
|
passive: isPassive,
|
|
171
|
-
})
|
|
173
|
+
}),
|
|
172
174
|
);
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
/** Remove runtime events */
|
|
176
|
-
|
|
178
|
+
protected _removeRuntimeEvents() {
|
|
177
179
|
this._runtimeListeners.forEach((listener) => listener.remove());
|
|
178
180
|
|
|
179
181
|
this._runtimeListeners = [];
|
|
@@ -202,7 +204,7 @@ export abstract class DraggerBase<
|
|
|
202
204
|
}
|
|
203
205
|
|
|
204
206
|
/** Event on drag start */
|
|
205
|
-
|
|
207
|
+
protected _handleStart(event: NDraggerBase.TEvent) {
|
|
206
208
|
if (!this.props.isEnabled || this.isDragging) {
|
|
207
209
|
return false;
|
|
208
210
|
}
|
|
@@ -242,7 +244,7 @@ export abstract class DraggerBase<
|
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
/** Event on drag end */
|
|
245
|
-
|
|
247
|
+
protected handleEnd(event: NDraggerBase.TEvent) {
|
|
246
248
|
if (this._handleEndTimeout) {
|
|
247
249
|
return;
|
|
248
250
|
}
|
|
@@ -7,9 +7,12 @@ export type { NDraggerDirection };
|
|
|
7
7
|
* `Dragger` that detects swipe direction
|
|
8
8
|
*/
|
|
9
9
|
export class DraggerDirection<
|
|
10
|
-
StaticProps extends
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
StaticProps extends
|
|
11
|
+
NDraggerDirection.IStaticProps = NDraggerDirection.IStaticProps,
|
|
12
|
+
ChangeableProps extends
|
|
13
|
+
NDraggerDirection.IChangeableProps = NDraggerDirection.IChangeableProps,
|
|
14
|
+
CallbacksTypes extends
|
|
15
|
+
NDraggerDirection.ICallbacksTypes = NDraggerDirection.ICallbacksTypes,
|
|
13
16
|
> extends DraggerBase<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
14
17
|
protected _getDefaultProps() {
|
|
15
18
|
return {
|
|
@@ -9,8 +9,10 @@ export type { NDraggerMove };
|
|
|
9
9
|
*/
|
|
10
10
|
export class DraggerMove<
|
|
11
11
|
StaticProps extends NDraggerMove.IStaticProps = NDraggerMove.IStaticProps,
|
|
12
|
-
ChangeableProps extends
|
|
13
|
-
|
|
12
|
+
ChangeableProps extends
|
|
13
|
+
NDraggerMove.IChangeableProps = NDraggerMove.IChangeableProps,
|
|
14
|
+
CallbacksTypes extends
|
|
15
|
+
NDraggerMove.ICallbacksTypes = NDraggerMove.ICallbacksTypes,
|
|
14
16
|
> extends DraggerBase<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
15
17
|
protected _getDefaultProps() {
|
|
16
18
|
return {
|
|
@@ -52,8 +54,8 @@ export class DraggerMove<
|
|
|
52
54
|
},
|
|
53
55
|
{
|
|
54
56
|
passive: isPassive,
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
+
},
|
|
58
|
+
),
|
|
57
59
|
);
|
|
58
60
|
|
|
59
61
|
this._runtimeListeners.push(
|
|
@@ -67,8 +69,8 @@ export class DraggerMove<
|
|
|
67
69
|
},
|
|
68
70
|
{
|
|
69
71
|
passive: isPassive,
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
+
},
|
|
73
|
+
),
|
|
72
74
|
);
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -106,7 +108,7 @@ export class DraggerMove<
|
|
|
106
108
|
this._togglePointerEvents(true);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
protected _togglePointerEvents(isEnabledProp: boolean) {
|
|
110
112
|
if (typeof this.props.disablePointerEventsAt !== 'number') {
|
|
111
113
|
return;
|
|
112
114
|
}
|
|
@@ -13,7 +13,7 @@ export type { NMarquee };
|
|
|
13
13
|
export class Marquee<
|
|
14
14
|
StaticProps extends NMarquee.IStaticProps = NMarquee.IStaticProps,
|
|
15
15
|
ChangeableProps extends NMarquee.IChangeableProps = NMarquee.IChangeableProps,
|
|
16
|
-
CallbacksTypes extends NMarquee.ICallbacksTypes = NMarquee.ICallbacksTypes
|
|
16
|
+
CallbacksTypes extends NMarquee.ICallbacksTypes = NMarquee.ICallbacksTypes,
|
|
17
17
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
18
18
|
protected _getDefaultProps() {
|
|
19
19
|
return {
|
|
@@ -63,7 +63,7 @@ export class Marquee<
|
|
|
63
63
|
protected _canPlay: boolean;
|
|
64
64
|
|
|
65
65
|
/** Animation frame */
|
|
66
|
-
|
|
66
|
+
protected _animationFrame?: AnimationFrame;
|
|
67
67
|
|
|
68
68
|
constructor(initialProps?: StaticProps & ChangeableProps, canInit = true) {
|
|
69
69
|
super(initialProps, false);
|
|
@@ -190,7 +190,7 @@ export class Marquee<
|
|
|
190
190
|
// get items quantity
|
|
191
191
|
if (itemWidth < container.clientWidth) {
|
|
192
192
|
this._quantity = Math.ceil(
|
|
193
|
-
(container.clientWidth + itemWidth) / itemWidth
|
|
193
|
+
(container.clientWidth + itemWidth) / itemWidth,
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
this._quantity = Math.max(this._quantity, 4);
|
|
@@ -11,8 +11,10 @@ export type { NPreloader };
|
|
|
11
11
|
*/
|
|
12
12
|
export class Preloader<
|
|
13
13
|
StaticProps extends NPreloader.IStaticProps = NPreloader.IStaticProps,
|
|
14
|
-
ChangeableProps extends
|
|
15
|
-
|
|
14
|
+
ChangeableProps extends
|
|
15
|
+
NPreloader.IChangeableProps = NPreloader.IChangeableProps,
|
|
16
|
+
CallbacksTypes extends
|
|
17
|
+
NPreloader.ICallbacksTypes = NPreloader.ICallbacksTypes,
|
|
16
18
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
17
19
|
protected _getDefaultProps() {
|
|
18
20
|
return {
|
|
@@ -27,7 +29,7 @@ export class Preloader<
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
/** Preloader container */
|
|
30
|
-
|
|
32
|
+
protected _container?: HTMLElement | false;
|
|
31
33
|
|
|
32
34
|
/** Preloader container */
|
|
33
35
|
get container() {
|
|
@@ -35,7 +37,7 @@ export class Preloader<
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/** Preloader start time */
|
|
38
|
-
|
|
40
|
+
protected _startTime: number;
|
|
39
41
|
|
|
40
42
|
/** Preloader start time */
|
|
41
43
|
get startTime() {
|
|
@@ -43,7 +45,7 @@ export class Preloader<
|
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
/** Preloader end time */
|
|
46
|
-
|
|
48
|
+
protected _endTime: number;
|
|
47
49
|
|
|
48
50
|
/** Preloader end time */
|
|
49
51
|
get endTime() {
|
|
@@ -58,10 +60,10 @@ export class Preloader<
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/** Preloader is to be hidden */
|
|
61
|
-
|
|
63
|
+
protected _isToBeHidden: boolean;
|
|
62
64
|
|
|
63
65
|
/** Preloader is hidden */
|
|
64
|
-
|
|
66
|
+
protected _isHidden: boolean;
|
|
65
67
|
|
|
66
68
|
/** Preloader is hidden */
|
|
67
69
|
get isHidden() {
|
|
@@ -123,7 +125,7 @@ export class Preloader<
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
/** When the page is fully loaded */
|
|
126
|
-
|
|
128
|
+
protected _handleLoaded() {
|
|
127
129
|
this.callbacks.tbt('loaded', undefined);
|
|
128
130
|
|
|
129
131
|
// hide the preloader
|
|
@@ -136,7 +138,7 @@ export class Preloader<
|
|
|
136
138
|
public hide(
|
|
137
139
|
duration = typeof this.props.hideAnimation !== 'boolean'
|
|
138
140
|
? this.props.hideAnimation
|
|
139
|
-
: 250
|
|
141
|
+
: 250,
|
|
140
142
|
) {
|
|
141
143
|
this._isToBeHidden = true;
|
|
142
144
|
this.callbacks.tbt('hide', undefined);
|
|
@@ -169,7 +171,7 @@ export class Preloader<
|
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
/** Handle the moment when the preloader is hidden */
|
|
172
|
-
|
|
174
|
+
protected _handleHidden() {
|
|
173
175
|
this._isHidden = true;
|
|
174
176
|
this.callbacks.tbt('hidden', undefined);
|
|
175
177
|
}
|