vuejs 1.0.18 → 1.0.20

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: f9d6bd3f10a680d03ac1a8665ab2b1c0959dd259
4
- data.tar.gz: 4d5acc12155234311f6eff151929182a23baf5e1
3
+ metadata.gz: 102d3087a91ffb15dba385f2312742a48b90556b
4
+ data.tar.gz: 5129db28c66a55caf135ef4e6fd2c164f8fffc07
5
5
  SHA512:
6
- metadata.gz: 303de4d5fa5cdf359f5d11f235ea6c48cdc7871c667dcd6f8b84b909ae65b3ff86829eeae89842940d753570f2f67a108326e3576ddc878315c190c1def474ef
7
- data.tar.gz: f6cf5a6e0b61d1ab02c291a263f23f11a5b44f74e9bef3423d70310fe6be8d7aedeb8759cfaae61bff70ed24e3bbace5570cd0926f1e209094605e01c02dd537
6
+ metadata.gz: 9959cd6a8cb7366c1df8e60f6c78ae8f3e8f70f3e6d069af47063067533d8e1885570a633e8715af7c71529cc93e4b267c729f2dee1631a436def1997df1e413
7
+ data.tar.gz: c6a887d1c5f7bf9ca79b91ca928a36a44c22c2245d3e486616753b54dcb3b8588c2e94ecd3d402d5fc4564005e88bfb37680470f18aa3d607a390bd4bdf97417
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Vuejs
2
2
 
