@studiometa/js-toolkit 2.0.0-alpha.1 → 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 (201) hide show
  1. package/Base/index.d.ts +29 -47
  2. package/Base/index.js +144 -171
  3. package/Base/managers/ChildrenManager.d.ts +6 -6
  4. package/Base/managers/ChildrenManager.js +95 -119
  5. package/Base/managers/EventsManager.d.ts +9 -9
  6. package/Base/managers/EventsManager.js +128 -161
  7. package/Base/managers/OptionsManager.d.ts +50 -5
  8. package/Base/managers/OptionsManager.js +115 -116
  9. package/Base/managers/RefsManager.js +62 -73
  10. package/Base/managers/ServicesManager.d.ts +14 -3
  11. package/Base/managers/ServicesManager.js +78 -77
  12. package/Base/utils.js +5 -8
  13. package/README.md +12 -70
  14. package/decorators/index.js +1 -2
  15. package/decorators/withBreakpointManager.d.ts +4 -4
  16. package/decorators/withBreakpointManager.js +37 -75
  17. package/decorators/withBreakpointObserver.d.ts +2 -2
  18. package/decorators/withBreakpointObserver.js +54 -77
  19. package/decorators/withDrag.d.ts +3 -3
  20. package/decorators/withDrag.js +17 -41
  21. package/decorators/withExtraConfig.d.ts +3 -3
  22. package/decorators/withExtraConfig.js +2 -24
  23. package/decorators/withIntersectionObserver.d.ts +2 -2
  24. package/decorators/withIntersectionObserver.js +17 -56
  25. package/decorators/withMountWhenInView.d.ts +3 -3
  26. package/decorators/withMountWhenInView.js +23 -51
  27. package/helpers/createApp.d.ts +3 -3
  28. package/helpers/createApp.js +10 -12
  29. package/helpers/importOnInteraction.d.ts +3 -3
  30. package/helpers/importOnInteraction.js +7 -8
  31. package/helpers/importWhenIdle.d.ts +3 -3
  32. package/helpers/importWhenIdle.js +7 -8
  33. package/helpers/importWhenVisible.d.ts +3 -3
  34. package/helpers/importWhenVisible.js +9 -16
  35. package/helpers/index.d.ts +1 -3
  36. package/helpers/index.js +1 -4
  37. package/helpers/utils.js +1 -2
  38. package/index.d.ts +14 -4
  39. package/index.js +4 -4
  40. package/index.modern.js +1 -2
  41. package/index.umd.js +1 -2
  42. package/package.json +4 -6
  43. package/services/Service.js +48 -67
  44. package/services/drag.js +143 -179
  45. package/services/index.js +1 -2
  46. package/services/key.js +55 -97
  47. package/services/load.d.ts +1 -1
  48. package/services/load.js +21 -50
  49. package/services/pointer.js +117 -156
  50. package/services/raf.js +36 -64
  51. package/services/resize.js +47 -86
  52. package/services/scroll.js +81 -120
  53. package/utils/collide/boundingRectToCircle.js +7 -6
  54. package/utils/collide/collideCircleCircle.js +1 -2
  55. package/utils/collide/collideCircleRect.js +1 -2
  56. package/utils/collide/collidePointCircle.js +1 -2
  57. package/utils/collide/collidePointRect.js +1 -2
  58. package/utils/collide/collideRectRect.js +1 -2
  59. package/utils/collide/index.js +1 -2
  60. package/utils/css/classes.js +2 -3
  61. package/utils/css/index.js +1 -2
  62. package/utils/css/matrix.js +1 -2
  63. package/utils/css/styles.js +3 -8
  64. package/utils/css/transition.js +67 -140
  65. package/utils/debounce.js +3 -4
  66. package/utils/focusTrap.js +4 -5
  67. package/utils/history.js +13 -20
  68. package/utils/index.d.ts +2 -1
  69. package/utils/index.js +2 -2
  70. package/utils/keyCodes.js +1 -2
  71. package/utils/math/clamp.js +1 -2
  72. package/utils/math/clamp01.js +1 -2
  73. package/utils/math/damp.js +1 -2
  74. package/utils/math/index.js +1 -2
  75. package/utils/math/inertiaFinalValue.js +1 -2
  76. package/utils/math/lerp.js +1 -2
  77. package/utils/math/map.js +1 -2
  78. package/utils/math/round.js +1 -2
  79. package/utils/memoize.d.ts +30 -0
  80. package/utils/memoize.js +30 -0
  81. package/utils/nextFrame.js +4 -9
  82. package/utils/object/autoBind.js +11 -19
  83. package/utils/object/getAllProperties.js +3 -11
  84. package/utils/object/index.js +1 -2
  85. package/utils/object/isObject.js +2 -4
  86. package/utils/string/index.js +1 -2
  87. package/utils/string/withLeadingCharacters.js +1 -2
  88. package/utils/string/withLeadingSlash.js +1 -2
  89. package/utils/string/withTrailingCharacters.js +1 -2
  90. package/utils/string/withTrailingSlash.js +1 -2
  91. package/utils/string/withoutLeadingCharacters.js +1 -2
  92. package/utils/string/withoutLeadingCharactersRecursive.js +1 -2
  93. package/utils/string/withoutLeadingSlash.js +1 -2
  94. package/utils/string/withoutTrailingCharacters.js +1 -2
  95. package/utils/string/withoutTrailingCharactersRecursive.js +1 -2
  96. package/utils/string/withoutTrailingSlash.js +1 -2
  97. package/utils/throttle.js +2 -3
  98. package/Base/index.js.map +0 -1
  99. package/Base/managers/ChildrenManager.js.map +0 -1
  100. package/Base/managers/EventsManager.js.map +0 -1
  101. package/Base/managers/OptionsManager.js.map +0 -1
  102. package/Base/managers/RefsManager.js.map +0 -1
  103. package/Base/managers/ServicesManager.js.map +0 -1
  104. package/Base/utils.js.map +0 -1
  105. package/components/Accordion/Accordion.d.ts +0 -83
  106. package/components/Accordion/Accordion.js +0 -121
  107. package/components/Accordion/Accordion.js.map +0 -1
  108. package/components/Accordion/AccordionItem.d.ts +0 -122
  109. package/components/Accordion/AccordionItem.js +0 -327
  110. package/components/Accordion/AccordionItem.js.map +0 -1
  111. package/components/Accordion/index.d.ts +0 -27
  112. package/components/Accordion/index.js +0 -39
  113. package/components/Accordion/index.js.map +0 -1
  114. package/components/Cursor.d.ts +0 -138
  115. package/components/Cursor.js +0 -167
  116. package/components/Cursor.js.map +0 -1
  117. package/components/Draggable.d.ts +0 -49
  118. package/components/Draggable.js +0 -77
  119. package/components/Draggable.js.map +0 -1
  120. package/components/Modal.d.ts +0 -158
  121. package/components/Modal.js +0 -270
  122. package/components/Modal.js.map +0 -1
  123. package/components/Tabs.d.ts +0 -108
  124. package/components/Tabs.js +0 -195
  125. package/components/Tabs.js.map +0 -1
  126. package/components/index.d.ts +0 -6
  127. package/components/index.js +0 -7
  128. package/components/index.js.map +0 -1
  129. package/decorators/index.js.map +0 -1
  130. package/decorators/withBreakpointManager.js.map +0 -1
  131. package/decorators/withBreakpointObserver.js.map +0 -1
  132. package/decorators/withDrag.js.map +0 -1
  133. package/decorators/withExtraConfig.js.map +0 -1
  134. package/decorators/withIntersectionObserver.js.map +0 -1
  135. package/decorators/withMountWhenInView.js.map +0 -1
  136. package/helpers/createApp.js.map +0 -1
  137. package/helpers/createBase.d.ts +0 -7
  138. package/helpers/createBase.js +0 -7
  139. package/helpers/createBase.js.map +0 -1
  140. package/helpers/defineComponent.d.ts +0 -11
  141. package/helpers/defineComponent.js +0 -68
  142. package/helpers/defineComponent.js.map +0 -1
  143. package/helpers/importOnInteraction.js.map +0 -1
  144. package/helpers/importWhenIdle.js.map +0 -1
  145. package/helpers/importWhenVisible.js.map +0 -1
  146. package/helpers/index.js.map +0 -1
  147. package/helpers/utils.js.map +0 -1
  148. package/index.js.map +0 -1
  149. package/index.modern.js.map +0 -1
  150. package/index.umd.js.map +0 -1
  151. package/services/Service.js.map +0 -1
  152. package/services/drag.js.map +0 -1
  153. package/services/index.js.map +0 -1
  154. package/services/key.js.map +0 -1
  155. package/services/load.js.map +0 -1
  156. package/services/pointer.js.map +0 -1
  157. package/services/raf.js.map +0 -1
  158. package/services/resize.js.map +0 -1
  159. package/services/scroll.js.map +0 -1
  160. package/utils/collide/boundingRectToCircle.js.map +0 -1
  161. package/utils/collide/collideCircleCircle.js.map +0 -1
  162. package/utils/collide/collideCircleRect.js.map +0 -1
  163. package/utils/collide/collidePointCircle.js.map +0 -1
  164. package/utils/collide/collidePointRect.js.map +0 -1
  165. package/utils/collide/collideRectRect.js.map +0 -1
  166. package/utils/collide/index.js.map +0 -1
  167. package/utils/css/classes.js.map +0 -1
  168. package/utils/css/index.js.map +0 -1
  169. package/utils/css/matrix.js.map +0 -1
  170. package/utils/css/styles.js.map +0 -1
  171. package/utils/css/transition.js.map +0 -1
  172. package/utils/debounce.js.map +0 -1
  173. package/utils/focusTrap.js.map +0 -1
  174. package/utils/history.js.map +0 -1
  175. package/utils/index.js.map +0 -1
  176. package/utils/keyCodes.js.map +0 -1
  177. package/utils/math/clamp.js.map +0 -1
  178. package/utils/math/clamp01.js.map +0 -1
  179. package/utils/math/damp.js.map +0 -1
  180. package/utils/math/index.js.map +0 -1
  181. package/utils/math/inertiaFinalValue.js.map +0 -1
  182. package/utils/math/lerp.js.map +0 -1
  183. package/utils/math/map.js.map +0 -1
  184. package/utils/math/round.js.map +0 -1
  185. package/utils/nextFrame.js.map +0 -1
  186. package/utils/object/autoBind.js.map +0 -1
  187. package/utils/object/getAllProperties.js.map +0 -1
  188. package/utils/object/index.js.map +0 -1
  189. package/utils/object/isObject.js.map +0 -1
  190. package/utils/string/index.js.map +0 -1
  191. package/utils/string/withLeadingCharacters.js.map +0 -1
  192. package/utils/string/withLeadingSlash.js.map +0 -1
  193. package/utils/string/withTrailingCharacters.js.map +0 -1
  194. package/utils/string/withTrailingSlash.js.map +0 -1
  195. package/utils/string/withoutLeadingCharacters.js.map +0 -1
  196. package/utils/string/withoutLeadingCharactersRecursive.js.map +0 -1
  197. package/utils/string/withoutLeadingSlash.js.map +0 -1
  198. package/utils/string/withoutTrailingCharacters.js.map +0 -1
  199. package/utils/string/withoutTrailingCharactersRecursive.js.map +0 -1
  200. package/utils/string/withoutTrailingSlash.js.map +0 -1
  201. package/utils/throttle.js.map +0 -1
