@studiometa/js-toolkit 2.4.4-alpha.0 → 2.4.4-alpha.3

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 (46) hide show
  1. package/Base/index.cjs +1 -1
  2. package/Base/index.d.ts +198 -0
  3. package/Base/managers/AbstractManager.d.ts +44 -0
  4. package/Base/managers/ChildrenManager.d.ts +41 -0
  5. package/Base/managers/EventsManager.d.ts +112 -0
  6. package/Base/managers/OptionsManager.d.ts +87 -0
  7. package/Base/managers/RefsManager.d.ts +32 -0
  8. package/Base/managers/ResponsiveOptionsManager.cjs +1 -1
  9. package/Base/managers/ResponsiveOptionsManager.d.ts +22 -0
  10. package/Base/managers/ServicesManager.d.ts +109 -0
  11. package/Base/types.cjs +18 -0
  12. package/Base/types.d.ts +43 -0
  13. package/Base/types.js +0 -0
  14. package/Base/utils.d.ts +40 -0
  15. package/decorators/index.d.ts +10 -0
  16. package/decorators/withBreakpointManager.d.ts +59 -0
  17. package/decorators/withBreakpointObserver.d.ts +65 -0
  18. package/decorators/withDrag.d.ts +56 -0
  19. package/decorators/withExtraConfig.d.ts +57 -0
  20. package/decorators/withFreezedOptions.d.ts +56 -0
  21. package/decorators/withIntersectionObserver.d.ts +69 -0
  22. package/decorators/withMountWhenInView.d.ts +67 -0
  23. package/decorators/withResponsiveOptions.d.ts +53 -0
  24. package/decorators/withScrolledInView.d.ts +171 -0
  25. package/decorators/withVue2.cjs +2 -2
  26. package/decorators/withVue2.d.ts +70 -0
  27. package/decorators/withVue2.js +2 -2
  28. package/helpers/createApp.d.ts +14 -0
  29. package/helpers/getDirectChildren.d.ts +24 -0
  30. package/helpers/getInstanceFromElement.d.ts +14 -0
  31. package/helpers/importOnInteraction.d.ts +23 -0
  32. package/helpers/importWhenIdle.d.ts +21 -0
  33. package/helpers/importWhenVisible.d.ts +23 -0
  34. package/helpers/index.d.ts +6 -0
  35. package/helpers/utils.d.ts +10 -0
  36. package/index.d.ts +6 -0
  37. package/package.json +1 -1
  38. package/services/drag.d.ts +1 -1
  39. package/services/index.cjs +1 -1
  40. package/services/index.d.ts +33 -25
  41. package/services/key.d.ts +1 -1
  42. package/services/load.d.ts +1 -1
  43. package/services/pointer.d.ts +1 -1
  44. package/services/raf.d.ts +1 -1
  45. package/services/resize.d.ts +1 -1
  46. package/services/scroll.d.ts +1 -1
package/Base/index.cjs CHANGED
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
27
27
  return value;
28
28
  };
29
29
 
30
- // packages/js-toolkit/Base/index.js
30
+ // packages/js-toolkit/Base/index.ts
31
31
  var Base_exports = {};
