vuejs 1.0.33 → 1.0.34
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.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/lib/vuejs.rb +2 -2
- data/lib/vuejs/version.rb +1 -1
- data/vendor/assets/javascripts/vuex.js +353 -120
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d5c6c9edac113ae4bd1656d8a2cd6b20838f3437
         | 
| 4 | 
            +
              data.tar.gz: 7601868502a4a78527d23db450b374cd4ab88703
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b81e2e921996d5d43a344c34972b196aeaef9300936c493128f7a918588665321b1483541c3212c5f9ed30c9273bec073afcf80d6a6973a3d2b526d362d13694
         | 
| 7 | 
            +
              data.tar.gz: 51a470745423d960a40460b1d9c77c0cf1c36a7caa45374829dc95d6b55ea5b19869012efd3544fa70ade66999ceb0b76c10ce007fc7cf59543c46e0ca7fc614
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,12 +1,13 @@ | |
| 1 | 
            -
            # Vuejs
         | 
| 1 | 
            +
            # Vuejs Gem
         | 
| 2 2 |  | 
| 3 3 | 
             
            > Reactive Components for Modern Web Interfaces
         | 
| 4 4 |  | 
| 5 5 | 
             
            gem `vuejs` ships with the 1.x & 2.x latest [Vue.js + vue-router + vue-resource + vue-validator + vuex](http://vuejs.org/) and integrate with Rails' asset pipeline. Vue.js is created by Evan You and the vuejs team.
         | 
| 6 6 |  | 
| 7 | 
            -
            The current 2.x version is `Vue.js` (v2.1. | 
| 7 | 
            +
            The current 2.x version is `Vue.js` (v2.1.6) + `vue-router` (v2.1.1) + `vue-validator` (v2.1.3) + `vuex` (v2.1.1).
         | 
| 8 8 | 
             
            > Note that Vue 2.x is not compatible with 1.x. vue-router 2.0 only works with Vue 2.x`
         | 
| 9 9 |  | 
| 10 | 
            +
            #####  Legacy
         | 
| 10 11 | 
             
            The current 1.x version is `Vue.js` (v1.0.28) + `vue-router` (v0.7.13) + `vue-resource` (v1.0.3)
         | 
| 11 12 |  | 
| 12 13 | 
             
            # Requirement
         | 
| @@ -66,3 +67,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/ytbrya | |
| 66 67 | 
             
            ## License
         | 
| 67 68 |  | 
| 68 69 | 
             
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         | 
| 70 | 
            +
             | 
| 71 | 
            +
             | 
| 72 | 
            +
            ## Contact
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            📮 Bryan Lim ytbryan@gmail.com
         | 
    
        data/lib/vuejs.rb
    CHANGED
    
    
    
        data/lib/vuejs/version.rb
    CHANGED
    
    
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            /**
         | 
| 2 | 
            -
             * vuex v2. | 
| 2 | 
            +
             * vuex v2.1.1
         | 
| 3 3 | 
             
             * (c) 2016 Evan You
         | 
| 4 4 | 
             
             * @license MIT
         | 
| 5 5 | 
             
             */
         | 
| @@ -64,27 +64,39 @@ function applyMixin (Vue) { | |
| 64 64 | 
             
              }
         | 
| 65 65 | 
             
            }
         | 
| 66 66 |  | 
| 67 | 
            -
             | 
| 67 | 
            +
            var mapState = normalizeNamespace(function (namespace, states) {
         | 
| 68 68 | 
             
              var res = {}
         | 
| 69 69 | 
             
              normalizeMap(states).forEach(function (ref) {
         | 
| 70 70 | 
             
                var key = ref.key;
         | 
| 71 71 | 
             
                var val = ref.val;
         | 
| 72 72 |  | 
| 73 73 | 
             
                res[key] = function mappedState () {
         | 
| 74 | 
            +
                  var state = this.$store.state
         | 
| 75 | 
            +
                  var getters = this.$store.getters
         | 
| 76 | 
            +
                  if (namespace) {
         | 
| 77 | 
            +
                    var module = this.$store._modulesNamespaceMap[namespace]
         | 
| 78 | 
            +
                    if (!module) {
         | 
| 79 | 
            +
                      warnNamespace('mapState', namespace)
         | 
| 80 | 
            +
                      return
         | 
| 81 | 
            +
                    }
         | 
| 82 | 
            +
                    state = module.state
         | 
| 83 | 
            +
                    getters = module.context.getters
         | 
| 84 | 
            +
                  }
         | 
| 74 85 | 
             
                  return typeof val === 'function'
         | 
| 75 | 
            -
                    ? val.call(this,  | 
| 76 | 
            -
                    :  | 
| 86 | 
            +
                    ? val.call(this, state, getters)
         | 
| 87 | 
            +
                    : state[val]
         | 
| 77 88 | 
             
                }
         | 
| 78 89 | 
             
              })
         | 
| 79 90 | 
             
              return res
         | 
| 80 | 
            -
            }
         | 
| 91 | 
            +
            })
         | 
| 81 92 |  | 
| 82 | 
            -
             | 
| 93 | 
            +
            var mapMutations = normalizeNamespace(function (namespace, mutations) {
         | 
| 83 94 | 
             
              var res = {}
         | 
| 84 95 | 
             
              normalizeMap(mutations).forEach(function (ref) {
         | 
| 85 96 | 
             
                var key = ref.key;
         | 
| 86 97 | 
             
                var val = ref.val;
         | 
| 87 98 |  | 
| 99 | 
            +
                val = namespace + val
         | 
| 88 100 | 
             
                res[key] = function mappedMutation () {
         | 
| 89 101 | 
             
                  var args = [], len = arguments.length;
         | 
| 90 102 | 
             
                  while ( len-- ) args[ len ] = arguments[ len ];
         | 
| @@ -93,14 +105,15 @@ function mapMutations (mutations) { | |
| 93 105 | 
             
                }
         | 
| 94 106 | 
             
              })
         | 
| 95 107 | 
             
              return res
         | 
| 96 | 
            -
            }
         | 
| 108 | 
            +
            })
         | 
| 97 109 |  | 
| 98 | 
            -
             | 
| 110 | 
            +
            var mapGetters = normalizeNamespace(function (namespace, getters) {
         | 
| 99 111 | 
             
              var res = {}
         | 
| 100 112 | 
             
              normalizeMap(getters).forEach(function (ref) {
         | 
| 101 113 | 
             
                var key = ref.key;
         | 
| 102 114 | 
             
                var val = ref.val;
         | 
| 103 115 |  | 
| 116 | 
            +
                val = namespace + val
         | 
| 104 117 | 
             
                res[key] = function mappedGetter () {
         | 
| 105 118 | 
             
                  if (!(val in this.$store.getters)) {
         | 
| 106 119 | 
             
                    console.error(("[vuex] unknown getter: " + val))
         | 
| @@ -109,14 +122,15 @@ function mapGetters (getters) { | |
| 109 122 | 
             
                }
         | 
| 110 123 | 
             
              })
         | 
| 111 124 | 
             
              return res
         | 
| 112 | 
            -
            }
         | 
| 125 | 
            +
            })
         | 
| 113 126 |  | 
| 114 | 
            -
             | 
| 127 | 
            +
            var mapActions = normalizeNamespace(function (namespace, actions) {
         | 
| 115 128 | 
             
              var res = {}
         | 
| 116 129 | 
             
              normalizeMap(actions).forEach(function (ref) {
         | 
| 117 130 | 
             
                var key = ref.key;
         | 
| 118 131 | 
             
                var val = ref.val;
         | 
| 119 132 |  | 
| 133 | 
            +
                val = namespace + val
         | 
| 120 134 | 
             
                res[key] = function mappedAction () {
         | 
| 121 135 | 
             
                  var args = [], len = arguments.length;
         | 
| 122 136 | 
             
                  while ( len-- ) args[ len ] = arguments[ len ];
         | 
| @@ -125,7 +139,7 @@ function mapActions (actions) { | |
| 125 139 | 
             
                }
         | 
| 126 140 | 
             
              })
         | 
| 127 141 | 
             
              return res
         | 
| 128 | 
            -
            }
         | 
| 142 | 
            +
            })
         | 
| 129 143 |  | 
| 130 144 | 
             
            function normalizeMap (map) {
         | 
| 131 145 | 
             
              return Array.isArray(map)
         | 
| @@ -133,6 +147,29 @@ function normalizeMap (map) { | |
| 133 147 | 
             
                : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
         | 
| 134 148 | 
             
            }
         | 
| 135 149 |  | 
| 150 | 
            +
            function normalizeNamespace (fn) {
         | 
| 151 | 
            +
              return function (namespace, map) {
         | 
| 152 | 
            +
                if (typeof namespace !== 'string') {
         | 
| 153 | 
            +
                  map = namespace
         | 
| 154 | 
            +
                  namespace = ''
         | 
| 155 | 
            +
                } else if (namespace.charAt(namespace.length - 1) !== '/') {
         | 
| 156 | 
            +
                  namespace += '/'
         | 
| 157 | 
            +
                }
         | 
| 158 | 
            +
                return fn(namespace, map)
         | 
| 159 | 
            +
              }
         | 
| 160 | 
            +
            }
         | 
| 161 | 
            +
             | 
| 162 | 
            +
            function warnNamespace (helper, namespace) {
         | 
| 163 | 
            +
              console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace))
         | 
| 164 | 
            +
            }
         | 
| 165 | 
            +
             | 
| 166 | 
            +
            /**
         | 
| 167 | 
            +
             * forEach for object
         | 
| 168 | 
            +
             */
         | 
| 169 | 
            +
            function forEachValue (obj, fn) {
         | 
| 170 | 
            +
              Object.keys(obj).forEach(function (key) { return fn(obj[key], key); })
         | 
| 171 | 
            +
            }
         | 
| 172 | 
            +
             | 
| 136 173 | 
             
            function isObject (obj) {
         | 
| 137 174 | 
             
              return obj !== null && typeof obj === 'object'
         | 
| 138 175 | 
             
            }
         | 
| @@ -145,6 +182,146 @@ function assert (condition, msg) { | |
| 145 182 | 
             
              if (!condition) { throw new Error(("[vuex] " + msg)) }
         | 
| 146 183 | 
             
            }
         | 
| 147 184 |  | 
| 185 | 
            +
            var Module = function Module (rawModule, runtime) {
         | 
| 186 | 
            +
              this.runtime = runtime
         | 
| 187 | 
            +
              this._children = Object.create(null)
         | 
| 188 | 
            +
              this._rawModule = rawModule
         | 
| 189 | 
            +
            };
         | 
| 190 | 
            +
             | 
| 191 | 
            +
            var prototypeAccessors$1 = { state: {},namespaced: {} };
         | 
| 192 | 
            +
             | 
| 193 | 
            +
            prototypeAccessors$1.state.get = function () {
         | 
| 194 | 
            +
              return this._rawModule.state || {}
         | 
| 195 | 
            +
            };
         | 
| 196 | 
            +
             | 
| 197 | 
            +
            prototypeAccessors$1.namespaced.get = function () {
         | 
| 198 | 
            +
              return !!this._rawModule.namespaced
         | 
| 199 | 
            +
            };
         | 
| 200 | 
            +
             | 
| 201 | 
            +
            Module.prototype.addChild = function addChild (key, module) {
         | 
| 202 | 
            +
              this._children[key] = module
         | 
| 203 | 
            +
            };
         | 
| 204 | 
            +
             | 
| 205 | 
            +
            Module.prototype.removeChild = function removeChild (key) {
         | 
| 206 | 
            +
              delete this._children[key]
         | 
| 207 | 
            +
            };
         | 
| 208 | 
            +
             | 
| 209 | 
            +
            Module.prototype.getChild = function getChild (key) {
         | 
| 210 | 
            +
              return this._children[key]
         | 
| 211 | 
            +
            };
         | 
| 212 | 
            +
             | 
| 213 | 
            +
            Module.prototype.update = function update (rawModule) {
         | 
| 214 | 
            +
              this._rawModule.namespaced = rawModule.namespaced
         | 
| 215 | 
            +
              if (rawModule.actions) {
         | 
| 216 | 
            +
                this._rawModule.actions = rawModule.actions
         | 
| 217 | 
            +
              }
         | 
| 218 | 
            +
              if (rawModule.mutations) {
         | 
| 219 | 
            +
                this._rawModule.mutations = rawModule.mutations
         | 
| 220 | 
            +
              }
         | 
| 221 | 
            +
              if (rawModule.getters) {
         | 
| 222 | 
            +
                this._rawModule.getters = rawModule.getters
         | 
| 223 | 
            +
              }
         | 
| 224 | 
            +
            };
         | 
| 225 | 
            +
             | 
| 226 | 
            +
            Module.prototype.forEachChild = function forEachChild (fn) {
         | 
| 227 | 
            +
              forEachValue(this._children, fn)
         | 
| 228 | 
            +
            };
         | 
| 229 | 
            +
             | 
| 230 | 
            +
            Module.prototype.forEachGetter = function forEachGetter (fn) {
         | 
| 231 | 
            +
              if (this._rawModule.getters) {
         | 
| 232 | 
            +
                forEachValue(this._rawModule.getters, fn)
         | 
| 233 | 
            +
              }
         | 
| 234 | 
            +
            };
         | 
| 235 | 
            +
             | 
| 236 | 
            +
            Module.prototype.forEachAction = function forEachAction (fn) {
         | 
| 237 | 
            +
              if (this._rawModule.actions) {
         | 
| 238 | 
            +
                forEachValue(this._rawModule.actions, fn)
         | 
| 239 | 
            +
              }
         | 
| 240 | 
            +
            };
         | 
| 241 | 
            +
             | 
| 242 | 
            +
            Module.prototype.forEachMutation = function forEachMutation (fn) {
         | 
| 243 | 
            +
              if (this._rawModule.mutations) {
         | 
| 244 | 
            +
                forEachValue(this._rawModule.mutations, fn)
         | 
| 245 | 
            +
              }
         | 
| 246 | 
            +
            };
         | 
| 247 | 
            +
             | 
| 248 | 
            +
            Object.defineProperties( Module.prototype, prototypeAccessors$1 );
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            var ModuleCollection = function ModuleCollection (rawRootModule) {
         | 
| 251 | 
            +
              var this$1 = this;
         | 
| 252 | 
            +
             | 
| 253 | 
            +
              // register root module (Vuex.Store options)
         | 
| 254 | 
            +
              this.root = new Module(rawRootModule, false)
         | 
| 255 | 
            +
             | 
| 256 | 
            +
              // register all nested modules
         | 
| 257 | 
            +
              if (rawRootModule.modules) {
         | 
| 258 | 
            +
                forEachValue(rawRootModule.modules, function (rawModule, key) {
         | 
| 259 | 
            +
                  this$1.register([key], rawModule, false)
         | 
| 260 | 
            +
                })
         | 
| 261 | 
            +
              }
         | 
| 262 | 
            +
            };
         | 
| 263 | 
            +
             | 
| 264 | 
            +
            ModuleCollection.prototype.get = function get (path) {
         | 
| 265 | 
            +
              return path.reduce(function (module, key) {
         | 
| 266 | 
            +
                return module.getChild(key)
         | 
| 267 | 
            +
              }, this.root)
         | 
| 268 | 
            +
            };
         | 
| 269 | 
            +
             | 
| 270 | 
            +
            ModuleCollection.prototype.getNamespace = function getNamespace (path) {
         | 
| 271 | 
            +
              var module = this.root
         | 
| 272 | 
            +
              return path.reduce(function (namespace, key) {
         | 
| 273 | 
            +
                module = module.getChild(key)
         | 
| 274 | 
            +
                return namespace + (module.namespaced ? key + '/' : '')
         | 
| 275 | 
            +
              }, '')
         | 
| 276 | 
            +
            };
         | 
| 277 | 
            +
             | 
| 278 | 
            +
            ModuleCollection.prototype.update = function update$1 (rawRootModule) {
         | 
| 279 | 
            +
              update(this.root, rawRootModule)
         | 
| 280 | 
            +
            };
         | 
| 281 | 
            +
             | 
| 282 | 
            +
            ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
         | 
| 283 | 
            +
                var this$1 = this;
         | 
| 284 | 
            +
                if ( runtime === void 0 ) runtime = true;
         | 
| 285 | 
            +
             | 
| 286 | 
            +
              var parent = this.get(path.slice(0, -1))
         | 
| 287 | 
            +
              var newModule = new Module(rawModule, runtime)
         | 
| 288 | 
            +
              parent.addChild(path[path.length - 1], newModule)
         | 
| 289 | 
            +
             | 
| 290 | 
            +
              // register nested modules
         | 
| 291 | 
            +
              if (rawModule.modules) {
         | 
| 292 | 
            +
                forEachValue(rawModule.modules, function (rawChildModule, key) {
         | 
| 293 | 
            +
                  this$1.register(path.concat(key), rawChildModule, runtime)
         | 
| 294 | 
            +
                })
         | 
| 295 | 
            +
              }
         | 
| 296 | 
            +
            };
         | 
| 297 | 
            +
             | 
| 298 | 
            +
            ModuleCollection.prototype.unregister = function unregister (path) {
         | 
| 299 | 
            +
              var parent = this.get(path.slice(0, -1))
         | 
| 300 | 
            +
              var key = path[path.length - 1]
         | 
| 301 | 
            +
              if (!parent.getChild(key).runtime) { return }
         | 
| 302 | 
            +
             | 
| 303 | 
            +
              parent.removeChild(key)
         | 
| 304 | 
            +
            };
         | 
| 305 | 
            +
             | 
| 306 | 
            +
            function update (targetModule, newModule) {
         | 
| 307 | 
            +
              // update target module
         | 
| 308 | 
            +
              targetModule.update(newModule)
         | 
| 309 | 
            +
             | 
| 310 | 
            +
              // update nested modules
         | 
| 311 | 
            +
              if (newModule.modules) {
         | 
| 312 | 
            +
                for (var key in newModule.modules) {
         | 
| 313 | 
            +
                  if (!targetModule.getChild(key)) {
         | 
| 314 | 
            +
                    console.warn(
         | 
| 315 | 
            +
                      "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
         | 
| 316 | 
            +
                      'manual reload is needed'
         | 
| 317 | 
            +
                    )
         | 
| 318 | 
            +
                    return
         | 
| 319 | 
            +
                  }
         | 
| 320 | 
            +
                  update(targetModule.getChild(key), newModule.modules[key])
         | 
| 321 | 
            +
                }
         | 
| 322 | 
            +
              }
         | 
| 323 | 
            +
            }
         | 
| 324 | 
            +
             | 
| 148 325 | 
             
            var Vue // bind on install
         | 
| 149 326 |  | 
| 150 327 | 
             
            var Store = function Store (options) {
         | 
| @@ -159,34 +336,34 @@ var Store = function Store (options) { | |
| 159 336 | 
             
              var strict = options.strict; if ( strict === void 0 ) strict = false;
         | 
| 160 337 |  | 
| 161 338 | 
             
              // store internal state
         | 
| 162 | 
            -
              this._options = options
         | 
| 163 339 | 
             
              this._committing = false
         | 
| 164 340 | 
             
              this._actions = Object.create(null)
         | 
| 165 341 | 
             
              this._mutations = Object.create(null)
         | 
| 166 342 | 
             
              this._wrappedGetters = Object.create(null)
         | 
| 167 | 
            -
              this. | 
| 343 | 
            +
              this._modules = new ModuleCollection(options)
         | 
| 344 | 
            +
              this._modulesNamespaceMap = Object.create(null)
         | 
| 168 345 | 
             
              this._subscribers = []
         | 
| 169 346 | 
             
              this._watcherVM = new Vue()
         | 
| 170 347 |  | 
| 171 | 
            -
             | 
| 348 | 
            +
              // bind commit and dispatch to self
         | 
| 172 349 | 
             
              var store = this
         | 
| 173 350 | 
             
              var ref = this;
         | 
| 174 351 | 
             
              var dispatch = ref.dispatch;
         | 
| 175 352 | 
             
              var commit = ref.commit;
         | 
| 176 | 
            -
             | 
| 353 | 
            +
                this.dispatch = function boundDispatch (type, payload) {
         | 
| 177 354 | 
             
                return dispatch.call(store, type, payload)
         | 
| 178 | 
            -
                }
         | 
| 179 | 
            -
                this.commit = function boundCommit (type, payload, options) {
         | 
| 180 | 
            -
                return commit.call(store, type, payload, options)
         | 
| 181 355 | 
             
              }
         | 
| 356 | 
            +
              this.commit = function boundCommit (type, payload, options) {
         | 
| 357 | 
            +
                return commit.call(store, type, payload, options)
         | 
| 358 | 
            +
                }
         | 
| 182 359 |  | 
| 183 | 
            -
             | 
| 360 | 
            +
                // strict mode
         | 
| 184 361 | 
             
              this.strict = strict
         | 
| 185 362 |  | 
| 186 363 | 
             
              // init root module.
         | 
| 187 364 | 
             
              // this also recursively registers all sub-modules
         | 
| 188 365 | 
             
              // and collects all module getters inside this._wrappedGetters
         | 
| 189 | 
            -
              installModule(this, state, [],  | 
| 366 | 
            +
              installModule(this, state, [], this._modules.root)
         | 
| 190 367 |  | 
| 191 368 | 
             
              // initialize the store vm, which is responsible for the reactivity
         | 
| 192 369 | 
             
              // (also registers _wrappedGetters as computed properties)
         | 
| @@ -199,22 +376,22 @@ var Store = function Store (options) { | |
| 199 376 | 
             
            var prototypeAccessors = { state: {} };
         | 
| 200 377 |  | 
| 201 378 | 
             
            prototypeAccessors.state.get = function () {
         | 
| 202 | 
            -
              return this._vm.state
         | 
| 379 | 
            +
              return this._vm.$data.state
         | 
| 203 380 | 
             
            };
         | 
| 204 381 |  | 
| 205 382 | 
             
            prototypeAccessors.state.set = function (v) {
         | 
| 206 383 | 
             
              assert(false, "Use store.replaceState() to explicit replace store state.")
         | 
| 207 384 | 
             
            };
         | 
| 208 385 |  | 
| 209 | 
            -
            Store.prototype.commit = function commit ( | 
| 386 | 
            +
            Store.prototype.commit = function commit (_type, _payload, _options) {
         | 
| 210 387 | 
             
                var this$1 = this;
         | 
| 211 388 |  | 
| 212 389 | 
             
              // check object-style commit
         | 
| 213 | 
            -
               | 
| 214 | 
            -
                 | 
| 215 | 
            -
                payload =  | 
| 216 | 
            -
                 | 
| 217 | 
            -
             | 
| 390 | 
            +
              var ref = unifyObjectStyle(_type, _payload, _options);
         | 
| 391 | 
            +
                var type = ref.type;
         | 
| 392 | 
            +
                var payload = ref.payload;
         | 
| 393 | 
            +
                var options = ref.options;
         | 
| 394 | 
            +
             | 
| 218 395 | 
             
              var mutation = { type: type, payload: payload }
         | 
| 219 396 | 
             
              var entry = this._mutations[type]
         | 
| 220 397 | 
             
              if (!entry) {
         | 
| @@ -226,17 +403,22 @@ Store.prototype.commit = function commit (type, payload, options) { | |
| 226 403 | 
             
                  handler(payload)
         | 
| 227 404 | 
             
                })
         | 
| 228 405 | 
             
              })
         | 
| 229 | 
            -
               | 
| 230 | 
            -
             | 
| 406 | 
            +
              this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); })
         | 
| 407 | 
            +
             | 
| 408 | 
            +
              if (options && options.silent) {
         | 
| 409 | 
            +
                console.warn(
         | 
| 410 | 
            +
                  "[vuex] mutation type: " + type + ". Silent option has been removed. " +
         | 
| 411 | 
            +
                  'Use the filter functionality in the vue-devtools'
         | 
| 412 | 
            +
                )
         | 
| 231 413 | 
             
              }
         | 
| 232 414 | 
             
            };
         | 
| 233 415 |  | 
| 234 | 
            -
            Store.prototype.dispatch = function dispatch ( | 
| 416 | 
            +
            Store.prototype.dispatch = function dispatch (_type, _payload) {
         | 
| 235 417 | 
             
              // check object-style dispatch
         | 
| 236 | 
            -
               | 
| 237 | 
            -
                 | 
| 238 | 
            -
                 | 
| 239 | 
            -
             | 
| 418 | 
            +
              var ref = unifyObjectStyle(_type, _payload);
         | 
| 419 | 
            +
                var type = ref.type;
         | 
| 420 | 
            +
                var payload = ref.payload;
         | 
| 421 | 
            +
             | 
| 240 422 | 
             
              var entry = this._actions[type]
         | 
| 241 423 | 
             
              if (!entry) {
         | 
| 242 424 | 
             
                console.error(("[vuex] unknown action type: " + type))
         | 
| @@ -264,7 +446,7 @@ Store.prototype.watch = function watch (getter, cb, options) { | |
| 264 446 | 
             
                var this$1 = this;
         | 
| 265 447 |  | 
| 266 448 | 
             
              assert(typeof getter === 'function', "store.watch only accepts a function.")
         | 
| 267 | 
            -
              return this._watcherVM.$watch(function () { return getter(this$1.state); }, cb, options)
         | 
| 449 | 
            +
              return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
         | 
| 268 450 | 
             
            };
         | 
| 269 451 |  | 
| 270 452 | 
             
            Store.prototype.replaceState = function replaceState (state) {
         | 
| @@ -275,11 +457,11 @@ Store.prototype.replaceState = function replaceState (state) { | |
| 275 457 | 
             
              })
         | 
| 276 458 | 
             
            };
         | 
| 277 459 |  | 
| 278 | 
            -
            Store.prototype.registerModule = function registerModule (path,  | 
| 460 | 
            +
            Store.prototype.registerModule = function registerModule (path, rawModule) {
         | 
| 279 461 | 
             
              if (typeof path === 'string') { path = [path] }
         | 
| 280 462 | 
             
              assert(Array.isArray(path), "module path must be a string or an Array.")
         | 
| 281 | 
            -
              this. | 
| 282 | 
            -
              installModule(this, this.state, path,  | 
| 463 | 
            +
              this._modules.register(path, rawModule)
         | 
| 464 | 
            +
              installModule(this, this.state, path, this._modules.get(path))
         | 
| 283 465 | 
             
              // reset store to update getters...
         | 
| 284 466 | 
             
              resetStoreVM(this, this.state)
         | 
| 285 467 | 
             
            };
         | 
| @@ -289,7 +471,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) { | |
| 289 471 |  | 
| 290 472 | 
             
              if (typeof path === 'string') { path = [path] }
         | 
| 291 473 | 
             
              assert(Array.isArray(path), "module path must be a string or an Array.")
         | 
| 292 | 
            -
                 | 
| 474 | 
            +
                this._modules.unregister(path)
         | 
| 293 475 | 
             
              this._withCommit(function () {
         | 
| 294 476 | 
             
                var parentState = getNestedState(this$1.state, path.slice(0, -1))
         | 
| 295 477 | 
             
                Vue.delete(parentState, path[path.length - 1])
         | 
| @@ -298,7 +480,7 @@ Store.prototype.unregisterModule = function unregisterModule (path) { | |
| 298 480 | 
             
            };
         | 
| 299 481 |  | 
| 300 482 | 
             
            Store.prototype.hotUpdate = function hotUpdate (newOptions) {
         | 
| 301 | 
            -
               | 
| 483 | 
            +
              this._modules.update(newOptions)
         | 
| 302 484 | 
             
              resetStore(this)
         | 
| 303 485 | 
             
            };
         | 
| 304 486 |  | 
| @@ -311,41 +493,14 @@ Store.prototype._withCommit = function _withCommit (fn) { | |
| 311 493 |  | 
| 312 494 | 
             
            Object.defineProperties( Store.prototype, prototypeAccessors );
         | 
| 313 495 |  | 
| 314 | 
            -
            function updateModule (targetModule, newModule) {
         | 
| 315 | 
            -
              if (newModule.actions) {
         | 
| 316 | 
            -
                targetModule.actions = newModule.actions
         | 
| 317 | 
            -
              }
         | 
| 318 | 
            -
              if (newModule.mutations) {
         | 
| 319 | 
            -
                targetModule.mutations = newModule.mutations
         | 
| 320 | 
            -
              }
         | 
| 321 | 
            -
              if (newModule.getters) {
         | 
| 322 | 
            -
                targetModule.getters = newModule.getters
         | 
| 323 | 
            -
              }
         | 
| 324 | 
            -
              if (newModule.modules) {
         | 
| 325 | 
            -
                for (var key in newModule.modules) {
         | 
| 326 | 
            -
                  if (!(targetModule.modules && targetModule.modules[key])) {
         | 
| 327 | 
            -
                    console.warn(
         | 
| 328 | 
            -
                      "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
         | 
| 329 | 
            -
                      'manual reload is needed'
         | 
| 330 | 
            -
                    )
         | 
| 331 | 
            -
                    return
         | 
| 332 | 
            -
                  }
         | 
| 333 | 
            -
                  updateModule(targetModule.modules[key], newModule.modules[key])
         | 
| 334 | 
            -
                }
         | 
| 335 | 
            -
              }
         | 
| 336 | 
            -
            }
         | 
| 337 | 
            -
             | 
| 338 496 | 
             
            function resetStore (store) {
         | 
| 339 497 | 
             
              store._actions = Object.create(null)
         | 
| 340 498 | 
             
              store._mutations = Object.create(null)
         | 
| 341 499 | 
             
              store._wrappedGetters = Object.create(null)
         | 
| 500 | 
            +
              store._modulesNamespaceMap = Object.create(null)
         | 
| 342 501 | 
             
              var state = store.state
         | 
| 343 | 
            -
              // init  | 
| 344 | 
            -
              installModule(store, state, [], store. | 
| 345 | 
            -
              // init all runtime modules
         | 
| 346 | 
            -
              Object.keys(store._runtimeModules).forEach(function (key) {
         | 
| 347 | 
            -
                installModule(store, state, key.split('.'), store._runtimeModules[key], true)
         | 
| 348 | 
            -
              })
         | 
| 502 | 
            +
              // init all modules
         | 
| 503 | 
            +
              installModule(store, state, [], store._modules.root, true)
         | 
| 349 504 | 
             
              // reset vm
         | 
| 350 505 | 
             
              resetStoreVM(store, state)
         | 
| 351 506 | 
             
            }
         | 
| @@ -357,12 +512,12 @@ function resetStoreVM (store, state) { | |
| 357 512 | 
             
              store.getters = {}
         | 
| 358 513 | 
             
              var wrappedGetters = store._wrappedGetters
         | 
| 359 514 | 
             
              var computed = {}
         | 
| 360 | 
            -
               | 
| 361 | 
            -
                var fn = wrappedGetters[key]
         | 
| 515 | 
            +
              forEachValue(wrappedGetters, function (fn, key) {
         | 
| 362 516 | 
             
                // use computed to leverage its lazy-caching mechanism
         | 
| 363 517 | 
             
                computed[key] = function () { return fn(store); }
         | 
| 364 518 | 
             
                Object.defineProperty(store.getters, key, {
         | 
| 365 | 
            -
                  get: function () { return store._vm[key]; }
         | 
| 519 | 
            +
                  get: function () { return store._vm[key]; },
         | 
| 520 | 
            +
                  enumerable: true // for local getters
         | 
| 366 521 | 
             
                })
         | 
| 367 522 | 
             
              })
         | 
| 368 523 |  | 
| @@ -394,65 +549,135 @@ function resetStoreVM (store, state) { | |
| 394 549 |  | 
| 395 550 | 
             
            function installModule (store, rootState, path, module, hot) {
         | 
| 396 551 | 
             
              var isRoot = !path.length
         | 
| 397 | 
            -
              var  | 
| 398 | 
            -
             | 
| 399 | 
            -
               | 
| 400 | 
            -
               | 
| 401 | 
            -
             | 
| 552 | 
            +
              var namespace = store._modules.getNamespace(path)
         | 
| 553 | 
            +
             | 
| 554 | 
            +
              // register in namespace map
         | 
| 555 | 
            +
              if (namespace) {
         | 
| 556 | 
            +
                store._modulesNamespaceMap[namespace] = module
         | 
| 557 | 
            +
              }
         | 
| 402 558 |  | 
| 403 559 | 
             
              // set state
         | 
| 404 560 | 
             
              if (!isRoot && !hot) {
         | 
| 405 561 | 
             
                var parentState = getNestedState(rootState, path.slice(0, -1))
         | 
| 406 562 | 
             
                var moduleName = path[path.length - 1]
         | 
| 407 563 | 
             
                store._withCommit(function () {
         | 
| 408 | 
            -
                  Vue.set(parentState, moduleName, state | 
| 564 | 
            +
                  Vue.set(parentState, moduleName, module.state)
         | 
| 409 565 | 
             
                })
         | 
| 410 566 | 
             
              }
         | 
| 411 567 |  | 
| 412 | 
            -
               | 
| 413 | 
            -
                Object.keys(mutations).forEach(function (key) {
         | 
| 414 | 
            -
                  registerMutation(store, key, mutations[key], path)
         | 
| 415 | 
            -
                })
         | 
| 416 | 
            -
              }
         | 
| 568 | 
            +
              var local = module.context = makeLocalContext(store, namespace)
         | 
| 417 569 |  | 
| 418 | 
            -
               | 
| 419 | 
            -
                 | 
| 420 | 
            -
             | 
| 421 | 
            -
             | 
| 422 | 
            -
              }
         | 
| 570 | 
            +
              module.forEachMutation(function (mutation, key) {
         | 
| 571 | 
            +
                var namespacedType = namespace + key
         | 
| 572 | 
            +
                registerMutation(store, namespacedType, mutation, path)
         | 
| 573 | 
            +
              })
         | 
| 423 574 |  | 
| 424 | 
            -
               | 
| 425 | 
            -
                 | 
| 575 | 
            +
              module.forEachAction(function (action, key) {
         | 
| 576 | 
            +
                var namespacedType = namespace + key
         | 
| 577 | 
            +
                registerAction(store, namespacedType, action, local, path)
         | 
| 578 | 
            +
              })
         | 
| 579 | 
            +
             | 
| 580 | 
            +
              module.forEachGetter(function (getter, key) {
         | 
| 581 | 
            +
                var namespacedType = namespace + key
         | 
| 582 | 
            +
                registerGetter(store, namespacedType, getter, local, path)
         | 
| 583 | 
            +
              })
         | 
| 584 | 
            +
             | 
| 585 | 
            +
              module.forEachChild(function (child, key) {
         | 
| 586 | 
            +
                installModule(store, rootState, path.concat(key), child, hot)
         | 
| 587 | 
            +
              })
         | 
| 588 | 
            +
            }
         | 
| 589 | 
            +
             | 
| 590 | 
            +
            /**
         | 
| 591 | 
            +
             * make localized dispatch, commit and getters
         | 
| 592 | 
            +
             * if there is no namespace, just use root ones
         | 
| 593 | 
            +
             */
         | 
| 594 | 
            +
            function makeLocalContext (store, namespace) {
         | 
| 595 | 
            +
              var noNamespace = namespace === ''
         | 
| 596 | 
            +
             | 
| 597 | 
            +
              var local = {
         | 
| 598 | 
            +
                dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
         | 
| 599 | 
            +
                  var args = unifyObjectStyle(_type, _payload, _options)
         | 
| 600 | 
            +
                  var payload = args.payload;
         | 
| 601 | 
            +
                  var options = args.options;
         | 
| 602 | 
            +
                  var type = args.type;
         | 
| 603 | 
            +
             | 
| 604 | 
            +
                  if (!options || !options.root) {
         | 
| 605 | 
            +
                    type = namespace + type
         | 
| 606 | 
            +
                    if (!store._actions[type]) {
         | 
| 607 | 
            +
                      console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type))
         | 
| 608 | 
            +
                      return
         | 
| 609 | 
            +
                    }
         | 
| 610 | 
            +
                  }
         | 
| 611 | 
            +
             | 
| 612 | 
            +
                  return store.dispatch(type, payload)
         | 
| 613 | 
            +
                },
         | 
| 614 | 
            +
             | 
| 615 | 
            +
                commit: noNamespace ? store.commit : function (_type, _payload, _options) {
         | 
| 616 | 
            +
                  var args = unifyObjectStyle(_type, _payload, _options)
         | 
| 617 | 
            +
                  var payload = args.payload;
         | 
| 618 | 
            +
                  var options = args.options;
         | 
| 619 | 
            +
                  var type = args.type;
         | 
| 620 | 
            +
             | 
| 621 | 
            +
                  if (!options || !options.root) {
         | 
| 622 | 
            +
                    type = namespace + type
         | 
| 623 | 
            +
                    if (!store._mutations[type]) {
         | 
| 624 | 
            +
                      console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type))
         | 
| 625 | 
            +
                      return
         | 
| 626 | 
            +
                    }
         | 
| 627 | 
            +
                  }
         | 
| 628 | 
            +
             | 
| 629 | 
            +
                  store.commit(type, payload, options)
         | 
| 630 | 
            +
                }
         | 
| 426 631 | 
             
              }
         | 
| 427 632 |  | 
| 428 | 
            -
               | 
| 429 | 
            -
             | 
| 430 | 
            -
             | 
| 633 | 
            +
              // getters object must be gotten lazily
         | 
| 634 | 
            +
              // because store.getters will be changed by vm update
         | 
| 635 | 
            +
              Object.defineProperty(local, 'getters', {
         | 
| 636 | 
            +
                get: noNamespace ? function () { return store.getters; } : function () { return makeLocalGetters(store, namespace); }
         | 
| 637 | 
            +
              })
         | 
| 638 | 
            +
             | 
| 639 | 
            +
              return local
         | 
| 640 | 
            +
            }
         | 
| 641 | 
            +
             | 
| 642 | 
            +
            function makeLocalGetters (store, namespace) {
         | 
| 643 | 
            +
              var gettersProxy = {}
         | 
| 644 | 
            +
             | 
| 645 | 
            +
              var splitPos = namespace.length
         | 
| 646 | 
            +
              Object.keys(store.getters).forEach(function (type) {
         | 
| 647 | 
            +
                // skip if the target getter is not match this namespace
         | 
| 648 | 
            +
                if (type.slice(0, splitPos) !== namespace) { return }
         | 
| 649 | 
            +
             | 
| 650 | 
            +
                // extract local getter type
         | 
| 651 | 
            +
                var localType = type.slice(splitPos)
         | 
| 652 | 
            +
             | 
| 653 | 
            +
                // Add a port to the getters proxy.
         | 
| 654 | 
            +
                // Define as getter property because
         | 
| 655 | 
            +
                // we do not want to evaluate the getters in this time.
         | 
| 656 | 
            +
                Object.defineProperty(gettersProxy, localType, {
         | 
| 657 | 
            +
                  get: function () { return store.getters[type]; },
         | 
| 658 | 
            +
                  enumerable: true
         | 
| 431 659 | 
             
                })
         | 
| 432 | 
            -
              }
         | 
| 660 | 
            +
              })
         | 
| 661 | 
            +
             | 
| 662 | 
            +
              return gettersProxy
         | 
| 433 663 | 
             
            }
         | 
| 434 664 |  | 
| 435 665 | 
             
            function registerMutation (store, type, handler, path) {
         | 
| 436 | 
            -
              if ( path === void 0 ) path = [];
         | 
| 437 | 
            -
             | 
| 438 666 | 
             
              var entry = store._mutations[type] || (store._mutations[type] = [])
         | 
| 439 667 | 
             
              entry.push(function wrappedMutationHandler (payload) {
         | 
| 440 668 | 
             
                handler(getNestedState(store.state, path), payload)
         | 
| 441 669 | 
             
              })
         | 
| 442 670 | 
             
            }
         | 
| 443 671 |  | 
| 444 | 
            -
            function registerAction (store, type, handler, path) {
         | 
| 445 | 
            -
              if ( path === void 0 ) path = [];
         | 
| 446 | 
            -
             | 
| 672 | 
            +
            function registerAction (store, type, handler, local, path) {
         | 
| 447 673 | 
             
              var entry = store._actions[type] || (store._actions[type] = [])
         | 
| 448 | 
            -
              var dispatch = store.dispatch;
         | 
| 449 | 
            -
              var commit = store.commit;
         | 
| 450 674 | 
             
              entry.push(function wrappedActionHandler (payload, cb) {
         | 
| 451 675 | 
             
                var res = handler({
         | 
| 452 | 
            -
                  dispatch: dispatch,
         | 
| 453 | 
            -
                  commit: commit,
         | 
| 454 | 
            -
                  getters:  | 
| 676 | 
            +
                  dispatch: local.dispatch,
         | 
| 677 | 
            +
                  commit: local.commit,
         | 
| 678 | 
            +
                  getters: local.getters,
         | 
| 455 679 | 
             
                  state: getNestedState(store.state, path),
         | 
| 680 | 
            +
                  rootGetters: store.getters,
         | 
| 456 681 | 
             
                  rootState: store.state
         | 
| 457 682 | 
             
                }, payload, cb)
         | 
| 458 683 | 
             
                if (!isPromise(res)) {
         | 
| @@ -469,21 +694,19 @@ function registerAction (store, type, handler, path) { | |
| 469 694 | 
             
              })
         | 
| 470 695 | 
             
            }
         | 
| 471 696 |  | 
| 472 | 
            -
            function  | 
| 473 | 
            -
               | 
| 474 | 
            -
                 | 
| 475 | 
            -
                 | 
| 476 | 
            -
             | 
| 477 | 
            -
             | 
| 478 | 
            -
                 | 
| 479 | 
            -
             | 
| 480 | 
            -
                   | 
| 481 | 
            -
             | 
| 482 | 
            -
             | 
| 483 | 
            -
             | 
| 484 | 
            -
             | 
| 485 | 
            -
                }
         | 
| 486 | 
            -
              })
         | 
| 697 | 
            +
            function registerGetter (store, type, rawGetter, local, path) {
         | 
| 698 | 
            +
              if (store._wrappedGetters[type]) {
         | 
| 699 | 
            +
                console.error(("[vuex] duplicate getter key: " + type))
         | 
| 700 | 
            +
                return
         | 
| 701 | 
            +
              }
         | 
| 702 | 
            +
              store._wrappedGetters[type] = function wrappedGetter (store) {
         | 
| 703 | 
            +
                return rawGetter(
         | 
| 704 | 
            +
                  getNestedState(store.state, path), // local state
         | 
| 705 | 
            +
                  local.getters, // local getters
         | 
| 706 | 
            +
                  store.state, // root state
         | 
| 707 | 
            +
                  store.getters // root getters
         | 
| 708 | 
            +
                )
         | 
| 709 | 
            +
              }
         | 
| 487 710 | 
             
            }
         | 
| 488 711 |  | 
| 489 712 | 
             
            function enableStrictMode (store) {
         | 
| @@ -498,6 +721,15 @@ function getNestedState (state, path) { | |
| 498 721 | 
             
                : state
         | 
| 499 722 | 
             
            }
         | 
| 500 723 |  | 
| 724 | 
            +
            function unifyObjectStyle (type, payload, options) {
         | 
| 725 | 
            +
              if (isObject(type) && type.type) {
         | 
| 726 | 
            +
                options = payload
         | 
| 727 | 
            +
                payload = type
         | 
| 728 | 
            +
                type = type.type
         | 
| 729 | 
            +
              }
         | 
| 730 | 
            +
              return { type: type, payload: payload, options: options }
         | 
| 731 | 
            +
            }
         | 
| 732 | 
            +
             | 
| 501 733 | 
             
            function install (_Vue) {
         | 
| 502 734 | 
             
              if (Vue) {
         | 
| 503 735 | 
             
                console.error(
         | 
| @@ -517,6 +749,7 @@ if (typeof window !== 'undefined' && window.Vue) { | |
| 517 749 | 
             
            var index = {
         | 
| 518 750 | 
             
              Store: Store,
         | 
| 519 751 | 
             
              install: install,
         | 
| 752 | 
            +
              version: '2.1.1',
         | 
| 520 753 | 
             
              mapState: mapState,
         | 
| 521 754 | 
             
              mapMutations: mapMutations,
         | 
| 522 755 | 
             
              mapGetters: mapGetters,
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: vuejs
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.34
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Bryan Lim
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-12- | 
| 11 | 
            +
            date: 2016-12-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |