nanime 0.0.8 → 0.0.10
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/dist/module.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import { normalizeAnimeTarget } from '../utils/normalize-targets.js';
|
|
3
|
+
import type { AnimationParams, ScrambleTextParams } from 'animejs';
|
|
4
|
+
import { type JSAnimation } from 'animejs/animation';
|
|
5
|
+
export declare function useScrambleText(target: Parameters<typeof normalizeAnimeTarget>[0], animationOptions?: MaybeRefOrGetter<AnimationParams>, scrambleOptions?: MaybeRefOrGetter<ScrambleTextParams>): JSAnimation;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { toReactive, tryOnScopeDispose, useMounted } from "@vueuse/core";
|
|
2
|
+
import { shallowRef, toValue, watchEffect, nextTick } from "vue";
|
|
3
|
+
import { normalizeAnimeTarget } from "../utils/normalize-targets.js";
|
|
4
|
+
import { animate } from "animejs/animation";
|
|
5
|
+
import { scrambleText } from "animejs/text";
|
|
6
|
+
import { AnimationComponentFlags, getAnimationComponentFlag } from "../utils/normalizers/instance-management.js";
|
|
7
|
+
export function useScrambleText(target, animationOptions, scrambleOptions) {
|
|
8
|
+
const flag = getAnimationComponentFlag();
|
|
9
|
+
const animation = shallowRef(animate({}, {}));
|
|
10
|
+
const mounted = useMounted();
|
|
11
|
+
function buildParams() {
|
|
12
|
+
const anim = toValue(animationOptions) || {};
|
|
13
|
+
const scramble = toValue(scrambleOptions) || {};
|
|
14
|
+
return {
|
|
15
|
+
...anim,
|
|
16
|
+
innerHTML: scrambleText(scramble)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (flag === AnimationComponentFlags.Watchable) {
|
|
20
|
+
watchEffect(() => {
|
|
21
|
+
if (!mounted.value) return;
|
|
22
|
+
const targets = normalizeAnimeTarget(target);
|
|
23
|
+
if (!targets) return;
|
|
24
|
+
if (animation.value) animation.value.revert();
|
|
25
|
+
animation.value = animate(targets, buildParams());
|
|
26
|
+
});
|
|
27
|
+
tryOnScopeDispose(() => {
|
|
28
|
+
animation.value?.revert();
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
nextTick(() => {
|
|
32
|
+
const targets = normalizeAnimeTarget(target);
|
|
33
|
+
if (!targets) return;
|
|
34
|
+
animation.value = animate(targets, buildParams());
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return toReactive(animation);
|
|
38
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { AnimationParams, TargetsParam,
|
|
1
|
+
export type { AnimationParams, TargetsParam, EasingParam, WAAPIEasingParam, Draggable, DraggableAxisParam, DraggableParams, WAAPIAnimationParams, DOMTargetsParam, DOMTargetSelector, AnimatableObject, AnimatableParams, ScrambleTextParams, } from 'animejs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nanime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Nuxt module for animejs integration and transitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,46 +32,48 @@
|
|
|
32
32
|
"playground",
|
|
33
33
|
"docs"
|
|
34
34
|
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"prepack": "nuxt-module-build build",
|
|
37
|
+
"dev": "npm run dev:prepare && nuxt dev playground",
|
|
38
|
+
"dev:build": "nuxt build playground",
|
|
39
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
|
|
40
|
+
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
41
|
+
"lint": "eslint .",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"test:watch": "vitest watch",
|
|
44
|
+
"test:types": "nuxt typecheck",
|
|
45
|
+
"clean": "rm -rf playground/.nuxt docs/.nuxt playground/.output docs/.output .nuxt"
|
|
46
|
+
},
|
|
35
47
|
"dependencies": {
|
|
36
|
-
"@vueuse/core": "^14.
|
|
37
|
-
"animejs": "^4.
|
|
38
|
-
"defu": "^6.1.
|
|
39
|
-
"vue": "^3.5.
|
|
48
|
+
"@vueuse/core": "^14.3.0",
|
|
49
|
+
"animejs": "^4.4.1",
|
|
50
|
+
"defu": "^6.1.7",
|
|
51
|
+
"vue": "^3.5.34"
|
|
40
52
|
},
|
|
41
53
|
"peerDependencies": {
|
|
42
|
-
"@vueuse/core": "
|
|
43
|
-
"animejs": "^4.
|
|
54
|
+
"@vueuse/core": ">=13.0.0",
|
|
55
|
+
"animejs": "^4.4.0",
|
|
44
56
|
"defu": "^6.1.4",
|
|
45
57
|
"vue": "^3.5.0"
|
|
46
58
|
},
|
|
47
59
|
"devDependencies": {
|
|
48
|
-
"@nuxt/devtools": "^3.
|
|
49
|
-
"@nuxt/eslint-config": "^1.
|
|
50
|
-
"@nuxt/kit": "^4.
|
|
60
|
+
"@nuxt/devtools": "^3.2.4",
|
|
61
|
+
"@nuxt/eslint-config": "^1.15.2",
|
|
62
|
+
"@nuxt/kit": "^4.4.6",
|
|
51
63
|
"@nuxt/module-builder": "^1.0.2",
|
|
52
|
-
"@nuxt/schema": "^4.
|
|
64
|
+
"@nuxt/schema": "^4.4.6",
|
|
53
65
|
"@nuxt/test-utils": "^3.23.0",
|
|
54
66
|
"@types/node": "latest",
|
|
55
|
-
"@vue/test-utils": "^2.4.
|
|
67
|
+
"@vue/test-utils": "^2.4.10",
|
|
56
68
|
"@vueuse/nuxt": "14.1.0",
|
|
57
69
|
"changelogen": "^0.6.2",
|
|
58
|
-
"eslint": "^9.39.
|
|
59
|
-
"happy-dom": "^20.
|
|
60
|
-
"lefthook": "^2.
|
|
61
|
-
"nuxt": "^4.
|
|
70
|
+
"eslint": "^9.39.4",
|
|
71
|
+
"happy-dom": "^20.9.0",
|
|
72
|
+
"lefthook": "^2.1.8",
|
|
73
|
+
"nuxt": "^4.4.6",
|
|
62
74
|
"typescript": "~5.9.3",
|
|
63
|
-
"vitest": "^
|
|
64
|
-
"vue-tsc": "^3.
|
|
75
|
+
"vitest": "^3.2.4",
|
|
76
|
+
"vue-tsc": "^3.3.1"
|
|
65
77
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
"dev:build": "nuxt build playground",
|
|
69
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
|
|
70
|
-
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
|
|
71
|
-
"lint": "eslint .",
|
|
72
|
-
"test": "vitest run",
|
|
73
|
-
"test:watch": "vitest watch",
|
|
74
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
75
|
-
"clean": "rm -rf playground/.nuxt docs/.nuxt playground/.output docs/.output .nuxt"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
+
"packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b"
|
|
79
|
+
}
|