@noction/vue-bezier 1.0.9 → 1.10.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.
Files changed (38) hide show
  1. package/dist/types/components/Collapse/CollapseTransition.vue.d.ts +66 -0
  2. package/dist/types/components/Fade/FadeTransition.vue.d.ts +66 -0
  3. package/dist/types/components/Scale/ScaleTransition.vue.d.ts +66 -0
  4. package/dist/types/components/Slide/SlideXLeftTransition.vue.d.ts +66 -0
  5. package/dist/types/components/Slide/SlideXRightTransition.vue.d.ts +66 -0
  6. package/dist/types/components/Slide/SlideYDownTransition.vue.d.ts +66 -0
  7. package/dist/types/components/Slide/SlideYUpTransition.vue.d.ts +66 -0
  8. package/dist/types/components/Zoom/ZoomCenterTransition.vue.d.ts +66 -0
  9. package/dist/types/components/Zoom/ZoomUpTransition.vue.d.ts +66 -0
  10. package/dist/types/components/Zoom/ZoomXTransition.vue.d.ts +66 -0
  11. package/dist/types/components/Zoom/ZoomYTransition.vue.d.ts +66 -0
  12. package/{src/components/index.ts → dist/types/components/index.d.ts} +0 -9
  13. package/dist/types/composables/buildComponentType.d.ts +4 -0
  14. package/dist/types/composables/index.d.ts +3 -0
  15. package/dist/types/composables/useHooks.d.ts +15 -0
  16. package/dist/types/main.d.ts +7 -0
  17. package/{src/types/index.ts → dist/types/types/index.d.ts} +10 -19
  18. package/dist/web-types.json +1 -1
  19. package/package.json +17 -17
  20. package/LICENSE +0 -21
  21. package/src/components/Collapse/CollapseTransition.vue +0 -127
  22. package/src/components/Fade/FadeTransition.vue +0 -52
  23. package/src/components/Scale/ScaleTransition.vue +0 -61
  24. package/src/components/Slide/SlideXLeftTransition.vue +0 -62
  25. package/src/components/Slide/SlideXRightTransition.vue +0 -60
  26. package/src/components/Slide/SlideYDownTransition.vue +0 -59
  27. package/src/components/Slide/SlideYUpTransition.vue +0 -61
  28. package/src/components/Slide/move.scss +0 -1
  29. package/src/components/Zoom/ZoomCenterTransition.vue +0 -62
  30. package/src/components/Zoom/ZoomUpTransition.vue +0 -63
  31. package/src/components/Zoom/ZoomXTransition.vue +0 -64
  32. package/src/components/Zoom/ZoomYTransition.vue +0 -65
  33. package/src/components/Zoom/move.scss +0 -1
  34. package/src/composables/buildComponentType.ts +0 -5
  35. package/src/composables/index.ts +0 -4
  36. package/src/composables/useHooks.ts +0 -110
  37. package/src/main.ts +0 -20
  38. package/src/vue-shim.d.ts +0 -5
