@studiometa/js-toolkit 2.3.0 → 2.4.2

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 (111) hide show
  1. package/Base/index.cjs +51 -43
  2. package/Base/index.d.ts +23 -18
  3. package/Base/index.js +70 -59
  4. package/Base/managers/AbstractManager.cjs +23 -13
  5. package/Base/managers/AbstractManager.d.ts +3 -3
  6. package/Base/managers/AbstractManager.js +24 -13
  7. package/Base/managers/ChildrenManager.cjs +21 -5
  8. package/Base/managers/ChildrenManager.d.ts +1 -1
  9. package/Base/managers/ChildrenManager.js +18 -4
  10. package/Base/managers/EventsManager.cjs +62 -44
  11. package/Base/managers/EventsManager.d.ts +3 -3
  12. package/Base/managers/EventsManager.js +59 -43
  13. package/Base/managers/OptionsManager.cjs +32 -12
  14. package/Base/managers/OptionsManager.d.ts +2 -2
  15. package/Base/managers/OptionsManager.js +29 -11
  16. package/Base/managers/RefsManager.cjs +19 -5
  17. package/Base/managers/RefsManager.js +15 -4
  18. package/Base/managers/ResponsiveOptionsManager.cjs +4 -1
  19. package/Base/managers/ServicesManager.cjs +21 -6
  20. package/Base/managers/ServicesManager.d.ts +1 -1
  21. package/Base/managers/ServicesManager.js +18 -5
  22. package/Base/utils.cjs +5 -1
  23. package/Base/utils.d.ts +2 -2
  24. package/Base/utils.js +5 -1
  25. package/README.md +3 -3
  26. package/decorators/index.cjs +4 -1
  27. package/decorators/withBreakpointManager.cjs +4 -1
  28. package/decorators/withBreakpointManager.d.ts +1 -1
  29. package/decorators/withBreakpointObserver.cjs +26 -14
  30. package/decorators/withBreakpointObserver.d.ts +1 -1
  31. package/decorators/withBreakpointObserver.js +23 -13
  32. package/decorators/withDrag.cjs +19 -8
  33. package/decorators/withDrag.d.ts +2 -4
  34. package/decorators/withDrag.js +16 -7
  35. package/decorators/withExtraConfig.cjs +12 -4
  36. package/decorators/withExtraConfig.js +9 -3
  37. package/decorators/withFreezedOptions.cjs +9 -1
  38. package/decorators/withFreezedOptions.js +10 -1
  39. package/decorators/withIntersectionObserver.cjs +25 -17
  40. package/decorators/withIntersectionObserver.d.ts +1 -1
  41. package/decorators/withIntersectionObserver.js +26 -17
  42. package/decorators/withMountWhenInView.cjs +30 -22
  43. package/decorators/withMountWhenInView.d.ts +1 -1
  44. package/decorators/withMountWhenInView.js +31 -22
  45. package/decorators/withResponsiveOptions.cjs +4 -1
  46. package/decorators/withScrolledInView.cjs +99 -48
  47. package/decorators/withScrolledInView.d.ts +27 -6
  48. package/decorators/withScrolledInView.js +96 -47
  49. package/decorators/withVue2.cjs +15 -10
  50. package/decorators/withVue2.d.ts +1 -1
  51. package/decorators/withVue2.js +16 -10
  52. package/helpers/getDirectChildren.cjs +46 -0
  53. package/helpers/getDirectChildren.d.ts +24 -0
  54. package/helpers/getDirectChildren.js +24 -0
  55. package/helpers/getInstanceFromElement.cjs +2 -1
  56. package/helpers/getInstanceFromElement.js +2 -1
  57. package/helpers/importOnInteraction.cjs +1 -1
  58. package/helpers/importOnInteraction.d.ts +2 -2
  59. package/helpers/importOnInteraction.js +1 -1
  60. package/helpers/importWhenIdle.cjs +10 -6
  61. package/helpers/importWhenIdle.js +10 -6
  62. package/helpers/importWhenVisible.cjs +1 -1
  63. package/helpers/importWhenVisible.d.ts +2 -2
  64. package/helpers/importWhenVisible.js +1 -1
  65. package/helpers/index.cjs +6 -1
  66. package/helpers/index.d.ts +1 -0
  67. package/helpers/index.js +1 -0
  68. package/index.cjs +4 -1
  69. package/package.json +2 -2
  70. package/services/drag.cjs +4 -1
  71. package/services/index.cjs +4 -1
  72. package/services/index.d.ts +7 -0
  73. package/services/key.cjs +5 -2
  74. package/services/key.js +1 -1
  75. package/services/pointer.cjs +3 -2
  76. package/services/pointer.js +3 -2
  77. package/services/resize.cjs +4 -1
  78. package/services/scroll.cjs +4 -1
  79. package/utils/collide/index.cjs +4 -1
  80. package/utils/css/animate.cjs +27 -12
  81. package/utils/css/animate.js +23 -11
  82. package/utils/css/index.cjs +4 -1
  83. package/utils/css/matrix.cjs +2 -1
  84. package/utils/css/matrix.js +2 -1
  85. package/utils/css/transform.cjs +2 -1
  86. package/utils/css/transform.js +2 -1
  87. package/utils/css/transition.cjs +11 -6
  88. package/utils/css/transition.js +8 -5
  89. package/utils/focusTrap.cjs +4 -1
  90. package/utils/history.cjs +4 -1
  91. package/utils/history.js +4 -1
  92. package/utils/index.cjs +4 -1
  93. package/utils/math/clamp01.cjs +4 -1
  94. package/utils/math/index.cjs +4 -1
  95. package/utils/math/inertiaFinalValue.cjs +4 -1
  96. package/utils/nextTick.cjs +5 -3
  97. package/utils/nextTick.js +5 -3
  98. package/utils/object/autoBind.cjs +4 -1
  99. package/utils/object/index.cjs +4 -1
  100. package/utils/scrollTo.cjs +4 -1
  101. package/utils/string/index.cjs +4 -1
  102. package/utils/string/withLeadingCharacters.cjs +4 -1
  103. package/utils/string/withLeadingSlash.cjs +4 -1
  104. package/utils/string/withTrailingCharacters.cjs +4 -1
  105. package/utils/string/withTrailingSlash.cjs +4 -1
  106. package/utils/string/withoutLeadingCharactersRecursive.cjs +4 -1
  107. package/utils/string/withoutLeadingSlash.cjs +4 -1
  108. package/utils/string/withoutTrailingCharactersRecursive.cjs +4 -1
  109. package/utils/string/withoutTrailingSlash.cjs +4 -1
  110. package/utils/tween.cjs +6 -2
  111. package/utils/tween.js +2 -1
