@studiometa/js-toolkit 2.4.4-alpha.3 → 2.4.4-alpha.6
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/types.d.ts +5 -1
- package/Base/utils.cjs +1 -1
- package/Base/utils.d.ts +5 -21
- package/decorators/index.cjs +11 -32
- package/decorators/index.d.ts +10 -10
- package/decorators/index.js +10 -22
- package/decorators/withBreakpointManager.cjs +9 -14
- package/decorators/withBreakpointManager.d.ts +3 -56
- package/decorators/withBreakpointManager.js +7 -6
- package/decorators/withBreakpointObserver.cjs +11 -15
- package/decorators/withBreakpointObserver.d.ts +12 -62
- package/decorators/withBreakpointObserver.js +8 -6
- package/decorators/withDrag.cjs +10 -15
- package/decorators/withDrag.d.ts +8 -51
- package/decorators/withDrag.js +9 -8
- package/decorators/withExtraConfig.cjs +5 -4
- package/decorators/withExtraConfig.d.ts +3 -53
- package/decorators/withExtraConfig.js +5 -4
- package/decorators/withFreezedOptions.cjs +4 -3
- package/decorators/withFreezedOptions.d.ts +6 -53
- package/decorators/withFreezedOptions.js +4 -3
- package/decorators/withIntersectionObserver.cjs +7 -5
- package/decorators/withIntersectionObserver.d.ts +4 -63
- package/decorators/withIntersectionObserver.js +7 -5
- package/decorators/withMountWhenInView.cjs +11 -6
- package/decorators/withMountWhenInView.d.ts +16 -61
- package/decorators/withMountWhenInView.js +11 -6
- package/decorators/withResponsiveOptions.cjs +4 -3
- package/decorators/withResponsiveOptions.d.ts +3 -50
- package/decorators/withResponsiveOptions.js +4 -3
- package/decorators/withScrolledInView.cjs +25 -18
- package/decorators/withScrolledInView.d.ts +30 -141
- package/decorators/withScrolledInView.js +25 -12
- package/decorators/withVue2.cjs +8 -5
- package/decorators/withVue2.d.ts +8 -62
- package/decorators/withVue2.js +8 -5
- 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 +4 -9
- 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 +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import useResize from "../services/
|
|
1
|
+
import { useResize } from "../services/index.js";
|
|
2
2
|
import { isDev, isArray } from "../utils/index.js";
|
|
3
3
|
function testBreakpoints(breakpoints) {
|
|
4
4
|
const { breakpoint } = useResize().props();
|
|
@@ -14,7 +14,7 @@ function mountComponents(instance, breakpoints) {
|
|
|
14
14
|
return breakpoints.map(([bk, ComponentClass]) => {
|
|
15
15
|
const child = new ComponentClass(instance.$el);
|
|
16
16
|
Object.defineProperty(child, "$parent", { get: () => instance.$parent });
|
|
17
|
-
return [bk, child];
|
|
17
|
+
return [bk.split(" "), child];
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
const instances = /* @__PURE__ */ new WeakMap();
|
|
@@ -34,11 +34,11 @@ function withBreakpointManager(BaseClass, breakpoints) {
|
|
|
34
34
|
const { add, props } = useResize();
|
|
35
35
|
if (!props().breakpoint) {
|
|
36
36
|
if (isDev) {
|
|
37
|
-
throw new Error(
|
|
37
|
+
throw new Error("The `BreakpointManager` class requires breakpoints to be defined.");
|
|
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,8 +61,9 @@ function withBreakpointManager(BaseClass, breakpoints) {
|
|
|
61
61
|
}
|
|
62
62
|
return super.$destroy();
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
|
+
return WithBreakpointManager;
|
|
65
66
|
}
|
|
66
67
|
export {
|
|
67
|
-
withBreakpointManager
|
|
68
|
+
withBreakpointManager
|
|
68
69
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
6
|
var __export = (target, all) => {
|
|
@@ -17,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
19
|
var __publicField = (obj, key, value) => {
|
|
26
20
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -30,12 +24,12 @@ var __publicField = (obj, key, value) => {
|
|
|
30
24
|
// packages/js-toolkit/decorators/withBreakpointObserver.ts
|
|
31
25
|
var withBreakpointObserver_exports = {};
|
|
32
26
|
__export(withBreakpointObserver_exports, {
|
|
33
|
-
|
|
27
|
+
withBreakpointObserver: () => withBreakpointObserver
|
|
34
28
|
});
|
|
35
29
|
module.exports = __toCommonJS(withBreakpointObserver_exports);
|
|
36
|
-
var
|
|
30
|
+
var import_services = require("../services/index.cjs");
|
|
37
31
|
var import_utils = require("../utils/index.cjs");
|
|
38
|
-
function testBreakpoints(instance, breakpoint = (0,
|
|
32
|
+
function testBreakpoints(instance, breakpoint = (0, import_services.useResize)().props().breakpoint) {
|
|
39
33
|
const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
|
|
40
34
|
const isInActiveBreakpoint = activeBreakpoints && activeBreakpoints.split(" ").includes(breakpoint);
|
|
41
35
|
const isInInactiveBreakpoint = inactiveBreakpoints && inactiveBreakpoints.split(" ").includes(breakpoint);
|
|
@@ -60,7 +54,7 @@ function addToResize(key, instance) {
|
|
|
60
54
|
if (import_utils.isDev) {
|
|
61
55
|
testConflictingBreakpointConfiguration(instance);
|
|
62
56
|
}
|
|
63
|
-
const { add, has } = (0,
|
|
57
|
+
const { add, has } = (0, import_services.useResize)();
|
|
64
58
|
if (!has(key)) {
|
|
65
59
|
add(key, ({ breakpoint }) => {
|
|
66
60
|
const action = testBreakpoints(instance, breakpoint);
|
|
@@ -73,11 +67,11 @@ function addToResize(key, instance) {
|
|
|
73
67
|
}
|
|
74
68
|
}
|
|
75
69
|
function withBreakpointObserver(BaseClass) {
|
|
76
|
-
var _a
|
|
77
|
-
|
|
70
|
+
var _a;
|
|
71
|
+
class WithBreakpointObserver extends BaseClass {
|
|
78
72
|
constructor(element) {
|
|
79
73
|
super(element);
|
|
80
|
-
const { remove, props } = (0,
|
|
74
|
+
const { remove, props } = (0, import_services.useResize)();
|
|
81
75
|
const { name } = this.$options;
|
|
82
76
|
if (!props().breakpoint) {
|
|
83
77
|
if (import_utils.isDev) {
|
|
@@ -114,7 +108,8 @@ function withBreakpointObserver(BaseClass) {
|
|
|
114
108
|
}
|
|
115
109
|
return this;
|
|
116
110
|
}
|
|
117
|
-
}
|
|
111
|
+
}
|
|
112
|
+
__publicField(WithBreakpointObserver, "config", {
|
|
118
113
|
...BaseClass.config,
|
|
119
114
|
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
120
115
|
options: {
|
|
@@ -122,6 +117,7 @@ function withBreakpointObserver(BaseClass) {
|
|
|
122
117
|
activeBreakpoints: String,
|
|
123
118
|
inactiveBreakpoints: String
|
|
124
119
|
}
|
|
125
|
-
})
|
|
120
|
+
});
|
|
121
|
+
return WithBreakpointObserver;
|
|
126
122
|
}
|
|
127
123
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,65 +1,15 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
1
|
+
import type { BaseDecorator, BaseInterface } from '../Base/types.js';
|
|
2
|
+
import type { Base, BaseTypeParameter } from '../Base/index.js';
|
|
3
|
+
export interface WithBreakpointObserverTypeParameter extends BaseTypeParameter {
|
|
4
|
+
$options: {
|
|
5
|
+
activeBreakpoints?: string;
|
|
6
|
+
inactiveBreakpoints?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface WithBreakpointObserverInterface extends BaseInterface {
|
|
10
|
+
$mount(): this;
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* BreakpointObserver class.
|
|
5
14
|
*/
|
|
6
|
-
export
|
|
7
|
-
new <U extends BaseTypeParameter = BaseTypeParameter>(element: any): {
|
|
8
|
-
/**
|
|
9
|
-
* Override the default $mount method to prevent component's from being
|
|
10
|
-
* mounted when they should not.
|
|
11
|
-
*
|
|
12
|
-
* @returns {this}
|
|
13
|
-
*/
|
|
14
|
-
$mount(): any;
|
|
15
|
-
$parent: Base<BaseTypeParameter>;
|
|
16
|
-
$id: string;
|
|
17
|
-
$el: (T & U)["$el"] & HTMLElement & {
|
|
18
|
-
__base__?: WeakMap<typeof Base, Base<BaseTypeParameter> | "terminated">;
|
|
19
|
-
};
|
|
20
|
-
$isMounted: boolean;
|
|
21
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
22
|
-
readonly $root: Base<BaseTypeParameter>;
|
|
23
|
-
readonly __config: import("../Base/index.js").BaseConfig;
|
|
24
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
25
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
26
|
-
__refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
27
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
28
|
-
__options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
29
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
30
|
-
__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;
|
|
31
|
-
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;
|
|
32
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
33
|
-
readonly $log: (...args: any) => void;
|
|
34
|
-
readonly __debug: (...args: any) => void;
|
|
35
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
36
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
37
|
-
__hasEvent(event: string): boolean;
|
|
38
|
-
$update(): any;
|
|
39
|
-
$destroy(): any;
|
|
40
|
-
$terminate(): void;
|
|
41
|
-
__addEmits(event: string): void;
|
|
42
|
-
__removeEmits(event: string): void;
|
|
43
|
-
readonly __ctor: typeof Base;
|
|
44
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
45
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
46
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
47
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
48
|
-
dispatchEvent(event: Event): boolean;
|
|
49
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
50
|
-
};
|
|
51
|
-
config: {
|
|
52
|
-
name: string;
|
|
53
|
-
options: {
|
|
54
|
-
activeBreakpoints: StringConstructor;
|
|
55
|
-
inactiveBreakpoints: StringConstructor;
|
|
56
|
-
};
|
|
57
|
-
debug?: boolean;
|
|
58
|
-
log?: boolean;
|
|
59
|
-
refs?: string[];
|
|
60
|
-
emits?: string[];
|
|
61
|
-
components?: import("../Base/index.js").BaseConfigComponents;
|
|
62
|
-
};
|
|
63
|
-
readonly $isBase: true;
|
|
64
|
-
$factory(nameOrSelector: string): Base<BaseTypeParameter>[];
|
|
65
|
-
};
|
|
15
|
+
export declare function withBreakpointObserver<S extends Base>(BaseClass: typeof Base): BaseDecorator<WithBreakpointObserverInterface, S>;
|
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import useResize from "../services/
|
|
7
|
+
import { useResize } from "../services/index.js";
|
|
8
8
|
import { isDev } from "../utils/index.js";
|
|
9
9
|
function testBreakpoints(instance, breakpoint = useResize().props().breakpoint) {
|
|
10
10
|
const { activeBreakpoints, inactiveBreakpoints } = instance.$options;
|
|
@@ -44,8 +44,8 @@ function addToResize(key, instance) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
function withBreakpointObserver(BaseClass) {
|
|
47
|
-
var _a
|
|
48
|
-
|
|
47
|
+
var _a;
|
|
48
|
+
class WithBreakpointObserver extends BaseClass {
|
|
49
49
|
constructor(element) {
|
|
50
50
|
super(element);
|
|
51
51
|
const { remove, props } = useResize();
|
|
@@ -85,7 +85,8 @@ function withBreakpointObserver(BaseClass) {
|
|
|
85
85
|
}
|
|
86
86
|
return this;
|
|
87
87
|
}
|
|
88
|
-
}
|
|
88
|
+
}
|
|
89
|
+
__publicField(WithBreakpointObserver, "config", {
|
|
89
90
|
...BaseClass.config,
|
|
90
91
|
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
91
92
|
options: {
|
|
@@ -93,8 +94,9 @@ function withBreakpointObserver(BaseClass) {
|
|
|
93
94
|
activeBreakpoints: String,
|
|
94
95
|
inactiveBreakpoints: String
|
|
95
96
|
}
|
|
96
|
-
})
|
|
97
|
+
});
|
|
98
|
+
return WithBreakpointObserver;
|
|
97
99
|
}
|
|
98
100
|
export {
|
|
99
|
-
withBreakpointObserver
|
|
101
|
+
withBreakpointObserver
|
|
100
102
|
};
|
package/decorators/withDrag.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
6
|
var __export = (target, all) => {
|
|
@@ -17,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
19
|
var __publicField = (obj, key, value) => {
|
|
26
20
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -30,19 +24,18 @@ var __publicField = (obj, key, value) => {
|
|
|
30
24
|
// packages/js-toolkit/decorators/withDrag.ts
|
|
31
25
|
var withDrag_exports = {};
|
|
32
26
|
__export(withDrag_exports, {
|
|
33
|
-
|
|
27
|
+
withDrag: () => withDrag
|
|
34
28
|
});
|
|
35
29
|
module.exports = __toCommonJS(withDrag_exports);
|
|
36
|
-
var
|
|
30
|
+
var import_services = require("../services/index.cjs");
|
|
37
31
|
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
super(el);
|
|
32
|
+
class WithDrag extends BaseClass {
|
|
33
|
+
constructor(element) {
|
|
34
|
+
super(element);
|
|
42
35
|
this.$on("mounted", () => {
|
|
43
36
|
this.$services.register(
|
|
44
37
|
"dragged",
|
|
45
|
-
|
|
38
|
+
import_services.useDrag.bind(void 0, target.call(this, this), options)
|
|
46
39
|
);
|
|
47
40
|
this.$services.enable("dragged");
|
|
48
41
|
});
|
|
@@ -51,9 +44,11 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
51
44
|
this.$services.unregister("dragged");
|
|
52
45
|
});
|
|
53
46
|
}
|
|
54
|
-
}
|
|
47
|
+
}
|
|
48
|
+
__publicField(WithDrag, "config", {
|
|
55
49
|
name: `${BaseClass.config.name}WithDrag`,
|
|
56
50
|
emits: ["dragged"]
|
|
57
|
-
})
|
|
51
|
+
});
|
|
52
|
+
return WithDrag;
|
|
58
53
|
}
|
|
59
54
|
if (module.exports.default) module.exports = module.exports.default;
|
package/decorators/withDrag.d.ts
CHANGED
|
@@ -1,56 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
import type { DragServiceOptions } from '../services/drag.js';
|
|
4
|
-
declare type DragDecoratorOptions = DragServiceOptions & {
|
|
1
|
+
import type { BaseDecorator, BaseInterface } from '../Base/types.js';
|
|
2
|
+
import type { Base } from '../Base/index.js';
|
|
3
|
+
import type { DragServiceOptions, DragServiceProps } from '../services/drag.js';
|
|
4
|
+
export declare type DragDecoratorOptions = DragServiceOptions & {
|
|
5
5
|
target?: (this: Base, instance: Base) => HTMLElement;
|
|
6
6
|
};
|
|
7
|
+
export interface WithDragInterfacd extends BaseInterface {
|
|
8
|
+
dragged?(props: DragServiceProps): void;
|
|
9
|
+
}
|
|
7
10
|
/**
|
|
8
11
|
* Add dragging capabilities to a component.
|
|
9
12
|
*/
|
|
10
|
-
export
|
|
11
|
-
new <U extends BaseTypeParameter = BaseTypeParameter>(el: any): {
|
|
12
|
-
$parent: Base<BaseTypeParameter>;
|
|
13
|
-
$id: string;
|
|
14
|
-
$el: (T & U)["$el"] & HTMLElement & {
|
|
15
|
-
__base__?: WeakMap<typeof Base, Base<BaseTypeParameter> | "terminated">;
|
|
16
|
-
};
|
|
17
|
-
$isMounted: boolean;
|
|
18
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
19
|
-
readonly $root: Base<BaseTypeParameter>;
|
|
20
|
-
readonly __config: import("../Base/index.js").BaseConfig;
|
|
21
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
22
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
23
|
-
__refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
24
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
25
|
-
__options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
26
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
27
|
-
__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;
|
|
28
|
-
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;
|
|
29
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
30
|
-
readonly $log: (...args: any) => void;
|
|
31
|
-
readonly __debug: (...args: any) => void;
|
|
32
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
33
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
34
|
-
__hasEvent(event: string): boolean;
|
|
35
|
-
$mount(): any;
|
|
36
|
-
$update(): any;
|
|
37
|
-
$destroy(): any;
|
|
38
|
-
$terminate(): void;
|
|
39
|
-
__addEmits(event: string): void;
|
|
40
|
-
__removeEmits(event: string): void;
|
|
41
|
-
readonly __ctor: typeof Base;
|
|
42
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
43
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
44
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
45
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
46
|
-
dispatchEvent(event: Event): boolean;
|
|
47
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
48
|
-
};
|
|
49
|
-
config: {
|
|
50
|
-
name: string;
|
|
51
|
-
emits: string[];
|
|
52
|
-
};
|
|
53
|
-
readonly $isBase: true;
|
|
54
|
-
$factory(nameOrSelector: string): Base<BaseTypeParameter>[];
|
|
55
|
-
};
|
|
56
|
-
export {};
|
|
13
|
+
export declare function withDrag<S extends Base>(BaseClass: typeof Base, { target, ...options }?: DragDecoratorOptions): BaseDecorator<BaseInterface, S>;
|
package/decorators/withDrag.js
CHANGED
|
@@ -4,12 +4,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import useDrag from "../services/
|
|
7
|
+
import { useDrag } from "../services/index.js";
|
|
8
8
|
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
super(el);
|
|
9
|
+
class WithDrag extends BaseClass {
|
|
10
|
+
constructor(element) {
|
|
11
|
+
super(element);
|
|
13
12
|
this.$on("mounted", () => {
|
|
14
13
|
this.$services.register(
|
|
15
14
|
"dragged",
|
|
@@ -22,11 +21,13 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
22
21
|
this.$services.unregister("dragged");
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
|
-
}
|
|
24
|
+
}
|
|
25
|
+
__publicField(WithDrag, "config", {
|
|
26
26
|
name: `${BaseClass.config.name}WithDrag`,
|
|
27
27
|
emits: ["dragged"]
|
|
28
|
-
})
|
|
28
|
+
});
|
|
29
|
+
return WithDrag;
|
|
29
30
|
}
|
|
30
31
|
export {
|
|
31
|
-
withDrag
|
|
32
|
+
withDrag
|
|
32
33
|
};
|
|
@@ -30,17 +30,18 @@ var __publicField = (obj, key, value) => {
|
|
|
30
30
|
// packages/js-toolkit/decorators/withExtraConfig.ts
|
|
31
31
|
var withExtraConfig_exports = {};
|
|
32
32
|
__export(withExtraConfig_exports, {
|
|
33
|
-
|
|
33
|
+
withExtraConfig: () => withExtraConfig
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(withExtraConfig_exports);
|
|
36
36
|
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
37
37
|
function withExtraConfig(BaseClass, config, options = {}) {
|
|
38
|
-
var _a;
|
|
39
38
|
const newConfig = (0, import_deepmerge.default)(BaseClass.config, config, options);
|
|
40
39
|
if (newConfig.name === BaseClass.config.name) {
|
|
41
40
|
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
}
|
|
42
|
+
class WithExtraConfig extends BaseClass {
|
|
43
|
+
}
|
|
44
|
+
__publicField(WithExtraConfig, "config", newConfig);
|
|
45
|
+
return WithExtraConfig;
|
|
45
46
|
}
|
|
46
47
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,57 +1,7 @@
|
|
|
1
1
|
import type { Options as DeepmergeOptions } from 'deepmerge';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BaseDecorator, BaseInterface } from '../Base/types.js';
|
|
3
|
+
import type { Base, BaseConfig } from '../Base/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* Extends the configuration of an existing class.
|
|
5
|
-
*
|
|
6
|
-
* @template {BaseConstructor} T
|
|
7
|
-
* @param {T} BaseClass The Base class to extend.
|
|
8
|
-
* @param {Partial<BaseConfig>} config Extra configuration to merge.
|
|
9
|
-
* @param {DeepmergeOptions} options Options for the `deepmerge` function. {@link https://github.com/TehShrike/deepmerge#options}
|
|
10
6
|
*/
|
|
11
|
-
export
|
|
12
|
-
new <U extends BaseTypeParameter = BaseTypeParameter>(element: HTMLElement): {
|
|
13
|
-
$parent: import("../Base/index.js").default<BaseTypeParameter>;
|
|
14
|
-
$id: string;
|
|
15
|
-
$el: (T & U)["$el"] & HTMLElement & {
|
|
16
|
-
__base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<BaseTypeParameter> | "terminated">;
|
|
17
|
-
};
|
|
18
|
-
$isMounted: boolean;
|
|
19
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
20
|
-
readonly $root: import("../Base/index.js").default<BaseTypeParameter>;
|
|
21
|
-
readonly __config: BaseConfig;
|
|
22
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
23
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
24
|
-
__refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
25
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
26
|
-
__options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
27
|
-
readonly $options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
28
|
-
__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;
|
|
29
|
-
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;
|
|
30
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
31
|
-
readonly $log: (...args: any) => void;
|
|
32
|
-
readonly __debug: (...args: any) => void;
|
|
33
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
34
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
35
|
-
__hasEvent(event: string): boolean;
|
|
36
|
-
$mount(): any;
|
|
37
|
-
$update(): any;
|
|
38
|
-
$destroy(): any;
|
|
39
|
-
$terminate(): void;
|
|
40
|
-
__addEmits(event: string): void;
|
|
41
|
-
__removeEmits(event: string): void;
|
|
42
|
-
readonly __ctor: typeof import("../Base/index.js").default;
|
|
43
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
44
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
45
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
46
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
47
|
-
dispatchEvent(event: Event): boolean;
|
|
48
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Class config.
|
|
52
|
-
* @type {BaseConfig}
|
|
53
|
-
*/
|
|
54
|
-
config: BaseConfig;
|
|
55
|
-
readonly $isBase: true;
|
|
56
|
-
$factory(nameOrSelector: string): import("../Base/index.js").default<BaseTypeParameter>[];
|
|
57
|
-
};
|
|
7
|
+
export declare function withExtraConfig<S extends Base>(BaseClass: typeof Base, config: Partial<BaseConfig>, options?: DeepmergeOptions): BaseDecorator<BaseInterface, S>;
|
|
@@ -6,14 +6,15 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import merge from "deepmerge";
|
|
8
8
|
function withExtraConfig(BaseClass, config, options = {}) {
|
|
9
|
-
var _a;
|
|
10
9
|
const newConfig = merge(BaseClass.config, config, options);
|
|
11
10
|
if (newConfig.name === BaseClass.config.name) {
|
|
12
11
|
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
}
|
|
13
|
+
class WithExtraConfig extends BaseClass {
|
|
14
|
+
}
|
|
15
|
+
__publicField(WithExtraConfig, "config", newConfig);
|
|
16
|
+
return WithExtraConfig;
|
|
16
17
|
}
|
|
17
18
|
export {
|
|
18
|
-
withExtraConfig
|
|
19
|
+
withExtraConfig
|
|
19
20
|
};
|
|
@@ -24,11 +24,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24
24
|
// packages/js-toolkit/decorators/withFreezedOptions.ts
|
|
25
25
|
var withFreezedOptions_exports = {};
|
|
26
26
|
__export(withFreezedOptions_exports, {
|
|
27
|
-
|
|
27
|
+
withFreezedOptions: () => withFreezedOptions
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(withFreezedOptions_exports);
|
|
30
30
|
function withFreezedOptions(BaseClass) {
|
|
31
|
-
|
|
31
|
+
class WithFreezedOptions extends BaseClass {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
34
|
__publicField(this, "__freezedOptions");
|
|
@@ -43,6 +43,7 @@ function withFreezedOptions(BaseClass) {
|
|
|
43
43
|
}
|
|
44
44
|
return this.__freezedOptions;
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
|
+
return WithFreezedOptions;
|
|
47
48
|
}
|
|
48
49
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,56 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BaseDecorator, BaseInterface } from '../Base/types.js';
|
|
2
|
+
import type { Base } from '../Base/index.js';
|
|
3
|
+
export interface WithFreezedOptionsInterface extends BaseInterface {
|
|
4
|
+
readonly $options: this['$options'];
|
|
5
|
+
}
|
|
2
6
|
/**
|
|
3
7
|
* Freeze the `$options` property to improve performance.
|
|
4
8
|
*/
|
|
5
|
-
export
|
|
6
|
-
new <U extends BaseTypeParameter = BaseTypeParameter>(element: HTMLElement): {
|
|
7
|
-
/**
|
|
8
|
-
* Hold freezed options
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
__freezedOptions: any;
|
|
12
|
-
/**
|
|
13
|
-
* Lazyly freeze the `$options` property.
|
|
14
|
-
* @returns {Readonly<this['$options']>}
|
|
15
|
-
*/
|
|
16
|
-
readonly $options: any;
|
|
17
|
-
$parent: import("../Base/index.js").default<BaseTypeParameter>;
|
|
18
|
-
$id: string;
|
|
19
|
-
$el: (T & U)["$el"] & HTMLElement & {
|
|
20
|
-
__base__?: WeakMap<typeof import("../Base/index.js").default, import("../Base/index.js").default<BaseTypeParameter> | "terminated">;
|
|
21
|
-
};
|
|
22
|
-
$isMounted: boolean;
|
|
23
|
-
__eventHandlers: Map<string, Set<EventListenerOrEventListenerObject>>;
|
|
24
|
-
readonly $root: import("../Base/index.js").default<BaseTypeParameter>;
|
|
25
|
-
readonly __config: import("../Base/index.js").BaseConfig;
|
|
26
|
-
__services: import("../Base/managers/ServicesManager.js").default;
|
|
27
|
-
readonly $services: import("../Base/managers/ServicesManager.js").default;
|
|
28
|
-
__refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
29
|
-
readonly $refs: import("../Base/managers/RefsManager.js").default & (T & U)["$refs"] & import("../Base/index.js").BaseRefs;
|
|
30
|
-
__options: import("../Base/managers/OptionsManager.js").default & (T & U)["$options"] & import("../Base/index.js").BaseOptions;
|
|
31
|
-
__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;
|
|
32
|
-
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;
|
|
33
|
-
__events: import("../Base/managers/EventsManager.js").default;
|
|
34
|
-
readonly $log: (...args: any) => void;
|
|
35
|
-
readonly __debug: (...args: any) => void;
|
|
36
|
-
readonly __managers: import("../Base/index.js").Managers;
|
|
37
|
-
__callMethod(method: string, ...args: unknown[]): unknown;
|
|
38
|
-
__hasEvent(event: string): boolean;
|
|
39
|
-
$mount(): any;
|
|
40
|
-
$update(): any;
|
|
41
|
-
$destroy(): any;
|
|
42
|
-
$terminate(): void;
|
|
43
|
-
__addEmits(event: string): void;
|
|
44
|
-
__removeEmits(event: string): void;
|
|
45
|
-
readonly __ctor: typeof import("../Base/index.js").default;
|
|
46
|
-
$on(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
47
|
-
$off(event: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
48
|
-
$emit(event: string, ...args: unknown[]): void;
|
|
49
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
50
|
-
dispatchEvent(event: Event): boolean;
|
|
51
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
52
|
-
};
|
|
53
|
-
readonly $isBase: true;
|
|
54
|
-
config: import("../Base/index.js").BaseConfig;
|
|
55
|
-
$factory(nameOrSelector: string): import("../Base/index.js").default<BaseTypeParameter>[];
|
|
56
|
-
};
|
|
9
|
+
export declare function withFreezedOptions<S extends Base>(BaseClass: typeof Base): BaseDecorator<WithFreezedOptionsInterface, S>;
|
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
function withFreezedOptions(BaseClass) {
|
|
8
|
-
|
|
8
|
+
class WithFreezedOptions extends BaseClass {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
__publicField(this, "__freezedOptions");
|
|
@@ -20,8 +20,9 @@ function withFreezedOptions(BaseClass) {
|
|
|
20
20
|
}
|
|
21
21
|
return this.__freezedOptions;
|
|
22
22
|
}
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
|
+
return WithFreezedOptions;
|
|
24
25
|
}
|
|
25
26
|
export {
|
|
26
|
-
withFreezedOptions
|
|
27
|
+
withFreezedOptions
|
|
27
28
|
};
|
|
@@ -24,15 +24,15 @@ var __publicField = (obj, key, value) => {
|
|
|
24
24
|
// packages/js-toolkit/decorators/withIntersectionObserver.ts
|
|
25
25
|
var withIntersectionObserver_exports = {};
|
|
26
26
|
__export(withIntersectionObserver_exports, {
|
|
27
|
-
|
|
27
|
+
withIntersectionObserver: () => withIntersectionObserver
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(withIntersectionObserver_exports);
|
|
30
30
|
function createArrayOfNumber(length) {
|
|
31
31
|
return [...new Array(length + 1)].map((val, index) => index / length);
|
|
32
32
|
}
|
|
33
33
|
function withIntersectionObserver(BaseClass, defaultOptions = { threshold: createArrayOfNumber(100) }) {
|
|
34
|
-
var _a
|
|
35
|
-
|
|
34
|
+
var _a;
|
|
35
|
+
class WithIntersectionObserver extends BaseClass {
|
|
36
36
|
constructor(element) {
|
|
37
37
|
super(element);
|
|
38
38
|
__publicField(this, "$observer");
|
|
@@ -52,7 +52,8 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
52
52
|
this.$observer.unobserve(this.$el);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
|
+
__publicField(WithIntersectionObserver, "config", {
|
|
56
57
|
...BaseClass.config,
|
|
57
58
|
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
58
59
|
options: {
|
|
@@ -60,6 +61,7 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
60
61
|
intersectionObserver: Object
|
|
61
62
|
},
|
|
62
63
|
emits: ["intersected"]
|
|
63
|
-
})
|
|
64
|
+
});
|
|
65
|
+
return WithIntersectionObserver;
|
|
64
66
|
}
|
|
65
67
|
if (module.exports.default) module.exports = module.exports.default;
|