@studiometa/js-toolkit 2.4.3 → 2.4.4-alpha.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 (48) hide show
  1. package/Base/index.d.ts +26 -39
  2. package/Base/managers/ResponsiveOptionsManager.cjs +1 -1
  3. package/Base/managers/ResponsiveOptionsManager.d.ts +3 -7
  4. package/Base/managers/ServicesManager.d.ts +5 -5
  5. package/Base/types.cjs +18 -0
  6. package/Base/types.d.ts +43 -0
  7. package/Base/types.js +0 -0
  8. package/decorators/index.cjs +1 -1
  9. package/decorators/index.d.ts +10 -10
  10. package/decorators/withBreakpointManager.cjs +2 -3
  11. package/decorators/withBreakpointManager.d.ts +84 -7
  12. package/decorators/withBreakpointManager.js +1 -2
  13. package/decorators/withBreakpointObserver.cjs +2 -2
  14. package/decorators/withBreakpointObserver.d.ts +89 -13
  15. package/decorators/withBreakpointObserver.js +1 -1
  16. package/decorators/withDrag.cjs +1 -1
  17. package/decorators/withDrag.d.ts +77 -23
  18. package/decorators/withExtraConfig.cjs +1 -1
  19. package/decorators/withExtraConfig.d.ts +77 -10
  20. package/decorators/withFreezedOptions.cjs +9 -7
  21. package/decorators/withFreezedOptions.d.ts +81 -11
  22. package/decorators/withFreezedOptions.js +8 -6
  23. package/decorators/withIntersectionObserver.cjs +2 -1
  24. package/decorators/withIntersectionObserver.d.ts +91 -17
  25. package/decorators/withIntersectionObserver.js +1 -0
  26. package/decorators/withMountWhenInView.cjs +1 -1
  27. package/decorators/withMountWhenInView.d.ts +91 -29
  28. package/decorators/withResponsiveOptions.cjs +2 -2
  29. package/decorators/withResponsiveOptions.d.ts +78 -5
  30. package/decorators/withResponsiveOptions.js +1 -1
  31. package/decorators/withScrolledInView.cjs +13 -7
  32. package/decorators/withScrolledInView.d.ts +169 -15
  33. package/decorators/withScrolledInView.js +12 -6
  34. package/decorators/withVue2.cjs +5 -5
  35. package/decorators/withVue2.d.ts +97 -6
  36. package/decorators/withVue2.js +4 -4
  37. package/index.cjs +1 -1
  38. package/index.d.ts +6 -5
  39. package/package.json +1 -1
  40. package/services/drag.d.ts +1 -1
  41. package/services/index.cjs +1 -1
  42. package/services/index.d.ts +33 -25
  43. package/services/key.d.ts +1 -1
  44. package/services/load.d.ts +1 -1
  45. package/services/pointer.d.ts +1 -1
  46. package/services/raf.d.ts +1 -1
  47. package/services/resize.d.ts +1 -1
  48. package/services/scroll.d.ts +1 -1
package/Base/index.d.ts CHANGED
@@ -36,9 +36,9 @@
36
36
  */
37
37
  /**
38
38
  * Base class.
39
- * @template {BaseTypeParameter} [BaseInterface={ $el: HTMLElement, $options: BaseOptions, $refs: BaseRefs, $children: { [name:string]: Base | Promise<Base> } }]
39
+ * @template {BaseTypeParameter} [T={ $el: HTMLElement, $options: BaseOptions, $refs: BaseRefs, $children: { [name:string]: Base | Promise<Base> } }]
40
40
  */
