@studiometa/js-toolkit 2.0.0-beta.13 → 2.0.0-beta.17

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 +39 -38
  2. package/Base/index.js +60 -54
  3. package/Base/managers/ChildrenManager.cjs +15 -8
  4. package/Base/managers/ChildrenManager.js +15 -8
  5. package/Base/managers/EventsManager.cjs +50 -44
  6. package/Base/managers/EventsManager.js +50 -44
  7. package/Base/managers/OptionsManager.cjs +16 -14
  8. package/Base/managers/OptionsManager.js +35 -27
  9. package/Base/managers/RefsManager.cjs +10 -4
  10. package/Base/managers/RefsManager.js +10 -4
  11. package/Base/managers/ServicesManager.cjs +14 -8
  12. package/Base/managers/ServicesManager.js +14 -8
  13. package/Base/utils.cjs +1 -0
  14. package/decorators/index.cjs +1 -0
  15. package/decorators/withBreakpointManager.cjs +1 -0
  16. package/decorators/withBreakpointObserver.cjs +17 -11
  17. package/decorators/withBreakpointObserver.js +17 -11
  18. package/decorators/withDrag.cjs +12 -6
  19. package/decorators/withDrag.js +12 -6
  20. package/decorators/withExtraConfig.cjs +9 -3
  21. package/decorators/withExtraConfig.js +9 -3
  22. package/decorators/withIntersectionObserver.cjs +21 -15
  23. package/decorators/withIntersectionObserver.js +21 -15
  24. package/decorators/withMountWhenInView.cjs +24 -18
  25. package/decorators/withMountWhenInView.js +24 -18
  26. package/decorators/withScrolledInView.cjs +39 -30
  27. package/decorators/withScrolledInView.js +39 -30
  28. package/decorators/withVue2.cjs +14 -9
  29. package/decorators/withVue2.js +14 -9
  30. package/helpers/createApp.cjs +1 -0
  31. package/helpers/importOnInteraction.cjs +2 -1
  32. package/helpers/importOnInteraction.js +1 -1
  33. package/helpers/importWhenIdle.cjs +4 -2
  34. package/helpers/importWhenIdle.js +3 -2
  35. package/helpers/importWhenVisible.cjs +2 -1
  36. package/helpers/importWhenVisible.js +1 -1
  37. package/helpers/index.cjs +1 -0
  38. package/helpers/utils.cjs +1 -0
  39. package/index.cjs +1 -0
  40. package/package.json +1 -2
  41. package/services/Service.cjs +7 -1
  42. package/services/Service.js +7 -1
  43. package/services/drag.cjs +59 -33
  44. package/services/drag.d.ts +1 -0
  45. package/services/drag.js +59 -33
  46. package/services/index.cjs +1 -0
  47. package/services/key.cjs +27 -17
  48. package/services/key.js +27 -17
  49. package/services/load.cjs +12 -3
  50. package/services/load.js +12 -3
  51. package/services/pointer.cjs +38 -28
  52. package/services/pointer.js +38 -28
  53. package/services/raf.cjs +16 -7
  54. package/services/raf.js +16 -7
  55. package/services/resize.cjs +16 -7
  56. package/services/resize.js +16 -7
  57. package/services/scroll.cjs +36 -27
  58. package/services/scroll.js +36 -27
  59. package/utils/collide/boundingRectToCircle.cjs +1 -0
  60. package/utils/collide/collideCircleCircle.cjs +1 -0
  61. package/utils/collide/collideCircleRect.cjs +1 -0
  62. package/utils/collide/collidePointCircle.cjs +1 -0
  63. package/utils/collide/collidePointRect.cjs +1 -0
  64. package/utils/collide/collideRectRect.cjs +1 -0
  65. package/utils/collide/index.cjs +1 -0
  66. package/utils/css/classes.cjs +1 -0
  67. package/utils/css/index.cjs +1 -0
  68. package/utils/css/matrix.cjs +3 -1
  69. package/utils/css/matrix.js +2 -1
  70. package/utils/css/styles.cjs +1 -0
  71. package/utils/css/transition.cjs +8 -2
  72. package/utils/css/transition.js +8 -2
  73. package/utils/debounce.cjs +1 -0
  74. package/utils/focusTrap.cjs +1 -0
  75. package/utils/history.cjs +1 -0
  76. package/utils/index.cjs +1 -0
  77. package/utils/keyCodes.cjs +1 -0
  78. package/utils/math/clamp.cjs +1 -0
  79. package/utils/math/clamp01.cjs +1 -0
  80. package/utils/math/damp.cjs +1 -0
  81. package/utils/math/ease.cjs +1 -0
  82. package/utils/math/index.cjs +1 -0
  83. package/utils/math/inertiaFinalValue.cjs +1 -0
  84. package/utils/math/lerp.cjs +1 -0
  85. package/utils/math/map.cjs +1 -0
  86. package/utils/math/round.cjs +1 -0
  87. package/utils/memoize.cjs +1 -0
  88. package/utils/nextFrame.cjs +1 -0
  89. package/utils/object/autoBind.cjs +1 -0
  90. package/utils/object/getAllProperties.cjs +1 -0
  91. package/utils/object/index.cjs +1 -0
  92. package/utils/object/isObject.cjs +1 -0
  93. package/utils/scrollTo.cjs +1 -0
  94. package/utils/string/index.cjs +1 -0
  95. package/utils/string/withLeadingCharacters.cjs +1 -0
  96. package/utils/string/withLeadingSlash.cjs +1 -0
  97. package/utils/string/withTrailingCharacters.cjs +1 -0
  98. package/utils/string/withTrailingSlash.cjs +1 -0
  99. package/utils/string/withoutLeadingCharacters.cjs +1 -0
  100. package/utils/string/withoutLeadingCharactersRecursive.cjs +1 -0
  101. package/utils/string/withoutLeadingSlash.cjs +1 -0
  102. package/utils/string/withoutTrailingCharacters.cjs +1 -0
  103. package/utils/string/withoutTrailingCharactersRecursive.cjs +1 -0
  104. package/utils/string/withoutTrailingSlash.cjs +1 -0
  105. package/utils/throttle.cjs +1 -0