3
- Vuejs ships with the latest [Vue.js + router + resource](http://vuejs.org/) and integrate with Rails' asset pipeline.
3
+ Vuejs ships with the latest [Vue.js + router + resource](http://vuejs.org/) and integrate with Rails' asset pipeline. Vue.js is created by Evan You.
4
4
 
5
- The current version is Vue.js (v0.7.11) + vue-router (v1.0.17) + vue-resource (0.7.0)
5
+ The current version is Vue.js (v0.7.11) + vue-router (v1.0.20) + vue-resource (0.7.0)
6
6
 
7
7
  > Reactive Components for Modern Web Interfaces
8
8
 
@@ -29,8 +29,8 @@ Or install it yourself as:
29
29
  //= require jquery_ujs
30
30
  //= require turbolinks
31
31
  //= require vue
32
- //= require vue-router #(optional)
33
- //= require vue-resource #(optional)
32
+ //= require vue-router
33
+ //= require vue-resource
34
34
  //= require_tree .
35
35
  ```
36
36
 
@@ -1,5 +1,13 @@
1
1
  module Log
2
2
  MESSAGE = "
3
+
4
+ ██╗ ██╗██╗ ██╗███████╗
5
+ ██║ ██║██║ ██║██╔════╝
6
+ ██║ ██║██║ ██║█████╗
7
+ ╚██╗ ██╔╝██║ ██║██╔══╝
8
+ ╚████╔╝ ╚██████╔╝███████╗
9
+ ╚═══╝ ╚═════╝ ╚══════╝
10
+
3
11
  Pull Request -> https://github.com/ytbryan/vuejs/pulls
4
12
  "
5
13
  end
@@ -1,3 +1,3 @@
1
1
  module Vuejs
2
- VERSION = "1.0.18"
2
+ VERSION = "1.0.20"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v1.0.18
2
+ * Vue.js v1.0.20
3
3
  * (c) 2016 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -648,7 +648,7 @@
648
648
  * ]
649
649
  * }
650
650
  *
651
- * @param {String} str
651
+ * @param {String} s
652
652
  * @return {Object}
653
653
  */
654
654
 
@@ -1253,6 +1253,22 @@ var transition = Object.freeze({
1253
1253
  el.removeEventListener(event, cb);
1254
1254
  }
1255
1255
 
1256
+ /**
1257
+ * For IE9 compat: when both class and :class are present
1258
+ * getAttribute('class') returns wrong value...
1259
+ *
1260
+ * @param {Element} el
1261
+ * @return {String}
1262
+ */
1263
+
1264
+ function getClass(el) {
1265
+ var classname = el.className;
1266
+ if (typeof classname === 'object') {
1267
+ classname = classname.baseVal || '';
1268
+ }
1269
+ return classname;
1270
+ }
1271
+
1256
1272
  /**
1257
1273
  * In IE9, setAttribute('class') will result in empty class
1258
1274
  * if the element also has the :class attribute; However in
@@ -1283,7 +1299,7 @@ var transition = Object.freeze({
1283
1299
  if (el.classList) {
1284
1300
  el.classList.add(cls);
1285
1301
  } else {
1286
- var cur = ' ' + (el.getAttribute('class') || '') + ' ';
1302
+ var cur = ' ' + getClass(el) + ' ';
1287
1303
  if (cur.indexOf(' ' + cls + ' ') < 0) {
1288
1304
  setClass(el, (cur + cls).trim());
1289
1305
  }
@@ -1301,7 +1317,7 @@ var transition = Object.freeze({
1301
1317
  if (el.classList) {
1302
1318
  el.classList.remove(cls);
1303
1319
  } else {
1304
- var cur = ' ' + (el.getAttribute('class') || '') + ' ';
1320
+ var cur = ' ' + getClass(el) + ' ';
1305
1321
  var tar = ' ' + cls + ' ';
1306
1322
  while (cur.indexOf(tar) >= 0) {
1307
1323
  cur = cur.replace(tar, ' ');
@@ -1500,863 +1516,754 @@ var transition = Object.freeze({
1500
1516
  }
1501
1517
  }
1502
1518
 
1503
- var uid$1 = 0;
1519
+ var commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/i;
1520
+ var reservedTagRE = /^(slot|partial|component)$/i;
1521
+
1522
+ var isUnknownElement = undefined;
1523
+ if ('development' !== 'production') {
1524
+ isUnknownElement = function (el, tag) {
1525
+ if (tag.indexOf('-') > -1) {
1526
+ // http://stackoverflow.com/a/28210364/1070244
1527
+ return el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;
1528
+ } else {
1529
+ return (/HTMLUnknownElement/.test(el.toString()) &&
1530
+ // Chrome returns unknown for several HTML5 elements.
1531
+ // https://code.google.com/p/chromium/issues/detail?id=540526
1532
+ !/^(data|time|rtc|rb)$/.test(tag)
1533
+ );
1534
+ }
1535
+ };
1536
+ }
1504
1537
 
1505
1538
  /**
1506
- * A dep is an observable that can have multiple
1507
- * directives subscribing to it.
1539
+ * Check if an element is a component, if yes return its
1540
+ * component id.
1508
1541
  *
1509
- * @constructor
1542
+ * @param {Element} el
1543
+ * @param {Object} options
1544
+ * @return {Object|undefined}
1510
1545
  */
1511
- function Dep() {
1512
- this.id = uid$1++;
1513
- this.subs = [];
1514
- }
1515
1546
 
1516
- // the current target watcher being evaluated.
1517
- // this is globally unique because there could be only one
1518
- // watcher being evaluated at any time.
1519
- Dep.target = null;
1547
+ function checkComponentAttr(el, options) {
1548
+ var tag = el.tagName.toLowerCase();
1549
+ var hasAttrs = el.hasAttributes();
1550
+ if (!commonTagRE.test(tag) && !reservedTagRE.test(tag)) {
1551
+ if (resolveAsset(options, 'components', tag)) {
1552
+ return { id: tag };
1553
+ } else {
1554
+ var is = hasAttrs && getIsBinding(el);
1555
+ if (is) {
1556
+ return is;
1557
+ } else if ('development' !== 'production') {
1558
+ var expectedTag = options._componentNameMap && options._componentNameMap[tag];
1559
+ if (expectedTag) {
1560
+ warn('Unknown custom element: <' + tag + '> - ' + 'did you mean <' + expectedTag + '>? ' + 'HTML is case-insensitive, remember to use kebab-case in templates.');
1561
+ } else if (isUnknownElement(el, tag)) {
1562
+ warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the "name" option.');
1563
+ }
1564
+ }
1565
+ }
1566
+ } else if (hasAttrs) {
1567
+ return getIsBinding(el);
1568
+ }
1569
+ }
1520
1570
 
1521
1571
  /**
1522
- * Add a directive subscriber.
1572
+ * Get "is" binding from an element.
1523
1573
  *
1524
- * @param {Directive} sub
1574
+ * @param {Element} el
1575
+ * @return {Object|undefined}
1525
1576
  */
1526
1577
 
1527
- Dep.prototype.addSub = function (sub) {
1528
- this.subs.push(sub);
1529
- };
1578
+ function getIsBinding(el) {
1579
+ // dynamic syntax
1580
+ var exp = getAttr(el, 'is');
1581
+ if (exp != null) {
1582
+ return { id: exp };
1583
+ } else {
1584
+ exp = getBindAttr(el, 'is');
1585
+ if (exp != null) {
1586
+ return { id: exp, dynamic: true };
1587
+ }
1588
+ }
1589
+ }
1530
1590
 
1531
1591
  /**
1532
- * Remove a directive subscriber.
1592
+ * Option overwriting strategies are functions that handle
1593
+ * how to merge a parent option value and a child option
1594
+ * value into the final value.
1533
1595
  *
1534
- * @param {Directive} sub
1596
+ * All strategy functions follow the same signature:
1597
+ *
1598
+ * @param {*} parentVal
1599
+ * @param {*} childVal
1600
+ * @param {Vue} [vm]
1535
1601
  */
1536
1602
 
1537
- Dep.prototype.removeSub = function (sub) {
1538
- this.subs.$remove(sub);
1539
- };
1603
+ var strats = config.optionMergeStrategies = Object.create(null);
1540
1604
 
1541
1605
  /**
1542
- * Add self as a dependency to the target watcher.
1606
+ * Helper that recursively merges two data objects together.
1543
1607
  */
1544
1608
 
1545
- Dep.prototype.depend = function () {
1546
- Dep.target.addDep(this);
1547
- };
1609
+ function mergeData(to, from) {
1610
+ var key, toVal, fromVal;
1611
+ for (key in from) {
1612
+ toVal = to[key];
1613
+ fromVal = from[key];
1614
+ if (!hasOwn(to, key)) {
1615
+ set(to, key, fromVal);
1616
+ } else if (isObject(toVal) && isObject(fromVal)) {
1617
+ mergeData(toVal, fromVal);
1618
+ }
1619
+ }
1620
+ return to;
1621
+ }
1548
1622
 
1549
1623
  /**
1550
- * Notify all subscribers of a new value.
1624
+ * Data
1551
1625
  */
1552
1626
 
1553
- Dep.prototype.notify = function () {
1554
- // stablize the subscriber list first
1555
- var subs = toArray(this.subs);
1556
- for (var i = 0, l = subs.length; i < l; i++) {
1557
- subs[i].update();
1627
+ strats.data = function (parentVal, childVal, vm) {
1628
+ if (!vm) {
1629
+ // in a Vue.extend merge, both should be functions
1630
+ if (!childVal) {
1631
+ return parentVal;
1632
+ }
1633
+ if (typeof childVal !== 'function') {
1634
+ 'development' !== 'production' && warn('The "data" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.');
1635
+ return parentVal;
1636
+ }
1637
+ if (!parentVal) {
1638
+ return childVal;
1639
+ }
1640
+ // when parentVal & childVal are both present,
1641
+ // we need to return a function that returns the
1642
+ // merged result of both functions... no need to
1643
+ // check if parentVal is a function here because
1644
+ // it has to be a function to pass previous merges.
1645
+ return function mergedDataFn() {
1646
+ return mergeData(childVal.call(this), parentVal.call(this));
1647
+ };
1648
+ } else if (parentVal || childVal) {
1649
+ return function mergedInstanceDataFn() {
1650
+ // instance merge
1651
+ var instanceData = typeof childVal === 'function' ? childVal.call(vm) : childVal;
1652
+ var defaultData = typeof parentVal === 'function' ? parentVal.call(vm) : undefined;
1653
+ if (instanceData) {
1654
+ return mergeData(instanceData, defaultData);
1655
+ } else {
1656
+ return defaultData;
1657
+ }
1658
+ };
1558
1659
  }
1559
1660
  };
1560
1661
 
1561
- var arrayProto = Array.prototype;
1562
- var arrayMethods = Object.create(arrayProto)
1662
+ /**
1663
+ * El
1664
+ */
1665
+
1666
+ strats.el = function (parentVal, childVal, vm) {
1667
+ if (!vm && childVal && typeof childVal !== 'function') {
1668
+ 'development' !== 'production' && warn('The "el" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.');
1669
+ return;
1670
+ }
1671
+ var ret = childVal || parentVal;
1672
+ // invoke the element factory if this is instance merge
1673
+ return vm && typeof ret === 'function' ? ret.call(vm) : ret;
1674
+ };
1563
1675
 
1564
1676
  /**
1565
- * Intercept mutating methods and emit events
1677
+ * Hooks and param attributes are merged as arrays.
1566
1678
  */
1567
1679
 
1568
- ;['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'].forEach(function (method) {
1569
- // cache original method
1570
- var original = arrayProto[method];
1571
- def(arrayMethods, method, function mutator() {
1572
- // avoid leaking arguments:
1573
- // http://jsperf.com/closure-with-arguments
1574
- var i = arguments.length;
1575
- var args = new Array(i);
1576
- while (i--) {
1577
- args[i] = arguments[i];
1578
- }
1579
- var result = original.apply(this, args);
1580
- var ob = this.__ob__;
1581
- var inserted;
1582
- switch (method) {
1583
- case 'push':
1584
- inserted = args;
1585
- break;
1586
- case 'unshift':
1587
- inserted = args;
1588
- break;
1589
- case 'splice':
1590
- inserted = args.slice(2);
1591
- break;
1592
- }
1593
- if (inserted) ob.observeArray(inserted);
1594
- // notify change
1595
- ob.dep.notify();
1596
- return result;
1597
- });
1598
- });
1680
+ strats.init = strats.created = strats.ready = strats.attached = strats.detached = strats.beforeCompile = strats.compiled = strats.beforeDestroy = strats.destroyed = strats.activate = function (parentVal, childVal) {
1681
+ return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
1682
+ };
1599
1683
 
1600
1684
  /**
1601
- * Swap the element at the given index with a new value
1602
- * and emits corresponding event.
1603
- *
1604
- * @param {Number} index
1605
- * @param {*} val
1606
- * @return {*} - replaced element
1685
+ * 0.11 deprecation warning
1607
1686
  */
1608
1687
 
1609
- def(arrayProto, '$set', function $set(index, val) {
1610
- if (index >= this.length) {
1611
- this.length = Number(index) + 1;
1612
- }
1613
- return this.splice(index, 1, val)[0];
1614
- });
1688
+ strats.paramAttributes = function () {
1689
+ /* istanbul ignore next */
1690
+ 'development' !== 'production' && warn('"paramAttributes" option has been deprecated in 0.12. ' + 'Use "props" instead.');
1691
+ };
1615
1692
 
1616
1693
  /**
1617
- * Convenience method to remove the element at given index.
1694
+ * Assets
1618
1695
  *
1619
- * @param {Number} index
1620
- * @param {*} val
1696
+ * When a vm is present (instance creation), we need to do
1697
+ * a three-way merge between constructor options, instance
1698
+ * options and parent options.
1621
1699
  */
1622
1700
 
1623
- def(arrayProto, '$remove', function $remove(item) {
1624
- /* istanbul ignore if */
1625
- if (!this.length) return;
1626
- var index = indexOf(this, item);
1627
- if (index > -1) {
1628
- return this.splice(index, 1);
1629
- }
1630
- });
1701
+ function mergeAssets(parentVal, childVal) {
1702
+ var res = Object.create(parentVal);
1703
+ return childVal ? extend(res, guardArrayAssets(childVal)) : res;
1704
+ }
1631
1705
 
1632
- var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
1706
+ config._assetTypes.forEach(function (type) {
1707
+ strats[type + 's'] = mergeAssets;
1708
+ });
1633
1709
 
1634
1710
  /**
1635
- * Observer class that are attached to each observed
1636
- * object. Once attached, the observer converts target
1637
- * object's property keys into getter/setters that
1638
- * collect dependencies and dispatches updates.
1711
+ * Events & Watchers.
1639
1712
  *
1640
- * @param {Array|Object} value
1641
- * @constructor
1642
- */
1643
-
1644
- function Observer(value) {
1645
- this.value = value;
1646
- this.dep = new Dep();
1647
- def(value, '__ob__', this);
1648
- if (isArray(value)) {
1649
- var augment = hasProto ? protoAugment : copyAugment;
1650
- augment(value, arrayMethods, arrayKeys);
1651
- this.observeArray(value);
1652
- } else {
1653
- this.walk(value);
1654
- }
1655
- }
1656
-
1657
- // Instance methods
1658
-
1659
- /**
1660
- * Walk through each property and convert them into
1661
- * getter/setters. This method should only be called when
1662
- * value type is Object.
1663
- *
1664
- * @param {Object} obj
1665
- */
1666
-
1667
- Observer.prototype.walk = function (obj) {
1668
- var keys = Object.keys(obj);
1669
- for (var i = 0, l = keys.length; i < l; i++) {
1670
- this.convert(keys[i], obj[keys[i]]);
1671
- }
1672
- };
1673
-
1674
- /**
1675
- * Observe a list of Array items.
1676
- *
1677
- * @param {Array} items
1713
+ * Events & watchers hashes should not overwrite one
1714
+ * another, so we merge them as arrays.
1678
1715
  */
1679
1716
 
1680
- Observer.prototype.observeArray = function (items) {
1681
- for (var i = 0, l = items.length; i < l; i++) {
1682
- observe(items[i]);
1717
+ strats.watch = strats.events = function (parentVal, childVal) {
1718
+ if (!childVal) return parentVal;
1719
+ if (!parentVal) return childVal;
1720
+ var ret = {};
1721
+ extend(ret, parentVal);
1722
+ for (var key in childVal) {
1723
+ var parent = ret[key];
1724
+ var child = childVal[key];
1725
+ if (parent && !isArray(parent)) {
1726
+ parent = [parent];
1727
+ }
1728
+ ret[key] = parent ? parent.concat(child) : [child];
1683
1729
  }
1730
+ return ret;
1684
1731
  };
1685
1732
 
1686
1733
  /**
1687
- * Convert a property into getter/setter so we can emit
1688
- * the events when the property is accessed/changed.
1689
- *
1690
- * @param {String} key
1691
- * @param {*} val
1692
- */
1693
-
1694
- Observer.prototype.convert = function (key, val) {
1695
- defineReactive(this.value, key, val);
1696
- };
1697
-
1698
- /**
1699
- * Add an owner vm, so that when $set/$delete mutations
1700
- * happen we can notify owner vms to proxy the keys and
1701
- * digest the watchers. This is only called when the object
1702
- * is observed as an instance's root $data.
1703
- *
1704
- * @param {Vue} vm
1734
+ * Other object hashes.
1705
1735
  */
1706
1736
 
1707
- Observer.prototype.addVm = function (vm) {
1708
- (this.vms || (this.vms = [])).push(vm);
1737
+ strats.props = strats.methods = strats.computed = function (parentVal, childVal) {
1738
+ if (!childVal) return parentVal;
1739
+ if (!parentVal) return childVal;
1740
+ var ret = Object.create(null);
1741
+ extend(ret, parentVal);
1742
+ extend(ret, childVal);
1743
+ return ret;
1709
1744
  };
1710
1745
 
1711
1746
  /**
1712
- * Remove an owner vm. This is called when the object is
1713
- * swapped out as an instance's $data object.
1714
- *
1715
- * @param {Vue} vm
1747
+ * Default strategy.
1716
1748
  */
1717
1749
 
1718
- Observer.prototype.removeVm = function (vm) {
1719
- this.vms.$remove(vm);
1750
+ var defaultStrat = function defaultStrat(parentVal, childVal) {
1751
+ return childVal === undefined ? parentVal : childVal;
1720
1752
  };
1721
1753
 
1722
- // helpers
1723
-
1724
- /**
1725
- * Augment an target Object or Array by intercepting
1726
- * the prototype chain using __proto__
1727
- *
1728
- * @param {Object|Array} target
1729
- * @param {Object} proto
1730
- */
1731
-
1732
- function protoAugment(target, src) {
1733
- /* eslint-disable no-proto */
1734
- target.__proto__ = src;
1735
- /* eslint-enable no-proto */
1736
- }
1737
-
1738
1754
  /**
1739
- * Augment an target Object or Array by defining
1740
- * hidden properties.
1741
- *
1742
- * @param {Object|Array} target
1743
- * @param {Object} proto
1744
- */
1745
-
1746
- function copyAugment(target, src, keys) {
1747
- for (var i = 0, l = keys.length; i < l; i++) {
1748
- var key = keys[i];
1749
- def(target, key, src[key]);
1750
- }
1751
- }
1752
-
1753
- /**
1754
- * Attempt to create an observer instance for a value,
1755
- * returns the new observer if successfully observed,
1756
- * or the existing observer if the value already has one.
1757
- *
1758
- * @param {*} value
1759
- * @param {Vue} [vm]
1760
- * @return {Observer|undefined}
1761
- * @static
1762
- */
1763
-
1764
- function observe(value, vm) {
1765
- if (!value || typeof value !== 'object') {
1766
- return;
1767
- }
1768
- var ob;
1769
- if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
1770
- ob = value.__ob__;
1771
- } else if ((isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
1772
- ob = new Observer(value);
1773
- }
1774
- if (ob && vm) {
1775
- ob.addVm(vm);
1776
- }
1777
- return ob;
1778
- }
1779
-
1780
- /**
1781
- * Define a reactive property on an Object.
1755
+ * Make sure component options get converted to actual
1756
+ * constructors.
1782
1757
  *
1783
- * @param {Object} obj
1784
- * @param {String} key
1785
- * @param {*} val
1786
- * @param {Boolean} doNotObserve
1758
+ * @param {Object} options
1787
1759
  */
1788
1760
 
1789
- function defineReactive(obj, key, val, doNotObserve) {
1790
- var dep = new Dep();
1791
-
1792
- var property = Object.getOwnPropertyDescriptor(obj, key);
1793
- if (property && property.configurable === false) {
1794
- return;
1795
- }
1796
-
1797
- // cater for pre-defined getter/setters
1798
- var getter = property && property.get;
1799
- var setter = property && property.set;
1800
-
1801
- // if doNotObserve is true, only use the child value observer
1802
- // if it already exists, and do not attempt to create it.
1803
- // this allows freezing a large object from the root and
1804
- // avoid unnecessary observation inside v-for fragments.
1805
- var childOb = doNotObserve ? isObject(val) && val.__ob__ : observe(val);
1806
- Object.defineProperty(obj, key, {
1807
- enumerable: true,
1808
- configurable: true,
1809
- get: function reactiveGetter() {
1810
- var value = getter ? getter.call(obj) : val;
1811
- if (Dep.target) {
1812
- dep.depend();
1813
- if (childOb) {
1814
- childOb.dep.depend();
1815
- }
1816
- if (isArray(value)) {
1817
- for (var e, i = 0, l = value.length; i < l; i++) {
1818
- e = value[i];
1819
- e && e.__ob__ && e.__ob__.dep.depend();
1820
- }
1821
- }
1761
+ function guardComponents(options) {
1762
+ if (options.components) {
1763
+ var components = options.components = guardArrayAssets(options.components);
1764
+ var ids = Object.keys(components);
1765
+ var def;
1766
+ if ('development' !== 'production') {
1767
+ var map = options._componentNameMap = {};
1768
+ }
1769
+ for (var i = 0, l = ids.length; i < l; i++) {
1770
+ var key = ids[i];
1771
+ if (commonTagRE.test(key) || reservedTagRE.test(key)) {
1772
+ 'development' !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key);
1773
+ continue;
1822
1774
  }
1823
- return value;
1824
- },
1825
- set: function reactiveSetter(newVal) {
1826
- var value = getter ? getter.call(obj) : val;
1827
- if (newVal === value) {
1828
- return;
1775
+ // record a all lowercase <-> kebab-case mapping for
1776
+ // possible custom element case error warning
1777
+ if ('development' !== 'production') {
1778
+ map[key.replace(/-/g, '').toLowerCase()] = hyphenate(key);
1829
1779
  }
1830
- if (setter) {
1831
- setter.call(obj, newVal);
1832
- } else {
1833
- val = newVal;
1780
+ def = components[key];
1781
+ if (isPlainObject(def)) {
1782
+ components[key] = Vue.extend(def);
1834
1783
  }
1835
- childOb = doNotObserve ? isObject(newVal) && newVal.__ob__ : observe(newVal);
1836
- dep.notify();
1837
- }
1838
- });
1839
- }
1840
-
1841
- var commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/i;
1842
- var reservedTagRE = /^(slot|partial|component)$/i;
1843
-
1844
- var isUnknownElement = undefined;
1845
- if ('development' !== 'production') {
1846
- isUnknownElement = function (el, tag) {
1847
- if (tag.indexOf('-') > -1) {
1848
- // http://stackoverflow.com/a/28210364/1070244
1849
- return el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;
1850
- } else {
1851
- return (/HTMLUnknownElement/.test(el.toString()) &&
1852
- // Chrome returns unknown for several HTML5 elements.
1853
- // https://code.google.com/p/chromium/issues/detail?id=540526
1854
- !/^(data|time|rtc|rb)$/.test(tag)
1855
- );
1856
1784
  }
1857
- };
1785
+ }
1858
1786
  }
1859
1787
 
1860
1788
  /**
1861
- * Check if an element is a component, if yes return its
1862
- * component id.
1789
+ * Ensure all props option syntax are normalized into the
1790
+ * Object-based format.
1863
1791
  *
1864
- * @param {Element} el
1865
1792
  * @param {Object} options
1866
- * @return {Object|undefined}
1867
1793
  */
1868
1794
 
1869
- function checkComponentAttr(el, options) {
1870
- var tag = el.tagName.toLowerCase();
1871
- var hasAttrs = el.hasAttributes();
1872
- if (!commonTagRE.test(tag) && !reservedTagRE.test(tag)) {
1873
- if (resolveAsset(options, 'components', tag)) {
1874
- return { id: tag };
1875
- } else {
1876
- var is = hasAttrs && getIsBinding(el);
1877
- if (is) {
1878
- return is;
1879
- } else if ('development' !== 'production') {
1880
- var expectedTag = options._componentNameMap && options._componentNameMap[tag];
1881
- if (expectedTag) {
1882
- warn('Unknown custom element: <' + tag + '> - ' + 'did you mean <' + expectedTag + '>? ' + 'HTML is case-insensitive, remember to use kebab-case in templates.');
1883
- } else if (isUnknownElement(el, tag)) {
1884
- warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the "name" option.');
1885
- }
1795
+ function guardProps(options) {
1796
+ var props = options.props;
1797
+ var i, val;
1798
+ if (isArray(props)) {
1799
+ options.props = {};
1800
+ i = props.length;
1801
+ while (i--) {
1802
+ val = props[i];
1803
+ if (typeof val === 'string') {
1804
+ options.props[val] = null;
1805
+ } else if (val.name) {
1806
+ options.props[val.name] = val;
1807
+ }
1808
+ }
1809
+ } else if (isPlainObject(props)) {
1810
+ var keys = Object.keys(props);
1811
+ i = keys.length;
1812
+ while (i--) {
1813
+ val = props[keys[i]];
1814
+ if (typeof val === 'function') {
1815
+ props[keys[i]] = { type: val };
1886
1816
  }
1887
1817
  }
1888
- } else if (hasAttrs) {
1889
- return getIsBinding(el);
1890
1818
  }
1891
1819
  }
1892
1820
 
1893
1821
  /**
1894
- * Get "is" binding from an element.
1822
+ * Guard an Array-format assets option and converted it
1823
+ * into the key-value Object format.
1895
1824
  *
1896
- * @param {Element} el
1897
- * @return {Object|undefined}
1825
+ * @param {Object|Array} assets
1826
+ * @return {Object}
1898
1827
  */
1899
1828
 
1900
- function getIsBinding(el) {
1901
- // dynamic syntax
1902
- var exp = getAttr(el, 'is');
1903
- if (exp != null) {
1904
- return { id: exp };
1905
- } else {
1906
- exp = getBindAttr(el, 'is');
1907
- if (exp != null) {
1908
- return { id: exp, dynamic: true };
1829
+ function guardArrayAssets(assets) {
1830
+ if (isArray(assets)) {
1831
+ var res = {};
1832
+ var i = assets.length;
1833
+ var asset;
1834
+ while (i--) {
1835
+ asset = assets[i];
1836
+ var id = typeof asset === 'function' ? asset.options && asset.options.name || asset.id : asset.name || asset.id;
1837
+ if (!id) {
1838
+ 'development' !== 'production' && warn('Array-syntax assets must provide a "name" or "id" field.');
1839
+ } else {
1840
+ res[id] = asset;
1841
+ }
1909
1842
  }
1843
+ return res;
1910
1844
  }
1845
+ return assets;
1911
1846
  }
1912
1847
 
1913
1848
  /**
1914
- * Set a prop's initial value on a vm and its data object.
1849
+ * Merge two option objects into a new one.
1850
+ * Core utility used in both instantiation and inheritance.
1915
1851
  *
1916
- * @param {Vue} vm
1917
- * @param {Object} prop
1918
- * @param {*} value
1852
+ * @param {Object} parent
1853
+ * @param {Object} child
1854
+ * @param {Vue} [vm] - if vm is present, indicates this is
1855
+ * an instantiation merge.
1919
1856
  */
1920
1857
 
1921
- function initProp(vm, prop, value) {
1922
- var key = prop.path;
1923
- value = coerceProp(prop, value);
1924
- if (value === undefined) {
1925
- value = getPropDefaultValue(vm, prop.options);
1858
+ function mergeOptions(parent, child, vm) {
1859
+ guardComponents(child);
1860
+ guardProps(child);
1861
+ var options = {};
1862
+ var key;
1863
+ if (child.mixins) {
1864
+ for (var i = 0, l = child.mixins.length; i < l; i++) {
1865
+ parent = mergeOptions(parent, child.mixins[i], vm);
1866
+ }
1926
1867
  }
1927
- if (assertProp(prop, value)) {
1928
- defineReactive(vm, key, value, true /* doNotObserve */);
1868
+ for (key in parent) {
1869
+ mergeField(key);
1929
1870
  }
1930
- }
1931
-
1932
- /**
1933
- * Get the default value of a prop.
1934
- *
1935
- * @param {Vue} vm
1936
- * @param {Object} options
1937
- * @return {*}
1938
- */
1939
-
1940
- function getPropDefaultValue(vm, options) {
1941
- // no default, return undefined
1942
- if (!hasOwn(options, 'default')) {
1943
- // absent boolean value defaults to false
1944
- return options.type === Boolean ? false : undefined;
1871
+ for (key in child) {
1872
+ if (!hasOwn(parent, key)) {
1873
+ mergeField(key);
1874
+ }
1945
1875
  }
1946
- var def = options['default'];
1947
- // warn against non-factory defaults for Object & Array
1948
- if (isObject(def)) {
1949
- 'development' !== 'production' && warn('Object/Array as default prop values will be shared ' + 'across multiple instances. Use a factory function ' + 'to return the default value instead.');
1876
+ function mergeField(key) {
1877
+ var strat = strats[key] || defaultStrat;
1878
+ options[key] = strat(parent[key], child[key], vm, key);
1950
1879
  }
1951
- // call factory function for non-Function types
1952
- return typeof def === 'function' && options.type !== Function ? def.call(vm) : def;
1880
+ return options;
1953
1881
  }
1954
1882
 
1955
1883
  /**
1956
- * Assert whether a prop is valid.
1884
+ * Resolve an asset.
1885
+ * This function is used because child instances need access
1886
+ * to assets defined in its ancestor chain.
1957
1887
  *
1958
- * @param {Object} prop
1959
- * @param {*} value
1888
+ * @param {Object} options
1889
+ * @param {String} type
1890
+ * @param {String} id
1891
+ * @return {Object|Function}
1960
1892
  */
1961
1893
 
1962
- function assertProp(prop, value) {
1963
- if (!prop.options.required && ( // non-required
1964
- prop.raw === null || // abscent
1965
- value == null) // null or undefined
1966
- ) {
1967
- return true;
1968
- }
1969
- var options = prop.options;
1970
- var type = options.type;
1971
- var valid = true;
1972
- var expectedType;
1973
- if (type) {
1974
- if (type === String) {
1975
- expectedType = 'string';
1976
- valid = typeof value === expectedType;
1977
- } else if (type === Number) {
1978
- expectedType = 'number';
1979
- valid = typeof value === 'number';
1980
- } else if (type === Boolean) {
1981
- expectedType = 'boolean';
1982
- valid = typeof value === 'boolean';
1983
- } else if (type === Function) {
1984
- expectedType = 'function';
1985
- valid = typeof value === 'function';
1986
- } else if (type === Object) {
1987
- expectedType = 'object';
1988
- valid = isPlainObject(value);
1989
- } else if (type === Array) {
1990
- expectedType = 'array';
1991
- valid = isArray(value);
1992
- } else {
1993
- valid = value instanceof type;
1994
- }
1995
- }
1996
- if (!valid) {
1997
- 'development' !== 'production' && warn('Invalid prop: type check failed for ' + prop.path + '="' + prop.raw + '".' + ' Expected ' + formatType(expectedType) + ', got ' + formatValue(value) + '.');
1998
- return false;
1999
- }
2000
- var validator = options.validator;
2001
- if (validator) {
2002
- if (!validator(value)) {
2003
- 'development' !== 'production' && warn('Invalid prop: custom validator check failed for ' + prop.path + '="' + prop.raw + '"');
2004
- return false;
2005
- }
1894
+ function resolveAsset(options, type, id) {
1895
+ /* istanbul ignore if */
1896
+ if (typeof id !== 'string') {
1897
+ return;
2006
1898
  }
2007
- return true;
1899
+ var assets = options[type];
1900
+ var camelizedId;
1901
+ return assets[id] ||
1902
+ // camelCase ID
1903
+ assets[camelizedId = camelize(id)] ||
1904
+ // Pascal Case ID
1905
+ assets[camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)];
2008
1906
  }
2009
1907
 
2010
1908
  /**
2011
- * Force parsing value with coerce option.
2012
- *
2013
- * @param {*} value
2014
- * @param {Object} options
2015
- * @return {*}
1909
+ * Assert asset exists
2016
1910
  */
2017
1911
 
2018
- function coerceProp(prop, value) {
2019
- var coerce = prop.options.coerce;
2020
- if (!coerce) {
2021
- return value;
1912
+ function assertAsset(val, type, id) {
1913
+ if (!val) {
1914
+ 'development' !== 'production' && warn('Failed to resolve ' + type + ': ' + id);
2022
1915
  }
2023
- // coerce is a function
2024
- return coerce(value);
2025
1916
  }
2026
1917
 
2027
- function formatType(val) {
2028
- return val ? val.charAt(0).toUpperCase() + val.slice(1) : 'custom type';
2029
- }
1918
+ var uid$1 = 0;
2030
1919
 
2031
- function formatValue(val) {
2032
- return Object.prototype.toString.call(val).slice(8, -1);
1920
+ /**
1921
+ * A dep is an observable that can have multiple
1922
+ * directives subscribing to it.
1923
+ *
1924
+ * @constructor
1925
+ */
1926
+ function Dep() {
1927
+ this.id = uid$1++;
1928
+ this.subs = [];
2033
1929
  }
2034
1930
 
1931
+ // the current target watcher being evaluated.
1932
+ // this is globally unique because there could be only one
1933
+ // watcher being evaluated at any time.
1934
+ Dep.target = null;
1935
+
2035
1936
  /**
2036
- * Option overwriting strategies are functions that handle
2037
- * how to merge a parent option value and a child option
2038
- * value into the final value.
1937
+ * Add a directive subscriber.
2039
1938
  *
2040
- * All strategy functions follow the same signature:
1939
+ * @param {Directive} sub
1940
+ */
1941
+
1942
+ Dep.prototype.addSub = function (sub) {
1943
+ this.subs.push(sub);
1944
+ };
1945
+
1946
+ /**
1947
+ * Remove a directive subscriber.
2041
1948
  *
2042
- * @param {*} parentVal
2043
- * @param {*} childVal
2044
- * @param {Vue} [vm]
1949
+ * @param {Directive} sub
2045
1950
  */
2046
1951
 
2047
- var strats = config.optionMergeStrategies = Object.create(null);
1952
+ Dep.prototype.removeSub = function (sub) {
1953
+ this.subs.$remove(sub);
1954
+ };
2048
1955
 
2049
1956
  /**
2050
- * Helper that recursively merges two data objects together.
1957
+ * Add self as a dependency to the target watcher.
2051
1958
  */
2052
1959
 
2053
- function mergeData(to, from) {
2054
- var key, toVal, fromVal;
2055
- for (key in from) {
2056
- toVal = to[key];
2057
- fromVal = from[key];
2058
- if (!hasOwn(to, key)) {
2059
- set(to, key, fromVal);
2060
- } else if (isObject(toVal) && isObject(fromVal)) {
2061
- mergeData(toVal, fromVal);
2062
- }
1960
+ Dep.prototype.depend = function () {
1961
+ Dep.target.addDep(this);
1962
+ };
1963
+
1964
+ /**
1965
+ * Notify all subscribers of a new value.
1966
+ */
1967
+
1968
+ Dep.prototype.notify = function () {
1969
+ // stablize the subscriber list first
1970
+ var subs = toArray(this.subs);
1971
+ for (var i = 0, l = subs.length; i < l; i++) {
1972
+ subs[i].update();
2063
1973
  }
2064
- return to;
2065
- }
1974
+ };
1975
+
1976
+ var arrayProto = Array.prototype;
1977
+ var arrayMethods = Object.create(arrayProto)
2066
1978
 
2067
1979
  /**
2068
- * Data
1980
+ * Intercept mutating methods and emit events
2069
1981
  */
2070
1982
 
2071
- strats.data = function (parentVal, childVal, vm) {
2072
- if (!vm) {
2073
- // in a Vue.extend merge, both should be functions
2074
- if (!childVal) {
2075
- return parentVal;
2076
- }
2077
- if (typeof childVal !== 'function') {
2078
- 'development' !== 'production' && warn('The "data" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.');
2079
- return parentVal;
1983
+ ;['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'].forEach(function (method) {
1984
+ // cache original method
1985
+ var original = arrayProto[method];
1986
+ def(arrayMethods, method, function mutator() {
1987
+ // avoid leaking arguments:
1988
+ // http://jsperf.com/closure-with-arguments
1989
+ var i = arguments.length;
1990
+ var args = new Array(i);
1991
+ while (i--) {
1992
+ args[i] = arguments[i];
2080
1993
  }
2081
- if (!parentVal) {
2082
- return childVal;
1994
+ var result = original.apply(this, args);
1995
+ var ob = this.__ob__;
1996
+ var inserted;
1997
+ switch (method) {
1998
+ case 'push':
1999
+ inserted = args;
2000
+ break;
2001
+ case 'unshift':
2002
+ inserted = args;
2003
+ break;
2004
+ case 'splice':
2005
+ inserted = args.slice(2);
2006
+ break;
2083
2007
  }
2084
- // when parentVal & childVal are both present,
2085
- // we need to return a function that returns the
2086
- // merged result of both functions... no need to
2087
- // check if parentVal is a function here because
2088
- // it has to be a function to pass previous merges.
2089
- return function mergedDataFn() {
2090
- return mergeData(childVal.call(this), parentVal.call(this));
2091
- };
2092
- } else if (parentVal || childVal) {
2093
- return function mergedInstanceDataFn() {
2094
- // instance merge
2095
- var instanceData = typeof childVal === 'function' ? childVal.call(vm) : childVal;
2096
- var defaultData = typeof parentVal === 'function' ? parentVal.call(vm) : undefined;
2097
- if (instanceData) {
2098
- return mergeData(instanceData, defaultData);
2099
- } else {
2100
- return defaultData;
2101
- }
2102
- };
2103
- }
2104
- };
2008
+ if (inserted) ob.observeArray(inserted);
2009
+ // notify change
2010
+ ob.dep.notify();
2011
+ return result;
2012
+ });
2013
+ });
2105
2014
 
2106
2015
  /**
2107
- * El
2016
+ * Swap the element at the given index with a new value
2017
+ * and emits corresponding event.
2018
+ *
2019
+ * @param {Number} index
2020
+ * @param {*} val
2021
+ * @return {*} - replaced element
2108
2022
  */
2109
2023
 
2110
- strats.el = function (parentVal, childVal, vm) {
2111
- if (!vm && childVal && typeof childVal !== 'function') {
2112
- 'development' !== 'production' && warn('The "el" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.');
2113
- return;
2024
+ def(arrayProto, '$set', function $set(index, val) {
2025
+ if (index >= this.length) {
2026
+ this.length = Number(index) + 1;
2114
2027
  }
2115
- var ret = childVal || parentVal;
2116
- // invoke the element factory if this is instance merge
2117
- return vm && typeof ret === 'function' ? ret.call(vm) : ret;
2118
- };
2028
+ return this.splice(index, 1, val)[0];
2029
+ });
2119
2030
 
2120
2031
  /**
2121
- * Hooks and param attributes are merged as arrays.
2032
+ * Convenience method to remove the element at given index.
2033
+ *
2034
+ * @param {Number} index
2035
+ * @param {*} val
2122
2036
  */
2123
2037
 
2124
- strats.init = strats.created = strats.ready = strats.attached = strats.detached = strats.beforeCompile = strats.compiled = strats.beforeDestroy = strats.destroyed = strats.activate = function (parentVal, childVal) {
2125
- return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
2126
- };
2038
+ def(arrayProto, '$remove', function $remove(item) {
2039
+ /* istanbul ignore if */
2040
+ if (!this.length) return;
2041
+ var index = indexOf(this, item);
2042
+ if (index > -1) {
2043
+ return this.splice(index, 1);
2044
+ }
2045
+ });
2046
+
2047
+ var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
2127
2048
 
2128
2049
  /**
2129
- * 0.11 deprecation warning
2050
+ * By default, when a reactive property is set, the new value is
2051
+ * also converted to become reactive. However in certain cases, e.g.
2052
+ * v-for scope alias and props, we don't want to force conversion
2053
+ * because the value may be a nested value under a frozen data structure.
2054
+ *
2055
+ * So whenever we want to set a reactive property without forcing
2056
+ * conversion on the new value, we wrap that call inside this function.
2130
2057
  */
2131
2058
 
2132
- strats.paramAttributes = function () {
2133
- /* istanbul ignore next */
2134
- 'development' !== 'production' && warn('"paramAttributes" option has been deprecated in 0.12. ' + 'Use "props" instead.');
2135
- };
2059
+ var shouldConvert = true;
2060
+
2061
+ function withoutConversion(fn) {
2062
+ shouldConvert = false;
2063
+ fn();
2064
+ shouldConvert = true;
2065
+ }
2136
2066
 
2137
2067
  /**
2138
- * Assets
2068
+ * Observer class that are attached to each observed
2069
+ * object. Once attached, the observer converts target
2070
+ * object's property keys into getter/setters that
2071
+ * collect dependencies and dispatches updates.
2139
2072
  *
2140
- * When a vm is present (instance creation), we need to do
2141
- * a three-way merge between constructor options, instance
2142
- * options and parent options.
2073
+ * @param {Array|Object} value
2074
+ * @constructor
2143
2075
  */
2144
2076
 
2145
- function mergeAssets(parentVal, childVal) {
2146
- var res = Object.create(parentVal);
2147
- return childVal ? extend(res, guardArrayAssets(childVal)) : res;
2077
+ function Observer(value) {
2078
+ this.value = value;
2079
+ this.dep = new Dep();
2080
+ def(value, '__ob__', this);
2081
+ if (isArray(value)) {
2082
+ var augment = hasProto ? protoAugment : copyAugment;
2083
+ augment(value, arrayMethods, arrayKeys);
2084
+ this.observeArray(value);
2085
+ } else {
2086
+ this.walk(value);
2087
+ }
2148
2088
  }
2149
2089
 
2150
- config._assetTypes.forEach(function (type) {
2151
- strats[type + 's'] = mergeAssets;
2152
- });
2090
+ // Instance methods
2153
2091
 
2154
2092
  /**
2155
- * Events & Watchers.
2093
+ * Walk through each property and convert them into
2094
+ * getter/setters. This method should only be called when
2095
+ * value type is Object.
2156
2096
  *
2157
- * Events & watchers hashes should not overwrite one
2158
- * another, so we merge them as arrays.
2097
+ * @param {Object} obj
2159
2098
  */
2160
2099
 
2161
- strats.watch = strats.events = function (parentVal, childVal) {
2162
- if (!childVal) return parentVal;
2163
- if (!parentVal) return childVal;
2164
- var ret = {};
2165
- extend(ret, parentVal);
2166
- for (var key in childVal) {
2167
- var parent = ret[key];
2168
- var child = childVal[key];
2169
- if (parent && !isArray(parent)) {
2170
- parent = [parent];
2171
- }
2172
- ret[key] = parent ? parent.concat(child) : [child];
2100
+ Observer.prototype.walk = function (obj) {
2101
+ var keys = Object.keys(obj);
2102
+ for (var i = 0, l = keys.length; i < l; i++) {
2103
+ this.convert(keys[i], obj[keys[i]]);
2104
+ }
2105
+ };
2106
+
2107
+ /**
2108
+ * Observe a list of Array items.
2109
+ *
2110
+ * @param {Array} items
2111
+ */
2112
+
2113
+ Observer.prototype.observeArray = function (items) {
2114
+ for (var i = 0, l = items.length; i < l; i++) {
2115
+ observe(items[i]);
2173
2116
  }
2174
- return ret;
2175
2117
  };
2176
2118
 
2177
2119
  /**
2178
- * Other object hashes.
2120
+ * Convert a property into getter/setter so we can emit
2121
+ * the events when the property is accessed/changed.
2122
+ *
2123
+ * @param {String} key
2124
+ * @param {*} val
2179
2125
  */
2180
2126
 
2181
- strats.props = strats.methods = strats.computed = function (parentVal, childVal) {
2182
- if (!childVal) return parentVal;
2183
- if (!parentVal) return childVal;
2184
- var ret = Object.create(null);
2185
- extend(ret, parentVal);
2186
- extend(ret, childVal);
2187
- return ret;
2127
+ Observer.prototype.convert = function (key, val) {
2128
+ defineReactive(this.value, key, val);
2188
2129
  };
2189
2130
 
2190
2131
  /**
2191
- * Default strategy.
2132
+ * Add an owner vm, so that when $set/$delete mutations
2133
+ * happen we can notify owner vms to proxy the keys and
2134
+ * digest the watchers. This is only called when the object
2135
+ * is observed as an instance's root $data.
2136
+ *
2137
+ * @param {Vue} vm
2192
2138
  */
2193
2139
 
2194
- var defaultStrat = function defaultStrat(parentVal, childVal) {
2195
- return childVal === undefined ? parentVal : childVal;
2140
+ Observer.prototype.addVm = function (vm) {
2141
+ (this.vms || (this.vms = [])).push(vm);
2196
2142
  };
2197
2143
 
2198
2144
  /**
2199
- * Make sure component options get converted to actual
2200
- * constructors.
2145
+ * Remove an owner vm. This is called when the object is
2146
+ * swapped out as an instance's $data object.
2201
2147
  *
2202
- * @param {Object} options
2148
+ * @param {Vue} vm
2203
2149
  */
2204
2150
 
2205
- function guardComponents(options) {
2206
- if (options.components) {
2207
- var components = options.components = guardArrayAssets(options.components);
2208
- var ids = Object.keys(components);
2209
- var def;
2210
- if ('development' !== 'production') {
2211
- var map = options._componentNameMap = {};
2212
- }
2213
- for (var i = 0, l = ids.length; i < l; i++) {
2214
- var key = ids[i];
2215
- if (commonTagRE.test(key) || reservedTagRE.test(key)) {
2216
- 'development' !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key);
2217
- continue;
2218
- }
2219
- // record a all lowercase <-> kebab-case mapping for
2220
- // possible custom element case error warning
2221
- if ('development' !== 'production') {
2222
- map[key.replace(/-/g, '').toLowerCase()] = hyphenate(key);
2223
- }
2224
- def = components[key];
2225
- if (isPlainObject(def)) {
2226
- components[key] = Vue.extend(def);
2227
- }
2228
- }
2229
- }
2230
- }
2151
+ Observer.prototype.removeVm = function (vm) {
2152
+ this.vms.$remove(vm);
2153
+ };
2154
+
2155
+ // helpers
2231
2156
 
2232
2157
  /**
2233
- * Ensure all props option syntax are normalized into the
2234
- * Object-based format.
2158
+ * Augment an target Object or Array by intercepting
2159
+ * the prototype chain using __proto__
2235
2160
  *
2236
- * @param {Object} options
2161
+ * @param {Object|Array} target
2162
+ * @param {Object} src
2237
2163
  */
2238
2164
 
2239
- function guardProps(options) {
2240
- var props = options.props;
2241
- var i, val;
2242
- if (isArray(props)) {
2243
- options.props = {};
2244
- i = props.length;
2245
- while (i--) {
2246
- val = props[i];
2247
- if (typeof val === 'string') {
2248
- options.props[val] = null;
2249
- } else if (val.name) {
2250
- options.props[val.name] = val;
2251
- }
2252
- }
2253
- } else if (isPlainObject(props)) {
2254
- var keys = Object.keys(props);
2255
- i = keys.length;
2256
- while (i--) {
2257
- val = props[keys[i]];
2258
- if (typeof val === 'function') {
2259
- props[keys[i]] = { type: val };
2260
- }
2261
- }
2262
- }
2165
+ function protoAugment(target, src) {
2166
+ /* eslint-disable no-proto */
2167
+ target.__proto__ = src;
2168
+ /* eslint-enable no-proto */
2263
2169
  }
2264
2170
 
2265
2171
  /**
2266
- * Guard an Array-format assets option and converted it
2267
- * into the key-value Object format.
2172
+ * Augment an target Object or Array by defining
2173
+ * hidden properties.
2268
2174
  *
2269
- * @param {Object|Array} assets
2270
- * @return {Object}
2175
+ * @param {Object|Array} target
2176
+ * @param {Object} proto
2271
2177
  */
2272
2178
 
2273
- function guardArrayAssets(assets) {
2274
- if (isArray(assets)) {
2275
- var res = {};
2276
- var i = assets.length;
2277
- var asset;
2278
- while (i--) {
2279
- asset = assets[i];
2280
- var id = typeof asset === 'function' ? asset.options && asset.options.name || asset.id : asset.name || asset.id;
2281
- if (!id) {
2282
- 'development' !== 'production' && warn('Array-syntax assets must provide a "name" or "id" field.');
2283
- } else {
2284
- res[id] = asset;
2285
- }
2286
- }
2287
- return res;
2179
+ function copyAugment(target, src, keys) {
2180
+ for (var i = 0, l = keys.length; i < l; i++) {
2181
+ var key = keys[i];
2182
+ def(target, key, src[key]);
2288
2183
  }
2289
- return assets;
2290
2184
  }
2291
2185
 
2292
2186
  /**
2293
- * Merge two option objects into a new one.
2294
- * Core utility used in both instantiation and inheritance.
2187
+ * Attempt to create an observer instance for a value,
2188
+ * returns the new observer if successfully observed,
2189
+ * or the existing observer if the value already has one.
2295
2190
  *
2296
- * @param {Object} parent
2297
- * @param {Object} child
2298
- * @param {Vue} [vm] - if vm is present, indicates this is
2299
- * an instantiation merge.
2191
+ * @param {*} value
2192
+ * @param {Vue} [vm]
2193
+ * @return {Observer|undefined}
2194
+ * @static
2300
2195
  */
2301
2196
 
2302
- function mergeOptions(parent, child, vm) {
2303
- guardComponents(child);
2304
- guardProps(child);
2305
- var options = {};
2306
- var key;
2307
- if (child.mixins) {
2308
- for (var i = 0, l = child.mixins.length; i < l; i++) {
2309
- parent = mergeOptions(parent, child.mixins[i], vm);
2310
- }
2311
- }
2312
- for (key in parent) {
2313
- mergeField(key);
2197
+ function observe(value, vm) {
2198
+ if (!value || typeof value !== 'object') {
2199
+ return;
2314
2200
  }
2315
- for (key in child) {
2316
- if (!hasOwn(parent, key)) {
2317
- mergeField(key);
2318
- }
2201
+ var ob;
2202
+ if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
2203
+ ob = value.__ob__;
2204
+ } else if (shouldConvert && (isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
2205
+ ob = new Observer(value);
2319
2206
  }
2320
- function mergeField(key) {
2321
- var strat = strats[key] || defaultStrat;
2322
- options[key] = strat(parent[key], child[key], vm, key);
2207
+ if (ob && vm) {
2208
+ ob.addVm(vm);
2323
2209
  }
2324
- return options;
2210
+ return ob;
2325
2211
  }
2326
2212
 
2327
2213
  /**
2328
- * Resolve an asset.
2329
- * This function is used because child instances need access
2330
- * to assets defined in its ancestor chain.
2214
+ * Define a reactive property on an Object.
2331
2215
  *
2332
- * @param {Object} options
2333
- * @param {String} type
2334
- * @param {String} id
2335
- * @return {Object|Function}
2216
+ * @param {Object} obj
2217
+ * @param {String} key
2218
+ * @param {*} val
2336
2219
  */
2337
2220
 
2338
- function resolveAsset(options, type, id) {
2339
- /* istanbul ignore if */
2340
- if (typeof id !== 'string') {
2221
+ function defineReactive(obj, key, val) {
2222
+ var dep = new Dep();
2223
+
2224
+ var property = Object.getOwnPropertyDescriptor(obj, key);
2225
+ if (property && property.configurable === false) {
2341
2226
  return;
2342
2227
  }
2343
- var assets = options[type];
2344
- var camelizedId;
2345
- return assets[id] ||
2346
- // camelCase ID
2347
- assets[camelizedId = camelize(id)] ||
2348
- // Pascal Case ID
2349
- assets[camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)];
2350
- }
2351
2228
 
2352
- /**
2353
- * Assert asset exists
2354
- */
2229
+ // cater for pre-defined getter/setters
2230
+ var getter = property && property.get;
2231
+ var setter = property && property.set;
2355
2232
 
2356
- function assertAsset(val, type, id) {
2357
- if (!val) {
2358
- 'development' !== 'production' && warn('Failed to resolve ' + type + ': ' + id);
2359
- }
2233
+ var childOb = observe(val);
2234
+ Object.defineProperty(obj, key, {
2235
+ enumerable: true,
2236
+ configurable: true,
2237
+ get: function reactiveGetter() {
2238
+ var value = getter ? getter.call(obj) : val;
2239
+ if (Dep.target) {
2240
+ dep.depend();
2241
+ if (childOb) {
2242
+ childOb.dep.depend();
2243
+ }
2244
+ if (isArray(value)) {
2245
+ for (var e, i = 0, l = value.length; i < l; i++) {
2246
+ e = value[i];
2247
+ e && e.__ob__ && e.__ob__.dep.depend();
2248
+ }
2249
+ }
2250
+ }
2251
+ return value;
2252
+ },
2253
+ set: function reactiveSetter(newVal) {
2254
+ var value = getter ? getter.call(obj) : val;
2255
+ if (newVal === value) {
2256
+ return;
2257
+ }
2258
+ if (setter) {
2259
+ setter.call(obj, newVal);
2260
+ } else {
2261
+ val = newVal;
2262
+ }
2263
+ childOb = observe(newVal);
2264
+ dep.notify();
2265
+ }
2266
+ });
2360
2267
  }
2361
2268
 
2362
2269
 
@@ -2424,9 +2331,6 @@ var transition = Object.freeze({
2424
2331
  resolveAsset: resolveAsset,
2425
2332
  assertAsset: assertAsset,
2426
2333
  checkComponentAttr: checkComponentAttr,
2427
- initProp: initProp,
2428
- assertProp: assertProp,
2429
- coerceProp: coerceProp,
2430
2334
  commonTagRE: commonTagRE,
2431
2335
  reservedTagRE: reservedTagRE,
2432
2336
  get warn () { return warn; }
@@ -3170,7 +3074,7 @@ var expression = Object.freeze({
3170
3074
  * This is used for both the $watch() api and directives.
3171
3075
  *
3172
3076
  * @param {Vue} vm
3173
- * @param {String} expression
3077
+ * @param {String|Function} expOrFn
3174
3078
  * @param {Function} cb
3175
3079
  * @param {Object} options
3176
3080
  * - {Array} filters
@@ -3772,6 +3676,7 @@ var template = Object.freeze({
3772
3676
  * @param {DocumentFragment} frag
3773
3677
  * @param {Vue} [host]
3774
3678
  * @param {Object} [scope]
3679
+ * @param {Fragment} [parentFrag]
3775
3680
  */
3776
3681
  function Fragment(linker, vm, frag, host, scope, parentFrag) {
3777
3682
  this.children = [];
@@ -4019,6 +3924,7 @@ var template = Object.freeze({
4019
3924
  var vFor = {
4020
3925
 
4021
3926
  priority: FOR,
3927
+ terminal: true,
4022
3928
 
4023
3929
  params: ['track-by', 'stagger', 'enter-stagger', 'leave-stagger'],
4024
3930
 
@@ -4128,7 +4034,9 @@ var template = Object.freeze({
4128
4034
  // update data for track-by, object repeat &
4129
4035
  // primitive values.
4130
4036
  if (trackByKey || convertedFromObject || primitive) {
4131
- frag.scope[alias] = value;
4037
+ withoutConversion(function () {
4038
+ frag.scope[alias] = value;
4039
+ });
4132
4040
  }
4133
4041
  } else {
4134
4042
  // new isntance
@@ -4218,7 +4126,11 @@ var template = Object.freeze({
4218
4126
  // for two-way binding on alias
4219
4127
  scope.$forContext = this;
4220
4128
  // define scope properties
4221
- defineReactive(scope, alias, value, true /* do not observe */);
4129
+ // important: define the scope alias without forced conversion
4130
+ // so that frozen data structures remain non-reactive.
4131
+ withoutConversion(function () {
4132
+ defineReactive(scope, alias, value);
4133
+ });
4222
4134
  defineReactive(scope, '$index', index);
4223
4135
  if (key) {
4224
4136
  defineReactive(scope, '$key', key);
@@ -4594,6 +4506,7 @@ var template = Object.freeze({
4594
4506
  var vIf = {
4595
4507
 
4596
4508
  priority: IF,
4509
+ terminal: true,
4597
4510
 
4598
4511
  bind: function bind() {
4599
4512
  var el = this.el;
@@ -5519,22 +5432,18 @@ var template = Object.freeze({
5519
5432
 
5520
5433
  handleObject: function handleObject(value) {
5521
5434
  this.cleanup(value);
5522
- var keys = this.prevKeys = Object.keys(value);
5523
- for (var i = 0, l = keys.length; i < l; i++) {
5524
- var key = keys[i];
5525
- if (value[key]) {
5526
- addClass(this.el, key);
5527
- } else {
5528
- removeClass(this.el, key);
5529
- }
5530
- }
5435
+ this.prevKeys = Object.keys(value);
5436
+ setObjectClasses(this.el, value);
5531
5437
  },
5532
5438
 
5533
5439
  handleArray: function handleArray(value) {
5534
5440
  this.cleanup(value);
5535
5441
  for (var i = 0, l = value.length; i < l; i++) {
5536
- if (value[i]) {
5537
- addClass(this.el, value[i]);
5442
+ var val = value[i];
5443
+ if (val && isPlainObject(val)) {
5444
+ setObjectClasses(this.el, val);
5445
+ } else if (val && typeof val === 'string') {
5446
+ addClass(this.el, val);
5538
5447
  }
5539
5448
  }
5540
5449
  this.prevKeys = value.slice();
@@ -5545,13 +5454,29 @@ var template = Object.freeze({
5545
5454
  var i = this.prevKeys.length;
5546
5455
  while (i--) {
5547
5456
  var key = this.prevKeys[i];
5548
- if (key && (!value || !contains(value, key))) {
5457
+ if (!key) continue;
5458
+ if (isPlainObject(key)) {
5459
+ var keys = Object.keys(key);
5460
+ for (var k = 0; k < keys.length; k++) {
5461
+ removeClass(this.el, keys[k]);
5462
+ }
5463
+ } else {
5549
5464
  removeClass(this.el, key);
5550
5465
  }
5551
5466
  }
5552
5467
  }
5553
5468
  }
5554
- };
5469
+ };
5470
+
5471
+ function setObjectClasses(el, obj) {
5472
+ var keys = Object.keys(obj);
5473
+ for (var i = 0, l = keys.length; i < l; i++) {
5474
+ var key = keys[i];
5475
+ if (obj[key]) {
5476
+ addClass(el, key);
5477
+ }
5478
+ }
5479
+ }
5555
5480
 
5556
5481
  function stringToObject(value) {
5557
5482
  var res = {};
@@ -5563,10 +5488,6 @@ var template = Object.freeze({
5563
5488
  return res;
5564
5489
  }
5565
5490
 
5566
- function contains(value, key) {
5567
- return isArray(value) ? value.indexOf(key) > -1 : hasOwn(value, key);
5568
- }
5569
-
5570
5491
  var component = {
5571
5492
 
5572
5493
  priority: COMPONENT,
@@ -5663,16 +5584,19 @@ var template = Object.freeze({
5663
5584
  /**
5664
5585
  * Resolve the component constructor to use when creating
5665
5586
  * the child vm.
5587
+ *
5588
+ * @param {String|Function} value
5589
+ * @param {Function} cb
5666
5590
  */
5667
5591
 
5668
- resolveComponent: function resolveComponent(id, cb) {
5592
+ resolveComponent: function resolveComponent(value, cb) {
5669
5593
  var self = this;
5670
5594
  this.pendingComponentCb = cancellable(function (Component) {
5671
- self.ComponentName = Component.options.name || id;
5595
+ self.ComponentName = Component.options.name || (typeof value === 'string' ? value : null);
5672
5596
  self.Component = Component;
5673
5597
  cb();
5674
5598
  });
5675
- this.vm._resolveComponent(id, this.pendingComponentCb);
5599
+ this.vm._resolveComponent(value, this.pendingComponentCb);
5676
5600
  },
5677
5601
 
5678
5602
  /**
@@ -5804,7 +5728,9 @@ var template = Object.freeze({
5804
5728
 
5805
5729
  unbuild: function unbuild(defer) {
5806
5730
  if (this.waitingFor) {
5807
- this.waitingFor.$destroy();
5731
+ if (!this.keepAlive) {
5732
+ this.waitingFor.$destroy();
5733
+ }
5808
5734
  this.waitingFor = null;
5809
5735
  }
5810
5736
  var child = this.childVM;
@@ -5900,27 +5826,309 @@ var template = Object.freeze({
5900
5826
  this.cache = null;
5901
5827
  }
5902
5828
  }
5903
- };
5829
+ };
5830
+
5831
+ /**
5832
+ * Call activate hooks in order (asynchronous)
5833
+ *
5834
+ * @param {Array} hooks
5835
+ * @param {Vue} vm
5836
+ * @param {Function} cb
5837
+ */
5838
+
5839
+ function callActivateHooks(hooks, vm, cb) {
5840
+ var total = hooks.length;
5841
+ var called = 0;
5842
+ hooks[0].call(vm, next);
5843
+ function next() {
5844
+ if (++called >= total) {
5845
+ cb();
5846
+ } else {
5847
+ hooks[called].call(vm, next);
5848
+ }
5849
+ }
5850
+ }
5851
+
5852
+ var propBindingModes = config._propBindingModes;
5853
+ var empty = {};
5854
+
5855
+ // regexes
5856
+ var identRE$1 = /^[$_a-zA-Z]+[\w$]*$/;
5857
+ var settablePathRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\[[^\[\]]+\])*$/;
5858
+
5859
+ /**
5860
+ * Compile props on a root element and return
5861
+ * a props link function.
5862
+ *
5863
+ * @param {Element|DocumentFragment} el
5864
+ * @param {Array} propOptions
5865
+ * @return {Function} propsLinkFn
5866
+ */
5867
+
5868
+ function compileProps(el, propOptions) {
5869
+ var props = [];
5870
+ var names = Object.keys(propOptions);
5871
+ var i = names.length;
5872
+ var options, name, attr, value, path, parsed, prop;
5873
+ while (i--) {
5874
+ name = names[i];
5875
+ options = propOptions[name] || empty;
5876
+
5877
+ if ('development' !== 'production' && name === '$data') {
5878
+ warn('Do not use $data as prop.');
5879
+ continue;
5880
+ }
5881
+
5882
+ // props could contain dashes, which will be
5883
+ // interpreted as minus calculations by the parser
5884
+ // so we need to camelize the path here
5885
+ path = camelize(name);
5886
+ if (!identRE$1.test(path)) {
5887
+ 'development' !== 'production' && warn('Invalid prop key: "' + name + '". Prop keys ' + 'must be valid identifiers.');
5888
+ continue;
5889
+ }
5890
+
5891
+ prop = {
5892
+ name: name,
5893
+ path: path,
5894
+ options: options,
5895
+ mode: propBindingModes.ONE_WAY,
5896
+ raw: null
5897
+ };
5898
+
5899
+ attr = hyphenate(name);
5900
+ // first check dynamic version
5901
+ if ((value = getBindAttr(el, attr)) === null) {
5902
+ if ((value = getBindAttr(el, attr + '.sync')) !== null) {
5903
+ prop.mode = propBindingModes.TWO_WAY;
5904
+ } else if ((value = getBindAttr(el, attr + '.once')) !== null) {
5905
+ prop.mode = propBindingModes.ONE_TIME;
5906
+ }
5907
+ }
5908
+ if (value !== null) {
5909
+ // has dynamic binding!
5910
+ prop.raw = value;
5911
+ parsed = parseDirective(value);
5912
+ value = parsed.expression;
5913
+ prop.filters = parsed.filters;
5914
+ // check binding type
5915
+ if (isLiteral(value) && !parsed.filters) {
5916
+ // for expressions containing literal numbers and
5917
+ // booleans, there's no need to setup a prop binding,
5918
+ // so we can optimize them as a one-time set.
5919
+ prop.optimizedLiteral = true;
5920
+ } else {
5921
+ prop.dynamic = true;
5922
+ // check non-settable path for two-way bindings
5923
+ if ('development' !== 'production' && prop.mode === propBindingModes.TWO_WAY && !settablePathRE.test(value)) {
5924
+ prop.mode = propBindingModes.ONE_WAY;
5925
+ warn('Cannot bind two-way prop with non-settable ' + 'parent path: ' + value);
5926
+ }
5927
+ }
5928
+ prop.parentPath = value;
5929
+
5930
+ // warn required two-way
5931
+ if ('development' !== 'production' && options.twoWay && prop.mode !== propBindingModes.TWO_WAY) {
5932
+ warn('Prop "' + name + '" expects a two-way binding type.');
5933
+ }
5934
+ } else if ((value = getAttr(el, attr)) !== null) {
5935
+ // has literal binding!
5936
+ prop.raw = value;
5937
+ } else if ('development' !== 'production') {
5938
+ // check possible camelCase prop usage
5939
+ var lowerCaseName = path.toLowerCase();
5940
+ value = /[A-Z\-]/.test(name) && (el.getAttribute(lowerCaseName) || el.getAttribute(':' + lowerCaseName) || el.getAttribute('v-bind:' + lowerCaseName) || el.getAttribute(':' + lowerCaseName + '.once') || el.getAttribute('v-bind:' + lowerCaseName + '.once') || el.getAttribute(':' + lowerCaseName + '.sync') || el.getAttribute('v-bind:' + lowerCaseName + '.sync'));
5941
+ if (value) {
5942
+ warn('Possible usage error for prop `' + lowerCaseName + '` - ' + 'did you mean `' + attr + '`? HTML is case-insensitive, remember to use ' + 'kebab-case for props in templates.');
5943
+ } else if (options.required) {
5944
+ // warn missing required
5945
+ warn('Missing required prop: ' + name);
5946
+ }
5947
+ }
5948
+ // push prop
5949
+ props.push(prop);
5950
+ }
5951
+ return makePropsLinkFn(props);
5952
+ }
5953
+
5954
+ /**
5955
+ * Build a function that applies props to a vm.
5956
+ *
5957
+ * @param {Array} props
5958
+ * @return {Function} propsLinkFn
5959
+ */
5960
+
5961
+ function makePropsLinkFn(props) {
5962
+ return function propsLinkFn(vm, scope) {
5963
+ // store resolved props info
5964
+ vm._props = {};
5965
+ var i = props.length;
5966
+ var prop, path, options, value, raw;
5967
+ while (i--) {
5968
+ prop = props[i];
5969
+ raw = prop.raw;
5970
+ path = prop.path;
5971
+ options = prop.options;
5972
+ vm._props[path] = prop;
5973
+ if (raw === null) {
5974
+ // initialize absent prop
5975
+ initProp(vm, prop, undefined);
5976
+ } else if (prop.dynamic) {
5977
+ // dynamic prop
5978
+ if (prop.mode === propBindingModes.ONE_TIME) {
5979
+ // one time binding
5980
+ value = (scope || vm._context || vm).$get(prop.parentPath);
5981
+ initProp(vm, prop, value);
5982
+ } else {
5983
+ if (vm._context) {
5984
+ // dynamic binding
5985
+ vm._bindDir({
5986
+ name: 'prop',
5987
+ def: propDef,
5988
+ prop: prop
5989
+ }, null, null, scope); // el, host, scope
5990
+ } else {
5991
+ // root instance
5992
+ initProp(vm, prop, vm.$get(prop.parentPath));
5993
+ }
5994
+ }
5995
+ } else if (prop.optimizedLiteral) {
5996
+ // optimized literal, cast it and just set once
5997
+ var stripped = stripQuotes(raw);
5998
+ value = stripped === raw ? toBoolean(toNumber(raw)) : stripped;
5999
+ initProp(vm, prop, value);
6000
+ } else {
6001
+ // string literal, but we need to cater for
6002
+ // Boolean props with no value, or with same
6003
+ // literal value (e.g. disabled="disabled")
6004
+ // see https://github.com/vuejs/vue-loader/issues/182
6005
+ value = options.type === Boolean && (raw === '' || raw === hyphenate(prop.name)) ? true : raw;
6006
+ initProp(vm, prop, value);
6007
+ }
6008
+ }
6009
+ };
6010
+ }
6011
+
6012
+ /**
6013
+ * Set a prop's initial value on a vm and its data object.
6014
+ *
6015
+ * @param {Vue} vm
6016
+ * @param {Object} prop
6017
+ * @param {*} value
6018
+ */
6019
+
6020
+ function initProp(vm, prop, value) {
6021
+ var key = prop.path;
6022
+ value = coerceProp(prop, value);
6023
+ if (value === undefined) {
6024
+ value = getPropDefaultValue(vm, prop.options);
6025
+ }
6026
+ if (assertProp(prop, value)) {
6027
+ defineReactive(vm, key, value);
6028
+ }
6029
+ }
6030
+
6031
+ /**
6032
+ * Get the default value of a prop.
6033
+ *
6034
+ * @param {Vue} vm
6035
+ * @param {Object} options
6036
+ * @return {*}
6037
+ */
6038
+
6039
+ function getPropDefaultValue(vm, options) {
6040
+ // no default, return undefined
6041
+ if (!hasOwn(options, 'default')) {
6042
+ // absent boolean value defaults to false
6043
+ return options.type === Boolean ? false : undefined;
6044
+ }
6045
+ var def = options['default'];
6046
+ // warn against non-factory defaults for Object & Array
6047
+ if (isObject(def)) {
6048
+ 'development' !== 'production' && warn('Object/Array as default prop values will be shared ' + 'across multiple instances. Use a factory function ' + 'to return the default value instead.');
6049
+ }
6050
+ // call factory function for non-Function types
6051
+ return typeof def === 'function' && options.type !== Function ? def.call(vm) : def;
6052
+ }
6053
+
6054
+ /**
6055
+ * Assert whether a prop is valid.
6056
+ *
6057
+ * @param {Object} prop
6058
+ * @param {*} value
6059
+ */
6060
+
6061
+ function assertProp(prop, value) {
6062
+ if (!prop.options.required && ( // non-required
6063
+ prop.raw === null || // abscent
6064
+ value == null) // null or undefined
6065
+ ) {
6066
+ return true;
6067
+ }
6068
+ var options = prop.options;
6069
+ var type = options.type;
6070
+ var valid = true;
6071
+ var expectedType;
6072
+ if (type) {
6073
+ if (type === String) {
6074
+ expectedType = 'string';
6075
+ valid = typeof value === expectedType;
6076
+ } else if (type === Number) {
6077
+ expectedType = 'number';
6078
+ valid = typeof value === 'number';
6079
+ } else if (type === Boolean) {
6080
+ expectedType = 'boolean';
6081
+ valid = typeof value === 'boolean';
6082
+ } else if (type === Function) {
6083
+ expectedType = 'function';
6084
+ valid = typeof value === 'function';
6085
+ } else if (type === Object) {
6086
+ expectedType = 'object';
6087
+ valid = isPlainObject(value);
6088
+ } else if (type === Array) {
6089
+ expectedType = 'array';
6090
+ valid = isArray(value);
6091
+ } else {
6092
+ valid = value instanceof type;
6093
+ }
6094
+ }
6095
+ if (!valid) {
6096
+ 'development' !== 'production' && warn('Invalid prop: type check failed for ' + prop.path + '="' + prop.raw + '".' + ' Expected ' + formatType(expectedType) + ', got ' + formatValue(value) + '.');
6097
+ return false;
6098
+ }
6099
+ var validator = options.validator;
6100
+ if (validator) {
6101
+ if (!validator(value)) {
6102
+ 'development' !== 'production' && warn('Invalid prop: custom validator check failed for ' + prop.path + '="' + prop.raw + '"');
6103
+ return false;
6104
+ }
6105
+ }
6106
+ return true;
6107
+ }
5904
6108
 
5905
6109
  /**
5906
- * Call activate hooks in order (asynchronous)
6110
+ * Force parsing value with coerce option.
5907
6111
  *
5908
- * @param {Array} hooks
5909
- * @param {Vue} vm
5910
- * @param {Function} cb
6112
+ * @param {*} value
6113
+ * @param {Object} options
6114
+ * @return {*}
5911
6115
  */
5912
6116
 
5913
- function callActivateHooks(hooks, vm, cb) {
5914
- var total = hooks.length;
5915
- var called = 0;
5916
- hooks[0].call(vm, next);
5917
- function next() {
5918
- if (++called >= total) {
5919
- cb();
5920
- } else {
5921
- hooks[called].call(vm, next);
5922
- }
6117
+ function coerceProp(prop, value) {
6118
+ var coerce = prop.options.coerce;
6119
+ if (!coerce) {
6120
+ return value;
5923
6121
  }
6122
+ // coerce is a function
6123
+ return coerce(value);
6124
+ }
6125
+
6126
+ function formatType(val) {
6127
+ return val ? val.charAt(0).toUpperCase() + val.slice(1) : 'custom type';
6128
+ }
6129
+
6130
+ function formatValue(val) {
6131
+ return Object.prototype.toString.call(val).slice(8, -1);
5924
6132
  }
5925
6133
 
5926
6134
  var bindingModes = config._propBindingModes;
@@ -5935,11 +6143,18 @@ var template = Object.freeze({
5935
6143
  var childKey = prop.path;
5936
6144
  var parentKey = prop.parentPath;
5937
6145
  var twoWay = prop.mode === bindingModes.TWO_WAY;
6146
+ var isSimple = isSimplePath(parentKey);
5938
6147
 
5939
6148
  var parentWatcher = this.parentWatcher = new Watcher(parent, parentKey, function (val) {
5940
6149
  val = coerceProp(prop, val);
5941
6150
  if (assertProp(prop, val)) {
5942
- child[childKey] = val;
6151
+ if (isSimple) {
6152
+ withoutConversion(function () {
6153
+ child[childKey] = val;
6154
+ });
6155
+ } else {
6156
+ child[childKey] = val;
6157
+ }
5943
6158
  }
5944
6159
  }, {
5945
6160
  twoWay: twoWay,
@@ -5950,7 +6165,14 @@ var template = Object.freeze({
5950
6165
  });
5951
6166
 
5952
6167
  // set the child initial value.
5953
- initProp(child, prop, parentWatcher.value);
6168
+ var value = parentWatcher.value;
6169
+ if (isSimple && value !== undefined) {
6170
+ withoutConversion(function () {
6171
+ initProp(child, prop, value);
6172
+ });
6173
+ } else {
6174
+ initProp(child, prop, value);
6175
+ }
5954
6176
 
5955
6177
  // setup two-way binding
5956
6178
  if (twoWay) {
@@ -6018,6 +6240,32 @@ var template = Object.freeze({
6018
6240
  var transDurationProp = transitionProp + 'Duration';
6019
6241
  var animDurationProp = animationProp + 'Duration';
6020
6242
 
6243
+ /**
6244
+ * If a just-entered element is applied the
6245
+ * leave class while its enter transition hasn't started yet,
6246
+ * and the transitioned property has the same value for both
6247
+ * enter/leave, then the leave transition will be skipped and
6248
+ * the transitionend event never fires. This function ensures
6249
+ * its callback to be called after a transition has started
6250
+ * by waiting for double raf.
6251
+ *
6252
+ * It falls back to setTimeout on devices that support CSS
6253
+ * transitions but not raf (e.g. Android 4.2 browser) - since
6254
+ * these environments are usually slow, we are giving it a
6255
+ * relatively large timeout.
6256
+ */
6257
+
6258
+ var raf = inBrowser && window.requestAnimationFrame;
6259
+ var waitForTransitionStart = raf
6260
+ /* istanbul ignore next */
6261
+ ? function (fn) {
6262
+ raf(function () {
6263
+ raf(fn);
6264
+ });
6265
+ } : function (fn) {
6266
+ setTimeout(fn, 50);
6267
+ };
6268
+
6021
6269
  /**
6022
6270
  * A Transition object that encapsulates the state and logic
6023
6271
  * of the transition.
@@ -6102,19 +6350,13 @@ var template = Object.freeze({
6102
6350
  */
6103
6351
 
6104
6352
  p$1.enterNextTick = function () {
6105
- // Important hack:
6106
- // in Chrome, if a just-entered element is applied the
6107
- // leave class while its interpolated property still has
6108
- // a very small value (within one frame), Chrome will
6109
- // skip the leave transition entirely and not firing the
6110
- // transtionend event. Therefore we need to protected
6111
- // against such cases using a one-frame timeout.
6112
- this.justEntered = true;
6113
- var self = this;
6114
- setTimeout(function () {
6115
- self.justEntered = false;
6116
- }, 17);
6353
+ var _this = this;
6117
6354
 
6355
+ // prevent transition skipping
6356
+ this.justEntered = true;
6357
+ waitForTransitionStart(function () {
6358
+ _this.justEntered = false;
6359
+ });
6118
6360
  var enterDone = this.enterDone;
6119
6361
  var type = this.getCssTransitionType(this.enterClass);
6120
6362
  if (!this.pendingJsCb) {
@@ -6391,164 +6633,6 @@ var template = Object.freeze({
6391
6633
  transition: transition$1
6392
6634
  };
6393
6635
 
6394
- var propBindingModes = config._propBindingModes;
6395
- var empty = {};
6396
-
6397
- // regexes
6398
- var identRE$1 = /^[$_a-zA-Z]+[\w$]*$/;
6399
- var settablePathRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\[[^\[\]]+\])*$/;
6400
-
6401
- /**
6402
- * Compile props on a root element and return
6403
- * a props link function.
6404
- *
6405
- * @param {Element|DocumentFragment} el
6406
- * @param {Array} propOptions
6407
- * @return {Function} propsLinkFn
6408
- */
6409
-
6410
- function compileProps(el, propOptions) {
6411
- var props = [];
6412
- var names = Object.keys(propOptions);
6413
- var i = names.length;
6414
- var options, name, attr, value, path, parsed, prop;
6415
- while (i--) {
6416
- name = names[i];
6417
- options = propOptions[name] || empty;
6418
-
6419
- if ('development' !== 'production' && name === '$data') {
6420
- warn('Do not use $data as prop.');
6421
- continue;
6422
- }
6423
-
6424
- // props could contain dashes, which will be
6425
- // interpreted as minus calculations by the parser
6426
- // so we need to camelize the path here
6427
- path = camelize(name);
6428
- if (!identRE$1.test(path)) {
6429
- 'development' !== 'production' && warn('Invalid prop key: "' + name + '". Prop keys ' + 'must be valid identifiers.');
6430
- continue;
6431
- }
6432
-
6433
- prop = {
6434
- name: name,
6435
- path: path,
6436
- options: options,
6437
- mode: propBindingModes.ONE_WAY,
6438
- raw: null
6439
- };
6440
-
6441
- attr = hyphenate(name);
6442
- // first check dynamic version
6443
- if ((value = getBindAttr(el, attr)) === null) {
6444
- if ((value = getBindAttr(el, attr + '.sync')) !== null) {
6445
- prop.mode = propBindingModes.TWO_WAY;
6446
- } else if ((value = getBindAttr(el, attr + '.once')) !== null) {
6447
- prop.mode = propBindingModes.ONE_TIME;
6448
- }
6449
- }
6450
- if (value !== null) {
6451
- // has dynamic binding!
6452
- prop.raw = value;
6453
- parsed = parseDirective(value);
6454
- value = parsed.expression;
6455
- prop.filters = parsed.filters;
6456
- // check binding type
6457
- if (isLiteral(value) && !parsed.filters) {
6458
- // for expressions containing literal numbers and
6459
- // booleans, there's no need to setup a prop binding,
6460
- // so we can optimize them as a one-time set.
6461
- prop.optimizedLiteral = true;
6462
- } else {
6463
- prop.dynamic = true;
6464
- // check non-settable path for two-way bindings
6465
- if ('development' !== 'production' && prop.mode === propBindingModes.TWO_WAY && !settablePathRE.test(value)) {
6466
- prop.mode = propBindingModes.ONE_WAY;
6467
- warn('Cannot bind two-way prop with non-settable ' + 'parent path: ' + value);
6468
- }
6469
- }
6470
- prop.parentPath = value;
6471
-
6472
- // warn required two-way
6473
- if ('development' !== 'production' && options.twoWay && prop.mode !== propBindingModes.TWO_WAY) {
6474
- warn('Prop "' + name + '" expects a two-way binding type.');
6475
- }
6476
- } else if ((value = getAttr(el, attr)) !== null) {
6477
- // has literal binding!
6478
- prop.raw = value;
6479
- } else if ('development' !== 'production') {
6480
- // check possible camelCase prop usage
6481
- var lowerCaseName = path.toLowerCase();
6482
- value = /[A-Z\-]/.test(name) && (el.getAttribute(lowerCaseName) || el.getAttribute(':' + lowerCaseName) || el.getAttribute('v-bind:' + lowerCaseName) || el.getAttribute(':' + lowerCaseName + '.once') || el.getAttribute('v-bind:' + lowerCaseName + '.once') || el.getAttribute(':' + lowerCaseName + '.sync') || el.getAttribute('v-bind:' + lowerCaseName + '.sync'));
6483
- if (value) {
6484
- warn('Possible usage error for prop `' + lowerCaseName + '` - ' + 'did you mean `' + attr + '`? HTML is case-insensitive, remember to use ' + 'kebab-case for props in templates.');
6485
- } else if (options.required) {
6486
- // warn missing required
6487
- warn('Missing required prop: ' + name);
6488
- }
6489
- }
6490
- // push prop
6491
- props.push(prop);
6492
- }
6493
- return makePropsLinkFn(props);
6494
- }
6495
-
6496
- /**
6497
- * Build a function that applies props to a vm.
6498
- *
6499
- * @param {Array} props
6500
- * @return {Function} propsLinkFn
6501
- */
6502
-
6503
- function makePropsLinkFn(props) {
6504
- return function propsLinkFn(vm, scope) {
6505
- // store resolved props info
6506
- vm._props = {};
6507
- var i = props.length;
6508
- var prop, path, options, value, raw;
6509
- while (i--) {
6510
- prop = props[i];
6511
- raw = prop.raw;
6512
- path = prop.path;
6513
- options = prop.options;
6514
- vm._props[path] = prop;
6515
- if (raw === null) {
6516
- // initialize absent prop
6517
- initProp(vm, prop, undefined);
6518
- } else if (prop.dynamic) {
6519
- // dynamic prop
6520
- if (prop.mode === propBindingModes.ONE_TIME) {
6521
- // one time binding
6522
- value = (scope || vm._context || vm).$get(prop.parentPath);
6523
- initProp(vm, prop, value);
6524
- } else {
6525
- if (vm._context) {
6526
- // dynamic binding
6527
- vm._bindDir({
6528
- name: 'prop',
6529
- def: propDef,
6530
- prop: prop
6531
- }, null, null, scope); // el, host, scope
6532
- } else {
6533
- // root instance
6534
- initProp(vm, prop, vm.$get(prop.parentPath));
6535
- }
6536
- }
6537
- } else if (prop.optimizedLiteral) {
6538
- // optimized literal, cast it and just set once
6539
- var stripped = stripQuotes(raw);
6540
- value = stripped === raw ? toBoolean(toNumber(raw)) : stripped;
6541
- initProp(vm, prop, value);
6542
- } else {
6543
- // string literal, but we need to cater for
6544
- // Boolean props with no value
6545
- value = options.type === Boolean && raw === '' ? true : raw;
6546
- initProp(vm, prop, value);
6547
- }
6548
- }
6549
- };
6550
- }
6551
-
6552
6636
  // special binding prefixes
6553
6637
  var bindRE = /^v-bind:|^:/;
6554
6638
  var onRE = /^v-on:|^@/;
@@ -6556,11 +6640,9 @@ var template = Object.freeze({
6556
6640
  var modifierRE = /\.[^\.]+/g;
6557
6641
  var transitionRE = /^(v-bind:|:)?transition$/;
6558
6642
 
6559
- // terminal directives
6560
- var terminalDirectives = ['for', 'if'];
6561
-
6562
6643
  // default directive priority
6563
6644
  var DEFAULT_PRIORITY = 1000;
6645
+ var DEFAULT_TERMINAL_PRIORITY = 2000;
6564
6646
 
6565
6647
  /**
6566
6648
  * Compile a template and return a reusable composite link
@@ -6826,9 +6908,10 @@ var template = Object.freeze({
6826
6908
  }
6827
6909
  var linkFn;
6828
6910
  var hasAttrs = el.hasAttributes();
6911
+ var attrs = hasAttrs && toArray(el.attributes);
6829
6912
  // check terminal directives (for & if)
6830
6913
  if (hasAttrs) {
6831
- linkFn = checkTerminalDirectives(el, options);
6914
+ linkFn = checkTerminalDirectives(el, attrs, options);
6832
6915
  }
6833
6916
  // check element directives
6834
6917
  if (!linkFn) {
@@ -6840,7 +6923,7 @@ var template = Object.freeze({
6840
6923
  }
6841
6924
  // normal directives
6842
6925
  if (!linkFn && hasAttrs) {
6843
- linkFn = compileDirectives(el.attributes, options);
6926
+ linkFn = compileDirectives(attrs, options);
6844
6927
  }
6845
6928
  return linkFn;
6846
6929
  }
@@ -7069,11 +7152,12 @@ var template = Object.freeze({
7069
7152
  * If it finds one, return a terminal link function.
7070
7153
  *
7071
7154
  * @param {Element} el
7155
+ * @param {Array} attrs
7072
7156
  * @param {Object} options
7073
7157
  * @return {Function} terminalLinkFn
7074
7158
  */
7075
7159
 
7076
- function checkTerminalDirectives(el, options) {
7160
+ function checkTerminalDirectives(el, attrs, options) {
7077
7161
  // skip v-pre
7078
7162
  if (getAttr(el, 'v-pre') !== null) {
7079
7163
  return skip;
@@ -7085,14 +7169,29 @@ var template = Object.freeze({
7085
7169
  return skip;
7086
7170
  }
7087
7171
  }
7088
- var value, dirName;
7089
- for (var i = 0, l = terminalDirectives.length; i < l; i++) {
7090
- dirName = terminalDirectives[i];
7091
- value = el.getAttribute('v-' + dirName);
7092
- if (value != null) {
7093
- return makeTerminalNodeLinkFn(el, dirName, value, options);
7172
+
7173
+ var attr, name, value, modifiers, matched, dirName, rawName, arg, def, termDef;
7174
+ for (var i = 0, j = attrs.length; i < j; i++) {
7175
+ attr = attrs[i];
7176
+ modifiers = parseModifiers(attr.name);
7177
+ name = attr.name.replace(modifierRE, '');
7178
+ if (matched = name.match(dirAttrRE)) {
7179
+ def = resolveAsset(options, 'directives', matched[1]);
7180
+ if (def && def.terminal) {
7181
+ if (!termDef || (def.priority || DEFAULT_TERMINAL_PRIORITY) > termDef.priority) {
7182
+ termDef = def;
7183
+ rawName = attr.name;
7184
+ value = attr.value;
7185
+ dirName = matched[1];
7186
+ arg = matched[2];
7187
+ }
7188
+ }
7094
7189
  }
7095
7190
  }
7191
+
7192
+ if (termDef) {
7193
+ return makeTerminalNodeLinkFn(el, dirName, value, options, termDef, rawName, arg, modifiers);
7194
+ }
7096
7195
  }
7097
7196
 
7098
7197
  function skip() {}
@@ -7108,20 +7207,24 @@ var template = Object.freeze({
7108
7207
  * @param {String} dirName
7109
7208
  * @param {String} value
7110
7209
  * @param {Object} options
7111
- * @param {Object} [def]
7210
+ * @param {Object} def
7211
+ * @param {String} [rawName]
7212
+ * @param {String} [arg]
7213
+ * @param {Object} [modifiers]
7112
7214
  * @return {Function} terminalLinkFn
7113
7215
  */
7114
7216
 
7115
- function makeTerminalNodeLinkFn(el, dirName, value, options, def) {
7217
+ function makeTerminalNodeLinkFn(el, dirName, value, options, def, rawName, arg, modifiers) {
7116
7218
  var parsed = parseDirective(value);
7117
7219
  var descriptor = {
7118
7220
  name: dirName,
7221
+ arg: arg,
7119
7222
  expression: parsed.expression,
7120
7223
  filters: parsed.filters,
7121
7224
  raw: value,
7122
- // either an element directive, or if/for
7123
- // #2366 or custom terminal directive
7124
- def: def || resolveAsset(options, 'directives', dirName)
7225
+ attr: rawName,
7226
+ modifiers: modifiers,
7227
+ def: def
7125
7228
  };
7126
7229
  // check ref for v-for and router-view
7127
7230
  if (dirName === 'for' || dirName === 'router-view') {
@@ -7464,6 +7567,9 @@ var template = Object.freeze({
7464
7567
  (contents[name] || (contents[name] = [])).push(el);
7465
7568
  }
7466
7569
  /* eslint-enable no-cond-assign */
7570
+ if ('development' !== 'production' && getBindAttr(el, 'slot')) {
7571
+ warn('The "slot" attribute must be static.');
7572
+ }
7467
7573
  }
7468
7574
  for (name in contents) {
7469
7575
  contents[name] = extractFragment(contents[name], content);
@@ -7500,7 +7606,6 @@ var template = Object.freeze({
7500
7606
  compile: compile,
7501
7607
  compileAndLinkProps: compileAndLinkProps,
7502
7608
  compileRoot: compileRoot,
7503
- terminalDirectives: terminalDirectives,
7504
7609
  transclude: transclude,
7505
7610
  resolveSlots: resolveSlots
7506
7611
  });
@@ -7564,6 +7669,10 @@ var template = Object.freeze({
7564
7669
  Vue.prototype._initData = function () {
7565
7670
  var dataFn = this.$options.data;
7566
7671
  var data = this._data = dataFn ? dataFn() : {};
7672
+ if (!isPlainObject(data)) {
7673
+ data = {};
7674
+ 'development' !== 'production' && warn('data functions should return an object.');
7675
+ }
7567
7676
  var props = this._props;
7568
7677
  var runtimeData = this._runtimeData ? typeof this._runtimeData === 'function' ? this._runtimeData() : this._runtimeData : null;
7569
7678
  // proxy data on instance
@@ -7916,18 +8025,21 @@ var template = Object.freeze({
7916
8025
  * It registers a watcher with the expression and calls
7917
8026
  * the DOM update function when a change is triggered.
7918
8027
  *
7919
- * @param {String} name
7920
- * @param {Node} el
7921
- * @param {Vue} vm
7922
8028
  * @param {Object} descriptor
7923
8029
  * - {String} name
7924
8030
  * - {Object} def
7925
8031
  * - {String} expression
7926
8032
  * - {Array<Object>} [filters]
8033
+ * - {Object} [modifiers]
7927
8034
  * - {Boolean} literal
7928
8035
  * - {String} attr
8036
+ * - {String} arg
7929
8037
  * - {String} raw
7930
- * @param {Object} def - directive definition object
8038
+ * - {String} [ref]
8039
+ * - {Array<Object>} [interp]
8040
+ * - {Boolean} [hasOneTime]
8041
+ * @param {Vue} vm
8042
+ * @param {Node} el
7931
8043
  * @param {Vue} [host] - transclusion host component
7932
8044
  * @param {Object} [scope] - v-for scope
7933
8045
  * @param {Fragment} [frag] - owner fragment
@@ -7963,8 +8075,6 @@ var template = Object.freeze({
7963
8075
  * Initialize the directive, mixin definition properties,
7964
8076
  * setup the watcher, call definition bind() and update()
7965
8077
  * if present.
7966
- *
7967
- * @param {Object} def
7968
8078
  */
7969
8079
 
7970
8080
  Directive.prototype._bind = function () {
@@ -8045,7 +8155,7 @@ var template = Object.freeze({
8045
8155
  var i = params.length;
8046
8156
  var key, val, mappedKey;
8047
8157
  while (i--) {
8048
- key = params[i];
8158
+ key = hyphenate(params[i]);
8049
8159
  mappedKey = camelize(key);
8050
8160
  val = getBindAttr(this.el, key);
8051
8161
  if (val != null) {
@@ -8323,10 +8433,8 @@ var template = Object.freeze({
8323
8433
  /**
8324
8434
  * Create and bind a directive to an element.
8325
8435
  *
8326
- * @param {String} name - directive name
8436
+ * @param {Object} descriptor - parsed directive descriptor
8327
8437
  * @param {Node} node - target node
8328
- * @param {Object} desc - parsed directive descriptor
8329
- * @param {Object} def - directive definition object
8330
8438
  * @param {Vue} [host] - transclusion host component
8331
8439
  * @param {Object} [scope] - v-for scope
8332
8440
  * @param {Fragment} [frag] - owner fragment
@@ -8469,7 +8577,7 @@ var template = Object.freeze({
8469
8577
  Vue.prototype._applyFilters = function (value, oldValue, filters, write) {
8470
8578
  var filter, fn, args, arg, offset, i, l, j, k;
8471
8579
  for (i = 0, l = filters.length; i < l; i++) {
8472
- filter = filters[i];
8580
+ filter = filters[write ? l - i - 1 : i];
8473
8581
  fn = resolveAsset(this.$options, 'filters', filter.name);
8474
8582
  if ('development' !== 'production') {
8475
8583
  assertAsset(fn, 'filter', filter.name);
@@ -8497,14 +8605,19 @@ var template = Object.freeze({
8497
8605
  * resolves asynchronously and caches the resolved
8498
8606
  * constructor on the factory.
8499
8607
  *
8500
- * @param {String} id
8608
+ * @param {String|Function} value
8501
8609
  * @param {Function} cb
8502
8610
  */
8503
8611
 
8504
- Vue.prototype._resolveComponent = function (id, cb) {
8505
- var factory = resolveAsset(this.$options, 'components', id);
8506
- if ('development' !== 'production') {
8507
- assertAsset(factory, 'component', id);
8612
+ Vue.prototype._resolveComponent = function (value, cb) {
8613
+ var factory;
8614
+ if (typeof value === 'function') {
8615
+ factory = value;
8616
+ } else {
8617
+ factory = resolveAsset(this.$options, 'components', value);
8618
+ if ('development' !== 'production') {
8619
+ assertAsset(factory, 'component', value);
8620
+ }
8508
8621
  }
8509
8622
  if (!factory) {
8510
8623
  return;
@@ -8531,7 +8644,7 @@ var template = Object.freeze({
8531
8644
  cbs[i](res);
8532
8645
  }
8533
8646
  }, function reject(reason) {
8534
- 'development' !== 'production' && warn('Failed to resolve async component: ' + id + '. ' + (reason ? '\nReason: ' + reason : ''));
8647
+ 'development' !== 'production' && warn('Failed to resolve async component' + (typeof value === 'string' ? ': ' + value : '') + '. ' + (reason ? '\nReason: ' + reason : ''));
8535
8648
  });
8536
8649
  }
8537
8650
  } else {
@@ -9137,6 +9250,9 @@ var template = Object.freeze({
9137
9250
  /**
9138
9251
  * Teardown the instance, simply delegate to the internal
9139
9252
  * _destroy.
9253
+ *
9254
+ * @param {Boolean} remove
9255
+ * @param {Boolean} deferCleanup
9140
9256
  */
9141
9257
 
9142
9258
  Vue.prototype.$destroy = function (remove, deferCleanup) {
@@ -9149,6 +9265,8 @@ var template = Object.freeze({
9149
9265
  *
9150
9266
  * @param {Element|DocumentFragment} el
9151
9267
  * @param {Vue} [host]
9268
+ * @param {Object} [scope]
9269
+ * @param {Fragment} [frag]
9152
9270
  * @return {Function}
9153
9271
  */
9154
9272
 
@@ -9331,12 +9449,12 @@ var template = Object.freeze({
9331
9449
  if (j) {
9332
9450
  while (j--) {
9333
9451
  key = keys[j];
9334
- if (key === '$key' && contains$1(item.$key, search) || contains$1(getPath(val, key), search)) {
9452
+ if (key === '$key' && contains(item.$key, search) || contains(getPath(val, key), search)) {
9335
9453
  res.push(item);
9336
9454
  break;
9337
9455
  }
9338
9456
  }
9339
- } else if (contains$1(item, search)) {
9457
+ } else if (contains(item, search)) {
9340
9458
  res.push(item);
9341
9459
  }
9342
9460
  }
@@ -9375,20 +9493,20 @@ var template = Object.freeze({
9375
9493
  * @param {String} search
9376
9494
  */
9377
9495
 
9378
- function contains$1(val, search) {
9496
+ function contains(val, search) {
9379
9497
  var i;
9380
9498
  if (isPlainObject(val)) {
9381
9499
  var keys = Object.keys(val);
9382
9500
  i = keys.length;
9383
9501
  while (i--) {
9384
- if (contains$1(val[keys[i]], search)) {
9502
+ if (contains(val[keys[i]], search)) {
9385
9503
  return true;
9386
9504
  }
9387
9505
  }
9388
9506
  } else if (isArray(val)) {
9389
9507
  i = val.length;
9390
9508
  while (i--) {
9391
- if (contains$1(val[i], search)) {
9509
+ if (contains(val[i], search)) {
9392
9510
  return true;
9393
9511
  }
9394
9512
  }
@@ -9685,7 +9803,7 @@ var template = Object.freeze({
9685
9803
 
9686
9804
  installGlobalAPI(Vue);
9687
9805
 
9688
- Vue.version = '1.0.18';
9806
+ Vue.version = '1.0.20';
9689
9807
 
9690
9808
  // devtools global hook
9691
9809
  /* istanbul ignore next */