@@ -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
2
  * @typedef {import('../Base').default} Base
3
- * @typedef {import('../Base').BaseComponent} BaseComponent
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
17
  export default function withDrag<T extends typeof import("../Base").default>(BaseClass: T, options?: DragDecoratorOptions): T;
18
18
  export type Base = import('../Base').default;
19
- export type BaseComponent = import('../Base').BaseComponent;
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,12 +1,12 @@
1
1
  /**
2
2
  * @typedef {import('deepmerge').Options} DeepmergeOptions
3
3
  * @typedef {import('../Base').BaseConfig} BaseConfig
4
- * @typedef {import('../Base').BaseComponent} BaseComponent
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}
@@ -15,4 +15,4 @@
15
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
17
  export type BaseConfig = import('../Base').BaseConfig;
18
- export type BaseComponent = import('../Base').BaseComponent;
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,7 +1,7 @@
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 }}}
@@ -12,7 +12,7 @@ export default function withIntersectionObserver<T extends typeof import("../Bas
12
12
  };
13
13
  };
14
14
  export type Base = import('../Base').default;
15
- export type BaseComponent = import('../Base').BaseComponent;
15
+ export type BaseConstructor = import('../Base').BaseConstructor;
16
16
  export type WithIntersectionObserverOptions = {
17
17
  intersectionObserver: any;
18
18
  };
@@ -1,25 +1,11 @@
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 _get from "@babel/runtime/helpers/get";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
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
  function createArrayOfNumber(length) {
20
- return _toConsumableArray(new Array(length + 1)).map(function (val, index) {
21
- return index / length;
22
- });
8
+ return [...new Array(length + 1)].map((val, index) => index / length);
23
9
  }
24
10
 
25
11
  export default function withIntersectionObserver(BaseClass) {
@@ -28,58 +14,33 @@ export default function withIntersectionObserver(BaseClass) {
28
14
  var defaultOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
29
15
  threshold: createArrayOfNumber(100)
30
16
  };
31
- return _temp = _class = function (_BaseClass) {
32
- _inherits(_class, _BaseClass);
33
-
34
- var _super = _createSuper(_class);
35
-
36
- function _class(element) {
37
- var _this;
17
+ return _temp = _class = class extends BaseClass {
18
+ constructor(element) {
19
+ super(element);
38
20
 
39
- _classCallCheck(this, _class);
40
-
41
- _this = _super.call(this, element);
42
-
43
- if (!_this.intersected || typeof _this.intersected !== 'function') {
21
+ if (!this.intersected || typeof this.intersected !== 'function') {
44
22
  throw new Error('[withIntersectionObserver] The `intersected` method must be defined.');
45
23
  }
46
24
 
47
- _this.$observer = new IntersectionObserver(function (entries) {
48
- _this.__debug('intersected', entries);
49
-
50
- _this.$emit('intersected', entries);
51
-
52
- _this.intersected(entries);
53
- }, _objectSpread(_objectSpread({}, defaultOptions), _this.$options.intersectionObserver || {}));
25
+ this.$observer = new IntersectionObserver(entries => {
26
+ this.__debug('intersected', entries);
54
27
 
55
- if (_this.$isMounted) {
56
- _this.$observer.observe(_this.$el);
57
- }
58
-
59
- _this.$on('mounted', function () {
60
- _this.$observer.observe(_this.$el);
28
+ this.$emit('intersected', entries);
29
+ this.intersected(entries);
30
+ }, _objectSpread(_objectSpread({}, defaultOptions), this.$options.intersectionObserver || {}));
31
+ this.$on('mounted', () => {
32
+ this.$observer.observe(this.$el);
61
33
  });
62
-
63
- _this.$on('destroyed', function () {
64
- _this.$observer.unobserve(_this.$el);
34
+ this.$on('destroyed', () => {
35
+ this.$observer.unobserve(this.$el);
65
36
  });
66
-
67
- return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
37
+ return this;
68
38
  }
69
39
 
70
- _createClass(_class, [{
71
- key: "__excludeFromAutoBind",
72
- get: function get() {
73
- return [].concat(_toConsumableArray(_get(_getPrototypeOf(_class.prototype), "__excludeFromAutoBind", this) || []), ['intersected']);
74
- }
75
- }]);
76
-
77
- return _class;
78
- }(BaseClass), _defineProperty(_class, "config", _objectSpread(_objectSpread({}, BaseClass.config || {}), {}, {
40
+ }, _defineProperty(_class, "config", _objectSpread(_objectSpread({}, BaseClass.config || {}), {}, {
79
41
  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 : '', "WithIntersectionObserver"),
80
42
  options: _objectSpread(_objectSpread({}, (BaseClass === null || BaseClass === void 0 ? void 0 : (_BaseClass$config2 = BaseClass.config) === null || _BaseClass$config2 === void 0 ? void 0 : _BaseClass$config2.options) || {}), {}, {
81
43
  intersectionObserver: Object
82
44
  })
83
45
  })), _temp;
84
- }
85
- //# sourceMappingURL=withIntersectionObserver.js.map
46
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @typedef {import('../Base').default} Base
3
3
  * @typedef {import('../Base').BaseOptions} BaseOptions
4
- * @typedef {import('../Base').BaseComponent} BaseComponent
4
+ * @typedef {import('../Base').BaseConstructor} BaseConstructor
5
5
  */
