ember-source 4.5.0-beta.1 → 4.6.0-alpha.3
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/blueprints-js/-addon-import.js +48 -0
- package/blueprints-js/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +24 -0
- package/blueprints-js/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
- package/blueprints-js/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +12 -0
- package/blueprints-js/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +13 -0
- package/blueprints-js/component/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/component/files/__root__/__templatepath__/__templatename__.hbs +1 -0
- package/blueprints-js/component-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/component-class/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/component-class-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +34 -0
- package/blueprints-js/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +36 -0
- package/blueprints-js/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +38 -0
- package/blueprints-js/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +31 -0
- package/blueprints-js/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +36 -0
- package/blueprints-js/controller/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
- package/blueprints-js/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
- package/blueprints-js/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
- package/blueprints-js/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/helper/files/__root__/__collection__/__name__.js +5 -0
- package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +7 -0
- package/blueprints-js/helper-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +26 -0
- package/blueprints-js/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +28 -0
- package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +18 -0
- package/blueprints-js/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +15 -0
- package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +17 -0
- package/blueprints-js/initializer/files/__root__/initializers/__name__.js +5 -0
- package/blueprints-js/initializer-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +28 -0
- package/blueprints-js/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +31 -0
- package/blueprints-js/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +25 -0
- package/blueprints-js/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +37 -0
- package/blueprints-js/instance-initializer/files/__root__/instance-initializers/__name__.js +5 -0
- package/blueprints-js/instance-initializer-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +30 -0
- package/blueprints-js/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +32 -0
- package/blueprints-js/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +26 -0
- package/blueprints-js/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +39 -0
- package/blueprints-js/mixin/files/__root__/mixins/__name__.js +3 -0
- package/blueprints-js/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +13 -0
- package/blueprints-js/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +13 -0
- package/blueprints-js/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +12 -0
- package/blueprints-js/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +12 -0
- package/blueprints-js/route/files/__root__/__path__/__name__.js +9 -0
- package/blueprints-js/route/files/__root__/__templatepath__/__templatename__.hbs +2 -0
- package/blueprints-js/route-addon/files/__root__/__path__/__name__.js +1 -0
- package/blueprints-js/route-addon/files/__root__/__templatepath__/__templatename__.js +1 -0
- package/blueprints-js/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +15 -0
- package/blueprints-js/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +17 -0
- package/blueprints-js/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +11 -0
- package/blueprints-js/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +11 -0
- package/blueprints-js/service/files/__root__/__path__/__name__.js +3 -0
- package/blueprints-js/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +16 -0
- package/blueprints-js/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +18 -0
- package/blueprints-js/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +13 -0
- package/blueprints-js/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +12 -0
- package/blueprints-js/template/files/__root__/__path__/__name__.hbs +0 -0
- package/blueprints-js/test-framework-detector.js +60 -0
- package/blueprints-js/util/files/__root__/utils/__name__.js +3 -0
- package/blueprints-js/util-test/mocha-files/__root__/__testType__/__name__-test.js +11 -0
- package/blueprints-js/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +11 -0
- package/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js +10 -0
- package/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +10 -0
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +4 -4
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +112 -136
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +584 -944
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/error-handling/index.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +21 -11
- package/dist/packages/@ember/-internals/metal/index.js +16 -9
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -4
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -3
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +281 -368
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -5
- package/dist/packages/@ember/application/lib/application.js +4 -1
- package/dist/packages/@ember/canary-features/index.js +2 -2
- package/dist/packages/@ember/controller/lib/controller_mixin.js +8 -18
- package/dist/packages/@ember/engine/index.js +3 -1
- package/dist/packages/@ember/object/index.js +16 -8
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +6 -4
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +74 -365
- package/dist/packages/@ember/test/adapter.js +2 -2
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/adapter.js +11 -27
- package/dist/packages/ember-testing/lib/adapters/qunit.js +8 -16
- package/dist/packages/ember-testing/lib/ext/application.js +28 -19
- package/dist/packages/ember-testing/lib/helpers/and_then.js +4 -1
- package/dist/packages/ember-testing/lib/helpers/current_path.js +5 -0
- package/dist/packages/ember-testing/lib/helpers/current_route_name.js +5 -0
- package/dist/packages/ember-testing/lib/helpers/current_url.js +8 -1
- package/dist/packages/ember-testing/lib/helpers/visit.js +12 -2
- package/dist/packages/ember-testing/lib/helpers/wait.js +6 -1
- package/dist/packages/ember-testing/lib/initializers.js +3 -3
- package/dist/packages/ember-testing/lib/test/adapter.js +2 -1
- package/dist/packages/ember-testing/lib/test/helpers.js +3 -1
- package/dist/packages/ember-testing/lib/test/on_inject_helpers.js +2 -2
- package/dist/packages/ember-testing/lib/test/promise.js +8 -8
- package/dist/packages/ember-testing/lib/test/waiters.js +14 -45
- package/dist/packages/ember-testing/lib/test.js +1 -1
- package/docs/data.json +745 -729
- package/package.json +7 -6
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { get, objectAt, alias, PROPERTY_DID_CHANGE, addArrayObserver, removeArrayObserver, replace, arrayContentDidChange, arrayContentWillChange, tagForProperty } from '@ember/-internals/metal';
|
|
5
5
|
import { isObject } from '@ember/-internals/utils';
|
|
6
6
|
import EmberObject from './object';
|
|
7
|
-
import {
|
|
7
|
+
import EmberArray, { MutableArray } from '../mixins/array';
|
|
8
8
|
import { assert } from '@ember/debug';
|
|
9
9
|
import { setCustomTagFor } from '@glimmer/manager';
|
|
10
10
|
import { combine, consumeTag, validateTag, valueForTag, tagFor } from '@glimmer/validator';
|
|
@@ -122,7 +122,7 @@ class ArrayProxy extends EmberObject {
|
|
|
122
122
|
@method replaceContent
|
|
123
123
|
@param {Number} idx The starting index
|
|
124
124
|
@param {Number} amt The number of items to remove from the content.
|
|
125
|
-
@param {
|
|
125
|
+
@param {Array} objects Optional array of objects to insert.
|
|
126
126
|
@return {void}
|
|
127
127
|
@public
|
|
128
128
|
*/
|
|
@@ -130,9 +130,9 @@ class ArrayProxy extends EmberObject {
|
|
|
130
130
|
|
|
131
131
|
replaceContent(idx, amt, objects) {
|
|
132
132
|
let content = get(this, 'content');
|
|
133
|
-
assert('[BUG] Called
|
|
133
|
+
assert('[BUG] Called replaceContent without content', content);
|
|
134
134
|
assert('Mutating a non-mutable array is not allowed', isMutable(content));
|
|
135
|
-
|
|
135
|
+
replace(content, idx, amt, objects);
|
|
136
136
|
} // Overriding objectAt is not supported.
|
|
137
137
|
|
|
138
138
|
|
|
@@ -221,7 +221,10 @@ class ArrayProxy extends EmberObject {
|
|
|
221
221
|
if (arrangedContent && !arrangedContent.isDestroyed) {
|
|
222
222
|
// @ts-expect-error This check is still good for ensuring correctness
|
|
223
223
|
assert("Can't set ArrayProxy's content to itself", arrangedContent !== this);
|
|
224
|
-
assert(`ArrayProxy expects
|
|
224
|
+
assert(`ArrayProxy expects a native Array, EmberArray, or ArrayProxy, but you passed ${typeof arrangedContent}`, function (arr) {
|
|
225
|
+
return Array.isArray(arr) || EmberArray.detect(arr);
|
|
226
|
+
}(arrangedContent));
|
|
227
|
+
assert('ArrayProxy expected its contents to not be destroyed', !arrangedContent.isDestroyed);
|
|
225
228
|
addArrayObserver(arrangedContent, this, ARRAY_OBSERVER_MAPPING);
|
|
226
229
|
this._arrangedContent = arrangedContent;
|
|
227
230
|
}
|
|
@@ -13,7 +13,7 @@ import { RSVP } from '@ember/-internals/runtime';
|
|
|
13
13
|
import { EventDispatcher } from '@ember/-internals/views';
|
|
14
14
|
import { Route, Router, HashLocation, HistoryLocation, AutoLocation, NoneLocation, BucketCache } from '@ember/-internals/routing';
|
|
15
15
|
import ApplicationInstance from '../instance';
|
|
16
|
-
import Engine from '@ember/engine';
|
|
16
|
+
import Engine, { buildInitializerMethod } from '@ember/engine';
|
|
17
17
|
import { privatize as P } from '@ember/-internals/container';
|
|
18
18
|
import { setupApplicationRegistry } from '@ember/-internals/glimmer';
|
|
19
19
|
import { RouterService } from '@ember/-internals/routing';
|
|
@@ -841,6 +841,9 @@ class Application extends Engine {
|
|
|
841
841
|
|
|
842
842
|
}
|
|
843
843
|
|
|
844
|
+
Application.initializer = buildInitializerMethod('initializers', 'initializer');
|
|
845
|
+
Application.instanceInitializer = buildInitializerMethod('instanceInitializers', 'instance initializer');
|
|
846
|
+
|
|
844
847
|
function commonSetupRegistry(registry) {
|
|
845
848
|
registry.register('router:main', Router);
|
|
846
849
|
registry.register('-view-registry:main', {
|
|
@@ -11,8 +11,8 @@ import { ENV } from '@ember/-internals/environment';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
export const DEFAULT_FEATURES = {
|
|
14
|
-
EMBER_LIBRARIES_ISREGISTERED:
|
|
15
|
-
EMBER_IMPROVED_INSTRUMENTATION:
|
|
14
|
+
EMBER_LIBRARIES_ISREGISTERED: null,
|
|
15
|
+
EMBER_IMPROVED_INSTRUMENTATION: null,
|
|
16
16
|
EMBER_UNIQUE_ID_HELPER: true,
|
|
17
17
|
EMBER_DEFAULT_HELPER_MANAGER: true
|
|
18
18
|
};
|
|
@@ -2,31 +2,20 @@ import { Mixin, computed } from '@ember/-internals/metal';
|
|
|
2
2
|
import { ActionHandler } from '@ember/-internals/runtime';
|
|
3
3
|
import { symbol } from '@ember/-internals/utils';
|
|
4
4
|
const MODEL = symbol('MODEL');
|
|
5
|
-
|
|
6
|
-
@module ember
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
@class ControllerMixin
|
|
11
|
-
@namespace Ember
|
|
12
|
-
@uses Ember.ActionHandler
|
|
13
|
-
@private
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export default Mixin.create(ActionHandler, {
|
|
5
|
+
const ControllerMixin = Mixin.create(ActionHandler, {
|
|
17
6
|
/* ducktype as a controller */
|
|
18
7
|
isController: true,
|
|
19
8
|
|
|
20
9
|
/**
|
|
21
10
|
The object to which actions from the view should be sent.
|
|
22
|
-
|
|
11
|
+
For example, when a Handlebars template uses the `{{action}}` helper,
|
|
23
12
|
it will attempt to send the action to the view's controller's `target`.
|
|
24
|
-
|
|
13
|
+
By default, the value of the target property is set to the router, and
|
|
25
14
|
is injected when a controller is instantiated. This injection is applied
|
|
26
15
|
as part of the application's initialization process. In most cases the
|
|
27
16
|
`target` property will automatically be set to the logical consumer of
|
|
28
17
|
actions for the controller.
|
|
29
|
-
|
|
18
|
+
@property target
|
|
30
19
|
@default null
|
|
31
20
|
@public
|
|
32
21
|
*/
|
|
@@ -36,7 +25,7 @@ export default Mixin.create(ActionHandler, {
|
|
|
36
25
|
/**
|
|
37
26
|
The controller's current model. When retrieving or modifying a controller's
|
|
38
27
|
model, this property should be used instead of the `content` property.
|
|
39
|
-
|
|
28
|
+
@property model
|
|
40
29
|
@public
|
|
41
30
|
*/
|
|
42
31
|
model: computed({
|
|
@@ -44,9 +33,10 @@ export default Mixin.create(ActionHandler, {
|
|
|
44
33
|
return this[MODEL];
|
|
45
34
|
},
|
|
46
35
|
|
|
47
|
-
set(
|
|
36
|
+
set(_key, value) {
|
|
48
37
|
return this[MODEL] = value;
|
|
49
38
|
}
|
|
50
39
|
|
|
51
40
|
})
|
|
52
|
-
});
|
|
41
|
+
});
|
|
42
|
+
export default ControllerMixin;
|
|
@@ -420,8 +420,10 @@ function resolverFor(namespace) {
|
|
|
420
420
|
};
|
|
421
421
|
return ResolverClass.create(props);
|
|
422
422
|
}
|
|
423
|
+
/** @internal */
|
|
423
424
|
|
|
424
|
-
|
|
425
|
+
|
|
426
|
+
export function buildInitializerMethod(bucketName, humanName) {
|
|
425
427
|
return function (initializer) {
|
|
426
428
|
// If this is the first initializer being added to a subclass, we are going to reopen the class
|
|
427
429
|
// to make sure we have a new `initializers` object, which extends from the parent class' using
|
|
@@ -117,8 +117,12 @@ export { notifyPropertyChange, defineProperty, get, set, getProperties, setPrope
|
|
|
117
117
|
|
|
118
118
|
const BINDINGS_MAP = new WeakMap();
|
|
119
119
|
|
|
120
|
+
function hasProto(obj) {
|
|
121
|
+
return obj != null && obj.constructor !== undefined && typeof obj.constructor.proto === 'function';
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
function setupAction(target, key, actionFn) {
|
|
121
|
-
if (target
|
|
125
|
+
if (hasProto(target)) {
|
|
122
126
|
target.constructor.proto();
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -128,6 +132,7 @@ function setupAction(target, key, actionFn) {
|
|
|
128
132
|
target.actions = parentActions ? Object.assign({}, parentActions) : {};
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
assert("[BUG] Somehow the target doesn't have actions!", target.actions != null);
|
|
131
136
|
target.actions[key] = actionFn;
|
|
132
137
|
return {
|
|
133
138
|
get() {
|
|
@@ -151,13 +156,13 @@ function setupAction(target, key, actionFn) {
|
|
|
151
156
|
};
|
|
152
157
|
}
|
|
153
158
|
|
|
154
|
-
export function action(
|
|
159
|
+
export function action(...args) {
|
|
155
160
|
let actionFn;
|
|
156
161
|
|
|
157
|
-
if (!isElementDescriptor(
|
|
158
|
-
actionFn =
|
|
162
|
+
if (!isElementDescriptor(args)) {
|
|
163
|
+
actionFn = args[0];
|
|
159
164
|
|
|
160
|
-
let decorator = function (target, key,
|
|
165
|
+
let decorator = function (target, key, _desc, _meta, isClassicDecorator) {
|
|
161
166
|
assert('The @action decorator may only be passed a method when used in classic classes. You should decorate methods directly in native classes', isClassicDecorator);
|
|
162
167
|
assert('The action() decorator must be passed a method when used in classic classes', typeof actionFn === 'function');
|
|
163
168
|
return setupAction(target, key, actionFn);
|
|
@@ -167,8 +172,11 @@ export function action(target, key, desc) {
|
|
|
167
172
|
return decorator;
|
|
168
173
|
}
|
|
169
174
|
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
let [target, key, desc] = args;
|
|
176
|
+
actionFn = desc === null || desc === void 0 ? void 0 : desc.value;
|
|
177
|
+
assert('The @action decorator must be applied to methods when used in native classes', typeof actionFn === 'function'); // SAFETY: TS types are weird with decorators. This should work.
|
|
178
|
+
|
|
172
179
|
return setupAction(target, key, actionFn);
|
|
173
|
-
}
|
|
180
|
+
} // SAFETY: TS types are weird with decorators. This should work.
|
|
181
|
+
|
|
174
182
|
setClassicDecorator(action);
|
|
@@ -11,8 +11,7 @@ function expandPropertiesToArray(predicateName, properties) {
|
|
|
11
11
|
expandedProperties.push(entry);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
for (let
|
|
15
|
-
let property = properties[i];
|
|
14
|
+
for (let property of properties) {
|
|
16
15
|
assert(`Dependent keys passed to \`${predicateName}\` computed macro can't have spaces.`, property.indexOf(' ') < 0);
|
|
17
16
|
expandProperties(property, extractProperty);
|
|
18
17
|
}
|
|
@@ -21,19 +20,22 @@ function expandPropertiesToArray(predicateName, properties) {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
function generateComputedWithPredicate(name, predicate) {
|
|
24
|
-
return (...
|
|
23
|
+
return (dependentKey, ...additionalDependentKeys) => {
|
|
24
|
+
let properties = [dependentKey, ...additionalDependentKeys];
|
|
25
25
|
assert(`You attempted to use @${name} as a decorator directly, but it requires at least one dependent key parameter`, !isElementDescriptor(properties));
|
|
26
26
|
let dependentKeys = expandPropertiesToArray(name, properties);
|
|
27
27
|
let computedFunc = computed(...dependentKeys, function () {
|
|
28
28
|
let lastIdx = dependentKeys.length - 1;
|
|
29
29
|
|
|
30
30
|
for (let i = 0; i < lastIdx; i++) {
|
|
31
|
+
// SAFETY: `i` is derived from the length of `dependentKeys`
|
|
31
32
|
let value = get(this, dependentKeys[i]);
|
|
32
33
|
|
|
33
34
|
if (!predicate(value)) {
|
|
34
35
|
return value;
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
} // SAFETY: `lastIdx` is derived from the length of `dependentKeys`
|
|
38
|
+
|
|
37
39
|
|
|
38
40
|
return get(this, dependentKeys[lastIdx]);
|
|
39
41
|
});
|