derby-templates
Advanced tools
Comparing version 0.1.13 to 0.2.1
@@ -67,2 +67,5 @@ exports.ContextMeta = ContextMeta; | ||
if (expression ? expression.isUnbound(this) : this.unbound) return; | ||
var blockType = expression && expression.meta && expression.meta.blockType; | ||
if (blockType === 'with') return; | ||
if (blockType === 'each' && binding.context.item != null) return; | ||
this.meta.addBinding(binding); | ||
@@ -91,4 +94,4 @@ }; | ||
// Make a context for an item in an each block | ||
Context.prototype.eachChild = function(index) { | ||
var context = new Context(this.meta, this.controller, this, this.unbound, this.expression, index); | ||
Context.prototype.eachChild = function(expression, index) { | ||
var context = new Context(this.meta, this.controller, this, this.unbound, expression, index); | ||
this.meta.addItemContext(context); | ||
@@ -103,3 +106,3 @@ return context; | ||
Context.prototype.forRelative = function(expression) { | ||
return (expression.meta && expression.meta.blockType) ? this.parent : this; | ||
return (this.expression === expression) ? this.parent : this; | ||
}; | ||
@@ -106,0 +109,0 @@ |
@@ -159,4 +159,4 @@ var serializeObject = require('serialize-object'); | ||
Expression.prototype._getPatch = function(context, value) { | ||
if (this.meta && this.meta.blockType && value instanceof templates.Template) { | ||
value = value.get(context, true); | ||
if (this.meta && this.meta.blockType) { | ||
value = renderTemplate(value, context); | ||
} | ||
@@ -228,3 +228,3 @@ return (context && context.expression === this && context.item != null) ? | ||
if (this.segments.length) { | ||
if (value instanceof templates.Template) value = value.get(relativeContext, true); | ||
value = renderTemplate(value, relativeContext); | ||
value = lookup(this.segments, value); | ||
@@ -241,3 +241,3 @@ } | ||
var segments = base.concat(this.segments); | ||
return this._resolvePatch(relativeContext, segments); | ||
return this._resolvePatch(context, segments); | ||
}; | ||
@@ -272,3 +272,3 @@ RelativePathExpression.prototype.dependencies = function(context, forInnerPath) { | ||
if (this.segments.length) { | ||
if (value instanceof templates.Template) value = value.get(aliasContext, true); | ||
value = renderTemplate(value, aliasContext); | ||
value = lookup(this.segments, value); | ||
@@ -290,9 +290,11 @@ } | ||
if (!aliasContext) return; | ||
var inner = aliasContext.expression.dependencies(aliasContext, true); | ||
var outer = (aliasContext.keyAlias === this.alias) ? | ||
if (aliasContext.keyAlias === this.alias) { | ||
// For keyAliases, use a dependency of the entire list, so that it will | ||
// always update when the list changes in any way. This is over-binding, | ||
// but this would otherwise need complex special casing | ||
outerDependency(aliasContext.parent.expression, aliasContext.parent, forInnerPath) : | ||
outerDependency(this, context, forInnerPath); | ||
// but would otherwise be much more complex | ||
var base = aliasContext.expression.resolve(aliasContext.parent); | ||
return [base]; | ||
} | ||
var inner = aliasContext.expression.dependencies(aliasContext, true); | ||
var outer = outerDependency(this, context, forInnerPath); | ||
return concat(outer, inner); | ||
@@ -316,3 +318,3 @@ }; | ||
if (this.segments.length) { | ||
if (value instanceof templates.Template) value = value.get(attributeContext, true); | ||
value = renderTemplate(value, attributeContext); | ||
value = lookup(this.segments, value); | ||
@@ -319,0 +321,0 @@ } |
@@ -295,4 +295,4 @@ var saddle = require('saddle'); | ||
}; | ||
ParentWrapper.prototype.dependencies = function(context) { | ||
return (this.expression || this.template).dependencies(context.forViewParent()); | ||
ParentWrapper.prototype.dependencies = function(context, forInnerPath) { | ||
return (this.expression || this.template).dependencies(context.forViewParent(), forInnerPath); | ||
}; | ||
@@ -428,3 +428,3 @@ | ||
ComponentMarker.prototype.emit = function(context, node) { | ||
node.$markComponent = context.controller; | ||
node.$component = context.controller; | ||
}; | ||
@@ -431,0 +431,0 @@ |
{ | ||
"name": "derby-templates", | ||
"version": "0.1.13", | ||
"version": "0.2.1", | ||
"description": "", | ||
@@ -12,3 +12,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"saddle": "^0.4.3", | ||
"saddle": "^0.5.0", | ||
"serialize-object": "~0.0.5" | ||
@@ -15,0 +15,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48661
1341
+ Addedsaddle@0.5.8(transitive)
- Removedsaddle@0.4.6(transitive)
Updatedsaddle@^0.5.0