Build 0.4.0.
Showing
4 changed files
with
195 additions
and
183 deletions
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.3.13 | 2 | // version: 0.4.0 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
6 | var Rivets, attributeBinding, bindEvent, classBinding, eventBinding, getInputValue, iterationBinding, rivets, unbindEvent, | 6 | var Rivets, bindEvent, getInputValue, rivets, unbindEvent, |
7 | __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | 7 | __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, |
8 | __slice = [].slice, | 8 | __slice = [].slice, |
9 | __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | 9 | __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; |
... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
19 | Rivets.Binding = (function() { | 19 | Rivets.Binding = (function() { |
20 | 20 | ||
21 | function Binding(el, type, model, keypath, options) { | 21 | function Binding(el, type, model, keypath, options) { |
22 | var identifier, regexp, value, _ref; | ||
22 | this.el = el; | 23 | this.el = el; |
23 | this.type = type; | 24 | this.type = type; |
24 | this.model = model; | 25 | this.model = model; |
... | @@ -36,28 +37,29 @@ | ... | @@ -36,28 +37,29 @@ |
36 | 37 | ||
37 | this.formattedValue = __bind(this.formattedValue, this); | 38 | this.formattedValue = __bind(this.formattedValue, this); |
38 | 39 | ||
39 | this.isBidirectional = __bind(this.isBidirectional, this); | 40 | if (!(this.binder = Rivets.binders[type])) { |
40 | 41 | _ref = Rivets.binders; | |
41 | this.routine = (function() { | 42 | for (identifier in _ref) { |
42 | switch (this.options.special) { | 43 | value = _ref[identifier]; |
43 | case 'event': | 44 | if (identifier !== '*' && identifier.indexOf('*') !== -1) { |
44 | return eventBinding(this.type); | 45 | regexp = new RegExp("^" + (identifier.replace('*', '.+')) + "$"); |
45 | case 'class': | 46 | if (regexp.test(type)) { |
46 | return classBinding(this.type); | 47 | this.binder = value; |
47 | case 'iteration': | 48 | this.args = new RegExp("^" + (identifier.replace('*', '(.+)')) + "$").exec(type); |
48 | return iterationBinding(this.type); | 49 | this.args.shift(); |
49 | default: | 50 | } |
50 | return Rivets.routines[this.type] || attributeBinding(this.type); | 51 | } |
51 | } | 52 | } |
52 | }).call(this); | 53 | } |
54 | this.binder || (this.binder = Rivets.binders['*']); | ||
55 | if (this.binder instanceof Function) { | ||
56 | this.binder = { | ||
57 | routine: this.binder | ||
58 | }; | ||
59 | } | ||
53 | this.formatters = this.options.formatters || []; | 60 | this.formatters = this.options.formatters || []; |
54 | } | 61 | } |
55 | 62 | ||
56 | Binding.prototype.isBidirectional = function() { | ||
57 | var _ref; | ||
58 | return (_ref = this.type) === 'value' || _ref === 'checked' || _ref === 'unchecked'; | ||
59 | }; | ||
60 | |||
61 | Binding.prototype.formattedValue = function(value) { | 63 | Binding.prototype.formattedValue = function(value) { |
62 | var args, formatter, id, _i, _len, _ref, _ref1, _ref2; | 64 | var args, formatter, id, _i, _len, _ref, _ref1, _ref2; |
63 | _ref = this.formatters; | 65 | _ref = this.formatters; |
... | @@ -71,14 +73,9 @@ | ... | @@ -71,14 +73,9 @@ |
71 | }; | 73 | }; |
72 | 74 | ||
73 | Binding.prototype.set = function(value) { | 75 | Binding.prototype.set = function(value) { |
74 | value = value instanceof Function && this.options.special !== 'event' ? this.formattedValue(value.call(this.model)) : this.formattedValue(value); | 76 | var _ref; |
75 | if (this.options.special === 'event') { | 77 | value = value instanceof Function && !this.binder["function"] ? this.formattedValue(value.call(this.model)) : this.formattedValue(value); |
76 | return this.currentListener = this.routine(this.el, this.model, value, this.currentListener); | 78 | return (_ref = this.binder.routine) != null ? _ref.call(this, this.el, value) : void 0; |
77 | } else if (this.options.special === 'iteration') { | ||
78 | return this.routine(this.el, value, this); | ||
79 | } else { | ||
80 | return this.routine(this.el, value); | ||
81 | } | ||
82 | }; | 79 | }; |
83 | 80 | ||
84 | Binding.prototype.sync = function() { | 81 | Binding.prototype.sync = function() { |
... | @@ -90,23 +87,23 @@ | ... | @@ -90,23 +87,23 @@ |
90 | }; | 87 | }; |
91 | 88 | ||
92 | Binding.prototype.bind = function() { | 89 | Binding.prototype.bind = function() { |
93 | var dependency, keypath, model, _i, _len, _ref, _ref1, _results; | 90 | var dependency, keypath, model, _i, _len, _ref, _ref1, _ref2, _results; |
94 | if (this.options.bypass) { | 91 | if (this.options.bypass) { |
95 | this.sync(); | 92 | this.sync(); |
96 | } else { | 93 | } else { |
94 | if ((_ref = this.binder.bind) != null) { | ||
95 | _ref.call(this, this.el); | ||
96 | } | ||
97 | Rivets.config.adapter.subscribe(this.model, this.keypath, this.sync); | 97 | Rivets.config.adapter.subscribe(this.model, this.keypath, this.sync); |
98 | if (Rivets.config.preloadData) { | 98 | if (Rivets.config.preloadData) { |
99 | this.sync(); | 99 | this.sync(); |
100 | } | 100 | } |
101 | if (this.isBidirectional()) { | ||
102 | bindEvent(this.el, 'change', this.publish); | ||
103 | } | ||
104 | } | 101 | } |
105 | if ((_ref = this.options.dependencies) != null ? _ref.length : void 0) { | 102 | if ((_ref1 = this.options.dependencies) != null ? _ref1.length : void 0) { |
106 | _ref1 = this.options.dependencies; | 103 | _ref2 = this.options.dependencies; |
107 | _results = []; | 104 | _results = []; |
108 | for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | 105 | for (_i = 0, _len = _ref2.length; _i < _len; _i++) { |
109 | dependency = _ref1[_i]; | 106 | dependency = _ref2[_i]; |
110 | if (/^\./.test(dependency)) { | 107 | if (/^\./.test(dependency)) { |
111 | model = this.model; | 108 | model = this.model; |
112 | keypath = dependency.substr(1); | 109 | keypath = dependency.substr(1); |
... | @@ -122,18 +119,18 @@ | ... | @@ -122,18 +119,18 @@ |
122 | }; | 119 | }; |
123 | 120 | ||
124 | Binding.prototype.unbind = function() { | 121 | Binding.prototype.unbind = function() { |
125 | var keypath, _i, _len, _ref, _ref1, _results; | 122 | var keypath, _i, _len, _ref, _ref1, _ref2, _results; |
126 | if (!this.options.bypass) { | 123 | if (!this.options.bypass) { |
127 | Rivets.config.adapter.unsubscribe(this.model, this.keypath, this.sync); | 124 | if ((_ref = this.binder.unbind) != null) { |
128 | if (this.isBidirectional()) { | 125 | _ref.call(this, this.el); |
129 | unbindEvent(this.el, 'change', this.publish); | ||
130 | } | 126 | } |
127 | Rivets.config.adapter.unsubscribe(this.model, this.keypath, this.sync); | ||
131 | } | 128 | } |
132 | if ((_ref = this.options.dependencies) != null ? _ref.length : void 0) { | 129 | if ((_ref1 = this.options.dependencies) != null ? _ref1.length : void 0) { |
133 | _ref1 = this.options.dependencies; | 130 | _ref2 = this.options.dependencies; |
134 | _results = []; | 131 | _results = []; |
135 | for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | 132 | for (_i = 0, _len = _ref2.length; _i < _len; _i++) { |
136 | keypath = _ref1[_i]; | 133 | keypath = _ref2[_i]; |
137 | _results.push(Rivets.config.adapter.unsubscribe(this.model, keypath, this.sync)); | 134 | _results.push(Rivets.config.adapter.unsubscribe(this.model, keypath, this.sync)); |
138 | } | 135 | } |
139 | return _results; | 136 | return _results; |
... | @@ -180,57 +177,64 @@ | ... | @@ -180,57 +177,64 @@ |
180 | }; | 177 | }; |
181 | 178 | ||
182 | View.prototype.build = function() { | 179 | View.prototype.build = function() { |
183 | var bindingRegExp, classRegExp, el, eventRegExp, iterationRegExp, iterator, node, parseNode, skipNodes, _i, _j, _len, _len1, _ref, _ref1, | 180 | var bindingRegExp, el, node, parseNode, skipNodes, _i, _j, _len, _len1, _ref, _ref1, |
184 | _this = this; | 181 | _this = this; |
185 | this.bindings = []; | 182 | this.bindings = []; |
186 | skipNodes = []; | 183 | skipNodes = []; |
187 | iterator = null; | ||
188 | bindingRegExp = this.bindingRegExp(); | 184 | bindingRegExp = this.bindingRegExp(); |
189 | eventRegExp = /^on-/; | ||
190 | classRegExp = /^class-/; | ||
191 | iterationRegExp = /^each-/; | ||
192 | parseNode = function(node) { | 185 | parseNode = function(node) { |
193 | var a, attribute, binding, context, ctx, dependencies, keypath, model, n, options, path, pipe, pipes, splitPath, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2; | 186 | var attribute, attributes, binder, binding, context, ctx, dependencies, identifier, keypath, model, n, options, path, pipe, pipes, regexp, splitPath, type, value, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3; |
194 | if (__indexOf.call(skipNodes, node) < 0) { | 187 | if (__indexOf.call(skipNodes, node) < 0) { |
195 | _ref = node.attributes; | 188 | _ref = node.attributes; |
196 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 189 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
197 | attribute = _ref[_i]; | 190 | attribute = _ref[_i]; |
198 | if (bindingRegExp.test(attribute.name)) { | 191 | if (bindingRegExp.test(attribute.name)) { |
199 | type = attribute.name.replace(bindingRegExp, ''); | 192 | type = attribute.name.replace(bindingRegExp, ''); |
200 | if (iterationRegExp.test(type)) { | 193 | if (!(binder = Rivets.binders[type])) { |
201 | if (!_this.models[type.replace(iterationRegExp, '')]) { | 194 | _ref1 = Rivets.binders; |
202 | _ref1 = node.getElementsByTagName('*'); | 195 | for (identifier in _ref1) { |
203 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | 196 | value = _ref1[identifier]; |
204 | n = _ref1[_j]; | 197 | if (identifier !== '*' && identifier.indexOf('*') !== -1) { |
205 | skipNodes.push(n); | 198 | regexp = new RegExp("^" + (identifier.replace('*', '.+')) + "$"); |
199 | if (regexp.test(type)) { | ||
200 | binder = value; | ||
201 | } | ||
206 | } | 202 | } |
207 | iterator = [attribute]; | ||
208 | } | 203 | } |
209 | } | 204 | } |
205 | binder || (binder = Rivets.binders['*']); | ||
206 | if (binder.block) { | ||
207 | _ref2 = node.getElementsByTagName('*'); | ||
208 | for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { | ||
209 | n = _ref2[_j]; | ||
210 | skipNodes.push(n); | ||
211 | } | ||
212 | attributes = [attribute]; | ||
213 | } | ||
210 | } | 214 | } |
211 | } | 215 | } |
212 | _ref2 = iterator || node.attributes; | 216 | _ref3 = attributes || node.attributes; |
213 | for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) { | 217 | for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { |
214 | attribute = _ref2[_k]; | 218 | attribute = _ref3[_k]; |
215 | if (bindingRegExp.test(attribute.name)) { | 219 | if (bindingRegExp.test(attribute.name)) { |
216 | options = {}; | 220 | options = {}; |
217 | type = attribute.name.replace(bindingRegExp, ''); | 221 | type = attribute.name.replace(bindingRegExp, ''); |
218 | pipes = (function() { | 222 | pipes = (function() { |
219 | var _l, _len3, _ref3, _results; | 223 | var _l, _len3, _ref4, _results; |
220 | _ref3 = attribute.value.split('|'); | 224 | _ref4 = attribute.value.split('|'); |
221 | _results = []; | 225 | _results = []; |
222 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { | 226 | for (_l = 0, _len3 = _ref4.length; _l < _len3; _l++) { |
223 | pipe = _ref3[_l]; | 227 | pipe = _ref4[_l]; |
224 | _results.push(pipe.trim()); | 228 | _results.push(pipe.trim()); |
225 | } | 229 | } |
226 | return _results; | 230 | return _results; |
227 | })(); | 231 | })(); |
228 | context = (function() { | 232 | context = (function() { |
229 | var _l, _len3, _ref3, _results; | 233 | var _l, _len3, _ref4, _results; |
230 | _ref3 = pipes.shift().split('<'); | 234 | _ref4 = pipes.shift().split('<'); |
231 | _results = []; | 235 | _results = []; |
232 | for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) { | 236 | for (_l = 0, _len3 = _ref4.length; _l < _len3; _l++) { |
233 | ctx = _ref3[_l]; | 237 | ctx = _ref4[_l]; |
234 | _results.push(ctx.trim()); | 238 | _results.push(ctx.trim()); |
235 | } | 239 | } |
236 | return _results; | 240 | return _results; |
... | @@ -250,30 +254,14 @@ | ... | @@ -250,30 +254,14 @@ |
250 | if (dependencies = context.shift()) { | 254 | if (dependencies = context.shift()) { |
251 | options.dependencies = dependencies.split(/\s+/); | 255 | options.dependencies = dependencies.split(/\s+/); |
252 | } | 256 | } |
253 | if (eventRegExp.test(type)) { | ||
254 | type = type.replace(eventRegExp, ''); | ||
255 | options.special = 'event'; | ||
256 | } | ||
257 | if (classRegExp.test(type)) { | ||
258 | type = type.replace(classRegExp, ''); | ||
259 | options.special = 'class'; | ||
260 | } | ||
261 | if (iterationRegExp.test(type)) { | ||
262 | type = type.replace(iterationRegExp, ''); | ||
263 | options.special = 'iteration'; | ||
264 | } | ||
265 | binding = new Rivets.Binding(node, type, model, keypath, options); | 257 | binding = new Rivets.Binding(node, type, model, keypath, options); |
266 | binding.view = _this; | 258 | binding.view = _this; |
267 | _this.bindings.push(binding); | 259 | _this.bindings.push(binding); |
268 | } | 260 | } |
269 | } | 261 | } |
270 | if (iterator) { | 262 | } |
271 | for (_l = 0, _len3 = iterator.length; _l < _len3; _l++) { | 263 | if (attributes) { |
272 | a = iterator[_l]; | 264 | attributes = null; |
273 | node.removeAttribute(a.name); | ||
274 | } | ||
275 | iterator = null; | ||
276 | } | ||
277 | } | 265 | } |
278 | } | 266 | } |
279 | }; | 267 | }; |
... | @@ -338,7 +326,7 @@ | ... | @@ -338,7 +326,7 @@ |
338 | View.prototype.publish = function() { | 326 | View.prototype.publish = function() { |
339 | var binding, _i, _len, _ref, _results; | 327 | var binding, _i, _len, _ref, _results; |
340 | _ref = this.select(function(b) { | 328 | _ref = this.select(function(b) { |
341 | return b.isBidirectional(); | 329 | return b.binder.publishes; |
342 | }); | 330 | }); |
343 | _results = []; | 331 | _results = []; |
344 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | 332 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
... | @@ -409,93 +397,43 @@ | ... | @@ -409,93 +397,43 @@ |
409 | } | 397 | } |
410 | }; | 398 | }; |
411 | 399 | ||
412 | eventBinding = function(event) { | 400 | Rivets.binders = { |
413 | return function(el, context, bind, unbind) { | ||
414 | if (unbind) { | ||
415 | unbindEvent(el, event, unbind); | ||
416 | } | ||
417 | return bindEvent(el, event, bind, context); | ||
418 | }; | ||
419 | }; | ||
420 | |||
421 | classBinding = function(name) { | ||
422 | return function(el, value) { | ||
423 | var elClass, hasClass; | ||
424 | elClass = " " + el.className + " "; | ||
425 | hasClass = elClass.indexOf(" " + name + " ") !== -1; | ||
426 | if (!value === hasClass) { | ||
427 | return el.className = value ? "" + el.className + " " + name : elClass.replace(" " + name + " ", ' ').trim(); | ||
428 | } | ||
429 | }; | ||
430 | }; | ||
431 | |||
432 | iterationBinding = function(name) { | ||
433 | return function(el, collection, binding) { | ||
434 | var data, item, itemEl, iteration, m, n, previous, _i, _j, _len, _len1, _ref, _ref1, _ref2, _results; | ||
435 | if (binding.iterated != null) { | ||
436 | _ref = binding.iterated; | ||
437 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
438 | iteration = _ref[_i]; | ||
439 | iteration.view.unbind(); | ||
440 | iteration.el.parentNode.removeChild(iteration.el); | ||
441 | } | ||
442 | } else { | ||
443 | binding.marker = document.createComment(" rivets: each-" + name + " "); | ||
444 | el.parentNode.insertBefore(binding.marker, el); | ||
445 | el.parentNode.removeChild(el); | ||
446 | } | ||
447 | binding.iterated = []; | ||
448 | _results = []; | ||
449 | for (_j = 0, _len1 = collection.length; _j < _len1; _j++) { | ||
450 | item = collection[_j]; | ||
451 | data = {}; | ||
452 | _ref1 = binding.view.models; | ||
453 | for (n in _ref1) { | ||
454 | m = _ref1[n]; | ||
455 | data[n] = m; | ||
456 | } | ||
457 | data[name] = item; | ||
458 | itemEl = el.cloneNode(true); | ||
459 | previous = binding.iterated[binding.iterated.length - 1] || binding.marker; | ||
460 | binding.marker.parentNode.insertBefore(itemEl, (_ref2 = previous.nextSibling) != null ? _ref2 : null); | ||
461 | _results.push(binding.iterated.push({ | ||
462 | el: itemEl, | ||
463 | view: rivets.bind(itemEl, data) | ||
464 | })); | ||
465 | } | ||
466 | return _results; | ||
467 | }; | ||
468 | }; | ||
469 | |||
470 | attributeBinding = function(attr) { | ||
471 | return function(el, value) { | ||
472 | if (value) { | ||
473 | return el.setAttribute(attr, value); | ||
474 | } else { | ||
475 | return el.removeAttribute(attr); | ||
476 | } | ||
477 | }; | ||
478 | }; | ||
479 | |||
480 | Rivets.routines = { | ||
481 | enabled: function(el, value) { | 401 | enabled: function(el, value) { |
482 | return el.disabled = !value; | 402 | return el.disabled = !value; |
483 | }, | 403 | }, |
484 | disabled: function(el, value) { | 404 | disabled: function(el, value) { |
485 | return el.disabled = !!value; | 405 | return el.disabled = !!value; |
486 | }, | 406 | }, |
487 | checked: function(el, value) { | 407 | checked: { |
488 | if (el.type === 'radio') { | 408 | publishes: true, |
489 | return el.checked = el.value === value; | 409 | bind: function(el) { |
490 | } else { | 410 | return bindEvent(el, 'change', this.publish); |
491 | return el.checked = !!value; | 411 | }, |
412 | unbind: function(el) { | ||
413 | return unbindEvent(el, 'change', this.publish); | ||
414 | }, | ||
415 | routine: function(el, value) { | ||
416 | if (el.type === 'radio') { | ||
417 | return el.checked = el.value === value; | ||
418 | } else { | ||
419 | return el.checked = !!value; | ||
420 | } | ||
492 | } | 421 | } |
493 | }, | 422 | }, |
494 | unchecked: function(el, value) { | 423 | unchecked: { |
495 | if (el.type === 'radio') { | 424 | publishes: true, |
496 | return el.checked = el.value !== value; | 425 | bind: function(el) { |
497 | } else { | 426 | return bindEvent(el, 'change', this.publish); |
498 | return el.checked = !value; | 427 | }, |
428 | unbind: function(el) { | ||
429 | return unbindEvent(el, 'change', this.publish); | ||
430 | }, | ||
431 | routine: function(el, value) { | ||
432 | if (el.type === 'radio') { | ||
433 | return el.checked = el.value !== value; | ||
434 | } else { | ||
435 | return el.checked = !value; | ||
436 | } | ||
499 | } | 437 | } |
500 | }, | 438 | }, |
501 | show: function(el, value) { | 439 | show: function(el, value) { |
... | @@ -507,19 +445,28 @@ | ... | @@ -507,19 +445,28 @@ |
507 | html: function(el, value) { | 445 | html: function(el, value) { |
508 | return el.innerHTML = value != null ? value : ''; | 446 | return el.innerHTML = value != null ? value : ''; |
509 | }, | 447 | }, |
510 | value: function(el, value) { | 448 | value: { |
511 | var o, _i, _len, _ref, _results; | 449 | publishes: true, |
512 | if (el.type === 'select-multiple') { | 450 | bind: function(el) { |
513 | if (value != null) { | 451 | return bindEvent(el, 'change', this.publish); |
514 | _results = []; | 452 | }, |
515 | for (_i = 0, _len = el.length; _i < _len; _i++) { | 453 | unbind: function(el) { |
516 | o = el[_i]; | 454 | return unbindEvent(el, 'change', this.publish); |
517 | _results.push(o.selected = (_ref = o.value, __indexOf.call(value, _ref) >= 0)); | 455 | }, |
456 | routine: function(el, value) { | ||
457 | var o, _i, _len, _ref, _results; | ||
458 | if (el.type === 'select-multiple') { | ||
459 | if (value != null) { | ||
460 | _results = []; | ||
461 | for (_i = 0, _len = el.length; _i < _len; _i++) { | ||
462 | o = el[_i]; | ||
463 | _results.push(o.selected = (_ref = o.value, __indexOf.call(value, _ref) >= 0)); | ||
464 | } | ||
465 | return _results; | ||
518 | } | 466 | } |
519 | return _results; | 467 | } else { |
468 | return el.value = value != null ? value : ''; | ||
520 | } | 469 | } |
521 | } else { | ||
522 | return el.value = value != null ? value : ''; | ||
523 | } | 470 | } |
524 | }, | 471 | }, |
525 | text: function(el, value) { | 472 | text: function(el, value) { |
... | @@ -528,6 +475,71 @@ | ... | @@ -528,6 +475,71 @@ |
528 | } else { | 475 | } else { |
529 | return el.textContent = value != null ? value : ''; | 476 | return el.textContent = value != null ? value : ''; |
530 | } | 477 | } |
478 | }, | ||
479 | "on-*": { | ||
480 | "function": true, | ||
481 | routine: function(el, value) { | ||
482 | if (this.currentListener) { | ||
483 | unbindEvent(el, this.args[0], this.currentListener); | ||
484 | } | ||
485 | return this.currentListener = bindEvent(el, this.args[0], value, this.model); | ||
486 | } | ||
487 | }, | ||
488 | "each-*": { | ||
489 | block: true, | ||
490 | bind: function(el, collection) { | ||
491 | return el.removeAttribute(['data', rivets.config.prefix, this.type].join('-').replace('--', '-')); | ||
492 | }, | ||
493 | routine: function(el, collection) { | ||
494 | var data, e, item, itemEl, m, n, previous, view, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _results; | ||
495 | if (this.iterated != null) { | ||
496 | _ref = this.iterated; | ||
497 | for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
498 | view = _ref[_i]; | ||
499 | view.unbind(); | ||
500 | _ref1 = view.els; | ||
501 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
502 | e = _ref1[_j]; | ||
503 | e.parentNode.removeChild(e); | ||
504 | } | ||
505 | } | ||
506 | } else { | ||
507 | this.marker = document.createComment(" rivets: " + this.type + " "); | ||
508 | el.parentNode.insertBefore(this.marker, el); | ||
509 | el.parentNode.removeChild(el); | ||
510 | } | ||
511 | this.iterated = []; | ||
512 | _results = []; | ||
513 | for (_k = 0, _len2 = collection.length; _k < _len2; _k++) { | ||
514 | item = collection[_k]; | ||
515 | data = {}; | ||
516 | _ref2 = this.view.models; | ||
517 | for (n in _ref2) { | ||
518 | m = _ref2[n]; | ||
519 | data[n] = m; | ||
520 | } | ||
521 | data[this.args[0]] = item; | ||
522 | itemEl = el.cloneNode(true); | ||
523 | previous = this.iterated[this.iterated.length - 1] || this.marker; | ||
524 | this.marker.parentNode.insertBefore(itemEl, (_ref3 = previous.nextSibling) != null ? _ref3 : null); | ||
525 | _results.push(this.iterated.push(rivets.bind(itemEl, data))); | ||
526 | } | ||
527 | return _results; | ||
528 | } | ||
529 | }, | ||
530 | "class-*": function(el, value) { | ||
531 | var elClass; | ||
532 | elClass = " " + el.className + " "; | ||
533 | if (!value === (elClass.indexOf(" " + this.args[0] + " ") !== -1)) { | ||
534 | return el.className = value ? "" + el.className + " " + this.args[0] : elClass.replace(" " + this.args[0] + " ", ' ').trim(); | ||
535 | } | ||
536 | }, | ||
537 | "*": function(el, value) { | ||
538 | if (value) { | ||
539 | return el.setAttribute(this.type, value); | ||
540 | } else { | ||
541 | return el.removeAttribute(this.type); | ||
542 | } | ||
531 | } | 543 | } |
532 | }; | 544 | }; |
533 | 545 | ||
... | @@ -538,7 +550,7 @@ | ... | @@ -538,7 +550,7 @@ |
538 | Rivets.formatters = {}; | 550 | Rivets.formatters = {}; |
539 | 551 | ||
540 | rivets = { | 552 | rivets = { |
541 | routines: Rivets.routines, | 553 | binders: Rivets.binders, |
542 | formatters: Rivets.formatters, | 554 | formatters: Rivets.formatters, |
543 | config: Rivets.config, | 555 | config: Rivets.config, |
544 | configure: function(options) { | 556 | configure: function(options) { | ... | ... |
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.3.13 | 2 | // version: 0.4.0 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function(){var a,b,c,d,e,f,g,h,i,j=function(a,b){return function(){return a.apply(b,arguments)}},k=[].slice,l=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};a={},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),a.Binding=function(){function h(c,f,h,i,k){this.el=c,this.type=f,this.model=h,this.keypath=i,this.options=k!=null?k:{},this.unbind=j(this.unbind,this),this.bind=j(this.bind,this),this.publish=j(this.publish,this),this.sync=j(this.sync,this),this.set=j(this.set,this),this.formattedValue=j(this.formattedValue,this),this.isBidirectional=j(this.isBidirectional,this),this.routine=function(){switch(this.options.special){case"event":return e(this.type);case"class":return d(this.type);case"iteration":return g(this.type);default:return a.routines[this.type]||b(this.type)}}.call(this),this.formatters=this.options.formatters||[]}return h.prototype.isBidirectional=function(){var a;return(a=this.type)==="value"||a==="checked"||a==="unchecked"},h.prototype.formattedValue=function(b){var c,d,e,f,g,h,i,j;h=this.formatters;for(f=0,g=h.length;f<g;f++)d=h[f],c=d.split(/\s+/),e=c.shift(),b=this.model[e]instanceof Function?(i=this.model)[e].apply(i,[b].concat(k.call(c))):a.formatters[e]?(j=a.formatters)[e].apply(j,[b].concat(k.call(c))):void 0;return b},h.prototype.set=function(a){return a=a instanceof Function&&this.options.special!=="event"?this.formattedValue(a.call(this.model)):this.formattedValue(a),this.options.special==="event"?this.currentListener=this.routine(this.el,this.model,a,this.currentListener):this.options.special==="iteration"?this.routine(this.el,a,this):this.routine(this.el,a)},h.prototype.sync=function(){return this.set(this.options.bypass?this.model[this.keypath]:a.config.adapter.read(this.model,this.keypath))},h.prototype.publish=function(){return a.config.adapter.publish(this.model,this.keypath,f(this.el))},h.prototype.bind=function(){var b,d,e,f,g,h,i,j;this.options.bypass?this.sync():(a.config.adapter.subscribe(this.model,this.keypath,this.sync),a.config.preloadData&&this.sync(),this.isBidirectional()&&c(this.el,"change",this.publish));if((h=this.options.dependencies)!=null?h.length:void 0){i=this.options.dependencies,j=[];for(f=0,g=i.length;f<g;f++)b=i[f],/^\./.test(b)?(e=this.model,d=b.substr(1)):(b=b.split("."),e=this.view.models[b.shift()],d=b.join(".")),j.push(a.config.adapter.subscribe(e,d,this.sync));return j}},h.prototype.unbind=function(){var b,c,d,e,f,g;this.options.bypass||(a.config.adapter.unsubscribe(this.model,this.keypath,this.sync),this.isBidirectional()&&i(this.el,"change",this.publish));if((e=this.options.dependencies)!=null?e.length:void 0){f=this.options.dependencies,g=[];for(c=0,d=f.length;c<d;c++)b=f[c],g.push(a.config.adapter.unsubscribe(this.model,b,this.sync));return g}},h}(),a.View=function(){function b(a,b){this.els=a,this.models=b,this.publish=j(this.publish,this),this.sync=j(this.sync,this),this.unbind=j(this.unbind,this),this.bind=j(this.bind,this),this.select=j(this.select,this),this.build=j(this.build,this),this.bindingRegExp=j(this.bindingRegExp,this),this.els.jquery||this.els instanceof Array||(this.els=[this.els]),this.build()}return b.prototype.bindingRegExp=function(){var b;return b=a.config.prefix,b?new RegExp("^data-"+b+"-"):/^data-/},b.prototype.build=function(){var b,c,d,e,f,g,h,i,j,k,m,n,o,p,q,r=this;this.bindings=[],j=[],g=null,b=this.bindingRegExp(),e=/^on-/,c=/^class-/,f=/^each-/,i=function(d){var h,i,k,m,n,o,p,q,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J;if(l.call(j,d)<0){H=d.attributes;for(z=0,D=H.length;z<D;z++){i=H[z];if(b.test(i.name)){y=i.name.replace(b,"");if(f.test(y)&&!r.models[y.replace(f,"")]){I=d.getElementsByTagName("*");for(A=0,E=I.length;A<E;A++)s=I[A],j.push(s);g=[i]}}}J=g||d.attributes;for(B=0,F=J.length;B<F;B++){i=J[B];if(b.test(i.name)){t={},y=i.name.replace(b,""),w=function(){var a,b,c,d;c=i.value.split("|"),d=[];for(a=0,b=c.length;a<b;a++)v=c[a],d.push(v.trim());return d}(),m=function(){var a,b,c,d;c=w.shift().split("<"),d=[];for(a=0,b=c.length;a<b;a++)n=c[a],d.push(n.trim());return d}(),u=m.shift(),x=u.split(/\.|:/),t.formatters=w,t.bypass=u.indexOf(":")!==-1,x[0]?q=r.models[x.shift()]:(q=r.models,x.shift()),p=x.join(".");if(q){if(o=m.shift())t.dependencies=o.split(/\s+/);e.test(y)&&(y=y.replace(e,""),t.special="event"),c.test(y)&&(y=y.replace(c,""),t.special="class"),f.test(y)&&(y=y.replace(f,""),t.special="iteration"),k=new a.Binding(d,y,q,p,t),k.view=r,r.bindings.push(k)}}if(g){for(C=0,G=g.length;C<G;C++)h=g[C],d.removeAttribute(h.name);g=null}}}},p=this.els;for(k=0,n=p.length;k<n;k++){d=p[k],i(d),q=d.getElementsByTagName("*");for(m=0,o=q.length;m<o;m++)h=q[m],i(h)}},b.prototype.select=function(a){var b,c,d,e,f;e=this.bindings,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],a(b)&&f.push(b);return f},b.prototype.bind=function(){var a,b,c,d,e;d=this.bindings,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.bind());return e},b.prototype.unbind=function(){var a,b,c,d,e;d=this.bindings,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.unbind());return e},b.prototype.sync=function(){var a,b,c,d,e;d=this.bindings,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.sync());return e},b.prototype.publish=function(){var a,b,c,d,e;d=this.select(function(a){return a.isBidirectional()}),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.publish());return e},b}(),c=function(a,b,c,d){var e;return e=function(a){return c.call(d,a)},window.jQuery!=null?(a=jQuery(a),a.on!=null?a.on(b,e):a.bind(b,e)):window.addEventListener!=null?a.addEventListener(b,e,!1):(b="on"+b,a.attachEvent(b,e)),e},i=function(a,b,c){return window.jQuery!=null?(a=jQuery(a),a.off!=null?a.off(b,c):a.unbind(b,c)):window.removeEventListener?a.removeEventListener(b,c,!1):(b="on"+b,a.detachEvent(b,c))},f=function(a){var b,c,d,e;switch(a.type){case"checkbox":return a.checked;case"select-multiple":e=[];for(c=0,d=a.length;c<d;c++)b=a[c],b.selected&&e.push(b.value);return e;default:return a.value}},e=function(a){return function(b,d,e,f){return f&&i(b,a,f),c(b,a,e,d)}},d=function(a){return function(b,c){var d,e;d=" "+b.className+" ",e=d.indexOf(" "+a+" ")!==-1;if(!c===e)return b.className=c?""+b.className+" "+a:d.replace(" "+a+" "," ").trim()}},g=function(a){return function(b,c,d){var e,f,g,i,j,k,l,m,n,o,p,q,r,s,t;if(d.iterated!=null){q=d.iterated;for(m=0,o=q.length;m<o;m++)i=q[m],i.view.unbind(),i.el.parentNode.removeChild(i.el)}else d.marker=document.createComment(" rivets: each-"+a+" "),b.parentNode.insertBefore(d.marker,b),b.parentNode.removeChild(b);d.iterated=[],t=[];for(n=0,p=c.length;n<p;n++){f=c[n],e={},r=d.view.models;for(k in r)j=r[k],e[k]=j;e[a]=f,g=b.cloneNode(!0),l=d.iterated[d.iterated.length-1]||d.marker,d.marker.parentNode.insertBefore(g,(s=l.nextSibling)!=null?s:null),t.push(d.iterated.push({el:g,view:h.bind(g,e)}))}return t}},b=function(a){return function(b,c){return c?b.setAttribute(a,c):b.removeAttribute(a)}},a.routines={enabled:function(a,b){return a.disabled=!b},disabled:function(a,b){return a.disabled=!!b},checked:function(a,b){return a.type==="radio"?a.checked=a.value===b:a.checked=!!b},unchecked:function(a,b){return a.type==="radio"?a.checked=a.value!==b:a.checked=!b},show:function(a,b){return a.style.display=b?"":"none"},hide:function(a,b){return a.style.display=b?"none":""},html:function(a,b){return a.innerHTML=b!=null?b:""},value:function(a,b){var c,d,e,f,g;if(a.type!=="select-multiple")return a.value=b!=null?b:"";if(b!=null){g=[];for(d=0,e=a.length;d<e;d++)c=a[d],g.push(c.selected=(f=c.value,l.call(b,f)>=0));return g}},text:function(a,b){return a.innerText!=null?a.innerText=b!=null?b:"":a.textContent=b!=null?b:""}},a.config={preloadData:!0},a.formatters={},h={routines:a.routines,formatters:a.formatters,config:a.config,configure:function(b){var c,d;b==null&&(b={});for(c in b)d=b[c],a.config[c]=d},bind:function(b,c){var d;return c==null&&(c={}),d=new a.View(b,c),d.bind(),d}},typeof module!="undefined"&&module!==null?module.exports=h:this.rivets=h}).call(this); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
5 | (function(){var a,b,c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}},g=[].slice,h=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};a={},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),a.Binding=function(){function b(b,c,d,e,g){var h,i,j,k;this.el=b,this.type=c,this.model=d,this.keypath=e,this.options=g!=null?g:{},this.unbind=f(this.unbind,this),this.bind=f(this.bind,this),this.publish=f(this.publish,this),this.sync=f(this.sync,this),this.set=f(this.set,this),this.formattedValue=f(this.formattedValue,this);if(!(this.binder=a.binders[c])){k=a.binders;for(h in k)j=k[h],h!=="*"&&h.indexOf("*")!==-1&&(i=new RegExp("^"+h.replace("*",".+")+"$"),i.test(c)&&(this.binder=j,this.args=(new RegExp("^"+h.replace("*","(.+)")+"$")).exec(c),this.args.shift()))}this.binder||(this.binder=a.binders["*"]),this.binder instanceof Function&&(this.binder={routine:this.binder}),this.formatters=this.options.formatters||[]}return b.prototype.formattedValue=function(b){var c,d,e,f,h,i,j,k;i=this.formatters;for(f=0,h=i.length;f<h;f++)d=i[f],c=d.split(/\s+/),e=c.shift(),b=this.model[e]instanceof Function?(j=this.model)[e].apply(j,[b].concat(g.call(c))):a.formatters[e]?(k=a.formatters)[e].apply(k,[b].concat(g.call(c))):void 0;return b},b.prototype.set=function(a){var b;return a=a instanceof Function&&!this.binder["function"]?this.formattedValue(a.call(this.model)):this.formattedValue(a),(b=this.binder.routine)!=null?b.call(this,this.el,a):void 0},b.prototype.sync=function(){return this.set(this.options.bypass?this.model[this.keypath]:a.config.adapter.read(this.model,this.keypath))},b.prototype.publish=function(){return a.config.adapter.publish(this.model,this.keypath,c(this.el))},b.prototype.bind=function(){var b,c,d,e,f,g,h,i,j;this.options.bypass?this.sync():((g=this.binder.bind)!=null&&g.call(this,this.el),a.config.adapter.subscribe(this.model,this.keypath,this.sync),a.config.preloadData&&this.sync());if((h=this.options.dependencies)!=null?h.length:void 0){i=this.options.dependencies,j=[];for(e=0,f=i.length;e<f;e++)b=i[e],/^\./.test(b)?(d=this.model,c=b.substr(1)):(b=b.split("."),d=this.view.models[b.shift()],c=b.join(".")),j.push(a.config.adapter.subscribe(d,c,this.sync));return j}},b.prototype.unbind=function(){var b,c,d,e,f,g,h;this.options.bypass||((e=this.binder.unbind)!=null&&e.call(this,this.el),a.config.adapter.unsubscribe(this.model,this.keypath,this.sync));if((f=this.options.dependencies)!=null?f.length:void 0){g=this.options.dependencies,h=[];for(c=0,d=g.length;c<d;c++)b=g[c],h.push(a.config.adapter.unsubscribe(this.model,b,this.sync));return h}},b}(),a.View=function(){function b(a,b){this.els=a,this.models=b,this.publish=f(this.publish,this),this.sync=f(this.sync,this),this.unbind=f(this.unbind,this),this.bind=f(this.bind,this),this.select=f(this.select,this),this.build=f(this.build,this),this.bindingRegExp=f(this.bindingRegExp,this),this.els.jquery||this.els instanceof Array||(this.els=[this.els]),this.build()}return b.prototype.bindingRegExp=function(){var b;return b=a.config.prefix,b?new RegExp("^data-"+b+"-"):/^data-/},b.prototype.build=function(){var b,c,d,e,f,g,i,j,k,l,m,n=this;this.bindings=[],f=[],b=this.bindingRegExp(),e=function(c){var d,e,g,i,j,k,l,m,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;if(h.call(f,c)<0){F=c.attributes;for(z=0,C=F.length;z<C;z++){d=F[z];if(b.test(d.name)){x=d.name.replace(b,"");if(!(g=a.binders[x])){G=a.binders;for(m in G)y=G[m],m!=="*"&&m.indexOf("*")!==-1&&(v=new RegExp("^"+m.replace("*",".+")+"$"),v.test(x)&&(g=y))}g||(g=a.binders["*"]);if(g.block){H=c.getElementsByTagName("*");for(A=0,D=H.length;A<D;A++)q=H[A],f.push(q);e=[d]}}}I=e||c.attributes;for(B=0,E=I.length;B<E;B++){d=I[B];if(b.test(d.name)){r={},x=d.name.replace(b,""),u=function(){var a,b,c,e;c=d.value.split("|"),e=[];for(a=0,b=c.length;a<b;a++)t=c[a],e.push(t.trim());return e}(),j=function(){var a,b,c,d;c=u.shift().split("<"),d=[];for(a=0,b=c.length;a<b;a++)k=c[a],d.push(k.trim());return d}(),s=j.shift(),w=s.split(/\.|:/),r.formatters=u,r.bypass=s.indexOf(":")!==-1,w[0]?p=n.models[w.shift()]:(p=n.models,w.shift()),o=w.join(".");if(p){if(l=j.shift())r.dependencies=l.split(/\s+/);i=new a.Binding(c,x,p,o,r),i.view=n,n.bindings.push(i)}}}e&&(e=null)}},l=this.els;for(g=0,j=l.length;g<j;g++){c=l[g],e(c),m=c.getElementsByTagName("*");for(i=0,k=m.length;i<k;i++)d=m[i],e(d)}},b.prototype.select=function(a){var b,c,d,e,f;e=this.bindings,f=[];for(c=0,d=e.length;c<d;c++)b=e[c],a(b)&&f.push(b);return f},b.prototype.bind=function(){var a,b,c,d,e;d=this.bindings,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.bind());return e},b.prototype.unbind=function(){var a,b,c,d,e;d=this.bindings,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.unbind());return e},b.prototype.sync=function(){var a,b,c,d,e;d=this.bindings,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.sync());return e},b.prototype.publish=function(){var a,b,c,d,e;d=this.select(function(a){return a.binder.publishes}),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.publish());return e},b}(),b=function(a,b,c,d){var e;return e=function(a){return c.call(d,a)},window.jQuery!=null?(a=jQuery(a),a.on!=null?a.on(b,e):a.bind(b,e)):window.addEventListener!=null?a.addEventListener(b,e,!1):(b="on"+b,a.attachEvent(b,e)),e},e=function(a,b,c){return window.jQuery!=null?(a=jQuery(a),a.off!=null?a.off(b,c):a.unbind(b,c)):window.removeEventListener?a.removeEventListener(b,c,!1):(b="on"+b,a.detachEvent(b,c))},c=function(a){var b,c,d,e;switch(a.type){case"checkbox":return a.checked;case"select-multiple":e=[];for(c=0,d=a.length;c<d;c++)b=a[c],b.selected&&e.push(b.value);return e;default:return a.value}},a.binders={enabled:function(a,b){return a.disabled=!b},disabled:function(a,b){return a.disabled=!!b},checked:{publishes:!0,bind:function(a){return b(a,"change",this.publish)},unbind:function(a){return e(a,"change",this.publish)},routine:function(a,b){return a.type==="radio"?a.checked=a.value===b:a.checked=!!b}},unchecked:{publishes:!0,bind:function(a){return b(a,"change",this.publish)},unbind:function(a){return e(a,"change",this.publish)},routine:function(a,b){return a.type==="radio"?a.checked=a.value!==b:a.checked=!b}},show:function(a,b){return a.style.display=b?"":"none"},hide:function(a,b){return a.style.display=b?"none":""},html:function(a,b){return a.innerHTML=b!=null?b:""},value:{publishes:!0,bind:function(a){return b(a,"change",this.publish)},unbind:function(a){return e(a,"change",this.publish)},routine:function(a,b){var c,d,e,f,g;if(a.type!=="select-multiple")return a.value=b!=null?b:"";if(b!=null){g=[];for(d=0,e=a.length;d<e;d++)c=a[d],g.push(c.selected=(f=c.value,h.call(b,f)>=0));return g}}},text:function(a,b){return a.innerText!=null?a.innerText=b!=null?b:"":a.textContent=b!=null?b:""},"on-*":{"function":!0,routine:function(a,c){return this.currentListener&&e(a,this.args[0],this.currentListener),this.currentListener=b(a,this.args[0],c,this.model)}},"each-*":{block:!0,bind:function(a,b){return a.removeAttribute(["data",d.config.prefix,this.type].join("-").replace("--","-"))},routine:function(a,b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;if(this.iterated!=null){r=this.iterated;for(l=0,o=r.length;l<o;l++){k=r[l],k.unbind(),s=k.els;for(m=0,p=s.length;m<p;m++)e=s[m],e.parentNode.removeChild(e)}}else this.marker=document.createComment(" rivets: "+this.type+" "),a.parentNode.insertBefore(this.marker,a),a.parentNode.removeChild(a);this.iterated=[],v=[];for(n=0,q=b.length;n<q;n++){f=b[n],c={},t=this.view.models;for(i in t)h=t[i],c[i]=h;c[this.args[0]]=f,g=a.cloneNode(!0),j=this.iterated[this.iterated.length-1]||this.marker,this.marker.parentNode.insertBefore(g,(u=j.nextSibling)!=null?u:null),v.push(this.iterated.push(d.bind(g,c)))}return v}},"class-*":function(a,b){var c;c=" "+a.className+" ";if(!b==(c.indexOf(" "+this.args[0]+" ")!==-1))return a.className=b?""+a.className+" "+this.args[0]:c.replace(" "+this.args[0]+" "," ").trim()},"*":function(a,b){return b?a.setAttribute(this.type,b):a.removeAttribute(this.type)}},a.config={preloadData:!0},a.formatters={},d={binders:a.binders,formatters:a.formatters,config:a.config,configure:function(b){var c,d;b==null&&(b={});for(c in b)d=b[c],a.config[c]=d},bind:function(b,c){var d;return c==null&&(c={}),d=new a.View(b,c),d.bind(),d}},typeof module!="undefined"&&module!==null?module.exports=d:this.rivets=d}).call(this); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | { | 1 | { |
2 | "name" : "rivets", | 2 | "name" : "rivets", |
3 | "description" : "Declarative data binding facility.", | 3 | "description" : "Declarative data binding facility.", |
4 | "version" : "0.3.13", | 4 | "version" : "0.4.0", |
5 | "author" : "Michael Richards", | 5 | "author" : "Michael Richards", |
6 | "url" : "http://rivetsjs.com", | 6 | "url" : "http://rivetsjs.com", |
7 | "main" : "./lib/rivets.js", | 7 | "main" : "./lib/rivets.js", | ... | ... |
-
Please register or sign in to post a comment