@@ -0,0 +1,66 @@
1
+ import type { ComponentProps } from '@/types';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ComponentProps>, {
3
+ delay: number;
4
+ duration: number;
5
+ group: boolean;
6
+ origin: string;
7
+ styles: () => {
8
+ animationFillMode: string;
9
+ animationTimingFunction: string;
10
+ };
11
+ tag: string;
12
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ leave: (el: import("vue").RendererElement, done: () => void) => void;
14
+ "after-enter": (el: import("vue").RendererElement) => void;
15
+ "after-leave": (el: import("vue").RendererElement) => void;
16
+ "before-enter": (el: import("vue").RendererElement) => void;
17
+ "before-leave": (el: import("vue").RendererElement) => void;
18
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ComponentProps>, {
19
+ delay: number;
20
+ duration: number;
21
+ group: boolean;
22
+ origin: string;
23
+ styles: () => {
24
+ animationFillMode: string;
25
+ animationTimingFunction: string;
26
+ };
27
+ tag: string;
28
+ }>>> & {
29
+ onLeave?: ((el: import("vue").RendererElement, done: () => void) => any) | undefined;
30
+ "onAfter-enter"?: ((el: import("vue").RendererElement) => any) | undefined;
31
+ "onAfter-leave"?: ((el: import("vue").RendererElement) => any) | undefined;
32
+ "onBefore-enter"?: ((el: import("vue").RendererElement) => any) | undefined;
33
+ "onBefore-leave"?: ((el: import("vue").RendererElement) => any) | undefined;
34
+ }, {
35
+ delay: import("@/types").NumberOrTimings;
36
+ duration: import("@/types").NumberOrTimings;
37
+ group: boolean;
38
+ origin: string;
39
+ styles: Partial<CSSStyleDeclaration>;
40
+ tag: string;
41
+ }, {}>, {
42
+ default?(_: {}): any;
43
+ }>;
44
+ export default _default;
45
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
46
+ type __VLS_TypePropsToRuntimeProps<T> = {
47
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
48
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
49
+ } : {
50
+ type: import('vue').PropType<T[K]>;
51
+ required: true;
52
+ };
53
+ };
54
+ type __VLS_WithDefaults<P, D> = {
55
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
56
+ default: D[K];
57
+ }> : P[K];
58
+ };
59
+ type __VLS_Prettify<T> = {
60
+ [K in keyof T]: T[K];
61
+ } & {};
62
+ type __VLS_WithTemplateSlots<T, S> = T & {
63
+ new (): {
64
+ $slots: S;
65
+ };
66
+ };
@@ -1,19 +1,10 @@
1
- // Exporting components from Collapse directory
2
1
  export { default as CollapseTransition } from './Collapse/CollapseTransition.vue';
3
-
4
- // Exporting components from Fade directory
5
2
  export { default as FadeTransition } from './Fade/FadeTransition.vue';
6
-
7
- // Exporting components from Scale directory
8
3
  export { default as ScaleTransition } from './Scale/ScaleTransition.vue';
9
-
10
- // Exporting components from Slide directory
11
4
  export { default as SlideXLeftTransition } from './Slide/SlideXLeftTransition.vue';
12
5
  export { default as SlideXRightTransition } from './Slide/SlideXRightTransition.vue';
13
6
  export { default as SlideYDownTransition } from './Slide/SlideYDownTransition.vue';
14
7
  export { default as SlideYUpTransition } from './Slide/SlideYUpTransition.vue';
15
-
16
- // Exporting components from Zoom directory
17
8
  export { default as ZoomCenterTransition } from './Zoom/ZoomCenterTransition.vue';
18
9
  export { default as ZoomUpTransition } from './Zoom/ZoomUpTransition.vue';
19
10
  export { default as ZoomXTransition } from './Zoom/ZoomXTransition.vue';
