@studiometa/js-toolkit 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base/index.cjs +41 -40
- package/Base/index.js +64 -57
- package/Base/managers/AbstractManager.cjs +10 -5
- package/Base/managers/AbstractManager.js +11 -5
- package/Base/managers/ChildrenManager.cjs +11 -2
- package/Base/managers/ChildrenManager.js +12 -2
- package/Base/managers/EventsManager.cjs +46 -41
- package/Base/managers/EventsManager.js +47 -41
- package/Base/managers/OptionsManager.cjs +14 -7
- package/Base/managers/OptionsManager.js +15 -7
- package/Base/managers/RefsManager.cjs +2 -1
- package/Base/managers/RefsManager.js +2 -1
- package/Base/managers/ServicesManager.cjs +9 -1
- package/Base/managers/ServicesManager.js +10 -1
- package/README.md +3 -3
- package/decorators/withBreakpointObserver.cjs +16 -11
- package/decorators/withBreakpointObserver.js +17 -11
- package/decorators/withDrag.cjs +11 -6
- package/decorators/withDrag.js +12 -6
- package/decorators/withExtraConfig.cjs +8 -3
- package/decorators/withExtraConfig.js +9 -3
- package/decorators/withFreezedOptions.cjs +9 -1
- package/decorators/withFreezedOptions.js +10 -1
- package/decorators/withIntersectionObserver.cjs +16 -11
- package/decorators/withIntersectionObserver.js +17 -11
- package/decorators/withMountWhenInView.cjs +17 -12
- package/decorators/withMountWhenInView.js +18 -12
- package/decorators/withScrolledInView.cjs +35 -30
- package/decorators/withScrolledInView.js +36 -30
- package/decorators/withVue2.cjs +15 -10
- 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.js +1 -1
- package/helpers/importWhenIdle.cjs +3 -2
- package/helpers/importWhenIdle.js +3 -2
- package/helpers/importWhenVisible.cjs +1 -1
- package/helpers/importWhenVisible.js +1 -1
- package/helpers/index.cjs +2 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +1 -0
- package/package.json +1 -1
- package/services/key.cjs +1 -1
- package/services/key.js +1 -1
- package/services/pointer.cjs +3 -2
- package/services/pointer.js +3 -2
- package/utils/css/animate.cjs +12 -8
- package/utils/css/animate.js +12 -8
- 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 +7 -2
- package/utils/css/transition.js +8 -2
- package/utils/tween.cjs +2 -1
- 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 });
|
|
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
};
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
// packages/js-toolkit/Base/managers/OptionsManager.js
|
|
23
28
|
var OptionsManager_exports = {};
|
|
@@ -48,13 +53,14 @@ function __getPropertyName(name, prefix = "") {
|
|
|
48
53
|
return propertyName;
|
|
49
54
|
}
|
|
50
55
|
function __register(that, name, config) {
|
|
56
|
+
var _a;
|
|
51
57
|
if (!types.has(config.type)) {
|
|
52
58
|
if (import_utils.isDev) {
|
|
53
59
|
throw new Error(`The "${name}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`);
|
|
54
60
|
}
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
|
-
config.default = config.default
|
|
63
|
+
config.default = (_a = config.default) != null ? _a : __defaultValues[config.type.name];
|
|
58
64
|
if ((config.type === Array || config.type === Object) && !(0, import_utils.isFunction)(config.default)) {
|
|
59
65
|
if (import_utils.isDev) {
|
|
60
66
|
throw new Error(`The default value for options of type "${config.type.name}" must be returned by a function.`);
|
|
@@ -72,22 +78,23 @@ function __register(that, name, config) {
|
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
80
|
var OptionsManager = class extends import_AbstractManager.default {
|
|
75
|
-
__values = {};
|
|
76
|
-
name = "Base";
|
|
77
|
-
debug = false;
|
|
78
|
-
log = false;
|
|
79
81
|
constructor(base) {
|
|
82
|
+
var _a, _b;
|
|
80
83
|
super(base);
|
|
84
|
+
__publicField(this, "__values", {});
|
|
85
|
+
__publicField(this, "name", "Base");
|
|
86
|
+
__publicField(this, "debug", false);
|
|
87
|
+
__publicField(this, "log", false);
|
|
81
88
|
this.__hideProperties(["__values", "__defaultValues"]);
|
|
82
89
|
const schema = this.__config.options || {};
|
|
83
90
|
this.name = this.__config.name;
|
|
84
91
|
schema.debug = {
|
|
85
92
|
type: Boolean,
|
|
86
|
-
default: this.__config.debug
|
|
93
|
+
default: (_a = this.__config.debug) != null ? _a : false
|
|
87
94
|
};
|
|
88
95
|
schema.log = {
|
|
89
96
|
type: Boolean,
|
|
90
|
-
default: this.__config.log
|
|
97
|
+
default: (_b = this.__config.log) != null ? _b : false
|
|
91
98
|
};
|
|
92
99
|
Object.entries(schema).forEach(([name, config]) => {
|
|
93
100
|
__register(this, name, types.has(config) ? { type: config } : config);
|
|
@@ -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 deepmerge from "deepmerge";
|
|
2
8
|
import AbstractManager from "./AbstractManager.js";
|
|
3
9
|
import { isDev, isFunction, isDefined, isBoolean, isArray, isObject } from "../../utils/index.js";
|
|
@@ -20,13 +26,14 @@ function __getPropertyName(name, prefix = "") {
|
|
|
20
26
|
return propertyName;
|
|
21
27
|
}
|
|
22
28
|
function __register(that, name, config) {
|
|
29
|
+
var _a;
|
|
23
30
|
if (!types.has(config.type)) {
|
|
24
31
|
if (isDev) {
|
|
25
32
|
throw new Error(`The "${name}" option has an invalid type. The allowed types are: String, Number, Boolean, Array and Object.`);
|
|
26
33
|
}
|
|
27
34
|
return;
|
|
28
35
|
}
|
|
29
|
-
config.default = config.default
|
|
36
|
+
config.default = (_a = config.default) != null ? _a : __defaultValues[config.type.name];
|
|
30
37
|
if ((config.type === Array || config.type === Object) && !isFunction(config.default)) {
|
|
31
38
|
if (isDev) {
|
|
32
39
|
throw new Error(`The default value for options of type "${config.type.name}" must be returned by a function.`);
|
|
@@ -44,22 +51,23 @@ function __register(that, name, config) {
|
|
|
44
51
|
});
|
|
45
52
|
}
|
|
46
53
|
class OptionsManager extends AbstractManager {
|
|
47
|
-
__values = {};
|
|
48
|
-
name = "Base";
|
|
49
|
-
debug = false;
|
|
50
|
-
log = false;
|
|
51
54
|
constructor(base) {
|
|
55
|
+
var _a, _b;
|
|
52
56
|
super(base);
|
|
57
|
+
__publicField(this, "__values", {});
|
|
58
|
+
__publicField(this, "name", "Base");
|
|
59
|
+
__publicField(this, "debug", false);
|
|
60
|
+
__publicField(this, "log", false);
|
|
53
61
|
this.__hideProperties(["__values", "__defaultValues"]);
|
|
54
62
|
const schema = this.__config.options || {};
|
|
55
63
|
this.name = this.__config.name;
|
|
56
64
|
schema.debug = {
|
|
57
65
|
type: Boolean,
|
|
58
|
-
default: this.__config.debug
|
|
66
|
+
default: (_a = this.__config.debug) != null ? _a : false
|
|
59
67
|
};
|
|
60
68
|
schema.log = {
|
|
61
69
|
type: Boolean,
|
|
62
|
-
default: this.__config.log
|
|
70
|
+
default: (_b = this.__config.log) != null ? _b : false
|
|
63
71
|
};
|
|
64
72
|
Object.entries(schema).forEach(([name, config]) => {
|
|
65
73
|
__register(this, name, types.has(config) ? { type: config } : config);
|
|
@@ -65,7 +65,8 @@ function __unregister(that, refName) {
|
|
|
65
65
|
}
|
|
66
66
|
var RefsManager = class extends import_AbstractManager.default {
|
|
67
67
|
get __refs() {
|
|
68
|
-
|
|
68
|
+
var _a;
|
|
69
|
+
return (_a = this.__config.refs) != null ? _a : [];
|
|
69
70
|
}
|
|
70
71
|
registerAll() {
|
|
71
72
|
this.__refs.forEach((refName) => __register(this, refName));
|
|
@@ -37,7 +37,8 @@ function __unregister(that, refName) {
|
|
|
37
37
|
}
|
|
38
38
|
class RefsManager extends AbstractManager {
|
|
39
39
|
get __refs() {
|
|
40
|
-
|
|
40
|
+
var _a;
|
|
41
|
+
return (_a = this.__config.refs) != null ? _a : [];
|
|
41
42
|
}
|
|
42
43
|
registerAll() {
|
|
43
44
|
this.__refs.forEach((refName) => __register(this, refName));
|
|
@@ -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 });
|
|
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
};
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
// packages/js-toolkit/Base/managers/ServicesManager.js
|
|
23
28
|
var ServicesManager_exports = {};
|
|
@@ -43,7 +48,10 @@ var SERVICES_MAP = {
|
|
|
43
48
|
};
|
|
44
49
|
var SERVICE_NAMES = Object.keys(SERVICES_MAP);
|
|
45
50
|
var ServicesManager = class extends import_AbstractManager.default {
|
|
46
|
-
|
|
51
|
+
constructor() {
|
|
52
|
+
super(...arguments);
|
|
53
|
+
__publicField(this, "__customServices", {});
|
|
54
|
+
}
|
|
47
55
|
get __services() {
|
|
48
56
|
return {
|
|
49
57
|
...this.__customServices,
|
|
@@ -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,
|
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
|
|
@@ -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 });
|
|
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
};
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
// packages/js-toolkit/decorators/withBreakpointObserver.js
|
|
23
28
|
var withBreakpointObserver_exports = {};
|
|
@@ -63,16 +68,8 @@ function addToResize(key, instance) {
|
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
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
|
-
};
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return _b = class extends BaseClass {
|
|
76
73
|
constructor(element) {
|
|
77
74
|
super(element);
|
|
78
75
|
const { remove, props } = (0, import_resize.default)();
|
|
@@ -110,6 +107,14 @@ function withBreakpointObserver(BaseClass) {
|
|
|
110
107
|
}
|
|
111
108
|
return this;
|
|
112
109
|
}
|
|
113
|
-
}
|
|
110
|
+
}, __publicField(_b, "config", {
|
|
111
|
+
...BaseClass.config,
|
|
112
|
+
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
113
|
+
options: {
|
|
114
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
115
|
+
activeBreakpoints: String,
|
|
116
|
+
inactiveBreakpoints: String
|
|
117
|
+
}
|
|
118
|
+
}), _b;
|
|
114
119
|
}
|
|
115
120
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -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) {
|
|
@@ -36,16 +42,8 @@ function addToResize(key, instance) {
|
|
|
36
42
|
}
|
|
37
43
|
}
|
|
38
44
|
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
|
-
};
|
|
45
|
+
var _a, _b;
|
|
46
|
+
return _b = class extends BaseClass {
|
|
49
47
|
constructor(element) {
|
|
50
48
|
super(element);
|
|
51
49
|
const { remove, props } = useResize();
|
|
@@ -83,7 +81,15 @@ function withBreakpointObserver(BaseClass) {
|
|
|
83
81
|
}
|
|
84
82
|
return this;
|
|
85
83
|
}
|
|
86
|
-
}
|
|
84
|
+
}, __publicField(_b, "config", {
|
|
85
|
+
...BaseClass.config,
|
|
86
|
+
name: `${BaseClass.config.name}WithBreakpointObserver`,
|
|
87
|
+
options: {
|
|
88
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
89
|
+
activeBreakpoints: String,
|
|
90
|
+
inactiveBreakpoints: String
|
|
91
|
+
}
|
|
92
|
+
}), _b;
|
|
87
93
|
}
|
|
88
94
|
export {
|
|
89
95
|
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 });
|
|
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
};
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
// packages/js-toolkit/decorators/withDrag.js
|
|
23
28
|
var withDrag_exports = {};
|
|
@@ -27,11 +32,8 @@ __export(withDrag_exports, {
|
|
|
27
32
|
module.exports = __toCommonJS(withDrag_exports);
|
|
28
33
|
var import_drag = __toESM(require("../services/drag.cjs"), 1);
|
|
29
34
|
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
name: `${BaseClass.config.name}WithDrag`,
|
|
33
|
-
emits: ["dragged"]
|
|
34
|
-
};
|
|
35
|
+
var _a;
|
|
36
|
+
return _a = class extends BaseClass {
|
|
35
37
|
constructor(el) {
|
|
36
38
|
super(el);
|
|
37
39
|
this.$on("mounted", () => {
|
|
@@ -43,6 +45,9 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
43
45
|
this.$services.unregister("dragged");
|
|
44
46
|
});
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}, __publicField(_a, "config", {
|
|
49
|
+
name: `${BaseClass.config.name}WithDrag`,
|
|
50
|
+
emits: ["dragged"]
|
|
51
|
+
}), _a;
|
|
47
52
|
}
|
|
48
53
|
if (module.exports.default) module.exports = module.exports.default;
|
package/decorators/withDrag.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
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", () => {
|
|
@@ -16,7 +19,10 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
16
19
|
this.$services.unregister("dragged");
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
|
-
}
|
|
22
|
+
}, __publicField(_a, "config", {
|
|
23
|
+
name: `${BaseClass.config.name}WithDrag`,
|
|
24
|
+
emits: ["dragged"]
|
|
25
|
+
}), _a;
|
|
20
26
|
}
|
|
21
27
|
export {
|
|
22
28
|
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 });
|
|
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
};
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
// packages/js-toolkit/decorators/withExtraConfig.js
|
|
23
28
|
var withExtraConfig_exports = {};
|
|
@@ -27,12 +32,12 @@ __export(withExtraConfig_exports, {
|
|
|
27
32
|
module.exports = __toCommonJS(withExtraConfig_exports);
|
|
28
33
|
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
29
34
|
function withExtraConfig(BaseClass, config, options = {}) {
|
|
35
|
+
var _a;
|
|
30
36
|
const newConfig = (0, import_deepmerge.default)(BaseClass.config, config, options);
|
|
31
37
|
if (newConfig.name === BaseClass.config.name) {
|
|
32
38
|
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
33
39
|
}
|
|
34
|
-
return class extends BaseClass {
|
|
35
|
-
|
|
36
|
-
};
|
|
40
|
+
return _a = class extends BaseClass {
|
|
41
|
+
}, __publicField(_a, "config", newConfig), _a;
|
|
37
42
|
}
|
|
38
43
|
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,16 +31,8 @@ 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
38
|
this.$observer = new IntersectionObserver((entries) => {
|
|
@@ -51,6 +48,14 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
51
48
|
this.$observer.unobserve(this.$el);
|
|
52
49
|
});
|
|
53
50
|
}
|
|
54
|
-
}
|
|
51
|
+
}, __publicField(_b, "config", {
|
|
52
|
+
...BaseClass.config,
|
|
53
|
+
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
54
|
+
options: {
|
|
55
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
56
|
+
intersectionObserver: Object
|
|
57
|
+
},
|
|
58
|
+
emits: ["intersected"]
|
|
59
|
+
}), _b;
|
|
55
60
|
}
|
|
56
61
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,17 +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 createArrayOfNumber(length) {
|
|
2
8
|
return [...new Array(length + 1)].map((val, index) => index / length);
|
|
3
9
|
}
|
|
4
10
|
function withIntersectionObserver(BaseClass, defaultOptions = { threshold: createArrayOfNumber(100) }) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
...BaseClass.config,
|
|
8
|
-
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
9
|
-
options: {
|
|
10
|
-
...BaseClass.config?.options || {},
|
|
11
|
-
intersectionObserver: Object
|
|
12
|
-
},
|
|
13
|
-
emits: ["intersected"]
|
|
14
|
-
};
|
|
11
|
+
var _a, _b;
|
|
12
|
+
return _b = class extends BaseClass {
|
|
15
13
|
constructor(element) {
|
|
16
14
|
super(element);
|
|
17
15
|
this.$observer = new IntersectionObserver((entries) => {
|
|
@@ -27,7 +25,15 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
27
25
|
this.$observer.unobserve(this.$el);
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
|
-
}
|
|
28
|
+
}, __publicField(_b, "config", {
|
|
29
|
+
...BaseClass.config,
|
|
30
|
+
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
31
|
+
options: {
|
|
32
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
33
|
+
intersectionObserver: Object
|
|
34
|
+
},
|
|
35
|
+
emits: ["intersected"]
|
|
36
|
+
}), _b;
|
|
31
37
|
}
|
|
32
38
|
export {
|
|
33
39
|
withIntersectionObserver 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/withMountWhenInView.js
|
|
20
25
|
var withMountWhenInView_exports = {};
|
|
@@ -23,19 +28,12 @@ __export(withMountWhenInView_exports, {
|
|
|
23
28
|
});
|
|
24
29
|
module.exports = __toCommonJS(withMountWhenInView_exports);
|
|
25
30
|
function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...BaseClass.config,
|
|
29
|
-
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
30
|
-
options: {
|
|
31
|
-
...BaseClass.config?.options || {},
|
|
32
|
-
intersectionObserver: Object
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
__isVisible = false;
|
|
36
|
-
__observer;
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return _b = class extends BaseClass {
|
|
37
33
|
constructor(element) {
|
|
38
34
|
super(element);
|
|
35
|
+
__publicField(this, "__isVisible", false);
|
|
36
|
+
__publicField(this, "__observer");
|
|
39
37
|
this.__observer = new IntersectionObserver((entries) => {
|
|
40
38
|
const isVisible = entries.reduce((acc, entry) => acc || entry.isIntersecting, false);
|
|
41
39
|
if (this.__isVisible !== isVisible) {
|
|
@@ -58,6 +56,13 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
58
56
|
}
|
|
59
57
|
return this;
|
|
60
58
|
}
|
|
61
|
-
}
|
|
59
|
+
}, __publicField(_b, "config", {
|
|
60
|
+
...BaseClass.config,
|
|
61
|
+
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
62
|
+
options: {
|
|
63
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
64
|
+
intersectionObserver: Object
|
|
65
|
+
}
|
|
66
|
+
}), _b;
|
|
62
67
|
}
|
|
63
68
|
if (module.exports.default) module.exports = module.exports.default;
|