@studiometa/js-toolkit 2.4.1 → 2.4.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base/index.cjs +10 -3
- package/Base/index.js +6 -2
- package/Base/managers/AbstractManager.cjs +13 -8
- package/Base/managers/AbstractManager.js +13 -8
- package/Base/managers/ChildrenManager.cjs +10 -3
- package/Base/managers/ChildrenManager.js +6 -2
- package/Base/managers/EventsManager.cjs +17 -4
- package/Base/managers/EventsManager.js +13 -3
- package/Base/managers/OptionsManager.cjs +18 -5
- package/Base/managers/OptionsManager.js +14 -4
- package/Base/managers/RefsManager.cjs +17 -4
- package/Base/managers/RefsManager.js +13 -3
- package/Base/managers/ResponsiveOptionsManager.cjs +4 -1
- package/Base/managers/ServicesManager.cjs +12 -5
- package/Base/managers/ServicesManager.js +8 -4
- package/Base/utils.cjs +5 -1
- package/Base/utils.js +5 -1
- package/decorators/index.cjs +5 -2
- package/decorators/withBreakpointManager.cjs +6 -4
- package/decorators/withBreakpointManager.js +1 -2
- package/decorators/withBreakpointObserver.cjs +12 -5
- package/decorators/withBreakpointObserver.js +7 -3
- package/decorators/withDrag.cjs +9 -3
- package/decorators/withDrag.js +4 -1
- package/decorators/withExtraConfig.cjs +5 -2
- package/decorators/withFreezedOptions.cjs +9 -7
- package/decorators/withFreezedOptions.js +8 -6
- package/decorators/withIntersectionObserver.cjs +11 -7
- package/decorators/withIntersectionObserver.js +10 -6
- package/decorators/withMountWhenInView.cjs +14 -11
- package/decorators/withMountWhenInView.js +13 -10
- package/decorators/withResponsiveOptions.cjs +6 -3
- package/decorators/withResponsiveOptions.js +1 -1
- package/decorators/withScrolledInView.cjs +77 -25
- package/decorators/withScrolledInView.js +72 -23
- package/decorators/withVue2.cjs +4 -4
- package/decorators/withVue2.js +3 -3
- package/helpers/importWhenIdle.cjs +8 -5
- package/helpers/importWhenIdle.js +8 -5
- package/helpers/index.cjs +4 -1
- package/index.cjs +5 -2
- package/package.json +2 -2
- package/services/drag.cjs +4 -1
- package/services/index.cjs +4 -1
- package/services/index.d.ts +7 -0
- package/services/key.cjs +4 -1
- package/services/resize.cjs +4 -1
- package/services/scroll.cjs +4 -1
- package/utils/collide/index.cjs +4 -1
- package/utils/css/animate.cjs +24 -13
- package/utils/css/animate.js +20 -12
- package/utils/css/index.cjs +4 -1
- package/utils/css/transition.cjs +4 -4
- package/utils/css/transition.js +0 -3
- package/utils/focusTrap.cjs +4 -1
- package/utils/history.cjs +4 -1
- package/utils/history.js +4 -1
- package/utils/index.cjs +4 -1
- package/utils/math/clamp01.cjs +4 -1
- package/utils/math/index.cjs +4 -1
- package/utils/math/inertiaFinalValue.cjs +4 -1
- package/utils/nextTick.cjs +5 -3
- package/utils/nextTick.js +5 -3
- package/utils/object/autoBind.cjs +4 -1
- package/utils/object/index.cjs +4 -1
- package/utils/scrollTo.cjs +4 -1
- package/utils/string/index.cjs +4 -1
- package/utils/string/withLeadingCharacters.cjs +4 -1
- package/utils/string/withLeadingSlash.cjs +4 -1
- package/utils/string/withTrailingCharacters.cjs +4 -1
- package/utils/string/withTrailingSlash.cjs +4 -1
- package/utils/string/withoutLeadingCharactersRecursive.cjs +4 -1
- package/utils/string/withoutLeadingSlash.cjs +4 -1
- package/utils/string/withoutTrailingCharactersRecursive.cjs +4 -1
- package/utils/string/withoutTrailingSlash.cjs +4 -1
- package/utils/tween.cjs +4 -1
- package/Base/index.d.ts +0 -290
- package/Base/managers/AbstractManager.d.ts +0 -44
- package/Base/managers/ChildrenManager.d.ts +0 -41
- package/Base/managers/EventsManager.d.ts +0 -112
- package/Base/managers/OptionsManager.d.ts +0 -87
- package/Base/managers/RefsManager.d.ts +0 -32
- package/Base/managers/ResponsiveOptionsManager.d.ts +0 -26
- package/Base/managers/ServicesManager.d.ts +0 -109
- package/Base/utils.d.ts +0 -40
- package/decorators/index.d.ts +0 -10
- package/decorators/withBreakpointManager.d.ts +0 -10
- package/decorators/withBreakpointObserver.d.ts +0 -17
- package/decorators/withDrag.d.ts +0 -23
- package/decorators/withExtraConfig.d.ts +0 -18
- package/decorators/withFreezedOptions.d.ts +0 -14
- package/decorators/withIntersectionObserver.d.ts +0 -23
- package/decorators/withMountWhenInView.d.ts +0 -33
- package/decorators/withResponsiveOptions.d.ts +0 -8
- package/decorators/withScrolledInView.d.ts +0 -19
- package/decorators/withVue2.d.ts +0 -7
- package/helpers/createApp.d.ts +0 -14
- package/helpers/getDirectChildren.d.ts +0 -24
- package/helpers/getInstanceFromElement.d.ts +0 -14
- package/helpers/importOnInteraction.d.ts +0 -23
- package/helpers/importWhenIdle.d.ts +0 -21
- package/helpers/importWhenVisible.d.ts +0 -23
- package/helpers/index.d.ts +0 -6
- package/helpers/utils.d.ts +0 -10
- package/index.d.ts +0 -4
|
@@ -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(
|
|
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/utils/string/withoutLeadingCharactersRecursive.js
|
|
@@ -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(
|
|
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/utils/string/withoutLeadingSlash.js
|
|
@@ -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(
|
|
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/utils/string/withoutTrailingCharactersRecursive.js
|
|
@@ -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(
|
|
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/utils/string/withoutTrailingSlash.js
|
package/utils/tween.cjs
CHANGED
|
@@ -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(
|
|
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/utils/tween.js
|
package/Base/index.d.ts
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {typeof Base} BaseConstructor
|
|
3
|
-
* @typedef {(Base) => Promise<BaseConstructor | { default: BaseConstructor }>} BaseAsyncConstructor
|
|
4
|
-
* @typedef {OptionsManager & { [name:string]: any }} BaseOptions
|
|
5
|
-
* @typedef {{ [name:string]: HTMLElement | HTMLElement[] }} BaseRefs
|
|
6
|
-
* @typedef {{ [nameOrSelector:string]: Base[] | Promise<Base>[] }} BaseChildren
|
|
7
|
-
* @typedef {{ [nameOrSelector:string]: BaseConstructor | BaseAsyncConstructor }} BaseConfigComponents
|
|
8
|
-
* @typedef {import('./managers/OptionsManager').OptionsSchema} BaseConfigOptions
|
|
9
|
-
* @typedef {import('./managers/ServicesManager.js').ServiceName} ServiceName
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {Object} BaseConfig
|
|
13
|
-
* @property {string} name
|
|
14
|
-
* @property {boolean} [debug]
|
|
15
|
-
* @property {boolean} [log]
|
|
16
|
-
* @property {string[]} [refs]
|
|
17
|
-
* @property {string[]} [emits]
|
|
18
|
-
* @property {BaseConfigComponents} [components]
|
|
19
|
-
* @property {BaseConfigOptions} [options]
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @typedef {Object} Managers
|
|
23
|
-
* @property {typeof ChildrenManager} ChildrenManager
|
|
24
|
-
* @property {typeof EventsManager} EventsManager
|
|
25
|
-
* @property {typeof OptionsManager} OptionsManager
|
|
26
|
-
* @property {typeof RefsManager} RefsManager
|
|
27
|
-
* @property {typeof ServicesManager} ServicesManager
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* Base class.
|
|
31
|
-
*/
|
|
32
|
-
export default class Base extends EventTarget {
|
|
33
|
-
/**
|
|
34
|
-
* This is a Base instance.
|
|
35
|
-
* @type {boolean}
|
|
36
|
-
* @readonly
|
|
37
|
-
*/
|
|
38
|
-
static readonly $isBase: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* @type {BaseConfig}
|
|
41
|
-
*/
|
|
42
|
-
static config: BaseConfig;
|
|
43
|
-
/**
|
|
44
|
-
* Factory method to generate multiple instance of the class.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} nameOrSelector The selector on which to mount each instance.
|
|
47
|
-
* @returns {Array<Base>} A list of the created instance.
|
|
48
|
-
*/
|
|
49
|
-
static $factory(nameOrSelector: string): Array<Base>;
|
|
50
|
-
/**
|
|
51
|
-
* Class constructor where all the magic takes place.
|
|
52
|
-
*
|
|
53
|
-
* @param {HTMLElement} element The component's root element dd.
|
|
54
|
-
*/
|
|
55
|
-
constructor(element: HTMLElement);
|
|
56
|
-
/**
|
|
57
|
-
* The instance parent.
|
|
58
|
-
* @type {Base}
|
|
59
|
-
*/
|
|
60
|
-
$parent: Base;
|
|
61
|
-
/**
|
|
62
|
-
* The instance id.
|
|
63
|
-
* @type {string}
|
|
64
|
-
*/
|
|
65
|
-
$id: string;
|
|
66
|
-
/**
|
|
67
|
-
* The root element.
|
|
68
|
-
* @type {HTMLElement & { __base__?: WeakMap<BaseConstructor, Base | 'terminated'> }}
|
|
69
|
-
*/
|
|
70
|
-
$el: HTMLElement & {
|
|
71
|
-
__base__?: WeakMap<BaseConstructor, Base | 'terminated'>;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* The state of the component.
|
|
75
|
-
* @type {boolean}
|
|
76
|
-
*/
|
|
77
|
-
$isMounted: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Store the event handlers.
|
|
80
|
-
*
|
|
81
|
-
* @private
|
|
82
|
-
* @type {Map<string, Set<EventListenerOrEventListenerObject>>}
|
|
83
|
-
*/
|
|
84
|
-
private __eventHandlers;
|
|
85
|
-
/**
|
|
86
|
-
* Get the root instance of the app.
|
|
87
|
-
* @returns {Base}
|
|
88
|
-
*/
|
|
89
|
-
get $root(): Base;
|
|
90
|
-
/**
|
|
91
|
-
* Merge configuration with the parents' configurations.
|
|
92
|
-
*
|
|
93
|
-
* @returns {BaseConfig}
|
|
94
|
-
* @private
|
|
95
|
-
*/
|
|
96
|
-
private get __config();
|
|
97
|
-
/**
|
|
98
|
-
* @type {ServicesManager}
|
|
99
|
-
* @private
|
|
100
|
-
*/
|
|
101
|
-
private __services;
|
|
102
|
-
/**
|
|
103
|
-
* @type {ServicesManager}
|
|
104
|
-
*/
|
|
105
|
-
get $services(): ServicesManager;
|
|
106
|
-
/**
|
|
107
|
-
* @type {RefsManager}
|
|
108
|
-
* @private
|
|
109
|
-
*/
|
|
110
|
-
private __refs;
|
|
111
|
-
/**
|
|
112
|
-
* @returns {RefsManager}
|
|
113
|
-
*/
|
|
114
|
-
get $refs(): RefsManager;
|
|
115
|
-
/**
|
|
116
|
-
* @type {BaseOptions}
|
|
117
|
-
* @private
|
|
118
|
-
*/
|
|
119
|
-
private __options;
|
|
120
|
-
/**
|
|
121
|
-
* @returns {BaseOptions}
|
|
122
|
-
*/
|
|
123
|
-
get $options(): BaseOptions;
|
|
124
|
-
/**
|
|
125
|
-
* @type {ChildrenManager}
|
|
126
|
-
* @private
|
|
127
|
-
*/
|
|
128
|
-
private __children;
|
|
129
|
-
/**
|
|
130
|
-
* @returns {ChildrenManager}
|
|
131
|
-
*/
|
|
132
|
-
get $children(): ChildrenManager;
|
|
133
|
-
/**
|
|
134
|
-
* @type {EventsManager}
|
|
135
|
-
* @private
|
|
136
|
-
*/
|
|
137
|
-
private __events;
|
|
138
|
-
/**
|
|
139
|
-
* Small helper to log stuff.
|
|
140
|
-
*
|
|
141
|
-
* @returns {(...args: any) => void}
|
|
142
|
-
*/
|
|
143
|
-
get $log(): (...args: any) => void;
|
|
144
|
-
/**
|
|
145
|
-
* Small helper to debug information.
|
|
146
|
-
*
|
|
147
|
-
* @private
|
|
148
|
-
* @returns {(...args:any) => void}
|
|
149
|
-
*/
|
|
150
|
-
private get __debug();
|
|
151
|
-
/**
|
|
152
|
-
* Get manager constructors.
|
|
153
|
-
*
|
|
154
|
-
* @returns {Managers}
|
|
155
|
-
*/
|
|
156
|
-
get __managers(): Managers;
|
|
157
|
-
/**
|
|
158
|
-
* Call an instance method and emit corresponding events.
|
|
159
|
-
*
|
|
160
|
-
* @private
|
|
161
|
-
* @param {string} method
|
|
162
|
-
* @param {any[]} args
|
|
163
|
-
* @returns {any}
|
|
164
|
-
*/
|
|
165
|
-
private __callMethod;
|
|
166
|
-
/**
|
|
167
|
-
* Test if the given event has been bound to the instance.
|
|
168
|
-
*
|
|
169
|
-
* @private
|
|
170
|
-
* @param {string} event The event's name.
|
|
171
|
-
* @returns {boolean} Wether the given event has been bound or not.
|
|
172
|
-
*/
|
|
173
|
-
private __hasEvent;
|
|
174
|
-
/**
|
|
175
|
-
* Trigger the `mounted` callback.
|
|
176
|
-
* @returns {this}
|
|
177
|
-
*/
|
|
178
|
-
$mount(): this;
|
|
179
|
-
/**
|
|
180
|
-
* Update the instance children.
|
|
181
|
-
* @returns {this}
|
|
182
|
-
*/
|
|
183
|
-
$update(): this;
|
|
184
|
-
/**
|
|
185
|
-
* Trigger the `destroyed` callback.
|
|
186
|
-
* @returns {this}
|
|
187
|
-
*/
|
|
188
|
-
$destroy(): this;
|
|
189
|
-
/**
|
|
190
|
-
* Terminate a child instance when it is not needed anymore.
|
|
191
|
-
* @returns {void}
|
|
192
|
-
*/
|
|
193
|
-
$terminate(): void;
|
|
194
|
-
/**
|
|
195
|
-
* Add an emitted event.
|
|
196
|
-
*
|
|
197
|
-
* @private
|
|
198
|
-
* @param {string} event The event name.
|
|
199
|
-
* @returns {void}
|
|
200
|
-
*/
|
|
201
|
-
private __addEmits;
|
|
202
|
-
/**
|
|
203
|
-
* Remove an emitted event.
|
|
204
|
-
*
|
|
205
|
-
* @private
|
|
206
|
-
* @param {string} event The event name.
|
|
207
|
-
* @returns {void}
|
|
208
|
-
*/
|
|
209
|
-
private __removeEmits;
|
|
210
|
-
/**
|
|
211
|
-
* Get the instance constructor.
|
|
212
|
-
*
|
|
213
|
-
* @private
|
|
214
|
-
* @returns {BaseConstructor}
|
|
215
|
-
*/
|
|
216
|
-
private get __ctor();
|
|
217
|
-
/**
|
|
218
|
-
* Bind a listener function to an event.
|
|
219
|
-
*
|
|
220
|
-
* @param {string} event
|
|
221
|
-
* Name of the event.
|
|
222
|
-
* @param {EventListenerOrEventListenerObject} listener
|
|
223
|
-
* Function to be called.
|
|
224
|
-
* @param {boolean|AddEventListenerOptions} [options]
|
|
225
|
-
* Options for the `removeEventListener` method.
|
|
226
|
-
* @returns {() => void}
|
|
227
|
-
* A function to unbind the listener.
|
|
228
|
-
*/
|
|
229
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
230
|
-
/**
|
|
231
|
-
* Unbind a listener function from an event.
|
|
232
|
-
*
|
|
233
|
-
* @param {string} event
|
|
234
|
-
* Name of the event.
|
|
235
|
-
* @param {EventListenerOrEventListenerObject} listener
|
|
236
|
-
* Function to be removed.
|
|
237
|
-
* @param {boolean|EventListenerOptions} [options]
|
|
238
|
-
* Options for the `removeEventListener` method.
|
|
239
|
-
* @returns {void}
|
|
240
|
-
*/
|
|
241
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
242
|
-
/**
|
|
243
|
-
* Emits an event.
|
|
244
|
-
*
|
|
245
|
-
* @param {string} event
|
|
246
|
-
* Name of the event.
|
|
247
|
-
* @param {any[]} args The arguments to apply to the functions bound to this event.
|
|
248
|
-
* @returns {void}
|
|
249
|
-
*/
|
|
250
|
-
$emit(event: string, ...args: any[]): void;
|
|
251
|
-
}
|
|
252
|
-
export type BaseConstructor = typeof Base;
|
|
253
|
-
export type BaseAsyncConstructor = (Base: any) => Promise<BaseConstructor | {
|
|
254
|
-
default: BaseConstructor;
|
|
255
|
-
}>;
|
|
256
|
-
export type BaseOptions = OptionsManager & {
|
|
257
|
-
[name: string]: any;
|
|
258
|
-
};
|
|
259
|
-
export type BaseRefs = {
|
|
260
|
-
[name: string]: HTMLElement | HTMLElement[];
|
|
261
|
-
};
|
|
262
|
-
export type BaseChildren = {
|
|
263
|
-
[nameOrSelector: string]: Base[] | Promise<Base>[];
|
|
264
|
-
};
|
|
265
|
-
export type BaseConfigComponents = {
|
|
266
|
-
[nameOrSelector: string]: typeof Base | BaseAsyncConstructor;
|
|
267
|
-
};
|
|
268
|
-
export type BaseConfigOptions = import('./managers/OptionsManager').OptionsSchema;
|
|
269
|
-
export type ServiceName = import('./managers/ServicesManager.js').ServiceName;
|
|
270
|
-
export type BaseConfig = {
|
|
271
|
-
name: string;
|
|
272
|
-
debug?: boolean;
|
|
273
|
-
log?: boolean;
|
|
274
|
-
refs?: string[];
|
|
275
|
-
emits?: string[];
|
|
276
|
-
components?: BaseConfigComponents;
|
|
277
|
-
options?: BaseConfigOptions;
|
|
278
|
-
};
|
|
279
|
-
export type Managers = {
|
|
280
|
-
ChildrenManager: typeof ChildrenManager;
|
|
281
|
-
EventsManager: typeof EventsManager;
|
|
282
|
-
OptionsManager: typeof OptionsManager;
|
|
283
|
-
RefsManager: typeof RefsManager;
|
|
284
|
-
ServicesManager: typeof ServicesManager;
|
|
285
|
-
};
|
|
286
|
-
import ServicesManager from "./managers/ServicesManager.js";
|
|
287
|
-
import RefsManager from "./managers/RefsManager.js";
|
|
288
|
-
import ChildrenManager from "./managers/ChildrenManager.js";
|
|
289
|
-
import OptionsManager from "./managers/OptionsManager.js";
|
|
290
|
-
import EventsManager from "./managers/EventsManager.js";
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {import('../index.js').default} Base
|
|
3
|
-
* @typedef {import('../index.js').BaseConfig} BaseConfig
|
|
4
|
-
* @typedef {import('./EventsManager.js').default} EventsManager
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* AbstractManager class.
|
|
8
|
-
*/
|
|
9
|
-
export default class AbstractManager {
|
|
10
|
-
/**
|
|
11
|
-
* Class constructor.
|
|
12
|
-
*
|
|
13
|
-
* @param {Base} base
|
|
14
|
-
*/
|
|
15
|
-
constructor(base: Base);
|
|
16
|
-
/**
|
|
17
|
-
* @type {Base}
|
|
18
|
-
*/
|
|
19
|
-
__base: Base;
|
|
20
|
-
/**
|
|
21
|
-
* Get the base instance root element.
|
|
22
|
-
* @returns {HTMLElement}
|
|
23
|
-
*/
|
|
24
|
-
get __element(): HTMLElement;
|
|
25
|
-
/**
|
|
26
|
-
* Get the base instance config.
|
|
27
|
-
* @returns {BaseConfig}
|
|
28
|
-
*/
|
|
29
|
-
get __config(): import("../index.js").BaseConfig;
|
|
30
|
-
/**
|
|
31
|
-
* Get the events manager.
|
|
32
|
-
* @returns {EventsManager}
|
|
33
|
-
*/
|
|
34
|
-
get __eventsManager(): import("./EventsManager.js").default;
|
|
35
|
-
/**
|
|
36
|
-
* Prevent a list of properties from being enumerable and writable.
|
|
37
|
-
* @param {string[]} properties
|
|
38
|
-
* @returns {void}
|
|
39
|
-
*/
|
|
40
|
-
__hideProperties(properties: string[]): void;
|
|
41
|
-
}
|
|
42
|
-
export type Base = import('../index.js').default;
|
|
43
|
-
export type BaseConfig = import('../index.js').BaseConfig;
|
|
44
|
-
export type EventsManager = import('./EventsManager.js').default;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Children manager.
|
|
3
|
-
*/
|
|
4
|
-
export default class ChildrenManager extends AbstractManager {
|
|
5
|
-
/**
|
|
6
|
-
* Store async component promises to avoid calling them multiple times and
|
|
7
|
-
* waiting for them when they are already resolved.
|
|
8
|
-
*
|
|
9
|
-
* @type {WeakMap<BaseAsyncConstructor, { promise: ReturnType<BaseAsyncConstructor>, status: 'pending'|'resolved', ctor?: BaseConstructor }>}
|
|
10
|
-
*/
|
|
11
|
-
__asyncComponentPromises: WeakMap<BaseAsyncConstructor, {
|
|
12
|
-
promise: ReturnType<BaseAsyncConstructor>;
|
|
13
|
-
status: 'pending' | 'resolved';
|
|
14
|
-
ctor?: BaseConstructor;
|
|
15
|
-
}>;
|
|
16
|
-
/**
|
|
17
|
-
* @returns {string[]}
|
|
18
|
-
*/
|
|
19
|
-
get registeredNames(): string[];
|
|
20
|
-
/**
|
|
21
|
-
* Register instances of all children components.
|
|
22
|
-
*/
|
|
23
|
-
registerAll(): void;
|
|
24
|
-
/**
|
|
25
|
-
* Mount all child component instances.
|
|
26
|
-
*/
|
|
27
|
-
mountAll(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Update all child component instances.
|
|
30
|
-
*/
|
|
31
|
-
updateAll(): void;
|
|
32
|
-
/**
|
|
33
|
-
* Destroy all child component instances.
|
|
34
|
-
*/
|
|
35
|
-
destroyAll(): void;
|
|
36
|
-
}
|
|
37
|
-
export type Base = import('../index.js').default;
|
|
38
|
-
export type BaseConstructor = import('../index.js').BaseConstructor;
|
|
39
|
-
export type BaseAsyncConstructor = import('../index.js').BaseAsyncConstructor;
|
|
40
|
-
export type BaseConfigComponents = import('../index.js').BaseConfigComponents;
|
|
41
|
-
import AbstractManager from "./AbstractManager.js";
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize the given name to PascalCase, such as:
|
|
3
|
-
*
|
|
4
|
-
* ```
|
|
5
|
-
* sentence case => SentenceCase
|
|
6
|
-
* lowercase => Lowercase
|
|
7
|
-
* UPPERCASE => Uppercase
|
|
8
|
-
* kebab-case => KebabCase
|
|
9
|
-
* snake_case => SnakeCase
|
|
10
|
-
* camelCase => CamelCase
|
|
11
|
-
* PascalCase => PascalCase
|
|
12
|
-
* .class-selector => ClassSelector
|
|
13
|
-
* .bem__selector => BemSelector
|
|
14
|
-
* __id-selector => IdSelector
|
|
15
|
-
* .complex[class^ ="__"] => ComplexClass
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @param {string} name
|
|
19
|
-
* @returns {string}
|
|
20
|
-
*/
|
|
21
|
-
export function normalizeName(name: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Normalize the event names from PascalCase to kebab-case.
|
|
24
|
-
*
|
|
25
|
-
* @param {string} name
|
|
26
|
-
* @returns {string}
|
|
27
|
-
*/
|
|
28
|
-
export function normalizeEventName(name: string): string;
|
|
29
|
-
/**
|
|
30
|
-
* Event management class.
|
|
31
|
-
* @todo Prevent binding of `onChildOrRefEvent` to the root element
|
|
32
|
-
* @todo Use event delegation?
|
|
33
|
-
*/
|
|
34
|
-
export default class EventsManager extends AbstractManager {
|
|
35
|
-
/**
|
|
36
|
-
* @type {WeakMap}
|
|
37
|
-
*/
|
|
38
|
-
__methodsCache: WeakMap<any, any>;
|
|
39
|
-
/**
|
|
40
|
-
* Event listener object for the root element.
|
|
41
|
-
*
|
|
42
|
-
* @type {EventListenerObject}
|
|
43
|
-
*/
|
|
44
|
-
__rootElementHandler: EventListenerObject;
|
|
45
|
-
/**
|
|
46
|
-
* Event listener object for the refs.
|
|
47
|
-
*
|
|
48
|
-
* @type {EventListenerObject}
|
|
49
|
-
*/
|
|
50
|
-
__refsHandler: EventListenerObject;
|
|
51
|
-
/**
|
|
52
|
-
* Event listener object for the children.
|
|
53
|
-
*
|
|
54
|
-
* @type {EventListenerObject}
|
|
55
|
-
*/
|
|
56
|
-
__childrenHandler: EventListenerObject;
|
|
57
|
-
/**
|
|
58
|
-
* Bind event methods to the given ref elements.
|
|
59
|
-
*
|
|
60
|
-
* @param {string} name
|
|
61
|
-
* The name of the ref.
|
|
62
|
-
* @param {HTMLElement[]} elements
|
|
63
|
-
* The elements of the ref.
|
|
64
|
-
* @returns {void}
|
|
65
|
-
*/
|
|
66
|
-
bindRef(name: string, elements: HTMLElement[]): void;
|
|
67
|
-
/**
|
|
68
|
-
* Bind event methods to the given ref elements.
|
|
69
|
-
*
|
|
70
|
-
* @param {string} name
|
|
71
|
-
* The name of the ref.
|
|
72
|
-
* @param {HTMLElement[]} elements
|
|
73
|
-
* The elements of the ref.
|
|
74
|
-
* @returns {void}
|
|
75
|
-
*/
|
|
76
|
-
unbindRef(name: string, elements: HTMLElement[]): void;
|
|
77
|
-
/**
|
|
78
|
-
* Bind event methods to the given child instance.
|
|
79
|
-
*
|
|
80
|
-
* @param {string} name
|
|
81
|
-
* The name of the ref.
|
|
82
|
-
* @param {Base} instance
|
|
83
|
-
* A base instance.
|
|
84
|
-
* @returns {void}
|
|
85
|
-
*/
|
|
86
|
-
bindChild(name: string, instance: Base): void;
|
|
87
|
-
/**
|
|
88
|
-
* Unbind event methods to the given child instance.
|
|
89
|
-
*
|
|
90
|
-
* @param {string} name
|
|
91
|
-
* The name of the ref.
|
|
92
|
-
* @param {Base} instance
|
|
93
|
-
* A base instance.
|
|
94
|
-
* @returns {void}
|
|
95
|
-
*/
|
|
96
|
-
unbindChild(name: string, instance: Base): void;
|
|
97
|
-
/**
|
|
98
|
-
* Bind event methods on the root element.
|
|
99
|
-
*
|
|
100
|
-
* @returns {void}
|
|
101
|
-
*/
|
|
102
|
-
bindRootElement(): void;
|
|
103
|
-
/**
|
|
104
|
-
* Unbind event method from the root element.
|
|
105
|
-
*
|
|
106
|
-
* @returns {void}
|
|
107
|
-
*/
|
|
108
|
-
unbindRootElement(): void;
|
|
109
|
-
}
|
|
110
|
-
export type Base = import('../index.js').default;
|
|
111
|
-
export type ChildrenManager = import('./ChildrenManager.js').default;
|
|
112
|
-
import AbstractManager from "./AbstractManager.js";
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get a property name.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} name
|
|
5
|
-
* @param {string} [prefix]
|
|
6
|
-
* @returns {string}
|
|
7
|
-
* @protected
|
|
8
|
-
*/
|
|
9
|
-
export function __getPropertyName(name: string, prefix?: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Class options to manage options as data attributes on an HTML element.
|
|
12
|
-
*
|
|
13
|
-
* @todo Use `MutationObserver` to update values? Might be more performant.
|
|
14
|
-
*/
|
|
15
|
-
export default class OptionsManager extends AbstractManager {
|
|
16
|
-
/**
|
|
17
|
-
* An object to store Array and Object values for reference.
|
|
18
|
-
* @type {Object}
|
|
19
|
-
* @private
|
|
20
|
-
*/
|
|
21
|
-
private __values;
|
|
22
|
-
/**
|
|
23
|
-
* Default value for the name property.
|
|
24
|
-
* @type {string}
|
|
25
|
-
*/
|
|
26
|
-
name: string;
|
|
27
|
-
/**
|
|
28
|
-
* Default value for the debug property.
|
|
29
|
-
* @type {boolean}
|
|
30
|
-
*/
|
|
31
|
-
debug: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Default value for the log property.
|
|
34
|
-
* @type {boolean}
|
|
35
|
-
*/
|
|
36
|
-
log: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Get an option value.
|
|
39
|
-
*
|
|
40
|
-
* @param {string} name The option name.
|
|
41
|
-
* @param {OptionObject} config The option config.
|
|
42
|
-
* @returns {any}
|
|
43
|
-
*/
|
|
44
|
-
get(name: string, config: OptionObject): any;
|
|
45
|
-
/**
|
|
46
|
-
* Set an option value.
|
|
47
|
-
*
|
|
48
|
-
* @param {string} name The option name.
|
|
49
|
-
* @param {any} value The new value for this option.
|
|
50
|
-
* @param {OptionObject} config The option config.
|
|
51
|
-
*/
|
|
52
|
-
set(name: string, value: any, config: OptionObject): void;
|
|
53
|
-
}
|
|
54
|
-
export type DeepmergeOptions = import('deepmerge').Options;
|
|
55
|
-
export type Base = import('../index.js').default;
|
|
56
|
-
export type BaseConfig = import('../index.js').BaseConfig;
|
|
57
|
-
export type OptionType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor;
|
|
58
|
-
export type ArrayOption = {
|
|
59
|
-
type: ArrayConstructor;
|
|
60
|
-
default?: () => any[];
|
|
61
|
-
merge?: boolean;
|
|
62
|
-
};
|
|
63
|
-
export type ObjectOption = {
|
|
64
|
-
type: ObjectConstructor;
|
|
65
|
-
default?: () => any;
|
|
66
|
-
merge?: boolean;
|
|
67
|
-
};
|
|
68
|
-
export type StringOption = {
|
|
69
|
-
type: StringConstructor;
|
|
70
|
-
default?: string;
|
|
71
|
-
};
|
|
72
|
-
export type NumberOption = {
|
|
73
|
-
type: NumberConstructor;
|
|
74
|
-
default?: number;
|
|
75
|
-
};
|
|
76
|
-
export type BooleanOption = {
|
|
77
|
-
type: BooleanConstructor;
|
|
78
|
-
default?: boolean;
|
|
79
|
-
};
|
|
80
|
-
export type OptionObject = ArrayOption | ObjectOption | StringOption | NumberOption | BooleanOption;
|
|
81
|
-
export type OptionsSchema = {
|
|
82
|
-
[name: string]: OptionType | OptionObject;
|
|
83
|
-
};
|
|
84
|
-
export type OptionsInterface = {
|
|
85
|
-
[optionName: string]: any;
|
|
86
|
-
};
|
|
87
|
-
import AbstractManager from "./AbstractManager.js";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize the name of ref.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} name The original name.
|
|
5
|
-
* @returns {string} The normalized name.
|
|
6
|
-
*/
|
|
7
|
-
export function normalizeRefName(name: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Refs Manager
|
|
10
|
-
*
|
|
11
|
-
* @todo Use `MutationObserver` to automatically update refs?
|
|
12
|
-
*/
|
|
13
|
-
export default class RefsManager extends AbstractManager {
|
|
14
|
-
/**
|
|
15
|
-
* Get refs configuration.
|
|
16
|
-
* @returns {string[]}
|
|
17
|
-
*/
|
|
18
|
-
get __refs(): string[];
|
|
19
|
-
/**
|
|
20
|
-
* Register all refs.
|
|
21
|
-
*
|
|
22
|
-
* @returns {void}
|
|
23
|
-
*/
|
|
24
|
-
registerAll(): void;
|
|
25
|
-
/**
|
|
26
|
-
* Unregister all refs.
|
|
27
|
-
*
|
|
28
|
-
* @returns {void}
|
|
29
|
-
*/
|
|
30
|
-
unregisterAll(): void;
|
|
31
|
-
}
|
|
32
|
-
import AbstractManager from "./AbstractManager.js";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Class options to manage options as data attributes on an HTML element.
|
|
3
|
-
*/
|
|
4
|
-
export default class ResponsiveOptionsManager extends OptionsManager {
|
|
5
|
-
/**
|
|
6
|
-
* Get an option value.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} name The option name.
|
|
9
|
-
* @param {ResponsiveOptionObject} config The option configuration.
|
|
10
|
-
* @returns {any}
|
|
11
|
-
*/
|
|
12
|
-
get(name: string, config: ResponsiveOptionObject): any;
|
|
13
|
-
/**
|
|
14
|
-
* Set an option value.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} name The option name.
|
|
17
|
-
* @param {any} value The new value.
|
|
18
|
-
* @param {ResponsiveOptionObject} config The option configuration.
|
|
19
|
-
*/
|
|
20
|
-
set(name: string, value: any, config: ResponsiveOptionObject): void;
|
|
21
|
-
}
|
|
22
|
-
export type OptionObject = import('./OptionsManager.js').OptionObject;
|
|
23
|
-
export type ResponsiveOptionObject = OptionObject & {
|
|
24
|
-
responsive?: boolean;
|
|
25
|
-
};
|
|
26
|
-
import OptionsManager from "./OptionsManager.js";
|