@enso-ui/transitions 2.0.8 → 2.0.9

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/index.js CHANGED
@@ -1,17 +1,5 @@
1
1
  import Fade from './src/transitions/Fade.vue';
2
- import FadeLeft from './src/transitions/FadeLeft.vue';
3
- import FadeRight from './src/transitions/FadeRight.vue';
4
- import FadeUp from './src/transitions/FadeUp.vue';
5
- import FadeDown from './src/transitions/FadeDown.vue';
6
- import SlideLeft from './src/transitions/SlideLeft.vue';
7
- import SlideRight from './src/transitions/SlideRight.vue';
8
- import SlideUp from './src/transitions/SlideUp.vue';
9
- import SlideDown from './src/transitions/SlideDown.vue';
10
2
  import Zoom from './src/transitions/Zoom.vue';
11
- import HorizontalSlide from './src/transitions/HorizontalSlide.vue';
12
- import HorizontalFade from './src/transitions/HorizontalFade.vue';
3
+ import Slide from './src/transitions/Slide.vue';
13
4
 
14
- export {
15
- Fade, SlideLeft, SlideRight, SlideUp, SlideDown, FadeLeft,
16
- FadeRight, FadeUp, FadeDown, Zoom, HorizontalSlide, HorizontalFade,
17
- };
5
+ export { Fade, Zoom, Slide };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enso-ui/transitions",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "A collection of Vue transitions",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,17 +1,19 @@
1
1
  <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- mode="in-out"
5
- enter-active-class="animate__animated animate__fadeIn"
6
- leave-active-class="animate__animated animate__fadeOut">
2
+ <mirror v-bind="$attrs"
3
+ effect="fade">
4
+ <template #default>
7
5
  <slot/>
8
- </transition>
6
+ </template>
7
+ </mirror>
9
8
  </template>
10
9
 
11
10
  <script>
12
- import 'animate.css';
11
+ import Mirror from './Mirror.vue';
13
12
 
14
13
  export default {
15
14
  name: 'Fade',
16
- };
15
+
16
+ components: { Mirror },
17
+ }
18
+
17
19
  </script>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <transition v-bind="$attrs"
3
+ appear
4
+ :enter-active-class="enterClass"
5
+ :leave-active-class="leaveClass">
6
+ <slot/>
7
+ </transition>
8
+ </template>
9
+
10
+ <script>
11
+ import 'animate.css';
12
+
13
+ const directions = {
14
+ 'up': 'Up',
15
+ 'down': 'Down',
16
+ 'left': 'Left',
17
+ 'right': 'Right',
18
+ };
19
+
20
+ const effects = ['back', 'bounce', 'fade', 'slide', 'zoom'];
21
+
22
+ const validateDirection = direction => Object.keys(directions)
23
+ .includes(direction.toLowerCase());
24
+
25
+ const validateEffect = effect => effects.includes(effect);
26
+
27
+ export default {
28
+ name: 'Mirror',
29
+
30
+ props: {
31
+ enter: {
32
+ type: String,
33
+ default: null,
34
+ validator: validateDirection,
35
+ },
36
+ leave: {
37
+ type: String,
38
+ default: null,
39
+ validator: validateDirection,
40
+ },
41
+ effect: {
42
+ type: String,
43
+ required: true,
44
+ validator: validateEffect,
45
+ }
46
+ },
47
+
48
+ mounted() {
49
+ if (['back','slide'].includes(this.effect)
50
+ && !this.leave && !this.enter) {
51
+ throw 'Missing direction for the given effect';
52
+ }
53
+ },
54
+
55
+ computed: {
56
+ enterClass() {
57
+ const direction = this.enter
58
+ ? directions[this.enter.toLowerCase()]
59
+ : '';
60
+
61
+ return `animate__animated animate__${this.effect}In${direction}`;
62
+ },
63
+ leaveClass() {
64
+ const direction = this.leave
65
+ ? directions[this.leave.toLowerCase()]
66
+ : '';
67
+
68
+ return `animate__animated animate__${this.effect}Out${direction}`;
69
+ }
70
+ }
71
+ };
72
+ </script>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <mirror v-bind="$attrs"
3
+ effect="slide">
4
+ <template #default>
5
+ <slot/>
6
+ </template>
7
+ </mirror>
8
+ </template>
9
+
10
+ <script>
11
+ import Mirror from './Mirror.vue';
12
+
13
+ export default {
14
+ name: 'Slide',
15
+
16
+ components: { Mirror },
17
+ }
18
+
19
+ </script>
@@ -1,16 +1,18 @@
1
1
  <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__zoomIn"
5
- leave-active-class="animate__animated animate__zoomOut">
6
- <slot/>
7
- </transition>
2
+ <mirror v-bind="$attrs"
3
+ effect="zoom">
4
+ <template #default>
5
+ <slot/>
6
+ </template>
7
+ </mirror>
8
8
  </template>
9
9
 
10
10
  <script>
11
- import 'animate.css';
11
+ import Mirror from './Mirror.vue';
12
12
 
13
13
  export default {
14
- name: 'Zoom',
14
+ name: 'Zoom',
15
+
16
+ components: { Mirror },
15
17
  };
16
18
  </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__fadeInDown"
5
- leave-active-class="animate__animated animate__fadeOutDown">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'FadeDown',
15
- };
16
- </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__fadeInLeft"
5
- leave-active-class="animate__animated animate__fadeOutLeft">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'FadeLeft',
15
- };
16
- </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__fadeInRight"
5
- leave-active-class="animate__animated animate__fadeOutRight">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'FadeRight',
15
- };
16
- </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__fadeInUp"
5
- leave-active-class="animate__animated animate__fadeOutUp">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'FadeUp',
15
- };
16
- </script>
@@ -1,23 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- :enter-active-class="`animate__animated animate__${rtl ? 'fadeInRight' : 'fadeInLeft'}`"
5
- :leave-active-class="`animate__animated animate__${rtl ? 'fadeOutRight' : 'fadeOutLeft'}`">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'HorizontalFade',
15
-
16
- props: {
17
- rtl: {
18
- type: Boolean,
19
- default: false,
20
- },
21
- },
22
- };
23
- </script>
@@ -1,23 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- :enter-active-class="`animate__animated animate__${rtl ? 'slideInRight' : 'slideInLeft'}`"
5
- :leave-active-class="`animate__animated animate__${rtl ? 'slideOutRight' : 'slideOutLeft'}`">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'HorizontalSlide',
15
-
16
- props: {
17
- rtl: {
18
- type: Boolean,
19
- default: false,
20
- },
21
- },
22
- };
23
- </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__slideInDown"
5
- leave-active-class="animate__animated animate__slideOutUp">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'SlideDown',
15
- };
16
- </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__slideInLeft"
5
- leave-active-class="animate__animated animate__slideOutLeft">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'SlideLeft',
15
- };
16
- </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__slideInRight"
5
- leave-active-class="animate__animated animate__slideOutRight">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'SlideRight',
15
- };
16
- </script>
@@ -1,16 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animate__animated animate__slideInUp"
5
- leave-active-class="animate__animated animate__slideOutDown">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- import 'animate.css';
12
-
13
- export default {
14
- name: 'SlideUp',
15
- };
16
- </script>