vevet 2.0.1-dev.2 → 2.0.1-dev.7

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 (64) hide show
  1. package/build/cdn/index.js +1 -1
  2. package/build/cjs/components/scroll/plugins/SmoothScrollDragPlugin.js +40 -5
  3. package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +9 -0
  4. package/build/cjs/components/scroll/scrollable/ScrollView.js +2 -0
  5. package/build/cjs/components/scroll/scrollbar/Bar.js +3 -0
  6. package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +6 -0
  7. package/build/cjs/components/timeline/Timeline.js +1 -0
  8. package/build/cjs/handlers/wheel/WheelHandler.js +195 -0
  9. package/build/cjs/index.js +3 -1
  10. package/build/cjs/utils/listeners/onScroll.js +4 -2
  11. package/build/es/app/Application.js +50 -93
  12. package/build/es/app/events/PageLoad.js +3 -7
  13. package/build/es/app/events/Viewport.js +10 -34
  14. package/build/es/base/Callbacks.js +8 -19
  15. package/build/es/base/Component.js +0 -1
  16. package/build/es/base/Module.js +41 -61
  17. package/build/es/base/MutableProp.js +10 -32
  18. package/build/es/base/Plugin.js +0 -1
  19. package/build/es/components/animation-frame/AnimationFrame.js +4 -28
  20. package/build/es/components/canvas/Ctx2D.js +21 -49
  21. package/build/es/components/canvas/Ctx2DPrerender.js +1 -5
  22. package/build/es/components/cursor/CustomCursor.js +25 -58
  23. package/build/es/components/dragger/Dragger.js +20 -41
  24. package/build/es/components/dragger/DraggerDirection.js +1 -4
  25. package/build/es/components/loading/Preloader.js +26 -41
  26. package/build/es/components/loading/ProgressPreloader.js +17 -36
  27. package/build/es/components/page/Page.js +14 -33
  28. package/build/es/components/scroll/plugins/SmoothScrollDragPlugin.js +47 -29
  29. package/build/es/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +9 -0
  30. package/build/es/components/scroll/scrollable/ScrollEventsBase.js +15 -22
  31. package/build/es/components/scroll/scrollable/ScrollView.js +10 -29
  32. package/build/es/components/scroll/scrollbar/Bar.js +38 -52
  33. package/build/es/components/scroll/scrollbar/ScrollBar.js +47 -73
  34. package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +61 -135
  35. package/build/es/components/text/SplitText.js +21 -42
  36. package/build/es/components/timeline/StaticTimeline.js +11 -22
  37. package/build/es/components/timeline/Timeline.js +13 -28
  38. package/build/es/handlers/wheel/WheelHandler.js +153 -0
  39. package/build/es/index.js +2 -1
  40. package/build/es/utils/listeners/onScroll.js +4 -2
  41. package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts +11 -0
  42. package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts.map +1 -1
  43. package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts.map +1 -1
  44. package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -1
  45. package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -1
  46. package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -1
  47. package/build/types/components/timeline/Timeline.d.ts.map +1 -1
  48. package/build/types/handlers/wheel/WheelHandler.d.ts +100 -0
  49. package/build/types/handlers/wheel/WheelHandler.d.ts.map +1 -0
  50. package/build/types/index.d.ts +2 -1
  51. package/build/types/index.d.ts.map +1 -1
  52. package/build/types/utils/listeners/onScroll.d.ts +5 -1
  53. package/build/types/utils/listeners/onScroll.d.ts.map +1 -1
  54. package/package.json +3 -2
  55. package/src/sass/components/cursor/_custom-cursor.scss +0 -1
  56. package/src/ts/components/scroll/plugins/SmoothScrollDragPlugin.ts +58 -5
  57. package/src/ts/components/scroll/plugins/SmoothScrollKeyboardPlugin.ts +12 -0
  58. package/src/ts/components/scroll/scrollable/ScrollView.ts +4 -1
  59. package/src/ts/components/scroll/scrollbar/Bar.ts +3 -0
  60. package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +7 -0
  61. package/src/ts/components/timeline/Timeline.ts +1 -0
  62. package/src/ts/handlers/wheel/WheelHandler.ts +269 -0
  63. package/src/ts/index.ts +4 -0
  64. package/src/ts/utils/listeners/onScroll.ts +8 -0
@@ -4,13 +4,27 @@ import { Component } from '../../base/Component';
4
4
  * Drag & Swipe events. An abstract class