@@ -1,7 +1,15 @@
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 AbstractManager from "./AbstractManager.js";
2
8
  import { getComponentElements } from "../utils.js";
3
9
  function __getChild(that, el, ComponentClass, name) {
4
- const asyncComponentPromise = that.__asyncComponentPromises.get(ComponentClass);
10
+ const asyncComponentPromise = that.__asyncComponentPromises.get(
11
+ ComponentClass
12
+ );
5
13
  if ("$isBase" in ComponentClass || asyncComponentPromise && asyncComponentPromise.status === "resolved") {
6
14
  let ctor = ComponentClass;
7
15
  if (asyncComponentPromise) {
@@ -23,7 +31,8 @@ function __getChild(that, el, ComponentClass, name) {
23
31
  });
24
32
  }
25
33
  return promise.then((module) => {
26
- const ctor = module.default ?? module;
34
+ var _a;
35
+ const ctor = (_a = module.default) != null ? _a : module;
27
36
  that.__asyncComponentPromises.set(ComponentClass, {
28
37
  promise,
29
38
  status: "resolved",
@@ -69,12 +78,17 @@ function __triggerHookForAll(that, hook) {
69
78
  });
70
79
  }
71
80
  class ChildrenManager extends AbstractManager {
72
- __asyncComponentPromises = /* @__PURE__ */ new WeakMap();
81
+ constructor() {
82
+ super(...arguments);
83
+ __publicField(this, "__asyncComponentPromises", /* @__PURE__ */ new WeakMap());
84
+ }
73
85
  get registeredNames() {
74
86
  return Object.keys(this).filter((key) => !key.startsWith("__"));
75
87
  }
76
88
  registerAll() {
77
- 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
+ );
78
92
  }
79
93
  mountAll() {
80
94
  __triggerHookForAll(this, "$mount");
@@ -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 __export = (target, all) => {
8
9
  for (var name in all)
9
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,8 +17,15 @@ var __copyProps = (to, from, except, desc) => {
16
17
  }
17
18
  return to;
18
19
  };
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));
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
+ ));
20
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var __publicField = (obj, key, value) => {
26
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
27
+ return value;
28
+ };
21
29
 
