@studiometa/js-toolkit 2.4.2 → 2.4.4-alpha.1
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.
- package/Base/index.d.ts +90 -49
- package/Base/managers/AbstractManager.d.ts +3 -3
- package/Base/managers/ChildrenManager.d.ts +1 -1
- package/Base/managers/EventsManager.d.ts +3 -3
- package/Base/managers/OptionsManager.d.ts +1 -1
- package/Base/managers/ResponsiveOptionsManager.cjs +1 -1
- package/Base/managers/ResponsiveOptionsManager.d.ts +3 -7
- package/Base/managers/ServicesManager.d.ts +6 -6
- package/Base/utils.d.ts +2 -2
- package/decorators/index.cjs +1 -1
- package/decorators/index.d.ts +10 -10
- package/decorators/withBreakpointManager.cjs +2 -3
- package/decorators/withBreakpointManager.d.ts +84 -7
- package/decorators/withBreakpointManager.js +1 -2
- package/decorators/withBreakpointObserver.cjs +2 -2
- package/decorators/withBreakpointObserver.d.ts +89 -13
- package/decorators/withBreakpointObserver.js +1 -1
- package/decorators/withDrag.cjs +1 -1
- package/decorators/withDrag.d.ts +81 -18
- package/decorators/withExtraConfig.cjs +1 -1
- package/decorators/withExtraConfig.d.ts +77 -10
- package/decorators/withFreezedOptions.cjs +9 -7
- package/decorators/withFreezedOptions.d.ts +81 -11
- package/decorators/withFreezedOptions.js +8 -6
- package/decorators/withIntersectionObserver.cjs +2 -1
- package/decorators/withIntersectionObserver.d.ts +91 -17
- package/decorators/withIntersectionObserver.js +1 -0
- package/decorators/withMountWhenInView.cjs +1 -1
- package/decorators/withMountWhenInView.d.ts +91 -29
- package/decorators/withResponsiveOptions.cjs +2 -2
- package/decorators/withResponsiveOptions.d.ts +78 -5
- package/decorators/withResponsiveOptions.js +1 -1
- package/decorators/withScrolledInView.cjs +13 -7
- package/decorators/withScrolledInView.d.ts +173 -15
- package/decorators/withScrolledInView.js +12 -6
- package/decorators/withVue2.cjs +5 -5
- package/decorators/withVue2.d.ts +97 -6
- package/decorators/withVue2.js +4 -4
- package/helpers/getDirectChildren.d.ts +11 -4
- package/helpers/importOnInteraction.d.ts +2 -2
- package/helpers/importWhenVisible.d.ts +2 -2
- package/index.cjs +1 -1
- package/index.d.ts +5 -4
- package/package.json +1 -1
- package/services/drag.d.ts +1 -1
- package/services/index.cjs +1 -1
- package/services/index.d.ts +33 -25
- package/services/key.d.ts +1 -1
- package/services/load.d.ts +1 -1
- package/services/pointer.d.ts +1 -1
- package/services/raf.d.ts +1 -1
- package/services/resize.d.ts +1 -1
- package/services/scroll.d.ts +1 -1
package/Base/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {typeof Base} BaseConstructor
|
|
3
3
|
* @typedef {(Base) => Promise<BaseConstructor | { default: BaseConstructor }>} BaseAsyncConstructor
|
|
4
|
-
* @typedef {
|
|
4
|
+
* @typedef {{ [name:string]: any }} BaseOptions
|
|
5
5
|
* @typedef {{ [name:string]: HTMLElement | HTMLElement[] }} BaseRefs
|
|
6
6
|
* @typedef {{ [nameOrSelector:string]: Base[] | Promise<Base>[] }} BaseChildren
|
|
7
7
|
* @typedef {{ [nameOrSelector:string]: BaseConstructor | BaseAsyncConstructor }} BaseConfigComponents
|
|
@@ -18,6 +18,14 @@
|
|
|
18
18
|
* @property {BaseConfigComponents} [components]
|
|
19
19
|
* @property {BaseConfigOptions} [options]
|
|
20
20
|
*/
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {{
|
|
23
|
+
* $el?: HTMLElement,
|
|
24
|
+
* $options?: BaseOptions,
|
|
25
|
+
* $refs?: BaseRefs,
|
|
26
|
+
* $children?: { [name:string]: Base | Promise<Base> },
|
|
27
|
+
* }} BaseTypeParameter
|
|
28
|
+
*/
|
|
21
29
|
/**
|
|
22
30
|
* @typedef {Object} Managers
|
|
23
31
|
* @property {typeof ChildrenManager} ChildrenManager
|
|
@@ -28,12 +36,15 @@
|
|
|
28
36
|
*/
|
|
29
37
|
/**
|
|
30
38
|
* Base class.
|
|
31
|
-
* @template {{ $options: BaseOptions, $refs: BaseRefs, $children:
|
|
39
|
+
* @template {BaseTypeParameter} [BaseInterface={ $el: HTMLElement, $options: BaseOptions, $refs: BaseRefs, $children: { [name:string]: Base | Promise<Base> } }]
|
|
32
40
|
*/
|
|
33
|
-
export default class Base<BaseInterface extends {
|
|
41
|
+
export default class Base<BaseInterface extends BaseTypeParameter = {
|
|
42
|
+
$el: HTMLElement;
|
|
34
43
|
$options: BaseOptions;
|
|
35
44
|
$refs: BaseRefs;
|
|
36
|
-
$children:
|
|
45
|
+
$children: {
|
|
46
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
47
|
+
};
|
|
37
48
|
}> extends EventTarget {
|
|
38
49
|
/**
|
|
39
50
|
* This is a Base instance.
|
|
@@ -51,7 +62,7 @@ export default class Base<BaseInterface extends {
|
|
|
51
62
|
* @param {string} nameOrSelector The selector on which to mount each instance.
|
|
52
63
|
* @returns {Array<Base>} A list of the created instance.
|
|
53
64
|
*/
|
|
54
|
-
static $factory(nameOrSelector: string): Array<Base
|
|
65
|
+
static $factory(nameOrSelector: string): Array<Base>;
|
|
55
66
|
/**
|
|
56
67
|
* Class constructor where all the magic takes place.
|
|
57
68
|
*
|
|
@@ -62,7 +73,7 @@ export default class Base<BaseInterface extends {
|
|
|
62
73
|
* The instance parent.
|
|
63
74
|
* @type {Base}
|
|
64
75
|
*/
|
|
65
|
-
$parent: Base
|
|
76
|
+
$parent: Base;
|
|
66
77
|
/**
|
|
67
78
|
* The instance id.
|
|
68
79
|
* @type {string}
|
|
@@ -70,10 +81,10 @@ export default class Base<BaseInterface extends {
|
|
|
70
81
|
$id: string;
|
|
71
82
|
/**
|
|
72
83
|
* The root element.
|
|
73
|
-
* @type {HTMLElement & { __base__?: WeakMap<BaseConstructor, Base | 'terminated'> }}
|
|
84
|
+
* @type {BaseInterface['$el'] & HTMLElement & { __base__?: WeakMap<BaseConstructor, Base | 'terminated'> }}
|
|
74
85
|
*/
|
|
75
|
-
$el: HTMLElement & {
|
|
76
|
-
__base__?: WeakMap<BaseConstructor, Base
|
|
86
|
+
$el: BaseInterface['$el'] & HTMLElement & {
|
|
87
|
+
__base__?: WeakMap<BaseConstructor, Base | 'terminated'>;
|
|
77
88
|
};
|
|
78
89
|
/**
|
|
79
90
|
* The state of the component.
|
|
@@ -83,65 +94,63 @@ export default class Base<BaseInterface extends {
|
|
|
83
94
|
/**
|
|
84
95
|
* Store the event handlers.
|
|
85
96
|
*
|
|
86
|
-
* @private
|
|
87
97
|
* @type {Map<string, Set<EventListenerOrEventListenerObject>>}
|
|
88
98
|
*/
|
|
89
|
-
|
|
99
|
+
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
90
100
|
/**
|
|
91
101
|
* Get the root instance of the app.
|
|
92
102
|
* @returns {Base}
|
|
93
103
|
*/
|
|
94
|
-
get $root(): Base<
|
|
104
|
+
get $root(): Base<{
|
|
105
|
+
$el: HTMLElement;
|
|
106
|
+
$options: BaseOptions;
|
|
107
|
+
$refs: BaseRefs;
|
|
108
|
+
$children: {
|
|
109
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
110
|
+
};
|
|
111
|
+
}>;
|
|
95
112
|
/**
|
|
96
113
|
* Merge configuration with the parents' configurations.
|
|
97
114
|
*
|
|
98
115
|
* @returns {BaseConfig}
|
|
99
|
-
* @private
|
|
100
116
|
*/
|
|
101
|
-
|
|
117
|
+
get __config(): BaseConfig;
|
|
102
118
|
/**
|
|
103
119
|
* @type {ServicesManager}
|
|
104
|
-
* @private
|
|
105
120
|
*/
|
|
106
|
-
|
|
121
|
+
__services: ServicesManager;
|
|
107
122
|
/**
|
|
108
123
|
* @type {ServicesManager}
|
|
109
124
|
*/
|
|
110
125
|
get $services(): ServicesManager;
|
|
111
126
|
/**
|
|
112
|
-
* @type {RefsManager &
|
|
113
|
-
* @private
|
|
127
|
+
* @type {RefsManager & BaseInterface['$refs'] & BaseRefs}
|
|
114
128
|
*/
|
|
115
|
-
|
|
129
|
+
__refs: RefsManager & BaseInterface['$refs'] & BaseRefs;
|
|
116
130
|
/**
|
|
117
|
-
* @returns {RefsManager &
|
|
131
|
+
* @returns {RefsManager & BaseInterface['$refs'] & BaseRefs}
|
|
118
132
|
*/
|
|
119
|
-
get $refs(): RefsManager &
|
|
133
|
+
get $refs(): RefsManager & BaseInterface["$refs"] & BaseRefs;
|
|
120
134
|
/**
|
|
121
|
-
* @type {
|
|
122
|
-
* @private
|
|
135
|
+
* @type {OptionsManager & BaseInterface['$options'] & BaseOptions}
|
|
123
136
|
*/
|
|
124
|
-
|
|
137
|
+
__options: OptionsManager & BaseInterface['$options'] & BaseOptions;
|
|
125
138
|
/**
|
|
126
|
-
* @returns {
|
|
139
|
+
* @returns {OptionsManager & BaseInterface['$options'] & BaseOptions}
|
|
127
140
|
*/
|
|
128
|
-
get $options(): OptionsManager &
|
|
129
|
-
[name: string]: any;
|
|
130
|
-
} & (BaseInterface["$options"] extends infer T_1 ? { [key_1 in keyof T_1]: BaseInterface["$options"][key_1]; } : never);
|
|
141
|
+
get $options(): OptionsManager & BaseInterface["$options"] & BaseOptions;
|
|
131
142
|
/**
|
|
132
|
-
* @type {ChildrenManager & { [key in keyof BaseInterface['$children']]: Array<BaseInterface['$children'][key]> }}
|
|
133
|
-
* @private
|
|
143
|
+
* @type {ChildrenManager & { [key in keyof BaseInterface['$children']]: Array<BaseInterface['$children'][key]> } & BaseChildren}
|
|
134
144
|
*/
|
|
135
|
-
|
|
145
|
+
__children: ChildrenManager & (BaseInterface["$children"] extends infer T ? { [key in keyof T]: BaseInterface["$children"][key][]; } : never) & BaseChildren;
|
|
136
146
|
/**
|
|
137
|
-
* @returns {ChildrenManager & { [key in keyof BaseInterface['$children']]: Array<BaseInterface['$children'][key]> }}
|
|
147
|
+
* @returns {ChildrenManager & { [key in keyof BaseInterface['$children']]: Array<BaseInterface['$children'][key]> } & BaseChildren}
|
|
138
148
|
*/
|
|
139
|
-
get $children(): ChildrenManager & (BaseInterface["$children"] extends infer
|
|
149
|
+
get $children(): ChildrenManager & (BaseInterface["$children"] extends infer T_1 ? { [key_1 in keyof T_1]: BaseInterface["$children"][key_1][]; } : never) & BaseChildren;
|
|
140
150
|
/**
|
|
141
151
|
* @type {EventsManager}
|
|
142
|
-
* @private
|
|
143
152
|
*/
|
|
144
|
-
|
|
153
|
+
__events: EventsManager;
|
|
145
154
|
/**
|
|
146
155
|
* Small helper to log stuff.
|
|
147
156
|
*
|
|
@@ -151,10 +160,9 @@ export default class Base<BaseInterface extends {
|
|
|
151
160
|
/**
|
|
152
161
|
* Small helper to debug information.
|
|
153
162
|
*
|
|
154
|
-
* @private
|
|
155
163
|
* @returns {(...args:any) => void}
|
|
156
164
|
*/
|
|
157
|
-
|
|
165
|
+
get __debug(): (...args: any) => void;
|
|
158
166
|
/**
|
|
159
167
|
* Get manager constructors.
|
|
160
168
|
*
|
|
@@ -164,20 +172,18 @@ export default class Base<BaseInterface extends {
|
|
|
164
172
|
/**
|
|
165
173
|
* Call an instance method and emit corresponding events.
|
|
166
174
|
*
|
|
167
|
-
* @private
|
|
168
175
|
* @param {string} method
|
|
169
176
|
* @param {any[]} args
|
|
170
177
|
* @returns {any}
|
|
171
178
|
*/
|
|
172
|
-
|
|
179
|
+
__callMethod(method: string, ...args: any[]): any;
|
|
173
180
|
/**
|
|
174
181
|
* Test if the given event has been bound to the instance.
|
|
175
182
|
*
|
|
176
|
-
* @private
|
|
177
183
|
* @param {string} event The event's name.
|
|
178
184
|
* @returns {boolean} Wether the given event has been bound or not.
|
|
179
185
|
*/
|
|
180
|
-
|
|
186
|
+
__hasEvent(event: string): boolean;
|
|
181
187
|
/**
|
|
182
188
|
* Trigger the `mounted` callback.
|
|
183
189
|
* @returns {this}
|
|
@@ -201,26 +207,23 @@ export default class Base<BaseInterface extends {
|
|
|
201
207
|
/**
|
|
202
208
|
* Add an emitted event.
|
|
203
209
|
*
|
|
204
|
-
* @private
|
|
205
210
|
* @param {string} event The event name.
|
|
206
211
|
* @returns {void}
|
|
207
212
|
*/
|
|
208
|
-
|
|
213
|
+
__addEmits(event: string): void;
|
|
209
214
|
/**
|
|
210
215
|
* Remove an emitted event.
|
|
211
216
|
*
|
|
212
|
-
* @private
|
|
213
217
|
* @param {string} event The event name.
|
|
214
218
|
* @returns {void}
|
|
215
219
|
*/
|
|
216
|
-
|
|
220
|
+
__removeEmits(event: string): void;
|
|
217
221
|
/**
|
|
218
222
|
* Get the instance constructor.
|
|
219
223
|
*
|
|
220
|
-
* @private
|
|
221
224
|
* @returns {BaseConstructor}
|
|
222
225
|
*/
|
|
223
|
-
|
|
226
|
+
get __ctor(): typeof Base;
|
|
224
227
|
/**
|
|
225
228
|
* Bind a listener function to an event.
|
|
226
229
|
*
|
|
@@ -260,13 +263,29 @@ export type BaseConstructor = typeof Base;
|
|
|
260
263
|
export type BaseAsyncConstructor = (Base: any) => Promise<BaseConstructor | {
|
|
261
264
|
default: BaseConstructor;
|
|
262
265
|
}>;
|
|
263
|
-
export type BaseOptions =
|
|
266
|
+
export type BaseOptions = {
|
|
264
267
|
[name: string]: any;
|
|
265
268
|
};
|
|
266
269
|
export type BaseRefs = {
|
|
267
270
|
[name: string]: HTMLElement | HTMLElement[];
|
|
268
271
|
};
|
|
269
|
-
export type BaseChildren =
|
|
272
|
+
export type BaseChildren = {
|
|
273
|
+
[nameOrSelector: string]: Base<{
|
|
274
|
+
$el: HTMLElement;
|
|
275
|
+
$options: BaseOptions;
|
|
276
|
+
$refs: BaseRefs;
|
|
277
|
+
$children: {
|
|
278
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
279
|
+
};
|
|
280
|
+
}>[] | Promise<Base<{
|
|
281
|
+
$el: HTMLElement;
|
|
282
|
+
$options: BaseOptions;
|
|
283
|
+
$refs: BaseRefs;
|
|
284
|
+
$children: {
|
|
285
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
286
|
+
};
|
|
287
|
+
}>>[];
|
|
288
|
+
};
|
|
270
289
|
export type BaseConfigComponents = {
|
|
271
290
|
[nameOrSelector: string]: typeof Base | BaseAsyncConstructor;
|
|
272
291
|
};
|
|
@@ -281,6 +300,28 @@ export type BaseConfig = {
|
|
|
281
300
|
components?: BaseConfigComponents;
|
|
282
301
|
options?: BaseConfigOptions;
|
|
283
302
|
};
|
|
303
|
+
export type BaseTypeParameter = {
|
|
304
|
+
$el?: HTMLElement;
|
|
305
|
+
$options?: BaseOptions;
|
|
306
|
+
$refs?: BaseRefs;
|
|
307
|
+
$children?: {
|
|
308
|
+
[name: string]: Base<{
|
|
309
|
+
$el: HTMLElement;
|
|
310
|
+
$options: BaseOptions;
|
|
311
|
+
$refs: BaseRefs;
|
|
312
|
+
$children: {
|
|
313
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
314
|
+
};
|
|
315
|
+
}> | Promise<Base<{
|
|
316
|
+
$el: HTMLElement;
|
|
317
|
+
$options: BaseOptions;
|
|
318
|
+
$refs: BaseRefs;
|
|
319
|
+
$children: {
|
|
320
|
+
[name: string]: Base<any> | Promise<Base<any>>;
|
|
321
|
+
};
|
|
322
|
+
}>>;
|
|
323
|
+
};
|
|
324
|
+
};
|
|
284
325
|
export type Managers = {
|
|
285
326
|
ChildrenManager: typeof ChildrenManager;
|
|
286
327
|
EventsManager: typeof EventsManager;
|
|
@@ -12,11 +12,11 @@ export default class AbstractManager {
|
|
|
12
12
|
*
|
|
13
13
|
* @param {Base} base
|
|
14
14
|
*/
|
|
15
|
-
constructor(base:
|
|
15
|
+
constructor(base: Base);
|
|
16
16
|
/**
|
|
17
17
|
* @type {Base}
|
|
18
18
|
*/
|
|
19
|
-
__base:
|
|
19
|
+
__base: Base;
|
|
20
20
|
/**
|
|
21
21
|
* Get the base instance root element.
|
|
22
22
|
* @returns {HTMLElement}
|
|
@@ -39,6 +39,6 @@ export default class AbstractManager {
|
|
|
39
39
|
*/
|
|
40
40
|
__hideProperties(properties: string[]): void;
|
|
41
41
|
}
|
|
42
|
-
export type Base = import(
|
|
42
|
+
export type Base = import('../index.js').default;
|
|
43
43
|
export type BaseConfig = import('../index.js').BaseConfig;
|
|
44
44
|
export type EventsManager = import('./EventsManager.js').default;
|
|
@@ -34,7 +34,7 @@ export default class ChildrenManager extends AbstractManager {
|
|
|
34
34
|
*/
|
|
35
35
|
destroyAll(): void;
|
|
36
36
|
}
|
|
37
|
-
export type Base = import(
|
|
37
|
+
export type Base = import('../index.js').default;
|
|
38
38
|
export type BaseConstructor = import('../index.js').BaseConstructor;
|
|
39
39
|
export type BaseAsyncConstructor = import('../index.js').BaseAsyncConstructor;
|
|
40
40
|
export type BaseConfigComponents = import('../index.js').BaseConfigComponents;
|
|
@@ -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:
|
|
86
|
+
bindChild(name: string, instance: Base): 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:
|
|
96
|
+
unbindChild(name: string, instance: Base): 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(
|
|
110
|
+
export type Base = import('../index.js').default;
|
|
111
111
|
export type ChildrenManager = import('./ChildrenManager.js').default;
|
|
112
112
|
import AbstractManager from "./AbstractManager.js";
|
|
@@ -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(
|
|
55
|
+
export type Base = import('../index.js').default;
|
|
56
56
|
export type BaseConfig = import('../index.js').BaseConfig;
|
|
57
57
|
export type OptionType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor;
|
|
58
58
|
export type ArrayOption = {
|
|
@@ -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.
|
|
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:
|
|
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:
|
|
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
|
*
|
|
@@ -79,10 +79,10 @@ export default class ServicesManager extends AbstractManager {
|
|
|
79
79
|
*/
|
|
80
80
|
unregister(name: string): void;
|
|
81
81
|
}
|
|
82
|
-
export type Base = import(
|
|
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/utils.d.ts
CHANGED
|
@@ -36,5 +36,5 @@ export function eventIsNative(event: string, element: HTMLElement): boolean;
|
|
|
36
36
|
* @param {import('./index.js').BaseConfig} config
|
|
37
37
|
* @returns {Base|Base['$el']}
|
|
38
38
|
*/
|
|
39
|
-
export function getEventTarget(instance:
|
|
40
|
-
export type Base = import(
|
|
39
|
+
export function getEventTarget(instance: Base, event: string, config: import('./index.js').BaseConfig): Base | Base['$el'];
|
|
40
|
+
export type Base = import('./index.js').default;
|
package/decorators/index.cjs
CHANGED
|
@@ -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.
|
|
25
|
+
// packages/js-toolkit/decorators/index.ts
|
|
26
26
|
var decorators_exports = {};
|
|
27
27
|
__export(decorators_exports, {
|
|
28
28
|
withBreakpointManager: () => import_withBreakpointManager.default,
|
package/decorators/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { default as withBreakpointManager } from
|
|
2
|
-
export { default as withBreakpointObserver } from
|
|
3
|
-
export { default as withDrag } from
|
|
4
|
-
export { default as withExtraConfig } from
|
|
5
|
-
export { default as withFreezedOptions } from
|
|
6
|
-
export { default as withIntersectionObserver } from
|
|
7
|
-
export { default as withMountWhenInView } from
|
|
8
|
-
export { default as withResponsiveOptions } from
|
|
9
|
-
export { default as withScrolledInView } from
|
|
10
|
-
export { default as withVue2 } from
|
|
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.
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
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.
|
|
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,
|
|
65
|
+
add(key, ({ breakpoint }) => {
|
|
66
66
|
const action = testBreakpoints(instance, breakpoint);
|
|
67
67
|
if (action === "$destroy" && instance.$isMounted) {
|
|
68
68
|
instance[action]();
|