@studiometa/js-toolkit 2.2.1 → 2.3.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 (131) hide show
  1. package/Base/index.cjs +60 -69
  2. package/Base/index.d.ts +0 -8
  3. package/Base/index.js +67 -82
  4. package/Base/managers/AbstractManager.cjs +5 -10
  5. package/Base/managers/AbstractManager.js +5 -11
  6. package/Base/managers/ChildrenManager.cjs +2 -11
  7. package/Base/managers/ChildrenManager.js +2 -12
  8. package/Base/managers/EventsManager.cjs +61 -67
  9. package/Base/managers/EventsManager.js +61 -68
  10. package/Base/managers/OptionsManager.cjs +26 -27
  11. package/Base/managers/OptionsManager.js +26 -28
  12. package/Base/managers/RefsManager.cjs +9 -7
  13. package/Base/managers/RefsManager.js +9 -7
  14. package/Base/managers/ResponsiveOptionsManager.cjs +4 -1
  15. package/Base/managers/ResponsiveOptionsManager.js +4 -1
  16. package/Base/managers/ServicesManager.cjs +10 -16
  17. package/Base/managers/ServicesManager.js +10 -17
  18. package/Base/utils.cjs +22 -4
  19. package/Base/utils.d.ts +25 -8
  20. package/Base/utils.js +22 -4
  21. package/decorators/withBreakpointManager.cjs +15 -5
  22. package/decorators/withBreakpointManager.js +15 -5
  23. package/decorators/withBreakpointObserver.cjs +19 -18
  24. package/decorators/withBreakpointObserver.js +19 -19
  25. package/decorators/withDrag.cjs +6 -11
  26. package/decorators/withDrag.js +6 -12
  27. package/decorators/withExtraConfig.cjs +3 -8
  28. package/decorators/withExtraConfig.js +3 -9
  29. package/decorators/withFreezedOptions.cjs +1 -9
  30. package/decorators/withFreezedOptions.js +1 -10
  31. package/decorators/withIntersectionObserver.cjs +11 -16
  32. package/decorators/withIntersectionObserver.js +11 -17
  33. package/decorators/withMountWhenInView.cjs +12 -17
  34. package/decorators/withMountWhenInView.js +12 -18
  35. package/decorators/withScrolledInView.cjs +30 -35
  36. package/decorators/withScrolledInView.js +30 -36
  37. package/decorators/withVue2.cjs +20 -18
  38. package/decorators/withVue2.js +20 -19
  39. package/helpers/getInstanceFromElement.cjs +1 -2
  40. package/helpers/getInstanceFromElement.js +1 -2
  41. package/helpers/importOnInteraction.cjs +3 -2
  42. package/helpers/importOnInteraction.js +3 -2
  43. package/helpers/importWhenIdle.cjs +2 -3
  44. package/helpers/importWhenIdle.js +2 -3
  45. package/helpers/importWhenVisible.cjs +3 -2
  46. package/helpers/importWhenVisible.js +3 -2
  47. package/helpers/utils.cjs +3 -2
  48. package/helpers/utils.js +3 -2
  49. package/package.json +4 -1
  50. package/services/drag.cjs +126 -148
  51. package/services/drag.d.ts +10 -10
  52. package/services/drag.js +125 -148
  53. package/services/index.cjs +3 -1
  54. package/services/index.d.ts +1 -0
  55. package/services/index.js +3 -1
  56. package/services/key.cjs +48 -63
  57. package/services/key.d.ts +0 -8
  58. package/services/key.js +47 -63
  59. package/services/load.cjs +24 -40
  60. package/services/load.d.ts +0 -8
  61. package/services/load.js +23 -37
  62. package/services/pointer.cjs +72 -103
  63. package/services/pointer.d.ts +1 -9
  64. package/services/pointer.js +71 -100
  65. package/services/raf.cjs +38 -58
  66. package/services/raf.d.ts +0 -8
  67. package/services/raf.js +37 -55
  68. package/services/resize.cjs +59 -68
  69. package/services/resize.d.ts +0 -7
  70. package/services/resize.js +58 -68
  71. package/services/scroll.cjs +49 -71
  72. package/services/scroll.js +48 -71
  73. package/services/service.cjs +68 -0
  74. package/services/service.d.ts +18 -0
  75. package/services/service.js +46 -0
  76. package/utils/css/animate.cjs +33 -102
  77. package/utils/css/animate.d.ts +4 -13
  78. package/utils/css/animate.js +31 -100
  79. package/utils/css/classes.cjs +2 -1
  80. package/utils/css/classes.js +2 -1
  81. package/utils/css/matrix.cjs +1 -2
  82. package/utils/css/matrix.js +1 -2
  83. package/utils/css/styles.cjs +2 -5
  84. package/utils/css/styles.js +1 -1
  85. package/utils/css/transform.cjs +14 -18
  86. package/utils/css/transform.js +2 -3
  87. package/utils/css/transition.cjs +7 -10
  88. package/utils/css/transition.js +7 -11
  89. package/utils/focusTrap.cjs +2 -1
  90. package/utils/focusTrap.js +2 -1
  91. package/utils/{isFunction.cjs → has.cjs} +7 -7
  92. package/utils/has.d.ts +6 -0
  93. package/utils/has.js +6 -0
  94. package/utils/history.cjs +5 -7
  95. package/utils/history.js +4 -3
  96. package/utils/index.cjs +6 -5
  97. package/utils/index.d.ts +4 -2
  98. package/utils/index.js +6 -5
  99. package/utils/{object/isObject.cjs → is.cjs} +20 -8
  100. package/utils/is.d.ts +8 -0
  101. package/utils/is.js +18 -0
  102. package/utils/math/inertiaFinalValue.cjs +5 -3
  103. package/utils/math/inertiaFinalValue.js +2 -3
  104. package/utils/nextFrame.cjs +5 -3
  105. package/utils/nextFrame.js +5 -3
  106. package/utils/nextMicrotask.cjs +2 -1
  107. package/utils/nextMicrotask.js +2 -1
  108. package/utils/nextTick.cjs +2 -1
  109. package/utils/nextTick.js +2 -1
  110. package/utils/{isDefined.cjs → noop.cjs} +10 -7
  111. package/utils/noop.d.ts +12 -0
  112. package/utils/noop.js +9 -0
  113. package/utils/object/autoBind.cjs +3 -2
  114. package/utils/object/autoBind.js +3 -2
  115. package/utils/object/getAllProperties.cjs +2 -1
  116. package/utils/object/getAllProperties.js +2 -1
  117. package/utils/object/index.cjs +1 -3
  118. package/utils/object/index.d.ts +0 -1
  119. package/utils/object/index.js +1 -3
  120. package/utils/tween.cjs +113 -0
  121. package/utils/tween.d.ts +25 -0
  122. package/utils/tween.js +88 -0
  123. package/services/Service.cjs +0 -76
  124. package/services/Service.d.ts +0 -76
  125. package/services/Service.js +0 -55
  126. package/utils/isDefined.d.ts +0 -7
  127. package/utils/isDefined.js +0 -6
  128. package/utils/isFunction.d.ts +0 -7
  129. package/utils/isFunction.js +0 -6
  130. package/utils/object/isObject.d.ts +0 -7
  131. package/utils/object/isObject.js +0 -6
