update bower assets (vue 0.10.5 -> 0.10.6)

This commit is contained in:
uu59 2014-11-04 13:49:08 +09:00
parent 659f36774a
commit 11a2f99733
11 changed files with 207 additions and 93 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "vue", "name": "vue",
"version": "0.10.5", "version": "0.10.6",
"main": "dist/vue.js", "main": "dist/vue.js",
"description": "Simple, Fast & Composable MVVM for building interative interfaces", "description": "Simple, Fast & Composable MVVM for building interative interfaces",
"authors": [ "authors": [
@ -17,11 +17,11 @@
"*.md" "*.md"
], ],
"homepage": "https://github.com/yyx990803/vue", "homepage": "https://github.com/yyx990803/vue",
"_release": "0.10.5", "_release": "0.10.6",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v0.10.5", "tag": "v0.10.6",
"commit": "fe996b388971b014279b1f90df26ef95d8b00f05" "commit": "cf37f7efd6d63c0aa46b50c624816e645ddd7edd"
}, },
"_source": "git://github.com/yyx990803/vue.git", "_source": "git://github.com/yyx990803/vue.git",
"_target": "~0.10.0", "_target": "~0.10.0",

View File

@ -1,5 +1,5 @@
/* /*
Vue.js v0.10.5 Vue.js v0.10.6
(c) 2014 Evan You (c) 2014 Evan You
License: MIT License: MIT
*/ */
@ -213,12 +213,14 @@ var config = require('./config'),
ViewModel = require('./viewmodel'), ViewModel = require('./viewmodel'),
utils = require('./utils'), utils = require('./utils'),
makeHash = utils.hash, makeHash = utils.hash,
assetTypes = ['directive', 'filter', 'partial', 'effect', 'component'] assetTypes = ['directive', 'filter', 'partial', 'effect', 'component'],
// Internal modules that are exposed for plugins
// require these so Browserify can catch them pluginAPI = {
// so they can be used in Vue.require utils: utils,
require('./observer') config: config,
require('./transition') transition: require('./transition'),
observer: require('./observer')
}
ViewModel.options = config.globalAssets = { ViewModel.options = config.globalAssets = {
directives : require('./directives'), directives : require('./directives'),
@ -239,7 +241,7 @@ assetTypes.forEach(function (type) {
} }
if (!value) return hash[id] if (!value) return hash[id]
if (type === 'partial') { if (type === 'partial') {
value = utils.toFragment(value) value = utils.parseTemplateOption(value)
} else if (type === 'component') { } else if (type === 'component') {
value = utils.toConstructor(value) value = utils.toConstructor(value)
} else if (type === 'filter') { } else if (type === 'filter') {
@ -294,8 +296,8 @@ ViewModel.use = function (plugin) {
/** /**
* Expose internal modules for plugins * Expose internal modules for plugins
*/ */
ViewModel.require = function (path) { ViewModel.require = function (module) {
return require('./' + path) return pluginAPI[module]
} }
ViewModel.extend = extend ViewModel.extend = extend
@ -551,6 +553,11 @@ var utils = module.exports = {
*/ */
toFragment: require('./fragment'), toFragment: require('./fragment'),
/**
* Parse the various types of template options
*/
parseTemplateOption: require('./template-parser.js'),
/** /**
* get a value from an object keypath * get a value from an object keypath
*/ */
@ -745,7 +752,7 @@ var utils = module.exports = {
} }
if (partials) { if (partials) {
for (key in partials) { for (key in partials) {
partials[key] = utils.toFragment(partials[key]) partials[key] = utils.parseTemplateOption(partials[key])
} }
} }
if (filters) { if (filters) {
@ -754,7 +761,7 @@ var utils = module.exports = {
} }
} }
if (template) { if (template) {
options.template = utils.toFragment(template) options.template = utils.parseTemplateOption(template)
} }
}, },
@ -872,29 +879,12 @@ map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'
var TAG_RE = /<([\w:]+)/ var TAG_RE = /<([\w:]+)/
module.exports = function (template) { module.exports = function (templateString) {
if (typeof template !== 'string') {
return template
}
// template by ID
if (template.charAt(0) === '#') {
var templateNode = document.getElementById(template.slice(1))
if (!templateNode) return
// if its a template tag and the browser supports it,
// its content is already a document fragment!
if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
return templateNode.content
}
template = templateNode.innerHTML
}
var frag = document.createDocumentFragment(), var frag = document.createDocumentFragment(),
m = TAG_RE.exec(template) m = TAG_RE.exec(templateString)
// text only // text only
if (!m) { if (!m) {
frag.appendChild(document.createTextNode(template)) frag.appendChild(document.createTextNode(templateString))
return frag return frag
} }
@ -905,7 +895,7 @@ module.exports = function (template) {
suffix = wrap[2], suffix = wrap[2],
node = document.createElement('div') node = document.createElement('div')
node.innerHTML = prefix + template.trim() + suffix node.innerHTML = prefix + templateString.trim() + suffix
while (depth--) node = node.lastChild while (depth--) node = node.lastChild
// one element // one element
@ -1983,7 +1973,8 @@ var Compiler = require('./compiler'),
* and a few reserved methods * and a few reserved methods
*/ */
function ViewModel (options) { function ViewModel (options) {
// just compile. options are passed directly to compiler // compile if options passed, if false return. options are passed directly to compiler
if (options === false) return
new Compiler(this, options) new Compiler(this, options)
} }
@ -1991,6 +1982,15 @@ function ViewModel (options) {
// so it can be stringified/looped through as raw data // so it can be stringified/looped through as raw data
var VMProto = ViewModel.prototype var VMProto = ViewModel.prototype
/**
* init allows config compilation after instantiation:
* var a = new Vue(false)
* a.init(config)
*/
def(VMProto, '$init', function (options) {
new Compiler(this, options)
})
/** /**
* Convenience function to get a value from * Convenience function to get a value from
* a keypath * a keypath
@ -2048,8 +2048,8 @@ def(VMProto, '$unwatch', function (key, callback) {
/** /**
* unbind everything, remove everything * unbind everything, remove everything
*/ */
def(VMProto, '$destroy', function () { def(VMProto, '$destroy', function (noRemove) {
this.$compiler.destroy() this.$compiler.destroy(noRemove)
}) })
/** /**
@ -2145,6 +2145,7 @@ function query (el) {
} }
module.exports = ViewModel module.exports = ViewModel
}); });
require.register("vue/src/binding.js", function(exports, require, module){ require.register("vue/src/binding.js", function(exports, require, module){
var Batcher = require('./batcher'), var Batcher = require('./batcher'),
@ -3150,6 +3151,55 @@ exports.eval = function (exp, compiler, data) {
} }
return res return res
} }
});
require.register("vue/src/template-parser.js", function(exports, require, module){
var toFragment = require('./fragment');
/**
* Parses a template string or node and normalizes it into a
* a node that can be used as a partial of a template option
*
* Possible values include
* id selector: '#some-template-id'
* template string: '<div><span>my template</span></div>'
* DocumentFragment object
* Node object of type Template
*/
module.exports = function(template) {
var templateNode;
if (template instanceof window.DocumentFragment) {
// if the template is already a document fragment -- do nothing
return template
}
if (typeof template === 'string') {
// template by ID
if (template.charAt(0) === '#') {
templateNode = document.getElementById(template.slice(1))
if (!templateNode) return
} else {
return toFragment(template)
}
} else if (template.nodeType) {
templateNode = template
} else {
return
}
// if its a template tag and the browser supports it,
// its content is already a document fragment!
if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
return templateNode.content
}
if (templateNode.tagName === 'SCRIPT') {
return toFragment(templateNode.innerHTML)
}
return toFragment(templateNode.outerHTML);
}
}); });
require.register("vue/src/text-parser.js", function(exports, require, module){ require.register("vue/src/text-parser.js", function(exports, require, module){
var openChar = '{', var openChar = '{',
@ -3354,6 +3404,7 @@ filters.lowercase = function (value) {
* 12345 => $12,345.00 * 12345 => $12,345.00
*/ */
filters.currency = function (value, sign) { filters.currency = function (value, sign) {
value = parseFloat(value)
if (!value && value !== 0) return '' if (!value && value !== 0) return ''
sign = sign || '$' sign = sign || '$'
var s = Math.floor(value).toString(), var s = Math.floor(value).toString(),
@ -4271,7 +4322,9 @@ module.exports = {
var el = this.iframeBind var el = this.iframeBind
? this.el.contentWindow ? this.el.contentWindow
: this.el : this.el
el.removeEventListener(this.arg, this.handler) if (this.handler) {
el.removeEventListener(this.arg, this.handler)
}
}, },
unbind: function () { unbind: function () {
@ -4571,13 +4624,19 @@ module.exports = {
}, },
update: function (value) { update: function (value) {
var prop = this.prop var prop = this.prop,
isImportant
/* jshint eqeqeq: true */
// cast possible numbers/booleans into strings
if (value != null) value += ''
if (prop) { if (prop) {
var isImportant = value.slice(-10) === '!important' if (value) {
? 'important' isImportant = value.slice(-10) === '!important'
: '' ? 'important'
if (isImportant) { : ''
value = value.slice(0, -10).trim() if (isImportant) {
value = value.slice(0, -10).trim()
}
} }
this.el.style.setProperty(prop, value, isImportant) this.el.style.setProperty(prop, value, isImportant)
if (this.prefixed) { if (this.prefixed) {

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,9 @@ module.exports = {
var el = this.iframeBind var el = this.iframeBind
? this.el.contentWindow ? this.el.contentWindow
: this.el : this.el
el.removeEventListener(this.arg, this.handler) if (this.handler) {
el.removeEventListener(this.arg, this.handler)
}
}, },
unbind: function () { unbind: function () {

View File

@ -17,13 +17,19 @@ module.exports = {
}, },
update: function (value) { update: function (value) {
var prop = this.prop var prop = this.prop,
isImportant
/* jshint eqeqeq: true */
// cast possible numbers/booleans into strings
if (value != null) value += ''
if (prop) { if (prop) {
var isImportant = value.slice(-10) === '!important' if (value) {
? 'important' isImportant = value.slice(-10) === '!important'
: '' ? 'important'
if (isImportant) { : ''
value = value.slice(0, -10).trim() if (isImportant) {
value = value.slice(0, -10).trim()
}
} }
this.el.style.setProperty(prop, value, isImportant) this.el.style.setProperty(prop, value, isImportant)
if (this.prefixed) { if (this.prefixed) {

View File

@ -35,6 +35,7 @@ filters.lowercase = function (value) {
* 12345 => $12,345.00 * 12345 => $12,345.00
*/ */
filters.currency = function (value, sign) { filters.currency = function (value, sign) {
value = parseFloat(value)
if (!value && value !== 0) return '' if (!value && value !== 0) return ''
sign = sign || '$' sign = sign || '$'
var s = Math.floor(value).toString(), var s = Math.floor(value).toString(),

View File

@ -30,29 +30,12 @@ map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'
var TAG_RE = /<([\w:]+)/ var TAG_RE = /<([\w:]+)/
module.exports = function (template) { module.exports = function (templateString) {
if (typeof template !== 'string') {
return template
}
// template by ID
if (template.charAt(0) === '#') {
var templateNode = document.getElementById(template.slice(1))
if (!templateNode) return
// if its a template tag and the browser supports it,
// its content is already a document fragment!
if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
return templateNode.content
}
template = templateNode.innerHTML
}
var frag = document.createDocumentFragment(), var frag = document.createDocumentFragment(),
m = TAG_RE.exec(template) m = TAG_RE.exec(templateString)
// text only // text only
if (!m) { if (!m) {
frag.appendChild(document.createTextNode(template)) frag.appendChild(document.createTextNode(templateString))
return frag return frag
} }
@ -63,7 +46,7 @@ module.exports = function (template) {
suffix = wrap[2], suffix = wrap[2],
node = document.createElement('div') node = document.createElement('div')
node.innerHTML = prefix + template.trim() + suffix node.innerHTML = prefix + templateString.trim() + suffix
while (depth--) node = node.lastChild while (depth--) node = node.lastChild
// one element // one element

View File

@ -2,12 +2,14 @@ var config = require('./config'),
ViewModel = require('./viewmodel'), ViewModel = require('./viewmodel'),
utils = require('./utils'), utils = require('./utils'),
makeHash = utils.hash, makeHash = utils.hash,
assetTypes = ['directive', 'filter', 'partial', 'effect', 'component'] assetTypes = ['directive', 'filter', 'partial', 'effect', 'component'],
// Internal modules that are exposed for plugins
// require these so Browserify can catch them pluginAPI = {
// so they can be used in Vue.require utils: utils,
require('./observer') config: config,
require('./transition') transition: require('./transition'),
observer: require('./observer')
}
ViewModel.options = config.globalAssets = { ViewModel.options = config.globalAssets = {
directives : require('./directives'), directives : require('./directives'),
@ -28,7 +30,7 @@ assetTypes.forEach(function (type) {
} }
if (!value) return hash[id] if (!value) return hash[id]
if (type === 'partial') { if (type === 'partial') {
value = utils.toFragment(value) value = utils.parseTemplateOption(value)
} else if (type === 'component') { } else if (type === 'component') {
value = utils.toConstructor(value) value = utils.toConstructor(value)
} else if (type === 'filter') { } else if (type === 'filter') {
@ -83,8 +85,8 @@ ViewModel.use = function (plugin) {
/** /**
* Expose internal modules for plugins * Expose internal modules for plugins
*/ */
ViewModel.require = function (path) { ViewModel.require = function (module) {
return require('./' + path) return pluginAPI[module]
} }
ViewModel.extend = extend ViewModel.extend = extend

View File

@ -0,0 +1,46 @@
var toFragment = require('./fragment');
/**
* Parses a template string or node and normalizes it into a
* a node that can be used as a partial of a template option
*
* Possible values include
* id selector: '#some-template-id'
* template string: '<div><span>my template</span></div>'
* DocumentFragment object
* Node object of type Template
*/
module.exports = function(template) {
var templateNode;
if (template instanceof window.DocumentFragment) {
// if the template is already a document fragment -- do nothing
return template
}
if (typeof template === 'string') {
// template by ID
if (template.charAt(0) === '#') {
templateNode = document.getElementById(template.slice(1))
if (!templateNode) return
} else {
return toFragment(template)
}
} else if (template.nodeType) {
templateNode = template
} else {
return
}
// if its a template tag and the browser supports it,
// its content is already a document fragment!
if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
return templateNode.content
}
if (templateNode.tagName === 'SCRIPT') {
return toFragment(templateNode.innerHTML)
}
return toFragment(templateNode.outerHTML);
}

View File

@ -32,6 +32,11 @@ var utils = module.exports = {
*/ */
toFragment: require('./fragment'), toFragment: require('./fragment'),
/**
* Parse the various types of template options
*/
parseTemplateOption: require('./template-parser.js'),
/** /**
* get a value from an object keypath * get a value from an object keypath
*/ */
@ -226,7 +231,7 @@ var utils = module.exports = {
} }
if (partials) { if (partials) {
for (key in partials) { for (key in partials) {
partials[key] = utils.toFragment(partials[key]) partials[key] = utils.parseTemplateOption(partials[key])
} }
} }
if (filters) { if (filters) {
@ -235,7 +240,7 @@ var utils = module.exports = {
} }
} }
if (template) { if (template) {
options.template = utils.toFragment(template) options.template = utils.parseTemplateOption(template)
} }
}, },

View File

@ -16,7 +16,8 @@ var Compiler = require('./compiler'),
* and a few reserved methods * and a few reserved methods
*/ */
function ViewModel (options) { function ViewModel (options) {
// just compile. options are passed directly to compiler // compile if options passed, if false return. options are passed directly to compiler
if (options === false) return
new Compiler(this, options) new Compiler(this, options)
} }
@ -24,6 +25,15 @@ function ViewModel (options) {
// so it can be stringified/looped through as raw data // so it can be stringified/looped through as raw data
var VMProto = ViewModel.prototype var VMProto = ViewModel.prototype
/**
* init allows config compilation after instantiation:
* var a = new Vue(false)
* a.init(config)
*/
def(VMProto, '$init', function (options) {
new Compiler(this, options)
})
/** /**
* Convenience function to get a value from * Convenience function to get a value from
* a keypath * a keypath
@ -81,8 +91,8 @@ def(VMProto, '$unwatch', function (key, callback) {
/** /**
* unbind everything, remove everything * unbind everything, remove everything
*/ */
def(VMProto, '$destroy', function () { def(VMProto, '$destroy', function (noRemove) {
this.$compiler.destroy() this.$compiler.destroy(noRemove)
}) })
/** /**