vevet 2.0.1-dev.5 → 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.
Files changed (128) hide show
  1. package/build/cdn/index.js +1 -1
  2. package/build/cjs/app/Application.js +8 -8
  3. package/build/cjs/app/events/PageLoad.js +3 -3
  4. package/build/cjs/app/events/Viewport.js +5 -5
  5. package/build/cjs/base/Callbacks.js +3 -3
  6. package/build/cjs/base/Module.js +16 -7
  7. package/build/cjs/base/MutableProp.js +10 -10
  8. package/build/cjs/components/animation-frame/AnimationFrame.js +1 -1
  9. package/build/cjs/components/canvas/Ctx2D.js +7 -3
  10. package/build/cjs/components/canvas/Ctx2DPrerender.js +21 -3
  11. package/build/cjs/components/cursor/CustomCursor.js +12 -12
  12. package/build/cjs/components/dragger/Dragger.js +8 -8
  13. package/build/cjs/components/dragger/DraggerMove.js +2 -2
  14. package/build/cjs/components/loading/Preloader.js +5 -5
  15. package/build/cjs/components/loading/ProgressPreloader.js +17 -5
  16. package/build/cjs/components/page/Page.js +37 -9
  17. package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +2 -2
  18. package/build/cjs/components/scroll/scrollable/ScrollEventsBase.js +1 -1
  19. package/build/cjs/components/scroll/scrollable/ScrollView.js +133 -73
  20. package/build/cjs/components/scroll/scrollbar/Bar.js +18 -15
  21. package/build/cjs/components/scroll/scrollbar/ScrollBar.js +9 -7
  22. package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +26 -22
  23. package/build/cjs/components/text/SplitText.js +34 -12
  24. package/build/cjs/components/timeline/StaticTimeline.js +4 -4
  25. package/build/cjs/components/timeline/Timeline.js +2 -2
  26. package/build/cjs/handlers/wheel/WheelHandler.js +4 -4
  27. package/build/cjs/utils/common/mergeWithoutArrays.js +1 -1
  28. package/build/cjs/utils/common/randID.js +2 -2
  29. package/build/cjs/utils/listeners/onScroll.js +65 -25
  30. package/build/cjs/utils/math/{boundVal.js → clamp.js} +3 -3
  31. package/build/cjs/utils/math/clampScope.js +16 -0
  32. package/build/cjs/utils/math/inScope.js +10 -0
  33. package/build/cjs/utils/math/index.js +13 -5
  34. package/build/cjs/utils/math/scoped.js +18 -0
  35. package/build/cjs/utils/math/spreadScope.js +18 -0
  36. package/build/cjs/utils/math/wrap.js +13 -0
  37. package/build/es/base/Module.js +2 -4
  38. package/build/es/components/animation-frame/AnimationFrame.js +2 -2
  39. package/build/es/components/canvas/Ctx2D.js +6 -2
  40. package/build/es/components/canvas/Ctx2DPrerender.js +20 -2
  41. package/build/es/components/loading/ProgressPreloader.js +14 -2
  42. package/build/es/components/page/Page.js +32 -8
  43. package/build/es/components/scroll/scrollable/ScrollView.js +112 -62
  44. package/build/es/components/scroll/scrollbar/Bar.js +9 -6
  45. package/build/es/components/scroll/scrollbar/ScrollBar.js +3 -1
  46. package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +13 -9
  47. package/build/es/components/text/SplitText.js +25 -3
  48. package/build/es/components/timeline/StaticTimeline.js +3 -3
  49. package/build/es/components/timeline/Timeline.js +2 -2
  50. package/build/es/utils/listeners/onScroll.js +64 -25
  51. package/build/es/utils/math/{boundVal.js → clamp.js} +2 -2
  52. package/build/es/utils/math/clampScope.js +8 -0
  53. package/build/es/utils/math/inScope.js +6 -0
  54. package/build/es/utils/math/index.js +7 -3
  55. package/build/es/utils/math/scoped.js +14 -0
  56. package/build/es/utils/math/spreadScope.js +15 -0
  57. package/build/es/utils/math/wrap.js +10 -0
  58. package/build/types/base/Module.d.ts.map +1 -1
  59. package/build/types/components/canvas/Ctx2D.d.ts +9 -0
  60. package/build/types/components/canvas/Ctx2D.d.ts.map +1 -1
  61. package/build/types/components/canvas/Ctx2DPrerender.d.ts +1 -1
  62. package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -1
  63. package/build/types/components/loading/ProgressPreloader.d.ts +7 -0
  64. package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -1
  65. package/build/types/components/page/Page.d.ts +2 -0
  66. package/build/types/components/page/Page.d.ts.map +1 -1
  67. package/build/types/components/scroll/scrollable/ScrollView.d.ts +40 -14
  68. package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -1
  69. package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -1
  70. package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +4 -0
  71. package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -1
  72. package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +4 -0
  73. package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -1
  74. package/build/types/components/text/SplitText.d.ts +10 -0
  75. package/build/types/components/text/SplitText.d.ts.map +1 -1
  76. package/build/types/utils/listeners/onScroll.d.ts +13 -5
  77. package/build/types/utils/listeners/onScroll.d.ts.map +1 -1
  78. package/build/types/utils/math/clamp.d.ts +5 -0
  79. package/build/types/utils/math/clamp.d.ts.map +1 -0
  80. package/build/types/utils/math/clampScope.d.ts +5 -0
  81. package/build/types/utils/math/clampScope.d.ts.map +1 -0
  82. package/build/types/utils/math/inScope.d.ts +5 -0
  83. package/build/types/utils/math/inScope.d.ts.map +1 -0
  84. package/build/types/utils/math/index.d.ts +7 -3
  85. package/build/types/utils/math/index.d.ts.map +1 -1
  86. package/build/types/utils/math/scoped.d.ts +12 -0
  87. package/build/types/utils/math/scoped.d.ts.map +1 -0
  88. package/build/types/utils/math/spreadScope.d.ts +5 -0
  89. package/build/types/utils/math/spreadScope.d.ts.map +1 -0
  90. package/build/types/utils/math/wrap.d.ts +5 -0
  91. package/build/types/utils/math/wrap.d.ts.map +1 -0
  92. package/package.json +3 -3
  93. package/src/ts/base/Module.ts +5 -4
  94. package/src/ts/components/animation-frame/AnimationFrame.ts +2 -2
  95. package/src/ts/components/canvas/Ctx2D.ts +16 -1
  96. package/src/ts/components/canvas/Ctx2DPrerender.ts +23 -6
  97. package/src/ts/components/loading/ProgressPreloader.ts +21 -2
  98. package/src/ts/components/page/Page.ts +34 -8
  99. package/src/ts/components/scroll/scrollable/ScrollView.ts +155 -86
  100. package/src/ts/components/scroll/scrollbar/Bar.ts +9 -6
  101. package/src/ts/components/scroll/scrollbar/ScrollBar.ts +7 -0
  102. package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +17 -8
  103. package/src/ts/components/text/SplitText.ts +38 -2
  104. package/src/ts/components/timeline/StaticTimeline.ts +4 -4
  105. package/src/ts/components/timeline/Timeline.ts +2 -2
  106. package/src/ts/utils/listeners/onScroll.ts +105 -34
  107. package/src/ts/utils/math/{boundVal.ts → clamp.ts} +3 -3
  108. package/src/ts/utils/math/clampScope.ts +16 -0
  109. package/src/ts/utils/math/inScope.ts +9 -0
  110. package/src/ts/utils/math/index.ts +12 -4
  111. package/src/ts/utils/math/scoped.ts +17 -0
  112. package/src/ts/utils/math/spreadScope.ts +18 -0
  113. package/src/ts/utils/math/wrap.ts +18 -0
  114. package/build/cjs/components/scroll/custom-scroll/CustomScroll.js +0 -517
  115. package/build/cjs/components/split-text/SplitText.js +0 -233
  116. package/build/cjs/utils/math/scopeProgress.js +0 -25
  117. package/build/es/components/scroll/custom-scroll/CustomScroll.js +0 -486
  118. package/build/es/components/split-text/SplitText.js +0 -199
  119. package/build/es/utils/math/scopeProgress.js +0 -22
  120. package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts +0 -322
  121. package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts.map +0 -1
  122. package/build/types/components/split-text/SplitText.d.ts +0 -118
  123. package/build/types/components/split-text/SplitText.d.ts.map +0 -1
  124. package/build/types/utils/math/boundVal.d.ts +0 -5
  125. package/build/types/utils/math/boundVal.d.ts.map +0 -1
  126. package/build/types/utils/math/scopeProgress.d.ts +0 -20
  127. package/build/types/utils/math/scopeProgress.d.ts.map +0 -1
  128. package/src/ts/utils/math/scopeProgress.ts +0 -23
