@enso-ui/transitions 2.0.7 → 2.0.11

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.7",
3
+ "version": "2.0.11",
4
4
  "description": "A collection of Vue transitions",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,33 +1,19 @@
1
1
  <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- mode="in-out"
5
- enter-active-class="animated fadeIn"
6
- leave-active-class="animated fadeOut">
7
- <div v-if="visible">
2
+ <mirror
3
+ effect="fade">
4
+ <template #default>
8
5
  <slot/>
9
- </div>
10
- </transition>
6
+ </template>
7
+ </mirror>
11
8
  </template>
12
9
 
13
10
  <script>
14
- export default {
15
- name: 'Fade',
16
-
17
- data: () => ({
18
- visible: false,
19
- }),
20
-
21
- mounted() {
22
- console.log('hit mounted')
23
- setTimeout(() => this.visible = true, 1000)
11
+ import Mirror from './Mirror.vue';
24
12
 
25
- },
26
-
27
- unmounted() {
28
- this.visible = false;
13
+ export default {
14
+ name: 'Fade',
29
15
 
30
- console.log('hit unmounted')
31
- }
16
+ components: { Mirror },
32
17
  };
18
+
33
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
+ computed: {
49
+ enterClass() {
50
+ const direction = this.enter
51
+ ? directions[this.enter.toLowerCase()]
52
+ : '';
53
+
54
+ return `animate__animated animate__${this.effect}In${direction}`;
55
+ },
56
+ leaveClass() {
57
+ const direction = this.leave
58
+ ? directions[this.leave.toLowerCase()]
59
+ : '';
60
+
61
+ return `animate__animated animate__${this.effect}Out${direction}`;
62
+ },
63
+ },
64
+
65
+ mounted() {
66
+ if (['back', 'slide'].includes(this.effect)
67
+ && !this.leave && !this.enter) {
68
+ throw Error('Missing direction for the given effect');
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,28 +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
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
2
+ <mirror
3
+ effect="zoom">
4
+ <template #default>
5
+ <slot/>
6
+ </template>
7
+ </mirror>
10
8
  </template>
11
9
 
12
10
  <script>
13
- export default {
14
- name: 'Zoom',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
11
+ import Mirror from './Mirror.vue';
19
12
 
20
- mounted() {
21
- this.visible = true;
22
- },
13
+ export default {
14
+ name: 'Zoom',
23
15
 
24
- unmounted() {
25
- this.visible = false;
26
- }
16
+ components: { Mirror },
27
17
  };
28
18
  </script>
@@ -1,28 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInDown"
5
- leave-active-class="animated fadeOutDown">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'FadeDown',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
- },
23
-
24
- unmounted() {
25
- this.visible = false;
26
- }
27
- };
28
- </script>
@@ -1,28 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInLeft"
5
- leave-active-class="animated fadeOutLeft">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'FadeLeft',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
- },
23
-
24
- unmounted() {
25
- this.visible = false;
26
- }
27
- };
28
- </script>
@@ -1,28 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInRight"
5
- leave-active-class="animated fadeOutRight">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'FadeRight',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
- },
23
-
24
- unmounted() {
25
- this.visible = false;
26
- }
27
- };
28
- </script>
@@ -1,28 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated fadeInUp"
5
- leave-active-class="animated fadeOutUp">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'FadeUp',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
- },
23
-
24
- unmounted() {
25
- this.visible = false;
26
- }
27
- };
28
- </script>
@@ -1,35 +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
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'HorizontalFade',
15
-
16
- props: {
17
- rtl: {
18
- type: Boolean,
19
- default: false,
20
- },
21
- },
22
-
23
- data: () => ({
24
- visible: false,
25
- }),
26
-
27
- mounted() {
28
- this.visible = true;
29
- },
30
-
31
- unmounted() {
32
- this.visible = false;
33
- }
34
- };
35
- </script>
@@ -1,35 +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
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'HorizontalSlide',
15
-
16
- props: {
17
- rtl: {
18
- type: Boolean,
19
- default: false,
20
- },
21
- },
22
-
23
- data: () => ({
24
- visible: false,
25
- }),
26
-
27
- mounted() {
28
- this.visible = true;
29
- },
30
-
31
- unmounted() {
32
- this.visible = false;
33
- }
34
- };
35
- </script>
@@ -1,28 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInDown"
5
- leave-active-class="animated slideOutUp">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'SlideDown',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
- },
23
-
24
- unmounted() {
25
- this.visible = false;
26
- }
27
- };
28
- </script>
@@ -1,32 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInLeft"
5
- leave-active-class="animated slideOutLeft">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'SlideLeft',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
-
23
- console.log('hit mounted SlideLeft')
24
- },
25
-
26
- unmounted() {
27
- this.visible = false;
28
-
29
- console.log('hit unmounted SlideLeft')
30
- }
31
- };
32
- </script>
@@ -1,28 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInRight"
5
- leave-active-class="animated slideOutRight">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'SlideRight',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
- },
23
-
24
- unmounted() {
25
- this.visible = false;
26
- }
27
- };
28
- </script>
@@ -1,28 +0,0 @@
1
- <template>
2
- <transition v-bind="$attrs"
3
- appear
4
- enter-active-class="animated slideInUp"
5
- leave-active-class="animated slideOutDown">
6
- <div v-if="visible">
7
- <slot/>
8
- </div>
9
- </transition>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- name: 'SlideUp',
15
-
16
- data: () => ({
17
- visible: false,
18
- }),
19
-
20
- mounted() {
21
- this.visible = true;
22
- },
23
-
24
- unmounted() {
25
- this.visible = false;
26
- }
27
- };
28
- </script>