@studiometa/js-toolkit 2.3.0 → 2.4.2
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 +51 -43
- package/Base/index.d.ts +23 -18
- package/Base/index.js +70 -59
- package/Base/managers/AbstractManager.cjs +23 -13
- package/Base/managers/AbstractManager.d.ts +3 -3
- package/Base/managers/AbstractManager.js +24 -13
- package/Base/managers/ChildrenManager.cjs +21 -5
- package/Base/managers/ChildrenManager.d.ts +1 -1
- package/Base/managers/ChildrenManager.js +18 -4
- package/Base/managers/EventsManager.cjs +62 -44
- package/Base/managers/EventsManager.d.ts +3 -3
- package/Base/managers/EventsManager.js +59 -43
- package/Base/managers/OptionsManager.cjs +32 -12
- package/Base/managers/OptionsManager.d.ts +2 -2
- package/Base/managers/OptionsManager.js +29 -11
- package/Base/managers/RefsManager.cjs +19 -5
- package/Base/managers/RefsManager.js +15 -4
- package/Base/managers/ResponsiveOptionsManager.cjs +4 -1
- package/Base/managers/ServicesManager.cjs +21 -6
- package/Base/managers/ServicesManager.d.ts +1 -1
- package/Base/managers/ServicesManager.js +18 -5
- package/Base/utils.cjs +5 -1
- package/Base/utils.d.ts +2 -2
- package/Base/utils.js +5 -1
- package/README.md +3 -3
- package/decorators/index.cjs +4 -1
- package/decorators/withBreakpointManager.cjs +4 -1
- package/decorators/withBreakpointManager.d.ts +1 -1
- package/decorators/withBreakpointObserver.cjs +26 -14
- package/decorators/withBreakpointObserver.d.ts +1 -1
- package/decorators/withBreakpointObserver.js +23 -13
- package/decorators/withDrag.cjs +19 -8
- package/decorators/withDrag.d.ts +2 -4
- package/decorators/withDrag.js +16 -7
- package/decorators/withExtraConfig.cjs +12 -4
- package/decorators/withExtraConfig.js +9 -3
- package/decorators/withFreezedOptions.cjs +9 -1
- package/decorators/withFreezedOptions.js +10 -1
- package/decorators/withIntersectionObserver.cjs +25 -17
- package/decorators/withIntersectionObserver.d.ts +1 -1
- package/decorators/withIntersectionObserver.js +26 -17
- package/decorators/withMountWhenInView.cjs +30 -22
- package/decorators/withMountWhenInView.d.ts +1 -1
- package/decorators/withMountWhenInView.js +31 -22
- package/decorators/withResponsiveOptions.cjs +4 -1
- package/decorators/withScrolledInView.cjs +99 -48
- package/decorators/withScrolledInView.d.ts +27 -6
- package/decorators/withScrolledInView.js +96 -47
- package/decorators/withVue2.cjs +15 -10
- package/decorators/withVue2.d.ts +1 -1
- package/decorators/withVue2.js +16 -10
- package/helpers/getDirectChildren.cjs +46 -0
- package/helpers/getDirectChildren.d.ts +24 -0
- package/helpers/getDirectChildren.js +24 -0
- package/helpers/getInstanceFromElement.cjs +2 -1
- package/helpers/getInstanceFromElement.js +2 -1
- package/helpers/importOnInteraction.cjs +1 -1
- package/helpers/importOnInteraction.d.ts +2 -2
- package/helpers/importOnInteraction.js +1 -1
- package/helpers/importWhenIdle.cjs +10 -6
- package/helpers/importWhenIdle.js +10 -6
- package/helpers/importWhenVisible.cjs +1 -1
- package/helpers/importWhenVisible.d.ts +2 -2
- package/helpers/importWhenVisible.js +1 -1
- package/helpers/index.cjs +6 -1
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +1 -0
- package/index.cjs +4 -1
- 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 +5 -2
- package/services/key.js +1 -1
- package/services/pointer.cjs +3 -2
- package/services/pointer.js +3 -2
- package/services/resize.cjs +4 -1
- package/services/scroll.cjs +4 -1
- package/utils/collide/index.cjs +4 -1
- package/utils/css/animate.cjs +27 -12
- package/utils/css/animate.js +23 -11
- package/utils/css/index.cjs +4 -1
- package/utils/css/matrix.cjs +2 -1
- package/utils/css/matrix.js +2 -1
- package/utils/css/transform.cjs +2 -1
- package/utils/css/transform.js +2 -1
- package/utils/css/transition.cjs +11 -6
- package/utils/css/transition.js +8 -5
- 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 +6 -2
- package/utils/tween.js +2 -1
|
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
9
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,8 +17,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
}
|
|
17
18
|
return to;
|
|
18
19
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
20
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __publicField = (obj, key, value) => {
|
|
26
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
21
29
|
|
|
22
30
|
// packages/js-toolkit/Base/managers/ServicesManager.js
|
|
23
31
|
var ServicesManager_exports = {};
|
|
@@ -43,7 +51,10 @@ var SERVICES_MAP = {
|
|
|
43
51
|
};
|
|
44
52
|
var SERVICE_NAMES = Object.keys(SERVICES_MAP);
|
|
45
53
|
var ServicesManager = class extends import_AbstractManager.default {
|
|
46
|
-
|
|
54
|
+
constructor() {
|
|
55
|
+
super(...arguments);
|
|
56
|
+
__publicField(this, "__customServices", {});
|
|
57
|
+
}
|
|
47
58
|
get __services() {
|
|
48
59
|
return {
|
|
49
60
|
...this.__customServices,
|
|
@@ -76,12 +87,16 @@ var ServicesManager = class extends import_AbstractManager.default {
|
|
|
76
87
|
return this.disable.bind(this, service);
|
|
77
88
|
}
|
|
78
89
|
enableAll() {
|
|
79
|
-
return Object.keys(this.__services).map(
|
|
90
|
+
return Object.keys(this.__services).map(
|
|
91
|
+
(serviceName) => this.enable(serviceName)
|
|
92
|
+
);
|
|
80
93
|
}
|
|
81
94
|
disableAll() {
|
|
82
|
-
Object.keys(this.__services).forEach(
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
Object.keys(this.__services).forEach(
|
|
96
|
+
(serviceName) => {
|
|
97
|
+
this.disable(serviceName);
|
|
98
|
+
}
|
|
99
|
+
);
|
|
85
100
|
}
|
|
86
101
|
disable(service) {
|
|
87
102
|
if (!this.__services[service]) {
|
|
@@ -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(
|
|
82
|
+
export type Base = import("../index").default<any>;
|
|
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, () => ServiceInterface>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
import usePointer from "../../services/pointer.js";
|
|
2
8
|
import useRaf from "../../services/raf.js";
|
|
3
9
|
import useResize from "../../services/resize.js";
|
|
@@ -16,7 +22,10 @@ const SERVICES_MAP = {
|
|
|
16
22
|
};
|
|
17
23
|
const SERVICE_NAMES = Object.keys(SERVICES_MAP);
|
|
18
24
|
class ServicesManager extends AbstractManager {
|
|
19
|
-
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
__publicField(this, "__customServices", {});
|
|
28
|
+
}
|
|
20
29
|
get __services() {
|
|
21
30
|
return {
|
|
22
31
|
...this.__customServices,
|
|
@@ -49,12 +58,16 @@ class ServicesManager extends AbstractManager {
|
|
|
49
58
|
return this.disable.bind(this, service);
|
|
50
59
|
}
|
|
51
60
|
enableAll() {
|
|
52
|
-
return Object.keys(this.__services).map(
|
|
61
|
+
return Object.keys(this.__services).map(
|
|
62
|
+
(serviceName) => this.enable(serviceName)
|
|
63
|
+
);
|
|
53
64
|
}
|
|
54
65
|
disableAll() {
|
|
55
|
-
Object.keys(this.__services).forEach(
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
Object.keys(this.__services).forEach(
|
|
67
|
+
(serviceName) => {
|
|
68
|
+
this.disable(serviceName);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
58
71
|
}
|
|
59
72
|
disable(service) {
|
|
60
73
|
if (!this.__services[service]) {
|
package/Base/utils.cjs
CHANGED
|
@@ -52,7 +52,11 @@ function getEventTarget(instance, event, config) {
|
|
|
52
52
|
return instance.$el;
|
|
53
53
|
}
|
|
54
54
|
if (import_utils.isDev) {
|
|
55
|
-
console.warn(
|
|
55
|
+
console.warn(
|
|
56
|
+
`[${config.name}]`,
|
|
57
|
+
`The "${event}" event is missing from the configuration and is not a native`,
|
|
58
|
+
`event for the root element of type \`${instance.$el.constructor.name}\`.`
|
|
59
|
+
);
|
|
56
60
|
}
|
|
57
61
|
return instance;
|
|
58
62
|
}
|
package/Base/utils.d.ts
CHANGED
|
@@ -36,5 +36,5 @@ export function eventIsNative(event: string, element: HTMLElement): boolean;
|
|
|
36
36
|
* @param {import('./index.js').BaseConfig} config
|
|
37
37
|
* @returns {Base|Base['$el']}
|
|
38
38
|
*/
|
|
39
|
-
export function getEventTarget(instance:
|
|
40
|
-
export type Base = import(
|
|
39
|
+
export function getEventTarget(instance: import("./index.js").default<any>, event: string, config: import('./index.js').BaseConfig): import("./index.js").default<any> | import("./index.js").default<any>['$el'];
|
|
40
|
+
export type Base = import("./index.js").default<any>;
|
package/Base/utils.js
CHANGED
|
@@ -25,7 +25,11 @@ function getEventTarget(instance, event, config) {
|
|
|
25
25
|
return instance.$el;
|
|
26
26
|
}
|
|
27
27
|
if (isDev) {
|
|
28
|
-
console.warn(
|
|
28
|
+
console.warn(
|
|
29
|
+
`[${config.name}]`,
|
|
30
|
+
`The "${event}" event is missing from the configuration and is not a native`,
|
|
31
|
+
`event for the root element of type \`${instance.$el.constructor.name}\`.`
|
|
32
|
+
);
|
|
29
33
|
}
|
|
30
34
|
return instance;
|
|
31
35
|
}
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://david-dm.org/studiometa/js-toolkit)
|
|
6
6
|

|
|
7
7
|
|
|
8
|
-
> A
|
|
8
|
+
> A JavaScript data-attributes driven micro-framework shipped with plenty of useful utility functions to boost your project.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -15,9 +15,9 @@ Install the latest version via NPM:
|
|
|
15
15
|
npm install @studiometa/js-toolkit
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## What is it?
|
|
19
19
|
|
|
20
|
-
This project
|
|
20
|
+
This project is a JavaScript micro-framework (along with its utility functions) whose main objectives are:
|
|
21
21
|
|
|
22
22
|
- Enforcing best-practice and consistency between projects
|
|
23
23
|
- Using elements from the DOM easily
|
package/decorators/index.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/decorators/index.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/decorators/withBreakpointManager.js
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* @returns {T}
|
|
7
7
|
*/
|
|
8
8
|
export default function withBreakpointManager<T extends typeof import("../Base").default>(BaseClass: T, breakpoints: Array<[string, BaseConstructor]>): T;
|
|
9
|
-
export type Base = import(
|
|
9
|
+
export type Base = import("../Base").default<any>;
|
|
10
10
|
export type BaseConstructor = import('../Base').BaseConstructor;
|
|
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
9
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,8 +17,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
}
|
|
17
18
|
return to;
|
|
18
19
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
20
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __publicField = (obj, key, value) => {
|
|
26
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
21
29
|
|
|
22
30
|
// packages/js-toolkit/decorators/withBreakpointObserver.js
|
|
23
31
|
var withBreakpointObserver_exports = {};
|
|
@@ -43,7 +51,9 @@ function hasBreakpointConfiguration(instance) {
|
|
|
43
51
|
function testConflictingBreakpointConfiguration(instance) {
|
|
44
52
|
const { activeBreakpoints, inactiveBreakpoints, name } = instance.$options;
|
|
45
53
|
if (activeBreakpoints && inactiveBreakpoints) {
|
|
46
|
-
throw new Error(
|
|
54
|
+
throw new Error(
|
|
55
|
+
`[${name}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`
|
|
56
|
+
);
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
function addToResize(key, instance) {
|
|
@@ -63,23 +73,17 @@ function addToResize(key, instance) {
|
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
function withBreakpointObserver(BaseClass) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
...BaseClass.config,
|
|
69
|
-
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
70
|
-
options: {
|
|
71
|
-
...BaseClass.config?.options || {},
|
|
72
|
-
activeBreakpoints: String,
|
|
73
|
-
inactiveBreakpoints: String
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
+
var _a, _b;
|
|
77
|
+
return _b = class extends BaseClass {
|
|
76
78
|
constructor(element) {
|
|
77
79
|
super(element);
|
|
78
80
|
const { remove, props } = (0, import_resize.default)();
|
|
79
81
|
const { name } = this.$options;
|
|
80
82
|
if (!props().breakpoint) {
|
|
81
83
|
if (import_utils.isDev) {
|
|
82
|
-
throw new Error(
|
|
84
|
+
throw new Error(
|
|
85
|
+
`[${name}] The \`BreakpointObserver\` class requires breakpoints to be defined.`
|
|
86
|
+
);
|
|
83
87
|
}
|
|
84
88
|
return;
|
|
85
89
|
}
|
|
@@ -110,6 +114,14 @@ function withBreakpointObserver(BaseClass) {
|
|
|
110
114
|
}
|
|
111
115
|
return this;
|
|
112
116
|
}
|
|
113
|
-
}
|
|
117
|
+
}, __publicField(_b, "config", {
|
|
118
|
+
...BaseClass.config,
|
|
119
|
+
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
120
|
+
options: {
|
|
121
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
122
|
+
activeBreakpoints: String,
|
|
123
|
+
inactiveBreakpoints: String
|
|
124
|
+
}
|
|
125
|
+
}), _b;
|
|
114
126
|
}
|
|
115
127
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @returns {T}
|
|
7
7
|
*/
|
|
8
8
|
export default function withBreakpointObserver<T extends typeof import("../Base").default>(BaseClass: T): T;
|
|
9
|
-
export type Base = import(
|
|
9
|
+
export type Base = import("../Base").default<any>;
|
|
10
10
|
export type BaseConstructor = import('../Base').BaseConstructor;
|
|
11
11
|
export type WithBreakpointObserverOptions = {
|
|
12
12
|
activeBreakpoints?: string;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
import useResize from "../services/resize.js";
|
|
2
8
|
import { isDev } from "../utils/index.js";
|
|
3
9
|
function testBreakpoints(instance, breakpoint = useResize().props().breakpoint) {
|
|
@@ -16,7 +22,9 @@ function hasBreakpointConfiguration(instance) {
|
|
|
16
22
|
function testConflictingBreakpointConfiguration(instance) {
|
|
17
23
|
const { activeBreakpoints, inactiveBreakpoints, name } = instance.$options;
|
|
18
24
|
if (activeBreakpoints && inactiveBreakpoints) {
|
|
19
|
-
throw new Error(
|
|
25
|
+
throw new Error(
|
|
26
|
+
`[${name}] Incorrect configuration: the \`activeBreakpoints\` and \`inactiveBreakpoints\` are not compatible.`
|
|
27
|
+
);
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
function addToResize(key, instance) {
|
|
@@ -36,23 +44,17 @@ function addToResize(key, instance) {
|
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
function withBreakpointObserver(BaseClass) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
...BaseClass.config,
|
|
42
|
-
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
43
|
-
options: {
|
|
44
|
-
...BaseClass.config?.options || {},
|
|
45
|
-
activeBreakpoints: String,
|
|
46
|
-
inactiveBreakpoints: String
|
|
47
|
-
}
|
|
48
|
-
};
|
|
47
|
+
var _a, _b;
|
|
48
|
+
return _b = class extends BaseClass {
|
|
49
49
|
constructor(element) {
|
|
50
50
|
super(element);
|
|
51
51
|
const { remove, props } = useResize();
|
|
52
52
|
const { name } = this.$options;
|
|
53
53
|
if (!props().breakpoint) {
|
|
54
54
|
if (isDev) {
|
|
55
|
-
throw new Error(
|
|
55
|
+
throw new Error(
|
|
56
|
+
`[${name}] The \`BreakpointObserver\` class requires breakpoints to be defined.`
|
|
57
|
+
);
|
|
56
58
|
}
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
@@ -83,7 +85,15 @@ function withBreakpointObserver(BaseClass) {
|
|
|
83
85
|
}
|
|
84
86
|
return this;
|
|
85
87
|
}
|
|
86
|
-
}
|
|
88
|
+
}, __publicField(_b, "config", {
|
|
89
|
+
...BaseClass.config,
|
|
90
|
+
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
91
|
+
options: {
|
|
92
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
93
|
+
activeBreakpoints: String,
|
|
94
|
+
inactiveBreakpoints: String
|
|
95
|
+
}
|
|
96
|
+
}), _b;
|
|
87
97
|
}
|
|
88
98
|
export {
|
|
89
99
|
withBreakpointObserver as default
|
package/decorators/withDrag.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
9
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,8 +17,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
}
|
|
17
18
|
return to;
|
|
18
19
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
20
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __publicField = (obj, key, value) => {
|
|
26
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
21
29
|
|
|
22
30
|
// packages/js-toolkit/decorators/withDrag.js
|
|
23
31
|
var withDrag_exports = {};
|
|
@@ -27,15 +35,15 @@ __export(withDrag_exports, {
|
|
|
27
35
|
module.exports = __toCommonJS(withDrag_exports);
|
|
28
36
|
var import_drag = __toESM(require("../services/drag.cjs"), 1);
|
|
29
37
|
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
name: `${BaseClass.config.name}WithDrag`,
|
|
33
|
-
emits: ["dragged"]
|
|
34
|
-
};
|
|
38
|
+
var _a;
|
|
39
|
+
return _a = class extends BaseClass {
|
|
35
40
|
constructor(el) {
|
|
36
41
|
super(el);
|
|
37
42
|
this.$on("mounted", () => {
|
|
38
|
-
this.$services.register(
|
|
43
|
+
this.$services.register(
|
|
44
|
+
"dragged",
|
|
45
|
+
import_drag.default.bind(void 0, target.call(this, this), options)
|
|
46
|
+
);
|
|
39
47
|
this.$services.enable("dragged");
|
|
40
48
|
});
|
|
41
49
|
this.$on("destroyed", () => {
|
|
@@ -43,6 +51,9 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
43
51
|
this.$services.unregister("dragged");
|
|
44
52
|
});
|
|
45
53
|
}
|
|
46
|
-
}
|
|
54
|
+
}, __publicField(_a, "config", {
|
|
55
|
+
name: `${BaseClass.config.name}WithDrag`,
|
|
56
|
+
emits: ["dragged"]
|
|
57
|
+
}), _a;
|
|
47
58
|
}
|
|
48
59
|
if (module.exports.default) module.exports = module.exports.default;
|
package/decorators/withDrag.d.ts
CHANGED
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
* @returns {T}
|
|
16
16
|
*/
|
|
17
17
|
export default function withDrag<T extends typeof import("../Base").default>(BaseClass: T, { target, ...options }?: DragDecoratorOptions): T;
|
|
18
|
-
export type Base = import(
|
|
18
|
+
export type Base = import("../Base").default<any>;
|
|
19
19
|
export type BaseConstructor = import('../Base').BaseConstructor;
|
|
20
20
|
export type DragServiceOptions = import('../services/drag').DragServiceOptions;
|
|
21
|
-
export type DragDecoratorOptions =
|
|
22
|
-
target?: (this: import("../Base").default, Base: any) => HTMLElement;
|
|
23
|
-
};
|
|
21
|
+
export type DragDecoratorOptions = DragDecoratorOptions;
|
package/decorators/withDrag.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
import useDrag from "../services/drag.js";
|
|
2
8
|
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: `${BaseClass.config.name}WithDrag`,
|
|
6
|
-
emits: ["dragged"]
|
|
7
|
-
};
|
|
9
|
+
var _a;
|
|
10
|
+
return _a = class extends BaseClass {
|
|
8
11
|
constructor(el) {
|
|
9
12
|
super(el);
|
|
10
13
|
this.$on("mounted", () => {
|
|
11
|
-
this.$services.register(
|
|
14
|
+
this.$services.register(
|
|
15
|
+
"dragged",
|
|
16
|
+
useDrag.bind(void 0, target.call(this, this), options)
|
|
17
|
+
);
|
|
12
18
|
this.$services.enable("dragged");
|
|
13
19
|
});
|
|
14
20
|
this.$on("destroyed", () => {
|
|
@@ -16,7 +22,10 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
16
22
|
this.$services.unregister("dragged");
|
|
17
23
|
});
|
|
18
24
|
}
|
|
19
|
-
}
|
|
25
|
+
}, __publicField(_a, "config", {
|
|
26
|
+
name: `${BaseClass.config.name}WithDrag`,
|
|
27
|
+
emits: ["dragged"]
|
|
28
|
+
}), _a;
|
|
20
29
|
}
|
|
21
30
|
export {
|
|
22
31
|
withDrag as default
|
|
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
9
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,8 +17,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
}
|
|
17
18
|
return to;
|
|
18
19
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
20
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __publicField = (obj, key, value) => {
|
|
26
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
21
29
|
|
|
22
30
|
// packages/js-toolkit/decorators/withExtraConfig.js
|
|
23
31
|
var withExtraConfig_exports = {};
|
|
@@ -27,12 +35,12 @@ __export(withExtraConfig_exports, {
|
|
|
27
35
|
module.exports = __toCommonJS(withExtraConfig_exports);
|
|
28
36
|
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
29
37
|
function withExtraConfig(BaseClass, config, options = {}) {
|
|
38
|
+
var _a;
|
|
30
39
|
const newConfig = (0, import_deepmerge.default)(BaseClass.config, config, options);
|
|
31
40
|
if (newConfig.name === BaseClass.config.name) {
|
|
32
41
|
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
33
42
|
}
|
|
34
|
-
return class extends BaseClass {
|
|
35
|
-
|
|
36
|
-
};
|
|
43
|
+
return _a = class extends BaseClass {
|
|
44
|
+
}, __publicField(_a, "config", newConfig), _a;
|
|
37
45
|
}
|
|
38
46
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
import merge from "deepmerge";
|
|
2
8
|
function withExtraConfig(BaseClass, config, options = {}) {
|
|
9
|
+
var _a;
|
|
3
10
|
const newConfig = merge(BaseClass.config, config, options);
|
|
4
11
|
if (newConfig.name === BaseClass.config.name) {
|
|
5
12
|
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
6
13
|
}
|
|
7
|
-
return class extends BaseClass {
|
|
8
|
-
|
|
9
|
-
};
|
|
14
|
+
return _a = class extends BaseClass {
|
|
15
|
+
}, __publicField(_a, "config", newConfig), _a;
|
|
10
16
|
}
|
|
11
17
|
export {
|
|
12
18
|
withExtraConfig as default
|
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,6 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
16
|
return to;
|
|
16
17
|
};
|
|
17
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __publicField = (obj, key, value) => {
|
|
20
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
18
23
|
|
|
19
24
|
// packages/js-toolkit/decorators/withFreezedOptions.js
|
|
20
25
|
var withFreezedOptions_exports = {};
|
|
@@ -24,7 +29,10 @@ __export(withFreezedOptions_exports, {
|
|
|
24
29
|
module.exports = __toCommonJS(withFreezedOptions_exports);
|
|
25
30
|
function withFreezedOptions(BaseClass) {
|
|
26
31
|
return class extends BaseClass {
|
|
27
|
-
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
__publicField(this, "__freezedOptions");
|
|
35
|
+
}
|
|
28
36
|
get $options() {
|
|
29
37
|
Object.defineProperty(this, "__freezedOptions", {
|
|
30
38
|
value: Object.freeze({ ...super.$options }),
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
function withFreezedOptions(BaseClass) {
|
|
2
8
|
return class extends BaseClass {
|
|
3
|
-
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
__publicField(this, "__freezedOptions");
|
|
12
|
+
}
|
|
4
13
|
get $options() {
|
|
5
14
|
Object.defineProperty(this, "__freezedOptions", {
|
|
6
15
|
value: Object.freeze({ ...super.$options }),
|
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,6 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
16
|
return to;
|
|
16
17
|
};
|
|
17
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __publicField = (obj, key, value) => {
|
|
20
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
18
23
|
|
|
19
24
|
// packages/js-toolkit/decorators/withIntersectionObserver.js
|
|
20
25
|
var withIntersectionObserver_exports = {};
|
|
@@ -26,24 +31,19 @@ function createArrayOfNumber(length) {
|
|
|
26
31
|
return [...new Array(length + 1)].map((val, index) => index / length);
|
|
27
32
|
}
|
|
28
33
|
function withIntersectionObserver(BaseClass, defaultOptions = { threshold: createArrayOfNumber(100) }) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...BaseClass.config,
|
|
32
|
-
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
33
|
-
options: {
|
|
34
|
-
...BaseClass.config?.options || {},
|
|
35
|
-
intersectionObserver: Object
|
|
36
|
-
},
|
|
37
|
-
emits: ["intersected"]
|
|
38
|
-
};
|
|
34
|
+
var _a, _b;
|
|
35
|
+
return _b = class extends BaseClass {
|
|
39
36
|
constructor(element) {
|
|
40
37
|
super(element);
|
|
41
|
-
this.$observer = new IntersectionObserver(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
this.$observer = new IntersectionObserver(
|
|
39
|
+
(entries) => {
|
|
40
|
+
this.__callMethod("intersected", entries);
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
...defaultOptions,
|
|
44
|
+
...this.$options.intersectionObserver
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
47
|
this.$on("mounted", () => {
|
|
48
48
|
this.$observer.observe(this.$el);
|
|
49
49
|
});
|
|
@@ -51,6 +51,14 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
51
51
|
this.$observer.unobserve(this.$el);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}, __publicField(_b, "config", {
|
|
55
|
+
...BaseClass.config,
|
|
56
|
+
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
57
|
+
options: {
|
|
58
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
59
|
+
intersectionObserver: Object
|
|
60
|
+
},
|
|
61
|
+
emits: ["intersected"]
|
|
62
|
+
}), _b;
|
|
55
63
|
}
|
|
56
64
|
if (module.exports.default) module.exports = module.exports.default;
|