package/Base/index.cjs CHANGED
@@ -47,11 +47,44 @@ var isDev = typeof __DEV__ !== "undefined" && __DEV__;
47
47
  function noop() {
48
48
  }
49
49
  var Base = class extends EventTarget {
50
- $parent = null;
51
- $id;
52
- $el;
53
- $isMounted = false;
54
- __eventHandlers = /* @__PURE__ */ new Map();
50
+ constructor(element) {
51
+ super();
52
+ __publicField(this, "$parent", null);
53
+ __publicField(this, "$id");
54
+ __publicField(this, "$el");
55
+ __publicField(this, "$isMounted", false);
56
+ __publicField(this, "__eventHandlers", /* @__PURE__ */ new Map());
57
+ __publicField(this, "__services");
58
+ __publicField(this, "__refs");
59
+ __publicField(this, "__options");
60
+ __publicField(this, "__children");
61
+ __publicField(this, "__events");
62
+ if (!element) {
63
+ throw new Error("The root element must be defined.");
64
+ }
65
+ const { __config } = this;
66
+ if (__config.name === "Base") {
67
+ throw new Error("The `config.name` property is required.");
68
+ }
69
+ this.$id = `${__config.name}-${id}`;
70
+ id += 1;
71
+ this.$el = element;
72
+ if (!("__base__" in this.$el)) {
73
+ Object.defineProperty(this.$el, "__base__", {
74
+ get: () => this,
75
+ configurable: true
76
+ });
77
+ }
78
+ this.__options = new import_OptionsManager.default(element, __config.options || {}, __config);
79
+ this.__services = new import_ServicesManager.default(this);
80
+ this.__events = new import_EventsManager.default(element, this);
81
+ this.__children = new import_ChildrenManager.default(this, element, __config.components || {}, this.__events);
82
+ this.__refs = new import_RefsManager.default(this, element, __config.refs || [], this.__events);
83
+ if (isDev) {
84
+ this.__debug("constructor", this);
85
+ }
86
+ return this;
87
+ }
55
88
  get $root() {
56
89
  if (!this.$parent) {
57
90
  return this;
@@ -87,23 +120,18 @@ var Base = class extends EventTarget {
87
120
  }
88
121
  return config;
89
122
  }
90
- __services;
91
123
  get $services() {
92
124
  return this.__services;
93
125
  }
94
- __refs;
95
126
  get $refs() {
96
127
  return this.__refs;
97
128
  }
98
- __options;
99
129
  get $options() {
100
130
  return this.__options;
101
131
  }
102
- __children;
103
132
  get $children() {
104
133
  return this.__children;
105
134
  }
106
- __events;
107
135
  get $log() {
108
136
  return this.__options.log ? window.console.log.bind(window, `[${this.__config.name}]`) : noop;
109
137
  }
@@ -127,34 +155,6 @@ var Base = class extends EventTarget {
127
155
  const eventHandlers = this.__eventHandlers.get(event);
128
156
  return eventHandlers && eventHandlers.size > 0;
129
157
  }
130
- constructor(element) {
131
- super();
132
- if (!element) {
133
- throw new Error("The root element must be defined.");
134
- }
135
- const { __config } = this;
136
- if (__config.name === "Base") {
137
- throw new Error("The `config.name` property is required.");
138
- }
139
- this.$id = `${__config.name}-${id}`;
140
- id += 1;
141
- this.$el = element;
142
- if (!("__base__" in this.$el)) {
143
- Object.defineProperty(this.$el, "__base__", {
144
- get: () => this,
145
- configurable: true
146
- });
147
- }
148
- this.__options = new import_OptionsManager.default(element, __config.options || {}, __config);
149
- this.__services = new import_ServicesManager.default(this);
150
- this.__events = new import_EventsManager.default(element, this);
151
- this.__children = new import_ChildrenManager.default(this, element, __config.components || {}, this.__events);
152
- this.__refs = new import_RefsManager.default(this, element, __config.refs || [], this.__events);
153
- if (isDev) {
154
- this.__debug("constructor", this);
155
- }
156
- return this;
157
- }
158
158
  $mount() {
159
159
  if (this.$isMounted) {
160
160
  return this;
@@ -292,3 +292,4 @@ __publicField(Base, "config", {
292
292
  ]
293
293
  });
294
294
  module.exports = __toCommonJS(Base_exports);
295
+ if (module.exports.default) module.exports = module.exports.default;
package/Base/index.js CHANGED
@@ -1,3 +1,9 @@
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
+ };
1
7
  import { getComponentElements } from "./utils.js";
2
8
  import ChildrenManager from "./managers/ChildrenManager.js";
3
9
  import RefsManager from "./managers/RefsManager.js";
@@ -9,12 +15,44 @@ const isDev = typeof __DEV__ !== "undefined" && __DEV__;
9
15
  function noop() {
10
16
  }
11
17
  class Base extends EventTarget {
12
- static $isBase = true;
13
- $parent = null;
14
- $id;
15
- $el;
16
- $isMounted = false;
17
- __eventHandlers = /* @__PURE__ */ new Map();
18
+ constructor(element) {
19
+ super();
20
+ __publicField(this, "$parent", null);
21
+ __publicField(this, "$id");
22
+ __publicField(this, "$el");
23
+ __publicField(this, "$isMounted", false);
24
+ __publicField(this, "__eventHandlers", /* @__PURE__ */ new Map());
25
+ __publicField(this, "__services");
26
+ __publicField(this, "__refs");
27
+ __publicField(this, "__options");
28
+ __publicField(this, "__children");
29
+ __publicField(this, "__events");
30
+ if (!element) {
31
+ throw new Error("The root element must be defined.");
32
+ }
33
+ const { __config } = this;
34
+ if (__config.name === "Base") {
35
+ throw new Error("The `config.name` property is required.");
36
+ }
37
+ this.$id = `${__config.name}-${id}`;
38
+ id += 1;
39
+ this.$el = element;
40
+ if (!("__base__" in this.$el)) {
41
+ Object.defineProperty(this.$el, "__base__", {
42
+ get: () => this,
43
+ configurable: true
44
+ });
45
+ }
46
+ this.__options = new OptionsManager(element, __config.options || {}, __config);
47
+ this.__services = new ServicesManager(this);
48
+ this.__events = new EventsManager(element, this);
49
+ this.__children = new ChildrenManager(this, element, __config.components || {}, this.__events);
50
+ this.__refs = new RefsManager(this, element, __config.refs || [], this.__events);
51
+ if (isDev) {
52
+ this.__debug("constructor", this);
53
+ }
54
+ return this;
55
+ }
18
56
  get $root() {
19
57
  if (!this.$parent) {
20
58
  return this;
@@ -50,38 +88,18 @@ class Base extends EventTarget {
50
88
  }
51
89
  return config;
52
90
  }
53
- static config = {
54
- name: "Base",
55
- emits: [
56
- "mounted",
57
- "updated",
58
- "destroyed",
59
- "terminated",
60
- "ticked",
61
- "scrolled",
62
- "resized",
63
- "moved",
64
- "loaded",
65
- "keyed"
66
- ]
67
- };
68
- __services;
69
91
  get $services() {
70
92
  return this.__services;
71
93
  }
72
- __refs;
73
94
  get $refs() {
74
95
  return this.__refs;
75
96
  }
76
- __options;
77
97
  get $options() {
78
98
  return this.__options;
79
99
  }
80
- __children;
81
100
  get $children() {
82
101
  return this.__children;
83
102
  }
84
- __events;
85
103
  get $log() {
86
104
  return this.__options.log ? window.console.log.bind(window, `[${this.__config.name}]`) : noop;
87
105
  }
@@ -105,34 +123,6 @@ class Base extends EventTarget {
105
123
  const eventHandlers = this.__eventHandlers.get(event);
106
124
  return eventHandlers && eventHandlers.size > 0;
107
125
  }
108
- constructor(element) {
109
- super();
110
- if (!element) {
111
- throw new Error("The root element must be defined.");
112
- }
113
- const { __config } = this;
114
- if (__config.name === "Base") {
115
- throw new Error("The `config.name` property is required.");
116
- }
117
- this.$id = `${__config.name}-${id}`;
118
- id += 1;
119
- this.$el = element;
120
- if (!("__base__" in this.$el)) {
121
- Object.defineProperty(this.$el, "__base__", {
122
- get: () => this,
123
- configurable: true
124
- });
125
- }
126
- this.__options = new OptionsManager(element, __config.options || {}, __config);
127
- this.__services = new ServicesManager(this);
128
- this.__events = new EventsManager(element, this);
129
- this.__children = new ChildrenManager(this, element, __config.components || {}, this.__events);
130
- this.__refs = new RefsManager(this, element, __config.refs || [], this.__events);
131
- if (isDev) {
132
- this.__debug("constructor", this);
133
- }
134
- return this;
135
- }
136
126
  $mount() {
137
127
  if (this.$isMounted) {
138
128
  return this;
@@ -253,6 +243,22 @@ class Base extends EventTarget {
253
243
  return getComponentElements(nameOrSelector).map((el) => new this(el).$mount());
254
244
  }
255
245
  }
246
+ __publicField(Base, "$isBase", true);
247
+ __publicField(Base, "config", {
248
+ name: "Base",
249
+ emits: [
250
+ "mounted",
251
+ "updated",
252
+ "destroyed",
253
+ "terminated",
254
+ "ticked",
255
+ "scrolled",
256
+ "resized",
257
+ "moved",
258
+ "loaded",
259
+ "keyed"
260
+ ]
261
+ });
256
262
  export {
257
263
  Base as default
258
264
  };
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
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;
5
6
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
@@ -20,6 +21,10 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
20
21
  return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
21
22
  };
22
23
  })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
24
+ var __publicField = (obj, key, value) => {
25
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
26
+ return value;
27
+ };
23
28
 
24
29
  // packages/js-toolkit/Base/managers/ChildrenManager.js
25
30
  var ChildrenManager_exports = {};
@@ -28,14 +33,11 @@ __export(ChildrenManager_exports, {
28
33
  });
29
34
  var import_utils = require("../utils.cjs");
30
35
  var ChildrenManager = class {
31
- __base;
32
- __element;
33
- __components;
34
- __eventsManager;
35
- get registeredNames() {
36
- return Object.keys(this).filter((key) => !key.startsWith("__"));
37
- }
38
36
  constructor(base, element, components, eventsManager) {
37
+ __publicField(this, "__base");
38
+ __publicField(this, "__element");
39
+ __publicField(this, "__components");
40
+ __publicField(this, "__eventsManager");
39
41
  Object.defineProperties(this, {
40
42
  __base: {
41
43
  enumerable: false,
@@ -59,6 +61,9 @@ var ChildrenManager = class {
59
61
  }
60
62
  });
61
63
  }
64
+ get registeredNames() {
65
+ return Object.keys(this).filter((key) => !key.startsWith("__"));
66
+ }
62
67
  registerAll() {
63
68
  Object.entries(this.__components).forEach(([name, component]) => this.__register(name, component));
64
69
  }
@@ -85,7 +90,8 @@ var ChildrenManager = class {
85
90
  return child;
86
91
  }
87
92
  return ComponentClass(this.__base).then((module2) => {
88
- return this.__getChild(el, module2.default ?? module2, name);
93
+ var _a;
94
+ return this.__getChild(el, (_a = module2.default) != null ? _a : module2, name);
89
95
  });
90
96
  }
91
97
  mountAll() {
@@ -122,3 +128,4 @@ var ChildrenManager = class {
122
128
  }
123
129
  };
124
130
  module.exports = __toCommonJS(ChildrenManager_exports);
131
+ if (module.exports.default) module.exports = module.exports.default;
@@ -1,13 +1,16 @@
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
+ };
1
7
  import { getComponentElements } from "../utils.js";
2
8
  class ChildrenManager {
3
- __base;
4
- __element;
5
- __components;
6
- __eventsManager;
7
- get registeredNames() {
8
- return Object.keys(this).filter((key) => !key.startsWith("__"));
9
- }
10
9
  constructor(base, element, components, eventsManager) {
10
+ __publicField(this, "__base");
11
+ __publicField(this, "__element");
12
+ __publicField(this, "__components");
13
+ __publicField(this, "__eventsManager");
11
14
  Object.defineProperties(this, {
12
15
  __base: {
13
16
  enumerable: false,
@@ -31,6 +34,9 @@ class ChildrenManager {
31
34
  }
32
35
  });
33
36
  }
37
+ get registeredNames() {
38
+ return Object.keys(this).filter((key) => !key.startsWith("__"));
39
+ }
34
40
  registerAll() {
35
41
  Object.entries(this.__components).forEach(([name, component]) => this.__register(name, component));
36
42
  }
@@ -57,7 +63,8 @@ class ChildrenManager {
57
63
  return child;
58
64
  }
59
65
  return ComponentClass(this.__base).then((module) => {
60
- return this.__getChild(el, module.default ?? module, name);
66
+ var _a;
67
+ return this.__getChild(el, (_a = module.default) != null ? _a : module, name);
61
68
  });
62
69
  }
63
70
  mountAll() {
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
8
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
9
  var __export = (target, all) => {
9
10
  for (var name in all)
@@ -25,6 +26,10 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
25
26
  return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
27
  };
27
28
  })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
29
+ var __publicField = (obj, key, value) => {
30
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
31
+ return value;
32
+ };
28
33
 
29
34
  // packages/js-toolkit/Base/managers/EventsManager.js
30
35
  var EventsManager_exports = {};
@@ -34,52 +39,52 @@ __export(EventsManager_exports, {
34
39
  var import_getAllProperties = __toESM(require("../../utils/object/getAllProperties.cjs"), 1);
35
40
  var import_RefsManager = __toESM(require("./RefsManager.cjs"), 1);
36
41
  var EventsManager = class {
37
- __rootElement;
38
- __base;
39
- __methodsCache = /* @__PURE__ */ new Map();
40
- __rootElementHandler = {
41
- handleEvent: (event) => {
42
- const normalizedEventName = EventsManager.normalizeName(event.type);
43
- const method = `on${normalizedEventName}`;
44
- this.__base[method](event);
45
- }
46
- };
47
- __refsHandler = {
48
- handleEvent: (event) => {
49
- const ref = event.currentTarget;
50
- const refName = import_RefsManager.default.normalizeRefName(ref.dataset.ref);
51
- const normalizedRefName = EventsManager.normalizeName(refName);
52
- const normalizedEventName = EventsManager.normalizeName(event.type);
53
- const method = `on${normalizedRefName}${normalizedEventName}`;
54
- let index = 0;
55
- if (Array.isArray(this.__base.$refs[refName])) {
56
- index = this.__base.$refs[refName].indexOf(ref);
42
+ constructor(rootElement, base) {
43
+ __publicField(this, "__rootElement");
44
+ __publicField(this, "__base");
45
+ __publicField(this, "__methodsCache", /* @__PURE__ */ new Map());
46
+ __publicField(this, "__rootElementHandler", {
47
+ handleEvent: (event) => {
48
+ const normalizedEventName = EventsManager.normalizeName(event.type);
49
+ const method = `on${normalizedEventName}`;
50
+ this.__base[method](event);
57
51
  }
58
- this.__base[method](event, index);
59
- }
60
- };
61
- __childrenHandler = {
62
- handleEvent: (event) => {
63
- const child = event.currentTarget;
64
- let childName;
65
- let index = 0;
66
- const childrenManager = this.__base.$children;
67
- childrenManager.registeredNames.find((name) => {
68
- if (childrenManager[name].includes(child)) {
69
- childName = name;
70
- index = childrenManager[name].indexOf(child);
71
- return true;
52
+ });
53
+ __publicField(this, "__refsHandler", {
54
+ handleEvent: (event) => {
55
+ const ref = event.currentTarget;
56
+ const refName = import_RefsManager.default.normalizeRefName(ref.dataset.ref);
57
+ const normalizedRefName = EventsManager.normalizeName(refName);
58
+ const normalizedEventName = EventsManager.normalizeName(event.type);
59
+ const method = `on${normalizedRefName}${normalizedEventName}`;
60
+ let index = 0;
61
+ if (Array.isArray(this.__base.$refs[refName])) {
62
+ index = this.__base.$refs[refName].indexOf(ref);
72
63
  }
73
- return false;
74
- });
75
- const normalizedRefName = EventsManager.normalizeName(childName);
76
- const normalizedEventName = EventsManager.normalizeName(event.type);
77
- const method = `on${normalizedRefName}${normalizedEventName}`;
78
- const args = Array.isArray(event.detail) ? event.detail : [];
79
- this.__base[method](...args, index, event);
80
- }
81
- };
82
- constructor(rootElement, base) {
64
+ this.__base[method](event, index);
65
+ }
66
+ });
67
+ __publicField(this, "__childrenHandler", {
68
+ handleEvent: (event) => {
69
+ const child = event.currentTarget;
70
+ let childName;
71
+ let index = 0;
72
+ const childrenManager = this.__base.$children;
73
+ childrenManager.registeredNames.find((name) => {
74
+ if (childrenManager[name].includes(child)) {
75
+ childName = name;
76
+ index = childrenManager[name].indexOf(child);
77
+ return true;
78
+ }
79
+ return false;
80
+ });
81
+ const normalizedRefName = EventsManager.normalizeName(childName);
82
+ const normalizedEventName = EventsManager.normalizeName(event.type);
83
+ const method = `on${normalizedRefName}${normalizedEventName}`;
84
+ const args = Array.isArray(event.detail) ? event.detail : [];
85
+ this.__base[method](...args, index, event);
86
+ }
87
+ });
83
88
  Object.defineProperties(this, {
84
89
  __rootElement: {
85
90
  enumerable: false,
@@ -182,3 +187,4 @@ var EventsManager = class {
182
187
  }
183
188
  };
184
189
  module.exports = __toCommonJS(EventsManager_exports);
190
+ if (module.exports.default) module.exports = module.exports.default;
@@ -1,52 +1,58 @@
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
+ };
1
7
  import getAllProperties from "../../utils/object/getAllProperties.js";
2
8
  import RefsManager from "./RefsManager.js";
3
9
  class EventsManager {
4
- __rootElement;
5
- __base;
6
- __methodsCache = /* @__PURE__ */ new Map();
7
- __rootElementHandler = {
8
- handleEvent: (event) => {
9
- const normalizedEventName = EventsManager.normalizeName(event.type);
10
- const method = `on${normalizedEventName}`;
11
- this.__base[method](event);
12
- }
13
- };
14
- __refsHandler = {
15
- handleEvent: (event) => {
16
- const ref = event.currentTarget;
17
- const refName = RefsManager.normalizeRefName(ref.dataset.ref);
18
- const normalizedRefName = EventsManager.normalizeName(refName);
19
- const normalizedEventName = EventsManager.normalizeName(event.type);
20
- const method = `on${normalizedRefName}${normalizedEventName}`;
21
- let index = 0;
22
- if (Array.isArray(this.__base.$refs[refName])) {
23
- index = this.__base.$refs[refName].indexOf(ref);
10
+ constructor(rootElement, base) {
11
+ __publicField(this, "__rootElement");
12
+ __publicField(this, "__base");
13
+ __publicField(this, "__methodsCache", /* @__PURE__ */ new Map());
14
+ __publicField(this, "__rootElementHandler", {
15
+ handleEvent: (event) => {
16
+ const normalizedEventName = EventsManager.normalizeName(event.type);
17
+ const method = `on${normalizedEventName}`;
18
+ this.__base[method](event);
24
19
  }
25
- this.__base[method](event, index);
26
- }
27
- };
28
- __childrenHandler = {
29
- handleEvent: (event) => {
30
- const child = event.currentTarget;
31
- let childName;
32
- let index = 0;
33
- const childrenManager = this.__base.$children;
34
- childrenManager.registeredNames.find((name) => {
35
- if (childrenManager[name].includes(child)) {
36
- childName = name;
37
- index = childrenManager[name].indexOf(child);
38
- return true;
20
+ });
21
+ __publicField(this, "__refsHandler", {
22
+ handleEvent: (event) => {
23
+ const ref = event.currentTarget;
24
+ const refName = RefsManager.normalizeRefName(ref.dataset.ref);
25
+ const normalizedRefName = EventsManager.normalizeName(refName);
26
+ const normalizedEventName = EventsManager.normalizeName(event.type);
27
+ const method = `on${normalizedRefName}${normalizedEventName}`;
28
+ let index = 0;
29
+ if (Array.isArray(this.__base.$refs[refName])) {
30
+ index = this.__base.$refs[refName].indexOf(ref);
39
31
  }
40
- return false;
41
- });
42
- const normalizedRefName = EventsManager.normalizeName(childName);
43
- const normalizedEventName = EventsManager.normalizeName(event.type);
44
- const method = `on${normalizedRefName}${normalizedEventName}`;
45
- const args = Array.isArray(event.detail) ? event.detail : [];
46
- this.__base[method](...args, index, event);
47
- }
48
- };
49
- constructor(rootElement, base) {
32
+ this.__base[method](event, index);
33
+ }
34
+ });
35
+ __publicField(this, "__childrenHandler", {
36
+ handleEvent: (event) => {
37
+ const child = event.currentTarget;
38
+ let childName;
39
+ let index = 0;
40
+ const childrenManager = this.__base.$children;
41
+ childrenManager.registeredNames.find((name) => {
42
+ if (childrenManager[name].includes(child)) {
43
+ childName = name;
44
+ index = childrenManager[name].indexOf(child);
45
+ return true;
46
+ }
47
+ return false;
48
+ });
49
+ const normalizedRefName = EventsManager.normalizeName(childName);
50
+ const normalizedEventName = EventsManager.normalizeName(event.type);
51
+ const method = `on${normalizedRefName}${normalizedEventName}`;
52
+ const args = Array.isArray(event.detail) ? event.detail : [];
53
+ this.__base[method](...args, index, event);
54
+ }
55
+ });
50
56
  Object.defineProperties(this, {
51
57
  __rootElement: {
52
58
  enumerable: false,
@@ -39,19 +39,20 @@ __export(OptionsManager_exports, {
39
39
  var import_deepmerge = __toESM(require("deepmerge"), 1);
40
40
  var import_isObject = __toESM(require("../../utils/object/isObject.cjs"), 1);
41
41
  var _OptionsManager = class {
42
- __element;
43
- __values = {};
44
- __defaultValues = {
45
- String: "",
46
- Number: 0,
47
- Boolean: false,
48
- Array: () => [],
49
- Object: () => ({})
50
- };
51
- name = "Base";
52
- debug = false;
53
- log = false;
54
42
  constructor(element, schema, baseConfig) {
43
+ __publicField(this, "__element");
44
+ __publicField(this, "__values", {});
45
+ __publicField(this, "__defaultValues", {
46
+ String: "",
47
+ Number: 0,
48
+ Boolean: false,
49
+ Array: () => [],
50
+ Object: () => ({})
51
+ });
52
+ __publicField(this, "name", "Base");
53
+ __publicField(this, "debug", false);
54
+ __publicField(this, "log", false);
55
+ var _a, _b;
55
56
  Object.defineProperties(this, {
56
57
  __element: {
57
58
  enumerable: false,
@@ -72,11 +73,11 @@ var _OptionsManager = class {
72
73
  this.name = baseConfig.name;
73
74
  schema.debug = {
74
75
  type: Boolean,
75
- default: baseConfig.debug ?? false
76
+ default: (_a = baseConfig.debug) != null ? _a : false
76
77
  };
77
78
  schema.log = {
78
79
  type: Boolean,
79
- default: baseConfig.log ?? false
80
+ default: (_b = baseConfig.log) != null ? _b : false
80
81
  };
81
82
  Object.entries(schema).forEach(([name, config]) => {
82
83
  this.__register(name, config);
@@ -173,3 +174,4 @@ var OptionsManager = _OptionsManager;
173
174
  __publicField(OptionsManager, "types", [String, Number, Boolean, Array, Object]);
174
175
  __publicField(OptionsManager, "__propertyNameCache", /* @__PURE__ */ new Map());
175
176
  module.exports = __toCommonJS(OptionsManager_exports);
177
+ if (module.exports.default) module.exports = module.exports.default;