@studiometa/js-toolkit 2.0.0-beta.13 → 2.0.0-beta.17
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 +39 -38
- package/Base/index.js +60 -54
- package/Base/managers/ChildrenManager.cjs +15 -8
- package/Base/managers/ChildrenManager.js +15 -8
- package/Base/managers/EventsManager.cjs +50 -44
- package/Base/managers/EventsManager.js +50 -44
- package/Base/managers/OptionsManager.cjs +16 -14
- package/Base/managers/OptionsManager.js +35 -27
- package/Base/managers/RefsManager.cjs +10 -4
- package/Base/managers/RefsManager.js +10 -4
- package/Base/managers/ServicesManager.cjs +14 -8
- package/Base/managers/ServicesManager.js +14 -8
- package/Base/utils.cjs +1 -0
- package/decorators/index.cjs +1 -0
- package/decorators/withBreakpointManager.cjs +1 -0
- package/decorators/withBreakpointObserver.cjs +17 -11
- package/decorators/withBreakpointObserver.js +17 -11
- package/decorators/withDrag.cjs +12 -6
- package/decorators/withDrag.js +12 -6
- package/decorators/withExtraConfig.cjs +9 -3
- package/decorators/withExtraConfig.js +9 -3
- package/decorators/withIntersectionObserver.cjs +21 -15
- package/decorators/withIntersectionObserver.js +21 -15
- package/decorators/withMountWhenInView.cjs +24 -18
- package/decorators/withMountWhenInView.js +24 -18
- package/decorators/withScrolledInView.cjs +39 -30
- package/decorators/withScrolledInView.js +39 -30
- package/decorators/withVue2.cjs +14 -9
- package/decorators/withVue2.js +14 -9
- package/helpers/createApp.cjs +1 -0
- package/helpers/importOnInteraction.cjs +2 -1
- package/helpers/importOnInteraction.js +1 -1
- package/helpers/importWhenIdle.cjs +4 -2
- package/helpers/importWhenIdle.js +3 -2
- package/helpers/importWhenVisible.cjs +2 -1
- package/helpers/importWhenVisible.js +1 -1
- package/helpers/index.cjs +1 -0
- package/helpers/utils.cjs +1 -0
- package/index.cjs +1 -0
- package/package.json +1 -2
- package/services/Service.cjs +7 -1
- package/services/Service.js +7 -1
- package/services/drag.cjs +59 -33
- package/services/drag.d.ts +1 -0
- package/services/drag.js +59 -33
- package/services/index.cjs +1 -0
- package/services/key.cjs +27 -17
- package/services/key.js +27 -17
- package/services/load.cjs +12 -3
- package/services/load.js +12 -3
- package/services/pointer.cjs +38 -28
- package/services/pointer.js +38 -28
- package/services/raf.cjs +16 -7
- package/services/raf.js +16 -7
- package/services/resize.cjs +16 -7
- package/services/resize.js +16 -7
- package/services/scroll.cjs +36 -27
- package/services/scroll.js +36 -27
- package/utils/collide/boundingRectToCircle.cjs +1 -0
- package/utils/collide/collideCircleCircle.cjs +1 -0
- package/utils/collide/collideCircleRect.cjs +1 -0
- package/utils/collide/collidePointCircle.cjs +1 -0
- package/utils/collide/collidePointRect.cjs +1 -0
- package/utils/collide/collideRectRect.cjs +1 -0
- package/utils/collide/index.cjs +1 -0
- package/utils/css/classes.cjs +1 -0
- package/utils/css/index.cjs +1 -0
- package/utils/css/matrix.cjs +3 -1
- package/utils/css/matrix.js +2 -1
- package/utils/css/styles.cjs +1 -0
- package/utils/css/transition.cjs +8 -2
- package/utils/css/transition.js +8 -2
- package/utils/debounce.cjs +1 -0
- package/utils/focusTrap.cjs +1 -0
- package/utils/history.cjs +1 -0
- package/utils/index.cjs +1 -0
- package/utils/keyCodes.cjs +1 -0
- package/utils/math/clamp.cjs +1 -0
- package/utils/math/clamp01.cjs +1 -0
- package/utils/math/damp.cjs +1 -0
- package/utils/math/ease.cjs +1 -0
- package/utils/math/index.cjs +1 -0
- package/utils/math/inertiaFinalValue.cjs +1 -0
- package/utils/math/lerp.cjs +1 -0
- package/utils/math/map.cjs +1 -0
- package/utils/math/round.cjs +1 -0
- package/utils/memoize.cjs +1 -0
- package/utils/nextFrame.cjs +1 -0
- package/utils/object/autoBind.cjs +1 -0
- package/utils/object/getAllProperties.cjs +1 -0
- package/utils/object/index.cjs +1 -0
- package/utils/object/isObject.cjs +1 -0
- package/utils/scrollTo.cjs +1 -0
- package/utils/string/index.cjs +1 -0
- package/utils/string/withLeadingCharacters.cjs +1 -0
- package/utils/string/withLeadingSlash.cjs +1 -0
- package/utils/string/withTrailingCharacters.cjs +1 -0
- package/utils/string/withTrailingSlash.cjs +1 -0
- package/utils/string/withoutLeadingCharacters.cjs +1 -0
- package/utils/string/withoutLeadingCharactersRecursive.cjs +1 -0
- package/utils/string/withoutLeadingSlash.cjs +1 -0
- package/utils/string/withoutTrailingCharacters.cjs +1 -0
- package/utils/string/withoutTrailingCharactersRecursive.cjs +1 -0
- package/utils/string/withoutTrailingSlash.cjs +1 -0
- package/utils/throttle.cjs +1 -0
|
@@ -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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
@@ -20,6 +21,10 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
20
21
|
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
21
22
|
};
|
|
22
23
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var __publicField = (obj, key, value) => {
|
|
25
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
23
28
|
|
|
24
29
|
// packages/js-toolkit/decorators/withMountWhenInView.js
|
|
25
30
|
var withMountWhenInView_exports = {};
|
|
@@ -27,23 +32,16 @@ __export(withMountWhenInView_exports, {
|
|
|
27
32
|
default: () => withMountWhenInView
|
|
28
33
|
});
|
|
29
34
|
function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...BaseClass.config || {},
|
|
33
|
-
name: `${BaseClass?.config?.name ?? ""}WithMountWhenInView`,
|
|
34
|
-
options: {
|
|
35
|
-
...BaseClass?.config?.options || {},
|
|
36
|
-
intersectionObserver: Object
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
#isVisible = false;
|
|
40
|
-
#observer;
|
|
35
|
+
var _a, _b;
|
|
36
|
+
return _b = class extends BaseClass {
|
|
41
37
|
constructor(element) {
|
|
42
38
|
super(element);
|
|
43
|
-
this
|
|
39
|
+
__publicField(this, "__isVisible", false);
|
|
40
|
+
__publicField(this, "__observer");
|
|
41
|
+
this.__observer = new IntersectionObserver((entries) => {
|
|
44
42
|
const isVisible = entries.reduce((acc, entry) => acc || entry.isIntersecting, false);
|
|
45
|
-
if (this
|
|
46
|
-
this
|
|
43
|
+
if (this.__isVisible !== isVisible) {
|
|
44
|
+
this.__isVisible = isVisible;
|
|
47
45
|
if (isVisible) {
|
|
48
46
|
this.$mount();
|
|
49
47
|
} else {
|
|
@@ -51,18 +49,26 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
}, { ...defaultOptions, ...this.$options.intersectionObserver });
|
|
54
|
-
this
|
|
52
|
+
this.__observer.observe(this.$el);
|
|
55
53
|
this.$on("terminated", () => {
|
|
56
|
-
this
|
|
54
|
+
this.__observer.disconnect();
|
|
57
55
|
});
|
|
58
56
|
return this;
|
|
59
57
|
}
|
|
60
58
|
$mount() {
|
|
61
|
-
if (this
|
|
59
|
+
if (this.__isVisible) {
|
|
62
60
|
super.$mount();
|
|
63
61
|
}
|
|
64
62
|
return this;
|
|
65
63
|
}
|
|
66
|
-
}
|
|
64
|
+
}, __publicField(_b, "config", {
|
|
65
|
+
...BaseClass.config,
|
|
66
|
+
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
67
|
+
options: {
|
|
68
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
69
|
+
intersectionObserver: Object
|
|
70
|
+
}
|
|
71
|
+
}), _b;
|
|
67
72
|
}
|
|
68
73
|
module.exports = __toCommonJS(withMountWhenInView_exports);
|
|
74
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,21 +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
|
function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
...BaseClass.config || {},
|
|
5
|
-
name: `${BaseClass?.config?.name ?? ""}WithMountWhenInView`,
|
|
6
|
-
options: {
|
|
7
|
-
...BaseClass?.config?.options || {},
|
|
8
|
-
intersectionObserver: Object
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
#isVisible = false;
|
|
12
|
-
#observer;
|
|
8
|
+
var _a, _b;
|
|
9
|
+
return _b = class extends BaseClass {
|
|
13
10
|
constructor(element) {
|
|
14
11
|
super(element);
|
|
15
|
-
this
|
|
12
|
+
__publicField(this, "__isVisible", false);
|
|
13
|
+
__publicField(this, "__observer");
|
|
14
|
+
this.__observer = new IntersectionObserver((entries) => {
|
|
16
15
|
const isVisible = entries.reduce((acc, entry) => acc || entry.isIntersecting, false);
|
|
17
|
-
if (this
|
|
18
|
-
this
|
|
16
|
+
if (this.__isVisible !== isVisible) {
|
|
17
|
+
this.__isVisible = isVisible;
|
|
19
18
|
if (isVisible) {
|
|
20
19
|
this.$mount();
|
|
21
20
|
} else {
|
|
@@ -23,19 +22,26 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}, { ...defaultOptions, ...this.$options.intersectionObserver });
|
|
26
|
-
this
|
|
25
|
+
this.__observer.observe(this.$el);
|
|
27
26
|
this.$on("terminated", () => {
|
|
28
|
-
this
|
|
27
|
+
this.__observer.disconnect();
|
|
29
28
|
});
|
|
30
29
|
return this;
|
|
31
30
|
}
|
|
32
31
|
$mount() {
|
|
33
|
-
if (this
|
|
32
|
+
if (this.__isVisible) {
|
|
34
33
|
super.$mount();
|
|
35
34
|
}
|
|
36
35
|
return this;
|
|
37
36
|
}
|
|
38
|
-
}
|
|
37
|
+
}, __publicField(_b, "config", {
|
|
38
|
+
...BaseClass.config,
|
|
39
|
+
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
40
|
+
options: {
|
|
41
|
+
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
42
|
+
intersectionObserver: Object
|
|
43
|
+
}
|
|
44
|
+
}), _b;
|
|
39
45
|
}
|
|
40
46
|
export {
|
|
41
47
|
withMountWhenInView 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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
9
|
var __export = (target, all) => {
|
|
9
10
|
for (var name in all)
|
|
@@ -25,6 +26,10 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
25
26
|
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
27
|
};
|
|
27
28
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
29
|
+
var __publicField = (obj, key, value) => {
|
|
30
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
28
33
|
|
|
29
34
|
// packages/js-toolkit/decorators/withScrolledInView.js
|
|
30
35
|
var withScrolledInView_exports = {};
|
|
@@ -34,35 +39,35 @@ __export(withScrolledInView_exports, {
|
|
|
34
39
|
var import_withMountWhenInView = __toESM(require("./withMountWhenInView.cjs"), 1);
|
|
35
40
|
var import_utils = require("../utils/index.cjs");
|
|
36
41
|
function withScrolledInView(BaseClass, options) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
42
|
+
var _a;
|
|
43
|
+
return _a = class extends (0, import_withMountWhenInView.default)(BaseClass, options) {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
__publicField(this, "__props", {
|
|
47
|
+
start: {
|
|
48
|
+
x: 0,
|
|
49
|
+
y: 0
|
|
50
|
+
},
|
|
51
|
+
end: {
|
|
52
|
+
x: 0,
|
|
53
|
+
y: 0
|
|
54
|
+
},
|
|
55
|
+
current: {
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0
|
|
58
|
+
},
|
|
59
|
+
progress: {
|
|
60
|
+
x: 0,
|
|
61
|
+
y: 0
|
|
62
|
+
},
|
|
63
|
+
dampedProgress: {
|
|
64
|
+
x: 0,
|
|
65
|
+
y: 0
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
__publicField(this, "dampFactor", 0.1);
|
|
69
|
+
__publicField(this, "dampPrecision", 1e-3);
|
|
70
|
+
}
|
|
66
71
|
mounted() {
|
|
67
72
|
this.__setProps();
|
|
68
73
|
}
|
|
@@ -107,6 +112,10 @@ function withScrolledInView(BaseClass, options) {
|
|
|
107
112
|
this.__props.dampedProgress.x = (0, import_utils.damp)(xProgress, this.__props.dampedProgress.x);
|
|
108
113
|
this.__props.dampedProgress.y = (0, import_utils.damp)(yProgress, this.__props.dampedProgress.y);
|
|
109
114
|
}
|
|
110
|
-
}
|
|
115
|
+
}, __publicField(_a, "config", {
|
|
116
|
+
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
117
|
+
emits: ["scrolledInView"]
|
|
118
|
+
}), _a;
|
|
111
119
|
}
|
|
112
120
|
module.exports = __toCommonJS(withScrolledInView_exports);
|
|
121
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,35 +1,41 @@
|
|
|
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 withMountWhenInView from "./withMountWhenInView.js";
|
|
2
8
|
import { damp, clamp, clamp01 } from "../utils/index.js";
|
|
3
9
|
function withScrolledInView(BaseClass, options) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
var _a;
|
|
11
|
+
return _a = class extends withMountWhenInView(BaseClass, options) {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
__publicField(this, "__props", {
|
|
15
|
+
start: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0
|
|
18
|
+
},
|
|
19
|
+
end: {
|
|
20
|
+
x: 0,
|
|
21
|
+
y: 0
|
|
22
|
+
},
|
|
23
|
+
current: {
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0
|
|
26
|
+
},
|
|
27
|
+
progress: {
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0
|
|
30
|
+
},
|
|
31
|
+
dampedProgress: {
|
|
32
|
+
x: 0,
|
|
33
|
+
y: 0
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
__publicField(this, "dampFactor", 0.1);
|
|
37
|
+
__publicField(this, "dampPrecision", 1e-3);
|
|
38
|
+
}
|
|
33
39
|
mounted() {
|
|
34
40
|
this.__setProps();
|
|
35
41
|
}
|
|
@@ -74,7 +80,10 @@ function withScrolledInView(BaseClass, options) {
|
|
|
74
80
|
this.__props.dampedProgress.x = damp(xProgress, this.__props.dampedProgress.x);
|
|
75
81
|
this.__props.dampedProgress.y = damp(yProgress, this.__props.dampedProgress.y);
|
|
76
82
|
}
|
|
77
|
-
}
|
|
83
|
+
}, __publicField(_a, "config", {
|
|
84
|
+
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
85
|
+
emits: ["scrolledInView"]
|
|
86
|
+
}), _a;
|
|
78
87
|
}
|
|
79
88
|
export {
|
|
80
89
|
withScrolledInView as default
|
package/decorators/withVue2.cjs
CHANGED
|
@@ -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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
@@ -20,6 +21,10 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
20
21
|
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
21
22
|
};
|
|
22
23
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var __publicField = (obj, key, value) => {
|
|
25
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
23
28
|
|
|
24
29
|
// packages/js-toolkit/decorators/withVue2.js
|
|
25
30
|
var withVue2_exports = {};
|
|
@@ -27,16 +32,11 @@ __export(withVue2_exports, {
|
|
|
27
32
|
default: () => withVue2_default
|
|
28
33
|
});
|
|
29
34
|
var withVue2_default = (BaseClass, Vue) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...BaseClass.config || {},
|
|
33
|
-
name: `${BaseClass?.config?.name ?? ""}WithVue`,
|
|
34
|
-
refs: [...BaseClass?.config?.refs ?? [], "vue"]
|
|
35
|
-
};
|
|
36
|
-
$vue;
|
|
37
|
-
static vueConfig;
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
return _c = class extends BaseClass {
|
|
38
37
|
constructor(element) {
|
|
39
38
|
super(element);
|
|
39
|
+
__publicField(this, "$vue");
|
|
40
40
|
const { vueConfig } = this.constructor;
|
|
41
41
|
if (!vueConfig) {
|
|
42
42
|
throw new Error("[withVue] You must define a `vueConfig` object.");
|
|
@@ -55,6 +55,11 @@ var withVue2_default = (BaseClass, Vue) => {
|
|
|
55
55
|
this.$vue.$destroy();
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
}, __publicField(_c, "config", {
|
|
59
|
+
...BaseClass.config,
|
|
60
|
+
name: `${BaseClass.config.name}WithVue`,
|
|
61
|
+
refs: [...(_b = (_a = BaseClass.config) == null ? void 0 : _a.refs) != null ? _b : [], "vue"]
|
|
62
|
+
}), __publicField(_c, "vueConfig"), _c;
|
|
59
63
|
};
|
|
60
64
|
module.exports = __toCommonJS(withVue2_exports);
|
|
65
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/decorators/withVue2.js
CHANGED
|
@@ -1,14 +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
|
var withVue2_default = (BaseClass, Vue) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
...BaseClass.config || {},
|
|
5
|
-
name: `${BaseClass?.config?.name ?? ""}WithVue`,
|
|
6
|
-
refs: [...BaseClass?.config?.refs ?? [], "vue"]
|
|
7
|
-
};
|
|
8
|
-
$vue;
|
|
9
|
-
static vueConfig;
|
|
8
|
+
var _a, _b, _c;
|
|
9
|
+
return _c = class extends BaseClass {
|
|
10
10
|
constructor(element) {
|
|
11
11
|
super(element);
|
|
12
|
+
__publicField(this, "$vue");
|
|
12
13
|
const { vueConfig } = this.constructor;
|
|
13
14
|
if (!vueConfig) {
|
|
14
15
|
throw new Error("[withVue] You must define a `vueConfig` object.");
|
|
@@ -27,7 +28,11 @@ var withVue2_default = (BaseClass, Vue) => {
|
|
|
27
28
|
this.$vue.$destroy();
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
}
|
|
31
|
+
}, __publicField(_c, "config", {
|
|
32
|
+
...BaseClass.config,
|
|
33
|
+
name: `${BaseClass.config.name}WithVue`,
|
|
34
|
+
refs: [...(_b = (_a = BaseClass.config) == null ? void 0 : _a.refs) != null ? _b : [], "vue"]
|
|
35
|
+
}), __publicField(_c, "vueConfig"), _c;
|
|
31
36
|
};
|
|
32
37
|
export {
|
|
33
38
|
withVue2_default as default
|
package/helpers/createApp.cjs
CHANGED
|
@@ -37,7 +37,7 @@ function importOnInteraction(fn, nameOrSelectorOrElement, events, parent) {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
return new Promise((resolve) => {
|
|
40
|
-
const elements = (0, import_utils.getTargetElements)(nameOrSelectorOrElement, parent
|
|
40
|
+
const elements = (0, import_utils.getTargetElements)(nameOrSelectorOrElement, parent == null ? void 0 : parent.$el);
|
|
41
41
|
const eventListenerOptions = {
|
|
42
42
|
capture: true,
|
|
43
43
|
passive: true,
|
|
@@ -54,3 +54,4 @@ function importOnInteraction(fn, nameOrSelectorOrElement, events, parent) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
module.exports = __toCommonJS(importOnInteraction_exports);
|
|
57
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -9,7 +9,7 @@ function importOnInteraction(fn, nameOrSelectorOrElement, events, parent) {
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
return new Promise((resolve) => {
|
|
12
|
-
const elements = getTargetElements(nameOrSelectorOrElement, parent
|
|
12
|
+
const elements = getTargetElements(nameOrSelectorOrElement, parent == null ? void 0 : parent.$el);
|
|
13
13
|
const eventListenerOptions = {
|
|
14
14
|
capture: true,
|
|
15
15
|
passive: true,
|
|
@@ -35,7 +35,8 @@ function importWhenIdle(fn, options) {
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
return new Promise((resolve) => {
|
|
38
|
-
|
|
38
|
+
var _a;
|
|
39
|
+
const timeout = (_a = options == null ? void 0 : options.timeout) != null ? _a : 1;
|
|
39
40
|
if (!("requestIdleCallback" in window)) {
|
|
40
41
|
setTimeout(() => {
|
|
41
42
|
resolver(resolve);
|
|
@@ -45,8 +46,9 @@ function importWhenIdle(fn, options) {
|
|
|
45
46
|
setTimeout(() => {
|
|
46
47
|
resolver(resolve);
|
|
47
48
|
}, 0);
|
|
48
|
-
}, { timeout: options
|
|
49
|
+
}, { timeout: options == null ? void 0 : options.timeout });
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
module.exports = __toCommonJS(importWhenIdle_exports);
|
|
54
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -7,7 +7,8 @@ function importWhenIdle(fn, options) {
|
|
|
7
7
|
});
|
|
8
8
|
};
|
|
9
9
|
return new Promise((resolve) => {
|
|
10
|
-
|
|
10
|
+
var _a;
|
|
11
|
+
const timeout = (_a = options == null ? void 0 : options.timeout) != null ? _a : 1;
|
|
11
12
|
if (!("requestIdleCallback" in window)) {
|
|
12
13
|
setTimeout(() => {
|
|
13
14
|
resolver(resolve);
|
|
@@ -17,7 +18,7 @@ function importWhenIdle(fn, options) {
|
|
|
17
18
|
setTimeout(() => {
|
|
18
19
|
resolver(resolve);
|
|
19
20
|
}, 0);
|
|
20
|
-
}, { timeout: options
|
|
21
|
+
}, { timeout: options == null ? void 0 : options.timeout });
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
}
|
|
@@ -47,8 +47,9 @@ function importWhenVisible(fn, nameOrSelectorOrElement, parent, observerOptions
|
|
|
47
47
|
}, 0);
|
|
48
48
|
}
|
|
49
49
|
}, observerOptions);
|
|
50
|
-
const elements = (0, import_utils.getTargetElements)(nameOrSelectorOrElement, parent
|
|
50
|
+
const elements = (0, import_utils.getTargetElements)(nameOrSelectorOrElement, parent == null ? void 0 : parent.$el);
|
|
51
51
|
elements.forEach((element) => observer.observe(element));
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
module.exports = __toCommonJS(importWhenVisible_exports);
|
|
55
|
+
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -19,7 +19,7 @@ function importWhenVisible(fn, nameOrSelectorOrElement, parent, observerOptions
|
|
|
19
19
|
}, 0);
|
|
20
20
|
}
|
|
21
21
|
}, observerOptions);
|
|
22
|
-
const elements = getTargetElements(nameOrSelectorOrElement, parent
|
|
22
|
+
const elements = getTargetElements(nameOrSelectorOrElement, parent == null ? void 0 : parent.$el);
|
|
23
23
|
elements.forEach((element) => observer.observe(element));
|
|
24
24
|
});
|
|
25
25
|
}
|
package/helpers/index.cjs
CHANGED
|
@@ -39,3 +39,4 @@ var import_importOnInteraction = __toESM(require("./importOnInteraction.cjs"), 1
|
|
|
39
39
|
var import_importWhenIdle = __toESM(require("./importWhenIdle.cjs"), 1);
|
|
40
40
|
var import_importWhenVisible = __toESM(require("./importWhenVisible.cjs"), 1);
|
|
41
41
|
module.exports = __toCommonJS(helpers_exports);
|
|
42
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/helpers/utils.cjs
CHANGED
package/index.cjs
CHANGED
|
@@ -36,3 +36,4 @@ __reExport(js_toolkit_exports, require("./decorators/index.cjs"));
|
|
|
36
36
|
__reExport(js_toolkit_exports, require("./helpers/index.cjs"));
|
|
37
37
|
__reExport(js_toolkit_exports, require("./services/index.cjs"));
|
|
38
38
|
module.exports = __toCommonJS(js_toolkit_exports);
|
|
39
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiometa/js-toolkit",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.17",
|
|
4
4
|
"description": "A set of useful little bits of JavaScript to boost your project! 🚀",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"toolkit"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@babel/runtime": "^7.15.4",
|
|
43
42
|
"deepmerge": "^4.2.2"
|
|
44
43
|
}
|
|
45
44
|
}
|
package/services/Service.cjs
CHANGED
|
@@ -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 __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
@@ -20,6 +21,10 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
20
21
|
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
21
22
|
};
|
|
22
23
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var __publicField = (obj, key, value) => {
|
|
25
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
23
28
|
|
|
24
29
|
// packages/js-toolkit/services/Service.js
|
|
25
30
|
var Service_exports = {};
|
|
@@ -28,10 +33,10 @@ __export(Service_exports, {
|
|
|
28
33
|
});
|
|
29
34
|
var Service = class {
|
|
30
35
|
constructor() {
|
|
36
|
+
__publicField(this, "props");
|
|
31
37
|
this.callbacks = /* @__PURE__ */ new Map();
|
|
32
38
|
this.isInit = false;
|
|
33
39
|
}
|
|
34
|
-
props;
|
|
35
40
|
updateProps(...args) {
|
|
36
41
|
this.props = args;
|
|
37
42
|
throw new Error("The `updateProps` method must be implemented.");
|
|
@@ -73,3 +78,4 @@ var Service = class {
|
|
|
73
78
|
}
|
|
74
79
|
};
|
|
75
80
|
module.exports = __toCommonJS(Service_exports);
|
|
81
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/services/Service.js
CHANGED
|
@@ -1,9 +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
|
class Service {
|
|
2
8
|
constructor() {
|
|
9
|
+
__publicField(this, "props");
|
|
3
10
|
this.callbacks = /* @__PURE__ */ new Map();
|
|
4
11
|
this.isInit = false;
|
|
5
12
|
}
|
|
6
|
-
props;
|
|
7
13
|
updateProps(...args) {
|
|
8
14
|
this.props = args;
|
|
9
15
|
throw new Error("The `updateProps` method must be implemented.");
|