vevet 3.4.0 → 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/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/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.map +1 -1
- package/lib/types/components/BaseTimeline/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.map +1 -1
- 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.map +1 -1
- package/lib/types/components/Preloader/index.d.ts.map +1 -1
- package/lib/types/components/ProgressPreloader/index.d.ts.map +1 -1
- package/lib/types/components/ScrollBar/index.d.ts.map +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.map +1 -1
- package/lib/types/components/SmoothScrollDragPlugin/index.d.ts.map +1 -1
- package/lib/types/components/SmoothScrollKeyboardPlugin/index.d.ts.map +1 -1
- package/lib/types/components/SplitText/index.d.ts.map +1 -1
- 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 +8 -5
- package/src/components/BaseTimeline/index.ts +6 -4
- package/src/components/BaseTimeline/stories/Nested.tsx +1 -1
- package/src/components/Ctx2D/index.ts +1 -1
- package/src/components/Ctx2DPrerender/index.ts +6 -3
- package/src/components/CustomCursor/index.ts +11 -9
- package/src/components/DraggerBase/index.ts +10 -8
- package/src/components/DraggerDirection/index.ts +6 -3
- package/src/components/DraggerMove/index.ts +8 -6
- package/src/components/Marquee/index.ts +2 -2
- package/src/components/Preloader/index.ts +5 -3
- package/src/components/ProgressPreloader/index.ts +16 -10
- 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 +6 -4
- 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 +12 -10
- 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 +9 -7
- 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 +7 -4
- package/src/components/SmoothScrollDragPlugin/stories/index.tsx +1 -1
- package/src/components/SmoothScrollKeyboardPlugin/index.ts +7 -4
- package/src/components/SmoothScrollKeyboardPlugin/stories/index.tsx +1 -1
- package/src/components/SplitText/index.ts +5 -3
- package/src/components/Timeline/index.ts +4 -3
- 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
|
@@ -159,12 +159,12 @@ export class Viewport extends Callbacks<NViewport.ICallbacksTypes> {
|
|
|
159
159
|
if (this.isLandscape) {
|
|
160
160
|
this._updateBreakpointClassNames(
|
|
161
161
|
EOrientationTypes.Landscape,
|
|
162
|
-
orientationTypes
|
|
162
|
+
orientationTypes,
|
|
163
163
|
);
|
|
164
164
|
} else if (this.isPortrait) {
|
|
165
165
|
this._updateBreakpointClassNames(
|
|
166
166
|
EOrientationTypes.Portrait,
|
|
167
|
-
orientationTypes
|
|
167
|
+
orientationTypes,
|
|
168
168
|
);
|
|
169
169
|
} else {
|
|
170
170
|
this._updateBreakpointClassNames('', orientationTypes);
|
|
@@ -195,7 +195,7 @@ export class Viewport extends Callbacks<NViewport.ICallbacksTypes> {
|
|
|
195
195
|
/** Launch callbacks on resize. */
|
|
196
196
|
private _onResize(
|
|
197
197
|
/** force all callbacks */
|
|
198
|
-
force = false
|
|
198
|
+
force = false,
|
|
199
199
|
) {
|
|
200
200
|
const { _width: prevWidth, _height: prevHeight } = this;
|
|
201
201
|
|
package/src/Application/index.ts
CHANGED
|
@@ -64,7 +64,7 @@ export class Callbacks<Types extends NCallbacks.ITypes = NCallbacks.ITypes> {
|
|
|
64
64
|
public add<T extends keyof Types>(
|
|
65
65
|
target: T,
|
|
66
66
|
action: NCallbacks.TAction<Types[T]>,
|
|
67
|
-
settings: NCallbacks.ISettings = {}
|
|
67
|
+
settings: NCallbacks.ISettings = {},
|
|
68
68
|
): NCallbacks.IAddedCallback {
|
|
69
69
|
const id = uid('callback');
|
|
70
70
|
|
|
@@ -160,7 +160,7 @@ export class Callbacks<Types extends NCallbacks.ITypes = NCallbacks.ITypes> {
|
|
|
160
160
|
*/
|
|
161
161
|
private _callAction(
|
|
162
162
|
{ id, isEnabled, timeout, isOnce, action }: NCallbacks.ICallback<Types>,
|
|
163
|
-
parameter: Types[keyof Types]
|
|
163
|
+
parameter: Types[keyof Types],
|
|
164
164
|
) {
|
|
165
165
|
if (!isEnabled) {
|
|
166
166
|
return;
|
|
@@ -9,8 +9,10 @@ export type { NComponent };
|
|
|
9
9
|
*/
|
|
10
10
|
export class Component<
|
|
11
11
|
StaticProps extends NComponent.IStaticProps = NComponent.IStaticProps,
|
|
12
|
-
ChangeableProps extends
|
|
13
|
-
|
|
12
|
+
ChangeableProps extends
|
|
13
|
+
NComponent.IChangeableProps = NComponent.IChangeableProps,
|
|
14
|
+
CallbacksTypes extends
|
|
15
|
+
NComponent.ICallbacksTypes = NComponent.ICallbacksTypes,
|
|
14
16
|
> extends Module<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
15
17
|
/** Inner plugins */
|
|
16
18
|
private _plugins?: Plugin[];
|
package/src/base/Module/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ type TViewportAdd = Viewport['add'];
|
|
|
22
22
|
export class Module<
|
|
23
23
|
StaticProps extends NModule.IStaticProps = NModule.IStaticProps,
|
|
24
24
|
ChangeableProps extends NModule.IChangeableProps = NModule.IChangeableProps,
|
|
25
|
-
CallbacksTypes extends NModule.ICallbacksTypes = NModule.ICallbacksTypes
|
|
25
|
+
CallbacksTypes extends NModule.ICallbacksTypes = NModule.ICallbacksTypes,
|
|
26
26
|
> {
|
|
27
27
|
/**
|
|
28
28
|
* Get Default properties (should be extended)
|
|
@@ -139,13 +139,13 @@ export class Module<
|
|
|
139
139
|
* Defines if you need to call {@linkcode Module.init} at the constructor's end.
|
|
140
140
|
* If you want to add responsive properties, set this parameter to `false`.
|
|
141
141
|
*/
|
|
142
|
-
canInit = true
|
|
142
|
+
canInit = true,
|
|
143
143
|
) {
|
|
144
144
|
if (window.vevetApp) {
|
|
145
145
|
this._app = window.vevetApp;
|
|
146
146
|
} else {
|
|
147
147
|
throw new Error(
|
|
148
|
-
'Vevet.Application does not exist yet. Call "new Vevet.Application()" before using all the stuff'
|
|
148
|
+
'Vevet.Application does not exist yet. Call "new Vevet.Application()" before using all the stuff',
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -156,13 +156,13 @@ export class Module<
|
|
|
156
156
|
|
|
157
157
|
const props = mergeWithoutArrays(
|
|
158
158
|
this._getDefaultProps(),
|
|
159
|
-
initialProps || {}
|
|
159
|
+
initialProps || {},
|
|
160
160
|
);
|
|
161
161
|
|
|
162
162
|
this._mutableProps = new MutableProps(
|
|
163
163
|
props as StaticProps & ChangeableProps,
|
|
164
164
|
() => this._onPropsMutate(),
|
|
165
|
-
this.name
|
|
165
|
+
this.name,
|
|
166
166
|
);
|
|
167
167
|
|
|
168
168
|
if (canInit) {
|
|
@@ -174,7 +174,7 @@ export class Module<
|
|
|
174
174
|
public addResponsiveProps(rules: NMutableProps.IResponsive<ChangeableProps>) {
|
|
175
175
|
if (this.isInitialized) {
|
|
176
176
|
throw new Error(
|
|
177
|
-
'Responsive properties cannot be added after `init` is called'
|
|
177
|
+
'Responsive properties cannot be added after `init` is called',
|
|
178
178
|
);
|
|
179
179
|
} else {
|
|
180
180
|
this._mutableProps.addResponsiveProps(rules);
|
|
@@ -232,7 +232,7 @@ export class Module<
|
|
|
232
232
|
public addViewportCallback(
|
|
233
233
|
target: Parameters<TViewportAdd>[0],
|
|
234
234
|
action: Parameters<TViewportAdd>[1],
|
|
235
|
-
data: Parameters<TViewportAdd>[2] = {}
|
|
235
|
+
data: Parameters<TViewportAdd>[2] = {},
|
|
236
236
|
) {
|
|
237
237
|
const callback = this._app.viewport.add(target, action, {
|
|
238
238
|
...data,
|
|
@@ -246,7 +246,7 @@ export class Module<
|
|
|
246
246
|
public addCallback<T extends keyof CallbacksTypes>(
|
|
247
247
|
target: T,
|
|
248
248
|
action: NCallbacks.TAction<CallbacksTypes[T]>,
|
|
249
|
-
settings: NCallbacks.ISettings = {}
|
|
249
|
+
settings: NCallbacks.ISettings = {},
|
|
250
250
|
) {
|
|
251
251
|
return this.callbacks.add(target, action, settings);
|
|
252
252
|
}
|
|
@@ -255,12 +255,12 @@ export class Module<
|
|
|
255
255
|
public addEventListener<
|
|
256
256
|
El extends ListenerElement,
|
|
257
257
|
Target extends keyof HTMLElementEventMap,
|
|
258
|
-
Callback extends (evt: HTMLElementEventMap[Target]) => void
|
|
258
|
+
Callback extends (evt: HTMLElementEventMap[Target]) => void,
|
|
259
259
|
>(
|
|
260
260
|
el: El,
|
|
261
261
|
target: Target,
|
|
262
262
|
callback: Callback,
|
|
263
|
-
options?: IAddEventListenerOptions
|
|
263
|
+
options?: IAddEventListenerOptions,
|
|
264
264
|
): IAddEventListener {
|
|
265
265
|
const listener = addEventListener(el, target, callback, options);
|
|
266
266
|
this._listeners.push(listener);
|
|
@@ -269,7 +269,7 @@ export class Module<
|
|
|
269
269
|
...listener,
|
|
270
270
|
remove: () => {
|
|
271
271
|
this._listeners = this._listeners.filter(
|
|
272
|
-
(item) => item.id !== listener.id
|
|
272
|
+
(item) => item.id !== listener.id,
|
|
273
273
|
);
|
|
274
274
|
|
|
275
275
|
return listener.remove();
|
|
@@ -285,7 +285,7 @@ export class Module<
|
|
|
285
285
|
protected toggleClassName(
|
|
286
286
|
element: Element,
|
|
287
287
|
className: string,
|
|
288
|
-
isActive: boolean
|
|
288
|
+
isActive: boolean,
|
|
289
289
|
) {
|
|
290
290
|
const isAlreadyExists = element.classList.contains(className);
|
|
291
291
|
|
|
@@ -316,7 +316,7 @@ export class Module<
|
|
|
316
316
|
this._listeners.forEach((listener) => listener.remove());
|
|
317
317
|
|
|
318
318
|
this._classNamesToRemove.forEach(({ element, className }) =>
|
|
319
|
-
element.classList.remove(className)
|
|
319
|
+
element.classList.remove(className),
|
|
320
320
|
);
|
|
321
321
|
|
|
322
322
|
this._isDestroyed = true;
|
|
@@ -48,7 +48,7 @@ export class MutableProps<
|
|
|
48
48
|
* Mutable Properties
|
|
49
49
|
* (may change on window resize or through {@linkcode MutableProps.changeProps})
|
|
50
50
|
*/
|
|
51
|
-
ChangeableProps extends Record<string, any
|
|
51
|
+
ChangeableProps extends Record<string, any>,
|
|
52
52
|
> {
|
|
53
53
|
/**
|
|
54
54
|
* Vevet Application.
|
|
@@ -120,7 +120,7 @@ export class MutableProps<
|
|
|
120
120
|
/**
|
|
121
121
|
* Name of the responsive properties.
|
|
122
122
|
*/
|
|
123
|
-
private _name = 'Responsive Props'
|
|
123
|
+
private _name = 'Responsive Props',
|
|
124
124
|
) {
|
|
125
125
|
this._app = window.vevetApp;
|
|
126
126
|
this._refProps = mergeWithoutArrays({}, _initProps);
|
|
@@ -144,7 +144,7 @@ export class MutableProps<
|
|
|
144
144
|
this._viewportCallback = this._app.viewport.add(
|
|
145
145
|
'width',
|
|
146
146
|
this._responseProps.bind(this),
|
|
147
|
-
{ name: this._name }
|
|
147
|
+
{ name: this._name },
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
|
package/src/base/Plugin/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ export abstract class Plugin<
|
|
|
10
10
|
StaticProps extends NPlugin.IStaticProps = NPlugin.IStaticProps,
|
|
11
11
|
ChangeableProps extends NPlugin.IChangeableProps = NPlugin.IChangeableProps,
|
|
12
12
|
CallbacksTypes extends NPlugin.ICallbacksTypes = NPlugin.ICallbacksTypes,
|
|
13
|
-
Component = any
|
|
13
|
+
Component = any,
|
|
14
14
|
> extends Module<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
15
15
|
constructor(initialProps?: StaticProps & ChangeableProps) {
|
|
16
16
|
super(initialProps, false);
|
|
@@ -29,7 +29,7 @@ export abstract class Plugin<
|
|
|
29
29
|
public init() {
|
|
30
30
|
if (!this.component) {
|
|
31
31
|
throw new Error(
|
|
32
|
-
'Component is unknown. Be sure that `plugin.component` is non-nullable.'
|
|
32
|
+
'Component is unknown. Be sure that `plugin.component` is non-nullable.',
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -7,9 +7,12 @@ export type { NAnimationFrame };
|
|
|
7
7
|
* Launch an animation frame with a certain FPS
|
|
8
8
|
*/
|
|
9
9
|
export class AnimationFrame<
|
|
10
|
-
StaticProps extends
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
StaticProps extends
|
|
11
|
+
NAnimationFrame.IStaticProps = NAnimationFrame.IStaticProps,
|
|
12
|
+
ChangeableProps extends
|
|
13
|
+
NAnimationFrame.IChangeableProps = NAnimationFrame.IChangeableProps,
|
|
14
|
+
CallbacksTypes extends
|
|
15
|
+
NAnimationFrame.ICallbacksTypes = NAnimationFrame.ICallbacksTypes,
|
|
13
16
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
14
17
|
protected _getDefaultProps() {
|
|
15
18
|
return {
|
|
@@ -164,7 +167,7 @@ export class AnimationFrame<
|
|
|
164
167
|
const minFrameDuration =
|
|
165
168
|
this.props.fps === 'auto' ? 1 : 1000 / this.props.fps;
|
|
166
169
|
const newFrameIndex = Math.floor(
|
|
167
|
-
(startTime - this._firstFrameTime) / minFrameDuration
|
|
170
|
+
(startTime - this._firstFrameTime) / minFrameDuration,
|
|
168
171
|
);
|
|
169
172
|
|
|
170
173
|
// break if frame index the same
|
|
@@ -201,7 +204,7 @@ export class AnimationFrame<
|
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
const totalFramesDuration = this._frameDurations.reduce(
|
|
204
|
-
(prev, curr) => prev + curr
|
|
207
|
+
(prev, curr) => prev + curr,
|
|
205
208
|
);
|
|
206
209
|
|
|
207
210
|
const approximateFrameDuration =
|
|
@@ -11,8 +11,10 @@ export type { NBaseTimeline };
|
|
|
11
11
|
*/
|
|
12
12
|
export class BaseTimeline<
|
|
13
13
|
StaticProps extends NBaseTimeline.IStaticProps = NBaseTimeline.IStaticProps,
|
|
14
|
-
ChangeableProps extends
|
|
15
|
-
|
|
14
|
+
ChangeableProps extends
|
|
15
|
+
NBaseTimeline.IChangeableProps = NBaseTimeline.IChangeableProps,
|
|
16
|
+
CallbacksTypes extends
|
|
17
|
+
NBaseTimeline.ICallbacksTypes = NBaseTimeline.ICallbacksTypes,
|
|
16
18
|
> extends ComponentClass<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
17
19
|
protected _getDefaultProps() {
|
|
18
20
|
return {
|
|
@@ -70,7 +72,7 @@ export class BaseTimeline<
|
|
|
70
72
|
return {
|
|
71
73
|
remove: () => {
|
|
72
74
|
this._nestedTimelines = this._nestedTimelines.filter(
|
|
73
|
-
({ id: nestedTimelineId }) => nestedTimelineId !== id
|
|
75
|
+
({ id: nestedTimelineId }) => nestedTimelineId !== id,
|
|
74
76
|
);
|
|
75
77
|
},
|
|
76
78
|
};
|
|
@@ -103,7 +105,7 @@ export class BaseTimeline<
|
|
|
103
105
|
const timelineProgress = clampScope(
|
|
104
106
|
progressForNestedTimeline,
|
|
105
107
|
timeline.props.nestedScope,
|
|
106
|
-
[0, 1]
|
|
108
|
+
[0, 1],
|
|
107
109
|
);
|
|
108
110
|
|
|
109
111
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -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 {
|
|
@@ -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 {
|
|
@@ -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
|
});
|
|
@@ -235,31 +237,31 @@ 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));
|
|
@@ -314,7 +316,7 @@ export class CustomCursor<
|
|
|
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',
|
|
@@ -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 {
|
|
@@ -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,25 +152,25 @@ 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
|
|
|
@@ -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
|
|
|
@@ -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 {
|
|
@@ -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 {
|
|
@@ -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);
|
|
@@ -15,9 +15,12 @@ export type { NProgressPreloader };
|
|
|
15
15
|
* Page preloader with smooth progress calculation
|
|
16
16
|
*/
|
|
17
17
|
export class ProgressPreloader<
|
|
18
|
-
StaticProps extends
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
StaticProps extends
|
|
19
|
+
NProgressPreloader.IStaticProps = NProgressPreloader.IStaticProps,
|
|
20
|
+
ChangeableProps extends
|
|
21
|
+
NProgressPreloader.IChangeableProps = NProgressPreloader.IChangeableProps,
|
|
22
|
+
CallbacksTypes extends
|
|
23
|
+
NProgressPreloader.ICallbacksTypes = NProgressPreloader.ICallbacksTypes,
|
|
21
24
|
> extends Preloader<StaticProps, ChangeableProps, CallbacksTypes> {
|
|
22
25
|
protected _getDefaultProps() {
|
|
23
26
|
return {
|
|
@@ -190,7 +193,7 @@ export class ProgressPreloader<
|
|
|
190
193
|
|
|
191
194
|
let loadCount = parseInt(
|
|
192
195
|
element.getAttribute('data-load-count') || '1',
|
|
193
|
-
10
|
|
196
|
+
10,
|
|
194
197
|
);
|
|
195
198
|
|
|
196
199
|
loadCount = Number.isNaN(loadCount)
|
|
@@ -224,7 +227,7 @@ export class ProgressPreloader<
|
|
|
224
227
|
resolve();
|
|
225
228
|
}
|
|
226
229
|
},
|
|
227
|
-
{ isProtected: true, name: this.name }
|
|
230
|
+
{ isProtected: true, name: this.name },
|
|
228
231
|
);
|
|
229
232
|
});
|
|
230
233
|
}
|
|
@@ -233,22 +236,25 @@ export class ProgressPreloader<
|
|
|
233
236
|
protected _preloadResources() {
|
|
234
237
|
this.images.forEach((image) =>
|
|
235
238
|
preloadImage(image, (isSuccess) =>
|
|
236
|
-
this._handleLoadedResource({ element: image, isSuccess })
|
|
237
|
-
)
|
|
239
|
+
this._handleLoadedResource({ element: image, isSuccess }),
|
|
240
|
+
),
|
|
238
241
|
);
|
|
239
242
|
|
|
240
243
|
// preload videos
|
|
241
244
|
this.videos.forEach((video) =>
|
|
242
245
|
preloadVideo(video, (isSuccess) =>
|
|
243
|
-
this._handleLoadedResource({ element: video, isSuccess })
|
|
244
|
-
)
|
|
246
|
+
this._handleLoadedResource({ element: video, isSuccess }),
|
|
247
|
+
),
|
|
245
248
|
);
|
|
246
249
|
|
|
247
250
|
// preload custom resources
|
|
248
251
|
this._customResources.forEach((data) => {
|
|
249
252
|
preloadCustomElement(data, this)
|
|
250
253
|
.then(() =>
|
|
251
|
-
this._handleLoadedResource({
|
|
254
|
+
this._handleLoadedResource({
|
|
255
|
+
element: data.element,
|
|
256
|
+
isSuccess: true,
|
|
257
|
+
}),
|
|
252
258
|
)
|
|
253
259
|
.catch(() => {});
|
|
254
260
|
});
|
|
@@ -48,7 +48,7 @@ function getLoadProgress({
|
|
|
48
48
|
|
|
49
49
|
export function preloadCustomElement(
|
|
50
50
|
data: NProgressPreloader.ICustomResourceData,
|
|
51
|
-
instance: Module<any, any, any
|
|
51
|
+
instance: Module<any, any, any>,
|
|
52
52
|
) {
|
|
53
53
|
return new Promise<void>((resolve) => {
|
|
54
54
|
const { targetProgress } = data;
|