@@ -0,0 +1,4 @@
1
+ import { ComponentProps } from '@/types';
2
+ import { Component } from 'vue';
3
+ declare const _default: (props: ComponentProps) => Component;
4
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import buildComponentType from './buildComponentType';
2
+ import useHooks from './useHooks';
3
+ export { buildComponentType, useHooks };
@@ -0,0 +1,15 @@
1
+ import type { RendererElement } from 'vue';
2
+ import type { ComponentProps, NumberOrTimings } from '@/types';
3
+ declare function getTimingValue(timing: NumberOrTimings | undefined, key: 'enter' | 'leave'): number;
4
+ declare function leave(props: ComponentProps, el: RendererElement, done: () => void): void;
5
+ declare function setStyles(props: ComponentProps, el: RendererElement): void;
6
+ declare function setAbsolutePosition(props: ComponentProps, el: RendererElement): void;
7
+ declare const _default: (props: ComponentProps, emit: any) => {
8
+ onAfterEnter: (el: RendererElement) => void;
9
+ onAfterLeave: (el: RendererElement) => void;
10
+ onBeforeEnter: (el: RendererElement) => void;
11
+ onBeforeLeave: (el: RendererElement) => void;
12
+ onLeave: (el: RendererElement, done: () => void) => void;
13
+ };
14
+ export default _default;
15
+ export { getTimingValue, leave, setAbsolutePosition, setStyles };
@@ -0,0 +1,7 @@
1
+ export * from './components';
2
+ import type { App } from 'vue';
3
+ export declare function install(app: App): void;
4
+ declare const _default: {
5
+ install: typeof install;
6
+ };
7
+ export default _default;
@@ -1,53 +1,44 @@
1
- import { RendererElement } from 'vue'
2
-
1
+ import { RendererElement } from 'vue';
3
2
  export type ComponentEvents = {
4
- 'after-enter': [el: RendererElement],
5
- 'after-leave': [el: RendererElement],
6
- 'before-enter': [el: RendererElement],
7
- 'before-leave': [el: RendererElement],
8
- 'leave': [el: RendererElement, done: () => void]
9
- }
10
-
3
+ 'after-enter': [el: RendererElement];
4
+ 'after-leave': [el: RendererElement];
5
+ 'before-enter': [el: RendererElement];
6
+ 'before-leave': [el: RendererElement];
7
+ 'leave': [el: RendererElement, done: () => void];
8
+ };
11
9
  export type ComponentProps = {
12
10
  /**
13
11
  * Transition delay. Number for specifying the same delay for enter/leave transitions
14
12
  * Object style {enter: 300, leave: 300} for specifying explicit durations for enter/leave
15
13
  */
16
14
  delay?: NumberOrTimings;
17
-
18
15
  /**
19
16
  * Transition duration. Number for specifying the same duration for enter/leave transitions
20
17
  * Object style {enter: 300, leave: 300} for specifying explicit durations for enter/leave
21
18
  */
22
19
  duration?: NumberOrTimings;
23
-
24
20
  /**
25
21
  * Whether the component should be a `transition-group` component.
26
22
  */
27
23
  group?: boolean;
28
-
29
24
  /**
30
25
  * Transform origin property https://tympanus.net/codrops/css_reference/transform-origin/.
31
26
  * Can be specified with styles as well, but it's shorter with this prop
32
27
  */
33
28
  origin?: string;
34
-
35
29
  /**
36
30
  * Element styles that are applied during transition. These styles are applied on @beforeEnter and @beforeLeave hooks
37
31
  */
38
32
  styles?: Styles;
39
-
40
33
  /**
41
34
  * Transition tag, in case the component is a `transition-group`
42
35
  */
43
36
  tag?: string;
44
- }
45
-
37
+ };
46
38
  type TransitionTimings = {
47
39
  enter: number;
48
40
  leave: number;
49
- }
50
-
41
+ };
51
42
  type Styles = Partial<CSSStyleDeclaration>;
52
-
53
43
  export type NumberOrTimings = number | TransitionTimings;
44
+ export {};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "@noction/vue-bezier",
4
- "version": "1.0.9",
4
+ "version": "1.10.0",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noction/vue-bezier",
3
- "version": "1.0.9",
3
+ "version": "1.10.0",
4
4
  "description": "Vue3 reusable transition components",
5
5
  "keywords": [
6
6
  "transitions",
@@ -25,8 +25,7 @@
25
25
  "email": "soryngitlan@gmail.com"
26
26
  },
27
27
  "files": [
28
- "dist",
29
- "src"
28
+ "dist"
30
29
  ],
