exojs 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,9 @@
1
- // Generated by CoffeeScript 1.6.1
2
1
  (function() {
3
- var Controller, List, Model, Spine,
4
- __hasProp = {}.hasOwnProperty,
5
- __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; },
6
- __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; },
7
- __slice = [].slice;
2
+ var CSSTransitioner, Controller, List, Model, Spine, _base, _base2,
3
+ __hasProp = Object.prototype.hasOwnProperty,
4
+ __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; },
5
+ __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
6
+ __slice = Array.prototype.slice;
8
7
 
9
8
  Spine = this.Spine || require('spine');
10
9
 
@@ -14,9 +13,7 @@
14
13
 
15
14
  function Controller(opts) {
16
15
  var _this = this;
17
- if (opts == null) {
18
- opts = {};
19
- }
16
+ if (opts == null) opts = {};
20
17
  this._nodeOpts = opts;
21
18
  this._node = null;
22
19
  this.node().beforeActivate = function() {
@@ -43,15 +40,9 @@
43
40
  _this.trigger('onChildDeactivated', node.controller);
44
41
  return typeof _this.onChildDeactivated === "function" ? _this.onChildDeactivated(node.controller) : void 0;
45
42
  };
46
- if (opts.initialState) {
47
- delete opts.initialState;
48
- }
49
- if (opts.mode) {
50
- delete opts.mode;
51
- }
52
- if (opts.children) {
53
- delete opts.children;
54
- }
43
+ if (opts.initialState) delete opts.initialState;
44
+ if (opts.mode) delete opts.mode;
45
+ if (opts.children) delete opts.children;
55
46
  Controller.__super__.constructor.call(this, opts);
56
47
  this.prepare();
57
48
  }
@@ -188,9 +179,7 @@
188
179
  __extends(List, _super);
189
180
 
190
181
  function List(opts) {
191
- if (opts == null) {
192
- opts = {};
193
- }
182
+ if (opts == null) opts = {};
194
183
  opts.initialState || (opts.initialState = Exo.Node.States.ACTIVATED);
195
184
  opts.mode || (opts.mode = Exo.Node.Modes.MULTI);
196
185
  List.__super__.constructor.call(this, opts);
@@ -205,9 +194,7 @@
205
194
  };
206
195
 
