vuejs 1.0.29 → 1.0.30

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3fa67bc924e0c080deed960070ed7b6bac1bbf4
4
- data.tar.gz: f9f52c81daae1575bd5d3a1d5a86b9728d1a7dc2
3
+ metadata.gz: 32eb6ae3693eb02e0594fa498c79030bdacaa039
4
+ data.tar.gz: 2ad73f16c5a3270f99c9e9b890f994c23ad9c0d9
5
5
  SHA512:
6
- metadata.gz: b9ad75b6428d90be38736819744134e95296b1f4de28255bbd54e9b3d38301e9d06dfd79c9af86ec651948e6a6bce7fb892f08689a8ab307d35a5a2bcb9cf39f
7
- data.tar.gz: 478ad78ccfa4b6fd43fea779577a0099a9485bbc03c72faef397cb406d0b2611fe730d6d079e4cc1e8b9779924f4700e3ff49c1d7b33bb84193515e877a747c0
6
+ metadata.gz: d114df6daac162a6378b828fe68508c9adf80bb33557eed5887041e0c4f816ca7e36b8aa125393f9eb26366e3f109c4a93d22f0a48654512ec0d65da78ae538b
7
+ data.tar.gz: 81b31c559cbe5c16ce546abf69d5a258b129b5f23fd8d74cf897b2917462a29f0f4335470d7c46e1e789deffa52342738676038595bf0b52459dbd349446c65e
data/README.md CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  > Reactive Components for Modern Web Interfaces
4
4
 
5
+ gem `vuejs` ships with the 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.
5
6
 
6
- gem `vuejs` ships with the latest [Vue.js + vue-router + vue-resource + vue-validator](http://vuejs.org/) and integrate with Rails' asset pipeline. Vue.js is created by Evan You and the vuejs team.
7
-
8
- The current 2.x version is `Vue.js` (v2.0.1) + `vue-router` (v2.0.0) + `vue-validator` (v2.1.3).
7
+ The current 2.x version is `Vue.js` (v2.0.1) + `vue-router` (v2.0.0) + `vue-validator` (v2.1.3) + `vuex` (v2.0.0).
9
8
  > Note that Vue 2.x is not compatible with 1.x. vue-router 2.0 only works with Vue 2.x`
10
9
 
11
10
  The current 1.x version is `Vue.js` (v1.0.28) + `vue-router` (v0.7.13) + `vue-resource` (v1.0.3)
@@ -46,6 +45,7 @@ For 2.x Vue & vue-router or Vue-validator
46
45
  //= require vue2
47
46
  //= require vue-router2
48
47
  //= require vue-validator
48
+ //= require vuex
49
49
 
50
50
  ```
51
51
  ## Development
data/lib/vuejs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vuejs
2
- VERSION = "1.0.29"
2
+ VERSION = "1.0.30"
3
3
  end
@@ -0,0 +1,528 @@
1
+ /**
2
+ * vuex v2.0.0
3
+ * (c) 2016 Evan You
4
+ * @license MIT
5
+ */
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8
+ typeof define === 'function' && define.amd ? define(factory) :
9
+ (global.Vuex = factory());
10
+ }(this, (function () { 'use strict';
11
+
12
+ var devtoolHook =
13
+ typeof window !== 'undefined' &&
14
+ window.__VUE_DEVTOOLS_GLOBAL_HOOK__
15
+
16
+ function devtoolPlugin (store) {
17
+ if (!devtoolHook) { return }
18
+
19
+ store._devtoolHook = devtoolHook
20
+
21
+ devtoolHook.emit('vuex:init', store)
22
+
23
+ devtoolHook.on('vuex:travel-to-state', function (targetState) {
24
+ store.replaceState(targetState)
25
+ })
26
+
27
+ store.subscribe(function (mutation, state) {
28
+ devtoolHook.emit('vuex:mutation', mutation, state)
29
+ })
30
+ }
31
+
32
+ function applyMixin (Vue) {
33
+ var version = Number(Vue.version.split('.')[0])
34
+
35
+ if (version >= 2) {
36
+ var usesInit = Vue.config._lifecycleHooks.indexOf('init') > -1
37
+ Vue.mixin(usesInit ? { init: vuexInit } : { beforeCreate: vuexInit })
38
+ } else {
39
+ // override init and inject vuex init procedure
40
+ // for 1.x backwards compatibility.
41
+ var _init = Vue.prototype._init
42
+ Vue.prototype._init = function (options) {
43
+ if ( options === void 0 ) options = {};
44
+
45
+ options.init = options.init
46
+ ? [vuexInit].concat(options.init)
47
+ : vuexInit
48
+ _init.call(this, options)
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Vuex init hook, injected into each instances init hooks list.
54
+ */
55
+
56
+ function vuexInit () {
57
+ var options = this.$options
58
+ // store injection
59
+ if (options.store) {
60
+ this.$store = options.store
61
+ } else if (options.parent && options.parent.$store) {
62
+ this.$store = options.parent.$store
63
+ }
64
+ }
65
+ }
66
+
67
+ function mapState (states) {
68
+ var res = {}
69
+ normalizeMap(states).forEach(function (ref) {
70
+ var key = ref.key;
71
+ var val = ref.val;
72
+
73
+ res[key] = function mappedState () {
74
+ return typeof val === 'function'
75
+ ? val.call(this, this.$store.state, this.$store.getters)
76
+ : this.$store.state[val]
77
+ }
78
+ })
79
+ return res
80
+ }
81
+
82
+ function mapMutations (mutations) {
83
+ var res = {}
84
+ normalizeMap(mutations).forEach(function (ref) {
85
+ var key = ref.key;
86
+ var val = ref.val;
87
+
88
+ res[key] = function mappedMutation () {
89
+ var args = [], len = arguments.length;
90
+ while ( len-- ) args[ len ] = arguments[ len ];
91
+
92
+ return this.$store.commit.apply(this.$store, [val].concat(args))
93
+ }
94
+ })
95
+ return res
96
+ }
97
+
98
+ function mapGetters (getters) {
99
+ var res = {}
100
+ normalizeMap(getters).forEach(function (ref) {
101
+ var key = ref.key;
102
+ var val = ref.val;
103
+
104
+ res[key] = function mappedGetter () {
105
+ if (!(val in this.$store.getters)) {
106
+ console.error(("[vuex] unknown getter: " + val))
107
+ }
108
+ return this.$store.getters[val]
109
+ }
110
+ })
111
+ return res
112
+ }
113
+
114
+ function mapActions (actions) {
115
+ var res = {}
116
+ normalizeMap(actions).forEach(function (ref) {
117
+ var key = ref.key;
118
+ var val = ref.val;
119
+
120
+ res[key] = function mappedAction () {
121
+ var args = [], len = arguments.length;
122
+ while ( len-- ) args[ len ] = arguments[ len ];
123
+
124
+ return this.$store.dispatch.apply(this.$store, [val].concat(args))
125
+ }
126
+ })
127
+ return res
128
+ }
129
+
130
+ function normalizeMap (map) {
131
+ return Array.isArray(map)
132
+ ? map.map(function (key) { return ({ key: key, val: key }); })
133
+ : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
134
+ }
135
+
136
+ function isObject (obj) {
137
+ return obj !== null && typeof obj === 'object'
138
+ }
139
+
140
+ function isPromise (val) {
141
+ return val && typeof val.then === 'function'
142
+ }
143
+
144
+ function assert (condition, msg) {
145
+ if (!condition) { throw new Error(("[vuex] " + msg)) }
146
+ }
147
+
148
+ var Vue // bind on install
149
+
150
+ var Store = function Store (options) {
151
+ var this$1 = this;
152
+ if ( options === void 0 ) options = {};
153
+
154
+ assert(Vue, "must call Vue.use(Vuex) before creating a store instance.")
155
+ assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.")
156
+
157
+ var state = options.state; if ( state === void 0 ) state = {};
158
+ var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
159
+ var strict = options.strict; if ( strict === void 0 ) strict = false;
160
+
161
+ // store internal state
162
+ this._options = options
163
+ this._committing = false
164
+ this._actions = Object.create(null)
165
+ this._mutations = Object.create(null)
166
+ this._wrappedGetters = Object.create(null)
167
+ this._runtimeModules = Object.create(null)
168
+ this._subscribers = []
169
+ this._watcherVM = new Vue()
170
+
171
+ // bind commit and dispatch to self
172
+ var store = this
173
+ var ref = this;
174
+ var dispatch = ref.dispatch;
175
+ var commit = ref.commit;
176
+ this.dispatch = function boundDispatch (type, payload) {
177
+ return dispatch.call(store, type, payload)
178
+ }
179
+ this.commit = function boundCommit (type, payload, options) {
180
+ return commit.call(store, type, payload, options)
181
+ }
182
+
183
+ // strict mode
184
+ this.strict = strict
185
+
186
+ // init root module.
187
+ // this also recursively registers all sub-modules
188
+ // and collects all module getters inside this._wrappedGetters
189
+ installModule(this, state, [], options)
190
+
191
+ // initialize the store vm, which is responsible for the reactivity
192
+ // (also registers _wrappedGetters as computed properties)
193
+ resetStoreVM(this, state)
194
+
195
+ // apply plugins
196
+ plugins.concat(devtoolPlugin).forEach(function (plugin) { return plugin(this$1); })
197
+ };
198
+
199
+ var prototypeAccessors = { state: {} };
200
+
201
+ prototypeAccessors.state.get = function () {
202
+ return this._vm.state
203
+ };
204
+
205
+ prototypeAccessors.state.set = function (v) {
206
+ assert(false, "Use store.replaceState() to explicit replace store state.")
207
+ };
208
+
209
+ Store.prototype.commit = function commit (type, payload, options) {
210
+ var this$1 = this;
211
+
212
+ // check object-style commit
213
+ if (isObject(type) && type.type) {
214
+ options = payload
215
+ payload = type
216
+ type = type.type
217
+ }
218
+ var mutation = { type: type, payload: payload }
219
+ var entry = this._mutations[type]
220
+ if (!entry) {
221
+ console.error(("[vuex] unknown mutation type: " + type))
222
+ return
223
+ }
224
+ this._withCommit(function () {
225
+ entry.forEach(function commitIterator (handler) {
226
+ handler(payload)
227
+ })
228
+ })
229
+ if (!options || !options.silent) {
230
+ this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); })
231
+ }
232
+ };
233
+
234
+ Store.prototype.dispatch = function dispatch (type, payload) {
235
+ // check object-style dispatch
236
+ if (isObject(type) && type.type) {
237
+ payload = type
238
+ type = type.type
239
+ }
240
+ var entry = this._actions[type]
241
+ if (!entry) {
242
+ console.error(("[vuex] unknown action type: " + type))
243
+ return
244
+ }
245
+ return entry.length > 1
246
+ ? Promise.all(entry.map(function (handler) { return handler(payload); }))
247
+ : entry[0](payload)
248
+ };
249
+
250
+ Store.prototype.subscribe = function subscribe (fn) {
251
+ var subs = this._subscribers
252
+ if (subs.indexOf(fn) < 0) {
253
+ subs.push(fn)
254
+ }
255
+ return function () {
256
+ var i = subs.indexOf(fn)
257
+ if (i > -1) {
258
+ subs.splice(i, 1)
259
+ }
260
+ }
261
+ };
262
+
263
+ Store.prototype.watch = function watch (getter, cb, options) {
264
+ var this$1 = this;
265
+
266
+ assert(typeof getter === 'function', "store.watch only accepts a function.")
267
+ return this._watcherVM.$watch(function () { return getter(this$1.state); }, cb, options)
268
+ };
269
+
270
+ Store.prototype.replaceState = function replaceState (state) {
271
+ var this$1 = this;
272
+
273
+ this._withCommit(function () {
274
+ this$1._vm.state = state
275
+ })
276
+ };
277
+
278
+ Store.prototype.registerModule = function registerModule (path, module) {
279
+ if (typeof path === 'string') { path = [path] }
280
+ assert(Array.isArray(path), "module path must be a string or an Array.")
281
+ this._runtimeModules[path.join('.')] = module
282
+ installModule(this, this.state, path, module)
283
+ // reset store to update getters...
284
+ resetStoreVM(this, this.state)
285
+ };
286
+
287
+ Store.prototype.unregisterModule = function unregisterModule (path) {
288
+ var this$1 = this;
289
+
290
+ if (typeof path === 'string') { path = [path] }
291
+ assert(Array.isArray(path), "module path must be a string or an Array.")
292
+ delete this._runtimeModules[path.join('.')]
293
+ this._withCommit(function () {
294
+ var parentState = getNestedState(this$1.state, path.slice(0, -1))
295
+ Vue.delete(parentState, path[path.length - 1])
296
+ })
297
+ resetStore(this)
298
+ };
299
+
300
+ Store.prototype.hotUpdate = function hotUpdate (newOptions) {
301
+ updateModule(this._options, newOptions)
302
+ resetStore(this)
303
+ };
304
+
305
+ Store.prototype._withCommit = function _withCommit (fn) {
306
+ var committing = this._committing
307
+ this._committing = true
308
+ fn()
309
+ this._committing = committing
310
+ };
311
+
312
+ Object.defineProperties( Store.prototype, prototypeAccessors );
313
+
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
+ function resetStore (store) {
339
+ store._actions = Object.create(null)
340
+ store._mutations = Object.create(null)
341
+ store._wrappedGetters = Object.create(null)
342
+ var state = store.state
343
+ // init root module
344
+ installModule(store, state, [], store._options, true)
345
+ // init all runtime modules
346
+ Object.keys(store._runtimeModules).forEach(function (key) {
347
+ installModule(store, state, key.split('.'), store._runtimeModules[key], true)
348
+ })
349
+ // reset vm
350
+ resetStoreVM(store, state)
351
+ }
352
+
353
+ function resetStoreVM (store, state) {
354
+ var oldVm = store._vm
355
+
356
+ // bind store public getters
357
+ store.getters = {}
358
+ var wrappedGetters = store._wrappedGetters
359
+ var computed = {}
360
+ Object.keys(wrappedGetters).forEach(function (key) {
361
+ var fn = wrappedGetters[key]
362
+ // use computed to leverage its lazy-caching mechanism
363
+ computed[key] = function () { return fn(store); }
364
+ Object.defineProperty(store.getters, key, {
365
+ get: function () { return store._vm[key]; }
366
+ })
367
+ })
368
+
369
+ // use a Vue instance to store the state tree
370
+ // suppress warnings just in case the user has added
371
+ // some funky global mixins
372
+ var silent = Vue.config.silent
373
+ Vue.config.silent = true
374
+ store._vm = new Vue({
375
+ data: { state: state },
376
+ computed: computed
377
+ })
378
+ Vue.config.silent = silent
379
+
380
+ // enable strict mode for new vm
381
+ if (store.strict) {
382
+ enableStrictMode(store)
383
+ }
384
+
385
+ if (oldVm) {
386
+ // dispatch changes in all subscribed watchers
387
+ // to force getter re-evaluation.
388
+ store._withCommit(function () {
389
+ oldVm.state = null
390
+ })
391
+ Vue.nextTick(function () { return oldVm.$destroy(); })
392
+ }
393
+ }
394
+
395
+ function installModule (store, rootState, path, module, hot) {
396
+ var isRoot = !path.length
397
+ var state = module.state;
398
+ var actions = module.actions;
399
+ var mutations = module.mutations;
400
+ var getters = module.getters;
401
+ var modules = module.modules;
402
+
403
+ // set state
404
+ if (!isRoot && !hot) {
405
+ var parentState = getNestedState(rootState, path.slice(0, -1))
406
+ var moduleName = path[path.length - 1]
407
+ store._withCommit(function () {
408
+ Vue.set(parentState, moduleName, state || {})
409
+ })
410
+ }
411
+
412
+ if (mutations) {
413
+ Object.keys(mutations).forEach(function (key) {
414
+ registerMutation(store, key, mutations[key], path)
415
+ })
416
+ }
417
+
418
+ if (actions) {
419
+ Object.keys(actions).forEach(function (key) {
420
+ registerAction(store, key, actions[key], path)
421
+ })
422
+ }
423
+
424
+ if (getters) {
425
+ wrapGetters(store, getters, path)
426
+ }
427
+
428
+ if (modules) {
429
+ Object.keys(modules).forEach(function (key) {
430
+ installModule(store, rootState, path.concat(key), modules[key], hot)
431
+ })
432
+ }
433
+ }
434
+
435
+ function registerMutation (store, type, handler, path) {
436
+ if ( path === void 0 ) path = [];
437
+
438
+ var entry = store._mutations[type] || (store._mutations[type] = [])
439
+ entry.push(function wrappedMutationHandler (payload) {
440
+ handler(getNestedState(store.state, path), payload)
441
+ })
442
+ }
443
+
444
+ function registerAction (store, type, handler, path) {
445
+ if ( path === void 0 ) path = [];
446
+
447
+ var entry = store._actions[type] || (store._actions[type] = [])
448
+ var dispatch = store.dispatch;
449
+ var commit = store.commit;
450
+ entry.push(function wrappedActionHandler (payload, cb) {
451
+ var res = handler({
452
+ dispatch: dispatch,
453
+ commit: commit,
454
+ getters: store.getters,
455
+ state: getNestedState(store.state, path),
456
+ rootState: store.state
457
+ }, payload, cb)
458
+ if (!isPromise(res)) {
459
+ res = Promise.resolve(res)
460
+ }
461
+ if (store._devtoolHook) {
462
+ return res.catch(function (err) {
463
+ store._devtoolHook.emit('vuex:error', err)
464
+ throw err
465
+ })
466
+ } else {
467
+ return res
468
+ }
469
+ })
470
+ }
471
+
472
+ function wrapGetters (store, moduleGetters, modulePath) {
473
+ Object.keys(moduleGetters).forEach(function (getterKey) {
474
+ var rawGetter = moduleGetters[getterKey]
475
+ if (store._wrappedGetters[getterKey]) {
476
+ console.error(("[vuex] duplicate getter key: " + getterKey))
477
+ return
478
+ }
479
+ store._wrappedGetters[getterKey] = function wrappedGetter (store) {
480
+ return rawGetter(
481
+ getNestedState(store.state, modulePath), // local state
482
+ store.getters, // getters
483
+ store.state // root state
484
+ )
485
+ }
486
+ })
487
+ }
488
+
489
+ function enableStrictMode (store) {
490
+ store._vm.$watch('state', function () {
491
+ assert(store._committing, "Do not mutate vuex store state outside mutation handlers.")
492
+ }, { deep: true, sync: true })
493
+ }
494
+
495
+ function getNestedState (state, path) {
496
+ return path.length
497
+ ? path.reduce(function (state, key) { return state[key]; }, state)
498
+ : state
499
+ }
500
+
501
+ function install (_Vue) {
502
+ if (Vue) {
503
+ console.error(
504
+ '[vuex] already installed. Vue.use(Vuex) should be called only once.'
505
+ )
506
+ return
507
+ }
508
+ Vue = _Vue
509
+ applyMixin(Vue)
510
+ }
511
+
512
+ // auto install in dist mode
513
+ if (typeof window !== 'undefined' && window.Vue) {
514
+ install(window.Vue)
515
+ }
516
+
517
+ var index = {
518
+ Store: Store,
519
+ install: install,
520
+ mapState: mapState,
521
+ mapMutations: mapMutations,
522
+ mapGetters: mapGetters,
523
+ mapActions: mapActions
524
+ }
525
+
526
+ return index;
527
+
528
+ })));
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.29
4
+ version: 1.0.30
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-10-10 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,8 +38,8 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Latest Vue.js + vue-router + vue-resource + vue-validator for Rails -
42
- ship with Vue 2.x
41
+ description: Latest Vue.js + vue-router + vue-resource + vue-validator + vuex for
42
+ Rails - ship with Vue 2.x
43
43
  email:
44
44
  - ytbryan@gmail.com
45
45
  executables: []
@@ -57,6 +57,7 @@ files:
57
57
  - vendor/assets/javascripts/vue-validator.js
58
58
  - vendor/assets/javascripts/vue.js
59
59
  - vendor/assets/javascripts/vue2.js
60
+ - vendor/assets/javascripts/vuex.js
60
61
  homepage: http://github.com/ytbryan/vuejs
61
62
  licenses:
62
63
  - MIT
@@ -83,6 +84,6 @@ rubyforge_project:
83
84
  rubygems_version: 2.5.1
84
85
  signing_key:
85
86
  specification_version: 4
86
- summary: Latest Vue.js + vue-router + vue-resource + vue-validator for Rails - ship
87
- with Vue 2.x
87
+ summary: Latest Vue.js + vue-router + vue-resource + vue-validator + vuex for Rails
88
+ - ship with Vue 2.x
88
89
  test_files: []