@studiometa/js-toolkit 2.4.1 → 2.4.4-alpha.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 (105) hide show
  1. package/Base/index.cjs +10 -3
  2. package/Base/index.js +6 -2
  3. package/Base/managers/AbstractManager.cjs +13 -8
  4. package/Base/managers/AbstractManager.js +13 -8
  5. package/Base/managers/ChildrenManager.cjs +10 -3
  6. package/Base/managers/ChildrenManager.js +6 -2
  7. package/Base/managers/EventsManager.cjs +17 -4
  8. package/Base/managers/EventsManager.js +13 -3
  9. package/Base/managers/OptionsManager.cjs +18 -5
  10. package/Base/managers/OptionsManager.js +14 -4
  11. package/Base/managers/RefsManager.cjs +17 -4
  12. package/Base/managers/RefsManager.js +13 -3
  13. package/Base/managers/ResponsiveOptionsManager.cjs +4 -1
  14. package/Base/managers/ServicesManager.cjs +12 -5
  15. package/Base/managers/ServicesManager.js +8 -4
  16. package/Base/utils.cjs +5 -1
  17. package/Base/utils.js +5 -1
  18. package/decorators/index.cjs +5 -2
  19. package/decorators/withBreakpointManager.cjs +6 -4
  20. package/decorators/withBreakpointManager.js +1 -2
  21. package/decorators/withBreakpointObserver.cjs +12 -5
  22. package/decorators/withBreakpointObserver.js +7 -3
  23. package/decorators/withDrag.cjs +9 -3
  24. package/decorators/withDrag.js +4 -1
  25. package/decorators/withExtraConfig.cjs +5 -2
  26. package/decorators/withFreezedOptions.cjs +9 -7
  27. package/decorators/withFreezedOptions.js +8 -6
  28. package/decorators/withIntersectionObserver.cjs +11 -7
  29. package/decorators/withIntersectionObserver.js +10 -6
  30. package/decorators/withMountWhenInView.cjs +14 -11
  31. package/decorators/withMountWhenInView.js +13 -10
  32. package/decorators/withResponsiveOptions.cjs +6 -3
  33. package/decorators/withResponsiveOptions.js +1 -1
  34. package/decorators/withScrolledInView.cjs +77 -25
  35. package/decorators/withScrolledInView.js +72 -23
  36. package/decorators/withVue2.cjs +4 -4
  37. package/decorators/withVue2.js +3 -3
  38. package/helpers/importWhenIdle.cjs +8 -5
  39. package/helpers/importWhenIdle.js +8 -5
  40. package/helpers/index.cjs +4 -1
  41. package/index.cjs +5 -2
  42. package/package.json +2 -2
  43. package/services/drag.cjs +4 -1
  44. package/services/index.cjs +4 -1
  45. package/services/index.d.ts +7 -0
  46. package/services/key.cjs +4 -1
  47. package/services/resize.cjs +4 -1
  48. package/services/scroll.cjs +4 -1
  49. package/utils/collide/index.cjs +4 -1
  50. package/utils/css/animate.cjs +24 -13
  51. package/utils/css/animate.js +20 -12
  52. package/utils/css/index.cjs +4 -1
  53. package/utils/css/transition.cjs +4 -4
  54. package/utils/css/transition.js +0 -3
  55. package/utils/focusTrap.cjs +4 -1
  56. package/utils/history.cjs +4 -1
  57. package/utils/history.js +4 -1
  58. package/utils/index.cjs +4 -1
  59. package/utils/math/clamp01.cjs +4 -1
  60. package/utils/math/index.cjs +4 -1
  61. package/utils/math/inertiaFinalValue.cjs +4 -1
  62. package/utils/nextTick.cjs +5 -3
  63. package/utils/nextTick.js +5 -3
  64. package/utils/object/autoBind.cjs +4 -1
  65. package/utils/object/index.cjs +4 -1
  66. package/utils/scrollTo.cjs +4 -1
  67. package/utils/string/index.cjs +4 -1
  68. package/utils/string/withLeadingCharacters.cjs +4 -1
  69. package/utils/string/withLeadingSlash.cjs +4 -1
  70. package/utils/string/withTrailingCharacters.cjs +4 -1
  71. package/utils/string/withTrailingSlash.cjs +4 -1
  72. package/utils/string/withoutLeadingCharactersRecursive.cjs +4 -1
  73. package/utils/string/withoutLeadingSlash.cjs +4 -1
  74. package/utils/string/withoutTrailingCharactersRecursive.cjs +4 -1
  75. package/utils/string/withoutTrailingSlash.cjs +4 -1
  76. package/utils/tween.cjs +4 -1
  77. package/Base/index.d.ts +0 -290
  78. package/Base/managers/AbstractManager.d.ts +0 -44
  79. package/Base/managers/ChildrenManager.d.ts +0 -41
  80. package/Base/managers/EventsManager.d.ts +0 -112
  81. package/Base/managers/OptionsManager.d.ts +0 -87
  82. package/Base/managers/RefsManager.d.ts +0 -32
  83. package/Base/managers/ResponsiveOptionsManager.d.ts +0 -26
  84. package/Base/managers/ServicesManager.d.ts +0 -109
  85. package/Base/utils.d.ts +0 -40
  86. package/decorators/index.d.ts +0 -10
  87. package/decorators/withBreakpointManager.d.ts +0 -10
  88. package/decorators/withBreakpointObserver.d.ts +0 -17
  89. package/decorators/withDrag.d.ts +0 -23
  90. package/decorators/withExtraConfig.d.ts +0 -18
  91. package/decorators/withFreezedOptions.d.ts +0 -14
  92. package/decorators/withIntersectionObserver.d.ts +0 -23
  93. package/decorators/withMountWhenInView.d.ts +0 -33
  94. package/decorators/withResponsiveOptions.d.ts +0 -8
  95. package/decorators/withScrolledInView.d.ts +0 -19
  96. package/decorators/withVue2.d.ts +0 -7
  97. package/helpers/createApp.d.ts +0 -14
  98. package/helpers/getDirectChildren.d.ts +0 -24
  99. package/helpers/getInstanceFromElement.d.ts +0 -14
  100. package/helpers/importOnInteraction.d.ts +0 -23
  101. package/helpers/importWhenIdle.d.ts +0 -21
  102. package/helpers/importWhenVisible.d.ts +0 -23
  103. package/helpers/index.d.ts +0 -6
  104. package/helpers/utils.d.ts +0 -10
  105. package/index.d.ts +0 -4
