@studiometa/js-toolkit 2.0.0-rc.2 → 2.0.0

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 (101) hide show
  1. package/Base/index.cjs +1 -2
  2. package/Base/index.d.ts +25 -26
  3. package/Base/index.js +1 -2
  4. package/Base/managers/ChildrenManager.d.ts +2 -2
  5. package/Base/managers/EventsManager.d.ts +13 -20
  6. package/Base/managers/OptionsManager.cjs +0 -1
  7. package/Base/managers/OptionsManager.d.ts +13 -10
  8. package/Base/managers/OptionsManager.js +0 -1
  9. package/Base/managers/RefsManager.d.ts +4 -4
  10. package/Base/managers/ServicesManager.cjs +3 -0
  11. package/Base/managers/ServicesManager.d.ts +14 -8
  12. package/Base/managers/ServicesManager.js +3 -0
  13. package/Base/utils.d.ts +4 -4
  14. package/decorators/withBreakpointManager.cjs +0 -1
  15. package/decorators/withBreakpointManager.d.ts +2 -2
  16. package/decorators/withBreakpointManager.js +0 -1
  17. package/decorators/withBreakpointObserver.cjs +1 -2
  18. package/decorators/withBreakpointObserver.d.ts +1 -1
  19. package/decorators/withBreakpointObserver.js +1 -2
  20. package/decorators/withDrag.d.ts +1 -1
  21. package/decorators/withExtraConfig.d.ts +1 -1
  22. package/decorators/withFreezedOptions.d.ts +1 -1
  23. package/decorators/withIntersectionObserver.cjs +0 -1
  24. package/decorators/withIntersectionObserver.d.ts +1 -1
  25. package/decorators/withIntersectionObserver.js +0 -1
  26. package/decorators/withMountWhenInView.cjs +0 -1
  27. package/decorators/withMountWhenInView.d.ts +1 -1
  28. package/decorators/withMountWhenInView.js +0 -1
  29. package/decorators/withScrolledInView.d.ts +1 -1
  30. package/helpers/createApp.d.ts +3 -26
  31. package/helpers/getInstanceFromElement.cjs +32 -0
  32. package/helpers/getInstanceFromElement.d.ts +14 -0
  33. package/helpers/getInstanceFromElement.js +10 -0
  34. package/helpers/importOnInteraction.d.ts +3 -5
  35. package/helpers/importWhenIdle.d.ts +3 -5
  36. package/helpers/importWhenVisible.d.ts +4 -6
  37. package/helpers/index.cjs +2 -0
  38. package/helpers/index.d.ts +1 -0
  39. package/helpers/index.js +8 -6
  40. package/helpers/utils.d.ts +3 -4
  41. package/package.json +1 -1
  42. package/services/Service.d.ts +9 -9
  43. package/services/drag.cjs +0 -1
  44. package/services/drag.d.ts +3 -3
  45. package/services/drag.js +0 -1
  46. package/services/key.d.ts +1 -1
  47. package/services/load.d.ts +1 -1
  48. package/services/pointer.d.ts +1 -1
  49. package/services/raf.d.ts +1 -1
  50. package/services/resize.cjs +2 -2
  51. package/services/resize.d.ts +1 -1
  52. package/services/resize.js +2 -2
  53. package/services/scroll.d.ts +1 -1
  54. package/utils/collide/boundingRectToCircle.d.ts +5 -5
  55. package/utils/collide/collideCircleCircle.d.ts +4 -4
  56. package/utils/collide/collideCircleRect.d.ts +8 -8
  57. package/utils/collide/collidePointCircle.d.ts +6 -6
  58. package/utils/collide/collidePointRect.d.ts +7 -7
  59. package/utils/collide/collideRectRect.d.ts +5 -5
  60. package/utils/css/classes.cjs +3 -3
  61. package/utils/css/classes.d.ts +10 -10
  62. package/utils/css/classes.js +3 -3
  63. package/utils/css/matrix.d.ts +14 -15
  64. package/utils/css/styles.d.ts +2 -2
  65. package/utils/css/transition.d.ts +2 -2
  66. package/utils/debounce.d.ts +4 -4
  67. package/utils/focusTrap.cjs +1 -1
  68. package/utils/focusTrap.d.ts +1 -0
  69. package/utils/focusTrap.js +1 -1
  70. package/utils/history.d.ts +13 -11
  71. package/utils/math/clamp.d.ts +1 -1
  72. package/utils/math/clamp01.d.ts +1 -1
  73. package/utils/math/damp.d.ts +6 -6
  74. package/utils/math/ease.d.ts +7 -7
  75. package/utils/math/inertiaFinalValue.d.ts +5 -5
  76. package/utils/math/lerp.d.ts +4 -4
  77. package/utils/math/map.d.ts +6 -6
  78. package/utils/math/round.d.ts +4 -4
  79. package/utils/memoize.d.ts +1 -1
  80. package/utils/nextFrame.d.ts +3 -4
  81. package/utils/nextMicrotask.d.ts +1 -1
  82. package/utils/nextTick.d.ts +1 -1
  83. package/utils/object/autoBind.d.ts +3 -3
  84. package/utils/object/getAllProperties.d.ts +3 -3
  85. package/utils/object/isObject.d.ts +1 -1
  86. package/utils/scrollTo.cjs +1 -1
  87. package/utils/scrollTo.d.ts +1 -1
  88. package/utils/scrollTo.js +1 -1
  89. package/utils/string/withLeadingCharacters.d.ts +3 -2
  90. package/utils/string/withLeadingSlash.d.ts +1 -1
  91. package/utils/string/withTrailingCharacters.d.ts +3 -2
  92. package/utils/string/withTrailingSlash.d.ts +1 -1
  93. package/utils/string/withoutLeadingCharacters.d.ts +3 -2
  94. package/utils/string/withoutLeadingCharactersRecursive.d.ts +3 -2
  95. package/utils/string/withoutLeadingSlash.d.ts +1 -1
  96. package/utils/string/withoutTrailingCharacters.d.ts +3 -2
  97. package/utils/string/withoutTrailingCharactersRecursive.d.ts +3 -2
  98. package/utils/string/withoutTrailingSlash.d.ts +1 -1
  99. package/utils/throttle.cjs +1 -1
  100. package/utils/throttle.d.ts +3 -3
  101. package/utils/throttle.js +1 -1
