ember-source 3.28.5 → 4.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -10
- package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +3 -3
- package/blueprints/helper-test/index.js +4 -22
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +1 -13
- package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +0 -13
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -12
- package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -13
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -14
- package/blueprints/initializer/files/__root__/initializers/__name__.js +0 -1
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -1
- package/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/manager.js +19 -98
- package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
- package/dist/dependencies/@glimmer/runtime.js +1 -55
- package/dist/dependencies/@glimmer/validator.js +19 -51
- package/dist/ember-template-compiler.js +3692 -5667
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +12 -560
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +4357 -12470
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/bootstrap/index.js +2 -55
- package/dist/packages/@ember/-internals/container/index.js +35 -206
- package/dist/packages/@ember/-internals/environment/index.js +3 -46
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +1 -2
- package/dist/packages/@ember/-internals/glimmer/index.js +4774 -7035
- package/dist/packages/@ember/-internals/meta/lib/meta.js +2 -50
- package/dist/packages/@ember/-internals/metal/index.js +785 -1109
- package/dist/packages/@ember/-internals/overrides/index.js +1 -3
- package/dist/packages/@ember/-internals/owner/index.js +1 -19
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +1 -51
- package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -0
- package/dist/packages/@ember/-internals/routing/lib/location/history_location.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +0 -7
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +34 -2
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -3
- package/dist/packages/@ember/-internals/routing/lib/system/dsl.js +5 -6
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +192 -652
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +119 -248
- package/dist/packages/@ember/-internals/routing/lib/system/router_state.js +1 -2
- package/dist/packages/@ember/-internals/routing/lib/utils.js +1 -2
- package/dist/packages/@ember/-internals/runtime/index.js +1 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +4 -175
- package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +1 -18
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
- package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +10 -141
- package/dist/packages/@ember/-internals/utils/index.js +3 -59
- package/dist/packages/@ember/-internals/views/index.js +0 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -121
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -40
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +115 -190
- package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/pre_render.js +1 -2
- package/dist/packages/@ember/application/instance.js +3 -25
- package/dist/packages/@ember/application/lib/application.js +14 -32
- package/dist/packages/@ember/canary-features/index.js +5 -6
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/component/template-only.js +2 -0
- package/dist/packages/@ember/debug/lib/deprecate.js +7 -41
- package/dist/packages/@ember/deprecated-features/index.js +1 -14
- package/dist/packages/@ember/engine/index.js +3 -17
- package/dist/packages/@ember/engine/instance.js +0 -4
- package/dist/packages/@ember/helper/index.js +12 -4
- package/dist/packages/@ember/object/index.js +3 -101
- package/dist/packages/@ember/object/internals.js +0 -1
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +12 -384
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +9 -360
- package/dist/packages/@ember/polyfills/index.js +1 -6
- package/dist/packages/@ember/polyfills/lib/assign.js +12 -28
- package/dist/packages/@ember/routing/index.js +1 -1
- package/dist/packages/@ember/runloop/index.js +1 -83
- package/dist/packages/@ember/string/index.js +1 -206
- package/dist/packages/@ember/utils/index.js +0 -1
- package/dist/packages/ember/index.js +17 -180
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/index.js +0 -2
- package/dist/packages/ember-testing/lib/helpers.js +0 -12
- package/dist/packages/ember-testing/lib/setup_for_testing.js +0 -10
- package/docs/data.json +1637 -3659
- package/lib/index.js +14 -59
- package/lib/overrides.js +0 -61
- package/lib/transforms/inject-babel-helpers.js +1 -3
- package/package.json +27 -23
- package/dist/packages/@ember/-internals/console/index.js +0 -190
- package/dist/packages/@ember/-internals/runtime/lib/copy.js +0 -119
- package/dist/packages/@ember/-internals/runtime/lib/ext/function.js +0 -155
- package/dist/packages/@ember/-internals/runtime/lib/mixins/copyable.js +0 -31
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -357
- package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
- package/dist/packages/@ember/-internals/views/lib/system/jquery_event_deprecation.js +0 -60
- package/dist/packages/@ember/application/deprecations.js +0 -25
- package/dist/packages/@ember/application/globals-resolver.js +0 -434
- package/dist/packages/@ember/application/resolver.js +0 -1
- package/dist/packages/@ember/component/checkbox.js +0 -17
- package/dist/packages/@ember/component/text-area.js +0 -17
- package/dist/packages/@ember/component/text-field.js +0 -17
- package/dist/packages/@ember/polyfills/lib/merge.js +0 -50
- package/dist/packages/@ember/routing/link-component.js +0 -17
- package/dist/packages/ember-testing/lib/events.js +0 -102
- package/dist/packages/ember-testing/lib/helpers/-is-form-control.js +0 -19
- package/dist/packages/ember-testing/lib/helpers/click.js +0 -32
- package/dist/packages/ember-testing/lib/helpers/fill_in.js +0 -47
- package/dist/packages/ember-testing/lib/helpers/find.js +0 -40
- package/dist/packages/ember-testing/lib/helpers/find_with_assert.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/key_event.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/trigger_event.js +0 -61
- package/dist/packages/ember-testing/lib/support.js +0 -57
- package/dist/packages/jquery/index.js +0 -2
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ENV } from '@ember/-internals/environment';
|
|
2
|
-
import { assign } from '@ember/polyfills';
|
|
3
2
|
/**
|
|
4
3
|
Set `EmberENV.FEATURES` in your application's `config/environment.js` file
|
|
5
4
|
to enable canary features in your application.
|
|
@@ -17,9 +16,9 @@ export const DEFAULT_FEATURES = {
|
|
|
17
16
|
EMBER_NAMED_BLOCKS: true,
|
|
18
17
|
EMBER_GLIMMER_HELPER_MANAGER: true,
|
|
19
18
|
EMBER_GLIMMER_INVOKE_HELPER: true,
|
|
20
|
-
EMBER_MODERNIZED_BUILT_IN_COMPONENTS: true,
|
|
21
19
|
EMBER_STRICT_MODE: true,
|
|
22
|
-
EMBER_DYNAMIC_HELPERS_AND_MODIFIERS: true
|
|
20
|
+
EMBER_DYNAMIC_HELPERS_AND_MODIFIERS: true,
|
|
21
|
+
EMBER_ROUTING_ROUTER_SERVICE_REFRESH: false
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
24
|
The hash of enabled Canary features. Add to this, any canary features
|
|
@@ -31,7 +30,7 @@ export const DEFAULT_FEATURES = {
|
|
|
31
30
|
@public
|
|
32
31
|
*/
|
|
33
32
|
|
|
34
|
-
export const FEATURES = assign(DEFAULT_FEATURES, ENV.FEATURES);
|
|
33
|
+
export const FEATURES = Object.assign(DEFAULT_FEATURES, ENV.FEATURES);
|
|
35
34
|
/**
|
|
36
35
|
Determine whether the specified `feature` is enabled. Used by Ember's
|
|
37
36
|
build tools to exclude experimental features from beta/stable builds.
|
|
@@ -73,6 +72,6 @@ export const EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROV
|
|
|
73
72
|
export const EMBER_NAMED_BLOCKS = featureValue(FEATURES.EMBER_NAMED_BLOCKS);
|
|
74
73
|
export const EMBER_GLIMMER_HELPER_MANAGER = featureValue(FEATURES.EMBER_GLIMMER_HELPER_MANAGER);
|
|
75
74
|
export const EMBER_GLIMMER_INVOKE_HELPER = featureValue(FEATURES.EMBER_GLIMMER_INVOKE_HELPER);
|
|
76
|
-
export const EMBER_MODERNIZED_BUILT_IN_COMPONENTS = featureValue(FEATURES.EMBER_MODERNIZED_BUILT_IN_COMPONENTS);
|
|
77
75
|
export const EMBER_STRICT_MODE = featureValue(FEATURES.EMBER_STRICT_MODE);
|
|
78
|
-
export const EMBER_DYNAMIC_HELPERS_AND_MODIFIERS = featureValue(FEATURES.EMBER_DYNAMIC_HELPERS_AND_MODIFIERS);
|
|
76
|
+
export const EMBER_DYNAMIC_HELPERS_AND_MODIFIERS = featureValue(FEATURES.EMBER_DYNAMIC_HELPERS_AND_MODIFIERS);
|
|
77
|
+
export const EMBER_ROUTING_ROUTER_SERVICE_REFRESH = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE_REFRESH);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { setComponentTemplate, getComponentTemplate } from '@glimmer/manager';
|
|
2
|
-
export { Component as default, Input } from '@ember/-internals/glimmer';
|
|
2
|
+
export { Component as default, Input, Textarea } from '@ember/-internals/glimmer';
|
|
3
3
|
export { componentCapabilities as capabilities, setComponentManager } from '@ember/-internals/glimmer';
|
|
@@ -23,8 +23,10 @@
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
@public
|
|
26
|
+
@static
|
|
26
27
|
@method templateOnly
|
|
27
28
|
@param {String} moduleName the module name that the template only component represents, this will be used for debugging purposes
|
|
29
|
+
@for @ember/component/template-only
|
|
28
30
|
@category EMBER_GLIMMER_SET_COMPONENT_TEMPLATE
|
|
29
31
|
*/
|
|
30
32
|
export { templateOnlyComponent as default } from '@glimmer/runtime';
|
|
@@ -50,17 +50,11 @@ let registerHandler = () => {};
|
|
|
50
50
|
|
|
51
51
|
let missingOptionsDeprecation;
|
|
52
52
|
let missingOptionsIdDeprecation;
|
|
53
|
-
let missingOptionsUntilDeprecation;
|
|
54
53
|
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
let missingOptionsSinceDeprecation = () => '';
|
|
54
|
+
let missingOptionDeprecation = () => '';
|
|
58
55
|
|
|
59
56
|
let deprecate = () => {};
|
|
60
57
|
|
|
61
|
-
let FOR_MISSING_DEPRECATIONS = new Set();
|
|
62
|
-
let SINCE_MISSING_DEPRECATIONS = new Set();
|
|
63
|
-
|
|
64
58
|
if (DEBUG) {
|
|
65
59
|
registerHandler = function registerHandler(handler) {
|
|
66
60
|
genericRegisterHandler('deprecate', handler);
|
|
@@ -133,14 +127,9 @@ if (DEBUG) {
|
|
|
133
127
|
});
|
|
134
128
|
missingOptionsDeprecation = 'When calling `deprecate` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include `id` and `until` properties.';
|
|
135
129
|
missingOptionsIdDeprecation = 'When calling `deprecate` you must provide `id` in options.';
|
|
136
|
-
missingOptionsUntilDeprecation = 'When calling `deprecate` you must provide `until` in options.';
|
|
137
130
|
|
|
138
|
-
|
|
139
|
-
return `When calling \`deprecate\` you must provide \`
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
missingOptionsSinceDeprecation = id => {
|
|
143
|
-
return `When calling \`deprecate\` you must provide \`since\` in options. Missing options.since in "${id}" deprecation`;
|
|
131
|
+
missingOptionDeprecation = (id, missingOption) => {
|
|
132
|
+
return `When calling \`deprecate\` you must provide \`${missingOption}\` in options. Missing options.${missingOption} in "${id}" deprecation`;
|
|
144
133
|
};
|
|
145
134
|
/**
|
|
146
135
|
@module @ember/debug
|
|
@@ -176,35 +165,12 @@ if (DEBUG) {
|
|
|
176
165
|
deprecate = function deprecate(message, test, options) {
|
|
177
166
|
assert(missingOptionsDeprecation, Boolean(options && (options.id || options.until)));
|
|
178
167
|
assert(missingOptionsIdDeprecation, Boolean(options.id));
|
|
179
|
-
assert(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
FOR_MISSING_DEPRECATIONS.add(options.id);
|
|
183
|
-
deprecate(missingOptionsForDeprecation(options.id), Boolean(options.for), {
|
|
184
|
-
id: 'ember-source.deprecation-without-for',
|
|
185
|
-
until: '4.0.0',
|
|
186
|
-
for: 'ember-source',
|
|
187
|
-
since: {
|
|
188
|
-
enabled: '3.24.0'
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (!options.since && !SINCE_MISSING_DEPRECATIONS.has(options.id)) {
|
|
194
|
-
SINCE_MISSING_DEPRECATIONS.add(options.id);
|
|
195
|
-
deprecate(missingOptionsSinceDeprecation(options.id), Boolean(options.since), {
|
|
196
|
-
id: 'ember-source.deprecation-without-since',
|
|
197
|
-
until: '4.0.0',
|
|
198
|
-
for: 'ember-source',
|
|
199
|
-
since: {
|
|
200
|
-
enabled: '3.24.0'
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
168
|
+
assert(missingOptionDeprecation(options.id, 'until'), Boolean(options.until));
|
|
169
|
+
assert(missingOptionDeprecation(options.id, 'for'), Boolean(options.for));
|
|
170
|
+
assert(missingOptionDeprecation(options.id, 'since'), Boolean(options.since));
|
|
205
171
|
invoke('deprecate', message, test, options);
|
|
206
172
|
};
|
|
207
173
|
}
|
|
208
174
|
|
|
209
175
|
export default deprecate;
|
|
210
|
-
export { registerHandler, missingOptionsDeprecation, missingOptionsIdDeprecation,
|
|
176
|
+
export { registerHandler, missingOptionsDeprecation, missingOptionsIdDeprecation, missingOptionDeprecation };
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
/* eslint-disable no-implicit-coercion */
|
|
2
2
|
// These versions should be the version that the deprecation was _introduced_,
|
|
3
3
|
// not the version that the feature will be removed.
|
|
4
|
-
export const
|
|
5
|
-
export const EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5';
|
|
6
|
-
export const LOGGER = !!'3.2.0-beta.1';
|
|
7
|
-
export const MERGE = !!'3.6.0-beta.1';
|
|
8
|
-
export const ROUTER_EVENTS = !!'4.0.0';
|
|
9
|
-
export const COMPONENT_MANAGER_STRING_LOOKUP = !!'3.8.0';
|
|
10
|
-
export const JQUERY_INTEGRATION = !!'3.9.0';
|
|
11
|
-
export const ALIAS_METHOD = !!'3.9.0';
|
|
12
|
-
export const APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1';
|
|
13
|
-
export const FUNCTION_PROTOTYPE_EXTENSIONS = !!'3.11.0-beta.1';
|
|
14
|
-
export const MOUSE_ENTER_LEAVE_MOVE_EVENTS = !!'3.13.0-beta.1';
|
|
15
|
-
export const EMBER_COMPONENT_IS_VISIBLE = !!'3.15.0-beta.1';
|
|
16
|
-
export const PARTIALS = !!'3.15.0-beta.1';
|
|
17
|
-
export const GLOBALS_RESOLVER = !!'3.16.0-beta.1';
|
|
4
|
+
export const ASSIGN = !!'4.0.0-beta.1';
|
|
@@ -6,7 +6,6 @@ import { Registry } from '@ember/-internals/container';
|
|
|
6
6
|
import DAG from 'dag-map';
|
|
7
7
|
import { assert } from '@ember/debug';
|
|
8
8
|
import { get, set } from '@ember/-internals/metal';
|
|
9
|
-
import DefaultResolver from '@ember/application/globals-resolver';
|
|
10
9
|
import EngineInstance from '@ember/engine/instance';
|
|
11
10
|
import { RoutingService } from '@ember/-internals/routing';
|
|
12
11
|
import { ContainerDebugAdapter } from '@ember/-internals/extension-support';
|
|
@@ -293,7 +292,6 @@ Engine.reopenClass({
|
|
|
293
292
|
and after.
|
|
294
293
|
Example instanceInitializer to preload data into the store.
|
|
295
294
|
```app/initializer/preload-data.js
|
|
296
|
-
import $ from 'jquery';
|
|
297
295
|
export function initialize(application) {
|
|
298
296
|
var userConfig, userConfigEncoded, store;
|
|
299
297
|
// We have a HTML escaped JSON representation of the user's basic
|
|
@@ -304,7 +302,7 @@ Engine.reopenClass({
|
|
|
304
302
|
// like all local models and data can be manipulated by the user, so it
|
|
305
303
|
// should not be relied upon for security or authorization.
|
|
306
304
|
// Grab the encoded data from the meta tag
|
|
307
|
-
userConfigEncoded =
|
|
305
|
+
userConfigEncoded = document.querySelector('head meta[name=app-user-config]').attr('content');
|
|
308
306
|
// Unescape the text, then parse the resulting JSON into a real object
|
|
309
307
|
userConfig = JSON.parse(unescape(userConfigEncoded));
|
|
310
308
|
// Lookup the store
|
|
@@ -358,14 +356,6 @@ Engine.reopenClass({
|
|
|
358
356
|
return registry;
|
|
359
357
|
},
|
|
360
358
|
|
|
361
|
-
/**
|
|
362
|
-
Set this to provide an alternate class to `DefaultResolver`
|
|
363
|
-
@deprecated Use 'Resolver' instead
|
|
364
|
-
@property resolver
|
|
365
|
-
@public
|
|
366
|
-
*/
|
|
367
|
-
resolver: null,
|
|
368
|
-
|
|
369
359
|
/**
|
|
370
360
|
Set this to provide an alternate class to `DefaultResolver`
|
|
371
361
|
@property resolver
|
|
@@ -391,7 +381,7 @@ Engine.reopenClass({
|
|
|
391
381
|
*/
|
|
392
382
|
|
|
393
383
|
function resolverFor(namespace) {
|
|
394
|
-
let ResolverClass = get(namespace, 'Resolver')
|
|
384
|
+
let ResolverClass = get(namespace, 'Resolver');
|
|
395
385
|
let props = {
|
|
396
386
|
namespace
|
|
397
387
|
};
|
|
@@ -426,17 +416,13 @@ function commonSetupRegistry(registry) {
|
|
|
426
416
|
});
|
|
427
417
|
registry.register('controller:basic', Controller, {
|
|
428
418
|
instantiate: false
|
|
429
|
-
});
|
|
430
|
-
registry.injection('renderer', '_viewRegistry', '-view-registry:main');
|
|
431
|
-
registry.injection('view:-outlet', 'namespace', 'application:main'); // Register the routing service...
|
|
419
|
+
}); // Register the routing service...
|
|
432
420
|
|
|
433
421
|
registry.register('service:-routing', RoutingService); // DEBUGGING
|
|
434
422
|
|
|
435
423
|
registry.register('resolver-for-debugging:main', registry.resolver, {
|
|
436
424
|
instantiate: false
|
|
437
425
|
});
|
|
438
|
-
registry.injection('container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main'); // Custom resolver authors may want to register their own ContainerDebugAdapter with this key
|
|
439
|
-
|
|
440
426
|
registry.register('container-debug-adapter:main', ContainerDebugAdapter);
|
|
441
427
|
registry.register('component-lookup:main', ComponentLookup);
|
|
442
428
|
}
|
|
@@ -156,8 +156,6 @@ const EngineInstance = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixi
|
|
|
156
156
|
singletons.forEach(key => this.register(key, parent.lookup(key), {
|
|
157
157
|
instantiate: false
|
|
158
158
|
}));
|
|
159
|
-
this.inject('view', '_environment', '-environment:main');
|
|
160
|
-
this.inject('route', '_environment', '-environment:main');
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
});
|
|
@@ -173,8 +171,6 @@ EngineInstance.reopenClass({
|
|
|
173
171
|
if (!options) {
|
|
174
172
|
return;
|
|
175
173
|
}
|
|
176
|
-
|
|
177
|
-
registry.injection('view', '_environment', '-environment:main');
|
|
178
174
|
}
|
|
179
175
|
|
|
180
176
|
});
|
|
@@ -252,28 +252,36 @@
|
|
|
252
252
|
The `invokeHelper` function can be used to create a helper instance in
|
|
253
253
|
JavaScript.
|
|
254
254
|
|
|
255
|
+
To access a helper's value you have to use `getValue` from
|
|
256
|
+
`@glimmer/tracking/primitives/cache`.
|
|
257
|
+
|
|
255
258
|
```js
|
|
256
259
|
// app/components/data-loader.js
|
|
257
260
|
import Component from '@glimmer/component';
|
|
261
|
+
import { getValue } from '@glimmer/tracking/primitives/cache';
|
|
258
262
|
import Helper from '@ember/component/helper';
|
|
259
263
|
import { invokeHelper } from '@ember/helper';
|
|
260
264
|
|
|
261
265
|
class PlusOne extends Helper {
|
|
262
|
-
compute([
|
|
266
|
+
compute([number]) {
|
|
263
267
|
return number + 1;
|
|
264
268
|
}
|
|
265
269
|
}
|
|
266
270
|
|
|
267
|
-
export default class
|
|
268
|
-
plusOne = invokeHelper(this,
|
|
271
|
+
export default class PlusOneComponent extends Component {
|
|
272
|
+
plusOne = invokeHelper(this, PlusOne, () => {
|
|
269
273
|
return {
|
|
270
274
|
positional: [this.args.number],
|
|
271
275
|
};
|
|
272
276
|
});
|
|
277
|
+
|
|
278
|
+
get value() {
|
|
279
|
+
return getValue(this.plusOne);
|
|
280
|
+
}
|
|
273
281
|
}
|
|
274
282
|
```
|
|
275
283
|
```hbs
|
|
276
|
-
{{this.
|
|
284
|
+
{{this.value}}
|
|
277
285
|
```
|
|
278
286
|
|
|
279
287
|
It receives three arguments:
|
|
@@ -1,104 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { assert, deprecate } from '@ember/debug';
|
|
3
|
-
import { assign } from '@ember/polyfills';
|
|
1
|
+
import { assert } from '@ember/debug';
|
|
4
2
|
import { isElementDescriptor, setClassicDecorator } from '@ember/-internals/metal';
|
|
5
|
-
import { onComputedDotAccess } from '@ember/-internals/overrides';
|
|
6
3
|
export { Object as default } from '@ember/-internals/runtime';
|
|
7
|
-
export { notifyPropertyChange, defineProperty, get, set, getProperties, setProperties,
|
|
8
|
-
import { computed } from '@ember/-internals/metal';
|
|
9
|
-
import { alias, and, bool, collect, deprecatingAlias, empty, equal, filterBy, filter, gte, gt, intersect, lte, lt, mapBy, map, match, max, min, none, notEmpty, not, oneWay, or, readOnly, setDiff, sort, sum, union, uniqBy, uniq } from '@ember/object/computed'; // eslint-disable-next-line no-undef
|
|
10
|
-
|
|
11
|
-
if (DEBUG) {
|
|
12
|
-
let defaultHandler = (dotKey, importKey, module) => {
|
|
13
|
-
return `Using \`${dotKey}\` has been deprecated. Instead, import the value directly from ${module}:\n\n import { ${importKey} } from '${module}';`;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
let handler = onComputedDotAccess || defaultHandler;
|
|
17
|
-
|
|
18
|
-
let defineDeprecatedComputedFunc = (key, func) => {
|
|
19
|
-
Object.defineProperty(computed, key, {
|
|
20
|
-
get() {
|
|
21
|
-
let message = handler(`computed.${key}`, key, '@ember/object/computed');
|
|
22
|
-
deprecate(message, message === null, {
|
|
23
|
-
id: 'deprecated-run-loop-and-computed-dot-access',
|
|
24
|
-
until: '4.0.0',
|
|
25
|
-
for: 'ember-source',
|
|
26
|
-
since: {
|
|
27
|
-
enabled: '3.27.0'
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return func;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
defineDeprecatedComputedFunc('alias', alias);
|
|
37
|
-
defineDeprecatedComputedFunc('and', and);
|
|
38
|
-
defineDeprecatedComputedFunc('bool', bool);
|
|
39
|
-
defineDeprecatedComputedFunc('collect', collect);
|
|
40
|
-
defineDeprecatedComputedFunc('deprecatingAlias', deprecatingAlias);
|
|
41
|
-
defineDeprecatedComputedFunc('empty', empty);
|
|
42
|
-
defineDeprecatedComputedFunc('equal', equal);
|
|
43
|
-
defineDeprecatedComputedFunc('filterBy', filterBy);
|
|
44
|
-
defineDeprecatedComputedFunc('filter', filter);
|
|
45
|
-
defineDeprecatedComputedFunc('gte', gte);
|
|
46
|
-
defineDeprecatedComputedFunc('gt', gt);
|
|
47
|
-
defineDeprecatedComputedFunc('intersect', intersect);
|
|
48
|
-
defineDeprecatedComputedFunc('lte', lte);
|
|
49
|
-
defineDeprecatedComputedFunc('lt', lt);
|
|
50
|
-
defineDeprecatedComputedFunc('mapBy', mapBy);
|
|
51
|
-
defineDeprecatedComputedFunc('map', map);
|
|
52
|
-
defineDeprecatedComputedFunc('match', match);
|
|
53
|
-
defineDeprecatedComputedFunc('max', max);
|
|
54
|
-
defineDeprecatedComputedFunc('min', min);
|
|
55
|
-
defineDeprecatedComputedFunc('none', none);
|
|
56
|
-
defineDeprecatedComputedFunc('notEmpty', notEmpty);
|
|
57
|
-
defineDeprecatedComputedFunc('not', not);
|
|
58
|
-
defineDeprecatedComputedFunc('oneWay', oneWay);
|
|
59
|
-
defineDeprecatedComputedFunc('reads', oneWay);
|
|
60
|
-
defineDeprecatedComputedFunc('or', or);
|
|
61
|
-
defineDeprecatedComputedFunc('readOnly', readOnly);
|
|
62
|
-
defineDeprecatedComputedFunc('setDiff', setDiff);
|
|
63
|
-
defineDeprecatedComputedFunc('sort', sort);
|
|
64
|
-
defineDeprecatedComputedFunc('sum', sum);
|
|
65
|
-
defineDeprecatedComputedFunc('union', union);
|
|
66
|
-
defineDeprecatedComputedFunc('uniqBy', uniqBy);
|
|
67
|
-
defineDeprecatedComputedFunc('uniq', uniq);
|
|
68
|
-
} else {
|
|
69
|
-
computed.alias = alias;
|
|
70
|
-
computed.and = and;
|
|
71
|
-
computed.bool = bool;
|
|
72
|
-
computed.collect = collect;
|
|
73
|
-
computed.deprecatingAlias = deprecatingAlias;
|
|
74
|
-
computed.empty = empty;
|
|
75
|
-
computed.equal = equal;
|
|
76
|
-
computed.filterBy = filterBy;
|
|
77
|
-
computed.filter = filter;
|
|
78
|
-
computed.gte = gte;
|
|
79
|
-
computed.gt = gt;
|
|
80
|
-
computed.intersect = intersect;
|
|
81
|
-
computed.lte = lte;
|
|
82
|
-
computed.lt = lt;
|
|
83
|
-
computed.mapBy = mapBy;
|
|
84
|
-
computed.map = map;
|
|
85
|
-
computed.match = match;
|
|
86
|
-
computed.max = max;
|
|
87
|
-
computed.min = min;
|
|
88
|
-
computed.none = none;
|
|
89
|
-
computed.notEmpty = notEmpty;
|
|
90
|
-
computed.not = not;
|
|
91
|
-
computed.oneWay = oneWay;
|
|
92
|
-
computed.reads = oneWay;
|
|
93
|
-
computed.or = or;
|
|
94
|
-
computed.readOnly = readOnly;
|
|
95
|
-
computed.setDiff = setDiff;
|
|
96
|
-
computed.sort = sort;
|
|
97
|
-
computed.sum = sum;
|
|
98
|
-
computed.union = union;
|
|
99
|
-
computed.uniqBy = uniqBy;
|
|
100
|
-
computed.uniq = uniq;
|
|
101
|
-
}
|
|
4
|
+
export { notifyPropertyChange, defineProperty, get, set, getProperties, setProperties, observer, computed, trySet } from '@ember/-internals/metal';
|
|
102
5
|
/**
|
|
103
6
|
Decorator that turns the target function into an Action which can be accessed
|
|
104
7
|
directly by reference.
|
|
@@ -212,7 +115,6 @@ if (DEBUG) {
|
|
|
212
115
|
@return {PropertyDecorator} property decorator instance
|
|
213
116
|
*/
|
|
214
117
|
|
|
215
|
-
|
|
216
118
|
const BINDINGS_MAP = new WeakMap();
|
|
217
119
|
|
|
218
120
|
function setupAction(target, key, actionFn) {
|
|
@@ -223,7 +125,7 @@ function setupAction(target, key, actionFn) {
|
|
|
223
125
|
if (!Object.prototype.hasOwnProperty.call(target, 'actions')) {
|
|
224
126
|
let parentActions = target.actions; // we need to assign because of the way mixins copy actions down when inheriting
|
|
225
127
|
|
|
226
|
-
target.actions = parentActions ? assign({}, parentActions) : {};
|
|
128
|
+
target.actions = parentActions ? Object.assign({}, parentActions) : {};
|
|
227
129
|
}
|
|
228
130
|
|
|
229
131
|
target.actions[key] = actionFn;
|