5
5
  */
6
6
  export class Dragger extends Component {
7
+ constructor(initialProp, init = true) {
8
+ super(initialProp, false);
9
+ // get container
10
+ this._container = selectOne(this.prop.container);
11
+ if (!isElement(this._container) && !isWindow(this._container)) {
12
+ throw new Error('No container');
13
+ }
14
+ // set default vars
15
+ this._runtimeEvents = [];
16
+ this._isDragging = false;
17
+ this._pointerID = null;
18
+ this._coords = { x: 0, y: 0 };
19
+ this._prevCoords = { x: 0, y: 0 };
20
+ this._startCoords = { x: 0, y: 0 };
21
+ // initialize the class
22
+ if (init) {
23
+ this.init();
24
+ }
25
+ }
7
26
  _getDefaultProp() {
8
- return {
9
- ...super._getDefaultProp(),
10
- container: `#${this.prefix}`,
11
- usePassive: false,
12
- enabled: true,
13
- };
27
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { container: `#${this.prefix}`, usePassive: false, enabled: true });
14
28
  }
15
29
  get prefix() {
16
30
  return `${this._app.prefix}dragger`;
@@ -21,59 +35,24 @@ export class Dragger extends Component {
21
35
  get container() {
22
36
  return this._container;
23
37
  }
24
- _container;
25
- /**
26
- * Runtime events
27
- */
28
- _runtimeEvents;
29
38
  /**
30
39
  * If is dragging at the moment
31
40
  */
32
41
  get isDragging() {
33
42
  return this._isDragging;
34
43
  }
35
- _isDragging;
36
- /**
37
- * Current pointer id
38
- */
39
- _pointerID;
40
44
  /**
41
45
  * Current coordinates relative to the Window
42
46
  */
43
47
  get coords() {
44
48
  return this._coords;
45
49
  }
46
- _coords;
47
- /**
48
- * Last coordinates relative to the window
49
- */
50
- _prevCoords;
51
50
  /**
52
51
  * Coordinates on drag start
53
52
  */
54
53
  get startCoords() {
55
54
  return this._startCoords;
56
55
  }
57
- _startCoords;
58
- constructor(initialProp, init = true) {
59
- super(initialProp, false);
60
- // get container
61
- this._container = selectOne(this.prop.container);
62
- if (!isElement(this._container) && !isWindow(this._container)) {
63
- throw new Error('No container');
64
- }
65
- // set default vars
66
- this._runtimeEvents = [];
67
- this._isDragging = false;
68
- this._pointerID = null;
69
- this._coords = { x: 0, y: 0 };
70
- this._prevCoords = { x: 0, y: 0 };
71
- this._startCoords = { x: 0, y: 0 };
72
- // initialize the class
73
- if (init) {
74
- this.init();
75
- }
76
- }
77
56
  /**
78
57
  * Set component events
79
58
  */
@@ -4,10 +4,7 @@ import { Dragger } from './Dragger';
4
4
  */
5
5
  export class DraggerDirection extends Dragger {
6
6
  _getDefaultProp() {
7
- return {
8
- ...super._getDefaultProp(),
9
- min: 75,
10
- };
7
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { min: 75 });
11
8
  }
12
9
  /**
13
10
  * Event on drag end
@@ -6,12 +6,31 @@ import timeoutCallback from '../../utils/common/timeoutCallback';
6
6
  * A page preloader
7
7
  */
8
8
  export class Preloader extends Component {
9
+ constructor(initialProp, init = true) {
10
+ super(initialProp, false);
11
+ // get preloader container
12
+ if (this.prop.container) {
13
+ const container = selectOne(this.prop.container);
14
+ if (container instanceof HTMLElement) {
15
+ this._container = container;
16
+ }
17
+ }
18
+ // add classes
19
+ if (this._container) {
20
+ this._container.classList.add(this.prefix);
21
+ }
22
+ // set default vars
23
+ this._startTime = +new Date();
24
+ this._endTime = Infinity;
25
+ this._toBeHidden = false;
26
+ this._isHidden = false;
27
+ // initialize the class
28
+ if (init) {
29
+ this.init();
30
+ }
31
+ }
9
32
  _getDefaultProp() {
10
- return {
11
- ...super._getDefaultProp(),
12
- container: `#${this.prefix}`,
13
- hide: 250,
14
- };
33
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { container: `#${this.prefix}`, hide: 250 });
15
34
  }
16
35
  get prefix() {
17
36
  return `${this._app.prefix}preloader`;
@@ -22,65 +41,30 @@ export class Preloader extends Component {
22
41
  get container() {
23
42
  return this._container;
24
43
  }
25
- _container;
26
44
  /**
27
45
  * Preloader start time
28
46
  */
29
47
  get startTime() {
30
48
  return this._startTime;
31
49
  }
32
- _startTime;
33
50
  /**
34
51
  * Preloader end time
35
52
  */
36
53
  get endTime() {
37
54
  return this._endTime;
38
55
  }
39
- _endTime;
40
56
  /**
41
57
  * Total time of page loading before the preloader is to be hidden
42
58
  */
43
59
  get totalTime() {
44
60
  return this._endTime - this._startTime;
45
61
  }
46
- /**
47
- * If the preloader is to be hidden
48
- */
49
- _toBeHidden;
50
62
  /**
51
63
  * If the preloader is hidden
52
64
  */
53
65
  get isHidden() {
54
66
  return this._isHidden;
55
67
  }
56
- _isHidden;
57
- /**
58
- * Loading event
59
- */
60
- _pageLoadEvent;
61
- constructor(initialProp, init = true) {
62
- super(initialProp, false);
63
- // get preloader container
64
- if (this.prop.container) {
65
- const container = selectOne(this.prop.container);
66
- if (container instanceof HTMLElement) {
67
- this._container = container;
68
- }
69
- }
70
- // add classes
71
- if (this._container) {
72
- this._container.classList.add(this.prefix);
73
- }
74
- // set default vars
75
- this._startTime = +new Date();
76
- this._endTime = Infinity;
77
- this._toBeHidden = false;
78
- this._isHidden = false;
79
- // initialize the class
80
- if (init) {
81
- this.init();
82
- }
83
- }
84
68
  _setEvents() {
85
69
  super._setEvents();
86
70
  this._onLoaded().then(() => {
@@ -173,7 +157,8 @@ export class Preloader extends Component {
173
157
  * Destroy the module
174
158
  */
175
159
  _destroy() {
160
+ var _a;
176
161
  super._destroy();
177
- this._pageLoadEvent?.remove();
162
+ (_a = this._pageLoadEvent) === null || _a === void 0 ? void 0 : _a.remove();
178
163
  }
179
164
  }
@@ -8,20 +8,29 @@ import { Timeline } from '../timeline/Timeline';
8
8
  * A page preloader with smooth progress calculation
9
9
  */
10
10
  export class ProgressPreloader extends Preloader {
11
+ constructor(initialProp, init = true) {
12
+ super(initialProp, false);
13
+ // set default vars
14
+ this._imgs = [];
15
+ this._videos = [];
16
+ this._customResources = [];
17
+ this._resourcesTotal = 1 + this.prop.resources;
18
+ this._resourcesLoaded = 0;
19
+ this._progress = 0;
20
+ // initialize the class
21
+ if (init) {
22
+ this.init();
23
+ }
24
+ }
11
25
  _getDefaultProp() {
12
- return {
13
- ...super._getDefaultProp(),
14
- resources: 0,
15
- loaders: {
26
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { resources: 0, loaders: {
16
27
  img: true,
17
28
  video: true,
18
29
  custom: '.js-preload',
19
- },
20
- calc: {
30
+ }, calc: {
21
31
  lerp: 0.1,
22
32
  forceEnd: 500,
23
- },
24
- };
33
+ } });
25
34
  }
26
35
  /**
27
36
  * Image resources
@@ -29,35 +38,30 @@ export class ProgressPreloader extends Preloader {
29
38
  get imgs() {
30
39
  return this._imgs;
31
40
  }
32
- _imgs;
33
41
  /**
34
42
  * Video resources
35
43
  */
36
44
  get videos() {
37
45
  return this._videos;
38
46
  }
39
- _videos;
40
47
  /**
41
48
  * Custom resources
42
49
  */
43
50
  get customResources() {
44
51
  return this._customResources;
45
52
  }
46
- _customResources;
47
53
  /**
48
54
  * Quantity of resources to be preloader
49
55
  */
50
56
  get resourcesTotal() {
51
57
  return this._resourcesTotal;
52
58
  }
53
- _resourcesTotal;
54
59
  /**
55
60
  * Quantity of resources been already loaded
56
61
  */
57
62
  get resourcesLoaded() {
58
63
  return this._resourcesLoaded;
59
64
  }
60
- _resourcesLoaded;
61
65
  /**
62
66
  * Progress of resources loaded
63
67
  */
@@ -74,29 +78,6 @@ export class ProgressPreloader extends Preloader {
74
78
  this._progress = val;
75
79
  this._handleProgress();
76
80
  }
77
- _progress;
78
- /**
79
- * Animation progress. For smooth progress calculation
80
- */
81
- _animationFrame;
82
- /**
83
- * A timeline to finish progress animation
84
- */
85
- _endTimeline;
86
- constructor(initialProp, init = true) {
87
- super(initialProp, false);
88
- // set default vars
89
- this._imgs = [];
90
- this._videos = [];
91
- this._customResources = [];
92
- this._resourcesTotal = 1 + this.prop.resources;
93
- this._resourcesLoaded = 0;
94
- this._progress = 0;
95
- // initialize the class
96
- if (init) {
97
- this.init();
98
- }
99
- }
100
81
  _constructor() {
101
82
  super._constructor();
102
83
  this._getResources();
@@ -8,55 +8,36 @@ import { Component } from '../../base/Component';
8
8
  * and vice versa.
9
9
  */
10
10
  export class Page extends Component {
11
- /**
12
- * If the page is created
13
- */
14
- _created;
11
+ constructor(initialProp, init = true) {
12
+ super(initialProp, false);
13
+ // set default vars
14
+ this._created = false;
15
+ this._shown = false;
16
+ this._hidden = false;
17
+ this._destroyed = false;
18
+ this._viaAJAX = false;
19
+ // initialize the class
20
+ if (init) {
21
+ this.init();
22
+ }
23
+ }
15
24
  get created() {
16
25
  return this._created;
17
26
  }
18
- /**
19
- * If the page is shown
20
- */
21
- _shown;
22
27
  get shown() {
23
28
  return this._shown;
24
29
  }
25
- /**
26
- * If the page is hidden
27
- */
28
- _hidden;
29
30
  get hidden() {
30
31
  return this._hidden;
31
32
  }
32
- /**
33
- * If the page was loaded through AJAX
34
- */
35
- _viaAJAX;
36
33
  get viaAJAX() {
37
34
  return this._viaAJAX;
38
35
  }
39
36
  get pageClassName() {
40
37
  return `${this._app.prefix}page-${this.prop.name}`;
41
38
  }
42
- constructor(initialProp, init = true) {
43
- super(initialProp, false);
44
- // set default vars
45
- this._created = false;
46
- this._shown = false;
47
- this._hidden = false;
48
- this._destroyed = false;
49
- this._viaAJAX = false;
50
- // initialize the class
51
- if (init) {
52
- this.init();
53
- }
54
- }
55
39
  _getDefaultProp() {
56
- return {
57
- ...super._getDefaultProp(),
58
- name: 'home',
59
- };
40
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { name: 'home' });
60
41
  }
61
42
  /**
62
43
  * Create the page.
@@ -5,23 +5,15 @@ const draggingClassName = 'is-dragging';
5
5
  * A class for Plugins.
6
6
  */
7
7
  export class SmoothScrollDragPlugin extends Plugin {
8
+ constructor(initialProp) {
9
+ super(initialProp);
10
+ this._dragger = undefined;
11
+ this._componentEvents = [];
12
+ this._currentLerp = false;
13
+ }
8
14
  _getDefaultProp() {
9
- return {
10
- ...super._getDefaultProp(),
11
- enabled: true,
12
- speed: 1,
13
- lerp: false,
14
- reverseDir: false,
15
- };
15
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { enabled: true, speed: 1, lerp: false, reverseDir: false, stopPropagation: false });
16
16
  }
17
- /**
18
- * Dragger component
19
- */
20
- _dragger;
21
- /**
22
- * Component events
23
- */
24
- _componentEvents;
25
17
  /**
26
18
  * If is dragging at the moment
27
19
  */
@@ -31,15 +23,6 @@ export class SmoothScrollDragPlugin extends Plugin {
31
23
  }
32
24
  return false;
33
25
  }
34
- /**
35
- * Current lerp of SmoothScroll
36
- */
37
- _currentLerp;
38
- constructor(initialProp) {
39
- super(initialProp);
40
- this._componentEvents = [];
41
- this._currentLerp = false;
42
- }
43
26
  _constructor() {
44
27
  super._constructor();
45
28
  this._toggleDragger();
@@ -71,10 +54,13 @@ export class SmoothScrollDragPlugin extends Plugin {
71
54
  container: component.outer,
72
55
  });
73
56
  this._dragger.addCallback('start', this._handleDragStart.bind(this));
74
- this._dragger.addCallback('move', this._handleDragMove.bind(this));
57
+ this._dragger.addCallback('move', (data) => {
58
+ this._handleDragMove(data);
59
+ });
75
60
  this._dragger.addCallback('end', this._handleDragEnd.bind(this));
76
61
  this._componentEvents.push(component.addCallback('wheel', () => {
77
- this._dragger?.cancel();
62
+ var _a;
63
+ (_a = this._dragger) === null || _a === void 0 ? void 0 : _a.cancel();
78
64
  }));
79
65
  }
80
66
  /**
@@ -99,9 +85,10 @@ export class SmoothScrollDragPlugin extends Plugin {
99
85
  if (!component.prop.enabled) {
100
86
  return;
101
87
  }
102
- // set classes
103
- component.outer.classList.add(draggingClassName);
104
- component.container.classList.add(draggingClassName);
88
+ // check scrollable area
89
+ if (component.maxScrollableWidth <= 0 && component.maxScrollableHeight <= 0) {
90
+ return;
91
+ }
105
92
  // change lerp
106
93
  const { lerp } = this.prop;
107
94
  if (typeof lerp !== 'boolean') {
@@ -112,6 +99,8 @@ export class SmoothScrollDragPlugin extends Plugin {
112
99
  },
113
100
  });
114
101
  }
102
+ // launch events
103
+ this._callbacks.tbt('start', false);
115
104
  }
116
105
  /**
117
106
  * Callback on dragging move
@@ -121,6 +110,28 @@ export class SmoothScrollDragPlugin extends Plugin {
121
110
  if (!component.prop.enabled) {
122
111
  return;
123
112
  }
113
+ // check scrollable area
114
+ if (component.maxScrollableWidth <= 0 && component.maxScrollableHeight <= 0) {
115
+ return;
116
+ }
117
+ const { evt } = data;
118
+ // get difference between coordinates and decide
119
+ // if we need to stop propagation
120
+ const { stopPropagation } = this.prop;
121
+ if (stopPropagation) {
122
+ if (!evt.cancelable) {
123
+ return;
124
+ }
125
+ const diffX = Math.abs(data.coords.x - data.start.x);
126
+ const diffY = Math.abs(data.coords.y - data.start.y);
127
+ if (((diffX > stopPropagation.threshold) && stopPropagation.dir === 'x')
128
+ || ((diffY > stopPropagation.threshold) && stopPropagation.dir === 'y')) {
129
+ if (evt.cancelable) {
130
+ evt.preventDefault();
131
+ evt.stopPropagation();
132
+ }
133
+ }
134
+ }
124
135
  const { speed, reverseDir } = this.prop;
125
136
  // get coordinates
126
137
  const x = data.step.x * speed;
@@ -128,6 +139,11 @@ export class SmoothScrollDragPlugin extends Plugin {
128
139
  // update scroll values
129
140
  component.targetLeft -= !reverseDir ? x : y;
130
141
  component.targetTop -= !reverseDir ? y : x;
142
+ // set classes
143
+ component.outer.classList.add(draggingClassName);
144
+ component.container.classList.add(draggingClassName);
145
+ // launch events
146
+ this._callbacks.tbt('move', false);
131
147
  }
132
148
  /**
133
149
  * Callback on dragging end
@@ -146,6 +162,8 @@ export class SmoothScrollDragPlugin extends Plugin {
146
162
  });
147
163
  this._currentLerp = false;
148
164
  }
165
+ // launch events
166
+ this._callbacks.tbt('end', false);
149
167
  }
150
168
  /**
151
169
  * Destroy the plugin
@@ -33,6 +33,15 @@ export class SmoothScrollKeyboardPlugin extends Plugin {
33
33
  return;
34
34
  }
35
35
  }
36
+ // check if the scroll container is in viewport
37
+ const { viewport } = this._app;
38
+ const bounding = component.outer.getBoundingClientRect();
39
+ if (!(bounding.left < viewport.width
40
+ && bounding.right > 0
41
+ && bounding.top < viewport.height
42
+ && bounding.bottom > 0)) {
43
+ return;
44
+ }
36
45
  // update scroll values
37
46
  const scrollIterator = 40;
38
47
  switch (e.keyCode) {
@@ -4,16 +4,23 @@ import { Component } from '../../../base/Component';
4
4
  * A base for scroll event components
5
5
  */
6
6
  export class ScrollEventsBase extends Component {
7
+ constructor(initialProp, init = true) {
8
+ super(initialProp, false);
9
+ // get scroll container
10
+ if (typeof this.prop.container === 'string') {
11
+ this._scrollContainer = selectOne(this.prop.container);
12
+ }
13
+ else {
14
+ this._scrollContainer = this.prop.container;
15
+ }
16
+ // initialize the class
17
+ if (init) {
18
+ this.init();
19
+ }
20
+ }
7
21
  _getDefaultProp() {
8
- return {
9
- ...super._getDefaultProp(),
10
- container: window,
11
- };
22
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { container: window });
12
23
  }
13
- /**
14
- * Scroll container
15
- */
16
- _scrollContainer;
17
24
  get scrollContainer() {
18
25
  return this._scrollContainer;
19
26
  }
@@ -69,18 +76,4 @@ export class ScrollEventsBase extends Component {
69
76
  height: this._app.viewport.height,
70
77
  };
71
78
  }
72
- constructor(initialProp, init = true) {
73
- super(initialProp, false);
74
- // get scroll container
75
- if (typeof this.prop.container === 'string') {
76
- this._scrollContainer = selectOne(this.prop.container);
77
- }
78
- else {
79
- this._scrollContainer = this.prop.container;
80
- }
81
- // initialize the class
82
- if (init) {
83
- this.init();
84
- }
85
- }
86
79
  }
@@ -8,35 +8,10 @@ import timeoutCallback from '../../../utils/common/timeoutCallback';
8
8
  * Elements into viewport
9
9
  */
10
10
  export class ScrollView extends ScrollEventsBase {
11
- get prefix() {
12
- return `${this._app.prefix}scroll-view`;
13
- }
14
- _getDefaultProp() {
15
- return {
16
- ...super._getDefaultProp(),
17
- container: window,
18
- elements: `.${this.prefix}__el`,
19
- threshold: 0.9,
20
- states: 'in',
21
- classToToggle: 'viewed',
22
- useDelay: false,
23
- useIntersectionObserver: true,
24
- };
25
- }
26
- /**
27
- * Scroll event
28
- */
29
- _scrollEvent;
30
- /**
31
- * Intersection observer
32
- */
33
- _intersectionObserver;
34
- /**
35
- * If first start
36
- */
37
- _firstStart;
38
11
  constructor(initialProp, init = true) {
39
12
  super(initialProp, false);
13
+ this._scrollEvent = undefined;
14
+ this._intersectionObserver = undefined;
40
15
  this._firstStart = true;
41
16
  // get view elements
42
17
  this.updateElements();
@@ -45,6 +20,12 @@ export class ScrollView extends ScrollEventsBase {
45
20
  this.init();
46
21
  }
47
22
  }
23
+ get prefix() {
24
+ return `${this._app.prefix}scroll-view`;
25
+ }
26
+ _getDefaultProp() {
27
+ return Object.assign(Object.assign({}, super._getDefaultProp()), { container: window, elements: `.${this.prefix}__el`, threshold: 0.9, states: 'in', classToToggle: 'viewed', useDelay: false, useIntersectionObserver: true });
28
+ }
48
29
  init() {
49
30
  super.init();
50
31
  this.seekBounding();
@@ -91,7 +72,8 @@ export class ScrollView extends ScrollEventsBase {
91
72
  // add elements
92
73
  if (this.elements) {
93
74
  this.elements.forEach((el) => {
94
- this._intersectionObserver?.observe(el);
75
+ var _a;
76
+ (_a = this._intersectionObserver) === null || _a === void 0 ? void 0 : _a.observe(el);
95
77
  });
96
78
  }
97
79
  }
@@ -115,7 +97,6 @@ export class ScrollView extends ScrollEventsBase {
115
97
  this._intersectionObserver = undefined;
116
98
  }
117
99
  }
118
- _elements;
119
100
  /**
120
101
  * Element to seek
121
102
  */