Comparing version 0.4.15 to 0.4.16
@@ -6,2 +6,3 @@ // Generated by CoffeeScript 1.3.3 | ||
var Collection, collection, isArr, isCollection, isFn, map, mapItem, mutable, notify, reference, vec, _ref, | ||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -43,16 +44,38 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
Collection.prototype.append = []; | ||
function Collection(ref) { | ||
var newValues; | ||
this.ref = ref; | ||
this.onUpdate = __bind(this.onUpdate, this); | ||
Collection.prototype.prepend = []; | ||
this.onRemove = __bind(this.onRemove, this); | ||
Collection.prototype.removed = []; | ||
this.onPrepend = __bind(this.onPrepend, this); | ||
Collection.prototype.update = []; | ||
this.onAppend = __bind(this.onAppend, this); | ||
function Collection(ref) { | ||
var newValues; | ||
this.ref = ref; | ||
this.removeAll = __bind(this.removeAll, this); | ||
this.remove = __bind(this.remove, this); | ||
this.removeFn = __bind(this.removeFn, this); | ||
this.removeItem = __bind(this.removeItem, this); | ||
this.indexOf = __bind(this.indexOf, this); | ||
this.splice = __bind(this.splice, this); | ||
this.shift = __bind(this.shift, this); | ||
this.pop = __bind(this.pop, this); | ||
this.push = __bind(this.push, this); | ||
Collection.__super__.constructor.call(this); | ||
newValues = vec(map(mapItem, mutable.get(this.ref))); | ||
Array.prototype.push.apply(this, newValues); | ||
this.append = []; | ||
this.prepend = []; | ||
this.removed = []; | ||
this.update = []; | ||
} | ||
@@ -59,0 +82,0 @@ |
@@ -137,4 +137,3 @@ // Generated by CoffeeScript 1.3.3 | ||
var newFrame; | ||
newFrame = assoc(frame, "__parent", get(frame, "__node")); | ||
newFrame = assoc(newFrame, "__node", element(node)); | ||
newFrame = assoc(frame, "__node", element(node)); | ||
return proto.apply(cosy(node), newFrame); | ||
@@ -163,2 +162,3 @@ } | ||
newFrame = proto.apply(root(tree), frame); | ||
newFrame["__parent"] = newFrame; | ||
if ((newFrame != null ? newFrame.__delay : void 0) != null) { | ||
@@ -165,0 +165,0 @@ continueFn = function(nextFrame) { |
@@ -6,5 +6,6 @@ // Generated by CoffeeScript 1.3.3 | ||
module.exports = { | ||
List: (require('./control/list')).List | ||
List: (require('./control/list')).List, | ||
Tree: (require('./control/tree')).Tree | ||
}; | ||
}).call(this); |
@@ -18,5 +18,6 @@ // Generated by CoffeeScript 1.3.3 | ||
function List(control, ref) { | ||
var data, element, index, item, itemData, items, _base, _i, _len, _ref2; | ||
function List(control, ref, itemTemplate) { | ||
var data, element, index, item, itemData, items, _base, _i, _len, _ref2, _ref3; | ||
this.control = control; | ||
this.itemTemplate = itemTemplate; | ||
this.renderAll = __bind(this.renderAll, this); | ||
@@ -56,3 +57,5 @@ | ||
} | ||
this.itemTemplate = this.control.template('item'); | ||
if ((_ref3 = this.itemTemplate) == null) { | ||
this.itemTemplate = this.control.template('item'); | ||
} | ||
this.collection.onAppend(this.append); | ||
@@ -63,3 +66,2 @@ this.collection.onPrepend(this.prepend); | ||
this.renderAll(); | ||
global.list = ref; | ||
} | ||
@@ -66,0 +68,0 @@ |
@@ -18,3 +18,3 @@ // Generated by CoffeeScript 1.3.3 | ||
template = function(id, element) { | ||
var tmpl; | ||
var partial, partialName, tmpl, _ref; | ||
if (id == null) { | ||
@@ -28,3 +28,12 @@ id = 'template'; | ||
if ('text/mustache' === tmpl.attr('type')) { | ||
return hogan.tmpl(tmpl.html()); | ||
partialName = tmpl.data('partial'); | ||
if (partialName) { | ||
partial = (_ref = this.frame.partials) != null ? _ref[partialName] : void 0; | ||
if (partial == null) { | ||
throw new Error("Partial not found " + partialName); | ||
} | ||
return hogan.tmpl(partial); | ||
} else { | ||
return hogan.tmpl(tmpl.html()); | ||
} | ||
} else { | ||
@@ -31,0 +40,0 @@ throw new Error("Unkown type for template " + id); |
@@ -8,7 +8,7 @@ // Generated by CoffeeScript 1.3.3 | ||
partial = function(frame, name) { | ||
var _ref; | ||
if ((_ref = frame.partials) == null) { | ||
frame.partials = {}; | ||
var _base, _ref; | ||
if ((_ref = (_base = frame.__parent).partials) == null) { | ||
_base.partials = {}; | ||
} | ||
frame.partials[name] = frame.__node.html(); | ||
frame.__parent.partials[name] = frame.__node.html(); | ||
return frame; | ||
@@ -15,0 +15,0 @@ }; |
{ | ||
"name": "cosy-js", | ||
"version": "0.4.15", | ||
"version": "0.4.16", | ||
"description": "A cosy little library.", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
302590
112
7516
16