@studiometa/js-toolkit 1.7.2 → 2.0.0-alpha.10

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 (237) hide show
  1. package/Base/index.d.ts +217 -0
  2. package/Base/index.js +237 -0
  3. package/Base/managers/ChildrenManager.d.ts +108 -0
  4. package/Base/managers/ChildrenManager.js +124 -0
  5. package/Base/managers/EventsManager.d.ts +190 -0
  6. package/Base/managers/EventsManager.js +195 -0
  7. package/Base/managers/OptionsManager.d.ts +120 -0
  8. package/Base/managers/OptionsManager.js +180 -0
  9. package/Base/managers/RefsManager.d.ts +84 -0
  10. package/Base/managers/RefsManager.js +83 -0
  11. package/{abstracts/Base/classes/Services.d.ts → Base/managers/ServicesManager.d.ts} +22 -7
  12. package/Base/managers/ServicesManager.js +115 -0
  13. package/{abstracts/Base → Base}/utils.d.ts +0 -30
  14. package/Base/utils.js +43 -0
  15. package/README.md +12 -70
  16. package/decorators/index.js +1 -2
  17. package/decorators/withBreakpointManager.d.ts +5 -5
  18. package/decorators/withBreakpointManager.js +41 -79
  19. package/decorators/withBreakpointObserver.d.ts +4 -4
  20. package/decorators/withBreakpointObserver.js +54 -77
  21. package/decorators/withDrag.d.ts +6 -6
  22. package/decorators/withDrag.js +17 -41
  23. package/decorators/withExtraConfig.d.ts +6 -6
  24. package/decorators/withExtraConfig.js +2 -24
  25. package/decorators/withIntersectionObserver.d.ts +4 -4
  26. package/decorators/withIntersectionObserver.js +17 -60
  27. package/decorators/withMountWhenInView.d.ts +8 -8
  28. package/decorators/withMountWhenInView.js +23 -51
  29. package/helpers/createApp.d.ts +4 -4
  30. package/helpers/createApp.js +10 -12
  31. package/helpers/importOnInteraction.d.ts +6 -6
  32. package/helpers/importOnInteraction.js +7 -8
  33. package/helpers/importWhenIdle.d.ts +4 -4
  34. package/helpers/importWhenIdle.js +7 -8
  35. package/helpers/importWhenVisible.d.ts +6 -6
  36. package/helpers/importWhenVisible.js +9 -16
  37. package/helpers/index.d.ts +1 -3
  38. package/helpers/index.js +1 -4
  39. package/helpers/utils.js +2 -3
  40. package/index.d.ts +19 -5
  41. package/index.js +5 -6
  42. package/index.modern.js +1 -3230
  43. package/index.umd.js +1 -3586
  44. package/package.json +3 -6
  45. package/{abstracts → services}/Service.d.ts +0 -0
  46. package/services/Service.js +63 -0
  47. package/services/drag.js +144 -180
  48. package/services/index.js +1 -2
  49. package/services/key.js +56 -98
  50. package/services/load.d.ts +1 -1
  51. package/services/load.js +22 -51
  52. package/services/pointer.js +118 -157
  53. package/services/raf.js +37 -65
  54. package/services/resize.js +46 -98
  55. package/services/scroll.js +81 -120
  56. package/utils/collide/boundingRectToCircle.js +7 -6
  57. package/utils/collide/collideCircleCircle.js +1 -2
  58. package/utils/collide/collideCircleRect.js +1 -2
  59. package/utils/collide/collidePointCircle.js +1 -2
  60. package/utils/collide/collidePointRect.js +1 -2
  61. package/utils/collide/collideRectRect.js +1 -2
  62. package/utils/collide/index.js +1 -2
  63. package/utils/css/classes.js +2 -3
  64. package/utils/css/index.js +1 -2
  65. package/utils/css/matrix.js +1 -2
  66. package/utils/css/styles.js +3 -8
  67. package/utils/css/transition.js +67 -140
  68. package/utils/debounce.js +3 -4
  69. package/utils/focusTrap.js +4 -5
  70. package/utils/history.js +12 -19
  71. package/utils/index.d.ts +2 -1
  72. package/utils/index.js +2 -2
  73. package/utils/keyCodes.js +1 -2
  74. package/utils/math/clamp.js +1 -2
  75. package/utils/math/clamp01.js +1 -2
  76. package/utils/math/damp.js +1 -2
  77. package/utils/math/index.js +1 -2
  78. package/utils/math/inertiaFinalValue.js +1 -2
  79. package/utils/math/lerp.js +1 -2
  80. package/utils/math/map.js +1 -2
  81. package/utils/math/round.js +1 -2
  82. package/utils/memoize.d.ts +30 -0
  83. package/utils/memoize.js +30 -0
  84. package/utils/nextFrame.js +4 -9
  85. package/utils/object/autoBind.js +11 -19
  86. package/utils/object/getAllProperties.d.ts +6 -3
  87. package/utils/object/getAllProperties.js +10 -8
  88. package/utils/object/index.js +1 -2
  89. package/utils/object/isObject.js +2 -4
  90. package/utils/string/index.js +1 -2
  91. package/utils/string/withLeadingCharacters.js +1 -2
  92. package/utils/string/withLeadingSlash.js +1 -2
  93. package/utils/string/withTrailingCharacters.js +1 -2
  94. package/utils/string/withTrailingSlash.js +1 -2
  95. package/utils/string/withoutLeadingCharacters.js +1 -2
  96. package/utils/string/withoutLeadingCharactersRecursive.js +1 -2
  97. package/utils/string/withoutLeadingSlash.js +1 -2
  98. package/utils/string/withoutTrailingCharacters.js +1 -2
  99. package/utils/string/withoutTrailingCharactersRecursive.js +1 -2
  100. package/utils/string/withoutTrailingSlash.js +1 -2
  101. package/utils/throttle.js +2 -3
  102. package/abstracts/Base/children.d.ts +0 -16
  103. package/abstracts/Base/children.js +0 -66
  104. package/abstracts/Base/children.js.map +0 -1
  105. package/abstracts/Base/classes/Options.d.ts +0 -37
  106. package/abstracts/Base/classes/Options.js +0 -182
  107. package/abstracts/Base/classes/Options.js.map +0 -1
  108. package/abstracts/Base/classes/Services.js +0 -120
  109. package/abstracts/Base/classes/Services.js.map +0 -1
  110. package/abstracts/Base/components.d.ts +0 -22
  111. package/abstracts/Base/components.js +0 -67
  112. package/abstracts/Base/components.js.map +0 -1
  113. package/abstracts/Base/events.d.ts +0 -8
  114. package/abstracts/Base/events.js +0 -185
  115. package/abstracts/Base/events.js.map +0 -1
  116. package/abstracts/Base/index.d.ts +0 -176
  117. package/abstracts/Base/index.js +0 -215
  118. package/abstracts/Base/index.js.map +0 -1
  119. package/abstracts/Base/options.d.ts +0 -17
  120. package/abstracts/Base/options.js +0 -112
  121. package/abstracts/Base/options.js.map +0 -1
  122. package/abstracts/Base/refs.d.ts +0 -30
  123. package/abstracts/Base/refs.js +0 -60
  124. package/abstracts/Base/refs.js.map +0 -1
  125. package/abstracts/Base/utils.js +0 -102
  126. package/abstracts/Base/utils.js.map +0 -1
  127. package/abstracts/EventManager.d.ts +0 -41
  128. package/abstracts/EventManager.js +0 -88
  129. package/abstracts/EventManager.js.map +0 -1
  130. package/abstracts/Service.js +0 -82
  131. package/abstracts/Service.js.map +0 -1
  132. package/abstracts/index.d.ts +0 -4
  133. package/abstracts/index.js +0 -5
  134. package/abstracts/index.js.map +0 -1
  135. package/components/Accordion/Accordion.d.ts +0 -83
  136. package/components/Accordion/Accordion.js +0 -121
  137. package/components/Accordion/Accordion.js.map +0 -1
  138. package/components/Accordion/AccordionItem.d.ts +0 -122
  139. package/components/Accordion/AccordionItem.js +0 -327
  140. package/components/Accordion/AccordionItem.js.map +0 -1
  141. package/components/Accordion/index.d.ts +0 -27
  142. package/components/Accordion/index.js +0 -39
  143. package/components/Accordion/index.js.map +0 -1
  144. package/components/Cursor.d.ts +0 -138
  145. package/components/Cursor.js +0 -167
  146. package/components/Cursor.js.map +0 -1
  147. package/components/Draggable.d.ts +0 -49
  148. package/components/Draggable.js +0 -77
  149. package/components/Draggable.js.map +0 -1
  150. package/components/Modal.d.ts +0 -158
  151. package/components/Modal.js +0 -270
  152. package/components/Modal.js.map +0 -1
  153. package/components/Tabs.d.ts +0 -108
  154. package/components/Tabs.js +0 -195
  155. package/components/Tabs.js.map +0 -1
  156. package/components/index.d.ts +0 -6
  157. package/components/index.js +0 -7
  158. package/components/index.js.map +0 -1
  159. package/decorators/index.js.map +0 -1
  160. package/decorators/withBreakpointManager.js.map +0 -1
  161. package/decorators/withBreakpointObserver.js.map +0 -1
  162. package/decorators/withDrag.js.map +0 -1
  163. package/decorators/withExtraConfig.js.map +0 -1
  164. package/decorators/withIntersectionObserver.js.map +0 -1
  165. package/decorators/withMountWhenInView.js.map +0 -1
  166. package/full.d.ts +0 -10
  167. package/full.js +0 -12
  168. package/full.js.map +0 -1
  169. package/full.modern.js +0 -7523
  170. package/full.modern.js.map +0 -1
  171. package/full.umd.js +0 -8277
  172. package/full.umd.js.map +0 -1
  173. package/helpers/createApp.js.map +0 -1
  174. package/helpers/createBase.d.ts +0 -7
  175. package/helpers/createBase.js +0 -7
  176. package/helpers/createBase.js.map +0 -1
  177. package/helpers/defineComponent.d.ts +0 -11
  178. package/helpers/defineComponent.js +0 -68
  179. package/helpers/defineComponent.js.map +0 -1
  180. package/helpers/importOnInteraction.js.map +0 -1
  181. package/helpers/importWhenIdle.js.map +0 -1
  182. package/helpers/importWhenVisible.js.map +0 -1
  183. package/helpers/index.js.map +0 -1
  184. package/helpers/utils.js.map +0 -1
  185. package/index.js.map +0 -1
  186. package/index.modern.js.map +0 -1
  187. package/index.umd.js.map +0 -1
  188. package/services/drag.js.map +0 -1
  189. package/services/index.js.map +0 -1
  190. package/services/key.js.map +0 -1
  191. package/services/load.js.map +0 -1
  192. package/services/pointer.js.map +0 -1
  193. package/services/raf.js.map +0 -1
  194. package/services/resize.js.map +0 -1
  195. package/services/scroll.js.map +0 -1
  196. package/utils/collide/boundingRectToCircle.js.map +0 -1
  197. package/utils/collide/collideCircleCircle.js.map +0 -1
  198. package/utils/collide/collideCircleRect.js.map +0 -1
  199. package/utils/collide/collidePointCircle.js.map +0 -1
  200. package/utils/collide/collidePointRect.js.map +0 -1
  201. package/utils/collide/collideRectRect.js.map +0 -1
  202. package/utils/collide/index.js.map +0 -1
  203. package/utils/css/classes.js.map +0 -1
  204. package/utils/css/index.js.map +0 -1
  205. package/utils/css/matrix.js.map +0 -1
  206. package/utils/css/styles.js.map +0 -1
  207. package/utils/css/transition.js.map +0 -1
  208. package/utils/debounce.js.map +0 -1
  209. package/utils/focusTrap.js.map +0 -1
  210. package/utils/history.js.map +0 -1
  211. package/utils/index.js.map +0 -1
  212. package/utils/keyCodes.js.map +0 -1
  213. package/utils/math/clamp.js.map +0 -1
  214. package/utils/math/clamp01.js.map +0 -1
  215. package/utils/math/damp.js.map +0 -1
  216. package/utils/math/index.js.map +0 -1
  217. package/utils/math/inertiaFinalValue.js.map +0 -1
  218. package/utils/math/lerp.js.map +0 -1
  219. package/utils/math/map.js.map +0 -1
  220. package/utils/math/round.js.map +0 -1
  221. package/utils/nextFrame.js.map +0 -1
  222. package/utils/object/autoBind.js.map +0 -1
  223. package/utils/object/getAllProperties.js.map +0 -1
  224. package/utils/object/index.js.map +0 -1
  225. package/utils/object/isObject.js.map +0 -1
  226. package/utils/string/index.js.map +0 -1
  227. package/utils/string/withLeadingCharacters.js.map +0 -1
  228. package/utils/string/withLeadingSlash.js.map +0 -1
  229. package/utils/string/withTrailingCharacters.js.map +0 -1
  230. package/utils/string/withTrailingSlash.js.map +0 -1
  231. package/utils/string/withoutLeadingCharacters.js.map +0 -1
  232. package/utils/string/withoutLeadingCharactersRecursive.js.map +0 -1
  233. package/utils/string/withoutLeadingSlash.js.map +0 -1
  234. package/utils/string/withoutTrailingCharacters.js.map +0 -1
  235. package/utils/string/withoutTrailingCharactersRecursive.js.map +0 -1
  236. package/utils/string/withoutTrailingSlash.js.map +0 -1
  237. package/utils/throttle.js.map +0 -1