6
6
  /**
7
7
  * @typedef {Object} WithMountWhenInViewOptions
@@ -15,7 +15,7 @@
15
15
  /**
16
16
  * IntersectionObserver decoration.
17
17
  *
18
- * @template {BaseComponent} T
18
+ * @template {BaseConstructor} T
19
19
  * @param {T} BaseClass The Base class to extend.
20
20
  * @param {Object} [defaultOptions] The options for the IntersectionObserver instance.
21
21
  * @return {T}
@@ -23,7 +23,7 @@
23
23
  export default function withMountWhenInView<T extends typeof import("../Base").default>(BaseClass: T, defaultOptions?: any): T;
24
24
  export type Base = import('../Base').default;
25
25
  export type BaseOptions = import('../Base').BaseOptions;
26
- export type BaseComponent = import('../Base').BaseComponent;
26
+ export type BaseConstructor = import('../Base').BaseConstructor;
27
27
  export type WithMountWhenInViewOptions = {
28
28
  intersectionObserver: any;
29
29
  };
@@ -1,10 +1,3 @@
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
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
2
  import _classPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
10
3
  import _classPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
@@ -13,78 +6,57 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
13
6
 
14
7
  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; }
15
8
 
16
- 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); }; }
17
-
18
- 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; } }
19
-
20
9
  export default function withMountWhenInView(BaseClass) {
21
10
  var _class, _isVisible, _observer, _temp, _BaseClass$config$nam, _BaseClass$config, _BaseClass$config2;
22
11
 
23
12
  var defaultOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
24
13
  threshold: [0, 1]
25
14
  };
26
- return _temp = (_isVisible = new WeakMap(), _observer = new WeakMap(), _class = function (_BaseClass) {
27
- _inherits(_class, _BaseClass);
28
-
29
- var _super = _createSuper(_class);
30
-
31
- function _class(element) {
32
- var _this;
33
-
34
- _classCallCheck(this, _class);
35
-
36
- _this = _super.call(this, element);
15
+ return _temp = (_isVisible = new WeakMap(), _observer = new WeakMap(), _class = class extends BaseClass {
16
+ constructor(element) {
17
+ super(element);
37
18
 
38
- _isVisible.set(_assertThisInitialized(_this), {
19
+ _isVisible.set(this, {
39
20
  writable: true,
40
21
  value: false
41
22
  });
42
23
 
43
- _observer.set(_assertThisInitialized(_this), {
24
+ _observer.set(this, {
44
25
  writable: true,
45
26
  value: void 0
46
27
  });
47
28
 
48
- _classPrivateFieldSet(_assertThisInitialized(_this), _observer, new IntersectionObserver(function (entries) {
49
- var isVisible = entries.reduce(function (acc, entry) {
50
- return acc || entry.isIntersecting;
51
- }, false);
29
+ _classPrivateFieldSet(this, _observer, new IntersectionObserver(entries => {
30
+ var isVisible = entries.reduce((acc, entry) => acc || entry.isIntersecting, false);
52
31
 
53
- if (_classPrivateFieldGet(_assertThisInitialized(_this), _isVisible) !== isVisible) {
54
- _classPrivateFieldSet(_assertThisInitialized(_this), _isVisible, isVisible);
32
+ if (_classPrivateFieldGet(this, _isVisible) !== isVisible) {
33
+ _classPrivateFieldSet(this, _isVisible, isVisible);
55
34
 
56
35
  var method = isVisible ? '$mount' : '$destroy';
57
-
58
- _this[method]();
36
+ this[method]();
59
37
  }
60
- }, _objectSpread(_objectSpread({}, defaultOptions), _this.$options.intersectionObserver)));
38
+ }, _objectSpread(_objectSpread({}, defaultOptions), this.$options.intersectionObserver)));
61
39
 
62
- _classPrivateFieldGet(_assertThisInitialized(_this), _observer).observe(_this.$el);
40
+ _classPrivateFieldGet(this, _observer).observe(this.$el);
63
41
 
64
- _this.$on('terminated', function () {
65
- _classPrivateFieldGet(_assertThisInitialized(_this), _observer).disconnect();
42
+ this.$on('terminated', () => {
43
+ _classPrivateFieldGet(this, _observer).disconnect();
66
44
  });
67
-
68
- return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
45
+ return this;
69
46
  }
70
47
 
71
- _createClass(_class, [{
72
- key: "$mount",
73
- value: function $mount() {
74
- if (_classPrivateFieldGet(this, _isVisible)) {
75
- _get(_getPrototypeOf(_class.prototype), "$mount", this).call(this);
76
- }
77
-
78
- return this;
48
+ $mount() {
49
+ if (_classPrivateFieldGet(this, _isVisible)) {
50
+ super.$mount();
79
51
  }
80
- }]);
81
52
 
82
- return _class;
83
- }(BaseClass)), _defineProperty(_class, "config", _objectSpread(_objectSpread({}, BaseClass.config || {}), {}, {
53
+ return this;
54
+ }
55
+
56
+ }), _defineProperty(_class, "config", _objectSpread(_objectSpread({}, BaseClass.config || {}), {}, {
84
57
  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 : '', "WithMountWhenInView"),
85
58
  options: _objectSpread(_objectSpread({}, (BaseClass === null || BaseClass === void 0 ? void 0 : (_BaseClass$config2 = BaseClass.config) === null || _BaseClass$config2 === void 0 ? void 0 : _BaseClass$config2.options) || {}), {}, {
86
59
  intersectionObserver: Object
87
60
  })
88
61
  })), _temp;
89
- }
90
- //# sourceMappingURL=withMountWhenInView.js.map
62
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @typedef {import('../Base/index.js').BaseComponent} BaseComponent
2
+ * @typedef {import('../Base/index.js').BaseConstructor} BaseConstructor
3
3
  */
4
4
  /**
5
5
  * Instantiate and mount the given component on the given root element when the page has been loaded
@@ -26,7 +26,7 @@
26
26
  * console.log(app.$options.name); // 'App'
27
27
  * ```
28
28
  *
29
- * @template {BaseComponent} T
29
+ * @template {BaseConstructor} T
30
30
  * @param {T} App
31
31
  * @param {HTMLElement} rootElement
32
32
  *
@@ -34,4 +34,4 @@
34
34
  *
35
35
  */
36
36
  export default function createApp<T extends typeof import("../Base/index.js").default>(App: T, rootElement: HTMLElement): () => Promise<InstanceType<T>>;
37
- export type BaseComponent = import('../Base/index.js').BaseComponent;
37
+ export type BaseConstructor = import('../Base/index.js').BaseConstructor;