22
30
  // packages/js-toolkit/Base/managers/EventsManager.js
23
31
  var EventsManager_exports = {};
@@ -35,7 +43,10 @@ var import_RefsManager = require("./RefsManager.cjs");
35
43
  var names = /* @__PURE__ */ new Map();
36
44
  function normalizeName(name) {
37
45
  if (!names.has(name)) {
38
- 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
+ );
39
50
  }
40
51
  return names.get(name);
41
52
  }
@@ -63,7 +74,12 @@ function getEventMethodsByName(that, name = "") {
63
74
  const key = regex.toString();
64
75
  let methods = that.__methodsCache.get(key);
65
76
  if (!methods) {
66
- 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
+ );
67
83
  that.__methodsCache.set(key, methods);
68
84
  }
69
85
  return methods;
@@ -94,49 +110,51 @@ function manageRootElement(that, mode = "add") {
94
110
  });
95
111
  }
96
112
  var EventsManager = class extends import_AbstractManager.default {
97
- __methodsCache = /* @__PURE__ */ new Map();
98
- __rootElementHandler = {
99
- handleEvent: (event) => {
100
- const normalizedEventName = normalizeName(event.type);
101
- const method = `on${normalizedEventName}`;
102
- if (event instanceof CustomEvent && (0, import_utils.isArray)(event.detail) && event.detail.length) {
103
- this.__base[method](...event.detail, event);
104
- } else {
105
- this.__base[method](event);
106
- }
107
- }
108
- };
109
- __refsHandler = {
110
- handleEvent: (event) => {
111
- const ref = event.currentTarget;
112
- const refName = (0, import_RefsManager.normalizeRefName)(ref.dataset.ref);
113
- const normalizedRefName = normalizeName(refName);
114
- const normalizedEventName = normalizeName(event.type);
115
- const method = `on${normalizedRefName}${normalizedEventName}`;
116
- let index = 0;
117
- if ((0, import_utils.isArray)(this.__base.$refs[refName])) {
118
- index = this.__base.$refs[refName].indexOf(ref);
119
- }
120
- this.__base[method](event, index);
121
- }
122
- };
123
- __childrenHandler = {
124
- handleEvent: (event) => {
125
- const childrenManager = this.__base.$children;
126
- const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
127
- name: childName,
128
- child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
129
- })).find(({ child }) => child);
130
- const normalizedChildName = normalizeName(name);
131
- const normalizedEventName = normalizeName(event.type);
132
- const method = `on${normalizedChildName}${normalizedEventName}`;
133
- const index = childrenManager[name].indexOf(resolvedChild);
134
- const args = (0, import_utils.isArray)(event.detail) ? event.detail : [];
135
- this.__base[method](...args, index, event);
136
- }
137
- };
138
113
  constructor(base) {
139
114
  super(base);
115
+ __publicField(this, "__methodsCache", /* @__PURE__ */ new Map());
116
+ __publicField(this, "__rootElementHandler", {
117
+ handleEvent: (event) => {
118
+ const normalizedEventName = normalizeName(event.type);
119
+ const method = `on${normalizedEventName}`;
120
+ if (event instanceof CustomEvent && (0, import_utils.isArray)(event.detail) && event.detail.length) {
121
+ this.__base[method](...event.detail, event);
122
+ } else {
123
+ this.__base[method](event);
124
+ }
125
+ }
126
+ });
127
+ __publicField(this, "__refsHandler", {
128
+ handleEvent: (event) => {
129
+ const ref = event.currentTarget;
130
+ const refName = (0, import_RefsManager.normalizeRefName)(ref.dataset.ref);
131
+ const normalizedRefName = normalizeName(refName);
132
+ const normalizedEventName = normalizeName(event.type);
133
+ const method = `on${normalizedRefName}${normalizedEventName}`;
134
+ let index = 0;
135
+ if ((0, import_utils.isArray)(this.__base.$refs[refName])) {
136
+ index = this.__base.$refs[refName].indexOf(ref);
137
+ }
138
+ this.__base[method](event, index);
139
+ }
140
+ });
141
+ __publicField(this, "__childrenHandler", {
142
+ handleEvent: (event) => {
143
+ const childrenManager = this.__base.$children;
144
+ const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
145
+ name: childName,
146
+ child: childrenManager[childName].find(
147
+ (instance) => instance === event.currentTarget || instance.$el === event.currentTarget
148
+ )
149
+ })).find(({ child }) => child);
150
+ const normalizedChildName = normalizeName(name);
151
+ const normalizedEventName = normalizeName(event.type);
152
+ const method = `on${normalizedChildName}${normalizedEventName}`;
153
+ const index = childrenManager[name].indexOf(resolvedChild);
154
+ const args = (0, import_utils.isArray)(event.detail) ? event.detail : [];
155
+ this.__base[method](...args, index, event);
156
+ }
157
+ });
140
158
  this.__hideProperties([
141
159
  "__methodsCache",
142
160
  "__rootElementHandler",
@@ -83,7 +83,7 @@ export default class EventsManager extends AbstractManager {
83
83
  * A base instance.
84
84
  * @returns {void}
85
85
  */
86
- bindChild(name: string, instance: Base): void;
86
+ bindChild(name: string, instance: import("../index.js").default<any>): void;
87
87
  /**
88
88
  * Unbind event methods to the given child instance.
89
89
  *
@@ -93,7 +93,7 @@ export default class EventsManager extends AbstractManager {
93
93
  * A base instance.
94
94
  * @returns {void}
95
95
  */
96
- unbindChild(name: string, instance: Base): void;
96
+ unbindChild(name: string, instance: import("../index.js").default<any>): void;
97
97
  /**
98
98
  * Bind event methods on the root element.
99
99
  *
@@ -107,6 +107,6 @@ export default class EventsManager extends AbstractManager {
107
107
  */
108
108
  unbindRootElement(): void;
109
109
  }
110
- export type Base = import('../index.js').default;
110
+ export type Base = import("../index.js").default<any>;
111
111
  export type ChildrenManager = import('./ChildrenManager.js').default;
112
112
  import AbstractManager from "./AbstractManager.js";
@@ -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 getAllProperties from "../../utils/object/getAllProperties.js";
2
8
  import { isArray } from "../../utils/index.js";
3
9
  import { getEventTarget, eventIsNative, eventIsDefinedInConfig } from "../utils.js";
@@ -6,7 +12,10 @@ import { normalizeRefName } from "./RefsManager.js";
6
12
  const names = /* @__PURE__ */ new Map();
7
13
  function normalizeName(name) {
8
14
  if (!names.has(name)) {
9
- 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
+ );
10
19
  }
11
20
  return names.get(name);
12
21
  }
@@ -34,7 +43,12 @@ function getEventMethodsByName(that, name = "") {
34
43
  const key = regex.toString();
35
44
  let methods = that.__methodsCache.get(key);
36
45
  if (!methods) {
37
- 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
+ );
38
52
  that.__methodsCache.set(key, methods);
39
53
  }
40
54
  return methods;
@@ -65,49 +79,51 @@ function manageRootElement(that, mode = "add") {
65
79
  });