package/Base/index.cjs CHANGED
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var __publicField = (obj, key, value) => {
23
26
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -68,7 +71,9 @@ function createAndTestManagers(instance) {
68
71
  ].forEach(({ prop, constructorName, constructor }) => {
69
72
  instance[prop] = new instance.__managers[constructorName](instance);
70
73
  if (import_utils2.isDev && !(instance[prop] instanceof constructor)) {
71
- throw new Error(`The \`$managers.${constructorName}\` must extend the \`${constructorName}\` class.`);
74
+ throw new Error(
75
+ `The \`$managers.${constructorName}\` must extend the \`${constructorName}\` class.`
76
+ );
72
77
  }
73
78
  });
74
79
  }
@@ -288,7 +293,9 @@ var Base = class extends EventTarget {
288
293
  }
289
294
  static $factory(nameOrSelector) {
290
295
  if (import_utils2.isDev && !nameOrSelector) {
291
- throw new Error("The $factory method requires a component\u2019s name or selector to be specified.");
296
+ throw new Error(
297
+ "The $factory method requires a component\u2019s name or selector to be specified."
298
+ );
292
299
  }
293
300
  return (0, import_utils.getComponentElements)(nameOrSelector).map((el) => new this(el).$mount());
294
301
  }
package/Base/index.js CHANGED
@@ -42,7 +42,9 @@ function createAndTestManagers(instance) {
42
42
  ].forEach(({ prop, constructorName, constructor }) => {
43
43
  instance[prop] = new instance.__managers[constructorName](instance);
44
44
  if (isDev && !(instance[prop] instanceof constructor)) {
45
- throw new Error(`The \`$managers.${constructorName}\` must extend the \`${constructorName}\` class.`);
45
+ throw new Error(
46
+ `The \`$managers.${constructorName}\` must extend the \`${constructorName}\` class.`
47
+ );
46
48
  }
47
49
  });