31
30
  "exports": {
32
31
  ".": "./dist/vue-bezier.js",
@@ -39,6 +38,19 @@
39
38
  "module": "dist/vue-bezier.js",
40
39
  "types": "dist/types/main.d.ts",
41
40
  "type": "module",
41
+ "scripts": {
42
+ "dev": "cross-env NODE_ENV=development vite build --watch",
43
+ "build:light": "cross-env NODE_ENV=development vite build",
44
+ "prebuild": "vue-tsc -p tsconfig.build.json",
45
+ "build": "vite build",
46
+ "postbuild": "vue-docgen-web-types",
47
+ "prepublishOnly": "npm run build",
48
+ "lint:es": "eslint \"src/**/*.{js,ts,vue}\" --fix --color",
49
+ "lint:style": "stylelint src/**/*.{css,scss,vue} --color --fix",
50
+ "test": "vitest",
51
+ "test:coverage": "vitest run --coverage",
52
+ "type:check": "vue-tsc --noEmit"
53
+ },
42
54
  "devDependencies": {
43
55
  "@faker-js/faker": "^8.3.1",
44
56
  "@types/node": "^20.10.5",
@@ -55,17 +67,5 @@
55
67
  "vue-tsc": "^1.8.27",
56
68
  "vue-docgen-web-types": "^0.1.8"
57
69
  },
58
- "web-types": "./dist/web-types.json",
59
- "scripts": {
60
- "dev": "cross-env NODE_ENV=development vite build --watch",
61
- "build:light": "cross-env NODE_ENV=development vite build",
62
- "prebuild": "vue-tsc -p tsconfig.build.json",
63
- "build": "vite build",
64
- "postbuild": "vue-docgen-web-types",
65
- "lint:es": "eslint \"src/**/*.{js,ts,vue}\" --fix --color",
66
- "lint:style": "stylelint src/**/*.{css,scss,vue} --color --fix",
67
- "test": "vitest",
68
- "test:coverage": "vitest run --coverage",
69
- "type:check": "vue-tsc --noEmit"
70
- }
71
- }
70
+ "web-types": "./dist/web-types.json"
71
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019-PRESENT Noction<sales@noction.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,127 +0,0 @@
1
- <template>
2
- <component
3
- :is="componentType"
4
- :tag="props.tag"
5
- v-bind="{ ...$attrs, ...hooks }"
6
- move-class="collapse-move"
7
- >
8
- <slot />
9
- </component>
10
- </template>
11
-
12
- <script setup lang="ts">
13
- import { BaseTransitionProps } from 'vue'
14
- import { buildComponentType } from '../../composables'
15
- import type { ComponentEvents, ComponentProps } from '@/types'
16
- import { getTimingValue, leave, setAbsolutePosition, setStyles } from '@/composables/useHooks'
17
-
18
- const props = withDefaults(defineProps<ComponentProps>(), {
19
- delay: 0,
20
- duration: 300,
21
- group: false,
22
- origin: '',
23
- styles: () => ({
24
- animationFillMode: 'both',
25
- animationTimingFunction: 'ease-out'
26
- }),
27
- tag: 'span'
28
- })
29
- const emit = defineEmits<ComponentEvents>()
30
-
31
- const componentType = buildComponentType(props)
32
-
33
- const hooks: BaseTransitionProps = {
34
- onAfterEnter (el) {
35
- // for safari: remove class then reset height is necessary
36
- el.style.transition = ''
37
- el.style.height = ''
38
- el.style.overflow = el.dataset.oldOverflow
39
-
40
- emit('after-enter', el)
41
- },
42
- onAfterLeave (el) {
43
- el.style.transition = ''
44
- el.style.height = ''
45
- el.style.overflow = el.dataset.oldOverflow
46
- el.style.paddingTop = el.dataset.oldPaddingTop
47
- el.style.paddingBottom = el.dataset.oldPaddingBottom
48
-
49
- emit('after-leave', el)
50
- },
51
- onBeforeEnter (el) {
52
- const enterDuration = getTimingValue(props.duration, 'enter')
53
-
54
- el.style.transition = transitionStyle(enterDuration)
55
-
56
- if (!el.dataset) el.dataset = {}
57
-
58
- el.dataset.oldPaddingTop = el.style.paddingTop
59
- el.dataset.oldPaddingBottom = el.style.paddingBottom
60
-
61
- el.style.height = '0'
62
- el.style.paddingTop = 0
63
- el.style.paddingBottom = 0
64
-
65
- setStyles(props, el)
66
-
67
- emit('before-enter', el)
68
- },
69
- onBeforeLeave (el) {
70
- if (!el.dataset) el.dataset = {}
71
-
72
- el.dataset.oldPaddingTop = el.style.paddingTop
73
- el.dataset.oldPaddingBottom = el.style.paddingBottom
74
- el.dataset.oldOverflow = el.style.overflow
75
-
76
- el.style.height = `${el.scrollHeight}px`
77
- el.style.overflow = 'hidden'
78
-
79
- setStyles(props, el)
80
-
81
- emit('before-leave', el)
82
- },
83
- onEnter (el) {
84
- el.dataset.oldOverflow = el.style.overflow
85
-
86
- if (el.scrollHeight !== 0) {
87
- el.style.height = `${el.scrollHeight}px`
88
- el.style.paddingTop = el.dataset.oldPaddingTop
89
- el.style.paddingBottom = el.dataset.oldPaddingBottom
90
- } else {
91
- el.style.height = ''
92
- el.style.paddingTop = el.dataset.oldPaddingTop
93
- el.style.paddingBottom = el.dataset.oldPaddingBottom
94
- }
95
-
96
- el.style.overflow = 'hidden'
97
- },
98
- onLeave (el, done: () => void) {
99
- const leaveDuration = getTimingValue(props.duration, 'leave')
100
-
101
- if (el.scrollHeight !== 0) {
102
- // for safari: add class after set height, or it will jump to zero height suddenly, weired
103
- el.style.transition = transitionStyle(leaveDuration)
104
- el.style.height = 0
105
- el.style.paddingTop = 0
106
- el.style.paddingBottom = 0
107
- }
108
-
109
- // necessary for transition-group
110
- setAbsolutePosition(props, el)
111
-
112
- leave(props, el, done)
113
- emit('leave', el, done)
114
- }
115
- }
116
-
117
- const transitionStyle = (duration: number) => {
118
- const durationInSeconds = duration / 1000
119
-
120
- return `${durationInSeconds}s height ease-in-out, ${durationInSeconds}s padding-top ease-in-out, ${durationInSeconds}s padding-bottom ease-in-out`
121
- }
122
-
123
- </script>
124
-
125
- <style>
126
- .collapse-move { transition: transform .3s ease-in-out; }
127
- </style>
@@ -1,52 +0,0 @@
1
- <template>
2
- <component
3
- :is="componentType"
4
- :tag="props.tag"
5
- enter-active-class="fade-in"
6
- move-class="fade-move"
7
- leave-active-class="fade-out"
8
- v-bind="{ ...$attrs, ...hooks }"
9
- >
10
- <slot />
11
- </component>
12
- </template>
13
-
14
- <script setup lang="ts">
15
- import type { ComponentEvents, ComponentProps } from '@/types'
16
- import { buildComponentType, useHooks } from '@/composables'
17
-
18
- defineOptions({ inheritAttrs: false })
19
-
20
- const props = withDefaults(defineProps<ComponentProps>(), {
21
- delay: 0,
22
- duration: 300,
23
- group: false,
24
- origin: '',
25
- styles: () => ({
26
- animationFillMode: 'both',
27
- animationTimingFunction: 'ease-out'
28
- }),
29
- tag: 'span'
30
- })
31
- const emit = defineEmits<ComponentEvents>()
32
-
33
- const componentType = buildComponentType(props)
34
- const hooks = useHooks(props, emit)
35
-
36
- </script>
37
-
38
- <style>
39
- @keyframes fade-in {
40
- from { opacity: 0; }
41
- to { opacity: 1; }
42
- }
43
-
44
- @keyframes fade-out {
45
- from { opacity: 1; }
46
- to { opacity: 0; }
47
- }
48
-
49
- .fade-in { animation-name: fade-in; }
50
- .fade-out { animation-name: fade-out; }
51
- .fade-move { transition: transform .3s ease-out; }
52
- </style>
@@ -1,61 +0,0 @@
1
- <template>
2
- <component
3
- :is="componentType"
4
- :tag="props.tag"
5
- v-bind="{ ...$attrs, ...hooks }"
6
- enter-active-class="scale-in"
7
- move-class="scale-move"
8
- leave-active-class="scale-out"
9
- >
10
- <slot />
11
- </component>
12
- </template>
13
-
14
- <script setup lang="ts">
15
- import type { ComponentEvents, ComponentProps } from '@/types'
16
- import { buildComponentType, useHooks } from '@/composables'
17
-
18
- defineOptions({ inheritAttrs: false })
19
-
20
- const props = withDefaults(defineProps<ComponentProps>(), {
21
- delay: 0,
22
- duration: 300,
23
- group: false,
24
- origin: 'top left',
25
- styles: () => ({
26
- animationFillMode: 'both',
27
- animationTimingFunction: 'cubic-bezier(.25,.8,.50,1)'
28
- }),
29
- tag: 'span'
30
- })
31
-
32
- const emit = defineEmits<ComponentEvents>()
33
-
34
- const componentType = buildComponentType(props)
35
- const hooks = useHooks(props, emit)
36
-
37
- </script>
38
-
39
- <style>
40
- @keyframes scale-in {
41
- from {
42
- opacity: 0;
43
- transform: scale(0);
44
- }
45
-
46
- to { opacity: 1; }
47
- }
48
-
49
- @keyframes scale-out {
50
- from { opacity: 1; }
51
-
52
- to {
53
- opacity: 0;
54
- transform: scale(0);
55
- }
56
- }
57
-
58
- .scale-in { animation-name: scale-in; }
59
- .scale-out { animation-name: scale-out; }
60
- .scale-move { transition: transform .3s cubic-bezier(.25, .8, .5, 1); }
61
- </style>
@@ -1,62 +0,0 @@
1
- <template>
2
- <component
3
- :is="componentType"
4
- :tag="props.tag"
5
- v-bind="{ ...$attrs, ...hooks }"
6
- enter-active-class="slide-x-left-in"
7
- move-class="slide-move"
8
- leave-active-class="slide-x-left-out"
9
- >
10
- <slot />
11
- </component>
12
- </template>
13
-
14
- <script setup lang="ts">
15
- import type { ComponentEvents, ComponentProps } from '@/types'
16
- import { buildComponentType, useHooks } from '@/composables'
17
-
18
- defineOptions({ inheritAttrs: false })
19
-
20
- const props = withDefaults(defineProps<ComponentProps>(), {
21
- delay: 0,
22
- duration: 300,
23
- group: false,
24
- origin: '',
25
- styles: () => ({
26
- animationFillMode: 'both',
27
- animationTimingFunction: 'cubic-bezier(.25,.8,.50,1)'
28
- }),
29
- tag: 'span'
30
- })
31
-
32
- const emit = defineEmits<ComponentEvents>()
33
-
34
- const componentType = buildComponentType(props)
35
- const hooks = useHooks(props, emit)
36
-
37
- </script>
38
-
39
- <style lang="scss">
40
- @import 'move';
41
-
42
- @keyframes slide-x-left-in {
43
- from {
44
- opacity: 0;
45
- transform: translateX(-15px);
46
- }
47
-
48
- to { opacity: 1; }
49
- }
50
-
51
- @keyframes slide-x-left-out {
52
- from { opacity: 1; }
53
-
54
- to {
55
- opacity: 0;
56
- transform: translateX(-15px);
57
- }
58
- }
59
-
60
- .slide-x-left-in { animation-name: slide-x-left-in; }
61
- .slide-x-left-out { animation-name: slide-x-left-out; }
62
- </style>
@@ -1,60 +0,0 @@
1
- <template>
2
- <component
3
- :is="componentType"
4
- :tag="props.tag"
5
- v-bind="{ ...$attrs, ...hooks }"
6
- enter-active-class="slide-x-right-in"
7
- move-class="slide-move"
8
- leave-active-class="slide-x-right-out"
9
- >
10
- <slot />
11
- </component>
12
- </template>
13
-
14
- <script setup lang="ts">
15
- import type { ComponentEvents, ComponentProps } from '@/types'
16
- import { buildComponentType, useHooks } from '@/composables'
17
-
18
- defineOptions({ inheritAttrs: false })
19
- const props = withDefaults(defineProps<ComponentProps>(), {
20
- delay: 0,
21
- duration: 300,
22
- group: false,
23
- origin: '',
24
- styles: () => ({
25
- animationFillMode: 'both',
26
- animationTimingFunction: 'cubic-bezier(.25,.8,.50,1)'
27
- }),
28
- tag: 'span'
29
- })
30
- const emit = defineEmits<ComponentEvents>()
31
-
32
- const componentType = buildComponentType(props)
33
- const hooks = useHooks(props, emit)
34
-
35
- </script>
36
-
37
- <style lang="scss">
38
- @import 'move';
39
-
40
- @keyframes slide-x-right-in {
41
- from {
42
- opacity: 0;
43
- transform: translateX(15px);
44
- }
45
-
46
- to { opacity: 1; }
47
- }
48
-
49
- @keyframes slide-x-right-out {
50
- from { opacity: 1; }
51
-
52
- to {
53
- opacity: 0;
54
- transform: translateX(15px);
55
- }
56
- }
57
-
58
- .slide-x-right-in { animation-name: slide-x-right-in; }
59
- .slide-x-right-out { animation-name: slide-x-right-out; }
60
- </style>