-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.js
13453 lines (11943 loc) · 328 KB
/
bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],2:[function(require,module,exports){
var Vue = require('vue');
var VueRouter = require('vue-router');
Vue.use(require('vue-router'));
new Vue({
el: '#nav',
data: {
hellothere: 'Hello :)'
}
})
var toDo = require('./components/todo.vue');
var newPage = Vue.extend({
template: '<p>This is a new page.</p>'
})
// The router needs a root component to render.
// For demo purposes, we will just use an empty one
// because we are using the HTML as the app template.
var App = Vue.extend({})
// Create a router instance.
// You can pass in additional options here, but let's
// keep it simple for now.
var router = new VueRouter()
// Define some routes.
// Each route should map to a component. The "component" can
// either be an actual component constructor created via
// Vue.extend(), or just a component options object.
// We'll talk about nested routes later.
router.map({
'/todo': {
component: toDo
},
'/newpage': {
component: newPage
}
})
// Now we can start the app!
// The router will create an instance of App and mount to
// the element matching the selector #app.
router.start(App, '#app')
$(window).on('hashchange', function(e){
if (window.location.hash == '#!/todo') {
$(".navbar-nav li").removeClass();
$(".navbar-nav #to-do").addClass("active");
}
else {
$(".navbar-nav li").removeClass();
$(".navbar-nav #new-page").addClass("active");
}
});
},{"./components/todo.vue":3,"vue":103,"vue-router":10}],3:[function(require,module,exports){
'use strict';
module.exports = {
data: function data() {
return {
tasks: [],
newTask: '',
filters: {
inProcess: function inProcess(task) {
return !task.completed;
},
completed: function completed(task) {
return task.completed;
}
}
};
},
computed: {
completions: function completions() {
return this.tasks.filter(this.filters.completed);
},
remaining: function remaining() {
return this.tasks.filter(this.filters.inProcess);
}
},
methods: {
addTask: function addTask(e) {
console.log(this.$parent.$options);
e.preventDefault();
if (!this.newTask) return;
this.tasks.push({
body: this.newTask,
completed: false
});
this.newTask = '';
},
editTask: function editTask(task) {
this.removeTask(task);
this.newTask = task.body;
this.$$.newTask.focus();
},
toggleTaskCompletion: function toggleTaskCompletion(task) {
task.completed = !task.completed;
},
completeAll: function completeAll() {
this.tasks.forEach(function (task) {
task.completed = true;
});
},
clearCompleted: function clearCompleted() {
this.tasks = this.tasks.filter(this.filters.inProcess);
},
removeTask: function removeTask(task) {
this.tasks.$remove(task);
}
}
};
if (module.exports.__esModule) module.exports = module.exports.default
;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n\n\t<div id=\"tasks\">\n\n\t <!-- The Form to Add a New Task -->\n\t <form v-on:submit=\"addTask\">\n\t <div class=\"form-group\">\n\t <input v-model=\"newTask\" v-el=\"newTask\" class=\"form-control\" placeholder=\"I need to...\" v-on:keyup.enter=\"addTask\">\n\t </div>\n\n\t <button class=\"btn btn-primary\">\n\t Add Task\n\t </button>\n\n\t <button v-on:click=\"completeAll\" class=\"btn btn-default\">\n\t Mark All As Completed?\n\t </button>\n\t </form>\n\n\n\t <!-- The List of Todos -->\n\t <div v-show=\"remaining.length\">\n\t <h1>Tasks ({{ remaining.length }})</h1>\n\n\t <ol class=\"list-group\">\n\t <li v-for=\"task in remaining\" class=\"list-group-item\">\n\t <span v-on:dblclick=\"editTask(task)\">{{ task.body }}</span>\n\n\t <button v-on:click=\"removeTask(task)\">✗</button>\n\t <button v-on:click=\"toggleTaskCompletion(task)\">✔</button>\n\t </li>\n\t </ol>\n\t </div>\n\n\n\t <!-- The List of Completed Tasks -->\n\t <div v-if=\"completions.length\">\n\t <h2>Completed ({{ completions.length }})</h2>\n\n\t <ol class=\"list-group\">\n\t <li v-for=\"task in completions\" class=\"list-group-item\">\n\t {{ task.body }}\n\n\t <button v-on:click=\"toggleTaskCompletion(task)\">✗</button>\n\t </li>\n\t </ol>\n\n\t <button v-on:click=\"clearCompleted\" class=\"btn btn-danger\">Clear Completed</button>\n\t </div>\n\t \n\t <br>\n\t <pre>{{$data | json}}</pre>\n\n\t</div>\n\n"
if (module.hot) {(function () { module.hot.accept()
var hotAPI = require("vue-hot-reload-api")
hotAPI.install(require("vue"), true)
if (!hotAPI.compatible) return
var id = "C:\\xampp\\htdocs\\lab\\vue\\components\\todo.vue"
if (!module.hot.data) {
hotAPI.createRecord(id, module.exports)
} else {
hotAPI.update(id, module.exports, module.exports.template)
}
})()}
},{"vue":103,"vue-hot-reload-api":4}],4:[function(require,module,exports){
var Vue // late bind
var map = Object.create(null)
var shimmed = false
var isBrowserify = false
/**
* Determine compatibility and apply patch.
*
* @param {Function} vue
* @param {Boolean} browserify
*/
exports.install = function (vue, browserify) {
if (shimmed) return
shimmed = true
Vue = vue
isBrowserify = browserify
exports.compatible = !!Vue.internalDirectives
if (!exports.compatible) {
console.warn(
'[HMR] vue-loader hot reload is only compatible with ' +
'Vue.js 1.0.0+.'
)
return
}
// patch view directive
patchView(Vue.internalDirectives.component)
console.log('[HMR] Vue component hot reload shim applied.')
// shim router-view if present
var routerView = Vue.elementDirective('router-view')
if (routerView) {
patchView(routerView)
console.log('[HMR] vue-router <router-view> hot reload shim applied.')
}
}
/**
* Shim the view directive (component or router-view).
*
* @param {Object} View
*/
function patchView (View) {
var unbuild = View.unbuild
View.unbuild = function (defer) {
if (!this.hotUpdating) {
var prevComponent = this.childVM && this.childVM.constructor
removeView(prevComponent, this)
// defer = true means we are transitioning to a new
// Component. Register this new component to the list.
if (defer) {
addView(this.Component, this)
}
}
// call original
return unbuild.call(this, defer)
}
}
/**
* Add a component view to a Component's hot list
*
* @param {Function} Component
* @param {Directive} view - view directive instance
*/
function addView (Component, view) {
var id = Component && Component.options.hotID
if (id) {
if (!map[id]) {
map[id] = {
Component: Component,
views: [],
instances: []
}
}
map[id].views.push(view)
}
}
/**
* Remove a component view from a Component's hot list
*
* @param {Function} Component
* @param {Directive} view - view directive instance
*/
function removeView (Component, view) {
var id = Component && Component.options.hotID
if (id) {
map[id].views.$remove(view)
}
}
/**
* Create a record for a hot module, which keeps track of its construcotr,
* instnaces and views (component directives or router-views).
*
* @param {String} id
* @param {Object} options
*/
exports.createRecord = function (id, options) {
var Component = typeof options === 'function'
? options
: Vue.extend(options)
options = Component.options
if (typeof options.el !== 'string' && typeof options.data !== 'object') {
makeOptionsHot(id, options)
map[id] = {
Component: Component,
views: [],
instances: []
}
}
}
/**
* Make a Component options object hot.
*
* @param {String} id
* @param {Object} options
*/
function makeOptionsHot (id, options) {
options.hotID = id
injectHook(options, 'created', function () {
map[id].instances.push(this)
})
injectHook(options, 'beforeDestroy', function () {
map[id].instances.$remove(this)
})
}
/**
* Inject a hook to a hot reloadable component so that
* we can keep track of it.
*
* @param {Object} options
* @param {String} name
* @param {Function} hook
*/
function injectHook (options, name, hook) {
var existing = options[name]
options[name] = existing
? Array.isArray(existing)
? existing.concat(hook)
: [existing, hook]
: [hook]
}
/**
* Update a hot component.
*
* @param {String} id
* @param {Object|null} newOptions
* @param {String|null} newTemplate
*/
exports.update = function (id, newOptions, newTemplate) {
var record = map[id]
// force full-reload if an instance of the component is active but is not
// managed by a view
if (!record || (record.instances.length && !record.views.length)) {
console.log('[HMR] Root or manually-mounted instance modified. Full reload may be required.')
if (!isBrowserify) {
window.location.reload()
} else {
// browserify-hmr somehow sends incomplete bundle if we reload here
return
}
}
if (!isBrowserify) {
// browserify-hmr already logs this
console.log('[HMR] Updating component: ' + format(id))
}
var Component = record.Component
// update constructor
if (newOptions) {
// in case the user exports a constructor
Component = record.Component = typeof newOptions === 'function'
? newOptions
: Vue.extend(newOptions)
makeOptionsHot(id, Component.options)
}
if (newTemplate) {
Component.options.template = newTemplate
}
// handle recursive lookup
if (Component.options.name) {
Component.options.components[Component.options.name] = Component
}
// reset constructor cached linker
Component.linker = null
// reload all views
record.views.forEach(function (view) {
updateView(view, Component)
})
}
/**
* Update a component view instance
*
* @param {Directive} view
* @param {Function} Component
*/
function updateView (view, Component) {
if (!view._bound) {
return
}
view.Component = Component
view.hotUpdating = true
// disable transitions
view.vm._isCompiled = false
// save state
var state = view.childVM.$data
// remount, make sure to disable keep-alive
var keepAlive = view.keepAlive
view.keepAlive = false
view.mountComponent()
view.keepAlive = keepAlive
// restore state
view.childVM.$data = state
// re-eanble transitions
view.vm._isCompiled = true
view.hotUpdating = false
}
function format (id) {
return id.match(/[^\/]+\.vue$/)[0]
}
},{}],5:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _util = require('../util');
var trailingSlashRE = /\/$/;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
// install v-link, which provides navigation support for
// HTML5 history mode
exports['default'] = function (Vue) {
var _ = Vue.util;
Vue.directive('link', {
bind: function bind() {
var _this = this;
var vm = this.vm;
/* istanbul ignore if */
if (!vm.$route) {
_util.warn('v-link can only be used inside a ' + 'router-enabled app.');
return;
}
var router = vm.$route.router;
this.handler = function (e) {
// don't redirect with control keys
if (e.metaKey || e.ctrlKey || e.shiftKey) return;
// don't redirect when preventDefault called
if (e.defaultPrevented) return;
// don't redirect on right click
if (e.button !== 0) return;
var target = _this.target;
var go = function go(target) {
e.preventDefault();
if (target != null) {
router.go(target);
}
};
if (_this.el.tagName === 'A' || e.target === _this.el) {
// v-link on <a v-link="'path'">
go(target);
} else {
// v-link delegate on <div v-link>
var el = e.target;
while (el && el.tagName !== 'A' && el !== _this.el) {
el = el.parentNode;
}
if (!el) return;
if (el.tagName !== 'A' || !el.href) {
// allow not anchor
go(target);
} else if (sameOrigin(el)) {
go({
path: el.pathname,
replace: target && target.replace,
append: target && target.append
});
}
}
};
this.el.addEventListener('click', this.handler);
// manage active link class
this.unwatch = vm.$watch('$route.path', _.bind(this.updateClasses, this));
},
update: function update(path) {
var router = this.vm.$route.router;
var append = undefined;
this.target = path;
if (_.isObject(path)) {
append = path.append;
this.exact = path.exact;
this.prevActiveClass = this.activeClass;
this.activeClass = path.activeClass;
}
path = this.path = router._stringifyPath(path);
this.activeRE = path && !this.exact ? new RegExp('^' + path.replace(/\/$/, '').replace(regexEscapeRE, '\\$&') + '(\\/|$)') : null;
this.updateClasses(this.vm.$route.path);
var isAbsolute = path.charAt(0) === '/';
// do not format non-hash relative paths
var href = path && (router.mode === 'hash' || isAbsolute) ? router.history.formatPath(path, append) : path;
if (this.el.tagName === 'A') {
if (href) {
this.el.href = href;
} else {
this.el.removeAttribute('href');
}
}
},
updateClasses: function updateClasses(path) {
var el = this.el;
var dest = this.path;
var router = this.vm.$route.router;
var activeClass = this.activeClass || router._linkActiveClass;
// clear old class
if (this.prevActiveClass !== activeClass) {
_.removeClass(el, this.prevActiveClass);
}
// add new class
if (this.exact) {
if (dest === path ||
// also allow additional trailing slash
dest.charAt(dest.length - 1) !== '/' && dest === path.replace(trailingSlashRE, '')) {
_.addClass(el, activeClass);
} else {
_.removeClass(el, activeClass);
}
} else {
if (this.activeRE && this.activeRE.test(path)) {
_.addClass(el, activeClass);
} else {
_.removeClass(el, activeClass);
}
}
},
unbind: function unbind() {
this.el.removeEventListener('click', this.handler);
this.unwatch && this.unwatch();
}
});
function sameOrigin(link) {
return link.protocol === location.protocol && link.hostname === location.hostname && link.port === location.port;
}
};
module.exports = exports['default'];
},{"../util":15}],6:[function(require,module,exports){
'use strict';
exports.__esModule = true;
var _util = require('../util');
var _pipeline = require('../pipeline');
exports['default'] = function (Vue) {
var _ = Vue.util;
var componentDef =
// 0.12
Vue.directive('_component') ||
// 1.0
Vue.internalDirectives.component;
// <router-view> extends the internal component directive
var viewDef = _.extend({}, componentDef);
// with some overrides
_.extend(viewDef, {
_isRouterView: true,
bind: function bind() {
var route = this.vm.$route;
/* istanbul ignore if */
if (!route) {
_util.warn('<router-view> can only be used inside a ' + 'router-enabled app.');
return;
}
// force dynamic directive so v-component doesn't
// attempt to build right now
this._isDynamicLiteral = true;
// finally, init by delegating to v-component
componentDef.bind.call(this);
// all we need to do here is registering this view
// in the router. actual component switching will be
// managed by the pipeline.
var router = this.router = route.router;
router._views.unshift(this);
// note the views are in reverse order.
var parentView = router._views[1];
if (parentView) {
// register self as a child of the parent view,
// instead of activating now. This is so that the
// child's activate hook is called after the
// parent's has resolved.
parentView.childView = this;
}
// handle late-rendered view
// two possibilities:
// 1. root view rendered after transition has been
// validated;
// 2. child view rendered after parent view has been
// activated.
var transition = route.router._currentTransition;
if (!parentView && transition.done || parentView && parentView.activated) {
var depth = parentView ? parentView.depth + 1 : 0;
_pipeline.activate(this, transition, depth);
}
},
unbind: function unbind() {
this.router._views.$remove(this);
componentDef.unbind.call(this);
}
});
Vue.elementDirective('router-view', viewDef);
};
module.exports = exports['default'];
},{"../pipeline":12,"../util":15}],7:[function(require,module,exports){
'use strict';
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
exports.__esModule = true;
var _util = require('../util');
var AbstractHistory = (function () {
function AbstractHistory(_ref) {
var onChange = _ref.onChange;
_classCallCheck(this, AbstractHistory);
this.onChange = onChange;
this.currentPath = '/';
}
AbstractHistory.prototype.start = function start() {
this.onChange('/');
};
AbstractHistory.prototype.stop = function stop() {
// noop
};
AbstractHistory.prototype.go = function go(path, replace, append) {
path = this.currentPath = this.formatPath(path, append);
this.onChange(path);
};
AbstractHistory.prototype.formatPath = function formatPath(path, append) {
return path.charAt(0) === '/' ? path : _util.resolvePath(this.currentPath, path, append);
};
return AbstractHistory;
})();
exports['default'] = AbstractHistory;
module.exports = exports['default'];
},{"../util":15,"babel-runtime/helpers/class-call-check":19}],8:[function(require,module,exports){
'use strict';
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
exports.__esModule = true;
var _util = require('../util');
var HashHistory = (function () {
function HashHistory(_ref) {
var hashbang = _ref.hashbang;
var onChange = _ref.onChange;
_classCallCheck(this, HashHistory);
this.hashbang = hashbang;
this.onChange = onChange;
}
HashHistory.prototype.start = function start() {
var self = this;
this.listener = function () {
var path = location.hash;
var raw = path.replace(/^#!?/, '');
// always
if (raw.charAt(0) !== '/') {
raw = '/' + raw;
}
var formattedPath = self.formatPath(raw);
if (formattedPath !== path) {
location.replace(formattedPath);
return;
}
var pathToMatch = decodeURI(path.replace(/^#!?/, '') + location.search);
self.onChange(pathToMatch);
};
window.addEventListener('hashchange', this.listener);
this.listener();
};
HashHistory.prototype.stop = function stop() {
window.removeEventListener('hashchange', this.listener);
};
HashHistory.prototype.go = function go(path, replace, append) {
path = this.formatPath(path, append);
if (replace) {
location.replace(path);
} else {
location.hash = path;
}
};
HashHistory.prototype.formatPath = function formatPath(path, append) {
var isAbsoloute = path.charAt(0) === '/';
var prefix = '#' + (this.hashbang ? '!' : '');
return isAbsoloute ? prefix + path : prefix + _util.resolvePath(location.hash.replace(/^#!?/, ''), path, append);
};
return HashHistory;
})();
exports['default'] = HashHistory;
module.exports = exports['default'];
},{"../util":15,"babel-runtime/helpers/class-call-check":19}],9:[function(require,module,exports){
'use strict';
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
exports.__esModule = true;
var _util = require('../util');
var hashRE = /#.*$/;
var HTML5History = (function () {
function HTML5History(_ref) {
var root = _ref.root;
var onChange = _ref.onChange;
_classCallCheck(this, HTML5History);
if (root) {
// make sure there's the starting slash
if (root.charAt(0) !== '/') {
root = '/' + root;
}
// remove trailing slash
this.root = root.replace(/\/$/, '');
this.rootRE = new RegExp('^\\' + this.root);
} else {
this.root = null;
}
this.onChange = onChange;
// check base tag
var baseEl = document.querySelector('base');
this.base = baseEl && baseEl.getAttribute('href');
}
HTML5History.prototype.start = function start() {
var _this = this;
this.listener = function (e) {
var url = decodeURI(location.pathname + location.search);
if (_this.root) {
url = url.replace(_this.rootRE, '');
}
_this.onChange(url, e && e.state, location.hash);
};
window.addEventListener('popstate', this.listener);
this.listener();
};
HTML5History.prototype.stop = function stop() {
window.removeEventListener('popstate', this.listener);
};
HTML5History.prototype.go = function go(path, replace, append) {
var url = this.formatPath(path, append);
if (replace) {
history.replaceState({}, '', url);
} else {
// record scroll position by replacing current state
history.replaceState({
pos: {
x: window.pageXOffset,
y: window.pageYOffset
}
}, '');
// then push new state
history.pushState({}, '', url);
}
var hashMatch = path.match(hashRE);
var hash = hashMatch && hashMatch[0];
path = url
// strip hash so it doesn't mess up params
.replace(hashRE, '')
// remove root before matching
.replace(this.rootRE, '');
this.onChange(path, null, hash);
};
HTML5History.prototype.formatPath = function formatPath(path, append) {
return path.charAt(0) === '/'
// absolute path
? this.root ? this.root + '/' + path.replace(/^\//, '') : path : _util.resolvePath(this.base || location.pathname, path, append);
};
return HTML5History;
})();
exports['default'] = HTML5History;
module.exports = exports['default'];
},{"../util":15,"babel-runtime/helpers/class-call-check":19}],10:[function(require,module,exports){
'use strict';
var _classCallCheck = require('babel-runtime/helpers/class-call-check')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
exports.__esModule = true;
var _util = require('./util');
var _util2 = _interopRequireDefault(_util);
var _override = require('./override');
var _override2 = _interopRequireDefault(_override);
var _routeRecognizer = require('route-recognizer');
var _routeRecognizer2 = _interopRequireDefault(_routeRecognizer);
var _route = require('./route');
var _route2 = _interopRequireDefault(_route);
var _transition = require('./transition');
var _transition2 = _interopRequireDefault(_transition);
var _directivesView = require('./directives/view');
var _directivesView2 = _interopRequireDefault(_directivesView);
var _directivesLink = require('./directives/link');
var _directivesLink2 = _interopRequireDefault(_directivesLink);
var _historyAbstract = require('./history/abstract');
var _historyAbstract2 = _interopRequireDefault(_historyAbstract);
var _historyHash = require('./history/hash');
var _historyHash2 = _interopRequireDefault(_historyHash);
var _historyHtml5 = require('./history/html5');
var _historyHtml52 = _interopRequireDefault(_historyHtml5);
var historyBackends = {
abstract: _historyAbstract2['default'],
hash: _historyHash2['default'],
html5: _historyHtml52['default']
};
// late bind during install
var Vue = undefined;
/**
* Router constructor
*
* @param {Object} [options]
*/
var Router = (function () {
function Router() {
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var _ref$hashbang = _ref.hashbang;
var hashbang = _ref$hashbang === undefined ? true : _ref$hashbang;
var _ref$abstract = _ref.abstract;
var abstract = _ref$abstract === undefined ? false : _ref$abstract;
var _ref$history = _ref.history;
var history = _ref$history === undefined ? false : _ref$history;
var _ref$saveScrollPosition = _ref.saveScrollPosition;
var saveScrollPosition = _ref$saveScrollPosition === undefined ? false : _ref$saveScrollPosition;
var _ref$transitionOnLoad = _ref.transitionOnLoad;
var transitionOnLoad = _ref$transitionOnLoad === undefined ? false : _ref$transitionOnLoad;
var _ref$suppressTransitionError = _ref.suppressTransitionError;
var suppressTransitionError = _ref$suppressTransitionError === undefined ? false : _ref$suppressTransitionError;
var _ref$root = _ref.root;
var root = _ref$root === undefined ? null : _ref$root;
var _ref$linkActiveClass = _ref.linkActiveClass;
var linkActiveClass = _ref$linkActiveClass === undefined ? 'v-link-active' : _ref$linkActiveClass;
_classCallCheck(this, Router);
/* istanbul ignore if */
if (!Router.installed) {
throw new Error('Please install the Router with Vue.use() before ' + 'creating an instance.');
}
// Vue instances
this.app = null;
this._views = [];
this._children = [];
// route recognizer
this._recognizer = new _routeRecognizer2['default']();
this._guardRecognizer = new _routeRecognizer2['default']();
// state
this._started = false;
this._startCb = null;
this._currentRoute = {};
this._currentTransition = null;
this._previousTransition = null;
this._notFoundHandler = null;
this._notFoundRedirect = null;
this._beforeEachHooks = [];
this._afterEachHooks = [];
// feature detection
this._hasPushState = typeof window !== 'undefined' && window.history && window.history.pushState;
// trigger transition on initial render?
this._rendered = false;
this._transitionOnLoad = transitionOnLoad;