48
50
  }
@@ -262,7 +264,9 @@ class Base extends EventTarget {
262
264
  }
263
265
  static $factory(nameOrSelector) {
264
266
  if (isDev && !nameOrSelector) {
265
- throw new Error("The $factory method requires a component\u2019s name or selector to be specified.");
267
+ throw new Error(
268
+ "The $factory method requires a component\u2019s name or selector to be specified."
269
+ );
266
270
  }
267
271
  return getComponentElements(nameOrSelector).map((el) => new this(el).$mount());
268
272
  }
@@ -43,14 +43,19 @@ var AbstractManager = class {
43
43
  return this.__base.__events;
44
44
  }
45
45
  __hideProperties(properties) {
46
- Object.defineProperties(this, Object.fromEntries(properties.map((property) => [
47
- property,
48
- {
49
- enumerable: false,
50
- writable: false,
51
- value: this[property]
52
- }
53
- ])));
46
+ Object.defineProperties(
47
+ this,
48
+ Object.fromEntries(
49
+ properties.map((property) => [
50
+ property,
51
+ {
52
+ enumerable: false,
53
+ writable: false,
54
+ value: this[property]
55
+ }
56
+ ])
57
+ )
58
+ );
54
59
  }
55
60
  };
56
61
  if (module.exports.default) module.exports = module.exports.default;
@@ -20,14 +20,19 @@ class AbstractManager {
20
20
  return this.__base.__events;
21
21
  }
22
22
  __hideProperties(properties) {
23
- Object.defineProperties(this, Object.fromEntries(properties.map((property) => [
24
- property,
25
- {
26
- enumerable: false,
27
- writable: false,
28
- value: this[property]
29
- }
30
- ])));
23
+ Object.defineProperties(
24
+ this,
25
+ Object.fromEntries(
26
+ properties.map((property) => [
27
+ property,
28
+ {
29
+ enumerable: false,
30
+ writable: false,
31
+ value: this[property]
32
+ }
33
+ ])
34
+ )
35
+ );
31
36
  }
32
37
  }
