@studiometa/js-toolkit 2.2.1 → 2.3.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 +60 -69
- package/Base/index.d.ts +0 -8
- package/Base/index.js +67 -82
- package/Base/managers/AbstractManager.cjs +5 -10
- package/Base/managers/AbstractManager.js +5 -11
- package/Base/managers/ChildrenManager.cjs +2 -11
- package/Base/managers/ChildrenManager.js +2 -12
- package/Base/managers/EventsManager.cjs +61 -67
- package/Base/managers/EventsManager.js +61 -68
- package/Base/managers/OptionsManager.cjs +26 -27
- package/Base/managers/OptionsManager.js +26 -28
- package/Base/managers/RefsManager.cjs +9 -7
- package/Base/managers/RefsManager.js +9 -7
- package/Base/managers/ResponsiveOptionsManager.cjs +4 -1
- package/Base/managers/ResponsiveOptionsManager.js +4 -1
- package/Base/managers/ServicesManager.cjs +10 -16
- package/Base/managers/ServicesManager.js +10 -17
- package/Base/utils.cjs +22 -4
- package/Base/utils.d.ts +25 -8
- package/Base/utils.js +22 -4
- package/decorators/withBreakpointManager.cjs +15 -5
- package/decorators/withBreakpointManager.js +15 -5
- package/decorators/withBreakpointObserver.cjs +19 -18
- package/decorators/withBreakpointObserver.js +19 -19
- package/decorators/withDrag.cjs +6 -11
- package/decorators/withDrag.js +6 -12
- package/decorators/withExtraConfig.cjs +3 -8
- package/decorators/withExtraConfig.js +3 -9
- package/decorators/withFreezedOptions.cjs +1 -9
- package/decorators/withFreezedOptions.js +1 -10
- package/decorators/withIntersectionObserver.cjs +11 -16
- package/decorators/withIntersectionObserver.js +11 -17
- package/decorators/withMountWhenInView.cjs +12 -17
- package/decorators/withMountWhenInView.js +12 -18
- package/decorators/withScrolledInView.cjs +30 -35
- package/decorators/withScrolledInView.js +30 -36
- package/decorators/withVue2.cjs +20 -18
- package/decorators/withVue2.js +20 -19
- package/helpers/getInstanceFromElement.cjs +1 -2
- package/helpers/getInstanceFromElement.js +1 -2
- package/helpers/importOnInteraction.cjs +3 -2
- package/helpers/importOnInteraction.js +3 -2
- package/helpers/importWhenIdle.cjs +2 -3
- package/helpers/importWhenIdle.js +2 -3
- package/helpers/importWhenVisible.cjs +3 -2
- package/helpers/importWhenVisible.js +3 -2
- package/helpers/utils.cjs +3 -2
- package/helpers/utils.js +3 -2
- package/package.json +4 -1
- package/services/drag.cjs +126 -148
- package/services/drag.d.ts +10 -10
- package/services/drag.js +125 -148
- package/services/index.cjs +3 -1
- package/services/index.d.ts +1 -0
- package/services/index.js +3 -1
- package/services/key.cjs +48 -63
- package/services/key.d.ts +0 -8
- package/services/key.js +47 -63
- package/services/load.cjs +24 -40
- package/services/load.d.ts +0 -8
- package/services/load.js +23 -37
- package/services/pointer.cjs +72 -103
- package/services/pointer.d.ts +1 -9
- package/services/pointer.js +71 -100
- package/services/raf.cjs +38 -58
- package/services/raf.d.ts +0 -8
- package/services/raf.js +37 -55
- package/services/resize.cjs +59 -68
- package/services/resize.d.ts +0 -7
- package/services/resize.js +58 -68
- package/services/scroll.cjs +49 -71
- package/services/scroll.js +48 -71
- package/services/service.cjs +68 -0
- package/services/service.d.ts +18 -0
- package/services/service.js +46 -0
- package/utils/css/animate.cjs +33 -102
- package/utils/css/animate.d.ts +4 -13
- package/utils/css/animate.js +31 -100
- package/utils/css/classes.cjs +2 -1
- package/utils/css/classes.js +2 -1
- package/utils/css/matrix.cjs +1 -2
- package/utils/css/matrix.js +1 -2
- package/utils/css/styles.cjs +2 -5
- package/utils/css/styles.js +1 -1
- package/utils/css/transform.cjs +14 -18
- package/utils/css/transform.js +2 -3
- package/utils/css/transition.cjs +7 -10
- package/utils/css/transition.js +7 -11
- package/utils/focusTrap.cjs +2 -1
- package/utils/focusTrap.js +2 -1
- package/utils/{isFunction.cjs → has.cjs} +7 -7
- package/utils/has.d.ts +6 -0
- package/utils/has.js +6 -0
- package/utils/history.cjs +5 -7
- package/utils/history.js +4 -3
- package/utils/index.cjs +6 -5
- package/utils/index.d.ts +4 -2
- package/utils/index.js +6 -5
- package/utils/{object/isObject.cjs → is.cjs} +20 -8
- package/utils/is.d.ts +8 -0
- package/utils/is.js +18 -0
- package/utils/math/inertiaFinalValue.cjs +5 -3
- package/utils/math/inertiaFinalValue.js +2 -3
- package/utils/nextFrame.cjs +5 -3
- package/utils/nextFrame.js +5 -3
- package/utils/nextMicrotask.cjs +2 -1
- package/utils/nextMicrotask.js +2 -1
- package/utils/nextTick.cjs +2 -1
- package/utils/nextTick.js +2 -1
- package/utils/{isDefined.cjs → noop.cjs} +10 -7
- package/utils/noop.d.ts +12 -0
- package/utils/noop.js +9 -0
- package/utils/object/autoBind.cjs +3 -2
- package/utils/object/autoBind.js +3 -2
- package/utils/object/getAllProperties.cjs +2 -1
- package/utils/object/getAllProperties.js +2 -1
- package/utils/object/index.cjs +1 -3
- package/utils/object/index.d.ts +0 -1
- package/utils/object/index.js +1 -3
- package/utils/tween.cjs +113 -0
- package/utils/tween.d.ts +25 -0
- package/utils/tween.js +88 -0
- package/services/Service.cjs +0 -76
- package/services/Service.d.ts +0 -76
- package/services/Service.js +0 -55
- package/utils/isDefined.d.ts +0 -7
- package/utils/isDefined.js +0 -6
- package/utils/isFunction.d.ts +0 -7
- package/utils/isFunction.js +0 -6
- package/utils/object/isObject.d.ts +0 -7
- package/utils/object/isObject.js +0 -6
package/decorators/withDrag.cjs
CHANGED
|
@@ -4,7 +4,6 @@ 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;
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -19,10 +18,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
18
|
};
|
|
20
19
|
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));
|
|
21
20
|
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
|
-
};
|
|
26
21
|
|
|
27
22
|
// packages/js-toolkit/decorators/withDrag.js
|
|
28
23
|
var withDrag_exports = {};
|
|
@@ -32,8 +27,11 @@ __export(withDrag_exports, {
|
|
|
32
27
|
module.exports = __toCommonJS(withDrag_exports);
|
|
33
28
|
var import_drag = __toESM(require("../services/drag.cjs"), 1);
|
|
34
29
|
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
return class extends BaseClass {
|
|
31
|
+
static config = {
|
|
32
|
+
name: `${BaseClass.config.name}WithDrag`,
|
|
33
|
+
emits: ["dragged"]
|
|
34
|
+
};
|
|
37
35
|
constructor(el) {
|
|
38
36
|
super(el);
|
|
39
37
|
this.$on("mounted", () => {
|
|
@@ -45,9 +43,6 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
45
43
|
this.$services.unregister("dragged");
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
|
-
}
|
|
49
|
-
name: `${BaseClass.config.name}WithDrag`,
|
|
50
|
-
emits: ["dragged"]
|
|
51
|
-
}), _a;
|
|
46
|
+
};
|
|
52
47
|
}
|
|
53
48
|
if (module.exports.default) module.exports = module.exports.default;
|
package/decorators/withDrag.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
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
|
-
};
|
|
7
1
|
import useDrag from "../services/drag.js";
|
|
8
2
|
function withDrag(BaseClass, { target = (instance) => instance.$el, ...options } = {}) {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
return class extends BaseClass {
|
|
4
|
+
static config = {
|
|
5
|
+
name: `${BaseClass.config.name}WithDrag`,
|
|
6
|
+
emits: ["dragged"]
|
|
7
|
+
};
|
|
11
8
|
constructor(el) {
|
|
12
9
|
super(el);
|
|
13
10
|
this.$on("mounted", () => {
|
|
@@ -19,10 +16,7 @@ function withDrag(BaseClass, { target = (instance) => instance.$el, ...options }
|
|
|
19
16
|
this.$services.unregister("dragged");
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
|
-
}
|
|
23
|
-
name: `${BaseClass.config.name}WithDrag`,
|
|
24
|
-
emits: ["dragged"]
|
|
25
|
-
}), _a;
|
|
19
|
+
};
|
|
26
20
|
}
|
|
27
21
|
export {
|
|
28
22
|
withDrag as default
|
|
@@ -4,7 +4,6 @@ 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;
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -19,10 +18,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
18
|
};
|
|
20
19
|
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));
|
|
21
20
|
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
|
-
};
|
|
26
21
|
|
|
27
22
|
// packages/js-toolkit/decorators/withExtraConfig.js
|
|
28
23
|
var withExtraConfig_exports = {};
|
|
@@ -32,12 +27,12 @@ __export(withExtraConfig_exports, {
|
|
|
32
27
|
module.exports = __toCommonJS(withExtraConfig_exports);
|
|
33
28
|
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
34
29
|
function withExtraConfig(BaseClass, config, options = {}) {
|
|
35
|
-
var _a;
|
|
36
30
|
const newConfig = (0, import_deepmerge.default)(BaseClass.config, config, options);
|
|
37
31
|
if (newConfig.name === BaseClass.config.name) {
|
|
38
32
|
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
39
33
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
34
|
+
return class extends BaseClass {
|
|
35
|
+
static config = newConfig;
|
|
36
|
+
};
|
|
42
37
|
}
|
|
43
38
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,18 +1,12 @@
|
|
|
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
|
-
};
|
|
7
1
|
import merge from "deepmerge";
|
|
8
2
|
function withExtraConfig(BaseClass, config, options = {}) {
|
|
9
|
-
var _a;
|
|
10
3
|
const newConfig = merge(BaseClass.config, config, options);
|
|
11
4
|
if (newConfig.name === BaseClass.config.name) {
|
|
12
5
|
newConfig.name = `${BaseClass.config.name}WithExtraConfig`;
|
|
13
6
|
}
|
|
14
|
-
return
|
|
15
|
-
|
|
7
|
+
return class extends BaseClass {
|
|
8
|
+
static config = newConfig;
|
|
9
|
+
};
|
|
16
10
|
}
|
|
17
11
|
export {
|
|
18
12
|
withExtraConfig as default
|
|
@@ -2,7 +2,6 @@ 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;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
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
|
-
};
|
|
23
18
|
|
|
24
19
|
// packages/js-toolkit/decorators/withFreezedOptions.js
|
|
25
20
|
var withFreezedOptions_exports = {};
|
|
@@ -29,10 +24,7 @@ __export(withFreezedOptions_exports, {
|
|
|
29
24
|
module.exports = __toCommonJS(withFreezedOptions_exports);
|
|
30
25
|
function withFreezedOptions(BaseClass) {
|
|
31
26
|
return class extends BaseClass {
|
|
32
|
-
|
|
33
|
-
super(...arguments);
|
|
34
|
-
__publicField(this, "__freezedOptions");
|
|
35
|
-
}
|
|
27
|
+
__freezedOptions;
|
|
36
28
|
get $options() {
|
|
37
29
|
Object.defineProperty(this, "__freezedOptions", {
|
|
38
30
|
value: Object.freeze({ ...super.$options }),
|
|
@@ -1,15 +1,6 @@
|
|
|
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
|
-
};
|
|
7
1
|
function withFreezedOptions(BaseClass) {
|
|
8
2
|
return class extends BaseClass {
|
|
9
|
-
|
|
10
|
-
super(...arguments);
|
|
11
|
-
__publicField(this, "__freezedOptions");
|
|
12
|
-
}
|
|
3
|
+
__freezedOptions;
|
|
13
4
|
get $options() {
|
|
14
5
|
Object.defineProperty(this, "__freezedOptions", {
|
|
15
6
|
value: Object.freeze({ ...super.$options }),
|
|
@@ -2,7 +2,6 @@ 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;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
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
|
-
};
|
|
23
18
|
|
|
24
19
|
// packages/js-toolkit/decorators/withIntersectionObserver.js
|
|
25
20
|
var withIntersectionObserver_exports = {};
|
|
@@ -31,8 +26,16 @@ function createArrayOfNumber(length) {
|
|
|
31
26
|
return [...new Array(length + 1)].map((val, index) => index / length);
|
|
32
27
|
}
|
|
33
28
|
function withIntersectionObserver(BaseClass, defaultOptions = { threshold: createArrayOfNumber(100) }) {
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
return class extends BaseClass {
|
|
30
|
+
static config = {
|
|
31
|
+
...BaseClass.config,
|
|
32
|
+
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
33
|
+
options: {
|
|
34
|
+
...BaseClass.config?.options || {},
|
|
35
|
+
intersectionObserver: Object
|
|
36
|
+
},
|
|
37
|
+
emits: ["intersected"]
|
|
38
|
+
};
|
|
36
39
|
constructor(element) {
|
|
37
40
|
super(element);
|
|
38
41
|
this.$observer = new IntersectionObserver((entries) => {
|
|
@@ -48,14 +51,6 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
48
51
|
this.$observer.unobserve(this.$el);
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
|
-
}
|
|
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;
|
|
54
|
+
};
|
|
60
55
|
}
|
|
61
56
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,15 +1,17 @@
|
|
|
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
|
-
};
|
|
7
1
|
function createArrayOfNumber(length) {
|
|
8
2
|
return [...new Array(length + 1)].map((val, index) => index / length);
|
|
9
3
|
}
|
|
10
4
|
function withIntersectionObserver(BaseClass, defaultOptions = { threshold: createArrayOfNumber(100) }) {
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
return class extends BaseClass {
|
|
6
|
+
static config = {
|
|
7
|
+
...BaseClass.config,
|
|
8
|
+
name: `${BaseClass.config.name}WithIntersectionObserver`,
|
|
9
|
+
options: {
|
|
10
|
+
...BaseClass.config?.options || {},
|
|
11
|
+
intersectionObserver: Object
|
|
12
|
+
},
|
|
13
|
+
emits: ["intersected"]
|
|
14
|
+
};
|
|
13
15
|
constructor(element) {
|
|
14
16
|
super(element);
|
|
15
17
|
this.$observer = new IntersectionObserver((entries) => {
|
|
@@ -25,15 +27,7 @@ function withIntersectionObserver(BaseClass, defaultOptions = { threshold: creat
|
|
|
25
27
|
this.$observer.unobserve(this.$el);
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
|
-
}
|
|
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;
|
|
30
|
+
};
|
|
37
31
|
}
|
|
38
32
|
export {
|
|
39
33
|
withIntersectionObserver as default
|
|
@@ -2,7 +2,6 @@ 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;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
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
|
-
};
|
|
23
18
|
|
|
24
19
|
// packages/js-toolkit/decorators/withMountWhenInView.js
|
|
25
20
|
var withMountWhenInView_exports = {};
|
|
@@ -28,12 +23,19 @@ __export(withMountWhenInView_exports, {
|
|
|
28
23
|
});
|
|
29
24
|
module.exports = __toCommonJS(withMountWhenInView_exports);
|
|
30
25
|
function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
return class extends BaseClass {
|
|
27
|
+
static config = {
|
|
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;
|
|
33
37
|
constructor(element) {
|
|
34
38
|
super(element);
|
|
35
|
-
__publicField(this, "__isVisible", false);
|
|
36
|
-
__publicField(this, "__observer");
|
|
37
39
|
this.__observer = new IntersectionObserver((entries) => {
|
|
38
40
|
const isVisible = entries.reduce((acc, entry) => acc || entry.isIntersecting, false);
|
|
39
41
|
if (this.__isVisible !== isVisible) {
|
|
@@ -56,13 +58,6 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
56
58
|
}
|
|
57
59
|
return this;
|
|
58
60
|
}
|
|
59
|
-
}
|
|
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;
|
|
61
|
+
};
|
|
67
62
|
}
|
|
68
63
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,16 +1,17 @@
|
|
|
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
|
-
};
|
|
7
1
|
function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] }) {
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
return class extends BaseClass {
|
|
3
|
+
static config = {
|
|
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;
|
|
10
13
|
constructor(element) {
|
|
11
14
|
super(element);
|
|
12
|
-
__publicField(this, "__isVisible", false);
|
|
13
|
-
__publicField(this, "__observer");
|
|
14
15
|
this.__observer = new IntersectionObserver((entries) => {
|
|
15
16
|
const isVisible = entries.reduce((acc, entry) => acc || entry.isIntersecting, false);
|
|
16
17
|
if (this.__isVisible !== isVisible) {
|
|
@@ -33,14 +34,7 @@ function withMountWhenInView(BaseClass, defaultOptions = { threshold: [0, 1] })
|
|
|
33
34
|
}
|
|
34
35
|
return this;
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
-
...BaseClass.config,
|
|
38
|
-
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
39
|
-
options: {
|
|
40
|
-
...((_a = BaseClass.config) == null ? void 0 : _a.options) || {},
|
|
41
|
-
intersectionObserver: Object
|
|
42
|
-
}
|
|
43
|
-
}), _b;
|
|
37
|
+
};
|
|
44
38
|
}
|
|
45
39
|
export {
|
|
46
40
|
withMountWhenInView as default
|
|
@@ -4,7 +4,6 @@ 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;
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -19,10 +18,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
18
|
};
|
|
20
19
|
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));
|
|
21
20
|
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
|
-
};
|
|
26
21
|
|
|
27
22
|
// packages/js-toolkit/decorators/withScrolledInView.js
|
|
28
23
|
var withScrolledInView_exports = {};
|
|
@@ -34,34 +29,37 @@ var import_withMountWhenInView = __toESM(require("./withMountWhenInView.cjs"), 1
|
|
|
34
29
|
var import_utils = require("../utils/index.cjs");
|
|
35
30
|
var scheduler = (0, import_utils.useScheduler)(["update", "render"]);
|
|
36
31
|
function withScrolledInView(BaseClass, options = {}) {
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
return class extends (0, import_withMountWhenInView.default)(BaseClass, options) {
|
|
33
|
+
static config = {
|
|
34
|
+
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
35
|
+
emits: ["scrolledInView"]
|
|
36
|
+
};
|
|
37
|
+
__props = {
|
|
38
|
+
start: {
|
|
39
|
+
x: 0,
|
|
40
|
+
y: 0
|
|
41
|
+
},
|
|
42
|
+
end: {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0
|
|
45
|
+
},
|
|
46
|
+
current: {
|
|
47
|
+
x: 0,
|
|
48
|
+
y: 0
|
|
49
|
+
},
|
|
50
|
+
progress: {
|
|
51
|
+
x: 0,
|
|
52
|
+
y: 0
|
|
53
|
+
},
|
|
54
|
+
dampedProgress: {
|
|
55
|
+
x: 0,
|
|
56
|
+
y: 0
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
dampFactor = 0.1;
|
|
60
|
+
dampPrecision = 1e-3;
|
|
39
61
|
constructor(element) {
|
|
40
62
|
super(element);
|
|
41
|
-
__publicField(this, "__props", {
|
|
42
|
-
start: {
|
|
43
|
-
x: 0,
|
|
44
|
-
y: 0
|
|
45
|
-
},
|
|
46
|
-
end: {
|
|
47
|
-
x: 0,
|
|
48
|
-
y: 0
|
|
49
|
-
},
|
|
50
|
-
current: {
|
|
51
|
-
x: 0,
|
|
52
|
-
y: 0
|
|
53
|
-
},
|
|
54
|
-
progress: {
|
|
55
|
-
x: 0,
|
|
56
|
-
y: 0
|
|
57
|
-
},
|
|
58
|
-
dampedProgress: {
|
|
59
|
-
x: 0,
|
|
60
|
-
y: 0
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
__publicField(this, "dampFactor", 0.1);
|
|
64
|
-
__publicField(this, "dampPrecision", 1e-3);
|
|
65
63
|
const delegate = {
|
|
66
64
|
handleEvent(event) {
|
|
67
65
|
delegate[event.type](event.detail[0]);
|
|
@@ -149,9 +147,6 @@ function withScrolledInView(BaseClass, options = {}) {
|
|
|
149
147
|
this.__props.dampedProgress.x = (0, import_utils.damp)(xProgress, this.__props.dampedProgress.x);
|
|
150
148
|
this.__props.dampedProgress.y = (0, import_utils.damp)(yProgress, this.__props.dampedProgress.y);
|
|
151
149
|
}
|
|
152
|
-
}
|
|
153
|
-
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
154
|
-
emits: ["scrolledInView"]
|
|
155
|
-
}), _a;
|
|
150
|
+
};
|
|
156
151
|
}
|
|
157
152
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -1,41 +1,38 @@
|
|
|
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
|
-
};
|
|
7
1
|
import withMountWhenInView from "./withMountWhenInView.js";
|
|
8
2
|
import { damp, clamp, clamp01, getOffsetSizes, isFunction, useScheduler } from "../utils/index.js";
|
|
9
3
|
const scheduler = useScheduler(["update", "render"]);
|
|
10
4
|
function withScrolledInView(BaseClass, options = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
return class extends withMountWhenInView(BaseClass, options) {
|
|
6
|
+
static config = {
|
|
7
|
+
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
8
|
+
emits: ["scrolledInView"]
|
|
9
|
+
};
|
|
10
|
+
__props = {
|
|
11
|
+
start: {
|
|
12
|
+
x: 0,
|
|
13
|
+
y: 0
|
|
14
|
+
},
|
|
15
|
+
end: {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0
|
|
18
|
+
},
|
|
19
|
+
current: {
|
|
20
|
+
x: 0,
|
|
21
|
+
y: 0
|
|
22
|
+
},
|
|
23
|
+
progress: {
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0
|
|
26
|
+
},
|
|
27
|
+
dampedProgress: {
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
dampFactor = 0.1;
|
|
33
|
+
dampPrecision = 1e-3;
|
|
13
34
|
constructor(element) {
|
|
14
35
|
super(element);
|
|
15
|
-
__publicField(this, "__props", {
|
|
16
|
-
start: {
|
|
17
|
-
x: 0,
|
|
18
|
-
y: 0
|
|
19
|
-
},
|
|
20
|
-
end: {
|
|
21
|
-
x: 0,
|
|
22
|
-
y: 0
|
|
23
|
-
},
|
|
24
|
-
current: {
|
|
25
|
-
x: 0,
|
|
26
|
-
y: 0
|
|
27
|
-
},
|
|
28
|
-
progress: {
|
|
29
|
-
x: 0,
|
|
30
|
-
y: 0
|
|
31
|
-
},
|
|
32
|
-
dampedProgress: {
|
|
33
|
-
x: 0,
|
|
34
|
-
y: 0
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
__publicField(this, "dampFactor", 0.1);
|
|
38
|
-
__publicField(this, "dampPrecision", 1e-3);
|
|
39
36
|
const delegate = {
|
|
40
37
|
handleEvent(event) {
|
|
41
38
|
delegate[event.type](event.detail[0]);
|
|
@@ -123,10 +120,7 @@ function withScrolledInView(BaseClass, options = {}) {
|
|
|
123
120
|
this.__props.dampedProgress.x = damp(xProgress, this.__props.dampedProgress.x);
|
|
124
121
|
this.__props.dampedProgress.y = damp(yProgress, this.__props.dampedProgress.y);
|
|
125
122
|
}
|
|
126
|
-
}
|
|
127
|
-
name: `${BaseClass.config.name}WithMountWhenInView`,
|
|
128
|
-
emits: ["scrolledInView"]
|
|
129
|
-
}), _a;
|
|
123
|
+
};
|
|
130
124
|
}
|
|
131
125
|
export {
|
|
132
126
|
withScrolledInView as default
|
package/decorators/withVue2.cjs
CHANGED
|
@@ -2,7 +2,6 @@ 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;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
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
|
-
};
|
|
23
18
|
|
|
24
19
|
// packages/js-toolkit/decorators/withVue2.js
|
|
25
20
|
var withVue2_exports = {};
|
|
@@ -27,19 +22,30 @@ __export(withVue2_exports, {
|
|
|
27
22
|
default: () => withVue2_default
|
|
28
23
|
});
|
|
29
24
|
module.exports = __toCommonJS(withVue2_exports);
|
|
25
|
+
var import_utils = require("../utils/index.cjs");
|
|
30
26
|
var withVue2_default = (BaseClass, Vue) => {
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
return class WithVue2 extends BaseClass {
|
|
28
|
+
static config = {
|
|
29
|
+
...BaseClass.config,
|
|
30
|
+
name: `${BaseClass.config.name}WithVue`,
|
|
31
|
+
refs: [...BaseClass.config?.refs ?? [], "vue"]
|
|
32
|
+
};
|
|
33
|
+
$vue;
|
|
34
|
+
static vueConfig;
|
|
33
35
|
constructor(element) {
|
|
34
|
-
var _a2;
|
|
35
36
|
super(element);
|
|
36
|
-
|
|
37
|
-
const vueConfig = (_a2 = this.vueConfig) != null ? _a2 : this.constructor.vueConfig;
|
|
37
|
+
const vueConfig = this.vueConfig ?? this.constructor.vueConfig;
|
|
38
38
|
if (!vueConfig) {
|
|
39
|
-
|
|
39
|
+
if (import_utils.isDev) {
|
|
40
|
+
throw new Error("[withVue] You must define a `vueConfig` object.");
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
40
43
|
}
|
|
41
|
-
if (
|
|
42
|
-
|
|
44
|
+
if (!(0, import_utils.isFunction)(vueConfig.render)) {
|
|
45
|
+
if (import_utils.isDev) {
|
|
46
|
+
throw new Error("[withVue] You must define a `render` function in vueConfig.");
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
43
49
|
}
|
|
44
50
|
this.$vue = new Vue(vueConfig);
|
|
45
51
|
this.$on("mounted", () => {
|
|
@@ -52,10 +58,6 @@ var withVue2_default = (BaseClass, Vue) => {
|
|
|
52
58
|
this.$vue.$destroy();
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
|
-
}
|
|
56
|
-
...BaseClass.config,
|
|
57
|
-
name: `${BaseClass.config.name}WithVue`,
|
|
58
|
-
refs: [...(_b = (_a = BaseClass.config) == null ? void 0 : _a.refs) != null ? _b : [], "vue"]
|
|
59
|
-
}), __publicField(_c, "vueConfig"), _c;
|
|
61
|
+
};
|
|
60
62
|
};
|
|
61
63
|
if (module.exports.default) module.exports = module.exports.default;
|