207
196
  List.prototype.render = function(collection, opts) {
208
- if (opts == null) {
209
- opts = {};
210
- }
197
+ if (opts == null) opts = {};
211
198
  this.collection = collection;
212
199
  if (this.template || this.templates) {
213
200
  return this.renderTemplates(collection);
@@ -232,18 +219,16 @@
232
219
  };
233
220
 
234
221
  List.prototype.renderControllers = function(collection, opts) {
235
- var child, controllers, i, item, _i, _len;
222
+ var child, controllers, i, item, _len;
236
223
  controllers = this.controllers || {
237
224
  "default": this.controller
238
225
  };
239
226
  this.deactivateAndKillOrphans(this.children(), collection);
240
- for (i = _i = 0, _len = collection.length; _i < _len; i = ++_i) {
227
+ for (i = 0, _len = collection.length; i < _len; i++) {
241
228
  item = collection[i];
242
229
  child = this.getOrCreateChild(item, controllers[item.constructor.className] || controllers["default"], opts);
243
230
  child.listIndex = i;
244
- if (child.moveTo) {
245
- child.moveTo(i);
246
- }
231
+ if (child.moveTo) child.moveTo(i);
247
232
  child.activate();
248
233
  }
249
234
  return this.trigger('afterRender', this);
@@ -301,17 +286,11 @@
301
286
 
302
287
  })(Exo.Spine.Controller);
303
288
 
304
- if (typeof Exo !== "undefined" && Exo !== null) {
305
- Exo.Spine || (Exo.Spine = {});
306
- }
289
+ if (typeof Exo !== "undefined" && Exo !== null) Exo.Spine || (Exo.Spine = {});
307
290
 
308
- if (typeof Exo !== "undefined" && Exo !== null) {
309
- Exo.Spine.List = List;
310
- }
291
+ if (typeof Exo !== "undefined" && Exo !== null) Exo.Spine.List = List;
311
292
 
312
- if (typeof module !== "undefined" && module !== null) {
313
- module.exports = List;
314
- }
293
+ if (typeof module !== "undefined" && module !== null) module.exports = List;
315
294
 
316
295
  Spine = this.Spine || require('spine');
317
296
 
@@ -320,7 +299,7 @@
320
299
  __extends(Model, _super);
321
300
 
322
301
  function Model() {
323
- return Model.__super__.constructor.apply(this, arguments);
302
+ Model.__super__.constructor.apply(this, arguments);
324
303
  }
325
304
 
326
305
  Model.defaults = function(atts) {
@@ -336,12 +315,8 @@
336
315
 
337
316
  Model.create = function(atts, options) {
338
317
  var attribute, _i, _len, _ref;
339
- if (atts == null) {
340
- atts = {};
341
- }
342
- if (options == null) {
343
- options = {};
344
- }
318
+ if (atts == null) atts = {};
319
+ if (options == null) options = {};
345
320
  if (this.defaultValues) {
346
321
  _ref = this.attributes;
347
322
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -364,16 +339,50 @@
364
339
 
365
340
  })(Spine.Model);
366
341
 
342
+ if (typeof Exo !== "undefined" && Exo !== null) Exo.Spine || (Exo.Spine = {});
343
+
344
+ if (typeof Exo !== "undefined" && Exo !== null) Exo.Spine.Model = Model;
345
+
346
+ if (typeof module !== "undefined" && module !== null) module.exports = Model;
347
+
348
+ CSSTransitioner = {
349
+ cssTransitionEndEvents: 'transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd',
350
+ cssActiveClass: 'active',
351
+ cssTransitionDelay: 10,
352
+ doActivate: function() {
353
+ return this.cssStartTransition('addClass', this.onActivated);
354
+ },
355
+ doDeactivate: function() {
356
+ return this.cssStartTransition('removeClass', this.onDeactivated);
357
+ },
358
+ cssListen: function(callback) {
359
+ var _this = this;
360
+ return this.el.on(this.cssTransitionEndEvents, function() {
361
+ callback.call(_this);
362
+ return _this.el.off(_this.cssTransitionEndEvents);
363
+ });
364
+ },
365
+ cssStartTransition: function(mutatorFunc, callback) {
366
+ var _this = this;
367
+ this.cssListen(callback);
368
+ return this.delay(function() {
369
+ return _this.el[mutatorFunc].call(_this.el, _this.cssActiveClass);
370
+ }, this.cssTransitionDelay);
371
+ }
372
+ };
373
+
374
+ if (typeof Exo !== "undefined" && Exo !== null) Exo.Spine || (Exo.Spine = {});
375
+
367
376
  if (typeof Exo !== "undefined" && Exo !== null) {
368
- Exo.Spine || (Exo.Spine = {});
377
+ (_base = Exo.Spine).Modules || (_base.Modules = {});
369
378
  }
370
379
 
371
380
  if (typeof Exo !== "undefined" && Exo !== null) {
372
- Exo.Spine.Model = Model;
381
+ (_base2 = Exo.Spine.Modules).CSSTransitioner || (_base2.CSSTransitioner = CSSTransitioner);
373
382
  }
374
383
 
375
384
  if (typeof module !== "undefined" && module !== null) {
376
- module.exports = Model;
385
+ module.exports = CSSTransitioner;
377
386
  }
378
387
 
379
388
  }).call(this);
data/lib/exojs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ExoJS
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exojs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-27 00:00:00.000000000 Z
12
+ date: 2013-03-31 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Gives you easy access to the latest stable version of the Exo.js JavaScript
15
15
  library, for use in Middleman, Rails or other Sprockets capable applications.