33
38
  export {
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var __publicField = (obj, key, value) => {
23
26
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -33,7 +36,9 @@ module.exports = __toCommonJS(ChildrenManager_exports);
33
36
  var import_AbstractManager = __toESM(require("./AbstractManager.cjs"), 1);
34
37
  var import_utils = require("../utils.cjs");
35
38
  function __getChild(that, el, ComponentClass, name) {
36
- const asyncComponentPromise = that.__asyncComponentPromises.get(ComponentClass);
39
+ const asyncComponentPromise = that.__asyncComponentPromises.get(
40
+ ComponentClass
41
+ );
37
42
  if ("$isBase" in ComponentClass || asyncComponentPromise && asyncComponentPromise.status === "resolved") {
38
43
  let ctor = ComponentClass;
39
44
  if (asyncComponentPromise) {
@@ -110,7 +115,9 @@ var ChildrenManager = class extends import_AbstractManager.default {
110
115
  return Object.keys(this).filter((key) => !key.startsWith("__"));
111
116
  }
112
117
  registerAll() {
113
- Object.entries(this.__config.components).forEach(([name, component]) => __register(this, name, component));
118
+ Object.entries(this.__config.components).forEach(
119
+ ([name, component]) => __register(this, name, component)
120
+ );
114
121
  }
115
122
  mountAll() {
116
123
  __triggerHookForAll(this, "$mount");
@@ -7,7 +7,9 @@ var __publicField = (obj, key, value) => {
7
7
  import AbstractManager from "./AbstractManager.js";
8
8
  import { getComponentElements } from "../utils.js";
9
9
  function __getChild(that, el, ComponentClass, name) {
10
- const asyncComponentPromise = that.__asyncComponentPromises.get(ComponentClass);
10
+ const asyncComponentPromise = that.__asyncComponentPromises.get(
11
+ ComponentClass
12
+ );
11
13
  if ("$isBase" in ComponentClass || asyncComponentPromise && asyncComponentPromise.status === "resolved") {
12
14
  let ctor = ComponentClass;
13
15
  if (asyncComponentPromise) {
@@ -84,7 +86,9 @@ class ChildrenManager extends AbstractManager {
84
86
  return Object.keys(this).filter((key) => !key.startsWith("__"));
85
87
  }
86
88
  registerAll() {
87
- Object.entries(this.__config.components).forEach(([name, component]) => __register(this, name, component));
89
+ Object.entries(this.__config.components).forEach(
90
+ ([name, component]) => __register(this, name, component)
91
+ );
88
92
  }
89
93
  mountAll() {
90
94
  __triggerHookForAll(this, "$mount");
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var __publicField = (obj, key, value) => {
23
26
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -40,7 +43,10 @@ var import_RefsManager = require("./RefsManager.cjs");
40
43
  var names = /* @__PURE__ */ new Map();
41
44
  function normalizeName(name) {
42
45
  if (!names.has(name)) {
43
- names.set(name, name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim());
46
+ names.set(
47
+ name,
48
+ name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim()
49
+ );
44
50
  }
45
51
  return names.get(name);
46
52
  }
@@ -68,7 +74,12 @@ function getEventMethodsByName(that, name = "") {
68
74
  const key = regex.toString();
69
75
  let methods = that.__methodsCache.get(key);
70
76
  if (!methods) {
71
- methods = Array.from((0, import_getAllProperties.default)(that.__base, [], (method) => regex.test(method)).reduce((set, [method]) => set.add(method), /* @__PURE__ */ new Set()));
77
+ methods = Array.from(
78
+ (0, import_getAllProperties.default)(that.__base, [], (method) => regex.test(method)).reduce(
79
+ (set, [method]) => set.add(method),
80
+ /* @__PURE__ */ new Set()
81
+ )
82
+ );
72
83
  that.__methodsCache.set(key, methods);
73
84
  }
74
85
  return methods;
@@ -132,7 +143,9 @@ var EventsManager = class extends import_AbstractManager.default {
132
143
  const childrenManager = this.__base.$children;
133
144
  const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
134
145
  name: childName,
135
- child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
146
+ child: childrenManager[childName].find(
147
+ (instance) => instance === event.currentTarget || instance.$el === event.currentTarget
148
+ )
136
149
  })).find(({ child }) => child);
137
150
  const normalizedChildName = normalizeName(name);
138
151
  const normalizedEventName = normalizeName(event.type);
@@ -12,7 +12,10 @@ import { normalizeRefName } from "./RefsManager.js";
12
12
  const names = /* @__PURE__ */ new Map();
13
13
  function normalizeName(name) {
14
14
  if (!names.has(name)) {
15
- names.set(name, name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim());
15
+ names.set(
16
+ name,
17
+ name.replace(/[A-Z]([A-Z].*)/g, (c) => c.toLowerCase()).replace(/[^a-zA-Z\d\s:]/g, " ").replace(/(^\w|\s+\w)/g, (c) => c.trim().toUpperCase()).trim()
18
+ );
16
19
  }
17
20
  return names.get(name);
18
21
  }
@@ -40,7 +43,12 @@ function getEventMethodsByName(that, name = "") {
40
43
  const key = regex.toString();
41
44
  let methods = that.__methodsCache.get(key);
42
45
  if (!methods) {
43
- methods = Array.from(getAllProperties(that.__base, [], (method) => regex.test(method)).reduce((set, [method]) => set.add(method), /* @__PURE__ */ new Set()));
46
+ methods = Array.from(
47
+ getAllProperties(that.__base, [], (method) => regex.test(method)).reduce(
48
+ (set, [method]) => set.add(method),
49
+ /* @__PURE__ */ new Set()
50
+ )
51
+ );
44
52
  that.__methodsCache.set(key, methods);
45
53
  }
46
54
  return methods;
@@ -104,7 +112,9 @@ class EventsManager extends AbstractManager {
104
112
  const childrenManager = this.__base.$children;
105
113
  const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
106
114
  name: childName,
107
- child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
115
+ child: childrenManager[childName].find(
116
+ (instance) => instance === event.currentTarget || instance.$el === event.currentTarget
117
+ )
108
118
  })).find(({ child }) => child);
109
119
  const normalizedChildName = normalizeName(name);
110
120
  const normalizedEventName = normalizeName(event.type);
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var __publicField = (obj, key, value) => {
23
26
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -56,14 +59,18 @@ function __register(that, name, config) {
56
59
  var _a;
57
60
  if (!types.has(config.type)) {
58
61
  if (import_utils.isDev) {
59
- throw new Error(`The "${name}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`);
62
+ throw new Error(
63
+ `The "${name}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`
64
+ );
60
65
  }
61
66
  return;
62
67
  }
63
68
  config.default = (_a = config.default) != null ? _a : __defaultValues[config.type.name];
64
69
  if ((config.type === Array || config.type === Object) && !(0, import_utils.isFunction)(config.default)) {
65
70
  if (import_utils.isDev) {
66
- throw new Error(`The default value for options of type "${config.type.name}" must be returned by a function.`);
71
+ throw new Error(
72
+ `The default value for options of type "${config.type.name}" must be returned by a function.`
73
+ );
67
74
  }
68
75
  return;
69
76
  }
@@ -97,7 +104,11 @@ var OptionsManager = class extends import_AbstractManager.default {
97
104
  default: (_b = this.__config.log) != null ? _b : false
98
105
  };
99
106
  Object.entries(schema).forEach(([name, config]) => {
100
- __register(this, name, types.has(config) ? { type: config } : config);
107
+ __register(
108
+ this,
109
+ name,
110
+ types.has(config) ? { type: config } : config
111
+ );
101
112
  });
102
113
  }
103
114
  get(name, config) {
@@ -135,7 +146,9 @@ var OptionsManager = class extends import_AbstractManager.default {
135
146
  if (value.constructor.name !== type.name) {
136
147
  if (import_utils.isDev) {
137
148
  const val = (0, import_utils.isArray)(value) || (0, import_utils.isObject)(value) ? JSON.stringify(value) : value;
138
- throw new TypeError(`The "${val}" value for the "${name}" option must be of type "${type.name}"`);
149
+ throw new TypeError(
150
+ `The "${val}" value for the "${name}" option must be of type "${type.name}"`
151
+ );
139
152
  }
140
153
  return;
141
154
  }
@@ -29,14 +29,18 @@ function __register(that, name, config) {
29
29
  var _a;
30
30
  if (!types.has(config.type)) {
31
31
  if (isDev) {
32
- throw new Error(`The "${name}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`);
32
+ throw new Error(
33
+ `The "${name}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`
34
+ );
33
35
  }
34
36
  return;
35
37
  }
36
38
  config.default = (_a = config.default) != null ? _a : __defaultValues[config.type.name];
37
39
  if ((config.type === Array || config.type === Object) && !isFunction(config.default)) {
38
40
  if (isDev) {
39
- throw new Error(`The default value for options of type "${config.type.name}" must be returned by a function.`);
41
+ throw new Error(
42
+ `The default value for options of type "${config.type.name}" must be returned by a function.`
43
+ );
40
44
  }
41
45
  return;
42
46
  }
@@ -70,7 +74,11 @@ class OptionsManager extends AbstractManager {
70
74
  default: (_b = this.__config.log) != null ? _b : false
71
75
  };
72
76
  Object.entries(schema).forEach(([name, config]) => {
73
- __register(this, name, types.has(config) ? { type: config } : config);
77
+ __register(
78
+ this,
79
+ name,
80
+ types.has(config) ? { type: config } : config
81
+ );
74
82
  });
75
83
  }
76
84
  get(name, config) {
@@ -108,7 +116,9 @@ class OptionsManager extends AbstractManager {
108
116
  if (value.constructor.name !== type.name) {
109
117
  if (isDev) {
110
118
  const val = isArray(value) || isObject(value) ? JSON.stringify(value) : value;
111
- throw new TypeError(`The "${val}" value for the "${name}" option must be of type "${type.name}"`);
119
+ throw new TypeError(
120
+ `The "${val}" value for the "${name}" option must be of type "${type.name}"`
121
+ );
112
122
  }
113
123
  return;
114
124
  }
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // packages/js-toolkit/Base/managers/RefsManager.js
@@ -41,13 +44,23 @@ function __filterRefsBelongingToInstance(that, ref) {
41
44
  function __register(that, refName) {
42
45
  const isMultiple = refName.endsWith("[]");
43
46
  const propName = normalizeRefName(refName);
44
- const refs = Array.from(that.__element.querySelectorAll(`[data-ref="${refName}"]`)).filter((ref) => __filterRefsBelongingToInstance(that, ref));
47
+ const refs = Array.from(that.__element.querySelectorAll(`[data-ref="${refName}"]`)).filter(
48
+ (ref) => __filterRefsBelongingToInstance(that, ref)
49
+ );
45
50
  if (import_utils.isDev && !isMultiple && refs.length > 1) {
46
- console.warn(`[${that.__base.$options.name}]`, `The "${refName}" ref has been found multiple times.`, "Did you forgot to add the `[]` suffix to its name?");
51
+ console.warn(
52
+ `[${that.__base.$options.name}]`,
53
+ `The "${refName}" ref has been found multiple times.`,
54
+ "Did you forgot to add the `[]` suffix to its name?"
55
+ );
47
56
  }
48
57
  if (!isMultiple && refs.length <= 1 && !(0, import_utils.isDefined)(refs[0])) {
49
58
  if (import_utils.isDev) {
50
- console.warn(`[${that.__base.$options.name}]`, `The "${refName}" ref is missing.`, `Is there an \`[data-ref="${refName}"]\` element in the component's scope?`);
59
+ console.warn(
60
+ `[${that.__base.$options.name}]`,
61
+ `The "${refName}" ref is missing.`,
62
+ `Is there an \`[data-ref="${refName}"]\` element in the component's scope?`
63
+ );
51
64
  }
52
65
  return;
53
66
  }
@@ -13,13 +13,23 @@ function __filterRefsBelongingToInstance(that, ref) {
13
13
  function __register(that, refName) {
14
14
  const isMultiple = refName.endsWith("[]");
15
15
  const propName = normalizeRefName(refName);
16
- const refs = Array.from(that.__element.querySelectorAll(`[data-ref="${refName}"]`)).filter((ref) => __filterRefsBelongingToInstance(that, ref));
16
+ const refs = Array.from(that.__element.querySelectorAll(`[data-ref="${refName}"]`)).filter(
17
+ (ref) => __filterRefsBelongingToInstance(that, ref)
18
+ );
17
19
  if (isDev && !isMultiple && refs.length > 1) {
18
- console.warn(`[${that.__base.$options.name}]`, `The "${refName}" ref has been found multiple times.`, "Did you forgot to add the `[]` suffix to its name?");
20
+ console.warn(
21
+ `[${that.__base.$options.name}]`,
22
+ `The "${refName}" ref has been found multiple times.`,
23
+ "Did you forgot to add the `[]` suffix to its name?"
24
+ );
19
25
  }
20
26
  if (!isMultiple && refs.length <= 1 && !isDefined(refs[0])) {
21
27
  if (isDev) {
22
- console.warn(`[${that.__base.$options.name}]`, `The "${refName}" ref is missing.`, `Is there an \`[data-ref="${refName}"]\` element in the component's scope?`);
28
+ console.warn(
29
+ `[${that.__base.$options.name}]`,
30
+ `The "${refName}" ref is missing.`,
31
+ `Is there an \`[data-ref="${refName}"]\` element in the component's scope?`
32
+ );
23
33
  }
24
34
  return;
25
35
  }
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
25
  // packages/js-toolkit/Base/managers/ResponsiveOptionsManager.js
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var __publicField = (obj, key, value) => {
23
26
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -84,12 +87,16 @@ var ServicesManager = class extends import_AbstractManager.default {
84
87
  return this.disable.bind(this, service);
85
88
  }
86
89
  enableAll() {
87
- return Object.keys(this.__services).map((serviceName) => this.enable(serviceName));
90
+ return Object.keys(this.__services).map(
91
+ (serviceName) => this.enable(serviceName)
92
+ );
88
93
  }
89
94
  disableAll() {
90
- Object.keys(this.__services).forEach((serviceName) => {
91
- this.disable(serviceName);
92
- });
95
+ Object.keys(this.__services).forEach(
96
+ (serviceName) => {
97
+ this.disable(serviceName);
98
+ }
99
+ );
93
100
  }
94
101
  disable(service) {
95
102
  if (!this.__services[service]) {
@@ -58,12 +58,16 @@ class ServicesManager extends AbstractManager {
58
58
  return this.disable.bind(this, service);
59
59
  }
60
60
  enableAll() {
61
- return Object.keys(this.__services).map((serviceName) => this.enable(serviceName));
61
+ return Object.keys(this.__services).map(
62
+ (serviceName) => this.enable(serviceName)
63
+ );
62
64
  }
63
65
  disableAll() {
64
- Object.keys(this.__services).forEach((serviceName) => {
65
- this.disable(serviceName);
66
- });
66
+ Object.keys(this.__services).forEach(
67
+ (serviceName) => {
68
+ this.disable(serviceName);
69
+ }
70
+ );
67
71
  }
68
72
  disable(service) {
69
73
  if (!this.__services[service]) {
package/Base/utils.cjs CHANGED
@@ -52,7 +52,11 @@ function getEventTarget(instance, event, config) {
52
52
  return instance.$el;
53
53
  }
54
54
  if (import_utils.isDev) {
55
- console.warn(`[${config.name}]`, `The "${event}" event is missing from the configuration and is not a native`, `event for the root element of type \`${instance.$el.constructor.name}\`.`);
55
+ console.warn(
56
+ `[${config.name}]`,
57
+ `The "${event}" event is missing from the configuration and is not a native`,
58
+ `event for the root element of type \`${instance.$el.constructor.name}\`.`
59
+ );
56
60
  }
57
61
  return instance;
58
62
  }
package/Base/utils.js CHANGED
@@ -25,7 +25,11 @@ function getEventTarget(instance, event, config) {
25
25
  return instance.$el;
26
26
  }
27
27
  if (isDev) {
28
- console.warn(`[${config.name}]`, `The "${event}" event is missing from the configuration and is not a native`, `event for the root element of type \`${instance.$el.constructor.name}\`.`);
28
+ console.warn(
29
+ `[${config.name}]`,
30
+ `The "${event}" event is missing from the configuration and is not a native`,
31
+ `event for the root element of type \`${instance.$el.constructor.name}\`.`
32
+ );
29
33
  }
30
34
  return instance;
31
35
  }
@@ -16,10 +16,13 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
- // packages/js-toolkit/decorators/index.js
25
+ // packages/js-toolkit/decorators/index.ts
23
26
  var decorators_exports = {};
24
27
  __export(decorators_exports, {
25
28
  withBreakpointManager: () => import_withBreakpointManager.default,
@@ -16,10 +16,13 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
20
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
24
 
22
- // packages/js-toolkit/decorators/withBreakpointManager.js
25
+ // packages/js-toolkit/decorators/withBreakpointManager.ts
23
26
  var withBreakpointManager_exports = {};
24
27
  __export(withBreakpointManager_exports, {
25
28
  default: () => withBreakpointManager
@@ -65,7 +68,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
65
68
  }
66
69
  return BaseClass;
67
70
  }
68
- return class extends BaseClass {
71
+ return class WithBreakpointManager extends BaseClass {
69
72
  constructor(element) {
70
73
  super(element);
71
74
  if (!instances.has(this)) {
@@ -74,7 +77,6 @@ function withBreakpointManager(BaseClass, breakpoints) {
74
77
  add(`BreakpointManager-${this.$id}`, () => {
75
78
  testBreakpoints(instances.get(this));
76
79
  });
77
- this.instances = instances.get(this);
78
80
  }
79
81
  $mount() {
80
82
  super.$mount();
@@ -38,7 +38,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
38
38
  }
39
39
  return BaseClass;
40
40
  }
41
- return class extends BaseClass {
41
+ return class WithBreakpointManager extends BaseClass {
42
42
  constructor(element) {
43
43
  super(element);
44
44
  if (!instances.has(this)) {
@@ -47,7 +47,6 @@ function withBreakpointManager(BaseClass, breakpoints) {
47
47
  add(`BreakpointManager-${this.$id}`, () => {
48
48
  testBreakpoints(instances.get(this));
49
49
  });
50
- this.instances = instances.get(this);
51
50
  }
52
51
  $mount() {
53
52
  super.$mount();
@@ -17,14 +17,17 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var __publicField = (obj, key, value) => {
23
26
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
27
  return value;
25
28
  };
26
29
 
27
- // packages/js-toolkit/decorators/withBreakpointObserver.js
30
+ // packages/js-toolkit/decorators/withBreakpointObserver.ts
28
31
  var withBreakpointObserver_exports = {};
29
32
  __export(withBreakpointObserver_exports, {
30
33
  default: () => withBreakpointObserver
@@ -48,7 +51,9 @@ function hasBreakpointConfiguration(instance) {
48
51
  function testConflictingBreakpointConfiguration(instance) {
49
52
  const { activeBreakpoints, inactiveBreakpoints, name } = instance.$options;
50
53
  if (activeBreakpoints && inactiveBreakpoints) {
51
- throw new Error(`[${name}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`);
54
+ throw new Error(
55
+ `[${name}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`
56
+ );
52
57
  }
53
58
  }
54
59
  function addToResize(key, instance) {
@@ -57,7 +62,7 @@ function addToResize(key, instance) {
57
62
  }
58
63
  const { add, has } = (0, import_resize.default)();
59
64
  if (!has(key)) {
60
- add(key, function onResize({ breakpoint }) {
65
+ add(key, ({ breakpoint }) => {
61
66
  const action = testBreakpoints(instance, breakpoint);
62
67
  if (action === "$destroy" && instance.$isMounted) {
63
68
  instance[action]();
@@ -76,7 +81,9 @@ function withBreakpointObserver(BaseClass) {
76
81
  const { name } = this.$options;
77
82
  if (!props().breakpoint) {
78
83
  if (import_utils.isDev) {
79
- throw new Error(`[${name}] The \`BreakpointObserver\` class requires breakpoints to be defined.`);
84
+ throw new Error(
85
+ `[${name}] The \`BreakpointObserver\` class requires breakpoints to be defined.`
86
+ );
80
87
  }
81
88
  return;
82
89
  }