vevet 2.0.1-dev.3 → 2.0.1-dev.30

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.
Files changed (125) hide show
  1. package/build/cdn/index.js +1 -1
  2. package/build/cjs/base/Module.js +13 -4
  3. package/build/cjs/components/animation-frame/AnimationFrame.js +1 -1
  4. package/build/cjs/components/canvas/Ctx2D.js +6 -2
  5. package/build/cjs/components/canvas/Ctx2DPrerender.js +20 -2
  6. package/build/cjs/components/loading/ProgressPreloader.js +14 -2
  7. package/build/cjs/components/page/Page.js +36 -8
  8. package/build/cjs/components/scroll/plugins/SmoothScrollDragPlugin.js +40 -5
  9. package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +9 -0
  10. package/build/cjs/components/scroll/scrollable/ScrollView.js +124 -66
  11. package/build/cjs/components/scroll/scrollbar/Bar.js +12 -6
  12. package/build/cjs/components/scroll/scrollbar/ScrollBar.js +3 -1
  13. package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +19 -9
  14. package/build/cjs/components/text/SplitText.js +25 -3
  15. package/build/cjs/components/timeline/StaticTimeline.js +3 -3
  16. package/build/cjs/components/timeline/Timeline.js +3 -2
  17. package/build/cjs/handlers/wheel/WheelHandler.js +195 -0
  18. package/build/cjs/index.js +3 -1
  19. package/build/cjs/utils/listeners/onScroll.js +65 -25
  20. package/build/cjs/utils/math/clamp.js +16 -0
  21. package/build/cjs/utils/math/clampScope.js +16 -0
  22. package/build/cjs/utils/math/inScope.js +10 -0
  23. package/build/cjs/utils/math/index.js +13 -5
  24. package/build/cjs/utils/math/scoped.js +18 -0
  25. package/build/cjs/utils/math/spreadScope.js +18 -0
  26. package/build/cjs/utils/math/spreadScopeProgress.js +18 -0
  27. package/build/cjs/utils/math/wrap.js +13 -0
  28. package/build/es/base/Module.js +2 -4
  29. package/build/es/components/animation-frame/AnimationFrame.js +2 -2
  30. package/build/es/components/canvas/Ctx2D.js +6 -2
  31. package/build/es/components/canvas/Ctx2DPrerender.js +20 -2
  32. package/build/es/components/loading/ProgressPreloader.js +14 -2
  33. package/build/es/components/page/Page.js +32 -8
  34. package/build/es/components/scroll/plugins/SmoothScrollDragPlugin.js +40 -5
  35. package/build/es/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +9 -0
  36. package/build/es/components/scroll/scrollable/ScrollView.js +113 -61
  37. package/build/es/components/scroll/scrollbar/Bar.js +12 -6
  38. package/build/es/components/scroll/scrollbar/ScrollBar.js +3 -1
  39. package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +19 -9
  40. package/build/es/components/text/SplitText.js +25 -3
  41. package/build/es/components/timeline/StaticTimeline.js +3 -3
  42. package/build/es/components/timeline/Timeline.js +3 -2
  43. package/build/es/handlers/wheel/WheelHandler.js +153 -0
  44. package/build/es/index.js +2 -1
  45. package/build/es/utils/listeners/onScroll.js +64 -25
  46. package/build/es/utils/math/clamp.js +12 -0
  47. package/build/es/utils/math/clampScope.js +8 -0
  48. package/build/es/utils/math/inScope.js +6 -0
  49. package/build/es/utils/math/index.js +7 -3
  50. package/build/es/utils/math/scoped.js +14 -0
  51. package/build/es/utils/math/spreadScope.js +15 -0
  52. package/build/es/utils/math/spreadScopeProgress.js +15 -0
  53. package/build/es/utils/math/wrap.js +10 -0
  54. package/build/types/base/Module.d.ts.map +1 -1
  55. package/build/types/components/canvas/Ctx2D.d.ts +9 -0
  56. package/build/types/components/canvas/Ctx2D.d.ts.map +1 -1
  57. package/build/types/components/canvas/Ctx2DPrerender.d.ts +1 -1
  58. package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -1
  59. package/build/types/components/loading/ProgressPreloader.d.ts +7 -0
  60. package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -1
  61. package/build/types/components/page/Page.d.ts +2 -0
  62. package/build/types/components/page/Page.d.ts.map +1 -1
  63. package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts +11 -0
  64. package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts.map +1 -1
  65. package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts.map +1 -1
  66. package/build/types/components/scroll/scrollable/ScrollView.d.ts +40 -14
  67. package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -1
  68. package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -1
  69. package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +4 -0
  70. package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -1
  71. package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +4 -0
  72. package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -1
  73. package/build/types/components/text/SplitText.d.ts +10 -0
  74. package/build/types/components/text/SplitText.d.ts.map +1 -1
  75. package/build/types/components/timeline/Timeline.d.ts.map +1 -1
  76. package/build/types/handlers/wheel/WheelHandler.d.ts +100 -0
  77. package/build/types/handlers/wheel/WheelHandler.d.ts.map +1 -0
  78. package/build/types/index.d.ts +2 -1
  79. package/build/types/index.d.ts.map +1 -1
  80. package/build/types/utils/listeners/onScroll.d.ts +13 -5
  81. package/build/types/utils/listeners/onScroll.d.ts.map +1 -1
  82. package/build/types/utils/math/clamp.d.ts +5 -0
  83. package/build/types/utils/math/clamp.d.ts.map +1 -0
  84. package/build/types/utils/math/clampScope.d.ts +5 -0
  85. package/build/types/utils/math/clampScope.d.ts.map +1 -0
  86. package/build/types/utils/math/inScope.d.ts +5 -0
  87. package/build/types/utils/math/inScope.d.ts.map +1 -0
  88. package/build/types/utils/math/index.d.ts +7 -3
  89. package/build/types/utils/math/index.d.ts.map +1 -1
  90. package/build/types/utils/math/scoped.d.ts +12 -0
  91. package/build/types/utils/math/scoped.d.ts.map +1 -0
  92. package/build/types/utils/math/spreadScope.d.ts +5 -0
  93. package/build/types/utils/math/spreadScope.d.ts.map +1 -0
  94. package/build/types/utils/math/spreadScopeProgress.d.ts +5 -0
  95. package/build/types/utils/math/spreadScopeProgress.d.ts.map +1 -0
  96. package/build/types/utils/math/wrap.d.ts +5 -0
  97. package/build/types/utils/math/wrap.d.ts.map +1 -0
  98. package/package.json +3 -2
  99. package/src/sass/components/cursor/_custom-cursor.scss +0 -1
  100. package/src/ts/base/Module.ts +5 -4
  101. package/src/ts/components/animation-frame/AnimationFrame.ts +2 -2
  102. package/src/ts/components/canvas/Ctx2D.ts +16 -1
  103. package/src/ts/components/canvas/Ctx2DPrerender.ts +23 -6
  104. package/src/ts/components/loading/ProgressPreloader.ts +21 -2
  105. package/src/ts/components/page/Page.ts +34 -8
  106. package/src/ts/components/scroll/plugins/SmoothScrollDragPlugin.ts +58 -5
  107. package/src/ts/components/scroll/plugins/SmoothScrollKeyboardPlugin.ts +12 -0
  108. package/src/ts/components/scroll/scrollable/ScrollView.ts +157 -85
  109. package/src/ts/components/scroll/scrollbar/Bar.ts +12 -6
  110. package/src/ts/components/scroll/scrollbar/ScrollBar.ts +7 -0
  111. package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +24 -8
  112. package/src/ts/components/text/SplitText.ts +38 -2
  113. package/src/ts/components/timeline/StaticTimeline.ts +4 -4
  114. package/src/ts/components/timeline/Timeline.ts +3 -2
  115. package/src/ts/handlers/wheel/WheelHandler.ts +269 -0
  116. package/src/ts/index.ts +4 -0
  117. package/src/ts/utils/listeners/onScroll.ts +105 -34
  118. package/src/ts/utils/math/{boundVal.ts → clamp.ts} +3 -3
  119. package/src/ts/utils/math/clampScope.ts +16 -0
  120. package/src/ts/utils/math/inScope.ts +9 -0
  121. package/src/ts/utils/math/index.ts +12 -4
  122. package/src/ts/utils/math/scoped.ts +17 -0
  123. package/src/ts/utils/math/spreadScope.ts +18 -0
  124. package/src/ts/utils/math/wrap.ts +18 -0
  125. package/src/ts/utils/math/scopeProgress.ts +0 -23
