@enso-ui/transitions 2.0.6 → 2.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/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.6",
3
+ "version": "2.0.10",
4
4
  "description": "A collection of Vue transitions",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,14 +1,19 @@
1
1
  <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeIn"
5
- leave-active-class="animated fadeOut">
6
- <slot/>
7
- </transition>
2
+ <mirror
3
+ effect="fade">
4
+ <template #default>
5
+ <slot/>
6
+ </template>
7
+ </mirror>
8
8
  </template>
9
9
 
10
10
  <script>
11
+ import Mirror from './Mirror.vue';
12
+
11
13
  export default {
12
- name: 'Fade',
13
- };
14
+ name: 'Fade',
15
+
16
+ components: { Mirror },
17
+ }
18
+
14
19
  </script>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <transition
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
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,14 +1,18 @@
1
1
  <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated zoomIn"
5
- leave-active-class="animated zoomOut">
6
- <slot/>
7
- </transition>
2
+ <mirror
3
+ effect="zoom">
4
+ <template #default>
5
+ <slot/>
6
+ </template>
7
+ </mirror>
8
8
  </template>
9
9
 
10
10
  <script>
11
+ import Mirror from './Mirror.vue';
12
+
11
13
  export default {
12
14
  name: 'Zoom',
15
+
16
+ components: { Mirror },
13
17
  };
14
18
  </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInDown"
5
- leave-active-class="animated fadeOutDown">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'FadeDown',
13
- };
14
- </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInLeft"
5
- leave-active-class="animated fadeOutLeft">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'FadeLeft',
13
- };
14
- </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInRight"
5
- leave-active-class="animated fadeOutRight">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'FadeRight',
13
- };
14
- </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInUp"
5
- leave-active-class="animated fadeOutUp">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'FadeUp',
13
- };
14
- </script>
@@ -1,21 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- :enter-active-class="`animated ${rtl ? 'fadeInRight' : 'fadeInLeft'}`"
5
- :leave-active-class="`animated ${rtl ? 'fadeOutRight' : 'fadeOutLeft'}`">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'HorizontalFade',
13
-
14
- props: {
15
- rtl: {
16
- type: Boolean,
17
- default: false,
18
- },
19
- },
20
- };
21
- </script>
@@ -1,21 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- :enter-active-class="`animated ${rtl ? 'slideInRight' : 'slideInLeft'}`"
5
- :leave-active-class="`animated ${rtl ? 'slideOutRight' : 'slideOutLeft'}`">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'HorizontalSlide',
13
-
14
- props: {
15
- rtl: {
16
- type: Boolean,
17
- default: false,
18
- },
19
- },
20
- };
21
- </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInDown"
5
- leave-active-class="animated slideOutUp">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'SlideDown',
13
- };
14
- </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInLeft"
5
- leave-active-class="animated slideOutLeft">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'SlideLeft',
13
- };
14
- </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInRight"
5
- leave-active-class="animated slideOutRight">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'SlideRight',
13
- };
14
- </script>
@@ -1,14 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInUp"
5
- leave-active-class="animated slideOutDown">
6
- <slot/>
7
- </transition>
8
- </template>
9
-
10
- <script>
11
- export default {
12
- name: 'SlideUp',
13
- };
14
- </script>