@studiometa/js-toolkit 2.4.4-alpha.3 → 2.4.4-alpha.4
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 +1 -1
- package/Base/index.d.ts +16 -18
- package/Base/index.js +1 -1
- package/Base/managers/AbstractManager.d.ts +2 -2
- package/Base/managers/ChildrenManager.cjs +2 -4
- package/Base/managers/ChildrenManager.d.ts +2 -10
- package/Base/managers/ChildrenManager.js +1 -3
- package/Base/managers/EventsManager.cjs +3 -3
- package/Base/managers/EventsManager.d.ts +9 -15
- package/Base/managers/EventsManager.js +2 -2
- package/Base/managers/OptionsManager.d.ts +2 -2
- package/Base/managers/ServicesManager.d.ts +1 -1
- package/Base/utils.cjs +1 -1
- package/Base/utils.d.ts +5 -21
- package/decorators/index.cjs +2 -0
- package/decorators/index.d.ts +1 -0
- package/decorators/index.js +4 -2
- package/decorators/withBreakpointManager.cjs +3 -2
- package/decorators/withBreakpointManager.d.ts +2 -56
- package/decorators/withBreakpointManager.js +3 -2
- package/decorators/withBreakpointObserver.cjs +6 -4
- package/decorators/withBreakpointObserver.d.ts +71 -16
- package/decorators/withBreakpointObserver.js +6 -4
- package/decorators/withDrag.cjs +5 -4
- package/decorators/withDrag.d.ts +58 -16
- package/decorators/withDrag.js +5 -4
- package/decorators/withExtraConfig.cjs +4 -3
- package/decorators/withExtraConfig.d.ts +60 -17
- package/decorators/withExtraConfig.js +4 -3
- package/decorators/withFreezedOptions.cjs +3 -2
- package/decorators/withFreezedOptions.d.ts +68 -16
- package/decorators/withFreezedOptions.js +3 -2
- package/decorators/withIntersectionObserver.cjs +6 -4
- package/decorators/withIntersectionObserver.d.ts +64 -17
- package/decorators/withIntersectionObserver.js +6 -4
- package/decorators/withMountWhenInView.cjs +10 -5
- package/decorators/withMountWhenInView.d.ts +71 -16
- package/decorators/withMountWhenInView.js +10 -5
- package/decorators/withResponsiveOptions.cjs +3 -2
- package/decorators/withResponsiveOptions.d.ts +65 -17
- package/decorators/withResponsiveOptions.js +3 -2
- package/decorators/withScrolledInView.cjs +5 -4
- package/decorators/withScrolledInView.d.ts +222 -55
- package/decorators/withScrolledInView.js +5 -4
- package/decorators/withType.cjs +28 -0
- package/decorators/withType.d.ts +5 -0
- package/decorators/withType.js +6 -0
- package/decorators/withVue2.cjs +7 -4
- package/decorators/withVue2.d.ts +61 -17
- package/decorators/withVue2.js +7 -4
- package/helpers/createApp.cjs +1 -1
- package/helpers/createApp.d.ts +2 -10
- package/helpers/getDirectChildren.cjs +5 -5
- package/helpers/getDirectChildren.d.ts +3 -6
- package/helpers/getDirectChildren.js +4 -4
- package/helpers/getInstanceFromElement.cjs +3 -4
- package/helpers/getInstanceFromElement.d.ts +2 -11
- package/helpers/getInstanceFromElement.js +2 -3
- package/helpers/importOnInteraction.cjs +1 -1
- package/helpers/importOnInteraction.d.ts +5 -10
- package/helpers/importWhenIdle.cjs +3 -5
- package/helpers/importWhenIdle.d.ts +7 -10
- package/helpers/importWhenIdle.js +2 -4
- package/helpers/importWhenVisible.cjs +1 -1
- package/helpers/importWhenVisible.d.ts +2 -7
- package/helpers/index.cjs +1 -1
- package/helpers/index.d.ts +6 -6
- package/helpers/utils.cjs +1 -1
- package/helpers/utils.d.ts +1 -1
- package/index.cjs +2 -8
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/package.json +1 -1
package/Base/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var __publicField = (obj, key, value) => {
|
|
|
30
30
|
// packages/js-toolkit/Base/index.ts
|
|
31
31
|
var Base_exports = {};
|
|
32
32
|
__export(Base_exports, {
|
|
33
|
-
|
|
33
|
+
Base: () => Base
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(Base_exports);
|
|
36
36
|
var import_utils = require("./utils.cjs");
|
package/Base/index.d.ts
CHANGED
|
@@ -3,9 +3,15 @@ import RefsManager from './managers/RefsManager.js';
|
|
|
3
3
|
import ServicesManager from './managers/ServicesManager.js';
|
|
4
4
|
import EventsManager from './managers/EventsManager.js';
|
|
5
5
|
import OptionsManager from './managers/OptionsManager.js';
|
|
6
|
-
export declare type
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export declare type BaseEl = HTMLElement & {
|
|
7
|
+
__base__?: WeakMap<BaseConstructor, Base | 'terminated'>;
|
|
8
|
+
};
|
|
9
|
+
export declare type BaseConstructor<T extends Base = Base> = {
|
|
10
|
+
new (...args: any[]): T;
|
|
11
|
+
prototype: Base;
|
|
12
|
+
} & Pick<typeof Base, keyof typeof Base>;
|
|
13
|
+
export declare type BaseAsyncConstructor<T extends Base = Base> = (Base: any) => Promise<BaseConstructor<T> | {
|
|
14
|
+
default: BaseConstructor<T>;
|
|
9
15
|
}>;
|
|
10
16
|
export declare type BaseOptions = {
|
|
11
17
|
[name: string]: unknown;
|
|
@@ -32,9 +38,7 @@ export declare type BaseTypeParameter = {
|
|
|
32
38
|
$el?: HTMLElement;
|
|
33
39
|
$options?: BaseOptions;
|
|
34
40
|
$refs?: BaseRefs;
|
|
35
|
-
$children?:
|
|
36
|
-
[name: string]: Base | Promise<Base>;
|
|
37
|
-
};
|
|
41
|
+
$children?: BaseChildren;
|
|
38
42
|
};
|
|
39
43
|
export declare type Managers = {
|
|
40
44
|
ChildrenManager: typeof ChildrenManager;
|
|
@@ -46,7 +50,7 @@ export declare type Managers = {
|
|
|
46
50
|
/**
|
|
47
51
|
* Base class.
|
|
48
52
|
*/
|
|
49
|
-
export
|
|
53
|
+
export declare class Base<T extends BaseTypeParameter = BaseTypeParameter> extends EventTarget {
|
|
50
54
|
/**
|
|
51
55
|
* This is a Base instance.
|
|
52
56
|
*/
|
|
@@ -62,9 +66,7 @@ export default class Base<T extends BaseTypeParameter = BaseTypeParameter> exten
|
|
|
62
66
|
/**
|
|
63
67
|
* The root element.
|
|
64
68
|
*/
|
|
65
|
-
$el: T['$el'] &
|
|
66
|
-
__base__?: WeakMap<BaseConstructor, Base | 'terminated'>;
|
|
67
|
-
};
|
|
69
|
+
$el: T['$el'] & BaseEl;
|
|
68
70
|
/**
|
|
69
71
|
* The state of the component.
|
|
70
72
|
*/
|
|
@@ -88,21 +90,17 @@ export default class Base<T extends BaseTypeParameter = BaseTypeParameter> exten
|
|
|
88
90
|
get $refs(): RefsManager & T['$refs'] & BaseRefs;
|
|
89
91
|
__options: OptionsManager & T['$options'] & BaseOptions;
|
|
90
92
|
get $options(): OptionsManager & T['$options'] & BaseOptions;
|
|
91
|
-
__children: ChildrenManager &
|
|
92
|
-
|
|
93
|
-
} & BaseChildren;
|
|
94
|
-
get $children(): ChildrenManager & {
|
|
95
|
-
[key in keyof T['$children']]: Array<T['$children'][key]>;
|
|
96
|
-
} & BaseChildren;
|
|
93
|
+
__children: ChildrenManager & T['$children'] & BaseChildren;
|
|
94
|
+
get $children(): ChildrenManager & T['$children'] & BaseChildren;
|
|
97
95
|
__events: EventsManager;
|
|
98
96
|
/**
|
|
99
97
|
* Small helper to log stuff.
|
|
100
98
|
*/
|
|
101
|
-
get $log(): (...args:
|
|
99
|
+
get $log(): (...args: unknown[]) => void;
|
|
102
100
|
/**
|
|
103
101
|
* Small helper to debug information.
|
|
104
102
|
*/
|
|
105
|
-
get __debug(): (...args:
|
|
103
|
+
get __debug(): (...args: unknown[]) => void;
|
|
106
104
|
/**
|
|
107
105
|
* Get manager constructors.
|
|
108
106
|
*/
|
package/Base/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import('../index.js').
|
|
2
|
+
* @typedef {import('../index.js').Base} Base
|
|
3
3
|
* @typedef {import('../index.js').BaseConfig} BaseConfig
|
|
4
4
|
* @typedef {import('./EventsManager.js').default} EventsManager
|
|
5
5
|
*/
|
|
@@ -39,6 +39,6 @@ export default class AbstractManager {
|
|
|
39
39
|
*/
|
|
40
40
|
__hideProperties(properties: string[]): void;
|
|
41
41
|
}
|
|
42
|
-
export type Base = import('../index.js').
|
|
42
|
+
export type Base = import('../index.js').Base;
|
|
43
43
|
export type BaseConfig = import('../index.js').BaseConfig;
|
|
44
44
|
export type EventsManager = import('./EventsManager.js').default;
|
|
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27
27
|
return value;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
// packages/js-toolkit/Base/managers/ChildrenManager.
|
|
30
|
+
// packages/js-toolkit/Base/managers/ChildrenManager.ts
|
|
31
31
|
var ChildrenManager_exports = {};
|
|
32
32
|
__export(ChildrenManager_exports, {
|
|
33
33
|
default: () => ChildrenManager
|
|
@@ -36,9 +36,7 @@ module.exports = __toCommonJS(ChildrenManager_exports);
|
|
|
36
36
|
var import_AbstractManager = __toESM(require("./AbstractManager.cjs"), 1);
|
|
37
37
|
var import_utils = require("../utils.cjs");
|
|
38
38
|
function __getChild(that, el, ComponentClass, name) {
|
|
39
|
-
const asyncComponentPromise = that.__asyncComponentPromises.get(
|
|
40
|
-
ComponentClass
|
|
41
|
-
);
|
|
39
|
+
const asyncComponentPromise = that.__asyncComponentPromises.get(ComponentClass);
|
|
42
40
|
if ("$isBase" in ComponentClass || asyncComponentPromise && asyncComponentPromise.status === "resolved") {
|
|
43
41
|
let ctor = ComponentClass;
|
|
44
42
|
if (asyncComponentPromise) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BaseConstructor, BaseAsyncConstructor } from '../index.js';
|
|
2
|
+
import AbstractManager from './AbstractManager.js';
|
|
1
3
|
/**
|
|
2
4
|
* Children manager.
|
|
3
5
|
*/
|
|
@@ -5,17 +7,12 @@ export default class ChildrenManager extends AbstractManager {
|
|
|
5
7
|
/**
|
|
6
8
|
* Store async component promises to avoid calling them multiple times and
|
|
7
9
|
* waiting for them when they are already resolved.
|
|
8
|
-
*
|
|
9
|
-
* @type {WeakMap<BaseAsyncConstructor, { promise: ReturnType<BaseAsyncConstructor>, status: 'pending'|'resolved', ctor?: BaseConstructor }>}
|
|
10
10
|
*/
|
|
11
11
|
__asyncComponentPromises: WeakMap<BaseAsyncConstructor, {
|
|
12
12
|
promise: ReturnType<BaseAsyncConstructor>;
|
|
13
13
|
status: 'pending' | 'resolved';
|
|
14
14
|
ctor?: BaseConstructor;
|
|
15
15
|
}>;
|
|
16
|
-
/**
|
|
17
|
-
* @returns {string[]}
|
|
18
|
-
*/
|
|
19
16
|
get registeredNames(): string[];
|
|
20
17
|
/**
|
|
21
18
|
* Register instances of all children components.
|
|
@@ -34,8 +31,3 @@ export default class ChildrenManager extends AbstractManager {
|
|
|
34
31
|
*/
|
|
35
32
|
destroyAll(): void;
|
|
36
33
|
}
|
|
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";
|
|
@@ -7,9 +7,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
import AbstractManager from "./AbstractManager.js";
|
|
8
8
|
import { getComponentElements } from "../utils.js";
|
|
9
9
|
function __getChild(that, el, ComponentClass, name) {
|
|
10
|
-
const asyncComponentPromise = that.__asyncComponentPromises.get(
|
|
11
|
-
ComponentClass
|
|
12
|
-
);
|
|
10
|
+
const asyncComponentPromise = that.__asyncComponentPromises.get(ComponentClass);
|
|
13
11
|
if ("$isBase" in ComponentClass || asyncComponentPromise && asyncComponentPromise.status === "resolved") {
|
|
14
12
|
let ctor = ComponentClass;
|
|
15
13
|
if (asyncComponentPromise) {
|
|
@@ -27,7 +27,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27
27
|
return value;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
// packages/js-toolkit/Base/managers/EventsManager.
|
|
30
|
+
// packages/js-toolkit/Base/managers/EventsManager.ts
|
|
31
31
|
var EventsManager_exports = {};
|
|
32
32
|
__export(EventsManager_exports, {
|
|
33
33
|
default: () => EventsManager,
|
|
@@ -143,14 +143,14 @@ var EventsManager = class extends import_AbstractManager.default {
|
|
|
143
143
|
const childrenManager = this.__base.$children;
|
|
144
144
|
const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
|
|
145
145
|
name: childName,
|
|
146
|
-
child: childrenManager[childName].find(
|
|
146
|
+
child: [...childrenManager[childName]].find(
|
|
147
147
|
(instance) => instance === event.currentTarget || instance.$el === event.currentTarget
|
|
148
148
|
)
|
|
149
149
|
})).find(({ child }) => child);
|
|
150
150
|
const normalizedChildName = normalizeName(name);
|
|
151
151
|
const normalizedEventName = normalizeName(event.type);
|
|
152
152
|
const method = `on${normalizedChildName}${normalizedEventName}`;
|
|
153
|
-
const index = childrenManager[name].indexOf(resolvedChild);
|
|
153
|
+
const index = [...childrenManager[name]].indexOf(resolvedChild);
|
|
154
154
|
const args = (0, import_utils.isArray)(event.detail) ? event.detail : [];
|
|
155
155
|
this.__base[method](...args, index, event);
|
|
156
156
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Base } from '../index.js';
|
|
2
|
+
import AbstractManager from './AbstractManager.js';
|
|
1
3
|
/**
|
|
2
4
|
* Normalize the given name to PascalCase, such as:
|
|
3
5
|
*
|
|
@@ -18,42 +20,37 @@
|
|
|
18
20
|
* @param {string} name
|
|
19
21
|
* @returns {string}
|
|
20
22
|
*/
|
|
21
|
-
export function normalizeName(name: string): string;
|
|
23
|
+
export declare function normalizeName(name: string): string;
|
|
22
24
|
/**
|
|
23
25
|
* Normalize the event names from PascalCase to kebab-case.
|
|
24
26
|
*
|
|
25
27
|
* @param {string} name
|
|
26
28
|
* @returns {string}
|
|
27
29
|
*/
|
|
28
|
-
export function normalizeEventName(name: string): string;
|
|
30
|
+
export declare function normalizeEventName(name: string): string;
|
|
29
31
|
/**
|
|
30
32
|
* Event management class.
|
|
31
33
|
* @todo Prevent binding of `onChildOrRefEvent` to the root element
|
|
32
34
|
* @todo Use event delegation?
|
|
33
35
|
*/
|
|
34
36
|
export default class EventsManager extends AbstractManager {
|
|
35
|
-
|
|
36
|
-
* @type {WeakMap}
|
|
37
|
-
*/
|
|
38
|
-
__methodsCache: WeakMap<any, any>;
|
|
37
|
+
__methodsCache: Map<string, string[]>;
|
|
39
38
|
/**
|
|
40
39
|
* Event listener object for the root element.
|
|
41
|
-
*
|
|
42
|
-
* @type {EventListenerObject}
|
|
43
40
|
*/
|
|
44
41
|
__rootElementHandler: EventListenerObject;
|
|
45
42
|
/**
|
|
46
43
|
* Event listener object for the refs.
|
|
47
|
-
*
|
|
48
|
-
* @type {EventListenerObject}
|
|
49
44
|
*/
|
|
50
45
|
__refsHandler: EventListenerObject;
|
|
51
46
|
/**
|
|
52
47
|
* Event listener object for the children.
|
|
53
|
-
*
|
|
54
|
-
* @type {EventListenerObject}
|
|
55
48
|
*/
|
|
56
49
|
__childrenHandler: EventListenerObject;
|
|
50
|
+
/**
|
|
51
|
+
* Class constructor.
|
|
52
|
+
*/
|
|
53
|
+
constructor(base: Base);
|
|
57
54
|
/**
|
|
58
55
|
* Bind event methods to the given ref elements.
|
|
59
56
|
*
|
|
@@ -107,6 +104,3 @@ export default class EventsManager extends AbstractManager {
|
|
|
107
104
|
*/
|
|
108
105
|
unbindRootElement(): void;
|
|
109
106
|
}
|
|
110
|
-
export type Base = import('../index.js').default;
|
|
111
|
-
export type ChildrenManager = import('./ChildrenManager.js').default;
|
|
112
|
-
import AbstractManager from "./AbstractManager.js";
|
|
@@ -112,14 +112,14 @@ class EventsManager extends AbstractManager {
|
|
|
112
112
|
const childrenManager = this.__base.$children;
|
|
113
113
|
const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
|
|
114
114
|
name: childName,
|
|
115
|
-
child: childrenManager[childName].find(
|
|
115
|
+
child: [...childrenManager[childName]].find(
|
|
116
116
|
(instance) => instance === event.currentTarget || instance.$el === event.currentTarget
|
|
117
117
|
)
|
|
118
118
|
})).find(({ child }) => child);
|
|
119
119
|
const normalizedChildName = normalizeName(name);
|
|
120
120
|
const normalizedEventName = normalizeName(event.type);
|
|
121
121
|
const method = `on${normalizedChildName}${normalizedEventName}`;
|
|
122
|
-
const index = childrenManager[name].indexOf(resolvedChild);
|
|
122
|
+
const index = [...childrenManager[name]].indexOf(resolvedChild);
|
|
123
123
|
const args = isArray(event.detail) ? event.detail : [];
|
|
124
124
|
this.__base[method](...args, index, event);
|
|
125
125
|
}
|
|
@@ -52,7 +52,7 @@ export default class OptionsManager extends AbstractManager {
|
|
|
52
52
|
set(name: string, value: any, config: OptionObject): void;
|
|
53
53
|
}
|
|
54
54
|
export type DeepmergeOptions = import('deepmerge').Options;
|
|
55
|
-
export type Base = import('../index.js').
|
|
55
|
+
export type Base = import('../index.js').Base;
|
|
56
56
|
export type BaseConfig = import('../index.js').BaseConfig;
|
|
57
57
|
export type OptionType = StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor | ObjectConstructor;
|
|
58
58
|
export type ArrayOption = {
|
|
@@ -79,7 +79,7 @@ export type BooleanOption = {
|
|
|
79
79
|
};
|
|
80
80
|
export type OptionObject = ArrayOption | ObjectOption | StringOption | NumberOption | BooleanOption;
|
|
81
81
|
export type OptionsSchema = {
|
|
82
|
-
[name: string]:
|
|
82
|
+
[name: string]: OptionObject | OptionType;
|
|
83
83
|
};
|
|
84
84
|
export type OptionsInterface = {
|
|
85
85
|
[optionName: string]: any;
|
|
@@ -79,7 +79,7 @@ export default class ServicesManager extends AbstractManager {
|
|
|
79
79
|
*/
|
|
80
80
|
unregister(name: string): void;
|
|
81
81
|
}
|
|
82
|
-
export type Base = import('../index').
|
|
82
|
+
export type Base = import('../index').Base;
|
|
83
83
|
export type BaseConstructor = import('../index').BaseConstructor;
|
|
84
84
|
export type ServiceInterface = import('../../services').ServiceInterface<any>;
|
|
85
85
|
export type Services = typeof SERVICES_MAP & Record<string, () => import("../../services").ServiceInterface<any>>;
|
package/Base/utils.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/Base/utils.
|
|
19
|
+
// packages/js-toolkit/Base/utils.ts
|
|
20
20
|
var utils_exports = {};
|
|
21
21
|
__export(utils_exports, {
|
|
22
22
|
eventIsDefinedInConfig: () => eventIsDefinedInConfig,
|
package/Base/utils.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @typedef {import('./index.js').default} Base
|
|
3
|
-
*/
|
|
1
|
+
import type { Base, BaseConfig } from './index.js';
|
|
4
2
|
/**
|
|
5
3
|
* Get a list of elements based on the name of a component.
|
|
6
4
|
*
|
|
@@ -11,30 +9,16 @@
|
|
|
11
9
|
* @returns {Array<HTMLElement>}
|
|
12
10
|
* A list of elements on which the component should be mounted.
|
|
13
11
|
*/
|
|
14
|
-
export function getComponentElements(nameOrSelector: string, element?: HTMLElement | Document):
|
|
12
|
+
export declare function getComponentElements(nameOrSelector: string, element?: HTMLElement | Document): HTMLElement[];
|
|
15
13
|
/**
|
|
16
14
|
* Test if an event is defined in the given config.
|
|
17
|
-
*
|
|
18
|
-
* @param {string} event
|
|
19
|
-
* @param {import('./index.js').BaseConfig} config
|
|
20
|
-
* @returns {boolean}
|
|
21
15
|
*/
|
|
22
|
-
export function eventIsDefinedInConfig(event: string, config:
|
|
16
|
+
export declare function eventIsDefinedInConfig(event: string, config: BaseConfig): boolean;
|
|
23
17
|
/**
|
|
24
18
|
* Test if an event can be used on the given element.
|
|
25
|
-
*
|
|
26
|
-
* @param {string} event
|
|
27
|
-
* @param {HTMLElement} element
|
|
28
|
-
* @returns {boolean}
|
|
29
19
|
*/
|
|
30
|
-
export function eventIsNative(event: string, element: HTMLElement): boolean;
|
|
20
|
+
export declare function eventIsNative(event: string, element: HTMLElement): boolean;
|
|
31
21
|
/**
|
|
32
22
|
* Get the target of a given event.
|
|
33
|
-
*
|
|
34
|
-
* @param {Base} instance
|
|
35
|
-
* @param {string} event
|
|
36
|
-
* @param {import('./index.js').BaseConfig} config
|
|
37
|
-
* @returns {Base|Base['$el']}
|
|
38
23
|
*/
|
|
39
|
-
export function getEventTarget(instance: Base, event: string, config:
|
|
40
|
-
export type Base = import('./index.js').default;
|
|
24
|
+
export declare function getEventTarget(instance: Base, event: string, config: BaseConfig): Base | Base['$el'];
|
package/decorators/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(decorators_exports, {
|
|
|
34
34
|
withMountWhenInView: () => import_withMountWhenInView.default,
|
|
35
35
|
withResponsiveOptions: () => import_withResponsiveOptions.default,
|
|
36
36
|
withScrolledInView: () => import_withScrolledInView.default,
|
|
37
|
+
withType: () => import_withType.default,
|
|
37
38
|
withVue2: () => import_withVue2.default
|
|
38
39
|
});
|
|
39
40
|
module.exports = __toCommonJS(decorators_exports);
|
|
@@ -46,5 +47,6 @@ var import_withIntersectionObserver = __toESM(require("./withIntersectionObserve
|
|
|
46
47
|
var import_withMountWhenInView = __toESM(require("./withMountWhenInView.cjs"), 1);
|
|
47
48
|
var import_withResponsiveOptions = __toESM(require("./withResponsiveOptions.cjs"), 1);
|
|
48
49
|
var import_withScrolledInView = __toESM(require("./withScrolledInView.cjs"), 1);
|
|
50
|
+
var import_withType = __toESM(require("./withType.cjs"), 1);
|
|
49
51
|
var import_withVue2 = __toESM(require("./withVue2.cjs"), 1);
|
|
50
52
|
if (module.exports.default) module.exports = module.exports.default;
|
package/decorators/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export { default as withIntersectionObserver } from './withIntersectionObserver.
|
|
|
7
7
|
export { default as withMountWhenInView } from './withMountWhenInView.js';
|
|
8
8
|
export { default as withResponsiveOptions } from './withResponsiveOptions.js';
|
|
9
9
|
export { default as withScrolledInView } from './withScrolledInView.js';
|
|
10
|
+
export { default as withType } from './withType.js';
|
|
10
11
|
export { default as withVue2 } from './withVue2.js';
|
package/decorators/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import { default as default7 } from "./withIntersectionObserver.js";
|
|
|
7
7
|
import { default as default8 } from "./withMountWhenInView.js";
|
|
8
8
|
import { default as default9 } from "./withResponsiveOptions.js";
|
|
9
9
|
import { default as default10 } from "./withScrolledInView.js";
|
|
10
|
-
import { default as default11 } from "./
|
|
10
|
+
import { default as default11 } from "./withType.js";
|
|
11
|
+
import { default as default12 } from "./withVue2.js";
|
|
11
12
|
export {
|
|
12
13
|
default2 as withBreakpointManager,
|
|
13
14
|
default3 as withBreakpointObserver,
|
|
@@ -18,5 +19,6 @@ export {
|
|
|
18
19
|
default8 as withMountWhenInView,
|
|
19
20
|
default9 as withResponsiveOptions,
|
|
20
21
|
default10 as withScrolledInView,
|
|
21
|
-
default11 as
|
|
22
|
+
default11 as withType,
|
|
23
|
+
default12 as withVue2
|
|
22
24
|
};
|
|
@@ -68,7 +68,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
|
|
|
68
68
|
}
|
|
69
69
|
return BaseClass;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
class WithBreakpointManager extends BaseClass {
|
|
72
72
|
constructor(element) {
|
|
73
73
|
super(element);
|
|
74
74
|
if (!instances.has(this)) {
|
|
@@ -91,6 +91,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
|
|
|
91
91
|
}
|
|
92
92
|
return super.$destroy();
|
|
93
93
|
}
|
|
94
|
-
}
|
|
94
|
+
}
|
|
95
|
+
return WithBreakpointManager;
|
|
95
96
|
}
|
|
96
97
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,59 +1,5 @@
|
|
|
1
|
-
import type Base from '../Base/index.js';
|
|
2
|
-
import type { BaseConstructor, BaseTypeParameter } from '../Base/index.js';
|
|
1
|
+
import type { Base, BaseConstructor, BaseTypeParameter } from '../Base/index.js';
|
|
3
2
|
/**
|
|
4
3
|
* BreakpointManager class.
|
|
5
4
|
*/
|
|
6
|
-
export default function withBreakpointManager<T extends BaseTypeParameter = BaseTypeParameter>(BaseClass:
|
|
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<BaseTypeParameter>;
|
|
22
|
-
$id: string;
|
|
23
|
-
$el: (T & U)["$el"] & HTMLElement & {
|
|
24
|
-
__base__?: WeakMap<typeof Base, Base<BaseTypeParameter> | "terminated">;
|
|
25
|
-
};
|
|
26
|
-
$isMounted: boolean;
|
|
27
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
28
|
-
readonly $root: Base<BaseTypeParameter>;
|
|
29
|
-
readonly __config: import("../Base/index.js").BaseConfig;
|
|
30
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
31
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
32
|
-
__refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
33
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
34
|
-
__options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
35
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
36
|
-
__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;
|
|
37
|
-
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;
|
|
38
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
39
|
-
readonly $log: (...args: any) => void;
|
|
40
|
-
readonly __debug: (...args: any) => void;
|
|
41
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
42
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
43
|
-
__hasEvent(event: string): boolean;
|
|
44
|
-
$update(): any;
|
|
45
|
-
$terminate(): void;
|
|
46
|
-
__addEmits(event: string): void;
|
|
47
|
-
__removeEmits(event: string): void;
|
|
48
|
-
readonly __ctor: typeof Base;
|
|
49
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
50
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
51
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
52
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
53
|
-
dispatchEvent(event: Event): boolean;
|
|
54
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
55
|
-
};
|
|
56
|
-
readonly $isBase: true;
|
|
57
|
-
config: import("../Base/index.js").BaseConfig;
|
|
58
|
-
$factory(nameOrSelector: string): Base<BaseTypeParameter>[];
|
|
59
|
-
};
|
|
5
|
+
export default function withBreakpointManager<S extends BaseConstructor<Base>, T extends BaseTypeParameter = BaseTypeParameter>(BaseClass: S, breakpoints: Array<[string, BaseConstructor<Base>]>): S;
|
|
@@ -38,7 +38,7 @@ function withBreakpointManager(BaseClass, breakpoints) {
|
|
|
38
38
|
}
|
|
39
39
|
return BaseClass;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
class WithBreakpointManager extends BaseClass {
|
|
42
42
|
constructor(element) {
|
|
43
43
|
super(element);
|
|
44
44
|
if (!instances.has(this)) {
|
|
@@ -61,7 +61,8 @@ function withBreakpointManager(BaseClass, breakpoints) {
|
|
|
61
61
|
}
|
|
62
62
|
return super.$destroy();
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
|
+
return WithBreakpointManager;
|
|
65
66
|
}
|
|
66
67
|
export {
|
|
67
68
|
withBreakpointManager as default
|
|
@@ -73,8 +73,8 @@ function addToResize(key, instance) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
function withBreakpointObserver(BaseClass) {
|
|
76
|
-
var _a
|
|
77
|
-
|
|
76
|
+
var _a;
|
|
77
|
+
class WithBreakpointObserver extends BaseClass {
|
|
78
78
|
constructor(element) {
|
|
79
79
|
super(element);
|
|
80
80
|
const { remove, props } = (0, import_resize.default)();
|
|
@@ -114,7 +114,8 @@ function withBreakpointObserver(BaseClass) {
|
|
|
114
114
|
}
|
|
115
115
|
return this;
|
|
116
116
|
}
|
|
117
|
-
}
|
|
117
|
+
}
|
|
118
|
+
__publicField(WithBreakpointObserver, "config", {
|
|
118
119
|
...BaseClass.config,
|
|
119
120
|
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
120
121
|
options: {
|
|
@@ -122,6 +123,7 @@ function withBreakpointObserver(BaseClass) {
|
|
|
122
123
|
activeBreakpoints: String,
|
|
123
124
|
inactiveBreakpoints: String
|
|
124
125
|
}
|
|
125
|
-
})
|
|
126
|
+
});
|
|
127
|
+
return WithBreakpointObserver;
|
|
126
128
|
}
|
|
127
129
|
if (module.exports.default) module.exports = module.exports.default;
|