@noction/vue-bezier 1.0.8 → 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/dist/types/components/index.d.ts +11 -0
  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/vue-bezier.js +86 -75
  19. package/dist/web-types.json +1 -1
  20. package/package.json +2 -3
  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 -48
  38. package/src/vue-shim.d.ts +0 -5
@@ -1,65 +0,0 @@
1
- <template>
2
- <component
3
- :is="componentType"
4
- :tag="props.tag"
5
- enter-active-class="zoom-in-y"
6
- move-class="zoom-move"
7
- leave-active-class="zoom-out-y"
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
- 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(.55,0,.1,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 zoom-in-y {
41
- 0% {
42
- opacity: 0;
43
- transform: scaleY(0);
44
- }
45
-
46
- 50% {
47
- opacity: 1;
48
- transform: scaleY(1);
49
- }
50
- }
51
-
52
- @keyframes zoom-out-y {
53
- 0% { opacity: 1; }
54
-
55
- 50% {
56
- opacity: 0;
57
- transform: scaleY(0);
58
- }
59
-
60
- 100% { opacity: 0; }
61
- }
62
-
63
- .zoom-in-y { animation-name: zoom-in-y; }
64
- .zoom-out-y { animation-name: zoom-out-y; }
65
- </style>
@@ -1 +0,0 @@
1
- .zoom-move { transition: transform .3s ease-out; }
@@ -1,5 +0,0 @@
1
- import { ComponentProps } from '@/types'
2
- import { Component, Transition, TransitionGroup } from 'vue'
3
-
4
- export default (props: ComponentProps): Component =>
5
- props.group ? TransitionGroup : Transition
@@ -1,4 +0,0 @@
1
- import buildComponentType from './buildComponentType'
2
- import useHooks from './useHooks'
3
-
4
- export { buildComponentType, useHooks }
@@ -1,110 +0,0 @@
1
- import type { BaseTransitionProps, RendererElement } from 'vue'
2
- import type { ComponentProps, NumberOrTimings } from '@/types'
3
-
4
- function getTimingValue (timing: NumberOrTimings | undefined, key: 'enter' | 'leave'): number {
5
- if (typeof timing === 'number') {
6
- return timing
7
- }
8
-
9
- if (typeof timing === 'object' && timing !== null) {
10
- return timing[key] ?? 0
11
- }
12
-
13
- return 0
14
- }
15
-
16
- function beforeEnter (props: ComponentProps, el: RendererElement) {
17
- const enterDuration = getTimingValue(props.duration, 'enter')
18
- const enterDelay = getTimingValue(props.delay, 'enter')
19
-
20
- el.style.animationDuration = `${enterDuration}ms`
21
- el.style.animationDelay = `${enterDelay}ms`
22
-
23
- setStyles(props, el)
24
- }
25
-
26
- function beforeLeave (props: ComponentProps, el: RendererElement) {
27
- const leaveDuration = getTimingValue(props.duration, 'leave')
28
- const leaveDelay = getTimingValue(props.delay, 'leave')
29
-
30
- el.style.animationDuration = `${leaveDuration}ms`
31
- el.style.animationDelay = `${leaveDelay}ms`
32
-
33
- setStyles(props, el)
34
- }
35
-
36
- function leave (props: ComponentProps, el: RendererElement, done: () => void) {
37
- setAbsolutePosition(props, el)
38
-
39
- const leaveDuration = getTimingValue(props.duration, 'leave')
40
- const leaveDelay = getTimingValue(props.delay, 'leave')
41
-
42
- setTimeout(done, leaveDuration + leaveDelay)
43
- }
44
-
45
- function cleanUpStyles (props: ComponentProps, el: RendererElement) {
46
- if (props.styles) {
47
- Object
48
- .entries(props.styles)
49
- .forEach(([key]) => {
50
- if (key in el.style) {
51
- el.style[key] = ''
52
- }
53
- })
54
- }
55
-
56
- el.style.animationDuration = ''
57
- el.style.animationDelay = ''
58
- }
59
-
60
- function setStyles (props: ComponentProps, el: RendererElement) {
61
- setTransformOrigin(props, el)
62
-
63
- if (props.styles) {
64
- Object
65
- .entries(props.styles)
66
- .forEach(([key, value]) => {
67
- if (key in el.style) {
68
- el.style[key] = value
69
- }
70
- })
71
- }
72
- }
73
-
74
- function setAbsolutePosition (props: ComponentProps, el: RendererElement) {
75
- if (props.group) el.style.position = 'absolute'
76
- }
77
-
78
- function setTransformOrigin (props: ComponentProps, el: RendererElement) {
79
- if (props.origin) el.style.transformOrigin = props.origin
80
- }
81
-
82
- export default (props: ComponentProps, emit: any) => ({
83
- onAfterEnter: (el: RendererElement) => {
84
- cleanUpStyles(props, el)
85
- emit('after-enter', el)
86
- },
87
- onAfterLeave: (el: RendererElement) => {
88
- cleanUpStyles(props, el)
89
- emit('after-leave', el)
90
- },
91
- onBeforeEnter: (el: RendererElement) => {
92
- beforeEnter(props, el)
93
- emit('before-enter', el)
94
- },
95
- onBeforeLeave: (el: RendererElement) => {
96
- beforeLeave(props, el)
97
- emit('before-leave', el)
98
- },
99
- onLeave: (el: RendererElement, done: () => void) => {
100
- leave(props, el, done)
101
- emit('leave', el, done)
102
- }
103
- })
104
-
105
- export {
106
- getTimingValue,
107
- leave,
108
- setAbsolutePosition,
109
- setStyles
110
- }
package/src/main.ts DELETED
@@ -1,48 +0,0 @@
1
- import { App } from 'vue'
2
-
3
- import CollapseTransition from './components/Collapse/CollapseTransition.vue'
4
-
5
- import FadeTransition from './components/Fade/FadeTransition.vue'
6
-
7
- import ScaleTransition from './components/Scale/ScaleTransition.vue'
8
-
9
- import SlideXLeftTransition from './components/Slide/SlideXLeftTransition.vue'
10
- import SlideXRightTransition from './components/Slide/SlideXRightTransition.vue'
11
- import SlideYDownTransition from './components/Slide/SlideYDownTransition.vue'
12
- import SlideYUpTransition from './components/Slide/SlideYUpTransition.vue'
13
-
14
- import ZoomCenterTransition from './components/Zoom/ZoomCenterTransition.vue'
15
- import ZoomUpTransition from './components/Zoom/ZoomUpTransition.vue'
16
- import ZoomXTransition from './components/Zoom/ZoomXTransition.vue'
17
- import ZoomYTransition from './components/Zoom/ZoomYTransition.vue'
18
-
19
- export const components = {
20
- CollapseTransition,
21
- FadeTransition,
22
- ScaleTransition,
23
- SlideXLeftTransition,
24
- SlideXRightTransition,
25
- SlideYDownTransition,
26
- SlideYUpTransition,
27
- ZoomCenterTransition,
28
- ZoomUpTransition,
29
- ZoomXTransition,
30
- ZoomYTransition
31
- }
32
-
33
- export function install (app: App) {
34
- // @ts-expect-error it's a custom flag
35
- if (app.$_vueBezierInstalled) return
36
- // @ts-expect-error it's a custom flag
37
- app.$_vueBezierInstalled = true
38
-
39
- Object
40
- .entries(components)
41
- .forEach(([key, component]) =>
42
- app.component(key, component)
43
- )
44
- }
45
-
46
- export default {
47
- install
48
- }
package/src/vue-shim.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /* eslint-disable */
2
- declare module '*.vue' {
3
- const component: any
4
- export default component
5
- }