rasputin 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,6 +9,7 @@ It provide direct requires for official sproutcore packages :
9
9
  * sproutcore-datastore
10
10
  * sproutcore-statechart
11
11
  * sproutcore-touch
12
+ * sproutcore-routing
12
13
 
13
14
  And it also provides one unnoficial package :
14
15
 
@@ -36,6 +37,17 @@ If you do not want this behavior you can tourn it off in your rails configuratio
36
37
 
37
38
  config.rasputin.precompile_handlebars = false
38
39
 
40
+ If you use Slim templates, you can use handlebars filter :
41
+
42
+ handlebars:
43
+ {{view SC.Button}}OK{{/view}}
44
+
45
+ It will be translated as :
46
+
47
+ <script type="text/x-handlebars">
48
+ {{view SC.Button}}OK{{/view}}
49
+ </script>
50
+
39
51
  Install
40
52
  -------
41
53
 
@@ -45,6 +57,7 @@ In Gemfile:
45
57
 
46
58
  In your javascript asset manifest (app/assets/javascripts/application.js) add the following:
47
59
 
60
+ //= require jquery
48
61
  //= require sproutcore
49
62
 
50
63
  And any of the following you want to include:
@@ -52,6 +65,7 @@ And any of the following you want to include:
52
65
  //= require sproutcore-datastore
53
66
  //= require sproutcore-statechart
54
67
  //= require sproutcore-touch
68
+ //= require sproutcore-routing
55
69
  //= require sproutcore-i18n
56
70
 
57
71
  In your stylesheet asset manifest (app/assets/stylesheets/application.css) add the following:
@@ -63,6 +77,11 @@ In your stylesheet asset manifest (app/assets/stylesheets/application.css) add t
63
77
  ChangeLog
64
78
  ----------
65
79
 
80
+ 0.10.0
81
+
82
+ * add sproutcore-routing
83
+ * update sproutcore to master (with metamorph)
84
+
66
85
  0.9.1
67
86
 
68
87
  * you can change templates naming scheme in your configuration
