ember-source-machty 1.0.0.pre4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,195 @@
1
+ (function() {
2
+ var Ember = { assert: function() {} };
3
+ // Version: v1.0.0-pre.4-277-g2c0c237
4
+ // Last commit: 2c0c237 (2013-02-21 12:03:23 -0500)
5
+
6
+
7
+ (function() {
8
+ /**
9
+ @module ember
10
+ @submodule ember-handlebars
11
+ */
12
+
13
+ // Eliminate dependency on any Ember to simplify precompilation workflow
14
+ var objectCreate = Object.create || function(parent) {
15
+ function F() {}
16
+ F.prototype = parent;
17
+ return new F();
18
+ };
19
+
20
+ var Handlebars = this.Handlebars || (Ember.imports && Ember.imports.Handlebars);
21
+ if(!Handlebars && typeof require === 'function') {
22
+ Handlebars = require('handlebars');
23
+ }
24
+
25
+ Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater", Handlebars && Handlebars.VERSION.match(/^1\.0\.[0-9](\.rc\.[23456789]+)?/));
26
+
27
+ /**
28
+ Prepares the Handlebars templating library for use inside Ember's view
29
+ system.
30
+
31
+ The `Ember.Handlebars` object is the standard Handlebars library, extended to
32
+ use Ember's `get()` method instead of direct property access, which allows
33
+ computed properties to be used inside templates.
34
+
35
+ To create an `Ember.Handlebars` template, call `Ember.Handlebars.compile()`.
36
+ This will return a function that can be used by `Ember.View` for rendering.
37
+
38
+ @class Handlebars
39
+ @namespace Ember
40
+ */
41
+ Ember.Handlebars = objectCreate(Handlebars);
42
+
43
+ /**
44
+ @class helpers
45
+ @namespace Ember.Handlebars
46
+ */
47
+ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers);
48
+
49
+ /**
50
+ Override the the opcode compiler and JavaScript compiler for Handlebars.
51
+
52
+ @class Compiler
53
+ @namespace Ember.Handlebars
54
+ @private
55
+ @constructor
56
+ */
57
+ Ember.Handlebars.Compiler = function() {};
58
+
59
+ // Handlebars.Compiler doesn't exist in runtime-only
60
+ if (Handlebars.Compiler) {
61
+ Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
62
+ }
63
+
64
+ Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;
65
+
66
+ /**
67
+ @class JavaScriptCompiler
68
+ @namespace Ember.Handlebars
69
+ @private
70
+ @constructor
71
+ */
72
+ Ember.Handlebars.JavaScriptCompiler = function() {};
73
+
74
+ // Handlebars.JavaScriptCompiler doesn't exist in runtime-only
75
+ if (Handlebars.JavaScriptCompiler) {
76
+ Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
77
+ Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;
78
+ }
79
+
80
+
81
+ Ember.Handlebars.JavaScriptCompiler.prototype.namespace = "Ember.Handlebars";
82
+
83
+
84
+ Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {
85
+ return "''";
86
+ };
87
+
88
+ /**
89
+ @private
90
+
91
+ Override the default buffer for Ember Handlebars. By default, Handlebars
92
+ creates an empty String at the beginning of each invocation and appends to
93
+ it. Ember's Handlebars overrides this to append to a single shared buffer.
94
+
95
+ @method appendToBuffer
96
+ @param string {String}
97
+ */
98
+ Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {
99
+ return "data.buffer.push("+string+");";
100
+ };
101
+
102
+ var prefix = "ember" + (+new Date()), incr = 1;
103
+
104
+ /**
105
+ @private
106
+
107
+ Rewrite simple mustaches from `{{foo}}` to `{{bind "foo"}}`. This means that
108
+ all simple mustaches in Ember's Handlebars will also set up an observer to
109
+ keep the DOM up to date when the underlying property changes.
110
+
111
+ @method mustache
112
+ @for Ember.Handlebars.Compiler
113
+ @param mustache
114
+ */
115
+ Ember.Handlebars.Compiler.prototype.mustache = function(mustache) {
116
+ if (mustache.isHelper && mustache.id.string === 'control') {
117
+ mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);
118
+ mustache.hash.pairs.push(["controlID", new Handlebars.AST.StringNode(prefix + incr++)]);
119
+ } else if (mustache.params.length || mustache.hash) {
120
+ // no changes required
121
+ } else {
122
+ var id = new Handlebars.AST.IdNode(['_triageMustache']);
123
+
124
+ // Update the mustache node to include a hash value indicating whether the original node
125
+ // was escaped. This will allow us to properly escape values when the underlying value
126
+ // changes and we need to re-render the value.
127
+ if(!mustache.escaped) {
128
+ mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);
129
+ mustache.hash.pairs.push(["unescaped", new Handlebars.AST.StringNode("true")]);
130
+ }
131
+ mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);
132
+ }
133
+
134
+ return Handlebars.Compiler.prototype.mustache.call(this, mustache);
135
+ };
136
+
137
+ /**
138
+ Used for precompilation of Ember Handlebars templates. This will not be used
139
+ during normal app execution.
140
+
141
+ @method precompile
142
+ @for Ember.Handlebars
143
+ @static
144
+ @param {String} string The template to precompile
145
+ */
146
+ Ember.Handlebars.precompile = function(string) {
147
+ var ast = Handlebars.parse(string);
148
+
149
+ var options = {
150
+ knownHelpers: {
151
+ action: true,
152
+ unbound: true,
153
+ bindAttr: true,
154
+ template: true,
155
+ view: true,
156
+ _triageMustache: true
157
+ },
158
+ data: true,
159
+ stringParams: true
160
+ };
161
+
162
+ var environment = new Ember.Handlebars.Compiler().compile(ast, options);
163
+ return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
164
+ };
165
+
166
+ // We don't support this for Handlebars runtime-only
167
+ if (Handlebars.compile) {
168
+ /**
169
+ The entry point for Ember Handlebars. This replaces the default
170
+ `Handlebars.compile` and turns on template-local data and String
171
+ parameters.
172
+
173
+ @method compile
174
+ @for Ember.Handlebars
175
+ @static
176
+ @param {String} string The template to compile
177
+ @return {Function}
178
+ */
179
+ Ember.Handlebars.compile = function(string) {
180
+ var ast = Handlebars.parse(string);
181
+ var options = { data: true, stringParams: true };
182
+ var environment = new Ember.Handlebars.Compiler().compile(ast, options);
183
+ var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
184
+
185
+ return Ember.Handlebars.template(templateSpec);
186
+ };
187
+ }
188
+
189
+
190
+ })();
191
+
192
+
193
+ exports.precompile = Ember.Handlebars.precompile;
194
+ exports.EmberHandlebars = Ember.Handlebars;
195
+ })();
@@ -0,0 +1,15 @@
1
+ // ==========================================================================
2
+ // Project: Ember - JavaScript Application Framework
3
+ // Copyright: ©2011-2013 Tilde Inc. and contributors
4
+ // Portions ©2006-2011 Strobe Inc.
5
+ // Portions ©2008-2011 Apple Inc. All rights reserved.
6
+ // License: Licensed under MIT license
7
+ // See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
+ // ==========================================================================
9
+
10
+
11
+ // Version: v1.0.0-pre.4-277-g2c0c237
12
+ // Last commit: 2c0c237 (2013-02-21 12:03:23 -0500)
13
+
14
+
15
+ (function(){var e=Object.create||function(e){function t(){}return t.prototype=e,new t},t=this.Handlebars||Ember.imports&&Ember.imports.Handlebars;!t&&typeof require=="function"&&(t=require("handlebars")),Ember.Handlebars=e(t),Ember.Handlebars.helpers=e(t.helpers),Ember.Handlebars.Compiler=function(){},t.Compiler&&(Ember.Handlebars.Compiler.prototype=e(t.Compiler.prototype)),Ember.Handlebars.Compiler.prototype.compiler=Ember.Handlebars.Compiler,Ember.Handlebars.JavaScriptCompiler=function(){},t.JavaScriptCompiler&&(Ember.Handlebars.JavaScriptCompiler.prototype=e(t.JavaScriptCompiler.prototype),Ember.Handlebars.JavaScriptCompiler.prototype.compiler=Ember.Handlebars.JavaScriptCompiler),Ember.Handlebars.JavaScriptCompiler.prototype.namespace="Ember.Handlebars",Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer=function(){return"''"},Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer=function(e){return"data.buffer.push("+e+");"};var n="ember"+ +(new Date),r=1;Ember.Handlebars.Compiler.prototype.mustache=function(e){if(e.isHelper&&e.id.string==="control")e.hash=e.hash||new t.AST.HashNode([]),e.hash.pairs.push(["controlID",new t.AST.StringNode(n+r++)]);else if(!e.params.length&&!e.hash){var i=new t.AST.IdNode(["_triageMustache"]);e.escaped||(e.hash=e.hash||new t.AST.HashNode([]),e.hash.pairs.push(["unescaped",new t.AST.StringNode("true")])),e=new t.AST.MustacheNode([i].concat([e.id]),e.hash,!e.escaped)}return t.Compiler.prototype.mustache.call(this,e)},Ember.Handlebars.precompile=function(e){var n=t.parse(e),r={knownHelpers:{action:!0,unbound:!0,bindAttr:!0,template:!0,view:!0,_triageMustache:!0},data:!0,stringParams:!0},i=(new Ember.Handlebars.Compiler).compile(n,r);return(new Ember.Handlebars.JavaScriptCompiler).compile(i,r,undefined,!0)},t.compile&&(Ember.Handlebars.compile=function(e){var n=t.parse(e),r={data:!0,stringParams:!0},i=(new Ember.Handlebars.Compiler).compile(n,r),s=(new Ember.Handlebars.JavaScriptCompiler).compile(i,r,undefined,!0);return Ember.Handlebars.template(s)})})(),typeof location!="undefined"&&(location.hostname==="localhost"||location.hostname==="127.0.0.1")&&console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. If you want full error messages please use the non-minified build provided on the Ember website.");
@@ -0,0 +1,190 @@
1
+ (function() {
2
+ /**
3
+ @module ember
4
+ @submodule ember-handlebars
5
+ */
6
+
7
+ // Eliminate dependency on any Ember to simplify precompilation workflow
8
+ var objectCreate = Object.create || function(parent) {
9
+ function F() {}
10
+ F.prototype = parent;
11
+ return new F();
12
+ };
13
+
14
+ var Handlebars = this.Handlebars || (Ember.imports && Ember.imports.Handlebars);
15
+ if(!Handlebars && typeof require === 'function') {
16
+ Handlebars = require('handlebars');
17
+ }
18
+
19
+
20
+ /**
21
+ Prepares the Handlebars templating library for use inside Ember's view
22
+ system.
23
+
24
+ The `Ember.Handlebars` object is the standard Handlebars library, extended to
25
+ use Ember's `get()` method instead of direct property access, which allows
26
+ computed properties to be used inside templates.
27
+
28
+ To create an `Ember.Handlebars` template, call `Ember.Handlebars.compile()`.
29
+ This will return a function that can be used by `Ember.View` for rendering.
30
+
31
+ @class Handlebars
32
+ @namespace Ember
33
+ */
34
+ Ember.Handlebars = objectCreate(Handlebars);
35
+
36
+ /**
37
+ @class helpers
38
+ @namespace Ember.Handlebars
39
+ */
40
+ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers);
41
+
42
+ /**
43
+ Override the the opcode compiler and JavaScript compiler for Handlebars.
44
+
45
+ @class Compiler
46
+ @namespace Ember.Handlebars
47
+ @private
48
+ @constructor
49
+ */
50
+ Ember.Handlebars.Compiler = function() {};
51
+
52
+ // Handlebars.Compiler doesn't exist in runtime-only
53
+ if (Handlebars.Compiler) {
54
+ Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
55
+ }
56
+
57
+ Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler;
58
+
59
+ /**
60
+ @class JavaScriptCompiler
61
+ @namespace Ember.Handlebars
62
+ @private
63
+ @constructor
64
+ */
65
+ Ember.Handlebars.JavaScriptCompiler = function() {};
66
+
67
+ // Handlebars.JavaScriptCompiler doesn't exist in runtime-only
68
+ if (Handlebars.JavaScriptCompiler) {
69
+ Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
70
+ Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler;
71
+ }
72
+
73
+
74
+ Ember.Handlebars.JavaScriptCompiler.prototype.namespace = "Ember.Handlebars";
75
+
76
+
77
+ Ember.Handlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {
78
+ return "''";
79
+ };
80
+
81
+ /**
82
+ @private
83
+
84
+ Override the default buffer for Ember Handlebars. By default, Handlebars
85
+ creates an empty String at the beginning of each invocation and appends to
86
+ it. Ember's Handlebars overrides this to append to a single shared buffer.
87
+
88
+ @method appendToBuffer
89
+ @param string {String}
90
+ */
91
+ Ember.Handlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {
92
+ return "data.buffer.push("+string+");";
93
+ };
94
+
95
+ var prefix = "ember" + (+new Date()), incr = 1;
96
+
97
+ /**
98
+ @private
99
+
100
+ Rewrite simple mustaches from `{{foo}}` to `{{bind "foo"}}`. This means that
101
+ all simple mustaches in Ember's Handlebars will also set up an observer to
102
+ keep the DOM up to date when the underlying property changes.
103
+
104
+ @method mustache
105
+ @for Ember.Handlebars.Compiler
106
+ @param mustache
107
+ */
108
+ Ember.Handlebars.Compiler.prototype.mustache = function(mustache) {
109
+ if (mustache.isHelper && mustache.id.string === 'control') {
110
+ mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);
111
+ mustache.hash.pairs.push(["controlID", new Handlebars.AST.StringNode(prefix + incr++)]);
112
+ } else if (mustache.params.length || mustache.hash) {
113
+ // no changes required
114
+ } else {
115
+ var id = new Handlebars.AST.IdNode(['_triageMustache']);
116
+
117
+ // Update the mustache node to include a hash value indicating whether the original node
118
+ // was escaped. This will allow us to properly escape values when the underlying value
119
+ // changes and we need to re-render the value.
120
+ if(!mustache.escaped) {
121
+ mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);
122
+ mustache.hash.pairs.push(["unescaped", new Handlebars.AST.StringNode("true")]);
123
+ }
124
+ mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);
125
+ }
126
+
127
+ return Handlebars.Compiler.prototype.mustache.call(this, mustache);
128
+ };
129
+
130
+ /**
131
+ Used for precompilation of Ember Handlebars templates. This will not be used
132
+ during normal app execution.
133
+
134
+ @method precompile
135
+ @for Ember.Handlebars
136
+ @static
137
+ @param {String} string The template to precompile
138
+ */
139
+ Ember.Handlebars.precompile = function(string) {
140
+ var ast = Handlebars.parse(string);
141
+
142
+ var options = {
143
+ knownHelpers: {
144
+ action: true,
145
+ unbound: true,
146
+ bindAttr: true,
147
+ template: true,
148
+ view: true,
149
+ _triageMustache: true
150
+ },
151
+ data: true,
152
+ stringParams: true
153
+ };
154
+
155
+ var environment = new Ember.Handlebars.Compiler().compile(ast, options);
156
+ return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
157
+ };
158
+
159
+ // We don't support this for Handlebars runtime-only
160
+ if (Handlebars.compile) {
161
+ /**
162
+ The entry point for Ember Handlebars. This replaces the default
163
+ `Handlebars.compile` and turns on template-local data and String
164
+ parameters.
165
+
166
+ @method compile
167
+ @for Ember.Handlebars
168
+ @static
169
+ @param {String} string The template to compile
170
+ @return {Function}
171
+ */
172
+ Ember.Handlebars.compile = function(string) {
173
+ var ast = Handlebars.parse(string);
174
+ var options = { data: true, stringParams: true };
175
+ var environment = new Ember.Handlebars.Compiler().compile(ast, options);
176
+ var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
177
+
178
+ return Ember.Handlebars.template(templateSpec);
179
+ };
180
+ }
181
+
182
+
183
+ })();
184
+
185
+
186
+
187
+ if (typeof location !== 'undefined' && (location.hostname === 'localhost' || location.hostname === '127.0.0.1')) {
188
+ console.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. "+
189
+ "If you want full error messages please use the non-minified build provided on the Ember website.");
190
+ }