vevet 2.0.1-dev.7 → 2.0.5
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/build/cdn/index.js +1 -1
- package/build/cjs/app/Application.js +8 -8
- package/build/cjs/app/events/PageLoad.js +3 -3
- package/build/cjs/app/events/Viewport.js +5 -5
- package/build/cjs/base/Callbacks.js +3 -3
- package/build/cjs/base/Module.js +16 -7
- package/build/cjs/base/MutableProp.js +10 -10
- package/build/cjs/components/animation-frame/AnimationFrame.js +1 -1
- package/build/cjs/components/canvas/Ctx2D.js +7 -3
- package/build/cjs/components/canvas/Ctx2DPrerender.js +21 -3
- package/build/cjs/components/cursor/CustomCursor.js +12 -12
- package/build/cjs/components/dragger/Dragger.js +8 -8
- package/build/cjs/components/dragger/DraggerMove.js +2 -2
- package/build/cjs/components/loading/Preloader.js +5 -5
- package/build/cjs/components/loading/ProgressPreloader.js +17 -5
- package/build/cjs/components/page/Page.js +37 -9
- package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +2 -2
- package/build/cjs/components/scroll/scrollable/ScrollEventsBase.js +1 -1
- package/build/cjs/components/scroll/scrollable/ScrollView.js +133 -73
- package/build/cjs/components/scroll/scrollbar/Bar.js +18 -15
- package/build/cjs/components/scroll/scrollbar/ScrollBar.js +9 -7
- package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +26 -22
- package/build/cjs/components/text/SplitText.js +47 -12
- package/build/cjs/components/timeline/StaticTimeline.js +4 -4
- package/build/cjs/components/timeline/Timeline.js +2 -2
- package/build/cjs/handlers/wheel/WheelHandler.js +4 -4
- package/build/cjs/utils/common/mergeWithoutArrays.js +1 -1
- package/build/cjs/utils/common/randID.js +2 -2
- package/build/cjs/utils/listeners/onScroll.js +66 -28
- package/build/cjs/utils/math/{boundVal.js → clamp.js} +3 -3
- package/build/cjs/utils/math/clampScope.js +16 -0
- package/build/cjs/utils/math/inScope.js +10 -0
- package/build/cjs/utils/math/index.js +13 -5
- package/build/cjs/utils/math/scoped.js +18 -0
- package/build/cjs/utils/math/spreadScope.js +18 -0
- package/build/cjs/utils/math/wrap.js +13 -0
- package/build/es/base/Module.js +2 -4
- package/build/es/components/animation-frame/AnimationFrame.js +2 -2
- package/build/es/components/canvas/Ctx2D.js +6 -2
- package/build/es/components/canvas/Ctx2DPrerender.js +20 -2
- package/build/es/components/loading/ProgressPreloader.js +14 -2
- package/build/es/components/page/Page.js +32 -8
- package/build/es/components/scroll/scrollable/ScrollView.js +112 -62
- package/build/es/components/scroll/scrollbar/Bar.js +9 -6
- package/build/es/components/scroll/scrollbar/ScrollBar.js +3 -1
- package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +13 -9
- package/build/es/components/text/SplitText.js +38 -3
- package/build/es/components/timeline/StaticTimeline.js +3 -3
- package/build/es/components/timeline/Timeline.js +2 -2
- package/build/es/utils/listeners/onScroll.js +65 -28
- package/build/es/utils/math/{boundVal.js → clamp.js} +2 -2
- package/build/es/utils/math/clampScope.js +8 -0
- package/build/es/utils/math/inScope.js +6 -0
- package/build/es/utils/math/index.js +7 -3
- package/build/es/utils/math/scoped.js +14 -0
- package/build/es/utils/math/spreadScope.js +15 -0
- package/build/es/utils/math/wrap.js +10 -0
- package/build/types/base/Module.d.ts.map +1 -1
- package/build/types/components/canvas/Ctx2D.d.ts +9 -0
- package/build/types/components/canvas/Ctx2D.d.ts.map +1 -1
- package/build/types/components/canvas/Ctx2DPrerender.d.ts +1 -1
- package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -1
- package/build/types/components/loading/ProgressPreloader.d.ts +7 -0
- package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -1
- package/build/types/components/page/Page.d.ts +2 -0
- package/build/types/components/page/Page.d.ts.map +1 -1
- package/build/types/components/scroll/scrollable/ScrollView.d.ts +40 -14
- package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -1
- package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -1
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +4 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -1
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +4 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -1
- package/build/types/components/text/SplitText.d.ts +10 -0
- package/build/types/components/text/SplitText.d.ts.map +1 -1
- package/build/types/utils/listeners/onScroll.d.ts +10 -6
- package/build/types/utils/listeners/onScroll.d.ts.map +1 -1
- package/build/types/utils/math/clamp.d.ts +5 -0
- package/build/types/utils/math/clamp.d.ts.map +1 -0
- package/build/types/utils/math/clampScope.d.ts +5 -0
- package/build/types/utils/math/clampScope.d.ts.map +1 -0
- package/build/types/utils/math/inScope.d.ts +5 -0
- package/build/types/utils/math/inScope.d.ts.map +1 -0
- package/build/types/utils/math/index.d.ts +7 -3
- package/build/types/utils/math/index.d.ts.map +1 -1
- package/build/types/utils/math/scoped.d.ts +12 -0
- package/build/types/utils/math/scoped.d.ts.map +1 -0
- package/build/types/utils/math/spreadScope.d.ts +5 -0
- package/build/types/utils/math/spreadScope.d.ts.map +1 -0
- package/build/types/utils/math/wrap.d.ts +5 -0
- package/build/types/utils/math/wrap.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/ts/base/Module.ts +5 -4
- package/src/ts/components/animation-frame/AnimationFrame.ts +2 -2
- package/src/ts/components/canvas/Ctx2D.ts +16 -1
- package/src/ts/components/canvas/Ctx2DPrerender.ts +23 -6
- package/src/ts/components/loading/ProgressPreloader.ts +21 -2
- package/src/ts/components/page/Page.ts +34 -8
- package/src/ts/components/scroll/scrollable/ScrollView.ts +155 -86
- package/src/ts/components/scroll/scrollbar/Bar.ts +9 -6
- package/src/ts/components/scroll/scrollbar/ScrollBar.ts +7 -0
- package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +17 -8
- package/src/ts/components/text/SplitText.ts +52 -2
- package/src/ts/components/timeline/StaticTimeline.ts +4 -4
- package/src/ts/components/timeline/Timeline.ts +2 -2
- package/src/ts/utils/listeners/onScroll.ts +101 -38
- package/src/ts/utils/math/{boundVal.ts → clamp.ts} +3 -3
- package/src/ts/utils/math/clampScope.ts +16 -0
- package/src/ts/utils/math/inScope.ts +9 -0
- package/src/ts/utils/math/index.ts +12 -4
- package/src/ts/utils/math/scoped.ts +17 -0
- package/src/ts/utils/math/spreadScope.ts +18 -0
- package/src/ts/utils/math/wrap.ts +18 -0
- package/build/cjs/components/scroll/custom-scroll/CustomScroll.js +0 -517
- package/build/cjs/components/split-text/SplitText.js +0 -233
- package/build/cjs/utils/math/scopeProgress.js +0 -25
- package/build/es/components/scroll/custom-scroll/CustomScroll.js +0 -486
- package/build/es/components/split-text/SplitText.js +0 -199
- package/build/es/utils/math/scopeProgress.js +0 -22
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts +0 -322
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts.map +0 -1
- package/build/types/components/split-text/SplitText.d.ts +0 -118
- package/build/types/components/split-text/SplitText.d.ts.map +0 -1
- package/build/types/utils/math/boundVal.d.ts +0 -5
- package/build/types/utils/math/boundVal.d.ts.map +0 -1
- package/build/types/utils/math/scopeProgress.d.ts +0 -20
- package/build/types/utils/math/scopeProgress.d.ts.map +0 -1
- package/src/ts/utils/math/scopeProgress.ts +0 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollBar.d.ts","sourceRoot":"","sources":["../../../../../src/ts/components/scroll/scrollbar/ScrollBar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,GAAG,MAAM,OAAO,CAAC;AAIxB,yBAAiB,UAAU,CAAC;IAExB;;OAEG;IACH,UAAiB,UAAW,SAAQ,UAAU,CAAC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;IACH,SAAS,CAAC,YAAY,CAClB,EAAE,GAAE,kBAAkB,GAAG,KAAa;IAU1C;;OAEG;IACH,SAAS,CAAC,eAAe;IAgBzB;;OAEG;IACI,QAAQ;IA2Cf;;OAEG;IACH,SAAS,CAAC,QAAQ;CA0BrB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NViewport } from '../../app/events/Viewport';
|
|
1
2
|
import { Component, NComponent } from '../../base/Component';
|
|
2
3
|
import { RequiredModuleProp } from '../../utils/types/utility';
|
|
3
4
|
export declare namespace NSplitText {
|
|
@@ -20,6 +21,15 @@ export declare namespace NSplitText {
|
|
|
20
21
|
* @default false
|
|
21
22
|
*/
|
|
22
23
|
appendLines?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Viewport resize event target
|
|
26
|
+
* @default ''
|
|
27
|
+
*/
|
|
28
|
+
viewportTarget?: keyof NViewport.CallbacksTypes;
|
|
29
|
+
/**
|
|
30
|
+
* @default 0
|
|
31
|
+
*/
|
|
32
|
+
resizeTimeout?: number;
|
|
23
33
|
}
|
|
24
34
|
/**
|
|
25
35
|
* Changeable properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitText.d.ts","sourceRoot":"","sources":["../../../../src/ts/components/text/SplitText.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAI/D,yBAAiB,UAAU,CAAC;IAExB;;OAEG;IACH,UAAiB,UAAW,SAAQ,UAAU,CAAC,UAAU;QACrD;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAC7B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB;;;WAGG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SplitText.d.ts","sourceRoot":"","sources":["../../../../src/ts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tB;;OAEG;IACH,SAAS,CAAC,QAAQ;CASrB"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { SmoothScroll } from '../../components/scroll/smooth-scroll/SmoothScroll';
|
|
2
1
|
import { IRemovable } from '../types/general';
|
|
2
|
+
import { SmoothScroll } from '../../components/scroll/smooth-scroll/SmoothScroll';
|
|
3
|
+
declare type Container = string | Element | SmoothScroll | Window;
|
|
4
|
+
interface ArgData {
|
|
5
|
+
scrollTop: number;
|
|
6
|
+
scrollLeft: number;
|
|
7
|
+
}
|
|
3
8
|
interface Props {
|
|
4
|
-
|
|
9
|
+
container: Container;
|
|
10
|
+
callback: (data: ArgData) => void;
|
|
11
|
+
isPassive?: boolean;
|
|
5
12
|
}
|
|
6
13
|
/**
|
|
7
14
|
* Add OnScroll event
|
|
8
15
|
*/
|
|
9
|
-
export default function onScroll(
|
|
10
|
-
scrollTop: number;
|
|
11
|
-
scrollLeft: number;
|
|
12
|
-
}) => void, props?: Props): IRemovable;
|
|
16
|
+
export default function onScroll({ container, callback, isPassive, }: Props): IRemovable;
|
|
13
17
|
export {};
|
|
14
18
|
//# sourceMappingURL=onScroll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onScroll.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/listeners/onScroll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"onScroll.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/listeners/onScroll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAGlF,aAAK,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC;AAE1D,UAAU,OAAO;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB;AAeD,UAAU,KAAK;IACX,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAID;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,EAC9B,SAAS,EACT,QAAQ,EACR,SAAiB,GACpB,EAAE,KAAK,GAAG,UAAU,CAsFpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/clamp.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CACzB,GAAG,EAAE,MAAM,EACX,KAAK,WAAS,UASjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clampScope.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/clampScope.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,KAAK,WAAS,EACd,UAAU,WAAS,UAMtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inScope.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/inScope.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAC3B,GAAG,EAAE,MAAM,EACX,UAAU,WAAS,WAGtB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import clamp from './clamp';
|
|
2
2
|
import lerp from './lerp';
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import scoped from './scoped';
|
|
4
|
+
import spreadScope from './spreadScope';
|
|
5
|
+
import inScope from './inScope';
|
|
6
|
+
import clampScope from './clampScope';
|
|
7
|
+
import wrap from './wrap';
|
|
8
|
+
export { clamp, lerp, scoped, spreadScope, inScope, clampScope, wrap, };
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,OAAO,EACH,KAAK,EACL,IAAI,EACJ,MAAM,EACN,WAAW,EACX,OAAO,EACP,UAAU,EACV,IAAI,GACP,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get progress relatively to the scope.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
*
|
|
6
|
+
* scope(.35, [0, 1]);
|
|
7
|
+
* // => .5
|
|
8
|
+
* scope(.35, [.25, 1]);
|
|
9
|
+
* // => .133
|
|
10
|
+
*/
|
|
11
|
+
export default function scoped(val: number, scopeValue?: number[]): number;
|
|
12
|
+
//# sourceMappingURL=scoped.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoped.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/scoped.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAC1B,GAAG,EAAE,MAAM,EACX,UAAU,WAAS,UAItB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spreadScope.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/spreadScope.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,cAYhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/math/wrap.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,sCAIhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vevet",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "VEVET - A JavaScript library",
|
|
5
5
|
"browserslist": [
|
|
6
6
|
"since 2015"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"prepare:cdn": "webpack --config ./config/webpack.cdn.js",
|
|
18
18
|
"lint:js": "eslint . --ext .ts,.js",
|
|
19
19
|
"prepare": "npm run prepare:all",
|
|
20
|
-
"release": "npm version
|
|
20
|
+
"release": "npm version patch && npm publish"
|
|
21
21
|
},
|
|
22
22
|
"main": "./build/cjs/index.js",
|
|
23
23
|
"types": "./build/types/index.d.ts",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"detect-browser": "^5.2.0",
|
|
101
101
|
"easing-progress": "0.0.4",
|
|
102
|
-
"get-image-pos": "0.0.
|
|
102
|
+
"get-image-pos": "0.0.11",
|
|
103
103
|
"ismobilejs": "^1.1.1",
|
|
104
104
|
"lodash.mergewith": "^4.6.2",
|
|
105
105
|
"normalize-wheel": "^1.0.1",
|
package/src/ts/base/Module.ts
CHANGED
|
@@ -299,12 +299,13 @@ export class Module<
|
|
|
299
299
|
public addViewportCallback (
|
|
300
300
|
target: Parameters<Viewport['add']>[0],
|
|
301
301
|
func: Parameters<Viewport['add']>[1],
|
|
302
|
-
data: Parameters<Viewport['add']>[2] = {
|
|
303
|
-
name: this.constructor.name,
|
|
304
|
-
},
|
|
302
|
+
data: Parameters<Viewport['add']>[2] = {},
|
|
305
303
|
|
|
306
304
|
) {
|
|
307
|
-
const callback = this._app.viewport.add(target, func,
|
|
305
|
+
const callback = this._app.viewport.add(target, func, {
|
|
306
|
+
...data,
|
|
307
|
+
name: this.constructor.name,
|
|
308
|
+
});
|
|
308
309
|
this._viewportCallbacks.push(callback);
|
|
309
310
|
return callback;
|
|
310
311
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, NComponent } from '../../base/Component';
|
|
2
|
-
import {
|
|
2
|
+
import { clamp } from '../../utils/math';
|
|
3
3
|
import { RequiredModuleProp } from '../../utils/types/utility';
|
|
4
4
|
|
|
5
5
|
|
|
@@ -237,7 +237,7 @@ export class AnimationFrame <
|
|
|
237
237
|
|
|
238
238
|
// calculate real fps
|
|
239
239
|
const timeDiff = currentTime - this._prevFrameTime;
|
|
240
|
-
const realFPS =
|
|
240
|
+
const realFPS = clamp(
|
|
241
241
|
timeDiff === 0 ? 1000 / 60 : Math.floor(1000 / timeDiff),
|
|
242
242
|
[1, Infinity],
|
|
243
243
|
);
|
|
@@ -26,6 +26,15 @@ export namespace NCtx2D {
|
|
|
26
26
|
* @default false
|
|
27
27
|
*/
|
|
28
28
|
updateOnResize?: boolean | keyof NViewport.CallbacksTypes;
|
|
29
|
+
/**
|
|
30
|
+
* If need to resize when initializing
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
initialResize?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @default 0
|
|
36
|
+
*/
|
|
37
|
+
resizeTimeout?: number;
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
/**
|
|
@@ -157,7 +166,9 @@ export class Ctx2D <
|
|
|
157
166
|
});
|
|
158
167
|
this._ctx = this._canvas.getContext('2d')!;
|
|
159
168
|
// and resize it for the first time
|
|
160
|
-
this.
|
|
169
|
+
if (this.prop.initialResize) {
|
|
170
|
+
this.resize();
|
|
171
|
+
}
|
|
161
172
|
|
|
162
173
|
// initialize the class
|
|
163
174
|
if (init) {
|
|
@@ -173,6 +184,8 @@ export class Ctx2D <
|
|
|
173
184
|
container: false,
|
|
174
185
|
append: true,
|
|
175
186
|
updateOnResize: false,
|
|
187
|
+
initialResize: true,
|
|
188
|
+
resizeTimeout: 0,
|
|
176
189
|
width: false,
|
|
177
190
|
height: false,
|
|
178
191
|
dpr: false,
|
|
@@ -186,6 +199,8 @@ export class Ctx2D <
|
|
|
186
199
|
const viewportTarget: keyof NViewport.CallbacksTypes = typeof this.prop.updateOnResize === 'boolean' ? '' : this.prop.updateOnResize;
|
|
187
200
|
this.addViewportCallback(viewportTarget, () => {
|
|
188
201
|
this.resize();
|
|
202
|
+
}, {
|
|
203
|
+
timeout: this.prop.resizeTimeout,
|
|
189
204
|
});
|
|
190
205
|
this.resize();
|
|
191
206
|
}
|
|
@@ -13,7 +13,7 @@ export namespace NCtx2DPrerender {
|
|
|
13
13
|
/**
|
|
14
14
|
* Media element
|
|
15
15
|
*/
|
|
16
|
-
media: BaseProp['source'] | false;
|
|
16
|
+
media: BaseProp['source'] | Ctx2DPrerender | false;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -68,15 +68,33 @@ export class Ctx2DPrerender <
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
protected _prerender () {
|
|
71
|
+
// check if can render
|
|
72
|
+
if (this.width === 0 || this.height === 0) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
71
75
|
// check if media exists
|
|
72
76
|
const { media } = this.prop;
|
|
73
77
|
if (!media) {
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
76
80
|
|
|
81
|
+
// get source info
|
|
82
|
+
let source: BaseProp['source'];
|
|
83
|
+
let sourceWidth: number | undefined;
|
|
84
|
+
let sourceHeight: number | undefined;
|
|
85
|
+
if (media instanceof Ctx2D) {
|
|
86
|
+
source = media.canvas;
|
|
87
|
+
sourceWidth = media.width;
|
|
88
|
+
sourceHeight = media.height;
|
|
89
|
+
} else {
|
|
90
|
+
source = media;
|
|
91
|
+
}
|
|
92
|
+
|
|
77
93
|
// get media sizes
|
|
78
94
|
const size = getPos({
|
|
79
|
-
source
|
|
95
|
+
source,
|
|
96
|
+
sourceWidth,
|
|
97
|
+
sourceHeight,
|
|
80
98
|
rule: this.prop.posRule,
|
|
81
99
|
scale: 1,
|
|
82
100
|
width: this.width,
|
|
@@ -85,10 +103,9 @@ export class Ctx2DPrerender <
|
|
|
85
103
|
this._ctx.clearRect(0, 0, this.width, this.height);
|
|
86
104
|
// render the media
|
|
87
105
|
this._ctx.drawImage(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
size.
|
|
91
|
-
size.x, size.y, size.width, size.height,
|
|
106
|
+
source,
|
|
107
|
+
size.x, size.y,
|
|
108
|
+
size.width, size.height,
|
|
92
109
|
);
|
|
93
110
|
// launch callbacks on prerender
|
|
94
111
|
this.callbacks.tbt('prerender', false);
|
|
@@ -40,6 +40,13 @@ export namespace NProgressPreloader {
|
|
|
40
40
|
* @default '.js-preload'
|
|
41
41
|
*/
|
|
42
42
|
custom?: string | false;
|
|
43
|
+
/**
|
|
44
|
+
* If you enable images, video, or custom loaders,
|
|
45
|
+
* all these resources will be preloaded. In cases when you may want not
|
|
46
|
+
* to preload a certain resource, you can add to it the class name specified here.
|
|
47
|
+
* @default 'js-preload-ignore'
|
|
48
|
+
*/
|
|
49
|
+
ignoreClassName?: string;
|
|
43
50
|
};
|
|
44
51
|
/**
|
|
45
52
|
* Smooth calculation settings
|
|
@@ -107,6 +114,7 @@ export class ProgressPreloader <
|
|
|
107
114
|
img: true,
|
|
108
115
|
video: true,
|
|
109
116
|
custom: '.js-preload',
|
|
117
|
+
ignoreClassName: 'js-preload-ignore',
|
|
110
118
|
},
|
|
111
119
|
calc: {
|
|
112
120
|
lerp: 0.1,
|
|
@@ -275,6 +283,9 @@ export class ProgressPreloader <
|
|
|
275
283
|
if (loaders.img) {
|
|
276
284
|
const imgs = selectAll('img');
|
|
277
285
|
imgs.forEach((img) => {
|
|
286
|
+
if (img.classList.contains(loaders.ignoreClassName)) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
278
289
|
this._imgs.push(img);
|
|
279
290
|
this._resourcesTotal += 1;
|
|
280
291
|
});
|
|
@@ -284,6 +295,9 @@ export class ProgressPreloader <
|
|
|
284
295
|
if (loaders.video) {
|
|
285
296
|
const videos = selectAll('video');
|
|
286
297
|
videos.forEach((video) => {
|
|
298
|
+
if (video.classList.contains(loaders.ignoreClassName)) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
287
301
|
this._videos.push(video);
|
|
288
302
|
this._resourcesTotal += 1;
|
|
289
303
|
});
|
|
@@ -291,7 +305,12 @@ export class ProgressPreloader <
|
|
|
291
305
|
|
|
292
306
|
// get custom resources
|
|
293
307
|
if (loaders.custom) {
|
|
294
|
-
this._customResources = Array.from(selectAll(loaders.custom))
|
|
308
|
+
this._customResources = Array.from(selectAll(loaders.custom)).filter((el) => {
|
|
309
|
+
if (el.classList.contains(loaders.ignoreClassName)) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
return true;
|
|
313
|
+
});
|
|
295
314
|
this._resourcesTotal += this._customResources.length;
|
|
296
315
|
}
|
|
297
316
|
}
|
|
@@ -318,7 +337,7 @@ export class ProgressPreloader <
|
|
|
318
337
|
img.addEventListener('error', () => {
|
|
319
338
|
this._handleLoadedResource();
|
|
320
339
|
});
|
|
321
|
-
image.src = img.src;
|
|
340
|
+
image.src = img.currentSrc || img.src;
|
|
322
341
|
}
|
|
323
342
|
});
|
|
324
343
|
|
|
@@ -52,6 +52,11 @@ export class Page <
|
|
|
52
52
|
ChangeableProp,
|
|
53
53
|
CallbacksTypes
|
|
54
54
|
> {
|
|
55
|
+
protected _blocked: boolean;
|
|
56
|
+
protected get blocked () {
|
|
57
|
+
return this._blocked;
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
/**
|
|
56
61
|
* If the page is created
|
|
57
62
|
*/
|
|
@@ -95,6 +100,7 @@ export class Page <
|
|
|
95
100
|
super(initialProp, false);
|
|
96
101
|
|
|
97
102
|
// set default vars
|
|
103
|
+
this._blocked = false;
|
|
98
104
|
this._created = false;
|
|
99
105
|
this._shown = false;
|
|
100
106
|
this._hidden = false;
|
|
@@ -129,11 +135,12 @@ export class Page <
|
|
|
129
135
|
resolve, reject,
|
|
130
136
|
) => {
|
|
131
137
|
this.canCreate().then(() => {
|
|
132
|
-
if (this.created) {
|
|
138
|
+
if (this.created || this.blocked) {
|
|
139
|
+
reject();
|
|
133
140
|
return;
|
|
134
141
|
}
|
|
135
142
|
// update vars
|
|
136
|
-
this.
|
|
143
|
+
this._blocked = true;
|
|
137
144
|
this._shown = false;
|
|
138
145
|
this._hidden = false;
|
|
139
146
|
this._destroyed = false;
|
|
@@ -147,7 +154,11 @@ export class Page <
|
|
|
147
154
|
// actions
|
|
148
155
|
this._create().then(() => {
|
|
149
156
|
this.callbacks.tbt('create', false);
|
|
157
|
+
this._blocked = false;
|
|
158
|
+
this._created = true;
|
|
150
159
|
resolve();
|
|
160
|
+
}).catch(() => {
|
|
161
|
+
reject();
|
|
151
162
|
});
|
|
152
163
|
}).catch(() => {
|
|
153
164
|
reject();
|
|
@@ -191,19 +202,24 @@ export class Page <
|
|
|
191
202
|
resolve, reject,
|
|
192
203
|
) => {
|
|
193
204
|
this.canShow().then(() => {
|
|
194
|
-
if (this.shown) {
|
|
205
|
+
if (this.shown || this.blocked) {
|
|
206
|
+
reject();
|
|
195
207
|
return;
|
|
196
208
|
}
|
|
197
209
|
// update vars
|
|
210
|
+
this._blocked = true;
|
|
198
211
|
this._created = true;
|
|
199
|
-
this._shown = true;
|
|
200
212
|
this._hidden = false;
|
|
201
213
|
this._destroyed = false;
|
|
202
214
|
|
|
203
215
|
// actions
|
|
204
216
|
this._show().then(() => {
|
|
205
217
|
this.callbacks.tbt('show', false);
|
|
218
|
+
this._blocked = false;
|
|
219
|
+
this._shown = true;
|
|
206
220
|
resolve();
|
|
221
|
+
}).catch(() => {
|
|
222
|
+
reject();
|
|
207
223
|
});
|
|
208
224
|
// launch events
|
|
209
225
|
}).catch(() => {
|
|
@@ -249,19 +265,24 @@ export class Page <
|
|
|
249
265
|
reject: (...arg: any) => void,
|
|
250
266
|
) => {
|
|
251
267
|
this.canHide().then(() => {
|
|
252
|
-
if (this.hidden) {
|
|
268
|
+
if (this.hidden || this.blocked) {
|
|
269
|
+
reject();
|
|
253
270
|
return;
|
|
254
271
|
}
|
|
255
272
|
// update vars
|
|
273
|
+
this._blocked = true;
|
|
256
274
|
this._created = true;
|
|
257
275
|
this._shown = false;
|
|
258
|
-
this._hidden = true;
|
|
259
276
|
this._destroyed = false;
|
|
260
277
|
|
|
261
278
|
// actions
|
|
262
279
|
this._hide().then(() => {
|
|
263
280
|
this.callbacks.tbt('hide', false);
|
|
281
|
+
this._blocked = false;
|
|
282
|
+
this._hidden = true;
|
|
264
283
|
resolve();
|
|
284
|
+
}).catch(() => {
|
|
285
|
+
reject();
|
|
265
286
|
});
|
|
266
287
|
}).catch(() => {
|
|
267
288
|
reject();
|
|
@@ -306,14 +327,15 @@ export class Page <
|
|
|
306
327
|
reject: (...arg: any) => void,
|
|
307
328
|
) => {
|
|
308
329
|
this.canDestroy().then(() => {
|
|
309
|
-
if (this.destroyed) {
|
|
330
|
+
if (this.destroyed || this.blocked) {
|
|
331
|
+
reject();
|
|
310
332
|
return;
|
|
311
333
|
}
|
|
312
334
|
// change vars
|
|
335
|
+
this._blocked = true;
|
|
313
336
|
this._created = false;
|
|
314
337
|
this._shown = false;
|
|
315
338
|
this._hidden = true;
|
|
316
|
-
this._destroyed = true;
|
|
317
339
|
|
|
318
340
|
// update page
|
|
319
341
|
this._app.page = false;
|
|
@@ -322,7 +344,11 @@ export class Page <
|
|
|
322
344
|
|
|
323
345
|
// actions
|
|
324
346
|
this._destroy().then(() => {
|
|
347
|
+
this._blocked = false;
|
|
348
|
+
this._destroyed = true;
|
|
325
349
|
resolve();
|
|
350
|
+
}).catch(() => {
|
|
351
|
+
reject();
|
|
326
352
|
});
|
|
327
353
|
}).catch(() => {
|
|
328
354
|
reject();
|