@@ -53,21 +53,21 @@ var Application = /** @class */ (function () {
53
53
  // add the application to the window
54
54
  window.vevetApp = this;
55
55
  // get type of device
56
- var ifmobile = ismobilejs_1.default();
56
+ var ifmobile = (0, ismobilejs_1.default)();
57
57
  this._isPhone = ifmobile.phone;
58
- this.html.classList.toggle(this.prefix + "phone", this._isPhone);
58
+ this.html.classList.toggle("".concat(this.prefix, "phone"), this._isPhone);
59
59
  this._isTablet = ifmobile.tablet;
60
- this.html.classList.toggle(this.prefix + "tablet", this._isTablet);
60
+ this.html.classList.toggle("".concat(this.prefix, "tablet"), this._isTablet);
61
61
  this._isMobile = ifmobile.phone || ifmobile.tablet;
62
- this.html.classList.toggle(this.prefix + "mobile", this._isMobile);
62
+ this.html.classList.toggle("".concat(this.prefix, "mobile"), this._isMobile);
63
63
  this._isDesktop = !this._isMobile;
64
- this.html.classList.toggle(this.prefix + "desktop", this._isDesktop);
64
+ this.html.classList.toggle("".concat(this.prefix, "desktop"), this._isDesktop);
65
65
  // get browser info
66
- var browserData = detect_browser_1.detect();
66
+ var browserData = (0, detect_browser_1.detect)();
67
67
  // get OS name
68
68
  if (browserData === null || browserData === void 0 ? void 0 : browserData.os) {
69
69
  var osName = browserData.os.split(' ')[0].toLowerCase();
70
- this.html.classList.add(this.prefix + "os-" + osName);
70
+ this.html.classList.add("".concat(this.prefix, "os-").concat(osName));
71
71
  this._osName = osName;
72
72
  }
73
73
  else {
@@ -76,7 +76,7 @@ var Application = /** @class */ (function () {
76
76
  // get browser name
77
77
  if (browserData === null || browserData === void 0 ? void 0 : browserData.name) {
78
78
  var browserName = browserData.name.toLowerCase();
79
- this.html.classList.add(this.prefix + "browser-" + browserName);
79
+ this.html.classList.add("".concat(this.prefix, "browser-").concat(browserName));
80
80
  this._browserName = browserName;
81
81
  }
82
82
  else {
@@ -53,9 +53,9 @@ var PageLoad = /** @class */ (function (_super) {
53
53
  var app = this._app;
54
54
  var prefix = app.prefix;
55
55
  this._loaded = true;
56
- app.html.classList.remove(prefix + "loading");
57
- app.body.classList.remove(prefix + "loading");
58
- app.html.classList.add(prefix + "loaded");
56
+ app.html.classList.remove("".concat(prefix, "loading"));
57
+ app.body.classList.remove("".concat(prefix, "loading"));
58
+ app.html.classList.add("".concat(prefix, "loaded"));
59
59
  this.tbt('', false);
60
60
  };
61
61
  /**
@@ -172,7 +172,7 @@ var Viewport = /** @class */ (function (_super) {
172
172
  Viewport.prototype._setEvents = function () {
173
173
  var _this = this;
174
174
  window.addEventListener('resize', function () {
175
- common_1.timeoutCallback(function () {
175
+ (0, common_1.timeoutCallback)(function () {
176
176
  _this._onResize();
177
177
  }, _this._app.prop.viewportResizeTimeout);
178
178
  });
@@ -242,10 +242,10 @@ var Viewport = /** @class */ (function (_super) {
242
242
  var prefix = this._app.prefix;
243
243
  types.forEach(function (type) {
244
244
  if (type === activeType) {
245
- html.classList.add(prefix + "viewport-" + type);
245
+ html.classList.add("".concat(prefix, "viewport-").concat(type));
246
246
  }
247
247
  else {
248
- html.classList.remove(prefix + "viewport-" + type);
248
+ html.classList.remove("".concat(prefix, "viewport-").concat(type));
249
249
  }
250
250
  });
251
251
  };
@@ -254,8 +254,8 @@ var Viewport = /** @class */ (function (_super) {
254
254
  */
255
255
  Viewport.prototype._updateCSSVars = function () {
256
256
  var html = this._app.html;
257
- html.style.setProperty('--vw', this.vw + "px");
258
- html.style.setProperty('--vh', this.vh + "px");
257
+ html.style.setProperty('--vw', "".concat(this.vw, "px"));
258
+ html.style.setProperty('--vh', "".concat(this.vh, "px"));
259
259
  };
260
260
  /**
261
261
  * Launch callbacks on resize.
@@ -72,7 +72,7 @@ var Callbacks = /** @class */ (function () {
72
72
  */
73
73
  Callbacks.prototype.add = function (target, func, data) {
74
74
  if (data === void 0) { data = {}; }
75
- var id = common_1.randID('callback');
75
+ var id = (0, common_1.randID)('callback');
76
76
  var obj = {
77
77
  id: id,
78
78
  on: true,
@@ -182,10 +182,10 @@ var Callbacks = /** @class */ (function () {
182
182
  // launch
183
183
  if (timeout) {
184
184
  if (arg) {
185
- common_1.timeoutCallback(this._triggerFunc.bind(this, func, arg), timeout);
185
+ (0, common_1.timeoutCallback)(this._triggerFunc.bind(this, func, arg), timeout);
186
186
  }
187
187
  else {
188
- common_1.timeoutCallback(this._triggerFunc.bind(this, func, false), timeout);
188
+ (0, common_1.timeoutCallback)(this._triggerFunc.bind(this, func, false), timeout);
189
189
  }
190
190
  }
191
191
  else if (arg) {
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -41,7 +52,7 @@ var Module = /** @class */ (function () {
41
52
  this._app = window.vevetApp;
42
53
  }
43
54
  else {
44
- errors_1.throwVevetAppError();
55
+ (0, errors_1.throwVevetAppError)();
45
56
  }
46
57
  // set default vars
47
58
  this._destroyed = false;
@@ -49,7 +60,7 @@ var Module = /** @class */ (function () {
49
60
  // create callbacks
50
61
  this._callbacks = new Callbacks_1.Callbacks();
51
62
  // create mutable properties
52
- var prop = mergeWithoutArrays_1.default(this._getDefaultProp(), initialProp || {});
63
+ var prop = (0, mergeWithoutArrays_1.default)(this._getDefaultProp(), initialProp || {});
53
64
  this._mutableProp = new MutableProp_1.MutableProp(prop, this._onPropResponsive.bind(this), this._onPropChange.bind(this), this.name);
54
65
  if (init) {
55
66
  this.init();
@@ -204,10 +215,8 @@ var Module = /** @class */ (function () {
204
215
  * {@see Viewport}
205
216
  */
206
217
  Module.prototype.addViewportCallback = function (target, func, data) {
207
- if (data === void 0) { data = {
208
- name: this.constructor.name,
209
- }; }
210
- var callback = this._app.viewport.add(target, func, data);
218
+ if (data === void 0) { data = {}; }
219
+ var callback = this._app.viewport.add(target, func, __assign(__assign({}, data), { name: this.constructor.name }));
211
220
  this._viewportCallbacks.push(callback);
212
221
  return callback;
213
222
  };
@@ -224,7 +233,7 @@ var Module = /** @class */ (function () {
224
233
  * Add a DOM event listeners
225
234
  */
226
235
  Module.prototype.addEventListeners = function (el, target, callback, options) {
227
- var listener = vevet_dom_1.addEventListener(el, target, callback, options);
236
+ var listener = (0, vevet_dom_1.addEventListener)(el, target, callback, options);
228
237
  this._listeners.push(listener);
229
238
  return listener;
230
239
  };
@@ -63,8 +63,8 @@ var MutableProp = /** @class */ (function () {
63
63
  */
64
64
  this._responsiveRules = [];
65
65
  this._app = window.vevetApp;
66
- this._refProp = common_1.mergeWithoutArrays({}, _initProp);
67
- this._prop = common_1.mergeWithoutArrays({}, _initProp);
66
+ this._refProp = (0, common_1.mergeWithoutArrays)({}, _initProp);
67
+ this._prop = (0, common_1.mergeWithoutArrays)({}, _initProp);
68
68
  }
69
69
  Object.defineProperty(MutableProp.prototype, "prop", {
70
70
  /**
@@ -102,7 +102,7 @@ var MutableProp = /** @class */ (function () {
102
102
  var viewport = app.viewport;
103
103
  var width = viewport.width;
104
104
  var newProp = false;
105
- var statProp = common_1.mergeWithoutArrays({}, this._refProp);
105
+ var statProp = (0, common_1.mergeWithoutArrays)({}, this._refProp);
106
106
  // go through all breakpoints
107
107
  // and check if a proper breakpoint exists
108
108
  responsiveProp.forEach(function (prop) {
@@ -111,7 +111,7 @@ var MutableProp = /** @class */ (function () {
111
111
  // if the breakpoint is a number
112
112
  if (typeof breakpoint === 'number') {
113
113
  if (width <= prop.breakpoint) {
114
- newProp = common_1.mergeWithoutArrays(statProp, settings);
114
+ newProp = (0, common_1.mergeWithoutArrays)(statProp, settings);
115
115
  }
116
116
  }
117
117
  else if (typeof breakpoint === 'string') {
@@ -120,23 +120,23 @@ var MutableProp = /** @class */ (function () {
120
120
  if ((string === 'd' && viewport.isDesktop)
121
121
  || (string === 't' && viewport.isTablet)
122
122
  || (string === 'p' && viewport.isPhone)) {
123
- newProp = common_1.mergeWithoutArrays(statProp, settings);
123
+ newProp = (0, common_1.mergeWithoutArrays)(statProp, settings);
124
124
  }
125
125
  // device type
126
126
  if ((string === 'phone' && app.isPhone)
127
127
  || (string === 'tablet' && app.isTablet)
128
128
  || (string === 'mobile' && app.isMobile)) {
129
- newProp = common_1.mergeWithoutArrays(statProp, settings);
129
+ newProp = (0, common_1.mergeWithoutArrays)(statProp, settings);
130
130
  }
131
131
  }
132
132
  });
133
133
  // if there's no breakpoint, restore the props
134
134
  if (!newProp) {
135
- this._prop = common_1.mergeWithoutArrays(this._prop, this._refProp);
135
+ this._prop = (0, common_1.mergeWithoutArrays)(this._prop, this._refProp);
136
136
  }
137
137
  else {
138
138
  // otherwise, change the properties
139
- this._prop = common_1.mergeWithoutArrays(this._prop, newProp);
139
+ this._prop = (0, common_1.mergeWithoutArrays)(this._prop, newProp);
140
140
  }
141
141
  // responsive callback
142
142
  if (onResize) {
@@ -147,8 +147,8 @@ var MutableProp = /** @class */ (function () {
147
147
  * This method allows you to change the properties manually.
148
148
  */
149
149
  MutableProp.prototype.changeProp = function (prop) {
150
- this._prop = common_1.mergeWithoutArrays(this._prop, prop);
151
- this._refProp = common_1.mergeWithoutArrays(this._refProp, prop);
150
+ this._prop = (0, common_1.mergeWithoutArrays)(this._prop, prop);
151
+ this._refProp = (0, common_1.mergeWithoutArrays)(this._refProp, prop);
152
152
  // change prop callback
153
153
  this._onChange(prop);
154
154
  };
@@ -162,7 +162,7 @@ var AnimationFrame = /** @class */ (function (_super) {
162
162
  this._frameIndex = newFrameIndex;
163
163
  // calculate real fps
164
164
  var timeDiff = currentTime - this._prevFrameTime;
165
- var realFPS = math_1.boundVal(timeDiff === 0 ? 1000 / 60 : Math.floor(1000 / timeDiff), [1, Infinity]);
165
+ var realFPS = (0, math_1.clamp)(timeDiff === 0 ? 1000 / 60 : Math.floor(1000 / timeDiff), [1, Infinity]);
166
166
  // launch callbacks
167
167
  this.callbacks.tbt('frame', {
168
168
  fps: this.prop.fps,
@@ -46,12 +46,14 @@ var Ctx2D = /** @class */ (function (_super) {
46
46
  // create canvas
47
47
  var _a = _this.prop, append = _a.append, container = _a.container;
48
48
  var parent = (append && container) ? container : undefined;
49
- _this._canvas = vevet_dom_1.createElement('canvas', {
49
+ _this._canvas = (0, vevet_dom_1.createElement)('canvas', {
50
50
  parent: parent,
51
51
  });
52
52
  _this._ctx = _this._canvas.getContext('2d');
53
53
  // and resize it for the first time
54
- _this.resize();
54
+ if (_this.prop.initialResize) {
55
+ _this.resize();
56
+ }
55
57
  // initialize the class
56
58
  if (init) {
57
59
  _this.init();
@@ -124,7 +126,7 @@ var Ctx2D = /** @class */ (function (_super) {
124
126
  configurable: true
125
127
  });
126
128
  Ctx2D.prototype._getDefaultProp = function () {
127
- return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: false, append: true, updateOnResize: false, width: false, height: false, dpr: false });
129
+ return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: false, append: true, updateOnResize: false, initialResize: true, resizeTimeout: 0, width: false, height: false, dpr: false });
128
130
  };
129
131
  // Set Module Events
130
132
  Ctx2D.prototype._setEvents = function () {
@@ -134,6 +136,8 @@ var Ctx2D = /** @class */ (function (_super) {
134
136
  var viewportTarget = typeof this.prop.updateOnResize === 'boolean' ? '' : this.prop.updateOnResize;
135
137
  this.addViewportCallback(viewportTarget, function () {
136
138
  _this.resize();
139
+ }, {
140
+ timeout: this.prop.resizeTimeout,
137
141
  });
138
142
  this.resize();
139
143
  }
@@ -48,14 +48,32 @@ var Ctx2DPrerender = /** @class */ (function (_super) {
48
48
  this._prerender();
49
49
  };
50
50
  Ctx2DPrerender.prototype._prerender = function () {
51
+ // check if can render
52
+ if (this.width === 0 || this.height === 0) {
53
+ return;
54
+ }
51
55
  // check if media exists
52
56
  var media = this.prop.media;
53
57
  if (!media) {
54
58
  return;
55
59
  }
60
+ // get source info
61
+ var source;
62
+ var sourceWidth;
63
+ var sourceHeight;
64
+ if (media instanceof Ctx2D_1.Ctx2D) {
65
+ source = media.canvas;
66
+ sourceWidth = media.width;
67
+ sourceHeight = media.height;
68
+ }
69
+ else {
70
+ source = media;
71
+ }
56
72
  // get media sizes
57
- var size = get_image_pos_1.getPos({
58
- source: media,
73
+ var size = (0, get_image_pos_1.getPos)({
74
+ source: source,
75
+ sourceWidth: sourceWidth,
76
+ sourceHeight: sourceHeight,
59
77
  rule: this.prop.posRule,
60
78
  scale: 1,
61
79
  width: this.width,
@@ -63,7 +81,7 @@ var Ctx2DPrerender = /** @class */ (function (_super) {
63
81
  });
64
82
  this._ctx.clearRect(0, 0, this.width, this.height);
65
83
  // render the media
66
- this._ctx.drawImage(media, 0, 0, size.sourceWidth, size.sourceHeight, size.x, size.y, size.width, size.height);
84
+ this._ctx.drawImage(source, size.x, size.y, size.width, size.height);
67
85
  // launch callbacks on prerender
68
86
  this.callbacks.tbt('prerender', false);
69
87
  };
@@ -43,12 +43,12 @@ var CustomCursor = /** @class */ (function (_super) {
43
43
  if (init === void 0) { init = true; }
44
44
  var _this = _super.call(this, initialProp, false) || this;
45
45
  // get cursor container
46
- var container = vevet_dom_1.selectOne(_this.prop.container);
46
+ var container = (0, vevet_dom_1.selectOne)(_this.prop.container);
47
47
  if (container) {
48
48
  _this._container = container;
49
49
  }
50
50
  else {
51
- throw new Error("No cursor container for " + _this.prop.container);
51
+ throw new Error("No cursor container for ".concat(_this.prop.container));
52
52
  }
53
53
  _this._containerIsWindow = container instanceof Window;
54
54
  // set default vars
@@ -73,7 +73,7 @@ var CustomCursor = /** @class */ (function (_super) {
73
73
  };
74
74
  Object.defineProperty(CustomCursor.prototype, "prefix", {
75
75
  get: function () {
76
- return this._app.prefix + "custom-cursor";
76
+ return "".concat(this._app.prefix, "custom-cursor");
77
77
  },
78
78
  enumerable: false,
79
79
  configurable: true
@@ -191,14 +191,14 @@ var CustomCursor = /** @class */ (function (_super) {
191
191
  domContainer.classList.add('hide-defaut-cursor');
192
192
  }
193
193
  // set classes
194
- domContainer.classList.add(prefix + "-container");
194
+ domContainer.classList.add("".concat(prefix, "-container"));
195
195
  // create cursor elements
196
- this._outerCursor = vevet_dom_1.createElement('div', {
197
- class: prefix + " " + (container instanceof Window ? 'in-window' : 'in-element') + " disabled",
196
+ this._outerCursor = (0, vevet_dom_1.createElement)('div', {
197
+ class: "".concat(prefix, " ").concat(container instanceof Window ? 'in-window' : 'in-element', " disabled"),
198
198
  parent: domContainer,
199
199
  });
200
- this._innerCursor = vevet_dom_1.createElement('div', {
201
- class: prefix + "__inner disabled",
200
+ this._innerCursor = (0, vevet_dom_1.createElement)('div', {
201
+ class: "".concat(prefix, "__inner disabled"),
202
202
  parent: this._outerCursor,
203
203
  });
204
204
  // launch events
@@ -214,7 +214,7 @@ var CustomCursor = /** @class */ (function (_super) {
214
214
  var _a = this, prefix = _a.prefix, domContainer = _a.domContainer;
215
215
  domContainer.style.cursor = '';
216
216
  domContainer.classList.remove('hide-defaut-cursor');
217
- domContainer.classList.remove(prefix + "-container");
217
+ domContainer.classList.remove("".concat(prefix, "-container"));
218
218
  this._outerCursor.remove();
219
219
  this._innerCursor.remove();
220
220
  };
@@ -281,8 +281,8 @@ var CustomCursor = /** @class */ (function (_super) {
281
281
  var _a = prop.render, normalizeLerp = _a.normalizeLerp, ease = _a.lerp, lerpToFixed = _a.lerpToFixed;
282
282
  var fpsMultiplier = normalizeLerp ? 60 / this._currentFPS : 1;
283
283
  // interpolate coordinates
284
- this._x = lerp_1.default(this._x, this._xTarget, ease * fpsMultiplier, 0.02);
285
- this._y = lerp_1.default(this._y, this._yTarget, ease * fpsMultiplier, 0.02);
284
+ this._x = (0, lerp_1.default)(this._x, this._xTarget, ease * fpsMultiplier, 0.02);
285
+ this._y = (0, lerp_1.default)(this._y, this._yTarget, ease * fpsMultiplier, 0.02);
286
286
  // round the values
287
287
  if (typeof lerpToFixed === 'number') {
288
288
  var fixed = Math.round(Math.abs(lerpToFixed));
@@ -298,7 +298,7 @@ var CustomCursor = /** @class */ (function (_super) {
298
298
  y -= bounding.top;
299
299
  }
300
300
  // update dom coordinates
301
- this.outerCursor.style.transform = "translate(" + x + "px, " + y + "px)";
301
+ this.outerCursor.style.transform = "translate(".concat(x, "px, ").concat(y, "px)");
302
302
  // auto stop
303
303
  if (prop.autoStop
304
304
  && this._x === this._xTarget && this._y === this._yTarget) {
@@ -38,8 +38,8 @@ var Dragger = /** @class */ (function (_super) {
38
38
  if (init === void 0) { init = true; }
39
39
  var _this = _super.call(this, initialProp, false) || this;
40
40
  // get container
41
- _this._container = vevet_dom_1.selectOne(_this.prop.container);
42
- if (!vevet_dom_1.isElement(_this._container) && !vevet_dom_1.isWindow(_this._container)) {
41
+ _this._container = (0, vevet_dom_1.selectOne)(_this.prop.container);
42
+ if (!(0, vevet_dom_1.isElement)(_this._container) && !(0, vevet_dom_1.isWindow)(_this._container)) {
43
43
  throw new Error('No container');
44
44
  }
45
45
  // set default vars
@@ -56,11 +56,11 @@ var Dragger = /** @class */ (function (_super) {
56
56
  return _this;
57
57
  }
58
58
  Dragger.prototype._getDefaultProp = function () {
59
- return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: "#" + this.prefix, usePassive: false, enabled: true });
59
+ return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: "#".concat(this.prefix), usePassive: false, enabled: true });
60
60
  };
61
61
  Object.defineProperty(Dragger.prototype, "prefix", {
62
62
  get: function () {
63
- return this._app.prefix + "dragger";
63
+ return "".concat(this._app.prefix, "dragger");
64
64
  },
65
65
  enumerable: false,
66
66
  configurable: true
@@ -120,17 +120,17 @@ var Dragger = /** @class */ (function (_super) {
120
120
  Dragger.prototype._addRuntimeEvents = function () {
121
121
  var usePassive = this.prop.usePassive;
122
122
  // end
123
- this._runtimeEvents.push(vevet_dom_1.addEventListener(window, 'mouseup', this._handleEnd.bind(this), {
123
+ this._runtimeEvents.push((0, vevet_dom_1.addEventListener)(window, 'mouseup', this._handleEnd.bind(this), {
124
124
  passive: usePassive,
125
125
  }));
126
- this._runtimeEvents.push(vevet_dom_1.addEventListener(window, 'touchend', this._handleEnd.bind(this), {
126
+ this._runtimeEvents.push((0, vevet_dom_1.addEventListener)(window, 'touchend', this._handleEnd.bind(this), {
127
127
  passive: usePassive,
128
128
  }));
129
129
  // cancel
130
- this._runtimeEvents.push(vevet_dom_1.addEventListener(window, 'touchcancel', this.cancel.bind(this), {
130
+ this._runtimeEvents.push((0, vevet_dom_1.addEventListener)(window, 'touchcancel', this.cancel.bind(this), {
131
131
  passive: usePassive,
132
132
  }));
133
- this._runtimeEvents.push(vevet_dom_1.addEventListener(window, 'blur', this.cancel.bind(this), {
133
+ this._runtimeEvents.push((0, vevet_dom_1.addEventListener)(window, 'blur', this.cancel.bind(this), {
134
134
  passive: usePassive,
135
135
  }));
136
136
  };
@@ -46,10 +46,10 @@ var DraggerMove = /** @class */ (function (_super) {
46
46
  _super.prototype._addRuntimeEvents.call(this);
47
47
  var usePassive = this.prop.usePassive;
48
48
  // move
49
- this._runtimeEvents.push(vevet_dom_1.addEventListener(window, 'mousemove', this._handleMove.bind(this), {
49
+ this._runtimeEvents.push((0, vevet_dom_1.addEventListener)(window, 'mousemove', this._handleMove.bind(this), {
50
50
  passive: usePassive,
51
51
  }));
52
- this._runtimeEvents.push(vevet_dom_1.addEventListener(window, 'touchmove', this._handleMove.bind(this), {
52
+ this._runtimeEvents.push((0, vevet_dom_1.addEventListener)(window, 'touchmove', this._handleMove.bind(this), {
53
53
  passive: usePassive,
54
54
  }));
55
55
  };
@@ -44,7 +44,7 @@ var Preloader = /** @class */ (function (_super) {
44
44
  var _this = _super.call(this, initialProp, false) || this;
45
45
  // get preloader container
46
46
  if (_this.prop.container) {
47
- var container = vevet_dom_1.selectOne(_this.prop.container);
47
+ var container = (0, vevet_dom_1.selectOne)(_this.prop.container);
48
48
  if (container instanceof HTMLElement) {
49
49
  _this._container = container;
50
50
  }
@@ -65,11 +65,11 @@ var Preloader = /** @class */ (function (_super) {
65
65
  return _this;
66
66
  }
67
67
  Preloader.prototype._getDefaultProp = function () {
68
- return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: "#" + this.prefix, hide: 250 });
68
+ return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: "#".concat(this.prefix), hide: 250 });
69
69
  };
70
70
  Object.defineProperty(Preloader.prototype, "prefix", {
71
71
  get: function () {
72
- return this._app.prefix + "preloader";
72
+ return "".concat(this._app.prefix, "preloader");
73
73
  },
74
74
  enumerable: false,
75
75
  configurable: true
@@ -175,10 +175,10 @@ var Preloader = /** @class */ (function (_super) {
175
175
  return;
176
176
  }
177
177
  // if need to hide the container
178
- container.style.transition = "opacity " + duration + "ms, visibility " + duration + "ms";
178
+ container.style.transition = "opacity ".concat(duration, "ms, visibility ").concat(duration, "ms");
179
179
  container.style.opacity = '0';
180
180
  container.style.visibility = 'hidden';
181
- timeoutCallback_1.default(function () {
181
+ (0, timeoutCallback_1.default)(function () {
182
182
  container.style.display = 'none';
183
183
  _this._handleHidden();
184
184
  resolve();
@@ -62,6 +62,7 @@ var ProgressPreloader = /** @class */ (function (_super) {
62
62
  img: true,
63
63
  video: true,
64
64
  custom: '.js-preload',
65
+ ignoreClassName: 'js-preload-ignore',
65
66
  }, calc: {
66
67
  lerp: 0.1,
67
68
  forceEnd: 500,
@@ -154,7 +155,7 @@ var ProgressPreloader = /** @class */ (function (_super) {
154
155
  if (typeof lerpVal === 'number') {
155
156
  this._animationFrame = new AnimationFrame_1.AnimationFrame();
156
157
  this._animationFrame.addCallback('frame', function () {
157
- _this.progress = lerp_1.default(_this.progress, _this.loadProgress, lerpVal);
158
+ _this.progress = (0, lerp_1.default)(_this.progress, _this.loadProgress, lerpVal);
158
159
  });
159
160
  this._animationFrame.play();
160
161
  }
@@ -190,23 +191,34 @@ var ProgressPreloader = /** @class */ (function (_super) {
190
191
  var loaders = this.prop.loaders;
191
192
  // get images
192
193
  if (loaders.img) {
193
- var imgs = vevet_dom_1.selectAll('img');
194
+ var imgs = (0, vevet_dom_1.selectAll)('img');
194
195
  imgs.forEach(function (img) {
196
+ if (img.classList.contains(loaders.ignoreClassName)) {
197
+ return;
198
+ }
195
199
  _this._imgs.push(img);
196
200
  _this._resourcesTotal += 1;
197
201
  });
198
202
  }
199
203
  // get videos
200
204
  if (loaders.video) {
201
- var videos = vevet_dom_1.selectAll('video');
205
+ var videos = (0, vevet_dom_1.selectAll)('video');
202
206
  videos.forEach(function (video) {
207
+ if (video.classList.contains(loaders.ignoreClassName)) {
208
+ return;
209
+ }
203
210
  _this._videos.push(video);
204
211
  _this._resourcesTotal += 1;
205
212
  });
206
213
  }
207
214
  // get custom resources
208
215
  if (loaders.custom) {
209
- this._customResources = Array.from(vevet_dom_1.selectAll(loaders.custom));
216
+ this._customResources = Array.from((0, vevet_dom_1.selectAll)(loaders.custom)).filter(function (el) {
217
+ if (el.classList.contains(loaders.ignoreClassName)) {
218
+ return false;
219
+ }
220
+ return true;
221
+ });
210
222
  this._resourcesTotal += this._customResources.length;
211
223
  }
212
224
  };
@@ -233,7 +245,7 @@ var ProgressPreloader = /** @class */ (function (_super) {
233
245
  img.addEventListener('error', function () {
234
246
  _this._handleLoadedResource();
235
247
  });
236
- image.src = img.src;
248
+ image.src = img.currentSrc || img.src;
237
249
  }
238
250
  });
239
251
  // preload videos