@@ -47,7 +47,6 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
47
47
  this.$on("destroyed", () => {
48
48
  this.$observer.unobserve(this.$el);
49
49
  });
50
- return this;
51
50
  }
52
51
  }, __publicField(_b, "config", {
53
52
  ...BaseClass.config,
@@ -4,7 +4,7 @@
4
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
- * @return {T & { new: (element:HTMLElement) => { $observer: IntersectionObserver }}}
7
+ * @returns {T & { new: (element:HTMLElement) => { $observer: IntersectionObserver }}}
8
8
  */
9
9
  export default function withIntersectionObserver<T extends typeof import("../Base").default>(BaseClass: T, defaultOptions?: any): T & {
10
10
  new: (element: HTMLElement) => {
@@ -24,7 +24,6 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
24
24
  this.$on("destroyed", () => {
25
25
  this.$observer.unobserve(this.$el);
26
26
  });
27
- return this;
28
27
  }
29
28
  }, __publicField(_b, "config", {
30
29
  ...BaseClass.config,
@@ -49,7 +49,6 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
49
49
  this.$on("terminated", () => {
50
50
  this.__observer.disconnect();
51
51
  });
52
- return this;
53
52
  }
54
53
  $mount() {
55
54
  if (this.__isVisible) {
@@ -18,7 +18,7 @@
18
18
  * @template {BaseConstructor} T
19
19
  * @param {T} BaseClass The Base class to extend.
20
20
  * @param {IntersectionObserverInit} [defaultOptions] The options for the IntersectionObserver instance.
21
- * @return {T}
21
+ * @returns {T}
22
22
  */
23
23
  export default function withMountWhenInView<T extends typeof import("../Base").default>(BaseClass: T, defaultOptions?: IntersectionObserverInit): T;
24
24
  export type Base = import('../Base').default;
@@ -26,7 +26,6 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
26
26
  this.$on("terminated", () => {
27
27
  this.__observer.disconnect();
28
28
  });
29
- return this;
30
29
  }
31
30
  $mount() {
32
31
  if (this.__isVisible) {
@@ -9,7 +9,7 @@
9
9
  * @template {BaseConstructor} T
10
10
  * @param {T} BaseClass
11
11
  * @param {IntersectionObserverInit} options
12
- * @return {T}
12
+ * @returns {T}
13
13
  */
14
14
  export default function withScrolledInView<T extends typeof import("../Base").default>(BaseClass: T, options: IntersectionObserverInit): T;
15
15
  export type Base = import('../Base').default;
@@ -5,33 +5,10 @@
5
5
  * Instantiate and mount the given component on the given root element when the page has been loaded
6
6
  * and return a function to use the app instance when it is ready.
7
7
  *
8
- * @usage
9
- * ```js
10
- * // app.js
11
- * import Base, { createApp } from '@studiometa/js-toolkit';
12
- *
13
- * class App extends Base {
14
- * static config = {
15
- * name: 'App',
16
- * }
17
- * }
18
- *
19
- * export default createApp(App, document.body);
20
- * ```
21
- * ```js
22
- * // other.js
23
- * import useApp from './app.js';
24
- *
25
- * const app = await useApp();
26
- * console.log(app.$options.name); // 'App'
27
- * ```
28
- *
29
8
  * @template {BaseConstructor} T
30
9
  * @param {T} App
31
- * @param {HTMLElement=} [rootElement]
32
- *
33
- * @return {() => Promise<InstanceType<T>>}
34
- *
10
+ * @param {HTMLElement} [rootElement]
11
+ * @returns {() => Promise<InstanceType<T>>}
35
12
  */
36
- export default function createApp<T extends typeof import("../Base/index.js").default>(App: T, rootElement?: HTMLElement | undefined): () => Promise<InstanceType<T>>;
13
+ export default function createApp<T extends typeof import("../Base/index.js").default>(App: T, rootElement?: HTMLElement): () => Promise<InstanceType<T>>;
37
14
  export type BaseConstructor = import('../Base/index.js').BaseConstructor;
@@ -0,0 +1,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/js-toolkit/helpers/getInstanceFromElement.js
20
+ var getInstanceFromElement_exports = {};
21
+ __export(getInstanceFromElement_exports, {
22
+ default: () => getInstanceFromElement
23
+ });
24
+ module.exports = __toCommonJS(getInstanceFromElement_exports);
25
+ function getInstanceFromElement(element, Constructor) {
26
+ var _a;
27
+ if (!element.__base__) {
28
+ return null;
29
+ }
30
+ return (_a = element.__base__.get(Constructor)) != null ? _a : null;
31
+ }
32
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @typedef {import('../Base/index.js').BaseConstructor} BaseConstructor
3
+ */
4
+ /**
5
+ * Get a component instance from a DOM element.
6
+ * @template {BaseConstructor} T
7
+ * @param {HTMLElement & { __base__?: WeakMap<T, InstanceType<T>> }} element
8
+ * @param {T} Constructor
9
+ * @returns {null|InstanceType<T>}
10
+ */
11
+ export default function getInstanceFromElement<T extends typeof import("../Base/index.js").default>(element: HTMLElement & {
12
+ __base__?: WeakMap<T, InstanceType<T>>;
13
+ }, Constructor: T): InstanceType<T>;
14
+ export type BaseConstructor = import('../Base/index.js').BaseConstructor;
@@ -0,0 +1,10 @@
1
+ function getInstanceFromElement(element, Constructor) {
2
+ var _a;
3
+ if (!element.__base__) {
4
+ return null;
5
+ }
6
+ return (_a = element.__base__.get(Constructor)) != null ? _a : null;
7
+ }
8
+ export {
9
+ getInstanceFromElement as default
10
+ };
@@ -6,20 +6,18 @@
6
6
  * Import a component on an interaction.
7
7
  *
8
8
  * @template {BaseConstructor} T
9
- *
10
9
  * @param {() => Promise<T|{default:T}>} fn
11
10
  * The import function.
12
11
  * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement
13
12
  * The name or selector for the component.
14
13
  * @param {string|string[]} events
15
14
  * The events to listen to to trigger the import.
16
- * @param {Base=} [parent]
15
+ * @param {Base} [parent]
17
16
  * The parent component.
18
- *
19
- * @return {Promise<T>}
17
+ * @returns {Promise<T>}
20
18
  */
21
19
  export default function importOnInteraction<T extends typeof import("../Base/index.js").default>(fn: () => Promise<T | {
22
20
  default: T;
23
- }>, nameOrSelectorOrElement: string | HTMLElement | HTMLElement[], events: string | string[], parent?: Base | undefined): Promise<T>;
21
+ }>, nameOrSelectorOrElement: string | HTMLElement | HTMLElement[], events: string | string[], parent?: Base): Promise<T>;
24
22
  export type BaseConstructor = import('../Base/index.js').BaseConstructor;
25
23
  export type Base = import('../Base/index.js').default;
@@ -6,17 +6,15 @@
6
6
  * Import a component when user is idle.
7
7
  *
8
8
  * @template {BaseConstructor} T
9
- *
10
9
  * @param {() => Promise<T|{default:T}>} fn
11
10
  * The import function.
12
- * @param {ImportWhenIdleOptions=} [options]
11
+ * @param {ImportWhenIdleOptions} [options]
13
12
  * The time to wait before triggering the callback if never idle.
14
- *
15
- * @return {Promise<T>}
13
+ * @returns {Promise<T>}
16
14
  */
17
15
  export default function importWhenIdle<T extends typeof import("../Base/index.js").default>(fn: () => Promise<T | {
18
16
  default: T;
19
- }>, options?: ImportWhenIdleOptions | undefined): Promise<T>;
17
+ }>, options?: ImportWhenIdleOptions): Promise<T>;
20
18
  export type BaseConstructor = import('../Base/index.js').BaseConstructor;
21
19
  export type ImportWhenIdleOptions = {
22
20
  timeout?: number;
@@ -6,20 +6,18 @@
6
6
  * Import a component when it is visible.
7
7
  *
8
8
  * @template {BaseConstructor} T
9
- *
10
9
  * @param {() => Promise<T|{default:T}>} fn
11
10
  * The import function.
12
11
  * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement
13
12
  * The name or selector for the component.
14
- * @param {Base=} [parent]
13
+ * @param {Base} [parent]
15
14
  * The parent component.
16
- * @param {IntersectionObserverInit=} [observerOptions]
15
+ * @param {IntersectionObserverInit} [observerOptions]
17
16
  * Options for the `IntersectionObserver` instance.
18
- *
19
- * @return {Promise<T>}
17
+ * @returns {Promise<T>}
20
18
  */
21
19
  export default function importWhenVisible<T extends typeof import("../Base/index.js").default>(fn: () => Promise<T | {
22
20
  default: T;
23
- }>, nameOrSelectorOrElement: string | HTMLElement | HTMLElement[], parent?: Base | undefined, observerOptions?: IntersectionObserverInit | undefined): Promise<T>;
21
+ }>, nameOrSelectorOrElement: string | HTMLElement | HTMLElement[], parent?: Base, observerOptions?: IntersectionObserverInit): Promise<T>;
24
22
  export type Base = import('../Base/index.js').default;
25
23
  export type BaseConstructor = import('../Base/index.js').BaseConstructor;
package/helpers/index.cjs CHANGED
@@ -23,12 +23,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
23
23
  var helpers_exports = {};
24
24
  __export(helpers_exports, {
25
25
  createApp: () => import_createApp.default,
26
+ getInstanceFromElement: () => import_getInstanceFromElement.default,
26
27
  importOnInteraction: () => import_importOnInteraction.default,
27
28
  importWhenIdle: () => import_importWhenIdle.default,
28
29
  importWhenVisible: () => import_importWhenVisible.default
29
30
  });
30
31
  module.exports = __toCommonJS(helpers_exports);
31
32
  var import_createApp = __toESM(require("./createApp.cjs"), 1);
33
+ var import_getInstanceFromElement = __toESM(require("./getInstanceFromElement.cjs"), 1);
32
34
  var import_importOnInteraction = __toESM(require("./importOnInteraction.cjs"), 1);
33
35
  var import_importWhenIdle = __toESM(require("./importWhenIdle.cjs"), 1);
34
36
  var import_importWhenVisible = __toESM(require("./importWhenVisible.cjs"), 1);
@@ -1,4 +1,5 @@
1
1
  export { default as createApp } from "./createApp.js";
2
+ export { default as getInstanceFromElement } from "./getInstanceFromElement.js";
2
3
  export { default as importOnInteraction } from "./importOnInteraction.js";
3
4
  export { default as importWhenIdle } from "./importWhenIdle.js";
4
5
  export { default as importWhenVisible } from "./importWhenVisible.js";
package/helpers/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { default as default2 } from "./createApp.js";
2
- import { default as default3 } from "./importOnInteraction.js";
3
- import { default as default4 } from "./importWhenIdle.js";
4
- import { default as default5 } from "./importWhenVisible.js";
2
+ import { default as default3 } from "./getInstanceFromElement.js";
3
+ import { default as default4 } from "./importOnInteraction.js";
4
+ import { default as default5 } from "./importWhenIdle.js";
5
+ import { default as default6 } from "./importWhenVisible.js";
5
6
  export {
6
7
  default2 as createApp,
7
- default3 as importOnInteraction,
8
- default4 as importWhenIdle,
9
- default5 as importWhenVisible
8
+ default3 as getInstanceFromElement,
9
+ default4 as importOnInteraction,
10
+ default5 as importWhenIdle,
11
+ default6 as importWhenVisible
10
12
  };
@@ -3,9 +3,8 @@
3
3
  *
4
4
  * @param {string|HTMLElement|HTMLElement[]} nameOrSelectorOrElement
5
5
  * The original selector or element, or list of elements.
6
- * @param {HTMLElement=} [context]
6
+ * @param {HTMLElement} [context]
7
7
  * The optional context to use to query for elements.
8
- *
9
- * @return {HTMLElement[]} A normalized list of elements.
8
+ * @returns {HTMLElement[]} A normalized list of elements.
10
9
  */
11
- export function getTargetElements(nameOrSelectorOrElement: string | HTMLElement | HTMLElement[], context?: HTMLElement | undefined): HTMLElement[];
10
+ export function getTargetElements(nameOrSelectorOrElement: string | HTMLElement | HTMLElement[], context?: HTMLElement): HTMLElement[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiometa/js-toolkit",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.0.0",
4
4
  "description": "A set of useful little bits of JavaScript to boost your project! 🚀",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,43 +13,43 @@ export default class Service {
13
13
  * This method MUST be implemented by the service extending this class.
14
14
  *
15
15
  * @param {...any} args
16
- * @return {this['props']}
16
+ * @returns {this['props']}
17
17
  */
18
18
  updateProps(...args: any[]): unknown;
19
19
  /**
20
20
  * Method to initialize the service behaviors.
21
21
  * This method MUST be implemented by the service extending this class.
22
22
  *
23
- * @return {void}
23
+ * @returns {void}
24
24
  */
25
25
  init(): void;
26
26
  /**
27
27
  * Method to kill the service behaviors.
28
28
  * This method MUST be implemented by the service extending this class.
29
29
  *
30
- * @return {void}
30
+ * @returns {void}
31
31
  */
32
32
  kill(): void;
33
33
  /**
34
34
  * Add a callback.
35
35
  *
36
- * @param {String} key The callback's identifier
36
+ * @param {string} key The callback's identifier
37
37
  * @param {Function} callback The callback function
38
- * @return {void}
38
+ * @returns {void}
39
39
  */
40
40
  add(key: string, callback: Function): void;
41
41
  /**
42
42
  * Test if a callback with the given key has already been added.
43
43
  *
44
- * @param {String} key The identifier to test
45
- * @return {Boolean} Whether or not the identifier already exists
44
+ * @param {string} key The identifier to test
45
+ * @returns {boolean} Whether or not the identifier already exists
46
46
  */
47
47
  has(key: string): boolean;
48
48
  /**
49
49
  * Get the callback tied to the given key.
50
50
  *
51
51
  * @param {string} key The identifier to get
52
- * @return {Function} The callback function
52
+ * @returns {Function} The callback function
53
53
  */
54
54
  get(key: string): Function;
55
55
  /**
@@ -62,7 +62,7 @@ export default class Service {
62
62
  * Trigger each added callback with the given arguments.
63
63
  *
64
64
  * @param {...any} args All the arguments to apply to the callback
65
- * @return {this} The current instance
65
+ * @returns {this} The current instance
66
66
  */
67
67
  trigger(...args: any[]): this;
68
68
  }
package/services/drag.cjs CHANGED
@@ -80,7 +80,6 @@ var Drag = class extends import_Service.default {
80
80
  this.options = { ...this.options, ...options };
81
81
  this.pointerHandler = this.pointerHandler.bind(this);
82
82
  this.rafHandler = this.rafHandler.bind(this);
83
- return this;
84
83
  }
85
84
  init() {
86
85
  const options = { passive: true };
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * @param {HTMLElement} target
14
14
  * @param {DragServiceOptions} options
15
- * @return {DragService}
15
+ * @returns {DragService}
16
16
  */
17
17
  export default function useDrag(target: HTMLElement, options: DragServiceOptions): DragService;
18
18
  export type DragService = import('./index').ServiceInterface<DragServiceProps>;
@@ -73,6 +73,6 @@ export type DragServiceProps = {
73
73
  };
74
74
  };
75
75
  export type DragServiceOptions = {
76
- dampFactor?: number | undefined;
77
- dragTreshold?: number | undefined;
76
+ dampFactor?: number;
77
+ dragTreshold?: number;
78
78
  };
package/services/drag.js CHANGED
@@ -54,7 +54,6 @@ class Drag extends Service {
54
54
  this.options = { ...this.options, ...options };
55
55
  this.pointerHandler = this.pointerHandler.bind(this);
56
56
  this.rafHandler = this.rafHandler.bind(this);
57
- return this;
58
57
  }
59
58
  init() {
60
59
  const options = { passive: true };
package/services/key.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * props();
10
10
  * ```
11
11
  *
12
- * @return {KeyService}
12
+ * @returns {KeyService}
13
13
  */
14
14
  export default function useKey(): KeyService;
15
15
  export type KeyService = import('./index').ServiceInterface<KeyServiceProps>;
@@ -9,7 +9,7 @@
9
9
  * props();
10
10
  * ```
11
11
  *
12
- * @return {LoadService}
12
+ * @returns {LoadService}
13
13
  */
14
14
  export default function useLoad(): LoadService;
15
15
  export type LoadService = import('./index').ServiceInterface<LoadServiceProps>;
@@ -10,7 +10,7 @@
10
10
  * ```
11
11
  *
12
12
  * @todo Add element as parameter to get the pointer position relatively from.
13
- * @return {PointerService}
13
+ * @returns {PointerService}
14
14
  */
15
15
  export default function usePointer(): PointerService;
16
16
  export type PointerService = import('./index').ServiceInterface<PointerServiceProps>;
package/services/raf.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * props();
10
10
  * ```
11
11
  *
12
- * @return {RafService}
12
+ * @returns {RafService}
13
13
  */
14
14
  export default function useRaf(): RafService;
15
15
  export type RafService = import('./index').ServiceInterface<RafServiceProps>;
@@ -78,10 +78,10 @@ var Resize = class extends import_Service.default {
78
78
  return document.querySelector("[data-breakpoint]");
79
79
  }
80
80
  get breakpoint() {
81
- return window.getComputedStyle(this.breakpointElement, "::before").getPropertyValue("content").replace(/"/g, "");
81
+ return window.getComputedStyle(this.breakpointElement, "::before").getPropertyValue("content").replaceAll('"', "");
82
82
  }
83
83
  get breakpoints() {
84
- const breakpoints = window.getComputedStyle(this.breakpointElement, "::after").getPropertyValue("content").replace(/"/g, "");
84
+ const breakpoints = window.getComputedStyle(this.breakpointElement, "::after").getPropertyValue("content").replaceAll('"', "");
85
85
  return breakpoints.split(",");
86
86
  }
87
87
  };
@@ -8,7 +8,7 @@
8
8
  * remove(key);
9
9
  * props();
10
10
  * ```
11
- * @return {ResizeService}
11
+ * @returns {ResizeService}
12
12
  */
13
13
  export default function useResize(): ResizeService;
14
14
  export type ResizeService = import('./index').ServiceInterface<ResizeServiceProps>;
@@ -52,10 +52,10 @@ class Resize extends Service {
52
52
  return document.querySelector("[data-breakpoint]");
53
53
  }
54
54
  get breakpoint() {
55
- return window.getComputedStyle(this.breakpointElement, "::before").getPropertyValue("content").replace(/"/g, "");
55
+ return window.getComputedStyle(this.breakpointElement, "::before").getPropertyValue("content").replaceAll('"', "");
56
56
  }
57
57
  get breakpoints() {
58
- const breakpoints = window.getComputedStyle(this.breakpointElement, "::after").getPropertyValue("content").replace(/"/g, "");
58
+ const breakpoints = window.getComputedStyle(this.breakpointElement, "::after").getPropertyValue("content").replaceAll('"', "");
59
59
  return breakpoints.split(",");
60
60
  }
61
61
  }
@@ -9,7 +9,7 @@
9
9
  * props();
10
10
  * ```
11
11
  *
12
- * @return {ScrollService}
12
+ * @returns {ScrollService}
13
13
  */
14
14
  export default function useScroll(): ScrollService;
15
15
  export type ScrollService = import('./index').ServiceInterface<ScrollServiceProps>;
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * @typedef {Object} Circle
3
- * @property {Number} x Circle's x position
4
- * @property {Number} y Circle's y position
5
- * @property {Number} radius Circle's radius
3
+ * @property {number} x Circle's x position
4
+ * @property {number} y Circle's y position
5
+ * @property {number} radius Circle's radius
6
6
  */
7
7
  /**
8
8
  * Convert clientRect to a formatted circle object
9
9
  *
10
10
  * @param {Partial<DOMRect>} domRect DOMRect of a square DOMElement
11
- * @param {Boolean} force Force usage of non-square DOMElements
12
- * @return {Circle} Circle object that can be used in collides functions
11
+ * @param {boolean} force Force usage of non-square DOMElements
12
+ * @returns {Circle} Circle object that can be used in collides functions
13
13
  */
14
14
  export default function boundingRectToCircle({ x, y, width, height }: Partial<DOMRect>, force?: boolean): Circle;
15
15
  export type Circle = {
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @typedef {Object} Circle
3
- * @property {Number} x Circle's x position
4
- * @property {Number} y Circle's y position
5
- * @property {Number} radius Circle's radius
3
+ * @property {number} x Circle's x position
4
+ * @property {number} y Circle's y position
5
+ * @property {number} radius Circle's radius
6
6
  */
7
7
  /**
8
8
  * Test if a circle collides with another.
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @param {Circle} circle1 Circle 1
12
12
  * @param {Circle} circle2 Circle 2
13
- * @return {boolean} Are the sides of one circle touching the other ?
13
+ * @returns {boolean} Are the sides of one circle touching the other ?
14
14
  */
15
15
  export default function collideCircleCircle(circle1: Circle, circle2: Circle): boolean;
16
16
  export type Circle = {
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * @typedef {Object} Rect
3
- * @property {Number} x Rectangle's x position
4
- * @property {Number} y Rectangle's y position
5
- * @property {Number} width Rectangle's width
6
- * @property {Number} height Rectangle's height
3
+ * @property {number} x Rectangle's x position
4
+ * @property {number} y Rectangle's y position
5
+ * @property {number} width Rectangle's width
6
+ * @property {number} height Rectangle's height
7
7
  */
8
8
  /**
9
9
  * @typedef {Object} Circle
10
- * @property {Number} x Circle's x position
11
- * @property {Number} y Circle's y position
12
- * @property {Number} radius Circle's radius
10
+ * @property {number} x Circle's x position
11
+ * @property {number} y Circle's y position
12
+ * @property {number} radius Circle's radius
13
13
  */
14
14
  /**
15
15
  * Test if a circle collides with a rectangle.
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * @param {Circle} circle Circle
19
19
  * @param {Rect} rect Rectangle
20
- * @return {boolean} Are the sides of the circle touching the rectangle ?
20
+ * @returns {boolean} Are the sides of the circle touching the rectangle ?
21
21
  */
22
22
  export default function collideCircleRect(circle: Circle, rect: Rect): boolean;
23
23
  export type Rect = {
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @typedef {Object} Point
3
- * @property {Number} x Point's x position
4
- * @property {Number} y Point's y position
3
+ * @property {number} x Point's x position
4
+ * @property {number} y Point's y position
5
5
  */
6
6
  /**
7
7
  * @typedef {Object} Circle
8
- * @property {Number} x Circle's x position
9
- * @property {Number} y Circle's y position
10
- * @property {Number} radius Circle's radius
8
+ * @property {number} x Circle's x position
9
+ * @property {number} y Circle's y position
10
+ * @property {number} radius Circle's radius
11
11
  */
12
12
  /**
13
13
  * Test if a point is inside a circle.
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * @param {Point} point Point
17
17
  * @param {Circle} circle Circle
18
- * @return {boolean} Is the point inside the circle's bounds ?
18
+ * @returns {boolean} Is the point inside the circle's bounds ?
19
19
  */
20
20
  export default function collidePointCircle(point: Point, circle: Circle): boolean;
21
21
  export type Point = {
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * @typedef {Object} Point
3
- * @property {Number} x Point's x position
4
- * @property {Number} y Point's y position
3
+ * @property {number} x Point's x position
4
+ * @property {number} y Point's y position
5
5
  */
6
6
  /**
7
7
  * @typedef {Object} Rect
8
- * @property {Number} x Rectangle's x position
9
- * @property {Number} y Rectangle's y position
10
- * @property {Number} width Rectangle's width
11
- * @property {Number} height Rectangle's height
8
+ * @property {number} x Rectangle's x position
9
+ * @property {number} y Rectangle's y position
10
+ * @property {number} width Rectangle's width
11
+ * @property {number} height Rectangle's height
12
12
  */
13
13
  /**
14
14
  * Test if a point collides with a rectangle.
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @param {Point} point Point
18
18
  * @param {Rect} rect Rectangle
19
- * @return {boolean} Is the point inside the rectangle's bounds ?
19
+ * @returns {boolean} Is the point inside the rectangle's bounds ?
20
20
  */
21
21
  export default function collidePointRect(point: Point, rect: Rect): boolean;
22
22
  export type Point = {