32
32
  __export(Base_exports, {
33
33
  default: () => Base
@@ -0,0 +1,198 @@
1
+ import ChildrenManager from './managers/ChildrenManager.js';
2
+ import RefsManager from './managers/RefsManager.js';
3
+ import ServicesManager from './managers/ServicesManager.js';
4
+ import EventsManager from './managers/EventsManager.js';
5
+ import OptionsManager from './managers/OptionsManager.js';
6
+ export declare type BaseConstructor = typeof Base;
7
+ export declare type BaseAsyncConstructor = (Base: any) => Promise<BaseConstructor | {
8
+ default: BaseConstructor;
9
+ }>;
10
+ export declare type BaseOptions = {
11
+ [name: string]: unknown;
12
+ };
13
+ export declare type BaseRefs = {
14
+ [name: string]: HTMLElement | HTMLElement[];
15
+ };
16
+ export declare type BaseChildren = {
17
+ [nameOrSelector: string]: Base[] | Promise<Base>[];
18
+ };
19
+ export declare type BaseConfigComponents = {
20
+ [nameOrSelector: string]: BaseConstructor | BaseAsyncConstructor;
21
+ };
22
+ export declare type BaseConfig = {
23
+ name: string;
24
+ debug?: boolean;
25
+ log?: boolean;
26
+ refs?: string[];
27
+ emits?: string[];
28
+ components?: BaseConfigComponents;
29
+ options?: import('./managers/OptionsManager').OptionsSchema;
30
+ };
31
+ export declare type BaseTypeParameter = {
32
+ $el?: HTMLElement;
33
+ $options?: BaseOptions;
34
+ $refs?: BaseRefs;
35
+ $children?: {
36
+ [name: string]: Base | Promise<Base>;
37
+ };
38
+ };
39
+ export declare type Managers = {
40
+ ChildrenManager: typeof ChildrenManager;
41
+ EventsManager: typeof EventsManager;
42
+ OptionsManager: typeof OptionsManager;
43
+ RefsManager: typeof RefsManager;
44
+ ServicesManager: typeof ServicesManager;
45
+ };
46
+ /**
47
+ * Base class.
48
+ */
49
+ export default class Base<T extends BaseTypeParameter = BaseTypeParameter> extends EventTarget {
50
+ /**
51
+ * This is a Base instance.
52
+ */
53
+ static readonly $isBase: true;
54
+ /**
55
+ * The instance parent.
56
+ */
57
+ $parent: Base;
58
+ /**
59
+ * The instance id.
60
+ */
61
+ $id: string;
62
+ /**
63
+ * The root element.
64
+ */
65
+ $el: T['$el'] & HTMLElement & {
66
+ __base__?: WeakMap<BaseConstructor, Base | 'terminated'>;
67
+ };
68
+ /**
69
+ * The state of the component.
70
+ */
71
+ $isMounted: boolean;
72
+ /**
73
+ * Store the event handlers.
74
+ */
75
+ __eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
76
+ /**
77
+ * Get the root instance of the app.
78
+ */
79
+ get $root(): Base;
80
+ /**
81
+ * Merge configuration with the parents' configurations.
82
+ */
83
+ get __config(): BaseConfig;
84
+ static config: BaseConfig;
85
+ __services: ServicesManager;
86
+ get $services(): ServicesManager;
87
+ __refs: RefsManager & T['$refs'] & BaseRefs;
88
+ get $refs(): RefsManager & T['$refs'] & BaseRefs;
89
+ __options: OptionsManager & T['$options'] & BaseOptions;
90
+ get $options(): OptionsManager & T['$options'] & BaseOptions;
91
+ __children: ChildrenManager & {
92
+ [key in keyof T['$children']]: Array<T['$children'][key]>;
93
+ } & BaseChildren;
94
+ get $children(): ChildrenManager & {
95
+ [key in keyof T['$children']]: Array<T['$children'][key]>;
96
+ } & BaseChildren;
97
+ __events: EventsManager;
98
+ /**
99
+ * Small helper to log stuff.
100
+ */
101
+ get $log(): (...args: any) => void;
102
+ /**
103
+ * Small helper to debug information.
104
+ */
105
+ get __debug(): (...args: any) => void;
106
+ /**
107
+ * Get manager constructors.
108
+ */
109
+ get __managers(): Managers;
110
+ /**
111
+ * Call an instance method and emit corresponding events.
112
+ */
113
+ __callMethod(method: string, ...args: unknown[]): unknown;
114
+ /**
115
+ * Test if the given event has been bound to the instance.
116
+ *
117
+ * @param {string} event The event's name.
118
+ * @returns {boolean} Wether the given event has been bound or not.
119
+ */
120
+ __hasEvent(event: string): boolean;
121
+ /**
122
+ * Class constructor where all the magic takes place.
123
+ *
124
+ * @param {HTMLElement} element The component's root element dd.
125
+ */
126
+ constructor(element: HTMLElement);
127
+ /**
128
+ * Trigger the `mounted` callback.
129
+ */
130
+ $mount(): this;
131
+ /**
132
+ * Update the instance children.
133
+ */
134
+ $update(): this;
135
+ /**
136
+ * Trigger the `destroyed` callback.
137
+ */
138
+ $destroy(): this;
139
+ /**
140
+ * Terminate a child instance when it is not needed anymore.
141
+ */
142
+ $terminate(): void;
143
+ /**
144
+ * Add an emitted event.
145
+ *
146
+ * @param {string} event The event name.
147
+ * @returns {void}
148
+ */
149
+ __addEmits(event: string): void;
150
+ /**
151
+ * Remove an emitted event.
152
+ *
153
+ * @param {string} event The event name.
154
+ * @returns {void}
155
+ */
156
+ __removeEmits(event: string): void;
157
+ /**
158
+ * Get the instance constructor.
159
+ */
160
+ get __ctor(): BaseConstructor;
161
+ /**
162
+ * Bind a listener function to an event.
163
+ *
164
+ * @param {string} event
165
+ * Name of the event.
166
+ * @param {EventListenerOrEventListenerObject} listener
167
+ * Function to be called.
168
+ * @param {boolean|AddEventListenerOptions} [options]
169
+ * Options for the `removeEventListener` method.
170
+ * @returns {() => void}
171
+ * A function to unbind the listener.
172
+ */
173
+ $on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
174
+ /**
175
+ * Unbind a listener function from an event.
176
+ *
177
+ * @param {string} event
178
+ * Name of the event.
179
+ * @param {EventListenerOrEventListenerObject} listener
180
+ * Function to be removed.
181
+ * @param {boolean|EventListenerOptions} [options]
182
+ * Options for the `removeEventListener` method.
183
+ * @returns {void}
184
+ */
185
+ $off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
186
+ /**
187
+ * Emits an event.
188
+ *
189
+ * @param {string} event Name of the event.
190
+ * @param {any[]} args The arguments to apply to the functions bound to this event.
191
+ * @returns {void}
192
+ */
193
+ $emit(event: string, ...args: unknown[]): void;
194
+ /**
195
+ * Factory method to generate multiple instance of the class.
196
+ */
197
+ static $factory(nameOrSelector: string): Base[];
198
+ }
@@ -0,0 +1,44 @@
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;
@@ -0,0 +1,41 @@
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";
@@ -0,0 +1,112 @@
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";
@@ -0,0 +1,87 @@
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";
@@ -0,0 +1,32 @@
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";
@@ -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
@@ -0,0 +1,22 @@
1
+ import OptionsManager from './OptionsManager.js';
2
+ /**
3
+ * Class options to manage options as data attributes on an HTML element.
4
+ */
5
+ export default class ResponsiveOptionsManager extends OptionsManager {
6
+ /**
7
+ * Get an option value.
8
+ *
9
+ * @param {string} name The option name.
10
+ * @param {ResponsiveOptionObject} config The option configuration.
11
+ * @returns {any}
12
+ */
13
+ get(name: any, config: any): any;
14
+ /**
15
+ * Set an option value.
16
+ *
17
+ * @param {string} name The option name.
18
+ * @param {any} value The new value.
19
+ * @param {ResponsiveOptionObject} config The option configuration.
20
+ */
21
+ set(name: any, value: any, config: any): void;
22
+ }
@@ -0,0 +1,109 @@
1
+ /**
2
+ * @typedef {typeof SERVICES_MAP & Record<string, () => ServiceInterface>} Services
3
+ * @typedef {keyof SERVICES_MAP|string} ServiceName
4
+ */
5
+ /**
6
+ * Services management for the Base class.
7
+ *
8
+ * @todo Add support for disabled services on mount when the method is defined.
9
+ */
10
+ export default class ServicesManager extends AbstractManager {
11
+ /**
12
+ * @type {Record<string, () => ServiceInterface>}
13
+ */
14
+ __customServices: Record<string, () => import("../../services").ServiceInterface<any>>;
15
+ /**
16
+ * @returns {Record<string, () => ServiceInterface>}
17
+ */
18
+ get __services(): Record<string, () => import("../../services").ServiceInterface<any>>;
19
+ /**
20
+ * Test if the given service is registered.
21
+ *
22
+ * @param {ServiceName} service The name of the service.
23
+ * @returns {boolean}
24
+ */
25
+ has(service: ServiceName): boolean;
26
+ /**
27
+ * Get a service props by name.
28
+ * @param {ServiceName} service The name of the service.
29
+ * @returns {ReturnType<ServiceInterface['props']>}
30
+ */
31
+ get(service: ServiceName): ReturnType<import("../../services").ServiceInterface<any>['props']>;
32
+ /**
33
+ * Init the given service and bind it to the given instance.
34
+ *
35
+ * @param {ServiceName} service The name of the service.
36
+ * @returns {() => void} A function to unbind the service.
37
+ */
38
+ enable(service: ServiceName): () => void;
39
+ /**
40
+ * Enable all services and return methods to disable them.
41
+ *
42
+ * @returns {Function[]}
43
+ */
44
+ enableAll(): Function[];
45
+ /**
46
+ * Disable all services.
47
+ *
48
+ * @returns {void}
49
+ */
50
+ disableAll(): void;
51
+ /**
52
+ * Disable a service.
53
+ *
54
+ * @param {string} service The name of the service.
55
+ * @returns {void}
56
+ */
57
+ disable(service: string): void;
58
+ /**
59
+ * Toggle a service.
60
+ * @param {string} service The name of the service.
61
+ * @param {boolean} [force] The state to force.
62
+ * @returns {void}
63
+ */
64
+ toggle(service: string, force?: boolean): void;
65
+ /**
66
+ * Register a new service to be enabled/disabled.
67
+ *
68
+ * @param {string} name
69
+ * The name of the service hook.
70
+ * @param {() => ServiceInterface} useFunction
71
+ * The `use...` function for the service.
72
+ */
73
+ register(name: string, useFunction: () => import("../../services").ServiceInterface<any>): void;
74
+ /**
75
+ * Unregister a new service to be enabled disabled.
76
+ *
77
+ * @param {string} name
78
+ * The name of the service hook.
79
+ */
80
+ unregister(name: string): void;
81
+ }
82
+ export type Base = import('../index').default;
83
+ export type BaseConstructor = import('../index').BaseConstructor;
84
+ export type ServiceInterface = import('../../services').ServiceInterface<any>;
85
+ export type Services = typeof SERVICES_MAP & Record<string, () => import("../../services").ServiceInterface<any>>;
86
+ export type ServiceName = keyof {
87
+ scrolled: typeof useScroll;
88
+ resized: typeof useResize;
89
+ ticked: typeof useRaf;
90
+ moved: typeof usePointer;
91
+ keyed: typeof useKey;
92
+ loaded: typeof useLoad;
93
+ } | string;
94
+ import AbstractManager from "./AbstractManager.js";
95
+ declare namespace SERVICES_MAP {
96
+ export { useScroll as scrolled };
97
+ export { useResize as resized };
98
+ export { useRaf as ticked };
99
+ export { usePointer as moved };
100
+ export { useKey as keyed };
101
+ export { useLoad as loaded };
102
+ }
103
+ import useScroll from "../../services/scroll.js";
104
+ import useResize from "../../services/resize.js";
105
+ import useRaf from "../../services/raf.js";
106
+ import usePointer from "../../services/pointer.js";
107
+ import useKey from "../../services/key.js";
108
+ import useLoad from "../../services/load.js";
109
+ export {};
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;