66
80
  }
67
81
  class EventsManager extends AbstractManager {
68
- __methodsCache = /* @__PURE__ */ new Map();
69
- __rootElementHandler = {
70
- handleEvent: (event) => {
71
- const normalizedEventName = normalizeName(event.type);
72
- const method = `on${normalizedEventName}`;
73
- if (event instanceof CustomEvent && isArray(event.detail) && event.detail.length) {
74
- this.__base[method](...event.detail, event);
75
- } else {
76
- this.__base[method](event);
77
- }
78
- }
79
- };
80
- __refsHandler = {
81
- handleEvent: (event) => {
82
- const ref = event.currentTarget;
83
- const refName = normalizeRefName(ref.dataset.ref);
84
- const normalizedRefName = normalizeName(refName);
85
- const normalizedEventName = normalizeName(event.type);
86
- const method = `on${normalizedRefName}${normalizedEventName}`;
87
- let index = 0;
88
- if (isArray(this.__base.$refs[refName])) {
89
- index = this.__base.$refs[refName].indexOf(ref);
90
- }
91
- this.__base[method](event, index);
92
- }
93
- };
94
- __childrenHandler = {
95
- handleEvent: (event) => {
96
- const childrenManager = this.__base.$children;
97
- const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
98
- name: childName,
99
- child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
100
- })).find(({ child }) => child);
101
- const normalizedChildName = normalizeName(name);
102
- const normalizedEventName = normalizeName(event.type);
103
- const method = `on${normalizedChildName}${normalizedEventName}`;
104
- const index = childrenManager[name].indexOf(resolvedChild);
105
- const args = isArray(event.detail) ? event.detail : [];
106
- this.__base[method](...args, index, event);
107
- }
108
- };
109
82
  constructor(base) {
110
83
  super(base);
84
+ __publicField(this, "__methodsCache", /* @__PURE__ */ new Map());
85
+ __publicField(this, "__rootElementHandler", {
86
+ handleEvent: (event) => {
87
+ const normalizedEventName = normalizeName(event.type);
88
+ const method = `on${normalizedEventName}`;
89
+ if (event instanceof CustomEvent && isArray(event.detail) && event.detail.length) {
90
+ this.__base[method](...event.detail, event);
91
+ } else {
92
+ this.__base[method](event);
93
+ }
94
+ }
95
+ });
96
+ __publicField(this, "__refsHandler", {
97
+ handleEvent: (event) => {
98
+ const ref = event.currentTarget;
99
+ const refName = normalizeRefName(ref.dataset.ref);
100
+ const normalizedRefName = normalizeName(refName);
101
+ const normalizedEventName = normalizeName(event.type);
102
+ const method = `on${normalizedRefName}${normalizedEventName}`;
103
+ let index = 0;
104
+ if (isArray(this.__base.$refs[refName])) {
105
+ index = this.__base.$refs[refName].indexOf(ref);
106
+ }
107
+ this.__base[method](event, index);
108
+ }
109
+ });
110
+ __publicField(this, "__childrenHandler", {
111
+ handleEvent: (event) => {
112
+ const childrenManager = this.__base.$children;
113
+ const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
114
+ name: childName,
115
+ child: childrenManager[childName].find(
116
+ (instance) => instance === event.currentTarget || instance.$el === event.currentTarget
117
+ )
118
+ })).find(({ child }) => child);
119
+ const normalizedChildName = normalizeName(name);
120
+ const normalizedEventName = normalizeName(event.type);
121
+ const method = `on${normalizedChildName}${normalizedEventName}`;
122
+ const index = childrenManager[name].indexOf(resolvedChild);
123
+ const args = isArray(event.detail) ? event.detail : [];
124
+ this.__base[method](...args, index, event);
125
+ }
126
+ });
111
127
  this.__hideProperties([
112
128
  "__methodsCache",
113
129
  "__rootElementHandler",
@@ -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 __export = (target, all) => {
8
9
  for (var name in all)
9
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,8 +17,15 @@ var __copyProps = (to, from, except, desc) => {
16
17
  }
17
18
  return to;
18
19
  };
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));
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
+ ));
20
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var __publicField = (obj, key, value) => {
26
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
27
+ return value;
28
+ };
21
29
 
