1
+ var BreathingColors =
2
+ /******/ ( function ( modules ) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = { } ;
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__ ( moduleId ) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if ( installedModules [ moduleId ] ) {
11
+ /******/ return installedModules [ moduleId ] . exports ;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules [ moduleId ] = {
15
+ /******/ i : moduleId ,
16
+ /******/ l : false ,
17
+ /******/ exports : { }
18
+ /******/ } ;
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules [ moduleId ] . call ( module . exports , module , module . exports , __webpack_require__ ) ;
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module . l = true ;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module . exports ;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__ . m = modules ;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__ . c = installedModules ;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__ . d = function ( exports , name , getter ) {
39
+ /******/ if ( ! __webpack_require__ . o ( exports , name ) ) {
40
+ /******/ Object . defineProperty ( exports , name , {
41
+ /******/ configurable : false ,
42
+ /******/ enumerable : true ,
43
+ /******/ get : getter
44
+ /******/ } ) ;
45
+ /******/ }
46
+ /******/ } ;
47
+ /******/
48
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
49
+ /******/ __webpack_require__ . n = function ( module ) {
50
+ /******/ var getter = module && module . __esModule ?
51
+ /******/ function getDefault ( ) { return module [ 'default' ] ; } :
52
+ /******/ function getModuleExports ( ) { return module ; } ;
53
+ /******/ __webpack_require__ . d ( getter , 'a' , getter ) ;
54
+ /******/ return getter ;
55
+ /******/ } ;
56
+ /******/
57
+ /******/ // Object.prototype.hasOwnProperty.call
58
+ /******/ __webpack_require__ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
59
+ /******/
60
+ /******/ // __webpack_public_path__
61
+ /******/ __webpack_require__ . p = "" ;
62
+ /******/
63
+ /******/ // Load entry module and return exports
64
+ /******/ return __webpack_require__ ( __webpack_require__ . s = 0 ) ;
65
+ /******/ } )
66
+ /************************************************************************/
67
+ /******/ ( [
68
+ /* 0 */
69
+ /***/ ( function ( module , exports , __webpack_require__ ) {
70
+
71
+ "use strict" ;
72
+
73
+
74
+ Object . defineProperty ( exports , "__esModule" , {
75
+ value : true
76
+ } ) ;
77
+
78
+ var _breathingColors = __webpack_require__ ( 1 ) ;
79
+
80
+ var _breathingColors2 = _interopRequireDefault ( _breathingColors ) ;
81
+
82
+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
83
+
84
+ var BreathingColors = {
85
+ install : function install ( Vue , options ) {
86
+ ( 0 , _breathingColors2 . default ) ( Vue ) ;
87
+ }
88
+ } ;
89
+
90
+ exports . default = BreathingColors ;
91
+
92
+ /***/ } ) ,
93
+ /* 1 */
94
+ /***/ ( function ( module , exports , __webpack_require__ ) {
95
+
96
+ "use strict" ;
97
+
98
+
99
+ Object . defineProperty ( exports , "__esModule" , {
100
+ value : true
101
+ } ) ;
102
+
103
+ var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
104
+
105
+ var validate = function validate ( colors , interval , transition ) {
106
+ if ( ! colors ) {
107
+ console . warn ( 'Breathing Colors Warn: Colors is ' + colors + '. Array of colors is required.' ) ;
108
+ return ;
109
+ }
110
+
111
+ if ( ! interval ) {
112
+ console . warn ( 'Breathing Colors Warn: Interval is ' + colors + '. Animation interval is required.' ) ;
113
+ return ;
114
+ }
115
+
116
+ if ( typeof interval !== 'number' ) {
117
+ console . warn ( 'Breathing Colors Warn: Interval expects a number got - ' + ( typeof interval === 'undefined' ? 'undefined' : _typeof ( interval ) ) + '.' ) ;
118
+ return ;
119
+ }
120
+
121
+ if ( ! transition ) {
122
+ console . warn ( 'Breathing Colors Warn: Transition object is ' + interval + '. Transition object required,.' ) ;
123
+ return ;
124
+ }
125
+
126
+ if ( ! transition . duration ) {
127
+ console . warn ( 'Breathing Colors Warn: Transition duration is ' + transition . duration + '. Transition duration is required.' ) ;
128
+ return ;
129
+ }
130
+
131
+ if ( typeof transition . duration !== 'number' ) {
132
+ console . warn ( 'Breathing Colors Warn: Transition duration expects a number got - ' + _typeof ( transition . duration ) + '.' ) ;
133
+ return ;
134
+ }
135
+
136
+ if ( ! transition . timing ) {
137
+ console . warn ( 'Breathing Colors Warn: Transition timing is ' + transition . timing + '. Transition object required.' ) ;
138
+ return ;
139
+ }
140
+ } ;
141
+
142
+ exports . default = function ( Vue ) {
143
+ Vue . directive ( 'breathing-colors' , {
144
+ inserted : function inserted ( el ) {
145
+ console . log ( el ) ;
146
+ } ,
147
+ bind : function bind ( el , binding , vnode ) {
148
+ var name = binding . name ,
149
+ value = binding . value ,
150
+ oldValue = binding . oldValue ,
151
+ expression = binding . expression ,
152
+ arg = binding . arg ,
153
+ modifiers = binding . modifiers ;
154
+ var colors = value . colors ,
155
+ interval = value . interval ,
156
+ transition = value . transition ;
157
+ var hover = modifiers . hover ,
158
+ random = modifiers . random ;
159
+
160
+
161
+ validate ( colors , interval , transition ) ;
162
+
163
+ var count = colors . length ;
164
+ colors = new Array ( colors ) [ 0 ] . reverse ( ) ;
165
+ transition = 'background-color ' + ( transition . duration || 1000 ) + 'ms ' + transition . timing + ' ' + ( transition . delay ? transition . delay + 'ms' : '' ) ;
166
+
167
+ el . style . backgroundColor = colors [ colors . length - 1 ] ;
168
+ el . style [ '-webkit-transition' ] = transition ;
169
+ el . style [ '-moz-transition' ] = transition ;
170
+ el . style [ '-o-transition' ] = transition ;
171
+ el . style . transition = transition ;
172
+
173
+ var animate = function animate ( ) {
174
+ if ( random ) {
175
+ var num = Math . round ( Math . random ( ) * colors . length ) ;
176
+ el . style . backgroundColor = colors [ num ] ;
177
+ } else {
178
+ el . style . backgroundColor = colors [ -- count ] ;
179
+ if ( count === 0 ) {
180
+ count = colors . length ;
181
+ }
182
+ }
183
+ } ;
184
+
185
+ if ( hover ) {
186
+ el . onmouseover = function ( ) {
187
+ animate ( ) ;
188
+ } ;
189
+ } else {
190
+ setInterval ( function ( ) {
191
+ animate ( ) ;
192
+ } , interval ) ;
193
+ }
194
+ }
195
+ } ) ;
196
+ } ;
197
+
198
+ /***/ } )
199
+ /******/ ] ) ;
0 commit comments