@@ -1,76 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __publicField = (obj, key, value) => {
20
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
- return value;
22
- };
23
-
24
- // packages/js-toolkit/services/Service.js
25
- var Service_exports = {};
26
- __export(Service_exports, {
27
- default: () => Service
28
- });
29
- module.exports = __toCommonJS(Service_exports);
30
- var Service = class {
31
- constructor() {
32
- __publicField(this, "callbacks", /* @__PURE__ */ new Map());
33
- __publicField(this, "isInit", false);
34
- __publicField(this, "props");
35
- }
36
- updateProps(...args) {
37
- this.props = args;
38
- throw new Error("The `updateProps` method must be implemented.");
39
- }
40
- init() {
41
- throw new Error("The `init` method must be implemented.");
42
- }
43
- kill() {
44
- throw new Error("The `kill` method must be implemented.");
45
- }
46
- add(key, callback) {
47
- if (this.has(key)) {
48
- throw new Error(`A callback with the key \`${key}\` has already been registered.`);
49
- }
50
- if (this.callbacks.size === 0 && !this.isInit) {
51
- this.init();
52
- this.isInit = true;
53
- }
54
- this.callbacks.set(key, callback);
55
- }
56
- has(key) {
57
- return this.callbacks.has(key);
58
- }
59
- get(key) {
60
- return this.callbacks.get(key);
61
- }
62
- remove(key) {
63
- this.callbacks.delete(key);
64
- if (this.callbacks.size === 0 && this.isInit) {
65
- this.kill();
66
- this.isInit = false;
67
- }
68
- }
69
- trigger(...args) {
70
- this.callbacks.forEach(function forEachCallback(callback) {
71
- callback(...args);
72
- });
73
- return this;
74
- }
75
- };
76
- if (module.exports.default) module.exports = module.exports.default;
@@ -1,76 +0,0 @@
1
- /**
2
- * Service abstract class
3
- */
4
- export default class Service {
5
- /**
6
- * Map containing the callbacks.
7
- * @type {Map<string, Function>}
8
- */
9
- callbacks: Map<string, Function>;
10
- /**
11
- * State flag.
12
- * @type {boolean}
13
- */
14
- isInit: boolean;
15
- /**
16
- * @type {unknown}
17
- */
18
- props: unknown;
19
- /**
20
- * Method to update the services properties.
21
- * This method MUST be implemented by the service extending this class.
22
- *
23
- * @param {...any} args
24
- * @returns {this['props']}
25
- */
26
- updateProps(...args: any[]): unknown;
27
- /**
28
- * Method to initialize the service behaviors.
29
- * This method MUST be implemented by the service extending this class.
30
- *
31
- * @returns {void}
32
- */
33
- init(): void;
34
- /**
35
- * Method to kill the service behaviors.
36
- * This method MUST be implemented by the service extending this class.
37
- *
38
- * @returns {void}
39
- */
40
- kill(): void;
41
- /**
42
- * Add a callback.
43
- *
44
- * @param {string} key The callback's identifier
45
- * @param {Function} callback The callback function
46
- * @returns {void}
47
- */
48
- add(key: string, callback: Function): void;
49
- /**
50
- * Test if a callback with the given key has already been added.
51
- *
52
- * @param {string} key The identifier to test
53
- * @returns {boolean} Whether or not the identifier already exists
54
- */
55
- has(key: string): boolean;
56
- /**
57
- * Get the callback tied to the given key.
58
- *
59
- * @param {string} key The identifier to get
60
- * @returns {Function} The callback function
61
- */
62
- get(key: string): Function;
63
- /**
64
- * Remove the callback tied to the given key.
65
- *
66
- * @param {string} key The identifier to remove
67
- */
68
- remove(key: string): void;
69
- /**
70
- * Trigger each added callback with the given arguments.
71
- *
72
- * @param {...any} args All the arguments to apply to the callback
73
- * @returns {this} The current instance
74
- */
75
- trigger(...args: any[]): this;
76
- }
@@ -1,55 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- class Service {
8
- constructor() {
9
- __publicField(this, "callbacks", /* @__PURE__ */ new Map());
10
- __publicField(this, "isInit", false);
11
- __publicField(this, "props");
12
- }
13
- updateProps(...args) {
14
- this.props = args;
15
- throw new Error("The `updateProps` method must be implemented.");
16
- }
17
- init() {
18
- throw new Error("The `init` method must be implemented.");
19
- }
20
- kill() {
21
- throw new Error("The `kill` method must be implemented.");
22
- }
23
- add(key, callback) {
24
- if (this.has(key)) {
25
- throw new Error(`A callback with the key \`${key}\` has already been registered.`);
26
- }
27
- if (this.callbacks.size === 0 && !this.isInit) {
28
- this.init();
29
- this.isInit = true;
30
- }
31
- this.callbacks.set(key, callback);
32
- }
33
- has(key) {
34
- return this.callbacks.has(key);
35
- }
36
- get(key) {
37
- return this.callbacks.get(key);
38
- }
39
- remove(key) {
40
- this.callbacks.delete(key);
41
- if (this.callbacks.size === 0 && this.isInit) {
42
- this.kill();
43
- this.isInit = false;
44
- }
45
- }
46
- trigger(...args) {
47
- this.callbacks.forEach(function forEachCallback(callback) {
48
- callback(...args);
49
- });
50
- return this;
51
- }
52
- }
53
- export {
54
- Service as default
55
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Test if a value is defined or not.
3
- *
4
- * @param {any} value
5
- * @returns {boolean}
6
- */
7
- export default function isDefined(value: any): boolean;
@@ -1,6 +0,0 @@
1
- function isDefined(value) {
2
- return typeof value !== "undefined";
3
- }
4
- export {
5
- isDefined as default
6
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Test if the given value is a function.
3
- *
4
- * @param {any} fn
5
- * @returns {boolean}
6
- */
7
- export default function isFunction(fn: any): boolean;
@@ -1,6 +0,0 @@
1
- function isFunction(fn) {
2
- return typeof fn === "function";
3
- }
4
- export {
5
- isFunction as default
6
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Test if the given value is an object.
3
- *
4
- * @param {*} value The value to test.
5
- * @returns {boolean} Whether or not the value is an object.
6
- */
7
- export default function isObject(value: any): boolean;
@@ -1,6 +0,0 @@
1
- function isObject(value) {
2
- return typeof value === "object" && !!value && value.toString() === "[object Object]";
3
- }
4
- export {
5
- isObject as default
6
- };