@@ -1,107 +1,58 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
-
7
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
-
9
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
10
-
11
- import Service from '../abstracts/Service.js';
1
+ import Service from './Service.js';
12
2
  import debounce from '../utils/debounce.js';
13
3
 
14
- var Resize = function (_Service) {
15
- _inherits(Resize, _Service);
16
-
17
- var _super = _createSuper(Resize);
18
-
19
- function Resize() {
20
- _classCallCheck(this, Resize);
21
-
22
- return _super.apply(this, arguments);
4
+ class Resize extends Service {
5
+ init() {
6
+ this.handler = debounce(() => {
7
+ this.trigger(this.props);
8
+ }).bind(this);
9
+ window.addEventListener('resize', this.handler);
10
+ return this;
23
11
  }
24
12
 
25
- _createClass(Resize, [{
26
- key: "init",
27
- value: function init() {
28
- var _this = this;
13
+ kill() {
14
+ window.removeEventListener('resize', this.handler);
15
+ return this;
16
+ }
29
17
 
30
- this.handler = debounce(function () {
31
- _this.trigger(_this.props);
32
- }).bind(this);
18
+ get props() {
19
+ var props = {
20
+ width: window.innerWidth,
21
+ height: window.innerHeight,
22
+ ratio: window.innerWidth / window.innerHeight,
23
+ orientation: 'square'
24
+ };
33
25
 
34
- if (this.canUseResizeObserver) {
35
- this.resizeObserver = new ResizeObserver(this.handler);
36
- this.resizeObserver.observe(document.documentElement);
37
- } else {
38
- window.addEventListener('resize', this.handler);
39
- }
26
+ if (props.ratio > 1) {
27
+ props.orientation = 'landscape';
28
+ }
40
29
 
41
- return this;
30
+ if (props.ratio < 1) {
31
+ props.orientation = 'portrait';
42
32
  }
43
- }, {
44
- key: "kill",
45
- value: function kill() {
46
- if (this.canUseResizeObserver) {
47
- this.resizeObserver.disconnect();
48
- } else {
49
- window.removeEventListener('resize', this.handler);
50
- }
51
33
 
52
- delete this.resizeObserver;
53
- return this;
34
+ if (this.breakpointElement) {
35
+ props.breakpoint = this.breakpoint;
36
+ props.breakpoints = this.breakpoints;
54
37
  }
55
- }, {
56
- key: "props",
57
- get: function get() {
58
- var props = {
59
- width: window.innerWidth,
60
- height: window.innerHeight,
61
- ratio: window.innerWidth / window.innerHeight,
62
- orientation: 'square'
63
- };
64
38
 
65
- if (props.ratio > 1) {
66
- props.orientation = 'landscape';
67
- }
39
+ return props;
40
+ }
68
41
 
69
- if (props.ratio < 1) {
70
- props.orientation = 'portrait';
71
- }
42
+ get breakpointElement() {
43
+ return document.querySelector('[data-breakpoint]') || null;
44
+ }
72
45
 
73
- if (this.breakpointElement) {
74
- props.breakpoint = this.breakpoint;
75
- props.breakpoints = this.breakpoints;
76
- }
46
+ get breakpoint() {
47
+ return window.getComputedStyle(this.breakpointElement, '::before').getPropertyValue('content').replace(/"/g, '');
48
+ }
77
49
 
78
- return props;
79
- }
80
- }, {
81
- key: "breakpointElement",
82
- get: function get() {
83
- return document.querySelector('[data-breakpoint]') || null;
84
- }
85
- }, {
86
- key: "breakpoint",
87
- get: function get() {
88
- return window.getComputedStyle(this.breakpointElement, '::before').getPropertyValue('content').replace(/"/g, '');
89
- }
90
- }, {
91
- key: "breakpoints",
92
- get: function get() {
93
- var breakpoints = window.getComputedStyle(this.breakpointElement, '::after').getPropertyValue('content').replace(/"/g, '');
94
- return breakpoints.split(',');
95
- }
96
- }, {
97
- key: "canUseResizeObserver",
98
- get: function get() {
99
- return typeof window.ResizeObserver !== 'undefined';
100
- }
101
- }]);
50
+ get breakpoints() {
51
+ var breakpoints = window.getComputedStyle(this.breakpointElement, '::after').getPropertyValue('content').replace(/"/g, '');
52
+ return breakpoints.split(',');
53
+ }
102
54
 
103
- return Resize;
104
- }(Service);
55
+ }
105
56
 
106
57
  var resize = null;
107
58
  export default function useResize() {
@@ -113,15 +64,12 @@ export default function useResize() {
113
64
  var remove = resize.remove.bind(resize);
114
65
  var has = resize.has.bind(resize);
115
66
 
116
- var props = function props() {
117
- return resize.props;
118
- };
67
+ var props = () => resize.props;
119
68
 
120
69
  return {
121
- add: add,
122
- remove: remove,
123
- has: has,
124
- props: props
70
+ add,
71
+ remove,
72
+ has,
73
+ props
125
74
  };
126
- }
127
- //# sourceMappingURL=resize.js.map
75
+ }
@@ -1,131 +1,95 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import Service from './Service.js';
3
+ import debounce from '../utils/debounce.js';
8
4
 
9
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
5
+ class Scroll extends Service {
6
+ constructor() {
7
+ super(...arguments);
12
8
 
13
- import Service from '../abstracts/Service.js';
14
- import debounce from '../utils/debounce.js';
9
+ _defineProperty(this, "y", window.pageYOffset);
15
10
 
16
- var Scroll = function (_Service) {
17
- _inherits(Scroll, _Service);
11
+ _defineProperty(this, "yLast", window.pageYOffset);
18
12
 
19
- var _super = _createSuper(Scroll);
13
+ _defineProperty(this, "x", window.pageXOffset);
20
14
 
21
- function Scroll() {
22
- var _this;
15
+ _defineProperty(this, "xLast", window.pageXOffset);
16
+ }
23
17
 
24
- _classCallCheck(this, Scroll);
18
+ init() {
19
+ document.addEventListener('scroll', this, {
20
+ passive: true,
21
+ capture: true
22
+ });
23
+ return this;
24
+ }
25
25
 
26
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
- args[_key] = arguments[_key];
28
- }
26
+ get debouncedHandler() {
27
+ var debounced = debounce(() => {
28
+ this.trigger(this.props);
29
+ }, 0);
30
+ Object.defineProperty(this, 'debouncedHandler', {
31
+ value: debounced
32
+ });
33
+ return debounced;
34
+ }
29
35
 
30
- _this = _super.call.apply(_super, [this].concat(args));
36
+ handleEvent() {
37
+ this.trigger(this.props);
38
+ this.debouncedHandler();
39
+ }
31
40
 
32
- _defineProperty(_assertThisInitialized(_this), "y", window.pageYOffset);
41
+ kill() {
42
+ document.removeEventListener('scroll', this);
43
+ return this;
44
+ }
33
45
 
34
- _defineProperty(_assertThisInitialized(_this), "yLast", window.pageYOffset);
46
+ get props() {
47
+ this.yLast = this.y;
48
+ this.xLast = this.x;
35
49
 
36
- _defineProperty(_assertThisInitialized(_this), "x", window.pageXOffset);
50
+ if (window.pageYOffset !== this.y) {
51
+ this.y = window.pageYOffset;
52
+ }
37
53
 
38
- _defineProperty(_assertThisInitialized(_this), "xLast", window.pageXOffset);
54
+ if (window.pageXOffset !== this.x) {
55
+ this.x = window.pageXOffset;
56
+ }
39
57
 
40
- return _this;
58
+ return {
59
+ x: this.x,
60
+ y: this.y,
61
+ changed: {
62
+ x: this.x !== this.xLast,
63
+ y: this.y !== this.yLast
64
+ },
65
+ last: {
66
+ x: this.xLast,
67
+ y: this.yLast
68
+ },
69
+ delta: {
70
+ x: this.x - this.xLast,
71
+ y: this.y - this.yLast
72
+ },
73
+ progress: {
74
+ x: this.max.x === 0 ? 1 : this.x / this.max.x,
75
+ y: this.max.y === 0 ? 1 : this.y / this.max.y
76
+ },
77
+ direction: {
78
+ x: this.x > this.xLast ? 'RIGHT' : this.x < this.xLast ? 'LEFT' : 'NONE',
79
+ y: this.y > this.yLast ? 'DOWN' : this.y < this.yLast ? 'UP' : 'NONE'
80
+ },
81
+ max: this.max
82
+ };
41
83
  }
42
84
 
43
- _createClass(Scroll, [{
44
- key: "init",
45
- value: function init() {
46
- document.addEventListener('scroll', this, {
47
- passive: true,
48
- capture: true
49
- });
50
- return this;
51
- }
52
- }, {
53
- key: "debouncedHandler",
54
- get: function get() {
55
- var _this2 = this;
56
-
57
- var debounced = debounce(function () {
58
- _this2.trigger(_this2.props);
59
- }, 0);
60
- Object.defineProperty(this, 'debouncedHandler', {
61
- value: debounced
62
- });
63
- return debounced;
64
- }
65
- }, {
66
- key: "handleEvent",
67
- value: function handleEvent() {
68
- this.trigger(this.props);
69
- this.debouncedHandler();
70
- }
71
- }, {
72
- key: "kill",
73
- value: function kill() {
74
- document.removeEventListener('scroll', this);
75
- return this;
76
- }
77
- }, {
78
- key: "props",
79
- get: function get() {
80
- this.yLast = this.y;
81
- this.xLast = this.x;
82
-
83
- if (window.pageYOffset !== this.y) {
84
- this.y = window.pageYOffset;
85
- }
86
-
87
- if (window.pageXOffset !== this.x) {
88
- this.x = window.pageXOffset;
89
- }
90
-
91
- return {
92
- x: this.x,
93
- y: this.y,
94
- changed: {
95
- x: this.x !== this.xLast,
96
- y: this.y !== this.yLast
97
- },
98
- last: {
99
- x: this.xLast,
100
- y: this.yLast
101
- },
102
- delta: {
103
- x: this.x - this.xLast,
104
- y: this.y - this.yLast
105
- },
106
- progress: {
107
- x: this.max.x === 0 ? 1 : this.x / this.max.x,
108
- y: this.max.y === 0 ? 1 : this.y / this.max.y
109
- },
110
- direction: {
111
- x: this.x > this.xLast ? 'RIGHT' : this.x < this.xLast ? 'LEFT' : 'NONE',
112
- y: this.y > this.yLast ? 'DOWN' : this.y < this.yLast ? 'UP' : 'NONE'
113
- },
114
- max: this.max
115
- };
116
- }
117
- }, {
118
- key: "max",
119
- get: function get() {
120
- return {
121
- x: (document.scrollingElement || document.body).scrollWidth - window.innerWidth,
122
- y: (document.scrollingElement || document.body).scrollHeight - window.innerHeight
123
- };
124
- }
125
- }]);
85
+ get max() {
86
+ return {
87
+ x: (document.scrollingElement || document.body).scrollWidth - window.innerWidth,
88
+ y: (document.scrollingElement || document.body).scrollHeight - window.innerHeight
89
+ };
90
+ }
126
91
 
127
- return Scroll;
128
- }(Service);
92
+ }
129
93
 
130
94
  var scroll = null;
131
95
  export default function useScroll() {
@@ -137,15 +101,12 @@ export default function useScroll() {
137
101
  var remove = scroll.remove.bind(scroll);
138
102
  var has = scroll.has.bind(scroll);
139
103
 
140
- var props = function props() {
141
- return scroll.props;
142
- };
104
+ var props = () => scroll.props;
143
105
 
144
106
  return {
145
- add: add,
146
- remove: remove,
147
- has: has,
148
- props: props
107
+ add,
108
+ remove,
109
+ has,
110
+ props
149
111
  };
150
- }
151
- //# sourceMappingURL=scroll.js.map
112
+ }
@@ -1,8 +1,10 @@
1
1
  export default function collidePointRect(_ref) {
2
- var x = _ref.x,
3
- y = _ref.y,
4
- width = _ref.width,
5
- height = _ref.height;
2
+ var {
3
+ x,
4
+ y,
5
+ width,
6
+ height
7
+ } = _ref;
6
8
  var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7
9
  if (width !== height && !force) throw new Error('Initial DOMElement is not a square. Please use the force mode.');
8
10
  return {
@@ -10,5 +12,4 @@ export default function collidePointRect(_ref) {
10
12
  y: y + height / 2,
11
13
  radius: (width + height) / 4
12
14
  };
13
- }
14
- //# sourceMappingURL=boundingRectToCircle.js.map
15
+ }
@@ -8,5 +8,4 @@ export default function collideCircleCircle(circle1, circle2) {
8
8
  }
9
9
 
10
10
  return false;
11
- }
12
- //# sourceMappingURL=collideCircleCircle.js.map
11
+ }
@@ -23,5 +23,4 @@ export default function collideCircleRect(circle, rect) {
23
23
  }
24
24
 
25
25
  return false;
26
- }
27
- //# sourceMappingURL=collideCircleRect.js.map
26
+ }
@@ -3,5 +3,4 @@ export default function collidePointCircle(point, circle) {
3
3
  var distY = point.y - circle.y;
4
4
  var distance = Math.sqrt(distX * distX + distY * distY);
5
5
  return distance <= circle.radius;
6
- }
7
- //# sourceMappingURL=collidePointCircle.js.map
6
+ }
@@ -1,4 +1,3 @@
1
1
  export default function collidePointRect(point, rect) {
2
2
  return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
3
- }
4
- //# sourceMappingURL=collidePointRect.js.map
3
+ }
@@ -1,4 +1,3 @@
1
1
  export default function collideRectRect(rect1, rect2) {
2
2
  return rect1.x + rect1.width >= rect2.x && rect1.x <= rect2.x + rect2.width && rect1.y + rect1.height >= rect2.y && rect1.y <= rect2.y + rect2.height;
3
- }
4
- //# sourceMappingURL=collideRectRect.js.map
3
+ }
@@ -4,5 +4,4 @@ import boundingRectToCircle from './boundingRectToCircle.js';
4
4
  import collideCircleRect from './collideCircleRect.js';