41
- export default class Base<BaseInterface extends BaseTypeParameter = {
41
+ export default class Base<T extends BaseTypeParameter = {
42
42
  $el: HTMLElement;
43
43
  $options: BaseOptions;
44
44
  $refs: BaseRefs;
@@ -81,9 +81,9 @@ export default class Base<BaseInterface extends BaseTypeParameter = {
81
81
  $id: string;
82
82
  /**
83
83
  * The root element.
84
- * @type {BaseInterface['$el'] & HTMLElement & { __base__?: WeakMap<BaseConstructor, Base | 'terminated'> }}
84
+ * @type {T['$el'] & HTMLElement & { __base__?: WeakMap<BaseConstructor, Base | 'terminated'> }}
85
85
  */
86
- $el: BaseInterface['$el'] & HTMLElement & {
86
+ $el: T['$el'] & HTMLElement & {
87
87
  __base__?: WeakMap<BaseConstructor, Base | 'terminated'>;
88
88
  };
89
89
  /**
@@ -94,10 +94,9 @@ export default class Base<BaseInterface extends BaseTypeParameter = {
94
94
  /**
95
95
  * Store the event handlers.
96
96
  *
97
- * @private
98
97
  * @type {Map<string, Set<EventListenerOrEventListenerObject>>}
99
98
  */
100
- private __eventHandlers;
99
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
101
100
  /**
102
101
  * Get the root instance of the app.
103
102
  * @returns {Base}
@@ -114,50 +113,44 @@ export default class Base<BaseInterface extends BaseTypeParameter = {
114
113
  * Merge configuration with the parents' configurations.
115
114
  *
116
115
  * @returns {BaseConfig}
117
- * @private
118
116
  */
119
- private get __config();
117
+ get __config(): BaseConfig;
120
118
  /**
121
119
  * @type {ServicesManager}
122
- * @private
123
120
  */
124
- private __services;
121
+ __services: ServicesManager;
125
122
  /**
126
123
  * @type {ServicesManager}
127
124
  */
128
125
  get $services(): ServicesManager;
129
126
  /**
130
- * @type {RefsManager & { [key in keyof BaseInterface['$refs']]: BaseInterface['$refs'][key] } & BaseRefs}
131
- * @private
127
+ * @type {RefsManager & T['$refs'] & BaseRefs}
132
128
  */
133
- private __refs;
129
+ __refs: RefsManager & T['$refs'] & BaseRefs;
134
130
  /**
135
- * @returns {RefsManager & { [key in keyof BaseInterface['$refs']]: BaseInterface['$refs'][key] } & BaseRefs}
131
+ * @returns {RefsManager & T['$refs'] & BaseRefs}
136
132
  */
137
- get $refs(): RefsManager & (BaseInterface["$refs"] extends infer T ? { [key in keyof T]: BaseInterface["$refs"][key]; } : never) & BaseRefs;
133
+ get $refs(): RefsManager & T["$refs"] & BaseRefs;
138
134
  /**
139
- * @type {OptionsManager & { [key in keyof BaseInterface['$options']]: BaseInterface['$options'][key] } & BaseOptions}
140
- * @private
135
+ * @type {OptionsManager & T['$options'] & BaseOptions}
141
136
  */
142
- private __options;
137
+ __options: OptionsManager & T['$options'] & BaseOptions;
143
138
  /**
144
- * @returns {OptionsManager & { [key in keyof BaseInterface['$options']]: BaseInterface['$options'][key] } & BaseOptions}
139
+ * @returns {OptionsManager & T['$options'] & BaseOptions}
145
140
  */
146
- get $options(): OptionsManager & (BaseInterface["$options"] extends infer T_1 ? { [key_1 in keyof T_1]: BaseInterface["$options"][key_1]; } : never) & BaseOptions;
141
+ get $options(): OptionsManager & T["$options"] & BaseOptions;
147
142
  /**
148
- * @type {ChildrenManager & { [key in keyof BaseInterface['$children']]: Array<BaseInterface['$children'][key]> } & BaseChildren}
149
- * @private
143
+ * @type {ChildrenManager & { [key in keyof T['$children']]: Array<T['$children'][key]> } & BaseChildren}
150
144
  */
151
- private __children;
145
+ __children: ChildrenManager & (T["$children"] extends infer T_1 ? { [key in keyof T_1]: T["$children"][key][]; } : never) & BaseChildren;
152
146
  /**
153
- * @returns {ChildrenManager & { [key in keyof BaseInterface['$children']]: Array<BaseInterface['$children'][key]> } & BaseChildren}
147
+ * @returns {ChildrenManager & { [key in keyof T['$children']]: Array<T['$children'][key]> } & BaseChildren}
154
148
  */
155
- get $children(): ChildrenManager & (BaseInterface["$children"] extends infer T_2 ? { [key_2 in keyof T_2]: BaseInterface["$children"][key_2][]; } : never) & BaseChildren;
149
+ get $children(): ChildrenManager & (T["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: T["$children"][key_1][]; } : never) & BaseChildren;
156
150
  /**
157
151
  * @type {EventsManager}
158
- * @private
159
152
  */
160
- private __events;
153
+ __events: EventsManager;
161
154
  /**
162
155
  * Small helper to log stuff.
163
156
  *
@@ -167,10 +160,9 @@ export default class Base<BaseInterface extends BaseTypeParameter = {
167
160
  /**
168
161
  * Small helper to debug information.
169
162
  *
170
- * @private
171
163
  * @returns {(...args:any) => void}
172
164
  */
173
- private get __debug();
165
+ get __debug(): (...args: any) => void;
174
166
  /**
175
167
  * Get manager constructors.
176
168
  *
@@ -180,20 +172,18 @@ export default class Base<BaseInterface extends BaseTypeParameter = {
180
172
  /**
181
173
  * Call an instance method and emit corresponding events.
182
174
  *
183
- * @private
184
175
  * @param {string} method
185
176
  * @param {any[]} args
186
177
  * @returns {any}
187
178
  */
188
- private __callMethod;
179
+ __callMethod(method: string, ...args: any[]): any;
189
180
  /**
190
181
  * Test if the given event has been bound to the instance.
191
182
  *
192
- * @private
193
183
  * @param {string} event The event's name.
194
184
  * @returns {boolean} Wether the given event has been bound or not.
195
185
  */
196
- private __hasEvent;
186
+ __hasEvent(event: string): boolean;
197
187
  /**
198
188
  * Trigger the `mounted` callback.
199
189
  * @returns {this}
@@ -217,26 +207,23 @@ export default class Base<BaseInterface extends BaseTypeParameter = {
217
207
  /**
218
208
  * Add an emitted event.
219
209
  *
220
- * @private
221
210
  * @param {string} event The event name.
222
211
  * @returns {void}
223
212
  */
224
- private __addEmits;
213
+ __addEmits(event: string): void;
225
214
  /**
226
215
  * Remove an emitted event.
227
216
  *
228
- * @private
229
217
  * @param {string} event The event name.
230
218
  * @returns {void}
231
219
  */
232
- private __removeEmits;
220
+ __removeEmits(event: string): void;
233
221
  /**
234
222
  * Get the instance constructor.
235
223
  *
236
- * @private
237
224
  * @returns {BaseConstructor}
238
225
  */
239
- private get __ctor();
226
+ get __ctor(): typeof Base;
240
227
  /**
241
228
  * Bind a listener function to an event.
242
229
  *
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
24
 
25
- // packages/js-toolkit/Base/managers/ResponsiveOptionsManager.js
25
+ // packages/js-toolkit/Base/managers/ResponsiveOptionsManager.ts
26
26
  var ResponsiveOptionsManager_exports = {};
27
27
  __export(ResponsiveOptionsManager_exports, {
28
28
  default: () => ResponsiveOptionsManager
@@ -1,3 +1,4 @@
1
+ import OptionsManager from './OptionsManager.js';
1
2
  /**
2
3
  * Class options to manage options as data attributes on an HTML element.
3
4
  */
@@ -9,7 +10,7 @@ export default class ResponsiveOptionsManager extends OptionsManager {
9
10
  * @param {ResponsiveOptionObject} config The option configuration.
10
11
  * @returns {any}
11
12
  */
12
- get(name: string, config: ResponsiveOptionObject): any;
13
+ get(name: any, config: any): any;
13
14
  /**
14
15
  * Set an option value.
15
16
  *
@@ -17,10 +18,5 @@ export default class ResponsiveOptionsManager extends OptionsManager {
17
18
  * @param {any} value The new value.
18
19
  * @param {ResponsiveOptionObject} config The option configuration.
19
20
  */
20
- set(name: string, value: any, config: ResponsiveOptionObject): void;
21
+ set(name: any, value: any, config: any): void;
21
22
  }
22
- export type OptionObject = import('./OptionsManager.js').OptionObject;
23
- export type ResponsiveOptionObject = OptionObject & {
24
- responsive?: boolean;
25
- };
26
- import OptionsManager from "./OptionsManager.js";
@@ -11,11 +11,11 @@ export default class ServicesManager extends AbstractManager {
11
11
  /**
12
12
  * @type {Record<string, () => ServiceInterface>}
13
13
  */
14
- __customServices: Record<string, () => ServiceInterface>;
14
+ __customServices: Record<string, () => import("../../services").ServiceInterface<any>>;
15
15
  /**
16
16
  * @returns {Record<string, () => ServiceInterface>}
17
17
  */
18
- get __services(): Record<string, () => ServiceInterface>;
18
+ get __services(): Record<string, () => import("../../services").ServiceInterface<any>>;
19
19
  /**
20
20
  * Test if the given service is registered.
21
21
  *
@@ -28,7 +28,7 @@ export default class ServicesManager extends AbstractManager {
28
28
  * @param {ServiceName} service The name of the service.
29
29
  * @returns {ReturnType<ServiceInterface['props']>}
30
30
  */
31
- get(service: ServiceName): ReturnType<ServiceInterface['props']>;
31
+ get(service: ServiceName): ReturnType<import("../../services").ServiceInterface<any>['props']>;
32
32
  /**
33
33
  * Init the given service and bind it to the given instance.
34
34
  *
@@ -70,7 +70,7 @@ export default class ServicesManager extends AbstractManager {
70
70
  * @param {() => ServiceInterface} useFunction
71
71
  * The `use...` function for the service.
72
72
  */
73
- register(name: string, useFunction: () => ServiceInterface): void;
73
+ register(name: string, useFunction: () => import("../../services").ServiceInterface<any>): void;
74
74
  /**
75
75
  * Unregister a new service to be enabled disabled.
76
76
  *
@@ -82,7 +82,7 @@ export default class ServicesManager extends AbstractManager {
82
82
  export type Base = import('../index').default;
83
83
  export type BaseConstructor = import('../index').BaseConstructor;
84
84
  export type ServiceInterface = import('../../services').ServiceInterface<any>;
85
- export type Services = typeof SERVICES_MAP & Record<string, () => ServiceInterface>;
85
+ export type Services = typeof SERVICES_MAP & Record<string, () => import("../../services").ServiceInterface<any>>;
86
86
  export type ServiceName = keyof {
87
87
  scrolled: typeof useScroll;
88
88
  resized: typeof useResize;
package/Base/types.cjs ADDED
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+
15
+ // packages/js-toolkit/Base/types.ts
16
+ var types_exports = {};
17
+ module.exports = __toCommonJS(types_exports);
18
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,43 @@
1
+ import { KeyServiceProps, LoadServiceProps, PointerServiceProps, RafServiceProps, ResizeServiceProps, ScrollServiceProps } from '../services/index.js';
2
+ export interface BaseInterface {
3
+ /**
4
+ * Mounted hook.
5
+ */
6
+ mounted?(): void;
7
+ /**
8
+ * Updated hook.
9
+ */
10
+ updated?(): void;
11
+ /**
12
+ * Destroyed hook.
13
+ */
14
+ destroyed?(): void;
15
+ /**
16
+ * Terminated hook.
17
+ */
18
+ terminated?(): void;
19
+ /**
20
+ * Key service, executed when a keyboard key is pressed or released.
21
+ */
22
+ keyed?(props: KeyServiceProps): void;
23
+ /**
24
+ * Load service, executed when the window `load` event is fired.
25
+ */
26
+ loaded?(props: LoadServiceProps): void;
27
+ /**
28
+ * Pointer service, executed when the pointer is moving, pressed or released.
29
+ */
30
+ moved?(props: PointerServiceProps): void;
31
+ /**
32
+ * Raf service, executed on each rendered frame.
33
+ */
34
+ ticked?(props: RafServiceProps): void;
35
+ /**
36
+ * Resize service, executed when the window is resized.
37
+ */
38
+ resized?(props: ResizeServiceProps): void;
39
+ /**
40
+ * Scroll service, executed when the document is scrolled.
41
+ */
42
+ scrolled?(props: ScrollServiceProps): void;
43
+ }
package/Base/types.js ADDED
File without changes
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
24
 
25
- // packages/js-toolkit/decorators/index.js
25
+ // packages/js-toolkit/decorators/index.ts
26
26
  var decorators_exports = {};
27
27
  __export(decorators_exports, {
28
28
  withBreakpointManager: () => import_withBreakpointManager.default,
@@ -1,10 +1,10 @@
1
- export { default as withBreakpointManager } from "./withBreakpointManager.js";
2
- export { default as withBreakpointObserver } from "./withBreakpointObserver.js";
3
- export { default as withDrag } from "./withDrag.js";
4
- export { default as withExtraConfig } from "./withExtraConfig.js";
5
- export { default as withFreezedOptions } from "./withFreezedOptions.js";
6
- export { default as withIntersectionObserver } from "./withIntersectionObserver.js";
7
- export { default as withMountWhenInView } from "./withMountWhenInView.js";
8
- export { default as withResponsiveOptions } from "./withResponsiveOptions.js";
9
- export { default as withScrolledInView } from "./withScrolledInView.js";
10
- export { default as withVue2 } from "./withVue2.js";
1
+ export { default as withBreakpointManager } from './withBreakpointManager.js';
2
+ export { default as withBreakpointObserver } from './withBreakpointObserver.js';
3
+ export { default as withDrag } from './withDrag.js';
4
+ export { default as withExtraConfig } from './withExtraConfig.js';
5
+ export { default as withFreezedOptions } from './withFreezedOptions.js';
6
+ export { default as withIntersectionObserver } from './withIntersectionObserver.js';
7
+ export { default as withMountWhenInView } from './withMountWhenInView.js';
8
+ export { default as withResponsiveOptions } from './withResponsiveOptions.js';
9
+ export { default as withScrolledInView } from './withScrolledInView.js';
10
+ export { default as withVue2 } from './withVue2.js';
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  ));
23
23
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
24
 
25
- // packages/js-toolkit/decorators/withBreakpointManager.js
25
+ // packages/js-toolkit/decorators/withBreakpointManager.ts
26
26
  var withBreakpointManager_exports = {};
27
27
  __export(withBreakpointManager_exports, {
28
28
  default: () => withBreakpointManager
@@ -68,7 +68,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
68
68
  }
69
69
  return BaseClass;
70
70
  }
71
- return class extends BaseClass {
71
+ return class WithBreakpointManager extends BaseClass {
72
72
  constructor(element) {
73
73
  super(element);
74
74
  if (!instances.has(this)) {
@@ -77,7 +77,6 @@ function withBreakpointManager(BaseClass, breakpoints) {
77
77
  add(`BreakpointManager-${this.$id}`, () => {
78
78
  testBreakpoints(instances.get(this));
79
79
  });
80
- this.instances = instances.get(this);
81
80
  }
82
81
  $mount() {
83
82
  super.$mount();
@@ -1,10 +1,87 @@
1
+ import type Base from '../Base/index.js';
2
+ import type { BaseConstructor, BaseTypeParameter } from '../Base/index.js';
1
3
  /**
2
4
  * BreakpointManager class.
3
- * @template {BaseConstructor} T
4
- * @param {T} BaseClass
5
- * @param {Array<[string, BaseConstructor]>} breakpoints
6
- * @returns {T}
7
5
  */
8
- export default function withBreakpointManager<T extends typeof import("../Base").default>(BaseClass: T, breakpoints: Array<[string, BaseConstructor]>): T;
9
- export type Base = import('../Base').default;
10
- export type BaseConstructor = import('../Base').BaseConstructor;
6
+ export default function withBreakpointManager<T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: BaseConstructor, breakpoints: Array<[string, BaseConstructor]>): typeof Base | {
7
+ new <U extends BaseTypeParameter = BaseTypeParameter>(element: any): {
8
+ /**
9
+ * Override the default $mount method to prevent component's from being
10
+ * mounted when they should not.
11
+ *
12
+ * @returns {this}
13
+ */
14
+ $mount(): any;
15
+ /**
16
+ * Destroy all instances when the main one is destroyed.
17
+ *
18
+ * @returns {this}
19
+ */
20
+ $destroy(): any;
21
+ $parent: Base<{
22
+ $el: HTMLElement;
23
+ $options: import("../Base/index.js").BaseOptions;
24
+ $refs: import("../Base/index.js").BaseRefs;
25
+ $children: {
26
+ [name: string]: Base<any> | Promise<Base<any>>;
27
+ };
28
+ }>;
29
+ $id: string;
30
+ $el: (T & U)["$el"] & HTMLElement & {
31
+ __base__?: WeakMap<typeof Base, Base<{
32
+ $el: HTMLElement;
33
+ $options: import("../Base/index.js").BaseOptions;
34
+ $refs: import("../Base/index.js").BaseRefs;
35
+ $children: {
36
+ [name: string]: Base<any> | Promise<Base<any>>;
37
+ };
38
+ }> | "terminated">;
39
+ };
40
+ $isMounted: boolean;
41
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
42
+ readonly $root: Base<{
43
+ $el: HTMLElement;
44
+ $options: import("../Base/index.js").BaseOptions;
45
+ $refs: import("../Base/index.js").BaseRefs;
46
+ $children: {
47
+ [name: string]: Base<any> | Promise<Base<any>>;
48
+ };
49
+ }>;
50
+ readonly __config: import("../Base/index.js").BaseConfig;
51
+ __services: import("../Base/managers/ServicesManager.js").default;
52
+ readonly $services: import("../Base/managers/ServicesManager.js").default;
53
+ __refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
54
+ readonly $refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
55
+ __options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
56
+ readonly $options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
57
+ __children: import("../Base/managers/ChildrenManager.js").default & ((T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: (T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
58
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & ((T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: (T & U)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
59
+ __events: import("../Base/managers/EventsManager.js").default;
60
+ readonly $log: (...args: any) => void;
61
+ readonly __debug: (...args: any) => void;
62
+ readonly __managers: import("../Base/index.js").Managers;
63
+ __callMethod(method: string, ...args: any[]): any;
64
+ __hasEvent(event: string): boolean;
65
+ $update(): any;
66
+ $terminate(): void;
67
+ __addEmits(event: string): void;
68
+ __removeEmits(event: string): void;
69
+ readonly __ctor: typeof Base;
70
+ $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
71
+ $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
72
+ $emit(event: string, ...args: any[]): void;
73
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
74
+ dispatchEvent(event: Event): boolean;
75
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
76
+ };
77
+ readonly $isBase: boolean;
78
+ config: import("../Base/index.js").BaseConfig;
79
+ $factory(nameOrSelector: string): Base<{
80
+ $el: HTMLElement;
81
+ $options: import("../Base/index.js").BaseOptions;
82
+ $refs: import("../Base/index.js").BaseRefs;
83
+ $children: {
84
+ [name: string]: Base<any> | Promise<Base<any>>;
85
+ };
86
+ }>[];
87
+ };
@@ -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();
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
27
27
  return value;
28
28
  };
29
29
 
30
- // packages/js-toolkit/decorators/withBreakpointObserver.js
30
+ // packages/js-toolkit/decorators/withBreakpointObserver.ts
31
31
  var withBreakpointObserver_exports = {};
32
32
  __export(withBreakpointObserver_exports, {
33
33
  default: () => withBreakpointObserver
@@ -62,7 +62,7 @@ function addToResize(key, instance) {
62
62
  }
63
63
  const { add, has } = (0, import_resize.default)();
64
64
  if (!has(key)) {
65
- add(key, function onResize({ breakpoint }) {
65
+ add(key, ({ breakpoint }) => {
66
66
  const action = testBreakpoints(instance, breakpoint);
67
67
  if (action === "$destroy" && instance.$isMounted) {
68
68
  instance[action]();
@@ -1,17 +1,93 @@
1
+ import type Base from '../Base/index.js';
2
+ import type { BaseConstructor, BaseTypeParameter } from '../Base/index.js';
1
3
  /**
2
4
  * BreakpointObserver class.
3
- *
4
- * @template {BaseConstructor} T
5
- * @param {T} BaseClass The Base class to extend from.
6
- * @returns {T}
7
5
  */
8
- export default function withBreakpointObserver<T extends typeof import("../Base").default>(BaseClass: T): T;
9
- export type Base = import('../Base').default;
10
- export type BaseConstructor = import('../Base').BaseConstructor;
11
- export type WithBreakpointObserverOptions = {
12
- activeBreakpoints?: string;
13
- inactiveBreakpoints?: string;
14
- };
15
- export type WithBreakpointObserverInterface = {
16
- $options: WithBreakpointObserverOptions;
6
+ export default function withBreakpointObserver<T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: BaseConstructor): {
7
+ new <U extends BaseTypeParameter = BaseTypeParameter>(element: any): {
8
+ /**
9
+ * Override the default $mount method to prevent component's from being
10
+ * mounted when they should not.
11
+ *
12
+ * @returns {this}
13
+ */
14
+ $mount(): any;
15
+ $parent: Base<{
16
+ $el: HTMLElement;
17
+ $options: import("../Base/index.js").BaseOptions;
18
+ $refs: import("../Base/index.js").BaseRefs;
19
+ $children: {
20
+ [name: string]: Base<any> | Promise<Base<any>>;
21
+ };
22
+ }>;
23
+ $id: string;
24
+ $el: (T & U)["$el"] & HTMLElement & {
25
+ __base__?: WeakMap<typeof Base, Base<{
26
+ $el: HTMLElement;
27
+ $options: import("../Base/index.js").BaseOptions;
28
+ $refs: import("../Base/index.js").BaseRefs;
29
+ $children: {
30
+ [name: string]: Base<any> | Promise<Base<any>>;
31
+ };
32
+ }> | "terminated">;
33
+ };
34
+ $isMounted: boolean;
35
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
36
+ readonly $root: Base<{
37
+ $el: HTMLElement;
38
+ $options: import("../Base/index.js").BaseOptions;
39
+ $refs: import("../Base/index.js").BaseRefs;
40
+ $children: {
41
+ [name: string]: Base<any> | Promise<Base<any>>;
42
+ };
43
+ }>;
44
+ readonly __config: import("../Base/index.js").BaseConfig;
45
+ __services: import("../Base/managers/ServicesManager.js").default;
46
+ readonly $services: import("../Base/managers/ServicesManager.js").default;
47
+ __refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
48
+ readonly $refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
49
+ __options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
50
+ readonly $options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
51
+ __children: import("../Base/managers/ChildrenManager.js").default & ((T & U)["$children"] extends infer T_1 ? { [key in keyof T_1]: (T & U)["$children"][key][]; } : never) & import("../Base/index.js").BaseChildren;
52
+ readonly $children: import("../Base/managers/ChildrenManager.js").default & ((T & U)["$children"] extends infer T_2 ? { [key_1 in keyof T_2]: (T & U)["$children"][key_1][]; } : never) & import("../Base/index.js").BaseChildren;
53
+ __events: import("../Base/managers/EventsManager.js").default;
54
+ readonly $log: (...args: any) => void;
55
+ readonly __debug: (...args: any) => void;
56
+ readonly __managers: import("../Base/index.js").Managers;
57
+ __callMethod(method: string, ...args: any[]): any;
58
+ __hasEvent(event: string): boolean;
59
+ $update(): any;
60
+ $destroy(): any;
61
+ $terminate(): void;
62
+ __addEmits(event: string): void;
63
+ __removeEmits(event: string): void;
64
+ readonly __ctor: typeof Base;
65
+ $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
66
+ $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
67
+ $emit(event: string, ...args: any[]): void;
68
+ addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
69
+ dispatchEvent(event: Event): boolean;
70
+ removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
71
+ };
72
+ config: {
73
+ name: string;
74
+ options: {
75
+ activeBreakpoints: StringConstructor;
76
+ inactiveBreakpoints: StringConstructor;
77
+ };
78
+ debug?: boolean;
79
+ log?: boolean;
80
+ refs?: string[];
81
+ emits?: string[];
82
+ components?: import("../Base/index.js").BaseConfigComponents;
83
+ };
84
+ readonly $isBase: boolean;
85
+ $factory(nameOrSelector: string): Base<{
86
+ $el: HTMLElement;
87
+ $options: import("../Base/index.js").BaseOptions;
88
+ $refs: import("../Base/index.js").BaseRefs;
89
+ $children: {
90
+ [name: string]: Base<any> | Promise<Base<any>>;
91
+ };
92
+ }>[];
17
93
  };
@@ -33,7 +33,7 @@ function addToResize(key, instance) {
33
33
  }
34
34
  const { add, has } = useResize();
35
35
  if (!has(key)) {
36
- add(key, function onResize({ breakpoint }) {
36
+ add(key, ({ breakpoint }) => {
37
37
  const action = testBreakpoints(instance, breakpoint);
38
38
  if (action === "$destroy" && instance.$isMounted) {
39
39
  instance[action]();
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
27
27
  return value;
28
28
  };
29
29
 
30
- // packages/js-toolkit/decorators/withDrag.js
30
+ // packages/js-toolkit/decorators/withDrag.ts
31
31
  var withDrag_exports = {};
32
32
  __export(withDrag_exports, {
33
33
  default: () => withDrag