vevet 2.0.1-dev.9 → 2.0.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/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 +17 -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 +34 -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 -7
- package/build/cjs/utils/math/scoped.js +18 -0
- package/build/cjs/utils/math/{spreadScopeProgress.js → spreadScope.js} +2 -2
- 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 +16 -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 +25 -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 -4
- package/build/es/utils/math/scoped.js +14 -0
- package/build/es/utils/math/{spreadScopeProgress.js → spreadScope.js} +1 -1
- 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 -4
- 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 +19 -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 +38 -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 -6
- package/src/ts/utils/math/scoped.ts +17 -0
- package/src/ts/utils/math/{spreadScopeProgress.ts → spreadScope.ts} +2 -2
- 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/build/types/utils/math/spreadScopeProgress.d.ts +0 -5
- package/build/types/utils/math/spreadScopeProgress.d.ts.map +0 -1
- package/src/ts/utils/math/scopeProgress.ts +0 -23
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.SplitText = void 0;
|
|
19
|
-
var vevet_dom_1 = require("vevet-dom");
|
|
20
|
-
var Component_1 = require("../../base/Component");
|
|
21
|
-
var common_1 = require("../../utils/common");
|
|
22
|
-
/**
|
|
23
|
-
* The class splits text in an element into words, letters, and lines.
|
|
24
|
-
* This may be useful when animating the text.
|
|
25
|
-
*/
|
|
26
|
-
var SplitText = /** @class */ (function (_super) {
|
|
27
|
-
__extends(SplitText, _super);
|
|
28
|
-
function SplitText() {
|
|
29
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
-
/**
|
|
31
|
-
* Text container
|
|
32
|
-
*/
|
|
33
|
-
_this._container = null;
|
|
34
|
-
/**
|
|
35
|
-
* innerHTML of the container
|
|
36
|
-
*/
|
|
37
|
-
_this._html = '';
|
|
38
|
-
/**
|
|
39
|
-
* textContent of the container
|
|
40
|
-
*/
|
|
41
|
-
_this._text = '';
|
|
42
|
-
/**
|
|
43
|
-
* Defines if the text is already split
|
|
44
|
-
*/
|
|
45
|
-
_this._isSplit = false;
|
|
46
|
-
/**
|
|
47
|
-
* Text letters
|
|
48
|
-
*/
|
|
49
|
-
_this._letters = [];
|
|
50
|
-
return _this;
|
|
51
|
-
}
|
|
52
|
-
SplitText.prototype._getDefaultProp = function () {
|
|
53
|
-
var prop = {
|
|
54
|
-
container: '.v-text',
|
|
55
|
-
resizeTimeout: 0,
|
|
56
|
-
append: {
|
|
57
|
-
letters: true,
|
|
58
|
-
words: true,
|
|
59
|
-
lines: false,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
return common_1.mergeWithoutArrays(_super.prototype._getDefaultProp.call(this), prop);
|
|
63
|
-
};
|
|
64
|
-
// Extra constructor
|
|
65
|
-
SplitText.prototype._constructor = function () {
|
|
66
|
-
this._create();
|
|
67
|
-
};
|
|
68
|
-
Object.defineProperty(SplitText.prototype, "container", {
|
|
69
|
-
/**
|
|
70
|
-
* Get text container
|
|
71
|
-
*/
|
|
72
|
-
get: function () {
|
|
73
|
-
return this._container;
|
|
74
|
-
},
|
|
75
|
-
enumerable: false,
|
|
76
|
-
configurable: true
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(SplitText.prototype, "letters", {
|
|
79
|
-
/**
|
|
80
|
-
* Get text letters
|
|
81
|
-
*/
|
|
82
|
-
get: function () {
|
|
83
|
-
return this._letters;
|
|
84
|
-
},
|
|
85
|
-
enumerable: false,
|
|
86
|
-
configurable: true
|
|
87
|
-
});
|
|
88
|
-
/**
|
|
89
|
-
* Create split text
|
|
90
|
-
*/
|
|
91
|
-
SplitText.prototype._create = function () {
|
|
92
|
-
// get container
|
|
93
|
-
var container = vevet_dom_1.selectOne(this.prop.container);
|
|
94
|
-
this._container = container;
|
|
95
|
-
if (!container) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
container.classList.add("" + this.prefix);
|
|
99
|
-
console.log(this.prefix);
|
|
100
|
-
// update variables
|
|
101
|
-
this._text = container.textContent;
|
|
102
|
-
this._html = container.innerHTML;
|
|
103
|
-
console.log(this._container);
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Set events
|
|
107
|
-
*/
|
|
108
|
-
SplitText.prototype._setEvents = function () {
|
|
109
|
-
var _this = this;
|
|
110
|
-
this.addViewportCallback('', function () {
|
|
111
|
-
_this._resize();
|
|
112
|
-
}, {
|
|
113
|
-
timeout: this.prop.resizeTimeout,
|
|
114
|
-
name: this.name,
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Resize the text
|
|
119
|
-
*/
|
|
120
|
-
SplitText.prototype._resize = function () {
|
|
121
|
-
this.callbacks.tbt('resize', false);
|
|
122
|
-
this.split();
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Split the text
|
|
126
|
-
*/
|
|
127
|
-
SplitText.prototype.split = function () {
|
|
128
|
-
// break if there's no text
|
|
129
|
-
if (!this._text) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
// get prop
|
|
133
|
-
var prop = this.prop;
|
|
134
|
-
// split text into letters and words
|
|
135
|
-
// this must happen only once
|
|
136
|
-
if (!this._isSplit) {
|
|
137
|
-
// split
|
|
138
|
-
this._splitToWords(this._text);
|
|
139
|
-
// this._lettersSplit();
|
|
140
|
-
// // clear innerHTML
|
|
141
|
-
// this._outer.innerHTML = '';
|
|
142
|
-
// // and append
|
|
143
|
-
// this._lettersAppend();
|
|
144
|
-
// this._wordsAppend();
|
|
145
|
-
}
|
|
146
|
-
// remove previous lines
|
|
147
|
-
// if (this._splitBool) {
|
|
148
|
-
// this._linesRemove();
|
|
149
|
-
// }
|
|
150
|
-
// // append spaces
|
|
151
|
-
// if (!prop.appendLines) {
|
|
152
|
-
// if (!this._splitBool) {
|
|
153
|
-
// this._appendSpaces();
|
|
154
|
-
// }
|
|
155
|
-
// }
|
|
156
|
-
// // split to lines
|
|
157
|
-
// if (prop.appendLines) {
|
|
158
|
-
// this._appendSpaces();
|
|
159
|
-
// this._linesSplit();
|
|
160
|
-
// this._removeBr();
|
|
161
|
-
// this._linesAppend();
|
|
162
|
-
// this._appendSpaces();
|
|
163
|
-
// } else {
|
|
164
|
-
// this._linesSplit();
|
|
165
|
-
// }
|
|
166
|
-
// // change value
|
|
167
|
-
// this._splitBool = true;
|
|
168
|
-
// // remove the class
|
|
169
|
-
// this._outer.classList.remove(`${this._prefix}_splitting`);
|
|
170
|
-
// // launch callback
|
|
171
|
-
// this.lbt('split', this._el);
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Split text into words
|
|
175
|
-
*/
|
|
176
|
-
SplitText.prototype._splitToWords = function (text) {
|
|
177
|
-
console.log(text);
|
|
178
|
-
// split text to chars
|
|
179
|
-
// const chars = text.split('');
|
|
180
|
-
// const el = [];
|
|
181
|
-
// let word: string[] = [];
|
|
182
|
-
// // gor through all chars and add them to single words
|
|
183
|
-
// chars.forEach((char, index) => {
|
|
184
|
-
// const charCode = char.charCodeAt(0);
|
|
185
|
-
// const isNewLine = charCode === 10;
|
|
186
|
-
// const isWhitespace = charCode === 32 || charCode === 160;
|
|
187
|
-
// const isLastChar = index === (chars.length - 1);
|
|
188
|
-
// // define if a new word
|
|
189
|
-
// let isNewWord = false;
|
|
190
|
-
// if (isNewLine || isWhitespace || isLastChar) {
|
|
191
|
-
// isNewWord = true;
|
|
192
|
-
// if (isLastChar) {
|
|
193
|
-
// word.push(char);
|
|
194
|
-
// }
|
|
195
|
-
// }
|
|
196
|
-
// // if a new word
|
|
197
|
-
// if (isNewWord) {
|
|
198
|
-
// // add previous word to elements
|
|
199
|
-
// if (word.length > 0) {
|
|
200
|
-
// el.push({
|
|
201
|
-
// el: false,
|
|
202
|
-
// children: word,
|
|
203
|
-
// newline: isNewLine,
|
|
204
|
-
// content: word.join(''),
|
|
205
|
-
// type: 'word',
|
|
206
|
-
// });
|
|
207
|
-
// }
|
|
208
|
-
// word = [];
|
|
209
|
-
// } else {
|
|
210
|
-
// word.push(char);
|
|
211
|
-
// }
|
|
212
|
-
// // iteration
|
|
213
|
-
// i++;
|
|
214
|
-
// });
|
|
215
|
-
// // add elements to words
|
|
216
|
-
// if (this._prop.appendWords) {
|
|
217
|
-
// el.forEach((word) => {
|
|
218
|
-
// word.el = dom({
|
|
219
|
-
// selector: 'span',
|
|
220
|
-
// styles: `${this._prefix}__word`,
|
|
221
|
-
// });
|
|
222
|
-
// word.el.classList.add();
|
|
223
|
-
// if (!this._prop.appendLetters) {
|
|
224
|
-
// word.el.innerHTML = word.content;
|
|
225
|
-
// }
|
|
226
|
-
// });
|
|
227
|
-
// }
|
|
228
|
-
// // add to stack
|
|
229
|
-
// this._el.words = el;
|
|
230
|
-
};
|
|
231
|
-
return SplitText;
|
|
232
|
-
}(Component_1.Component));
|
|
233
|
-
exports.SplitText = SplitText;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Get progress relatively to the scope.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
*
|
|
8
|
-
* scopeProgress(.35, [0, 1]);
|
|
9
|
-
* // => .5
|
|
10
|
-
* scopeProgress(.35, [.25, 1]);
|
|
11
|
-
* // => .133
|
|
12
|
-
*/
|
|
13
|
-
function scopeProgress(
|
|
14
|
-
/**
|
|
15
|
-
* Current progress
|
|
16
|
-
*/
|
|
17
|
-
progress,
|
|
18
|
-
/**
|
|
19
|
-
* Progress scope
|
|
20
|
-
*/
|
|
21
|
-
scope) {
|
|
22
|
-
var result = (progress - scope[0]) / (scope[1] - scope[0]);
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
exports.default = scopeProgress;
|