@@ -2,7 +2,7 @@ import { selectAll, selectOne, isElement, createElement, } from 'vevet-dom';
2
2
  import normalizeWheel from 'normalize-wheel';
3
3
  import { Component } from '../../../base/Component';
4
4
  import { AnimationFrame } from '../../animation-frame/AnimationFrame';
5
- import boundVal from '../../../utils/math/boundVal';
5
+ import clamp from '../../../utils/math/clamp';
6
6
  import { lerp } from '../../../utils/math';
7
7
  /**
8
8
  * Create smooth scrolling.
@@ -21,6 +21,8 @@ export class SmoothScroll extends Component {
21
21
  this._clientWidth = 0;
22
22
  this._clientHeight = 0;
23
23
  this._instant = false;
24
+ this._animationFrame = undefined;
25
+ this._outerAnimationFrameEvent = undefined;
24
26
  this._currentFPS = 60;
25
27
  // get outer elements
26
28
  this._outer = selectOne(selectors.outer);
@@ -51,9 +53,11 @@ export class SmoothScroll extends Component {
51
53
  }
52
54
  this._elementsLength = this._elements.length;
53
55
  // add will-change
54
- this._elements.forEach((el) => {
55
- el.style.willChange = 'transform';
56
- });
56
+ if (this.prop.useWillChange) {
57
+ this._elements.forEach((el) => {
58
+ el.style.willChange = 'transform';
59
+ });
60
+ }
57
61
  // initialize the class
58
62
  if (init) {
59
63
  this.init();
@@ -86,7 +90,7 @@ export class SmoothScroll extends Component {
86
90
  ? -this.prop.overscroll.max : 0;
87
91
  const max = this.maxScrollableWidth
88
92
  + (!!this.prop.overscroll && this.prop.isHorizontal ? this.prop.overscroll.max : 0);
89
- this._targetLeft = boundVal(val, [min, max]);
93
+ this._targetLeft = clamp(val, [min, max]);
90
94
  }
91
95
  get targetLeftBound() {
92
96
  return this._targetLeft;
@@ -106,7 +110,7 @@ export class SmoothScroll extends Component {
106
110
  ? -this.prop.overscroll.max : 0;
107
111
  const max = this.maxScrollableHeight
108
112
  + (!!this.prop.overscroll && !this.prop.isHorizontal ? this.prop.overscroll.max : 0);
109
- this._targetTop = boundVal(val, [min, max]);
113
+ this._targetTop = clamp(val, [min, max]);
110
114
  }
111
115
  get targetTopBound() {
112
116
  return this._targetTop;
@@ -155,7 +159,7 @@ export class SmoothScroll extends Component {
155
159
  return Object.assign(Object.assign({}, super._getDefaultProp()), { selectors: {
156
160
  outer: `#${this.prefix}`,
157
161
  elements: false,
158
- }, enabled: true, animationFrame: false, recalculateSizes: true, useWheel: true, autoStop: true, isHorizontal: false, stopPropagation: true, useWillChange: true, render: {
162
+ }, enabled: true, animationFrame: false, recalculateSizes: true, resizeTimeout: 0, useWheel: true, autoStop: true, isHorizontal: false, stopPropagation: true, useWillChange: true, render: {
159
163
  lerp: 0.1,
160
164
  lerpToFixed: 2,
161
165
  approximation: 0.1,
@@ -176,6 +180,8 @@ export class SmoothScroll extends Component {
176
180
  this.resize();
177
181
  this.addViewportCallback('', () => {
178
182
  this.resize(true);
183
+ }, {
184
+ timeout: this.prop.resizeTimeout,
179
185
  });
180
186
  // wheel
181
187
  this.addEventListeners(this.outer, 'wheel', (e) => {
@@ -205,8 +211,8 @@ export class SmoothScroll extends Component {
205
211
  // get sizes
206
212
  this._clientWidth = outer.clientWidth;
207
213
  this._clientHeight = outer.clientHeight;
208
- this._scrollWidth = boundVal(container.clientWidth, [this.clientWidth, Infinity]);
209
- this._scrollHeight = boundVal(container.clientHeight, [this.clientHeight, Infinity]);
214
+ this._scrollWidth = clamp(container.clientWidth, [this.clientWidth, Infinity]);
215
+ this._scrollHeight = clamp(container.clientHeight, [this.clientHeight, Infinity]);
210
216
  // force instant change
211
217
  // it means that after resizing, scrolling will be instantaneous for a while
212
218
  if (native) {
@@ -219,6 +225,10 @@ export class SmoothScroll extends Component {
219
225
  this.targetLeft = parseInt(this.targetLeft.toFixed(0), 10);
220
226
  this.targetTop = parseInt(this.targetTop.toFixed(0), 10);
221
227
  }
228
+ // set scroll classes
229
+ const hasScroll = this.maxScrollableHeight > 0 || this.maxScrollableWidth > 0;
230
+ outer.classList.toggle('has-scroll', hasScroll);
231
+ outer.classList.toggle('no-scroll', !hasScroll);
222
232
  // render elements
223
233
  this._updateElementsProp();
224
234
  // this.render();
@@ -19,8 +19,12 @@ export class SplitText extends Component {
19
19
  }
20
20
  // get initial text
21
21
  this._initHTML = this._container.innerHTML;
22
- this._initText = (this._container.innerText || 'no rendered text').trim();
22
+ const innerText = this._container.innerText.trim() || this._container.innerHTML.trim();
23
+ this._initText = innerText || 'no rendered text';
23
24
  this._initText = this._initText.replace(/\s+\n/gm, '\n');
25
+ this._initText = this._initText.replace(/<br>/gm, String.fromCharCode(10));
26
+ this._initText = this._initText.replace(/<br\/>/gm, String.fromCharCode(10));
27
+ this._initText = this._initText.replace(/<br \/>/gm, String.fromCharCode(10));
24
28
  // set default vars
25
29
  this._isPrimarySplit = false;
26
30
  this._letters = [];
@@ -32,7 +36,7 @@ export class SplitText extends Component {
32
36
  }
33
37
  }
34
38
  _getDefaultProp() {
35
- return Object.assign(Object.assign({}, super._getDefaultProp()), { container: `#${this.prefix}`, appendLetters: true, appendLines: false });
39
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { container: `#${this.prefix}`, appendLetters: true, appendLines: false, viewportTarget: '', resizeTimeout: 0 });
36
40
  }
37
41
  get prefix() {
38
42
  return `${this._app.prefix}split-text`;
@@ -57,8 +61,10 @@ export class SplitText extends Component {
57
61
  // split the text
58
62
  this.splitText();
59
63
  if (this.prop.appendLines) {
60
- this.addViewportCallback('', () => {
64
+ this.addViewportCallback(this.prop.viewportTarget, () => {
61
65
  this.splitText();
66
+ }, {
67
+ timeout: this.prop.resizeTimeout,
62
68
  });
63
69
  }
64
70
  }
@@ -103,6 +109,7 @@ export class SplitText extends Component {
103
109
  // get type of the char
104
110
  const charCode = char.charCodeAt(0);
105
111
  const isWhitespace = charCode === 32 || charCode === 160;
112
+ const isSeparator = [45, 8208, 8211, 8212, 8722].includes(charCode);
106
113
  const isNewLine = charCode === 10;
107
114
  // add elements
108
115
  if (isWhitespace) {
@@ -123,6 +130,21 @@ export class SplitText extends Component {
123
130
  if (!this.prop.appendLetters) {
124
131
  currentWord.el.innerHTML = currentWord.content;
125
132
  }
133
+ // go to next word if needed
134
+ if (isSeparator) {
135
+ wordIndex += 1;
136
+ }
137
+ });
138
+ // only filled words
139
+ this._words = this._words.filter((word, index) => {
140
+ if (word.content.length === 0) {
141
+ if (index > 0) {
142
+ this._words[index - 1].whitespace = word.whitespace;
143
+ this._words[index - 1].br = word.br;
144
+ }
145
+ return false;
146
+ }
147
+ return true;
126
148
  });
127
149
  }
128
150
  /**
@@ -1,7 +1,7 @@
1
1
  import easingProgress from 'easing-progress';
2
2
  import { Component } from '../../base/Component';
3
- import scopeProgress from '../../utils/math/scopeProgress';
4
- import boundVal from '../../utils/math/boundVal';
3
+ import scoped from '../../utils/math/scoped';
4
+ import clamp from '../../utils/math/clamp';
5
5
  /**
6
6
  * StaticTimeline is the base class for Timeline itself.
7
7
  * The difference between the coponents is that StaticTimeline has no animation:
@@ -75,7 +75,7 @@ export class StaticTimeline extends Component {
75
75
  for (let index = 0, l = length; index < l; index += 1) {
76
76
  const tm = this._nestedTimelines[index];
77
77
  // calculate progress of this very timeline
78
- const tmProgress = boundVal(scopeProgress(progressForNested, tm.prop.nestedScope), [0, 1]);
78
+ const tmProgress = clamp(scoped(progressForNested, tm.prop.nestedScope), [0, 1]);
79
79
  tm.progress = tmProgress;
80
80
  }
81
81
  }
@@ -1,5 +1,5 @@
1
1
  import { StaticTimeline } from './StaticTimeline';
2
- import boundVal from '../../utils/math/boundVal';
2
+ import clamp from '../../utils/math/clamp';
3
3
  /**
4
4
  * Timeline is an animation helper.
5
5
  */