5
5
  import collideCircleCircle from './collideCircleCircle.js';
6
6
  import collidePointCircle from './collidePointCircle.js';
7
- export { collidePointRect, collideRectRect, boundingRectToCircle, collideCircleRect, collideCircleCircle, collidePointCircle };
8
- //# sourceMappingURL=index.js.map
7
+ export { collidePointRect, collideRectRect, boundingRectToCircle, collideCircleRect, collideCircleCircle, collidePointCircle };
@@ -5,7 +5,7 @@ function setClasses(element, classNames) {
5
5
  return;
6
6
  }
7
7
 
8
- classNames.split(' ').forEach(function (className) {
8
+ classNames.split(' ').forEach(className => {
9
9
  element.classList[method](className);
10
10
  });
11
11
  }
@@ -18,5 +18,4 @@ export function remove(element, classNames) {
18
18
  }
19
19
  export function toggle(element, classNames) {
20
20
  setClasses(element, classNames, 'toggle');
21
- }
22
- //# sourceMappingURL=classes.js.map
21
+ }
@@ -2,5 +2,4 @@ import * as classes from './classes.js';
2
2
  import * as styles from './styles.js';
3
3
  import matrix from './matrix.js';
4
4
  import transition from './transition.js';
5
- export { classes, styles, matrix, transition };
6
- //# sourceMappingURL=index.js.map
5
+ export { classes, styles, matrix, transition };
@@ -3,5 +3,4 @@ export default function matrix(transform) {
3
3
 
4
4
  transform = transform || {};
5
5
  return "matrix(".concat((_transform$scaleX = transform.scaleX) !== null && _transform$scaleX !== void 0 ? _transform$scaleX : 1, ", ").concat((_transform$skewY = transform.skewY) !== null && _transform$skewY !== void 0 ? _transform$skewY : 0, ", ").concat((_transform$skewX = transform.skewX) !== null && _transform$skewX !== void 0 ? _transform$skewX : 0, ", ").concat((_transform$scaleY = transform.scaleY) !== null && _transform$scaleY !== void 0 ? _transform$scaleY : 1, ", ").concat((_transform$translateX = transform.translateX) !== null && _transform$translateX !== void 0 ? _transform$translateX : 0, ", ").concat((_transform$translateY = transform.translateY) !== null && _transform$translateY !== void 0 ? _transform$translateY : 0, ")");
6
- }
7
- //# sourceMappingURL=matrix.js.map
6
+ }
@@ -1,4 +1,3 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import isObject from '../object/isObject.js';
3
2
  export default function setStyles(element, styles) {
4
3
  var method = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'add';
@@ -7,11 +6,8 @@ export default function setStyles(element, styles) {
7
6
  return;
8
7
  }
9
8
 
10
- Object.entries(styles).forEach(function (_ref) {
11
- var _ref2 = _slicedToArray(_ref, 2),
12
- prop = _ref2[0],
13
- value = _ref2[1];
14
-
9
+ Object.entries(styles).forEach(_ref => {
10
+ var [prop, value] = _ref;
15
11
  element.style[prop] = method === 'add' ? value : '';
16
12
  });
17
13
  }
@@ -20,5 +16,4 @@ export function add(element, styles) {
20
16
  }
21
17
  export function remove(element, styles) {
22
18
  setStyles(element, styles, 'remove');
23
- }
24
- //# sourceMappingURL=styles.js.map
19
+ }