ember-source 1.9.1 → 1.10.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-23 00:00:00.000000000 Z
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: handlebars-source
@@ -33,10 +33,10 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - VERSION
35
35
  - dist/ember-runtime.js
36
- - dist/ember-template-compiler.js
37
36
  - dist/ember-testing.js
38
37
  - dist/ember-tests.js
39
38
  - dist/ember-tests.prod.js
39
+ - dist/ember.debug.js
40
40
  - dist/ember.js
41
41
  - dist/ember.min.js
42
42
  - dist/ember.prod.js
@@ -57,9 +57,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - ">"
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: 1.3.1
63
63
  requirements: []
64
64
  rubyforge_project:
65
65
  rubygems_version: 2.2.0
@@ -1,295 +0,0 @@
1
- (function() {
2
- var Ember = { assert: function() {}, FEATURES: { isEnabled: function() {} } };
3
- /* global Handlebars:true */
4
-
5
- // Remove "use strict"; from transpiled module (in browser builds only) until
6
- // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
7
- //
8
- // REMOVE_USE_STRICT: true
9
-
10
- /**
11
- @module ember
12
- @submodule ember-handlebars-compiler
13
- */
14
-
15
-
16
-
17
- // ES6Todo: you'll need to import debugger once debugger is es6'd.
18
- if (typeof Ember.assert === 'undefined') { Ember.assert = function(){}; }
19
- if (typeof Ember.FEATURES === 'undefined') { Ember.FEATURES = { isEnabled: function(){} }; }
20
-
21
- var objectCreate = Object.create || function(parent) {
22
- function F() {}
23
- F.prototype = parent;
24
- return new F();
25
- };
26
-
27
- // set up for circular references later
28
- var View, Component;
29
-
30
- // ES6Todo: when ember-debug is es6'ed import this.
31
- // var emberAssert = Ember.assert;
32
- var Handlebars = (Ember.imports && Ember.imports.Handlebars) || (this && this.Handlebars);
33
- if (!Handlebars && typeof require === 'function') {
34
- Handlebars = require('handlebars');
35
- }
36
-
37
- Ember.assert("Ember Handlebars requires Handlebars version 2.0. Include " +
38
- "a SCRIPT tag in the HTML HEAD linking to the Handlebars file " +
39
- "before you link to Ember.", Handlebars);
40
-
41
- Ember.assert("Ember Handlebars requires Handlebars version 2.0. " +
42
- "Please see more details at http://emberjs.com/blog/2014/10/16/handlebars-update.html.",
43
- Handlebars.COMPILER_REVISION === 6);
44
-
45
- /**
46
- Prepares the Handlebars templating library for use inside Ember's view
47
- system.
48
-
49
- The `Ember.Handlebars` object is the standard Handlebars library, extended to
50
- use Ember's `get()` method instead of direct property access, which allows
51
- computed properties to be used inside templates.
52
-
53
- To create an `Ember.Handlebars` template, call `Ember.Handlebars.compile()`.
54
- This will return a function that can be used by `Ember.View` for rendering.
55
-
56
- @class Handlebars
57
- @namespace Ember
58
- */
59
- var EmberHandlebars = Ember.Handlebars = Handlebars.create();
60
-
61
- /**
62
- Register a bound helper or custom view helper.
63
-
64
- ## Simple bound helper example
65
-
66
- ```javascript
67
- Ember.Handlebars.helper('capitalize', function(value) {
68
- return value.toUpperCase();
69
- });
70
- ```
71
-
72
- The above bound helper can be used inside of templates as follows:
73
-
74
- ```handlebars
75
- {{capitalize name}}
76
- ```
77
-
78
- In this case, when the `name` property of the template's context changes,
79
- the rendered value of the helper will update to reflect this change.
80
-
81
- For more examples of bound helpers, see documentation for
82
- `Ember.Handlebars.registerBoundHelper`.
83
-
84
- ## Custom view helper example
85
-
86
- Assuming a view subclass named `App.CalendarView` were defined, a helper
87
- for rendering instances of this view could be registered as follows:
88
-
89
- ```javascript
90
- Ember.Handlebars.helper('calendar', App.CalendarView):
91
- ```
92
-
93
- The above bound helper can be used inside of templates as follows:
94
-
95
- ```handlebars
96
- {{calendar}}
97
- ```
98
-
99
- Which is functionally equivalent to:
100
-
101
- ```handlebars
102
- {{view 'calendar'}}
103
- ```
104
-
105
- Options in the helper will be passed to the view in exactly the same
106
- manner as with the `view` helper.
107
-
108
- @method helper
109
- @for Ember.Handlebars
110
- @param {String} name
111
- @param {Function|Ember.View} function or view class constructor
112
- @param {String} dependentKeys*
113
- */
114
- EmberHandlebars.helper = function(name, value) {
115
- if (!View) { View = requireModule('ember-views/views/view')['default']; } // ES6TODO: stupid circular dep
116
- if (!Component) { Component = requireModule('ember-views/views/component')['default']; } // ES6TODO: stupid circular dep
117
-
118
- Ember.assert("You tried to register a component named '" + name +
119
- "', but component names must include a '-'", !Component.detect(value) || name.match(/-/));
120
-
121
- if (View.detect(value)) {
122
- EmberHandlebars.registerHelper(name, EmberHandlebars.makeViewHelper(value));
123
- } else {
124
- EmberHandlebars.registerBoundHelper.apply(null, arguments);
125
- }
126
- };
127
-
128
- /**
129
- Returns a helper function that renders the provided ViewClass.
130
-
131
- Used internally by Ember.Handlebars.helper and other methods
132
- involving helper/component registration.
133
-
134
- @private
135
- @method makeViewHelper
136
- @for Ember.Handlebars
137
- @param {Function} ViewClass view class constructor
138
- @since 1.2.0
139
- */
140
- EmberHandlebars.makeViewHelper = function(ViewClass) {
141
- return function(options) {
142
- Ember.assert("You can only pass attributes (such as name=value) not bare " +
143
- "values to a helper for a View found in '" + ViewClass.toString() + "'", arguments.length < 2);
144
- return EmberHandlebars.helpers.view.call(this, ViewClass, options);
145
- };
146
- };
147
-
148
- /**
149
- @class helpers
150
- @namespace Ember.Handlebars
151
- */
152
- EmberHandlebars.helpers = objectCreate(Handlebars.helpers);
153
-
154
- /**
155
- Override the the opcode compiler and JavaScript compiler for Handlebars.
156
-
157
- @class Compiler
158
- @namespace Ember.Handlebars
159
- @private
160
- @constructor
161
- */
162
- EmberHandlebars.Compiler = function() {};
163
-
164
- // Handlebars.Compiler doesn't exist in runtime-only
165
- if (Handlebars.Compiler) {
166
- EmberHandlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype);
167
- }
168
-
169
- EmberHandlebars.Compiler.prototype.compiler = EmberHandlebars.Compiler;
170
-
171
- /**
172
- @class JavaScriptCompiler
173
- @namespace Ember.Handlebars
174
- @private
175
- @constructor
176
- */
177
- EmberHandlebars.JavaScriptCompiler = function() {};
178
-
179
- // Handlebars.JavaScriptCompiler doesn't exist in runtime-only
180
- if (Handlebars.JavaScriptCompiler) {
181
- EmberHandlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype);
182
- EmberHandlebars.JavaScriptCompiler.prototype.compiler = EmberHandlebars.JavaScriptCompiler;
183
- }
184
-
185
-
186
- EmberHandlebars.JavaScriptCompiler.prototype.namespace = "Ember.Handlebars";
187
-
188
- EmberHandlebars.JavaScriptCompiler.prototype.initializeBuffer = function() {
189
- return "''";
190
- };
191
-
192
- /**
193
- Override the default buffer for Ember Handlebars. By default, Handlebars
194
- creates an empty String at the beginning of each invocation and appends to
195
- it. Ember's Handlebars overrides this to append to a single shared buffer.
196
-
197
- @private
198
- @method appendToBuffer
199
- @param string {String}
200
- */
201
- EmberHandlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {
202
- return "data.buffer.push("+string+");";
203
- };
204
-
205
- /**
206
- Rewrite simple mustaches from `{{foo}}` to `{{bind "foo"}}`. This means that
207
- all simple mustaches in Ember's Handlebars will also set up an observer to
208
- keep the DOM up to date when the underlying property changes.
209
-
210
- @private
211
- @method mustache
212
- @for Ember.Handlebars.Compiler
213
- @param mustache
214
- */
215
- EmberHandlebars.Compiler.prototype.mustache = function(mustache) {
216
- if (!(mustache.params.length || mustache.hash)) {
217
- var id = new Handlebars.AST.IdNode([{ part: '_triageMustache' }]);
218
-
219
- // Update the mustache node to include a hash value indicating whether the original node
220
- // was escaped. This will allow us to properly escape values when the underlying value
221
- // changes and we need to re-render the value.
222
- if (!mustache.escaped) {
223
- mustache.hash = mustache.hash || new Handlebars.AST.HashNode([]);
224
- mustache.hash.pairs.push(["unescaped", new Handlebars.AST.StringNode("true")]);
225
- }
226
- mustache = new Handlebars.AST.MustacheNode([id].concat([mustache.id]), mustache.hash, !mustache.escaped);
227
- }
228
-
229
- return Handlebars.Compiler.prototype.mustache.call(this, mustache);
230
- };
231
-
232
- /**
233
- Used for precompilation of Ember Handlebars templates. This will not be used
234
- during normal app execution.
235
-
236
- @method precompile
237
- @for Ember.Handlebars
238
- @static
239
- @param {String|Object} value The template to precompile or an Handlebars AST
240
- @param {Boolean} asObject optional parameter, defaulting to true, of whether or not the
241
- compiled template should be returned as an Object or a String
242
- */
243
- EmberHandlebars.precompile = function(value, asObject) {
244
- var ast = Handlebars.parse(value);
245
-
246
- var options = {
247
- knownHelpers: {
248
- action: true,
249
- unbound: true,
250
- 'bind-attr': true,
251
- template: true,
252
- view: true,
253
- _triageMustache: true
254
- },
255
- data: true,
256
- stringParams: true
257
- };
258
-
259
- asObject = asObject === undefined ? true : asObject;
260
-
261
- var environment = new EmberHandlebars.Compiler().compile(ast, options);
262
- return new EmberHandlebars.JavaScriptCompiler().compile(environment, options, undefined, asObject);
263
- };
264
-
265
- // We don't support this for Handlebars runtime-only
266
- if (Handlebars.compile) {
267
- /**
268
- The entry point for Ember Handlebars. This replaces the default
269
- `Handlebars.compile` and turns on template-local data and String
270
- parameters.
271
-
272
- @method compile
273
- @for Ember.Handlebars
274
- @static
275
- @param {String} string The template to compile
276
- @return {Function}
277
- */
278
- EmberHandlebars.compile = function(string) {
279
- var ast = Handlebars.parse(string);
280
- var options = { data: true, stringParams: true };
281
- var environment = new EmberHandlebars.Compiler().compile(ast, options);
282
- var templateSpec = new EmberHandlebars.JavaScriptCompiler().compile(environment, options, undefined, true);
283
-
284
- var template = EmberHandlebars.template(templateSpec);
285
- template.isMethod = false; //Make sure we don't wrap templates with ._super
286
-
287
- return template;
288
- };
289
- }
290
-
291
-
292
-
293
- exports.precompile = EmberHandlebars.precompile;
294
- exports.EmberHandlebars = EmberHandlebars;
295
- })();