@@ -10,6 +10,7 @@ export class Timeline extends StaticTimeline {
10
10
  this._isPlaying = false;
11
11
  this._isReversed = false;
12
12
  this._isPaused = false;
13
+ this._animationFrame = undefined;
13
14
  this._animationFrameLastTime = 0;
14
15
  if (init) {
15
16
  this.init();
@@ -101,7 +102,7 @@ export class Timeline extends StaticTimeline {
101
102
  this._animationFrameLastTime = currentTime;
102
103
  // calculate current progress
103
104
  const progressIterator = frameDiff / this.prop.duration / (isReversed ? -1 : 1);
104
- const progressTarget = boundVal(this.progress + progressIterator, [0, 1]);
105
+ const progressTarget = clamp(this.progress + progressIterator, [0, 1]);
105
106
  this.progress = progressTarget;
106
107
  // end animation
107
108
  if ((progressTarget === 1 && !isReversed)
@@ -0,0 +1,153 @@
1
+ import { addEventListener } from 'vevet-dom';
2
+ import normalizeWheel from 'normalize-wheel';
3
+ import { Module } from '../../base/Module';
4
+ /**
5
+ * Wheel events: up & down, left & right without repeating
6
+
7
+ */
8
+ export class WheelHandler extends Module {
9
+ constructor(initialProp, init = true) {
10
+ super(initialProp, false);
11
+ this._wheelListener = undefined;
12
+ this._lockWheel = false;
13
+ if (init) {
14
+ this.init();
15
+ }
16
+ }
17
+ _getDefaultProp() {
18
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { container: false, enabled: true, stopPropagation: false, threshold: 20 });
19
+ }
20
+ /**
21
+ * Listener contianer
22
+ */
23
+ get container() {
24
+ if (!this.prop.container) {
25
+ return window;
26
+ }
27
+ return this.prop.container;
28
+ }
29
+ // Set Module Events
30
+ _setEvents() {
31
+ super._setEvents();
32
+ if (!(this.container instanceof Window)) {
33
+ this._listeners.push(addEventListener(this.container, 'mouseenter', this._handleMouseEnter.bind(this)));
34
+ this._listeners.push(addEventListener(this.container, 'mouseleave', this._handleMouseLeave.bind(this)));
35
+ }
36
+ else {
37
+ this._toggleWheelEvent();
38
+ }
39
+ }
40
+ _onPropMutate() {
41
+ super._onPropMutate();
42
+ this._toggleWheelEvent();
43
+ }
44
+ /**
45
+ * Handle element mouse enter
46
+ */
47
+ _handleMouseEnter() {
48
+ if (this.prop.enabled) {
49
+ this._createWheelEvent();
50
+ }
51
+ }
52
+ /**
53
+ * Handle element mouse leave
54
+ */
55
+ _handleMouseLeave() {
56
+ this._destroyWheelEvent();
57
+ }
58
+ /**
59
+ * Set wheel event
60
+ */
61
+ _toggleWheelEvent() {
62
+ if (this.prop.enabled) {
63
+ this._createWheelEvent();
64
+ }
65
+ else {
66
+ this._destroyWheelEvent();
67
+ }
68
+ }
69
+ /**
70
+ * Create a wheel event
71
+ */
72
+ _createWheelEvent() {
73
+ if (this._wheelListener) {
74
+ return;
75
+ }
76
+ // reset gaining
77
+ this._lockWheel = false;
78
+ if (this._lockWheelTimeout) {
79
+ clearTimeout(this._lockWheelTimeout);
80
+ }
81
+ // create a listener
82
+ this._wheelListener = addEventListener(this.container, 'wheel',
83
+ // throttle(this._handleWheel.bind(this), 200),
84
+ this._handleWheel.bind(this));
85
+ }
86
+ /**
87
+ * Destroy the wheel event
88
+ */
89
+ _destroyWheelEvent() {
90
+ if (!this._wheelListener) {
91
+ return;
92
+ }
93
+ this._wheelListener.remove();
94
+ this._wheelListener = undefined;
95
+ }
96
+ /**
97
+ * Handle wheel event
98
+ */
99
+ _handleWheel(evt) {
100
+ if (!this._wheelListener) {
101
+ return;
102
+ }
103
+ // stop propagation
104
+ if (this.prop.stopPropagation) {
105
+ evt.preventDefault();
106
+ evt.stopPropagation();
107
+ }
108
+ // if locked
109
+ if (this._lockWheel) {
110
+ if (this._lockWheelTimeout) {
111
+ clearTimeout(this._lockWheelTimeout);
112
+ }
113
+ this._lockWheelTimeout = setTimeout(() => {
114
+ this._lockWheel = false;
115
+ }, 300);
116
+ return;
117
+ }
118
+ // data
119
+ const delta = normalizeWheel(evt);
120
+ const { threshold } = this.prop;
121
+ // launch events
122
+ let eventFired = false;
123
+ // Y
124
+ if (delta.pixelY > threshold) {
125
+ this._callbacks.tbt('down', false);
126
+ eventFired = true;
127
+ }
128
+ else if (delta.pixelY < threshold * -1) {
129
+ this._callbacks.tbt('up', false);
130
+ eventFired = true;
131
+ }
132
+ // X
133
+ if (delta.pixelX > threshold) {
134
+ this._callbacks.tbt('right', false);
135
+ eventFired = true;
136
+ }
137
+ else if (delta.pixelX < threshold * -1) {
138
+ this._callbacks.tbt('left', false);
139
+ eventFired = true;
140
+ }
141
+ // lock events
142
+ if (eventFired) {
143
+ this._lockWheel = true;
144
+ }
145
+ }
146
+ /**
147
+ * Destroy the module
148
+ */
149
+ _destroy() {
150
+ super._destroy();
151
+ this._destroyWheelEvent();
152
+ }
153
+ }
package/build/es/index.js CHANGED
@@ -11,6 +11,7 @@ import { Module } from './base/Module';
11
11
  import { Component } from './base/Component';
12
12
  import { Plugin } from './base/Plugin';
13
13
  import { Page } from './components/page/Page';
14
+ import { WheelHandler } from './handlers/wheel/WheelHandler';
14
15
  import { AnimationFrame } from './components/animation-frame/AnimationFrame';
15
16
  import { StaticTimeline } from './components/timeline/StaticTimeline';
16
17
  import { Timeline } from './components/timeline/Timeline';
@@ -34,4 +35,4 @@ const utils = {
34
35
  listeners,
35
36
  math,
36
37
  };
37
- export { utils, GeneralTypes, Application, Viewport, PageLoad, Callbacks, MutableProp, Module, Component, Plugin, Page, AnimationFrame, StaticTimeline, Timeline, Preloader, ProgressPreloader, Dragger, DraggerMove, DraggerDirection, Ctx2D, Ctx2DPrerender, SmoothScroll, ScrollBar, ScrollEventsBase, ScrollView, SmoothScrollKeyboardPlugin, SmoothScrollDragPlugin, SplitText, CustomCursor, };
38
+ export { utils, GeneralTypes, Application, Viewport, PageLoad, Callbacks, MutableProp, Module, Component, Plugin, Page, WheelHandler, AnimationFrame, StaticTimeline, Timeline, Preloader, ProgressPreloader, Dragger, DraggerMove, DraggerDirection, Ctx2D, Ctx2DPrerender, SmoothScroll, ScrollBar, ScrollEventsBase, ScrollView, SmoothScrollKeyboardPlugin, SmoothScrollDragPlugin, SplitText, CustomCursor, };
@@ -1,44 +1,83 @@
1
1
  import { addEventListener, selectOne } from 'vevet-dom';
2
2
  import { SmoothScroll } from '../../components/scroll/smooth-scroll/SmoothScroll';
3
+ import { randID } from '../common';
4
+ let instances = [];
3
5
  /**
4
6
  * Add OnScroll event
5
7
  */
6
- export default function onScroll(selector, callback) {
7
- const listeners = [];
8
- if (selector instanceof SmoothScroll) {
9
- selector.addCallback('scroll', () => {
10
- callback({
11
- scrollTop: selector.scrollTop,
12
- scrollLeft: selector.scrollLeft,
13
- });
8
+ export default function onScroll({ container, callback, isPassive = false, }) {
9
+ // check if listeners for this element already exist
10
+ let instance = instances.find((data) => (data.container === container && data.isPassive === isPassive));
11
+ const callbackId = randID('scroll-event');
12
+ // if a listener exists, we just add a new callback to its stack
13
+ if (instance) {
14
+ instance.callbacks.push({
15
+ id: callbackId,
16
+ callback,
14
17
  });
15
18
  }
16
19
  else {
17
- let outer;
18
- if (typeof selector === 'string') {
19
- outer = selectOne(selector);
20
+ // otherwise we create a new instance
21
+ instance = {
22
+ id: randID('scroll-event-instance'),
23
+ container,
24
+ callbacks: [{
25
+ id: callbackId,
26
+ callback,
27
+ }],
28
+ isPassive,
29
+ listeners: [],
30
+ };
31
+ instances.push(instance);
32
+ // vars
33
+ const { listeners } = instance;
34
+ // smooth scroll events
35
+ if (container instanceof SmoothScroll) {
36
+ listeners.push(container.addCallback('scroll', () => {
37
+ const { scrollTop, scrollLeft } = container;
38
+ for (let index = 0; index < instance.callbacks.length; index += 1) {
39
+ instance.callbacks[index].callback({
40
+ scrollTop,
41
+ scrollLeft,
42
+ });
43
+ }
44
+ }));
20
45
  }
21
46
  else {
22
- outer = selector;
23
- }
24
- if (outer) {
25
- listeners.push(addEventListener(outer, 'scroll', () => {
26
- const scrollTop = outer instanceof Window
27
- ? outer.pageYOffset : outer.scrollTop;
28
- const scrollLeft = outer instanceof Window
29
- ? outer.pageXOffset : outer.scrollLeft;
30
- callback({
31
- scrollTop,
32
- scrollLeft,
33
- });
47
+ // dom scroll events
48
+ const isWindow = container instanceof Window;
49
+ const domContainer = selectOne(container);
50
+ listeners.push(addEventListener(domContainer, 'scroll', () => {
51
+ const scrollTop = isWindow
52
+ ? domContainer.pageYOffset : domContainer.scrollTop;
53
+ const scrollLeft = isWindow
54
+ ? domContainer.pageXOffset : domContainer.scrollLeft;
55
+ for (let index = 0; index < instance.callbacks.length; index += 1) {
56
+ instance.callbacks[index].callback({
57
+ scrollTop,
58
+ scrollLeft,
59
+ });
60
+ }
61
+ }, {
62
+ passive: isPassive,
34
63
  }));
35
64
  }
36
65
  }
37
66
  return {
38
67
  remove: () => {
39
- listeners.forEach((listener) => {
40
- listener.remove();
68
+ const newCallbacks = instance.callbacks.filter((item) => {
69
+ if (item.id !== callbackId) {
70
+ return true;
71
+ }
72
+ return false;
41
73
  });
74
+ instance.callbacks = newCallbacks;
75
+ if (newCallbacks.length === 0) {
76
+ instance.listeners.forEach((listener) => {
77
+ listener.remove();
78
+ });
79
+ instances = instances.filter((item) => item.id !== instance.id);
80
+ }
42
81
  },
43
82
  };
44
83
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Clamp the value between two points
3
+ */
4
+ export default function clamp(val, scope = [0, 1]) {
5
+ if (val < scope[0]) {
6
+ return scope[0];
7
+ }
8
+ if (val > scope[1]) {
9
+ return scope[1];
10
+ }
11
+ return val;
12
+ }
@@ -0,0 +1,8 @@
1
+ import scoped from './scoped';
2
+ import clamp from './clamp';
3
+ /**
4
+ * Get progress relatively to the scope and clamp it within two points
5
+ */
6
+ export default function clampScoped(val, scope = [0, 1], clampScope = [0, 1]) {
7
+ return clamp(scoped(val, scope), clampScope);
8
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Check if the value is within the scope
3
+ */
4
+ export default function inScope(val, scopeValue = [0, 1]) {
5
+ return val >= scopeValue[0] && val <= scopeValue[1];
6
+ }
@@ -1,4 +1,8 @@
1
- import boundVal from './boundVal';
1
+ import clamp from './clamp';
2
2
  import lerp from './lerp';
3
- import scopeProgress from './scopeProgress';
4
- export { boundVal, lerp, scopeProgress, };
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, };
@@ -0,0 +1,14 @@
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, scopeValue = [0, 1]) {
12
+ const result = (val - scopeValue[0]) / (scopeValue[1] - scopeValue[0]);
13
+ return result;
14
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Distribute scope progress among a certain quantity of timelines.
3
+ */
4
+ export default function spreadScope(quantity, shift) {
5
+ const timelines = [];
6
+ // duration for each element
7
+ const duration = 1 / (quantity - shift * (quantity - 1));
8
+ // calculate timelines
9
+ for (let index = 0; index < quantity; index += 1) {
10
+ const start = (duration * (1 - shift)) * index;
11
+ const end = start + duration;
12
+ timelines.push([start, end]);
13
+ }
14
+ return timelines;
15
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Distribute scope progress among a certain quantity of timelines.
3
+ */
4
+ export default function spreadScopeProgress(quantity, shift) {
5
+ const timelines = [];
6
+ // duration for each element
7
+ const duration = 1 / (quantity - shift * (quantity - 1));
8
+ // calculate timelines
9
+ for (let index = 0; index < quantity; index += 1) {
10
+ const start = (duration * (1 - shift)) * index;
11
+ const end = start + duration;
12
+ timelines.push([start, end]);
13
+ }
14
+ return timelines;
15
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Wrap values
3
+ */
4
+ export default function wrap(min, max, value) {
5
+ const range = max - min;
6
+ return conditionalReturn(value, (val) => ((range + ((val - min) % range)) % range) + min);
7
+ }
8
+ function conditionalReturn(value, func) {
9
+ return value || value === 0 ? func(value) : func;
10
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../../../src/ts/base/Module.ts"],"names":[],"mappings":"AAAA,OAAO,EACe,iBAAiB,EAAE,wBAAwB,EAAE,eAAe,EACjF,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAK5D,yBAAiB,OAAO,CAAC;IAErB;;OAEG;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B,CACtB,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EACtC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EACpC,IAAI,GAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAM;IAa7C;;;OAGG;IACI,WAAW,CAAE,MAAM,SAAS,MAAM,cAAc,EACnD,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAC/D,IAAI,GAAE,UAAU,CAAC,oBAAyB;IAS9C;;OAEG;IACI,iBAAiB,CACpB,EAAE,SAAS,eAAe,EAC1B,MAAM,SAAS,MAAM,mBAAmB,EACxC,QAAQ,SAAS,CAAC,GAAG,EAAE,mBAAmB,CAAC,MAAM,CAAC,KAAK,IAAI,EAG3D,EAAE,EAAE,EAAE,EACN,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,wBAAwB,GAAG,iBAAiB;IAS1D;;OAEG;IACI,OAAO;IAOd;;OAEG;IACH,SAAS,CAAC,QAAQ;CAqBrB"}
@@ -21,6 +21,15 @@ export declare namespace NCtx2D {
21
21
  * @default false
22
22
  */
23
23
  updateOnResize?: boolean | keyof NViewport.CallbacksTypes;
24
+ /**
25
+ * If need to resize when initializing
26
+ * @default true
27
+ */
28
+ initialResize?: boolean;
29
+ /**
30
+ * @default 0
31
+ */
32
+ resizeTimeout?: number;
24
33
  }
25
34
  /**
26
35
  * Changeable properties
@@ -1 +1 @@
1
- {"version":3,"file":"Ctx2D.d.ts","sourceRoot":"","sources":["../../../../src/ts/components/canvas/Ctx2D.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,SAA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,CAAC;IAeP,SAAS,CAAC,UAAU;IAapB,SAAS,CAAC,aAAa;IAOvB;;OAEG;IACI,MAAM;IA8Cb;;OAEG;IACH,SAAS,CAAC,QAAQ;CAOrB"}
@@ -9,7 +9,7 @@ export declare namespace NCtx2DPrerender {
9
9
  /**
10
10
  * Media element
11
11
  */
12
- media: BaseProp['source'] | false;
12
+ media: BaseProp['source'] | Ctx2DPrerender | false;
13
13
  }
14
14
  /**
15
15
  * Changeable properties
@@ -1 +1 @@
1
- {"version":3,"file":"Ctx2DPrerender.d.ts","sourceRoot":"","sources":["../../../../src/ts/components/canvas/Ctx2DPrerender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIxC,yBAAiB,eAAe,CAAC;IAE7B;;OAEG;IACH,UAAiB,UAAW,SAAQ,MAAM,CAAC,UAAU;QACjD;;WAEG;QACH,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;KACrC;IAED;;OAEG;IACH,UAAiB,cAAe,SAAQ,MAAM,CAAC,cAAc;QACzD;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;KACrB;IAED;;OAEG;IACH,UAAiB,cAAe,SAAQ,MAAM,CAAC,cAAc;QACzD,WAAW,EAAE,KAAK,CAAA;KACrB;CAEJ;AAID;;GAEG;AACH,qBAAa,cAAc,CACvB,UAAU,SAAS,eAAe,CAAC,UAAU,GAAG,eAAe,CAAC,UAAU,EAC1E,cAAc,SAAS,eAAe,CAAC,cAAc,GAAG,eAAe,CAAC,cAAc,EACtF,cAAc,SAAS,eAAe,CAAC,cAAc,GAAG,eAAe,CAAC,cAAc,CACxF,SAAQ,KAAK,CACX,UAAU,EACV,cAAc,EACd,cAAc,CACjB;IACG,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 -34,6 +34,13 @@ export declare namespace NProgressPreloader {
34
34
  * @default '.js-preload'
35
35
  */
36
36
  custom?: string | false;
37
+ /**
38
+ * If you enable images, video, or custom loaders,
39
+ * all these resources will be preloaded. In cases when you may want not
40
+ * to preload a certain resource, you can add to it the class name specified here.
41
+ * @default 'js-preload-ignore'
42
+ */
43
+ ignoreClassName?: string;
37
44
  };
38
45
  /**
39
46
  * Smooth calculation settings