22
30
  // packages/js-toolkit/Base/managers/OptionsManager.js
23
31
  var OptionsManager_exports = {};
@@ -48,16 +56,21 @@ function __getPropertyName(name, prefix = "") {
48
56
  return propertyName;
49
57
  }
50
58
  function __register(that, name, config) {
59
+ var _a;
51
60
  if (!types.has(config.type)) {
52
61
  if (import_utils.isDev) {
53
- 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
+ );
54
65
  }
55
66
  return;
56
67
  }
57
- config.default = config.default ?? __defaultValues[config.type.name];
68
+ config.default = (_a = config.default) != null ? _a : __defaultValues[config.type.name];
58
69
  if ((config.type === Array || config.type === Object) && !(0, import_utils.isFunction)(config.default)) {
59
70
  if (import_utils.isDev) {
60
- 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
+ );
61
74
  }
62
75
  return;
63
76
  }
@@ -72,25 +85,30 @@ function __register(that, name, config) {
72
85
  });
73
86
  }
74
87
  var OptionsManager = class extends import_AbstractManager.default {
75
- __values = {};
76
- name = "Base";
77
- debug = false;
78
- log = false;
79
88
  constructor(base) {
89
+ var _a, _b;
80
90
  super(base);
91
+ __publicField(this, "__values", {});
92
+ __publicField(this, "name", "Base");
93
+ __publicField(this, "debug", false);
94
+ __publicField(this, "log", false);
81
95
  this.__hideProperties(["__values", "__defaultValues"]);
82
96
  const schema = this.__config.options || {};
83
97
  this.name = this.__config.name;
84
98
  schema.debug = {
85
99
  type: Boolean,
86
- default: this.__config.debug ?? false
100
+ default: (_a = this.__config.debug) != null ? _a : false
87
101
  };
88
102
  schema.log = {
89
103
  type: Boolean,
90
- default: this.__config.log ?? false
104
+ default: (_b = this.__config.log) != null ? _b : false
91
105
  };
92
106
  Object.entries(schema).forEach(([name, config]) => {
93
- __register(this, name, types.has(config) ? { type: config } : config);
107
+ __register(
108
+ this,
109
+ name,
110
+ types.has(config) ? { type: config } : config
111
+ );
94
112
  });
95
113
  }
96
114
  get(name, config) {
@@ -128,7 +146,9 @@ var OptionsManager = class extends import_AbstractManager.default {
128
146
  if (value.constructor.name !== type.name) {
129
147
  if (import_utils.isDev) {
130
148
  const val = (0, import_utils.isArray)(value) || (0, import_utils.isObject)(value) ? JSON.stringify(value) : value;
131
- 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
+ );
132
152
  }
133
153
  return;
134
154
  }
@@ -52,7 +52,7 @@ export default class OptionsManager extends AbstractManager {
52
52
  set(name: string, value: any, config: OptionObject): void;
53
53
  }
54
54
  export type DeepmergeOptions = import('deepmerge').Options;
55
- export type Base = import('../index.js').default;
55
+ export type Base = import("../index.js").default<any>;
56
56
  export type BaseConfig = import('../index.js').BaseConfig;
57
57
  export type OptionType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor;
58
58
  export type ArrayOption = {
@@ -79,7 +79,7 @@ export type BooleanOption = {
79
79
  };
80
80
  export type OptionObject = ArrayOption | ObjectOption | StringOption | NumberOption | BooleanOption;
81
81
  export type OptionsSchema = {
82
- [name: string]: OptionType | OptionObject;
82
+ [name: string]: OptionObject | OptionType;
83
83
  };
84
84
  export type OptionsInterface = {
85
85
  [optionName: string]: any;
@@ -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 deepmerge from "deepmerge";
2
8
  import AbstractManager from "./AbstractManager.js";
3
9
  import { isDev, isFunction, isDefined, isBoolean, isArray, isObject } from "../../utils/index.js";
@@ -20,16 +26,21 @@ function __getPropertyName(name, prefix = "") {
20
26
  return propertyName;
21
27
  }
22
28
  function __register(that, name, config) {
29
+ var _a;
23
30
  if (!types.has(config.type)) {
24
31
  if (isDev) {
25
- 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
+ );
26
35
  }
27
36
  return;
28
37
  }
29
- config.default = config.default ?? __defaultValues[config.type.name];
38
+ config.default = (_a = config.default) != null ? _a : __defaultValues[config.type.name];
30
39
  if ((config.type === Array || config.type === Object) && !isFunction(config.default)) {
31
40
  if (isDev) {
32
- 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
+ );
33
44
  }
34
45
  return;
35
46
  }
@@ -44,25 +55,30 @@ function __register(that, name, config) {
44
55
  });
45
56
  }
46
57
  class OptionsManager extends AbstractManager {
47
- __values = {};
48
- name = "Base";
49
- debug = false;
50
- log = false;
51
58
  constructor(base) {
59
+ var _a, _b;
52
60
  super(base);
61
+ __publicField(this, "__values", {});
62
+ __publicField(this, "name", "Base");
63
+ __publicField(this, "debug", false);
64
+ __publicField(this, "log", false);
53
65
  this.__hideProperties(["__values", "__defaultValues"]);
54
66
  const schema = this.__config.options || {};
55
67
  this.name = this.__config.name;
56
68
  schema.debug = {
57
69
  type: Boolean,
58
- default: this.__config.debug ?? false
70
+ default: (_a = this.__config.debug) != null ? _a : false
59
71
  };
60
72
  schema.log = {
61
73
  type: Boolean,
62
- default: this.__config.log ?? false
74
+ default: (_b = this.__config.log) != null ? _b : false
63
75
  };
64
76
  Object.entries(schema).forEach(([name, config]) => {
65
- __register(this, name, types.has(config) ? { type: config } : config);
77
+ __register(
78
+ this,
79
+ name,
80
+ types.has(config) ? { type: config } : config
81
+ );
66
82
  });
67
83
  }
68
84
  get(name, config) {
@@ -100,7 +116,9 @@ class OptionsManager extends AbstractManager {
100
116
  if (value.constructor.name !== type.name) {
101
117
  if (isDev) {
102
118
  const val = isArray(value) || isObject(value) ? JSON.stringify(value) : value;
103
- 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
+ );
104
122
  }
105
123
  return;
106
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
  }
@@ -65,7 +78,8 @@ function __unregister(that, refName) {
65
78
  }
66
79
  var RefsManager = class extends import_AbstractManager.default {
67
80
  get __refs() {
68
- return this.__config.refs ?? [];
81
+ var _a;
82
+ return (_a = this.__config.refs) != null ? _a : [];
69
83
  }
70
84
  registerAll() {
71
85
  this.__refs.forEach((refName) => __register(this, refName));
@@ -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
  }
@@ -37,7 +47,8 @@ function __unregister(that, refName) {
37
47
  }
38
48
  class RefsManager extends AbstractManager {
39
49
  get __refs() {
40
- return this.__config.refs ?? [];
50
+ var _a;
51
+ return (_a = this.__config.refs) != null ? _a : [];
41
52
  }
42
53
  registerAll() {
43
54
  this.__refs.forEach((refName) => __register(this, refName));
@@ -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