@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,52 +1,32 @@
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 _get from "@babel/runtime/helpers/get";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
9
-
10
- 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); }; }
11
-
12
- 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; } }
13
-
14
1
  import useResize from '../services/resize.js';
15
2
 
16
3
  function testBreakpoints(breakpoints) {
17
- var _useResize$props = useResize().props(),
18
- breakpoint = _useResize$props.breakpoint;
19
-
20
- breakpoints.forEach(function (_ref) {
21
- var _ref2 = _slicedToArray(_ref, 2),
22
- breakpointKeys = _ref2[0],
23
- instance = _ref2[1];
24
-
25
- if (breakpointKeys.includes(breakpoint)) {
26
- instance.$mount();
27
- } else {
4
+ var {
5
+ breakpoint
6
+ } = useResize().props();
7
+ breakpoints.forEach(_ref => {
8
+ var [breakpointKeys, instance] = _ref;
9
+
10
+ if (breakpointKeys.includes(breakpoint) && !instance.$isMounted) {
11
+ setTimeout(() => instance.$mount(), 0);
12
+ } else if (!breakpointKeys.includes(breakpoint) && instance.$isMounted) {
28
13
  instance.$destroy();
29
14
  }
30
15
  });
31
16
  }
32
17
 
33
18
  function mountComponents(instance, breakpoints) {
34
- return breakpoints.map(function (_ref3) {
35
- var _ref4 = _slicedToArray(_ref3, 2),
36
- bk = _ref4[0],
37
- ComponentClass = _ref4[1];
38
-
19
+ return breakpoints.map(_ref2 => {
20
+ var [bk, ComponentClass] = _ref2;
39
21
  var child = new ComponentClass(instance.$el);
40
22
  Object.defineProperty(child, '$parent', {
41
- get: function get() {
42
- return instance;
43
- }
23
+ get: () => instance.$parent
44
24
  });
45
25
  return [bk, child];
46
26
  });
47
27
  }
48
28
 
49
- var instances = {};
29
+ var instances = new WeakMap();
50
30
  export default function withBreakpointManager(BaseClass, breakpoints) {
51
31
  if (!Array.isArray(breakpoints)) {
52
32
  throw new Error('[withBreakpointManager] The `breakpoints` parameter must be an array.');
@@ -56,64 +36,46 @@ export default function withBreakpointManager(BaseClass, breakpoints) {
56
36
  throw new Error('[withBreakpointManager] You must define at least 2 breakpoints.');
57
37
  }
58
38
 
59
- var _useResize = useResize(),
60
- add = _useResize.add,
61
- props = _useResize.props;
39
+ var {
40
+ add,
41
+ props
42
+ } = useResize();
62
43
 
63
44
  if (!props().breakpoint) {
64
45
  throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");
65
46
  }
66
47
 
67
- return function (_BaseClass) {
68
- _inherits(_class, _BaseClass);
69
-
70
- var _super = _createSuper(_class);
48
+ return class extends BaseClass {
49
+ constructor(element) {
50
+ super(element);
71
51
 
72
- function _class(element) {
73
- var _this;
74
-
75
- _classCallCheck(this, _class);
76
-
77
- _this = _super.call(this, element);
78
-
79
- if (!instances[_this.$id]) {
80
- instances[_this.$id] = mountComponents(_assertThisInitialized(_this), breakpoints);
52
+ if (!instances.has(this)) {
53
+ instances.set(this, mountComponents(this, breakpoints));
81
54
  }
82
55
 
83
- testBreakpoints(instances[_this.$id]);
84
- add("BreakpointManager-".concat(_this.$id), function () {
85
- testBreakpoints(instances[_this.$id]);
56
+ add("BreakpointManager-".concat(this.$id), () => {
57
+ testBreakpoints(instances.get(this));
86
58
  });
87
- return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
59
+ this.instances = instances.get(this);
60
+ return this;
88
61
  }
89
62
 
90
- _createClass(_class, [{
91
- key: "$mount",
92
- value: function $mount() {
93
- if (!instances[this.$id]) {
94
- instances[this.$id] = mountComponents(this, breakpoints);
95
- }
63
+ $mount() {
64
+ super.$mount();
65
+ testBreakpoints(instances.get(this));
66
+ return this;
67
+ }
96
68
 
97
- testBreakpoints(instances[this.$id]);
98
- return _get(_getPrototypeOf(_class.prototype), "$mount", this).call(this);
69
+ $destroy() {
70
+ if (Array.isArray(instances.get(this))) {
71
+ instances.get(this).forEach(_ref3 => {
72
+ var [, instance] = _ref3;
73
+ instance.$destroy();
74
+ });
99
75
  }
100
- }, {
101
- key: "$destroy",
102
- value: function $destroy() {
103
- if (Array.isArray(instances[this.$id])) {
104
- instances[this.$id].forEach(function (_ref5) {
105
- var _ref6 = _slicedToArray(_ref5, 2),
106
- instance = _ref6[1];
107
76
 
108
- instance.$destroy();
109
- });
110
- }
111
-
112
- return _get(_getPrototypeOf(_class.prototype), "$destroy", this).call(this);
113
- }
114
- }]);
77
+ return super.$destroy();
78
+ }
115
79
 
116
- return _class;
117
- }(BaseClass);
118
- }
119
- //# sourceMappingURL=withBreakpointManager.js.map
80
+ };
81
+ }
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * BreakpointObserver class.
3
3
  *
4
- * @template {BaseComponent} T
4
+ * @template {BaseConstructor} T
5
5
  * @param {T} BaseClass The Base class to extend from.
6
6
  * @return {T}
7
7
  */
8
- export default function withBreakpointObserver<T extends typeof import("../abstracts/Base").default>(BaseClass: T): T;
9
- export type Base = import('../abstracts/Base').default;
10
- export type BaseComponent = import('../abstracts/Base').BaseComponent;
8
+ export default function withBreakpointObserver<T extends typeof import("../Base").default>(BaseClass: T): T;
9
+ export type Base = import('../Base').default;
10
+ export type BaseConstructor = import('../Base').BaseConstructor;
11
11
  export type WithBreakpointObserverOptions = {
12
12
  activeBreakpoints?: string;
13
13
  inactiveBreakpoints?: string;
@@ -1,28 +1,17 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _get from "@babel/runtime/helpers/get";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
2
 
11
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
12
4
 
13
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
14
6
 
15
- 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); }; }
16
-
17
- 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; } }
18
-
19
7
  import useResize from '../services/resize.js';
20
8
 
21
9
  function testBreakpoints(instance) {
22
10
  var breakpoint = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : useResize().props().breakpoint;
23
- var _instance$$options = instance.$options,
24
- activeBreakpoints = _instance$$options.activeBreakpoints,
25
- inactiveBreakpoints = _instance$$options.inactiveBreakpoints;
11
+ var {
12
+ activeBreakpoints,
13
+ inactiveBreakpoints
14
+ } = instance.$options;
26
15
  var isInActiveBreakpoint = activeBreakpoints && activeBreakpoints.split(' ').includes(breakpoint);
27
16
  var isInInactiveBreakpoint = inactiveBreakpoints && inactiveBreakpoints.split(' ').includes(breakpoint);
28
17
 
@@ -34,17 +23,19 @@ function testBreakpoints(instance) {
34
23
  }
35
24
 
36
25
  function hasBreakpointConfiguration(instance) {
37
- var _instance$$options2 = instance.$options,
38
- activeBreakpoints = _instance$$options2.activeBreakpoints,
39
- inactiveBreakpoints = _instance$$options2.inactiveBreakpoints;
26
+ var {
27
+ activeBreakpoints,
28
+ inactiveBreakpoints
29
+ } = instance.$options;
40
30
  return Boolean(activeBreakpoints || inactiveBreakpoints);
41
31
  }
42
32
 
43
33
  function testConflictingBreakpointConfiguration(instance) {
44
- var _instance$$options3 = instance.$options,
45
- activeBreakpoints = _instance$$options3.activeBreakpoints,
46
- inactiveBreakpoints = _instance$$options3.inactiveBreakpoints,
47
- name = _instance$$options3.name;
34
+ var {
35
+ activeBreakpoints,
36
+ inactiveBreakpoints,
37
+ name
38
+ } = instance.$options;
48
39
 
49
40
  if (activeBreakpoints && inactiveBreakpoints) {
50
41
  throw new Error("[".concat(name, "] Incorrect configuration: the `activeBreakpoints` and `inactiveBreakpoints` are not compatible."));
@@ -53,22 +44,22 @@ function testConflictingBreakpointConfiguration(instance) {
53
44
 
54
45
  function addToResize(key, instance) {
55
46
  testConflictingBreakpointConfiguration(instance);
56
-
57
- var _useResize = useResize(),
58
- add = _useResize.add,
59
- has = _useResize.has;
47
+ var {
48
+ add,
49
+ has
50
+ } = useResize();
60
51
 
61
52
  if (!has(key)) {
62
53
  add(key, function onResize(_ref) {
63
- var breakpoint = _ref.breakpoint;
54
+ var {
55
+ breakpoint
56
+ } = _ref;
64
57
  var action = testBreakpoints(instance, breakpoint);
65
58
 
66
59
  if (action === '$destroy' && instance.$isMounted) {
67
60
  instance[action]();
68
61
  } else if (action === '$mount' && !instance.$isMounted) {
69
- setTimeout(function () {
70
- return instance[action]();
71
- }, 0);
62
+ setTimeout(() => instance[action](), 0);
72
63
  }
73
64
  });
74
65
  }
@@ -77,80 +68,66 @@ function addToResize(key, instance) {
77
68
  export default function withBreakpointObserver(BaseClass) {
78
69
  var _class, _temp, _BaseClass$config$nam, _BaseClass$config, _BaseClass$config2;
79
70
 
80
- return _temp = _class = function (_BaseClass) {
81
- _inherits(_class, _BaseClass);
82
-
83
- var _super = _createSuper(_class);
84
-
85
- function _class(element) {
86
- var _this;
87
-
88
- _classCallCheck(this, _class);
89
-
90
- _this = _super.call(this, element);
91
-
92
- var _useResize2 = useResize(),
93
- remove = _useResize2.remove,
94
- props = _useResize2.props;
95
-
96
- var name = _this.$options.name;
71
+ return _temp = _class = class extends BaseClass {
72
+ constructor(element) {
73
+ super(element);
74
+ var {
75
+ remove,
76
+ props
77
+ } = useResize();
78
+ var {
79
+ name
80
+ } = this.$options;
97
81
 
98
82
  if (!props().breakpoint) {
99
83
  throw new Error("[".concat(name, "] The `BreakpointObserver` class requires breakpoints to be defined."));
100
84
  }
101
85
 
102
- var key = "BreakpointObserver-".concat(_this.$id);
103
- var mutationObserver = new MutationObserver(function (_ref2) {
104
- var _ref3 = _slicedToArray(_ref2, 1),
105
- mutation = _ref3[0];
86
+ var key = "BreakpointObserver-".concat(this.$id);
87
+ var mutationObserver = new MutationObserver(_ref2 => {
88
+ var [mutation] = _ref2;
106
89
 
107
90
  if (mutation.type === 'attributes' && (mutation.attributeName === 'data-options' || mutation.attributeName.startsWith('data-option-'))) {
108
- if (!hasBreakpointConfiguration(_assertThisInitialized(_this))) {
109
- _this.$mount();
110
-
91
+ if (!hasBreakpointConfiguration(this)) {
92
+ this.$mount();
111
93
  remove(key);
112
94
  return;
113
95
  }
114
96
 
115
- addToResize(key, _assertThisInitialized(_this));
97
+ addToResize(key, this);
116
98
  }
117
99
  });
118
- mutationObserver.observe(_this.$el, {
100
+ mutationObserver.observe(this.$el, {
119
101
  attributes: true
120
102
  });
121
103
 
122
- if (!hasBreakpointConfiguration(_assertThisInitialized(_this))) {
123
- return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
104
+ if (!hasBreakpointConfiguration(this)) {
105
+ return this;
124
106
  }
125
107
 
126
- addToResize(key, _assertThisInitialized(_this));
127
- return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
108
+ addToResize(key, this);
109
+ return this;
128
110
  }
129
111
 
130
- _createClass(_class, [{
131
- key: "$mount",
132
- value: function $mount() {
133
- if (!hasBreakpointConfiguration(this)) {
134
- return _get(_getPrototypeOf(_class.prototype), "$mount", this).call(this);
135
- }
136
-
137
- var action = testBreakpoints(this);
112
+ $mount() {
113
+ if (!hasBreakpointConfiguration(this)) {
114
+ return super.$mount();
115
+ }
138
116
 
139
- if (action === '$mount') {
140
- return _get(_getPrototypeOf(_class.prototype), "$mount", this).call(this);
141
- }
117
+ var action = testBreakpoints(this);
142
118
 
143
- return this;
119
+ if (action === '$mount') {
120
+ return super.$mount();
144
121
  }
145
- }]);
146
122
 
147
- return _class;
148
- }(BaseClass), _defineProperty(_class, "config", _objectSpread(_objectSpread({}, BaseClass.config || {}), {}, {
123
+ return this;
124
+ }
125
+
126
+ }, _defineProperty(_class, "config", _objectSpread(_objectSpread({}, BaseClass.config || {}), {}, {
149
127
  name: "".concat((_BaseClass$config$nam = BaseClass === null || BaseClass === void 0 ? void 0 : (_BaseClass$config = BaseClass.config) === null || _BaseClass$config === void 0 ? void 0 : _BaseClass$config.name) !== null && _BaseClass$config$nam !== void 0 ? _BaseClass$config$nam : '', "WithBreakpointObserver"),
150
128
  options: _objectSpread(_objectSpread({}, (BaseClass === null || BaseClass === void 0 ? void 0 : (_BaseClass$config2 = BaseClass.config) === null || _BaseClass$config2 === void 0 ? void 0 : _BaseClass$config2.options) || {}), {}, {
151
129
  activeBreakpoints: String,
152
130
  inactiveBreakpoints: String
153
131
  })
154
132
  })), _temp;
155
- }
156
- //# sourceMappingURL=withBreakpointObserver.js.map
133
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @typedef {import('../abstracts/Base').default} Base
3
- * @typedef {import('../abstracts/Base').BaseComponent} BaseComponent
2
+ * @typedef {import('../Base').default} Base
3
+ * @typedef {import('../Base').BaseConstructor} BaseConstructor
4
4
  * @typedef {import('../services/drag').DragServiceOptions} DragServiceOptions
5
5
  */
6
6
  /**
@@ -9,14 +9,14 @@
9
9
  /**
10
10
  * Add dragging capabilities to a component.
11
11
  *
12
- * @template {BaseComponent} T
12
+ * @template {BaseConstructor} T
13
13
  * @param {T} BaseClass
14
14
  * @param {DragDecoratorOptions} options
15
15
  * @return {T}
16
16
  */
17
- export default function withDrag<T extends typeof import("../abstracts/Base").default>(BaseClass: T, options?: DragDecoratorOptions): T;
18
- export type Base = import('../abstracts/Base').default;
19
- export type BaseComponent = import('../abstracts/Base').BaseComponent;
17
+ export default function withDrag<T extends typeof import("../Base").default>(BaseClass: T, options?: DragDecoratorOptions): T;
18
+ export type Base = import('../Base').default;
19
+ export type BaseConstructor = import('../Base').BaseConstructor;
20
20
  export type DragServiceOptions = import('../services/drag').DragServiceOptions;
21
21
  export type DragDecoratorOptions = import("../services/drag.js").DragServiceOptions & {
22
22
  target: (this: Base) => HTMLElement;
@@ -1,55 +1,31 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
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
2
  var _excluded = ["target"];
8
-
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; } }
12
-
13
3
  import useDrag from '../services/drag.js';
14
4
  export default function withDrag(BaseClass) {
15
5
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
16
- target: function target() {
6
+ target() {
17
7
  return this.$el;
18
8
  }
19
- };
20
- return function (_BaseClass) {
21
- _inherits(_class, _BaseClass);
22
-
23
- var _super = _createSuper(_class);
24
-
25
- function _class(el) {
26
- var _this;
27
-
28
- _classCallCheck(this, _class);
29
-
30
- _this = _super.call(this, el);
31
9
 
32
- _this.$on('mounted', function () {
33
- var target = options.target,
10
+ };
11
+ return class extends BaseClass {
12
+ constructor(el) {
13
+ super(el);
14
+ this.$on('mounted', () => {
15
+ var {
16
+ target
17
+ } = options,
34
18
  otherOptions = _objectWithoutProperties(options, _excluded);
35
19
 
36
- var boundUseDrag = useDrag.bind(undefined, target.call(_assertThisInitialized(_this)), otherOptions);
37
-
38
- _this.$services.register('dragged', boundUseDrag);
39
-
40
- _this.$services.enable('dragged');
20
+ var boundUseDrag = useDrag.bind(undefined, target.call(this), otherOptions);
21
+ this.$services.register('dragged', boundUseDrag);
22
+ this.$services.enable('dragged');
41
23
  });
42
-
43
- _this.$on('destroyed', function () {
44
- _this.$services.disable('dragged');
45
-
46
- _this.$services.unregister('dragged');
24
+ this.$on('destroyed', () => {
25
+ this.$services.disable('dragged');
26
+ this.$services.unregister('dragged');
47
27
  });
48
-
49
- return _this;
50
28
  }
51
29
 
52
- return _class;
53
- }(BaseClass);
54
- }
55
- //# sourceMappingURL=withDrag.js.map
30
+ };
31
+ }
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * @typedef {import('deepmerge').Options} DeepmergeOptions
3
- * @typedef {import('../abstracts/Base').BaseConfig} BaseConfig
4
- * @typedef {import('../abstracts/Base').BaseComponent} BaseComponent
3
+ * @typedef {import('../Base').BaseConfig} BaseConfig
4
+ * @typedef {import('../Base').BaseConstructor} BaseConstructor
5
5
  */
6
6
  /**
7
7
  * Extends the configuration of an existing class.
8
8
  *
9
- * @template {BaseComponent} T
9
+ * @template {BaseConstructor} T
10
10
  * @param {T} BaseClass The Base class to extend.
11
11
  * @param {Partial<BaseConfig>} config Extra configuration to merge.
12
12
  * @param {DeepmergeOptions} options Options for the `deepmerge` function. {@link https://github.com/TehShrike/deepmerge#options}
13
13
  * @return {T}
14
14
  */
15
- export default function withExtraConfig<T extends typeof import("../abstracts/Base").default>(BaseClass: T, config: Partial<BaseConfig>, options?: DeepmergeOptions): T;
15
+ export default function withExtraConfig<T extends typeof import("../Base").default>(BaseClass: T, config: Partial<BaseConfig>, options?: DeepmergeOptions): T;
16
16
  export type DeepmergeOptions = import('deepmerge').Options;
17
- export type BaseConfig = import('../abstracts/Base').BaseConfig;
18
- export type BaseComponent = import('../abstracts/Base').BaseComponent;
17
+ export type BaseConfig = import('../Base').BaseConfig;
18
+ export type BaseConstructor = import('../Base').BaseConstructor;
@@ -1,13 +1,4 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _inherits from "@babel/runtime/helpers/inherits";
3
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
5
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
2
  import merge from 'deepmerge';
12
3
  export default function withExtraConfig(BaseClass, config) {
13
4
  var _class, _temp;
@@ -19,18 +10,5 @@ export default function withExtraConfig(BaseClass, config) {
19
10
  newConfig.name = "".concat(BaseClass.config.name, "WithExtraConfig");
20
11
  }
21
12
 
22
- return _temp = _class = function (_BaseClass) {
23
- _inherits(_class, _BaseClass);
24
-
25
- var _super = _createSuper(_class);
26
-
27
- function _class() {
28
- _classCallCheck(this, _class);
29
-
30
- return _super.apply(this, arguments);
31
- }
32
-
33
- return _class;
34
- }(BaseClass), _defineProperty(_class, "config", newConfig), _temp;
35
- }
36
- //# sourceMappingURL=withExtraConfig.js.map
13
+ return _temp = _class = class extends BaseClass {}, _defineProperty(_class, "config", newConfig), _temp;
14
+ }
@@ -1,18 +1,18 @@
1
1
  /**
2
2
  * IntersectionObserver decoration.
3
3
  *
4
- * @template {BaseComponent} T
4
+ * @template {BaseConstructor} T
5
5
  * @param {T} BaseClass The Base class to extend.
6
6
  * @param {Object} [defaultOptions] The options for the IntersectionObserver instance.
7
7
  * @return {T & { new: (element:HTMLElement) => { $observer: IntersectionObserver }}}
8
8
  */
9
- export default function withIntersectionObserver<T extends typeof import("../abstracts/Base").default>(BaseClass: T, defaultOptions?: any): T & {
9
+ export default function withIntersectionObserver<T extends typeof import("../Base").default>(BaseClass: T, defaultOptions?: any): T & {
10
10
  new: (element: HTMLElement) => {
11
11
  $observer: IntersectionObserver;
12
12
  };
13
13
  };
14
- export type Base = import('../abstracts/Base').default;
15
- export type BaseComponent = import('../abstracts/Base').BaseComponent;
14
+ export type Base = import('../Base').default;
15
+ export type BaseConstructor = import('../Base').BaseConstructor;
16
16
  export type WithIntersectionObserverOptions = {
17
17
  intersectionObserver: any;
18
18
  };