vevet 3.0.0-beta.1 → 3.0.0-beta.2
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/Application/events/Viewport/index.js +1 -1
- package/lib/cjs/Application/events/Viewport/index.js.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/Application/events/PageLoad/index.js +54 -28
- package/lib/esm/Application/events/PageLoad/index.js.map +1 -1
- package/lib/esm/Application/events/Viewport/index.js +180 -107
- package/lib/esm/Application/events/Viewport/index.js.map +1 -1
- package/lib/esm/Application/index.js +178 -96
- package/lib/esm/Application/index.js.map +1 -1
- package/lib/esm/base/Callbacks/index.js +78 -45
- package/lib/esm/base/Callbacks/index.js.map +1 -1
- package/lib/esm/base/Component/index.js +31 -10
- package/lib/esm/base/Component/index.js.map +1 -1
- package/lib/esm/base/Module/index.js +132 -77
- package/lib/esm/base/Module/index.js.map +1 -1
- package/lib/esm/base/MutableProps/index.js +49 -30
- package/lib/esm/base/MutableProps/index.js.map +1 -1
- package/lib/esm/base/Plugin/index.js +35 -13
- package/lib/esm/base/Plugin/index.js.map +1 -1
- package/lib/esm/components/AnimationFrame/index.js +98 -55
- package/lib/esm/components/AnimationFrame/index.js.map +1 -1
- package/lib/esm/components/BaseTimeline/index.js +88 -41
- package/lib/esm/components/BaseTimeline/index.js.map +1 -1
- package/lib/esm/components/Ctx2D/index.js +150 -82
- package/lib/esm/components/Ctx2D/index.js.map +1 -1
- package/lib/esm/components/Ctx2DPrerender/index.js +54 -20
- package/lib/esm/components/Ctx2DPrerender/index.js.map +1 -1
- package/lib/esm/components/CustomCursor/index.js +216 -149
- package/lib/esm/components/CustomCursor/index.js.map +1 -1
- package/lib/esm/components/DraggerBase/index.js +164 -98
- package/lib/esm/components/DraggerBase/index.js.map +1 -1
- package/lib/esm/components/DraggerDirection/index.js +42 -10
- package/lib/esm/components/DraggerDirection/index.js.map +1 -1
- package/lib/esm/components/DraggerMove/index.js +83 -42
- package/lib/esm/components/DraggerMove/index.js.map +1 -1
- package/lib/esm/components/Preloader/index.js +135 -77
- package/lib/esm/components/Preloader/index.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/index.js +190 -112
- package/lib/esm/components/ProgressPreloader/index.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadCustomElement.js +10 -9
- package/lib/esm/components/ProgressPreloader/utils/preloadCustomElement.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadImage.js +3 -3
- package/lib/esm/components/ProgressPreloader/utils/preloadImage.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadVideo.js +2 -2
- package/lib/esm/components/ProgressPreloader/utils/preloadVideo.js.map +1 -1
- package/lib/esm/components/ScrollBar/Bar/index.js +136 -90
- package/lib/esm/components/ScrollBar/Bar/index.js.map +1 -1
- package/lib/esm/components/ScrollBar/index.js +118 -70
- package/lib/esm/components/ScrollBar/index.js.map +1 -1
- package/lib/esm/components/ScrollView/index.js +154 -103
- package/lib/esm/components/ScrollView/index.js.map +1 -1
- package/lib/esm/components/SectionScrollProgress/index.js +170 -95
- package/lib/esm/components/SectionScrollProgress/index.js.map +1 -1
- package/lib/esm/components/SmoothScroll/AnimatonFrame.js +37 -20
- package/lib/esm/components/SmoothScroll/AnimatonFrame.js.map +1 -1
- package/lib/esm/components/SmoothScroll/Elements.js +59 -42
- package/lib/esm/components/SmoothScroll/Elements.js.map +1 -1
- package/lib/esm/components/SmoothScroll/index.js +304 -205
- package/lib/esm/components/SmoothScroll/index.js.map +1 -1
- package/lib/esm/components/SmoothScrollDragPlugin/index.js +86 -48
- package/lib/esm/components/SmoothScrollDragPlugin/index.js.map +1 -1
- package/lib/esm/components/SmoothScrollKeyboardPlugin/index.js +70 -34
- package/lib/esm/components/SmoothScrollKeyboardPlugin/index.js.map +1 -1
- package/lib/esm/components/SplitText/index.js +177 -117
- package/lib/esm/components/SplitText/index.js.map +1 -1
- package/lib/esm/components/Timeline/index.js +88 -45
- package/lib/esm/components/Timeline/index.js.map +1 -1
- package/lib/esm/utils/common/mergeWithoutArrays.js +1 -1
- package/lib/esm/utils/common/mergeWithoutArrays.js.map +1 -1
- package/lib/esm/utils/common/normalizedTimeoutCallback.js +3 -3
- package/lib/esm/utils/common/normalizedTimeoutCallback.js.map +1 -1
- package/lib/esm/utils/common/pickObjectProps.js +2 -2
- package/lib/esm/utils/common/pickObjectProps.js.map +1 -1
- package/lib/esm/utils/common/times.js +2 -2
- package/lib/esm/utils/common/times.js.map +1 -1
- package/lib/esm/utils/common/uid.js +4 -3
- package/lib/esm/utils/common/uid.js.map +1 -1
- package/lib/esm/utils/image/load.js +26 -15
- package/lib/esm/utils/image/load.js.map +1 -1
- package/lib/esm/utils/image/pathsToProps.js +5 -5
- package/lib/esm/utils/image/pathsToProps.js.map +1 -1
- package/lib/esm/utils/image/sizesToSrcSet.js +5 -5
- package/lib/esm/utils/image/sizesToSrcSet.js.map +1 -1
- package/lib/esm/utils/internal/fetchWebpSupport.js +3 -3
- package/lib/esm/utils/internal/fetchWebpSupport.js.map +1 -1
- package/lib/esm/utils/internal/getDeviceInfo.js +7 -7
- package/lib/esm/utils/internal/getDeviceInfo.js.map +1 -1
- package/lib/esm/utils/internal/onResize.js +16 -13
- package/lib/esm/utils/internal/onResize.js.map +1 -1
- package/lib/esm/utils/math/clamp.js +2 -1
- package/lib/esm/utils/math/clamp.js.map +1 -1
- package/lib/esm/utils/math/clampScope.js +3 -1
- package/lib/esm/utils/math/clampScope.js.map +1 -1
- package/lib/esm/utils/math/easing.js +5 -1
- package/lib/esm/utils/math/easing.js.map +1 -1
- package/lib/esm/utils/math/inScope.js +2 -1
- package/lib/esm/utils/math/inScope.js.map +1 -1
- package/lib/esm/utils/math/lerp.js +4 -3
- package/lib/esm/utils/math/lerp.js.map +1 -1
- package/lib/esm/utils/math/normalizeNestedScope.js +1 -1
- package/lib/esm/utils/math/normalizeNestedScope.js.map +1 -1
- package/lib/esm/utils/math/scoped.js +3 -2
- package/lib/esm/utils/math/scoped.js.map +1 -1
- package/lib/esm/utils/math/spreadScope.js +5 -5
- package/lib/esm/utils/math/spreadScope.js.map +1 -1
- package/lib/esm/utils/math/wrap.js +2 -2
- package/lib/esm/utils/math/wrap.js.map +1 -1
- package/lib/esm/utils/scroll/getScrollValues.js +6 -5
- package/lib/esm/utils/scroll/getScrollValues.js.map +1 -1
- package/lib/esm/utils/scroll/onScroll.js +23 -20
- package/lib/esm/utils/scroll/onScroll.js.map +1 -1
- package/lib/esm/utils/scroll/scrollTo.js +12 -10
- package/lib/esm/utils/scroll/scrollTo.js.map +1 -1
- package/lib/esm/utils/scroll/scrollToElement.js +19 -8
- package/lib/esm/utils/scroll/scrollToElement.js.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/esm/vevet.js +1 -1
- package/lib/esm/vevet.js.map +1 -1
- package/lib/types/Application/events/Viewport/index.d.ts +1 -1
- package/lib/types/Application/events/Viewport/index.d.ts.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Application/events/Viewport/index.ts +1 -1
- package/src/Application/events/Viewport/stories/index.tsx +1 -1
- package/src/version.ts +1 -1
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __assign = (this && this.__assign) || function () {
|
|
17
|
+
__assign = Object.assign || function(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
return __assign.apply(this, arguments);
|
|
26
|
+
};
|
|
1
27
|
import { selectOne } from 'vevet-dom';
|
|
2
28
|
import { Component as ComponentClass } from '../../base/Component';
|
|
3
29
|
import { clampScope } from '../../utils/math';
|
|
@@ -6,113 +32,157 @@ import { onResize } from '../../utils/internal/onResize';
|
|
|
6
32
|
/**
|
|
7
33
|
* Trace scroll progress of a section
|
|
8
34
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return this._scrollContainer;
|
|
16
|
-
}
|
|
17
|
-
/** Section element */
|
|
18
|
-
get section() {
|
|
19
|
-
return this._section;
|
|
20
|
-
}
|
|
21
|
-
/** Scrolling scope */
|
|
22
|
-
get scopeGlobal() {
|
|
23
|
-
return this._scopeGlobal;
|
|
24
|
-
}
|
|
25
|
-
/** Scope of element appearing from bottom to top */
|
|
26
|
-
get scopeIn() {
|
|
27
|
-
return this._scopeIn;
|
|
28
|
-
}
|
|
29
|
-
/** Scope of element moving */
|
|
30
|
-
get scopeMove() {
|
|
31
|
-
return this._scopeMove;
|
|
32
|
-
}
|
|
33
|
-
/** Scope of element disappearing from bottom to top */
|
|
34
|
-
get scopeOut() {
|
|
35
|
-
return this._scopeOut;
|
|
36
|
-
}
|
|
37
|
-
/** Global progress */
|
|
38
|
-
get progressGlobal() {
|
|
39
|
-
return this._progressGlobal;
|
|
40
|
-
}
|
|
41
|
-
set progressGlobal(value) {
|
|
42
|
-
this._progressGlobal = value;
|
|
43
|
-
}
|
|
44
|
-
constructor(initialProps, canInit = true) {
|
|
45
|
-
super(initialProps, false);
|
|
46
|
-
const { container, section } = this.props;
|
|
35
|
+
var SectionScrollProgress = /** @class */ (function (_super) {
|
|
36
|
+
__extends(SectionScrollProgress, _super);
|
|
37
|
+
function SectionScrollProgress(initialProps, canInit) {
|
|
38
|
+
if (canInit === void 0) { canInit = true; }
|
|
39
|
+
var _this = _super.call(this, initialProps, false) || this;
|
|
40
|
+
var _a = _this.props, container = _a.container, section = _a.section;
|
|
47
41
|
// get scroll container
|
|
48
42
|
if (typeof container === 'string') {
|
|
49
|
-
|
|
43
|
+
_this._scrollContainer = selectOne(container);
|
|
50
44
|
}
|
|
51
45
|
else {
|
|
52
|
-
|
|
46
|
+
_this._scrollContainer = container;
|
|
53
47
|
}
|
|
54
48
|
// get section element
|
|
55
|
-
|
|
49
|
+
_this._section = selectOne(section);
|
|
56
50
|
// set defaults
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
_this._prevProgressGlobal = -0.001;
|
|
52
|
+
_this._progressGlobal = -0.001;
|
|
53
|
+
_this._scopeGlobal = [0, 0];
|
|
54
|
+
_this._scopeIn = [0, 0];
|
|
55
|
+
_this._scopeMove = [0, 0];
|
|
56
|
+
_this._scopeOut = [0, 0];
|
|
57
|
+
_this._frameThrottleIndex = 0;
|
|
64
58
|
// initialize the class
|
|
65
59
|
if (canInit) {
|
|
66
|
-
|
|
60
|
+
_this.init();
|
|
67
61
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
SectionScrollProgress.prototype._getDefaultProps = function () {
|
|
65
|
+
return __assign(__assign({}, _super.prototype._getDefaultProps.call(this)), { container: window, viewportTarget: 'any', resizeTimeout: 0 });
|
|
66
|
+
};
|
|
67
|
+
Object.defineProperty(SectionScrollProgress.prototype, "scrollContainer", {
|
|
68
|
+
/** Scroll container */
|
|
69
|
+
get: function () {
|
|
70
|
+
return this._scrollContainer;
|
|
71
|
+
},
|
|
72
|
+
enumerable: false,
|
|
73
|
+
configurable: true
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(SectionScrollProgress.prototype, "section", {
|
|
76
|
+
/** Section element */
|
|
77
|
+
get: function () {
|
|
78
|
+
return this._section;
|
|
79
|
+
},
|
|
80
|
+
enumerable: false,
|
|
81
|
+
configurable: true
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(SectionScrollProgress.prototype, "scopeGlobal", {
|
|
84
|
+
/** Scrolling scope */
|
|
85
|
+
get: function () {
|
|
86
|
+
return this._scopeGlobal;
|
|
87
|
+
},
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(SectionScrollProgress.prototype, "scopeIn", {
|
|
92
|
+
/** Scope of element appearing from bottom to top */
|
|
93
|
+
get: function () {
|
|
94
|
+
return this._scopeIn;
|
|
95
|
+
},
|
|
96
|
+
enumerable: false,
|
|
97
|
+
configurable: true
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(SectionScrollProgress.prototype, "scopeMove", {
|
|
100
|
+
/** Scope of element moving */
|
|
101
|
+
get: function () {
|
|
102
|
+
return this._scopeMove;
|
|
103
|
+
},
|
|
104
|
+
enumerable: false,
|
|
105
|
+
configurable: true
|
|
106
|
+
});
|
|
107
|
+
Object.defineProperty(SectionScrollProgress.prototype, "scopeOut", {
|
|
108
|
+
/** Scope of element disappearing from bottom to top */
|
|
109
|
+
get: function () {
|
|
110
|
+
return this._scopeOut;
|
|
111
|
+
},
|
|
112
|
+
enumerable: false,
|
|
113
|
+
configurable: true
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(SectionScrollProgress.prototype, "progressGlobal", {
|
|
116
|
+
/** Global progress */
|
|
117
|
+
get: function () {
|
|
118
|
+
return this._progressGlobal;
|
|
119
|
+
},
|
|
120
|
+
set: function (value) {
|
|
121
|
+
this._progressGlobal = value;
|
|
122
|
+
},
|
|
123
|
+
enumerable: false,
|
|
124
|
+
configurable: true
|
|
125
|
+
});
|
|
126
|
+
SectionScrollProgress.prototype._init = function () {
|
|
127
|
+
_super.prototype._init.call(this);
|
|
71
128
|
this._setEvents();
|
|
72
|
-
}
|
|
129
|
+
};
|
|
73
130
|
/** Set events */
|
|
74
|
-
_setEvents() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
131
|
+
SectionScrollProgress.prototype._setEvents = function () {
|
|
132
|
+
var _this = this;
|
|
133
|
+
var _a = this.props, viewportTarget = _a.viewportTarget, resizeDebounce = _a.resizeDebounce;
|
|
134
|
+
var resizeHandler = onResize({
|
|
135
|
+
onResize: function () { return _this.resize(); },
|
|
78
136
|
element: this.section,
|
|
79
|
-
viewportTarget,
|
|
137
|
+
viewportTarget: viewportTarget,
|
|
80
138
|
hasBothEvents: true,
|
|
81
|
-
resizeDebounce,
|
|
139
|
+
resizeDebounce: resizeDebounce,
|
|
82
140
|
});
|
|
83
|
-
|
|
84
|
-
loadEvent.then(()
|
|
141
|
+
var loadEvent = this.app.onPageLoad();
|
|
142
|
+
loadEvent.then(function () { return resizeHandler.debounceResize(); }).catch(function () { });
|
|
85
143
|
// set scroll events
|
|
86
|
-
|
|
144
|
+
var scrollEvent = onScroll({
|
|
87
145
|
container: this.scrollContainer,
|
|
88
|
-
callback: (data)
|
|
146
|
+
callback: function (data) { return _this._render(data); },
|
|
89
147
|
});
|
|
90
148
|
// destroy events
|
|
91
|
-
this.addDestroyableAction(()
|
|
149
|
+
this.addDestroyableAction(function () {
|
|
92
150
|
resizeHandler.remove();
|
|
93
151
|
loadEvent.cancel();
|
|
94
152
|
scrollEvent.remove();
|
|
95
153
|
});
|
|
96
|
-
}
|
|
97
|
-
_onPropsMutate() {
|
|
98
|
-
|
|
154
|
+
};
|
|
155
|
+
SectionScrollProgress.prototype._onPropsMutate = function () {
|
|
156
|
+
_super.prototype._onPropsMutate.call(this);
|
|
99
157
|
this.resize();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
158
|
+
};
|
|
159
|
+
Object.defineProperty(SectionScrollProgress.prototype, "progressIn", {
|
|
160
|
+
/** 'in' progress */
|
|
161
|
+
get: function () {
|
|
162
|
+
return clampScope(this.progressGlobal, this.scopeIn) || 0;
|
|
163
|
+
},
|
|
164
|
+
enumerable: false,
|
|
165
|
+
configurable: true
|
|
166
|
+
});
|
|
167
|
+
Object.defineProperty(SectionScrollProgress.prototype, "progressOut", {
|
|
168
|
+
/** 'out' progress */
|
|
169
|
+
get: function () {
|
|
170
|
+
return clampScope(this.progressGlobal, this.scopeOut) || 0;
|
|
171
|
+
},
|
|
172
|
+
enumerable: false,
|
|
173
|
+
configurable: true
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(SectionScrollProgress.prototype, "progressMove", {
|
|
176
|
+
/** 'move' progress */
|
|
177
|
+
get: function () {
|
|
178
|
+
return clampScope(this.progressGlobal, this.scopeMove) || 0;
|
|
179
|
+
},
|
|
180
|
+
enumerable: false,
|
|
181
|
+
configurable: true
|
|
182
|
+
});
|
|
113
183
|
/** Resize the scene */
|
|
114
|
-
resize() {
|
|
115
|
-
|
|
184
|
+
SectionScrollProgress.prototype.resize = function () {
|
|
185
|
+
var scrollValues = getScrollValues(this.scrollContainer);
|
|
116
186
|
if (!scrollValues) {
|
|
117
187
|
return;
|
|
118
188
|
}
|
|
@@ -120,27 +190,30 @@ export class SectionScrollProgress extends ComponentClass {
|
|
|
120
190
|
this.callbacks.tbt('resize', undefined);
|
|
121
191
|
// render the scene
|
|
122
192
|
this._render(scrollValues, true);
|
|
123
|
-
}
|
|
193
|
+
};
|
|
124
194
|
/** Calculate scopes */
|
|
125
|
-
_calculateScopes
|
|
126
|
-
|
|
127
|
-
|
|
195
|
+
SectionScrollProgress.prototype._calculateScopes = function (_a) {
|
|
196
|
+
var scrollTop = _a.scrollTop;
|
|
197
|
+
var vHeight = this.app.viewport.height;
|
|
198
|
+
var sectionBounding = this.section.getBoundingClientRect();
|
|
128
199
|
// calculate scroll scope
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
200
|
+
var inStart = scrollTop + sectionBounding.top - vHeight;
|
|
201
|
+
var moveEnd = scrollTop + sectionBounding.top + sectionBounding.height;
|
|
202
|
+
var scrollLine = moveEnd - inStart;
|
|
132
203
|
this._scopeGlobal = [inStart, moveEnd];
|
|
133
204
|
// calculate other scopes
|
|
134
205
|
this._scopeIn = [0, vHeight / scrollLine];
|
|
135
206
|
this._scopeOut = [1 - vHeight / scrollLine, 1];
|
|
136
207
|
this._scopeMove = [this._scopeIn[1], this._scopeOut[0]];
|
|
137
|
-
}
|
|
208
|
+
};
|
|
138
209
|
/** Check if the section can be rendered */
|
|
139
|
-
_canRender
|
|
210
|
+
SectionScrollProgress.prototype._canRender = function (isForce) {
|
|
211
|
+
if (isForce === void 0) { isForce = false; }
|
|
140
212
|
return isForce || this.progressGlobal !== this._prevProgressGlobal;
|
|
141
|
-
}
|
|
213
|
+
};
|
|
142
214
|
/** Render the scene */
|
|
143
|
-
_render(scrollValues, isForce
|
|
215
|
+
SectionScrollProgress.prototype._render = function (scrollValues, isForce) {
|
|
216
|
+
if (isForce === void 0) { isForce = false; }
|
|
144
217
|
this._frameThrottleIndex += 1;
|
|
145
218
|
if (this._frameThrottleIndex % 60 === 0 || isForce) {
|
|
146
219
|
this._calculateScopes(scrollValues);
|
|
@@ -151,6 +224,8 @@ export class SectionScrollProgress extends ComponentClass {
|
|
|
151
224
|
return;
|
|
152
225
|
}
|
|
153
226
|
this.callbacks.tbt('render', undefined);
|
|
154
|
-
}
|
|
155
|
-
|
|
227
|
+
};
|
|
228
|
+
return SectionScrollProgress;
|
|
229
|
+
}(ComponentClass));
|
|
230
|
+
export { SectionScrollProgress };
|
|
156
231
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/SectionScrollProgress/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAoB,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIrD;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/SectionScrollProgress/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAoB,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIrD;;GAEG;AACH;IAIU,yCAA4D;IA2EpE,+BAAY,YAA4C,EAAE,OAAc;QAAd,wBAAA,EAAA,cAAc;QAAxE,YACE,kBAAM,YAAY,EAAE,KAAK,CAAC,SA2B3B;QAzBO,IAAA,KAAyB,KAAI,CAAC,KAAK,EAAjC,SAAS,eAAA,EAAE,OAAO,aAAe,CAAC;QAE1C,uBAAuB;QACvB,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACjC,KAAI,CAAC,gBAAgB,GAA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,CAAC,OAAO,CAAC,EAAE;YAC7B,OAAO;SACR;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC;IACH,4BAAC;AAAD,CAAC,AA1ND,CAIU,cAAc,GAsNvB"}
|
|
@@ -1,44 +1,61 @@
|
|
|
1
1
|
import { AnimationFrame as AnimationFrameClass } from '../AnimationFrame';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return (this.props.outerAnimationFrame || this._innerAnimationFrame);
|
|
5
|
-
}
|
|
6
|
-
get easeMultiplier() {
|
|
7
|
-
return this.animationFrame.easeMultiplier;
|
|
8
|
-
}
|
|
9
|
-
get props() {
|
|
10
|
-
return this._props;
|
|
11
|
-
}
|
|
12
|
-
constructor(_props) {
|
|
2
|
+
var AnimationFrame = /** @class */ (function () {
|
|
3
|
+
function AnimationFrame(_props) {
|
|
13
4
|
this._props = _props;
|
|
14
5
|
}
|
|
15
|
-
|
|
6
|
+
Object.defineProperty(AnimationFrame.prototype, "animationFrame", {
|
|
7
|
+
get: function () {
|
|
8
|
+
return (this.props.outerAnimationFrame || this._innerAnimationFrame);
|
|
9
|
+
},
|
|
10
|
+
enumerable: false,
|
|
11
|
+
configurable: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(AnimationFrame.prototype, "easeMultiplier", {
|
|
14
|
+
get: function () {
|
|
15
|
+
return this.animationFrame.easeMultiplier;
|
|
16
|
+
},
|
|
17
|
+
enumerable: false,
|
|
18
|
+
configurable: true
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(AnimationFrame.prototype, "props", {
|
|
21
|
+
get: function () {
|
|
22
|
+
return this._props;
|
|
23
|
+
},
|
|
24
|
+
enumerable: false,
|
|
25
|
+
configurable: true
|
|
26
|
+
});
|
|
27
|
+
AnimationFrame.prototype.enable = function () {
|
|
28
|
+
var _this = this;
|
|
16
29
|
// set animation callback for the outer AnimationFrame
|
|
17
30
|
if (this.props.outerAnimationFrame) {
|
|
18
31
|
if (!this._animationFrameEvent) {
|
|
19
|
-
this._animationFrameEvent = this.props.outerAnimationFrame.addCallback('frame', ()
|
|
32
|
+
this._animationFrameEvent = this.props.outerAnimationFrame.addCallback('frame', function () { return _this.props.callback(); }, { name: 'SmoothScroll' });
|
|
20
33
|
}
|
|
21
34
|
return;
|
|
22
35
|
}
|
|
23
36
|
// otherwise, check if inner AnimationFrame is created
|
|
24
37
|
if (!this._innerAnimationFrame) {
|
|
25
38
|
this._innerAnimationFrame = new AnimationFrameClass({ fps: 'auto' });
|
|
26
|
-
this._innerAnimationFrame.addCallback('frame', ()
|
|
39
|
+
this._innerAnimationFrame.addCallback('frame', function () {
|
|
40
|
+
return _this.props.callback();
|
|
41
|
+
});
|
|
27
42
|
}
|
|
28
43
|
// play
|
|
29
44
|
this._innerAnimationFrame.play();
|
|
30
|
-
}
|
|
45
|
+
};
|
|
31
46
|
/** Disable scrolling */
|
|
32
|
-
disable() {
|
|
47
|
+
AnimationFrame.prototype.disable = function () {
|
|
33
48
|
var _a, _b;
|
|
34
49
|
(_a = this._animationFrameEvent) === null || _a === void 0 ? void 0 : _a.remove();
|
|
35
50
|
this._animationFrameEvent = undefined;
|
|
36
51
|
(_b = this._innerAnimationFrame) === null || _b === void 0 ? void 0 : _b.pause();
|
|
37
|
-
}
|
|
38
|
-
destroy() {
|
|
52
|
+
};
|
|
53
|
+
AnimationFrame.prototype.destroy = function () {
|
|
39
54
|
var _a;
|
|
40
55
|
this.disable();
|
|
41
56
|
(_a = this._innerAnimationFrame) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
42
|
-
}
|
|
43
|
-
|
|
57
|
+
};
|
|
58
|
+
return AnimationFrame;
|
|
59
|
+
}());
|
|
60
|
+
export { AnimationFrame };
|
|
44
61
|
//# sourceMappingURL=AnimatonFrame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatonFrame.js","sourceRoot":"","sources":["../../../../src/components/SmoothScroll/AnimatonFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQ1E,MAAM,
|
|
1
|
+
{"version":3,"file":"AnimatonFrame.js","sourceRoot":"","sources":["../../../../src/components/SmoothScroll/AnimatonFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQ1E;IAiBE,wBAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAZtC,sBAAY,0CAAc;aAA1B;YACE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,IAAI,CAAC,oBAAoB,CAAE,CAAC;QACxE,CAAC;;;OAAA;IAED,sBAAI,0CAAc;aAAlB;YACE,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC;QAC5C,CAAC;;;OAAA;IAED,sBAAY,iCAAK;aAAjB;YACE,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAIM,+BAAM,GAAb;QAAA,iBAwBC;QAvBC,sDAAsD;QACtD,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBAC9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,WAAW,CACpE,OAAO,EACP,cAAM,OAAA,KAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAArB,CAAqB,EAC3B,EAAE,IAAI,EAAE,cAAc,EAAE,CACzB,CAAC;aACH;YAED,OAAO;SACR;QAED,sDAAsD;QACtD,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;YACrE,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,OAAO,EAAE;gBAC7C,OAAA,KAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YAArB,CAAqB,CACtB,CAAC;SACH;QAED,OAAO;QACP,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;IAED,wBAAwB;IACjB,gCAAO,GAAd;;QACE,MAAA,IAAI,CAAC,oBAAoB,0CAAE,MAAM,EAAE,CAAC;QACpC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;QAEtC,MAAA,IAAI,CAAC,oBAAoB,0CAAE,KAAK,EAAE,CAAC;IACrC,CAAC;IAEM,gCAAO,GAAd;;QACE,IAAI,CAAC,OAAO,EAAE,CAAC;QAEf,MAAA,IAAI,CAAC,oBAAoB,0CAAE,OAAO,EAAE,CAAC;IACvC,CAAC;IACH,qBAAC;AAAD,CAAC,AA1DD,IA0DC"}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import { createElement, selectAll, selectOne } from 'vevet-dom';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return this._wrapper;
|
|
5
|
-
}
|
|
6
|
-
get elements() {
|
|
7
|
-
return this._elements;
|
|
8
|
-
}
|
|
9
|
-
get props() {
|
|
10
|
-
return this._props;
|
|
11
|
-
}
|
|
12
|
-
constructor(_props) {
|
|
2
|
+
var Elements = /** @class */ (function () {
|
|
3
|
+
function Elements(_props) {
|
|
13
4
|
this._props = _props;
|
|
14
5
|
this._createWrapper();
|
|
15
6
|
this._createElements();
|
|
16
7
|
}
|
|
8
|
+
Object.defineProperty(Elements.prototype, "wrapper", {
|
|
9
|
+
get: function () {
|
|
10
|
+
return this._wrapper;
|
|
11
|
+
},
|
|
12
|
+
enumerable: false,
|
|
13
|
+
configurable: true
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(Elements.prototype, "elements", {
|
|
16
|
+
get: function () {
|
|
17
|
+
return this._elements;
|
|
18
|
+
},
|
|
19
|
+
enumerable: false,
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(Elements.prototype, "props", {
|
|
23
|
+
get: function () {
|
|
24
|
+
return this._props;
|
|
25
|
+
},
|
|
26
|
+
enumerable: false,
|
|
27
|
+
configurable: true
|
|
28
|
+
});
|
|
17
29
|
/** Create scrollable wrapper */
|
|
18
|
-
_createWrapper() {
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
Elements.prototype._createWrapper = function () {
|
|
31
|
+
var _a = this.props, wrapperClassName = _a.wrapperClassName, container = _a.container;
|
|
32
|
+
var existingWrapper = selectOne(".".concat(wrapperClassName), container);
|
|
21
33
|
if (existingWrapper instanceof HTMLElement) {
|
|
22
34
|
this._wrapper = existingWrapper;
|
|
23
35
|
this._wrapperInitiallyExists = true;
|
|
@@ -29,9 +41,9 @@ export class Elements {
|
|
|
29
41
|
children: Array.from(container.children),
|
|
30
42
|
});
|
|
31
43
|
this._wrapperInitiallyExists = false;
|
|
32
|
-
}
|
|
44
|
+
};
|
|
33
45
|
/** Create scrollable elements */
|
|
34
|
-
_createElements() {
|
|
46
|
+
Elements.prototype._createElements = function () {
|
|
35
47
|
if (this.props.elements) {
|
|
36
48
|
this._elements = Array.from(selectAll(this.props.elements, this.props.container));
|
|
37
49
|
}
|
|
@@ -40,49 +52,52 @@ export class Elements {
|
|
|
40
52
|
}
|
|
41
53
|
// add will-change
|
|
42
54
|
if (this.props.hasWillChange) {
|
|
43
|
-
this._elements.forEach((element)
|
|
55
|
+
this._elements.forEach(function (element) {
|
|
44
56
|
// eslint-disable-next-line no-param-reassign
|
|
45
57
|
element.style.willChange = 'transform';
|
|
46
58
|
});
|
|
47
59
|
}
|
|
48
|
-
}
|
|
60
|
+
};
|
|
49
61
|
/** Update elements' properties */
|
|
50
|
-
updateElementsProp(scrollLeft, scrollTop) {
|
|
51
|
-
for (
|
|
52
|
-
|
|
62
|
+
Elements.prototype.updateElementsProp = function (scrollLeft, scrollTop) {
|
|
63
|
+
for (var index = 0; index < this.elements.length; index += 1) {
|
|
64
|
+
var element = this.elements[index];
|
|
53
65
|
// update scroll values
|
|
54
66
|
element.smoothScrollLeft = scrollLeft;
|
|
55
67
|
element.smoothScrollTop = scrollTop;
|
|
56
68
|
// update easing
|
|
57
|
-
|
|
69
|
+
var lerpAttr = element.getAttribute('data-smooth-scroll-lerp');
|
|
58
70
|
if (lerpAttr) {
|
|
59
71
|
element.smoothScrollLerp = parseFloat(lerpAttr);
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
|
-
}
|
|
63
|
-
_getToFixed(value) {
|
|
64
|
-
|
|
74
|
+
};
|
|
75
|
+
Elements.prototype._getToFixed = function (value) {
|
|
76
|
+
var translatePrecision = this.props.translatePrecision;
|
|
65
77
|
if (typeof translatePrecision === 'number') {
|
|
66
78
|
return parseFloat(value.toFixed(translatePrecision));
|
|
67
79
|
}
|
|
68
80
|
return value;
|
|
69
|
-
}
|
|
81
|
+
};
|
|
70
82
|
/** Render elements */
|
|
71
|
-
render() {
|
|
72
|
-
for (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
element.style.transform =
|
|
83
|
+
Elements.prototype.render = function () {
|
|
84
|
+
for (var index = 0; index < this.elements.length; index += 1) {
|
|
85
|
+
var element = this._elements[index];
|
|
86
|
+
var x = this._getToFixed(-element.smoothScrollLeft);
|
|
87
|
+
var y = this._getToFixed(-element.smoothScrollTop);
|
|
88
|
+
element.style.transform = "matrix3d(1,0,0.00,0,0.00,1,0.00,0,0,0,1,0, ".concat(x, ", ").concat(y, ", 0,1)");
|
|
77
89
|
}
|
|
78
|
-
}
|
|
90
|
+
};
|
|
79
91
|
/** Check if scroll values are interpolated */
|
|
80
|
-
checkAllScrollValuesEqual() {
|
|
81
|
-
|
|
82
|
-
return array.every((
|
|
83
|
-
smoothScrollTop
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
Elements.prototype.checkAllScrollValuesEqual = function () {
|
|
93
|
+
var array = this.elements;
|
|
94
|
+
return array.every(function (_a) {
|
|
95
|
+
var smoothScrollLeft = _a.smoothScrollLeft, smoothScrollTop = _a.smoothScrollTop;
|
|
96
|
+
return smoothScrollLeft === array[0].smoothScrollLeft &&
|
|
97
|
+
smoothScrollTop === array[0].smoothScrollTop;
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
Elements.prototype.destroy = function () {
|
|
86
101
|
// remove wrapper
|
|
87
102
|
if (!this._wrapperInitiallyExists) {
|
|
88
103
|
while (this.wrapper.firstChild) {
|
|
@@ -91,12 +106,14 @@ export class Elements {
|
|
|
91
106
|
this._wrapper.remove();
|
|
92
107
|
}
|
|
93
108
|
// reset styles
|
|
94
|
-
this._elements.forEach((element)
|
|
109
|
+
this._elements.forEach(function (element) {
|
|
95
110
|
// eslint-disable-next-line no-param-reassign
|
|
96
111
|
element.style.transform = '';
|
|
97
112
|
// eslint-disable-next-line no-param-reassign
|
|
98
113
|
element.style.willChange = '';
|
|
99
114
|
});
|
|
100
|
-
}
|
|
101
|
-
|
|
115
|
+
};
|
|
116
|
+
return Elements;
|
|
117
|
+
}());
|
|
118
|
+
export { Elements };
|
|
102
119
|
//# sourceMappingURL=Elements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Elements.js","sourceRoot":"","sources":["../../../../src/components/SmoothScroll/Elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAWhE,MAAM,
|
|
1
|
+
{"version":3,"file":"Elements.js","sourceRoot":"","sources":["../../../../src/components/SmoothScroll/Elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAWhE;IAmBE,kBAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAChC,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAnBD,sBAAI,6BAAO;aAAX;Y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