@@ -1539,6 +1539,11 @@ Handlebars.VM = {
1539
1539
 
1540
1540
  Handlebars.template = Handlebars.VM.template;
1541
1541
 
1542
+ /*
1543
+ @SlexAxton
1544
+ https://github.com/SlexAxton/sc-handlebars
1545
+ */
1546
+
1542
1547
  var SC = { Handlebars : {} };
1543
1548
  this.SC = SC;
1544
1549
 
@@ -1,3 +1,3 @@
1
1
  module Rasputin
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -0,0 +1,432 @@
1
+ (function() {
2
+ // Vector and Matrix mathematics modules for JavaScript
3
+ // Copyright (c) 2007 James Coglan
4
+ //
5
+ // Permission is hereby granted, free of charge, to any person obtaining
6
+ // a copy of this software and associated documentation files (the "Software"),
7
+ // to deal in the Software without restriction, including without limitation
8
+ // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
+ // and/or sell copies of the Software, and to permit persons to whom the
10
+ // Software is furnished to do so, subject to the following conditions:
11
+ //
12
+ // The above copyright notice and this permission notice shall be included
13
+ // in all copies or substantial portions of the Software.
14
+ //
15
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
+ // DEALINGS IN THE SOFTWARE.
22
+
23
+ var Sylvester = {
24
+ version: '0.1.3',
25
+ precision: 1e-6
26
+ };
27
+
28
+ function Matrix() {}
29
+ Matrix.prototype = {
30
+
31
+ // Returns element (i,j) of the matrix
32
+ e: function(i,j) {
33
+ if (i < 1 || i > this.elements.length || j < 1 || j > this.elements[0].length) { return null; }
34
+ return this.elements[i-1][j-1];
35
+ },
36
+
37
+ // Maps the matrix to another matrix (of the same dimensions) according to the given function
38
+ map: function(fn) {
39
+ var els = [], ni = this.elements.length, ki = ni, i, nj, kj = this.elements[0].length, j;
40
+ do { i = ki - ni;
41
+ nj = kj;
42
+ els[i] = [];
43
+ do { j = kj - nj;
44
+ els[i][j] = fn(this.elements[i][j], i + 1, j + 1);
45
+ } while (--nj);
46
+ } while (--ni);
47
+ return Matrix.create(els);
48
+ },
49
+
50
+ // Returns the result of multiplying the matrix from the right by the argument.
51
+ // If the argument is a scalar then just multiply all the elements. If the argument is
52
+ // a vector, a vector is returned, which saves you having to remember calling
53
+ // col(1) on the result.
54
+ multiply: function(matrix) {
55
+ if (!matrix.elements) {
56
+ return this.map(function(x) { return x * matrix; });
57
+ }
58
+ var returnVector = matrix.modulus ? true : false;
59
+ var M = matrix.elements || matrix;
60
+ if (typeof(M[0][0]) == 'undefined') { M = Matrix.create(M).elements; }
61
+ if (!this.canMultiplyFromLeft(M)) { return null; }
62
+ var ni = this.elements.length, ki = ni, i, nj, kj = M[0].length, j;
63
+ var cols = this.elements[0].length, elements = [], sum, nc, c;
64
+ do { i = ki - ni;
65
+ elements[i] = [];
66
+ nj = kj;
67
+ do { j = kj - nj;
68
+ sum = 0;
69
+ nc = cols;
70
+ do { c = cols - nc;
71
+ sum += this.elements[i][c] * M[c][j];
72
+ } while (--nc);
73
+ elements[i][j] = sum;
74
+ } while (--nj);
75
+ } while (--ni);
76
+ var M = Matrix.create(elements);
77
+ return returnVector ? M.col(1) : M;
78
+ },
79
+
80
+ x: function(matrix) { return this.multiply(matrix); },
81
+
82
+ // Returns true iff the matrix can multiply the argument from the left
83
+ canMultiplyFromLeft: function(matrix) {
84
+ var M = matrix.elements || matrix;
85
+ if (typeof(M[0][0]) == 'undefined') { M = Matrix.create(M).elements; }
86
+ // this.columns should equal matrix.rows
87
+ return (this.elements[0].length == M.length);
88
+ },
89
+
90
+ // Set the matrix's elements from an array. If the argument passed
91
+ // is a vector, the resulting matrix will be a single column.
92
+ setElements: function(els) {
93
+ var i, elements = els.elements || els;
94
+ if (typeof(elements[0][0]) != 'undefined') {
95
+ var ni = elements.length, ki = ni, nj, kj, j;
96
+ this.elements = [];
97
+ do { i = ki - ni;
98
+ nj = elements[i].length; kj = nj;
99
+ this.elements[i] = [];
100
+ do { j = kj - nj;
101
+ this.elements[i][j] = elements[i][j];
102
+ } while (--nj);
103
+ } while(--ni);
104
+ return this;
105
+ }
106
+ var n = elements.length, k = n;
107
+ this.elements = [];
108
+ do { i = k - n;
109
+ this.elements.push([elements[i]]);
110
+ } while (--n);
111
+ return this;
112
+ }
113
+ };
114
+
115
+ // Constructor function
116
+ Matrix.create = function(elements) {
117
+ var M = new Matrix();
118
+ return M.setElements(elements);
119
+ };
120
+
121
+ // Utility functions
122
+ $M = Matrix.create;
123
+
124
+ })();
125
+
126
+ // ==========================================================================
127
+ // Project: TransformJS
128
+ // Copyright: ©2011 Strobe Inc.
129
+ // License: Licensed under MIT license (see license.js)
130
+ // ==========================================================================
131
+
132
+ (function($) {
133
+
134
+ if ( !$.cssHooks ) {
135
+ throw("jQuery 1.4.3+ is needed for this plugin to work");
136
+ return;
137
+ }
138
+
139
+ var translationUnit = ''
140
+
141
+ var prop = "transform",
142
+ vendorProp, supportedProp, supports3d, supports2d, supportsFilter,
143
+
144
+ // capitalize first character of the prop to test vendor prefix
145
+ capProp = prop.charAt(0).toUpperCase() + prop.slice(1),
146
+ prefixes = [ "Moz", "Webkit", "O", "ms" ],
147
+ div = document.createElement( "div" );
148
+
149
+ if ( prop in div.style ) {
150
+
151
+ // browser supports standard CSS property name
152
+ supportedProp = prop;
153
+ supports3d = div.style.perspective !== undefined;
154
+ }
155
+ else {
156
+
157
+ // otherwise test support for vendor-prefixed property names
158
+ for ( var i = 0; i < prefixes.length; i++ ) {
159
+ vendorProp = prefixes[i] + capProp;
160
+
161
+ if ( vendorProp in div.style ) {
162
+ supportedProp = vendorProp;
163
+ if (prefixes[i] === 'Moz') {
164
+ translationUnit = 'px'
165
+ }
166
+ if((prefixes[i] + 'Perspective') in div.style) {
167
+ supports3d = true;
168
+ }
169
+ else {
170
+ supports2d = true;
171
+ }
172
+ break;
173
+ }
174
+ }
175
+ }
176
+
177
+ if (!supportedProp) {
178
+ supportsFilter = ('filter' in div.style);
179
+ supportedProp = 'filter';
180
+ }
181
+
182
+ // console.log('supportedProp: '+supportedProp+', 2d: '+supports2d+', 3d: '+supports3d+', filter: '+supportsFilter);
183
+
184
+ // avoid memory leak in IE
185
+ div = null;
186
+
187
+ // add property to $.support so it can be accessed elsewhere
188
+ $.support[ prop ] = supportedProp;
189
+
190
+ var transformProperty = supportedProp;
191
+
192
+ var properties = {
193
+ rotateX: {
194
+ defaultValue: 0,
195
+ matrix: function(a) {
196
+ if (supports3d) {
197
+ return $M([
198
+ [1,0,0,0],
199
+ [0,Math.cos(a), Math.sin(-a), 0],
200
+ [0,Math.sin(a), Math.cos( a), 0],
201
+ [0,0,0,1]
202
+ ]);
203
+ }
204
+ else {
205
+ return $M([
206
+ [1, 0,0],
207
+ [0, 1,0],
208
+ [0,0,1]
209
+ ]);
210
+ }
211
+ }
212
+ },
213
+ rotateY: {
214
+ defaultValue: 0,
215
+ matrix: function(b) {
216
+ if (supports3d) {
217
+ return $M([
218
+ [Math.cos( b), 0, Math.sin(b),0],
219
+ [0,1,0,0],
220
+ [Math.sin(-b), 0, Math.cos(b), 0],
221
+ [0,0,0,1]
222
+ ]);
223
+ }
224
+ else {
225
+ return $M([
226
+ [1, 0,0],
227
+ [0, 1,0],
228
+ [0,0,1]
229
+ ]);
230
+ }
231
+ }
232
+ },
233
+ rotateZ: {
234
+ defaultValue: 0,
235
+ matrix: function(c) {
236
+ if (supports3d) {
237
+ return $M([
238
+ [Math.cos(c), Math.sin(-c), 0, 0],
239
+ [Math.sin(c), Math.cos( c), 0, 0],
240
+ [0,0,1,0],
241
+ [0,0,0,1]
242
+ ]);
243
+ }
244
+ else {
245
+ return $M([
246
+ [Math.cos(c), Math.sin(-c),0],
247
+ [Math.sin(c), Math.cos( c),0],
248
+ [0,0,1]
249
+ ]);
250
+ }
251
+ }
252
+ },
253
+ scale: {
254
+ defaultValue: 1,
255
+ matrix: function(s) {
256
+ if (supports3d) {
257
+ return $M([
258
+ [s,0,0,0],
259
+ [0,s,0,0],
260
+ [0,0,s,0],
261
+ [0,0,0,1]
262
+ ]);
263
+ }
264
+ else {
265
+ return $M([
266
+ [s, 0,0],
267
+ [0, s,0],
268
+ [0,0,1]
269
+ ]);
270
+ }
271
+ }
272
+ },
273
+ translateX: {
274
+ defaultValue: 0,
275
+ matrix: function(tx) {
276
+ if (supports3d) {
277
+ return $M([
278
+ [1,0,0,0],
279
+ [0,1,0,0],
280
+ [0,0,1,0],
281
+ [tx,0,0,1]
282
+ ]);
283
+ }
284
+ else {
285
+ return $M([
286
+ [1, 0,0],
287
+ [0, 1,0],
288
+ [tx,0,1]
289
+ ]);
290
+ }
291
+ }
292
+ },
293
+ translateY: {
294
+ defaultValue: 0,
295
+ matrix: function(ty) {
296
+ if (supports3d) {
297
+ return $M([
298
+ [1,0,0,0],
299
+ [0,1,0,0],
300
+ [0,0,1,0],
301
+ [0,ty,0,1]
302
+ ]);
303
+ }
304
+ else {
305
+ return $M([
306
+ [1, 0,0],
307
+ [0, 1,0],
308
+ [0,ty,1]
309
+ ]);
310
+ }
311
+ }
312
+ },
313
+ translateZ: {
314
+ defaultValue: 0,
315
+ matrix: function(tz) {
316
+ if (supports3d) {
317
+ return $M([
318
+ [1,0,0,0],
319
+ [0,1,0,0],
320
+ [0,0,1,0],
321
+ [0,0,tz,1]
322
+ ]);
323
+ }
324
+ else {
325
+ return $M([
326
+ [1, 0,0],
327
+ [0, 1,0],
328
+ [0,0,1]
329
+ ]);
330
+ }
331
+ }
332
+ }
333
+ };
334
+
335
+ var applyMatrix = function(elem) {
336
+ var transforms = $(elem).data('transforms');
337
+ var tM;
338
+
339
+ if (supports3d) {
340
+ tM = $M([
341
+ [1,0,0,0],
342
+ [0,1,0,0],
343
+ [0,0,1,0],
344
+ [0,0,0,1]
345
+ ]);
346
+ }
347
+ else {
348
+ tM = $M([
349
+ [1,0,0],
350
+ [0,1,0],
351
+ [0,0,1]
352
+ ]);
353
+ }
354
+
355
+ for (var name in properties) {
356
+ tM = tM.x(properties[name].matrix(transforms[name] || properties[name].defaultValue))
357
+ }
358
+
359
+ if (supports3d) {
360
+ s = "matrix3d(";
361
+ s += tM.e(1,1).toFixed(10) + "," + tM.e(1,2).toFixed(10) + "," + tM.e(1,3).toFixed(10) + "," + tM.e(1,4).toFixed(10) + ",";
362
+ s += tM.e(2,1).toFixed(10) + "," + tM.e(2,2).toFixed(10) + "," + tM.e(2,3).toFixed(10) + "," + tM.e(2,4).toFixed(10) + ",";
363
+ s += tM.e(3,1).toFixed(10) + "," + tM.e(3,2).toFixed(10) + "," + tM.e(3,3).toFixed(10) + "," + tM.e(3,4).toFixed(10) + ",";
364
+ s += tM.e(4,1).toFixed(10) + "," + tM.e(4,2).toFixed(10) + "," + tM.e(4,3).toFixed(10) + "," + tM.e(4,4).toFixed(10);
365
+ s += ")";
366
+ }
367
+ else if (supports2d) {
368
+ s = "matrix(";
369
+ s += tM.e(1,1).toFixed(10) + "," + tM.e(1,2).toFixed(10) + ",";
370
+ s += tM.e(2,1).toFixed(10) + "," + tM.e(2,2).toFixed(10) + ",";
371
+ s += tM.e(3,1).toFixed(10) + translationUnit + "," + tM.e(3,2).toFixed(10) + translationUnit;
372
+ s += ")";
373
+ }
374
+ else if (supportsFilter) {
375
+ s = "progid:DXImageTransform.Microsoft.";
376
+ s += "Matrix(";
377
+ s += "M11="+tM.e(1,1).toFixed(10) + ",";
378
+ s += "M12="+tM.e(1,2).toFixed(10) + ",";
379
+ s += "M21="+tM.e(2,1).toFixed(10) + ",";
380
+ s += "M22="+tM.e(2,2).toFixed(10) + ",";
381
+ s += "SizingMethod='auto expand'";
382
+ s += ")";
383
+
384
+ elem.style.top = tM.e(3,1);
385
+ elem.style.left = tM.e(3,2);
386
+ }
387
+
388
+ elem.style[transformProperty] = s;
389
+ }
390
+
391
+ var hookFor = function(name) {
392
+
393
+ $.fx.step[name] = function(fx){
394
+ $.cssHooks[name].set( fx.elem, fx.now + fx.unit );
395
+ };
396
+
397
+ return {
398
+ get: function( elem, computed, extra ) {
399
+ var transforms = $(elem).data('transforms');
400
+ if (transforms === undefined) {
401
+ transforms = {};
402
+ $(elem).data('transforms',transforms);
403
+ }
404
+
405
+ return transforms[name] || properties[name].defaultValue;
406
+ },
407
+ set: function( elem, value) {
408
+ var transforms = $(elem).data('transforms');
409
+ if (transforms === undefined) transforms = {};
410
+ var propInfo = properties[name];
411
+
412
+ if (typeof propInfo.apply === 'function') {
413
+ transforms[name] = propInfo.apply(transforms[name] || propInfo.defaultValue, value);
414
+ } else {
415
+ transforms[name] = value
416
+ }
417
+
418
+ $(elem).data('transforms',transforms);
419
+
420
+ applyMatrix(elem);
421
+ }
422
+ }
423
+ }
424
+
425
+ if (transformProperty) {
426
+ for (var name in properties) {
427
+ $.cssHooks[name] = hookFor(name);
428
+ $.cssNumber[name] = true;
429
+ }
430
+ }
431
+
432
+ })(jQuery);