ember-source 4.1.0-alpha.2 → 4.1.0-alpha.6
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 +53 -0
- 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/ember-template-compiler.js +25 -274
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +4 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +227 -1338
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/header/loader.js +1 -0
- package/dist/packages/@ember/-internals/container/index.js +17 -183
- package/dist/packages/@ember/-internals/environment/index.js +0 -12
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
- package/dist/packages/@ember/-internals/glimmer/index.js +34 -71
- package/dist/packages/@ember/-internals/metal/index.js +65 -2
- package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +1 -0
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +16 -8
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +2 -1
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +10 -45
- package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +4 -90
- package/dist/packages/@ember/-internals/views/index.js +0 -1
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +22 -72
- package/dist/packages/@ember/application/instance.js +1 -22
- package/dist/packages/@ember/application/lib/application.js +7 -24
- package/dist/packages/@ember/canary-features/index.js +4 -2
- package/dist/packages/@ember/deprecated-features/index.js +0 -3
- package/dist/packages/@ember/engine/index.js +1 -5
- package/dist/packages/@ember/engine/instance.js +0 -4
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +0 -373
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +0 -351
- package/dist/packages/@ember/service/index.js +19 -5
- package/dist/packages/@glimmer/tracking/index.js +1 -1
- package/dist/packages/ember/index.js +2 -3
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/qunit.js +1 -0
- package/docs/data.json +326 -368
- package/lib/index.js +11 -48
- package/package.json +33 -33
- package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
- package/dist/packages/jquery/index.js +0 -2
|
@@ -28,7 +28,7 @@ function cleanURL(url, rootURL) {
|
|
|
28
28
|
```app/components/example.js
|
|
29
29
|
import Component from '@glimmer/component';
|
|
30
30
|
import { action } from '@ember/object';
|
|
31
|
-
import {
|
|
31
|
+
import { service } from '@ember/service';
|
|
32
32
|
|
|
33
33
|
export default class ExampleComponent extends Component {
|
|
34
34
|
@service router;
|
|
@@ -78,7 +78,7 @@ export default class RouterService extends Service {
|
|
|
78
78
|
```app/components/example.js
|
|
79
79
|
import Component from '@glimmer/component';
|
|
80
80
|
import { action } from '@ember/object';
|
|
81
|
-
import {
|
|
81
|
+
import { service } from '@ember/service';
|
|
82
82
|
export default class extends Component {
|
|
83
83
|
@service router;
|
|
84
84
|
@action
|
|
@@ -172,7 +172,7 @@ export default class RouterService extends Service {
|
|
|
172
172
|
```
|
|
173
173
|
```app/components/copy-link.js
|
|
174
174
|
import Component from '@glimmer/component';
|
|
175
|
-
import {
|
|
175
|
+
import { service } from '@ember/service';
|
|
176
176
|
import { action } from '@ember/object';
|
|
177
177
|
export default class CopyLinkComponent extends Component {
|
|
178
178
|
@service router;
|
|
@@ -194,7 +194,7 @@ export default class RouterService extends Service {
|
|
|
194
194
|
```
|
|
195
195
|
```app/components/copy-link.js
|
|
196
196
|
import Component from '@glimmer/component';
|
|
197
|
-
import {
|
|
197
|
+
import { service } from '@ember/service';
|
|
198
198
|
import { action } from '@ember/object';
|
|
199
199
|
export default class CopyLinkComponent extends Component {
|
|
200
200
|
@service router;
|
|
@@ -223,6 +223,8 @@ export default class RouterService extends Service {
|
|
|
223
223
|
|
|
224
224
|
|
|
225
225
|
urlFor(routeName, ...args) {
|
|
226
|
+
this._router.setupRouter();
|
|
227
|
+
|
|
226
228
|
return this._router.generate(routeName, ...args);
|
|
227
229
|
}
|
|
228
230
|
/**
|
|
@@ -232,7 +234,7 @@ export default class RouterService extends Service {
|
|
|
232
234
|
In the following example, `isActive` will return `true` if the current route is `/posts`.
|
|
233
235
|
```app/components/posts.js
|
|
234
236
|
import Component from '@glimmer/component';
|
|
235
|
-
import {
|
|
237
|
+
import { service } from '@ember/service';
|
|
236
238
|
export default class extends Component {
|
|
237
239
|
@service router;
|
|
238
240
|
displayComments() {
|
|
@@ -244,7 +246,7 @@ export default class RouterService extends Service {
|
|
|
244
246
|
assuming the post has an id of 1:
|
|
245
247
|
```app/components/posts.js
|
|
246
248
|
import Component from '@glimmer/component';
|
|
247
|
-
import {
|
|
249
|
+
import { service } from '@ember/service';
|
|
248
250
|
export default class extends Component {
|
|
249
251
|
@service router;
|
|
250
252
|
displayComments(post) {
|
|
@@ -323,7 +325,7 @@ export default class RouterService extends Service {
|
|
|
323
325
|
application before transitioning to it.
|
|
324
326
|
```
|
|
325
327
|
import Component from '@ember/component';
|
|
326
|
-
import {
|
|
328
|
+
import { service } from '@ember/service';
|
|
327
329
|
export default class extends Component {
|
|
328
330
|
@service router;
|
|
329
331
|
path = '/';
|
|
@@ -342,6 +344,9 @@ export default class RouterService extends Service {
|
|
|
342
344
|
|
|
343
345
|
recognize(url) {
|
|
344
346
|
assert(`You must pass a url that begins with the application's rootURL "${this.rootURL}"`, url.indexOf(this.rootURL) === 0);
|
|
347
|
+
|
|
348
|
+
this._router.setupRouter();
|
|
349
|
+
|
|
345
350
|
let internalURL = cleanURL(url, this.rootURL);
|
|
346
351
|
return this._router._routerMicrolib.recognize(internalURL);
|
|
347
352
|
}
|
|
@@ -359,6 +364,9 @@ export default class RouterService extends Service {
|
|
|
359
364
|
|
|
360
365
|
recognizeAndLoad(url) {
|
|
361
366
|
assert(`You must pass a url that begins with the application's rootURL "${this.rootURL}"`, url.indexOf(this.rootURL) === 0);
|
|
367
|
+
|
|
368
|
+
this._router.setupRouter();
|
|
369
|
+
|
|
362
370
|
let internalURL = cleanURL(url, this.rootURL);
|
|
363
371
|
return this._router._routerMicrolib.recognizeAndLoad(internalURL);
|
|
364
372
|
}
|
|
@@ -512,7 +520,7 @@ RouterService.reopen(Evented, {
|
|
|
512
520
|
Usage example:
|
|
513
521
|
```app/components/header.js
|
|
514
522
|
import Component from '@glimmer/component';
|
|
515
|
-
import {
|
|
523
|
+
import { service } from '@ember/service';
|
|
516
524
|
import { notEmpty } from '@ember/object/computed';
|
|
517
525
|
export default class extends Component {
|
|
518
526
|
@service router;
|
|
@@ -750,6 +750,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) {
|
|
|
750
750
|
@return {Transition} the transition object associated with this
|
|
751
751
|
attempted transition
|
|
752
752
|
@since 1.0.0
|
|
753
|
+
@deprecated Use replaceWith from the Router service instead.
|
|
753
754
|
@public
|
|
754
755
|
*/
|
|
755
756
|
|
|
@@ -1286,7 +1287,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) {
|
|
|
1286
1287
|
```
|
|
1287
1288
|
```app/routes/application.js
|
|
1288
1289
|
import Route from '@ember/routing/route';
|
|
1289
|
-
import {
|
|
1290
|
+
import { service } from '@ember/service';
|
|
1290
1291
|
export default class ApplicationRoute extends Route {
|
|
1291
1292
|
@service router
|
|
1292
1293
|
constructor() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { privatize as P } from '@ember/-internals/container';
|
|
2
|
-
import { computed, get,
|
|
2
|
+
import { computed, get, set } from '@ember/-internals/metal';
|
|
3
3
|
import { getOwner } from '@ember/-internals/owner';
|
|
4
4
|
import { A as emberA, Evented, Object as EmberObject, typeOf } from '@ember/-internals/runtime';
|
|
5
5
|
import { assert, deprecate, info } from '@ember/debug';
|
|
6
|
-
import {
|
|
6
|
+
import { ROUTER_EVENTS } from '@ember/deprecated-features';
|
|
7
7
|
import EmberError from '@ember/error';
|
|
8
8
|
import { cancel, once, run, scheduleOnce } from '@ember/runloop';
|
|
9
9
|
import { DEBUG } from '@glimmer/env';
|
|
@@ -534,7 +534,14 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
534
534
|
if (!this._toplevelView) {
|
|
535
535
|
let owner = getOwner(this);
|
|
536
536
|
let OutletView = owner.factoryFor('view:-outlet');
|
|
537
|
-
|
|
537
|
+
let application = owner.lookup('application:main');
|
|
538
|
+
let environment = owner.lookup('-environment:main');
|
|
539
|
+
let template = owner.lookup('template:-outlet');
|
|
540
|
+
this._toplevelView = OutletView.create({
|
|
541
|
+
environment,
|
|
542
|
+
template,
|
|
543
|
+
application
|
|
544
|
+
});
|
|
538
545
|
|
|
539
546
|
this._toplevelView.setOutletState(liveRoutes);
|
|
540
547
|
|
|
@@ -1492,48 +1499,6 @@ function updatePaths(router) {
|
|
|
1492
1499
|
// actually been entered at that point.
|
|
1493
1500
|
return;
|
|
1494
1501
|
}
|
|
1495
|
-
|
|
1496
|
-
if (APP_CTRL_ROUTER_PROPS) {
|
|
1497
|
-
if (!('currentPath' in appController)) {
|
|
1498
|
-
Object.defineProperty(appController, 'currentPath', {
|
|
1499
|
-
get() {
|
|
1500
|
-
deprecate('Accessing `currentPath` on `controller:application` is deprecated, use the `currentPath` property on `service:router` instead.', false, {
|
|
1501
|
-
id: 'application-controller.router-properties',
|
|
1502
|
-
until: '4.0.0',
|
|
1503
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_application-controller-router-properties',
|
|
1504
|
-
for: 'ember-source',
|
|
1505
|
-
since: {
|
|
1506
|
-
enabled: '3.10.0-beta.1'
|
|
1507
|
-
}
|
|
1508
|
-
});
|
|
1509
|
-
return get(router, 'currentPath');
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
notifyPropertyChange(appController, 'currentPath');
|
|
1516
|
-
|
|
1517
|
-
if (!('currentRouteName' in appController)) {
|
|
1518
|
-
Object.defineProperty(appController, 'currentRouteName', {
|
|
1519
|
-
get() {
|
|
1520
|
-
deprecate('Accessing `currentRouteName` on `controller:application` is deprecated, use the `currentRouteName` property on `service:router` instead.', false, {
|
|
1521
|
-
id: 'application-controller.router-properties',
|
|
1522
|
-
until: '4.0.0',
|
|
1523
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_application-controller-router-properties',
|
|
1524
|
-
for: 'ember-source',
|
|
1525
|
-
since: {
|
|
1526
|
-
enabled: '3.10.0-beta.1'
|
|
1527
|
-
}
|
|
1528
|
-
});
|
|
1529
|
-
return get(router, 'currentRouteName');
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
notifyPropertyChange(appController, 'currentRouteName');
|
|
1536
|
-
}
|
|
1537
1502
|
}
|
|
1538
1503
|
|
|
1539
1504
|
function didBeginTransition(transition, router) {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { getFactoryFor, setFactoryFor } from '@ember/-internals/container';
|
|
5
5
|
import { getOwner } from '@ember/-internals/owner';
|
|
6
|
-
import { guidFor,
|
|
6
|
+
import { guidFor, makeArray, isInternalSymbol } from '@ember/-internals/utils';
|
|
7
7
|
import { meta } from '@ember/-internals/meta';
|
|
8
|
-
import { PROXY_CONTENT, sendEvent, Mixin, activateObserver, applyMixin, defineProperty, descriptorForProperty, isClassicDecorator, DEBUG_INJECTION_FUNCTIONS
|
|
8
|
+
import { PROXY_CONTENT, sendEvent, Mixin, activateObserver, applyMixin, defineProperty, descriptorForProperty, isClassicDecorator, DEBUG_INJECTION_FUNCTIONS } from '@ember/-internals/metal';
|
|
9
9
|
import ActionHandler from '../mixins/action_handler';
|
|
10
|
-
import { assert
|
|
10
|
+
import { assert } from '@ember/debug';
|
|
11
11
|
import { DEBUG } from '@glimmer/env';
|
|
12
12
|
import { _WeakSet as WeakSet } from '@glimmer/util';
|
|
13
13
|
import { destroy, isDestroying, isDestroyed, registerDestructor } from '@glimmer/destroyable';
|
|
@@ -31,22 +31,6 @@ function initialize(obj, properties) {
|
|
|
31
31
|
if (properties !== undefined) {
|
|
32
32
|
assert('EmberObject.create only accepts objects.', typeof properties === 'object' && properties !== null);
|
|
33
33
|
assert('EmberObject.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof Mixin));
|
|
34
|
-
let injectedProperties;
|
|
35
|
-
|
|
36
|
-
if (DEBUG) {
|
|
37
|
-
// these are all the implicit injectinos
|
|
38
|
-
injectedProperties = [];
|
|
39
|
-
let factory = getFactoryFor(obj);
|
|
40
|
-
|
|
41
|
-
if (factory) {
|
|
42
|
-
for (let injection in factory.injections) {
|
|
43
|
-
if (factory.injections[injection] === properties[injection]) {
|
|
44
|
-
injectedProperties.push(injection);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
34
|
let concatenatedProperties = obj.concatenatedProperties;
|
|
51
35
|
let mergedProperties = obj.mergedProperties;
|
|
52
36
|
let hasConcatenatedProps = concatenatedProperties !== undefined && concatenatedProperties.length > 0;
|
|
@@ -80,53 +64,12 @@ function initialize(obj, properties) {
|
|
|
80
64
|
}
|
|
81
65
|
|
|
82
66
|
if (isDescriptor) {
|
|
83
|
-
if (DEBUG && injectedProperties.indexOf(keyName) !== -1) {
|
|
84
|
-
// need to check if implicit injection owner.inject('component:my-component', 'foo', 'service:bar') does not match explicit injection @service foo
|
|
85
|
-
// implicit injection takes precedence so need to tell user to rename property on obj
|
|
86
|
-
let isInjectedProperty = DEBUG_INJECTION_FUNCTIONS.has(possibleDesc._getter);
|
|
87
|
-
|
|
88
|
-
if (isInjectedProperty && value !== possibleDesc.get(obj, keyName)) {
|
|
89
|
-
implicitInjectionDeprecation(keyName, `You have explicitly defined a service injection for the '${keyName}' property on ${inspect(obj)}. However, a different service or value was injected via implicit injections which overrode your explicit injection. Implicit injections have been deprecated, and will be removed in the near future. In order to prevent breakage, you should inject the same value explicitly that is currently being injected implicitly.`);
|
|
90
|
-
} else if (possibleDesc instanceof TrackedDescriptor) {
|
|
91
|
-
let descValue = possibleDesc.get(obj, keyName);
|
|
92
|
-
|
|
93
|
-
if (value !== descValue) {
|
|
94
|
-
implicitInjectionDeprecation(keyName, `A value was injected implicitly on the '${keyName}' tracked property of an instance of ${inspect(obj)}, overwriting the original value which was ${inspect(descValue)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
|
|
95
|
-
}
|
|
96
|
-
} else if (possibleDesc._setter === undefined) {
|
|
97
|
-
implicitInjectionDeprecation(keyName, `A value was injected implicitly on the '${keyName}' computed property of an instance of ${inspect(obj)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
67
|
possibleDesc.set(obj, keyName, value);
|
|
102
68
|
} else if (typeof obj.setUnknownProperty === 'function' && !(keyName in obj)) {
|
|
103
69
|
obj.setUnknownProperty(keyName, value);
|
|
104
70
|
} else {
|
|
105
71
|
if (DEBUG) {
|
|
106
|
-
|
|
107
|
-
let desc = lookupDescriptor(obj, keyName);
|
|
108
|
-
|
|
109
|
-
if (injectedProperties.indexOf(keyName) === -1) {
|
|
110
|
-
// Value was not an injected property, define in like normal
|
|
111
|
-
defineProperty(obj, keyName, null, value, m); // setup mandatory setter
|
|
112
|
-
} else if (desc) {
|
|
113
|
-
// If the property is a value prop, and it isn't the expected value,
|
|
114
|
-
// then we can warn the user when they attempt to use the value
|
|
115
|
-
if ('value' in desc && desc.value !== value) {
|
|
116
|
-
// implicit injection does not match value descriptor set on object
|
|
117
|
-
defineSelfDestructingImplicitInjectionGetter(obj, keyName, value, `A value was injected implicitly on the '${keyName}' property of an instance of ${inspect(obj)}, overwriting the original value which was ${inspect(desc.value)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
|
|
118
|
-
} else {
|
|
119
|
-
// Otherwise, the value is either a getter/setter, or it is the correct value.
|
|
120
|
-
// If it is a getter/setter, then we don't know what activating it might do - it could
|
|
121
|
-
// be that the user only defined a getter, and so the value will not be set at all. It
|
|
122
|
-
// could be that the setter is a no-op that does nothing. Both of these are valid ways
|
|
123
|
-
// to "override" an implicit injection, so we can't really warn here. So, assign the
|
|
124
|
-
// value like we would normally.
|
|
125
|
-
obj[keyName] = value;
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
defineSelfDestructingImplicitInjectionGetter(obj, keyName, value, `A value was injected implicitly on the '${keyName}' property of an instance of ${inspect(obj)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
|
|
129
|
-
}
|
|
72
|
+
defineProperty(obj, keyName, null, value, m); // setup mandatory setter
|
|
130
73
|
} else {
|
|
131
74
|
obj[keyName] = value;
|
|
132
75
|
}
|
|
@@ -151,23 +94,6 @@ function initialize(obj, properties) {
|
|
|
151
94
|
|
|
152
95
|
sendEvent(obj, 'init', undefined, undefined, undefined, m);
|
|
153
96
|
}
|
|
154
|
-
|
|
155
|
-
function defineSelfDestructingImplicitInjectionGetter(obj, keyName, value, message) {
|
|
156
|
-
Object.defineProperty(obj, keyName, {
|
|
157
|
-
configurable: true,
|
|
158
|
-
enumerable: true,
|
|
159
|
-
|
|
160
|
-
get() {
|
|
161
|
-
// only want to deprecate on first access so we make this self destructing
|
|
162
|
-
Object.defineProperty(obj, keyName, {
|
|
163
|
-
value
|
|
164
|
-
});
|
|
165
|
-
implicitInjectionDeprecation(keyName, message);
|
|
166
|
-
return value;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
97
|
/**
|
|
172
98
|
`CoreObject` is the base class for all Ember constructs. It establishes a
|
|
173
99
|
class system based on Ember's Mixin system, and provides the basis for the
|
|
@@ -985,16 +911,4 @@ if (DEBUG) {
|
|
|
985
911
|
};
|
|
986
912
|
}
|
|
987
913
|
|
|
988
|
-
function implicitInjectionDeprecation(keyName, msg = null) {
|
|
989
|
-
deprecate(msg, false, {
|
|
990
|
-
id: 'implicit-injections',
|
|
991
|
-
until: '4.0.0',
|
|
992
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_implicit-injections',
|
|
993
|
-
for: 'ember-source',
|
|
994
|
-
since: {
|
|
995
|
-
enabled: '3.26.0'
|
|
996
|
-
}
|
|
997
|
-
});
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
914
|
export default CoreObject;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { jQuery, jQueryDisabled } from './lib/system/jquery';
|
|
2
1
|
export { addChildView, isSimpleClick, getViewBounds, getViewClientRects, getViewBoundingClientRect, getRootViews, getChildViews, getViewId, getElementView, getViewElement, setElementView, setViewElement, clearElementView, clearViewElement, constructStyleDeprecationMessage } from './lib/system/utils';
|
|
3
2
|
export { default as EventDispatcher } from './lib/system/event_dispatcher';
|
|
4
3
|
export { default as ComponentLookup } from './lib/component_lookup';
|
|
@@ -4,18 +4,12 @@ import { get, set } from '@ember/-internals/metal';
|
|
|
4
4
|
import { Object as EmberObject } from '@ember/-internals/runtime';
|
|
5
5
|
import { getElementView } from '@ember/-internals/views';
|
|
6
6
|
import ActionManager from './action_manager';
|
|
7
|
-
import { contains } from './utils';
|
|
8
|
-
import { MOUSE_ENTER_LEAVE_MOVE_EVENTS } from '@ember/deprecated-features';
|
|
9
7
|
/**
|
|
10
8
|
@module ember
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
11
|
const ROOT_ELEMENT_CLASS = 'ember-application';
|
|
14
12
|
const ROOT_ELEMENT_SELECTOR = `.${ROOT_ELEMENT_CLASS}`;
|
|
15
|
-
const EVENT_MAP = {
|
|
16
|
-
mouseenter: 'mouseover',
|
|
17
|
-
mouseleave: 'mouseout'
|
|
18
|
-
};
|
|
19
13
|
/**
|
|
20
14
|
`Ember.EventDispatcher` handles delegating browser events to their
|
|
21
15
|
corresponding `Ember.Views.` For example, when you click on a view,
|
|
@@ -56,7 +50,7 @@ export default EmberObject.extend({
|
|
|
56
50
|
@type Object
|
|
57
51
|
@private
|
|
58
52
|
*/
|
|
59
|
-
events:
|
|
53
|
+
events: {
|
|
60
54
|
touchstart: 'touchStart',
|
|
61
55
|
touchmove: 'touchMove',
|
|
62
56
|
touchend: 'touchEnd',
|
|
@@ -81,11 +75,7 @@ export default EmberObject.extend({
|
|
|
81
75
|
dragover: 'dragOver',
|
|
82
76
|
drop: 'drop',
|
|
83
77
|
dragend: 'dragEnd'
|
|
84
|
-
},
|
|
85
|
-
mouseenter: 'mouseEnter',
|
|
86
|
-
mouseleave: 'mouseLeave',
|
|
87
|
-
mousemove: 'mouseMove'
|
|
88
|
-
} : {}),
|
|
78
|
+
},
|
|
89
79
|
|
|
90
80
|
/**
|
|
91
81
|
The root DOM element to which event listeners should be attached. Event
|
|
@@ -263,71 +253,31 @@ export default EmberObject.extend({
|
|
|
263
253
|
}
|
|
264
254
|
|
|
265
255
|
return result;
|
|
266
|
-
};
|
|
267
|
-
// Mimics the way this is handled in jQuery,
|
|
268
|
-
// see https://github.com/jquery/jquery/blob/899c56f6ada26821e8af12d9f35fa039100e838e/src/event.js#L666-L700
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (MOUSE_ENTER_LEAVE_MOVE_EVENTS && EVENT_MAP[event] !== undefined) {
|
|
272
|
-
let mappedEventType = EVENT_MAP[event];
|
|
273
|
-
let origEventType = event;
|
|
274
|
-
|
|
275
|
-
let createFakeEvent = (eventType, event) => {
|
|
276
|
-
let fakeEvent = document.createEvent('MouseEvent');
|
|
277
|
-
fakeEvent.initMouseEvent(eventType, false, false, event.view, event.detail, event.screenX, event.screenY, event.clientX, event.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, event.button, event.relatedTarget); // fake event.target as we don't dispatch the event
|
|
278
|
-
|
|
279
|
-
Object.defineProperty(fakeEvent, 'target', {
|
|
280
|
-
value: event.target,
|
|
281
|
-
enumerable: true
|
|
282
|
-
});
|
|
283
|
-
return fakeEvent;
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
let handleMappedEvent = this._eventHandlers[mappedEventType] = event => {
|
|
287
|
-
let target = event.target;
|
|
288
|
-
let related = event.relatedTarget;
|
|
289
|
-
|
|
290
|
-
while (target && target.nodeType === 1 && (related === null || related !== target && !contains(target, related))) {
|
|
291
|
-
// mouseEnter/Leave don't bubble, so there is no logic to prevent it as with other events
|
|
292
|
-
if (getElementView(target)) {
|
|
293
|
-
viewHandler(target, createFakeEvent(origEventType, event));
|
|
294
|
-
} else if (target.hasAttribute('data-ember-action')) {
|
|
295
|
-
actionHandler(target, createFakeEvent(origEventType, event));
|
|
296
|
-
} // separate mouseEnter/Leave events are dispatched for each listening element
|
|
297
|
-
// until the element (related) has been reached that the pointing device exited from/to
|
|
298
|
-
|
|
256
|
+
};
|
|
299
257
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
};
|
|
258
|
+
let handleEvent = this._eventHandlers[event] = event => {
|
|
259
|
+
let target = event.target;
|
|
303
260
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (
|
|
311
|
-
|
|
312
|
-
event.preventDefault();
|
|
313
|
-
event.stopPropagation();
|
|
314
|
-
break;
|
|
315
|
-
} else if (event.cancelBubble === true) {
|
|
316
|
-
break;
|
|
317
|
-
}
|
|
318
|
-
} else if (typeof target.hasAttribute === 'function' && target.hasAttribute('data-ember-action')) {
|
|
319
|
-
if (actionHandler(target, event) === false) {
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
261
|
+
do {
|
|
262
|
+
if (getElementView(target)) {
|
|
263
|
+
if (viewHandler(target, event) === false) {
|
|
264
|
+
event.preventDefault();
|
|
265
|
+
event.stopPropagation();
|
|
266
|
+
break;
|
|
267
|
+
} else if (event.cancelBubble === true) {
|
|
268
|
+
break;
|
|
322
269
|
}
|
|
270
|
+
} else if (typeof target.hasAttribute === 'function' && target.hasAttribute('data-ember-action')) {
|
|
271
|
+
if (actionHandler(target, event) === false) {
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
323
275
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
rootElement.addEventListener(event, handleEvent);
|
|
329
|
-
}
|
|
276
|
+
target = target.parentNode;
|
|
277
|
+
} while (target && target.nodeType === 1);
|
|
278
|
+
};
|
|
330
279
|
|
|
280
|
+
rootElement.addEventListener(event, handleEvent);
|
|
331
281
|
this.lazyEvents.delete(event);
|
|
332
282
|
},
|
|
333
283
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { get, set, computed } from '@ember/-internals/metal';
|
|
5
5
|
import * as environment from '@ember/-internals/browser-environment';
|
|
6
|
-
import { jQuery } from '@ember/-internals/views';
|
|
7
6
|
import EngineInstance from '@ember/engine/instance';
|
|
8
7
|
import { renderSettled } from '@ember/-internals/glimmer';
|
|
9
8
|
/**
|
|
@@ -52,8 +51,7 @@ const ApplicationInstance = EngineInstance.extend({
|
|
|
52
51
|
|
|
53
52
|
/**
|
|
54
53
|
The root DOM element of the Application as an element or a
|
|
55
|
-
|
|
56
|
-
string](http://api.jquery.com/category/selectors/).
|
|
54
|
+
CSS selector.
|
|
57
55
|
@private
|
|
58
56
|
@property {String|DOMElement} rootElement
|
|
59
57
|
*/
|
|
@@ -302,18 +300,6 @@ ApplicationInstance.reopenClass({
|
|
|
302
300
|
|
|
303
301
|
class BootOptions {
|
|
304
302
|
constructor(options = {}) {
|
|
305
|
-
/**
|
|
306
|
-
Provide a specific instance of jQuery. This is useful in conjunction with
|
|
307
|
-
the `document` option, as it allows you to use a copy of `jQuery` that is
|
|
308
|
-
appropriately bound to the foreign `document` (e.g. a jsdom).
|
|
309
|
-
This is highly experimental and support very incomplete at the moment.
|
|
310
|
-
@property jQuery
|
|
311
|
-
@type Object
|
|
312
|
-
@default auto-detected
|
|
313
|
-
@private
|
|
314
|
-
*/
|
|
315
|
-
this.jQuery = jQuery; // This default is overridable below
|
|
316
|
-
|
|
317
303
|
/**
|
|
318
304
|
Interactive mode: whether we need to set up event delegation and invoke
|
|
319
305
|
lifecycle callbacks on Components.
|
|
@@ -322,7 +308,6 @@ class BootOptions {
|
|
|
322
308
|
@default auto-detected
|
|
323
309
|
@private
|
|
324
310
|
*/
|
|
325
|
-
|
|
326
311
|
this.isInteractive = environment.hasDOM; // This default is overridable below
|
|
327
312
|
|
|
328
313
|
/**
|
|
@@ -359,7 +344,6 @@ class BootOptions {
|
|
|
359
344
|
}
|
|
360
345
|
|
|
361
346
|
if (!this.isBrowser) {
|
|
362
|
-
this.jQuery = null;
|
|
363
347
|
this.isInteractive = false;
|
|
364
348
|
this.location = 'none';
|
|
365
349
|
}
|
|
@@ -382,7 +366,6 @@ class BootOptions {
|
|
|
382
366
|
}
|
|
383
367
|
|
|
384
368
|
if (!this.shouldRender) {
|
|
385
|
-
this.jQuery = null;
|
|
386
369
|
this.isInteractive = false;
|
|
387
370
|
}
|
|
388
371
|
/**
|
|
@@ -447,10 +430,6 @@ class BootOptions {
|
|
|
447
430
|
this.location = options.location;
|
|
448
431
|
}
|
|
449
432
|
|
|
450
|
-
if (options.jQuery !== undefined) {
|
|
451
|
-
this.jQuery = options.jQuery;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
433
|
if (options.isInteractive !== undefined) {
|
|
455
434
|
this.isInteractive = Boolean(options.isInteractive);
|
|
456
435
|
}
|
|
@@ -10,15 +10,13 @@ import { join, once, run, schedule } from '@ember/runloop';
|
|
|
10
10
|
import { libraries } from '@ember/-internals/metal';
|
|
11
11
|
import { _loaded, runLoadHooks } from './lazy_load';
|
|
12
12
|
import { RSVP } from '@ember/-internals/runtime';
|
|
13
|
-
import { EventDispatcher
|
|
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
16
|
import Engine 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';
|
|
20
|
-
import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
|
|
21
|
-
let librariesRegistered = false;
|
|
22
20
|
/**
|
|
23
21
|
An instance of `Application` is the starting point for every Ember
|
|
24
22
|
application. It instantiates, initializes and coordinates the
|
|
@@ -316,12 +314,6 @@ const Application = Engine.extend({
|
|
|
316
314
|
// eslint-disable-line no-unused-vars
|
|
317
315
|
this._super(...arguments);
|
|
318
316
|
|
|
319
|
-
if (!this.$) {
|
|
320
|
-
this.$ = jQuery;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
registerLibraries();
|
|
324
|
-
|
|
325
317
|
if (DEBUG) {
|
|
326
318
|
if (ENV.LOG_VERSION) {
|
|
327
319
|
// we only need to see this once per Application#init
|
|
@@ -862,7 +854,6 @@ const Application = Engine.extend({
|
|
|
862
854
|
} else { // node
|
|
863
855
|
application.register('service:network', NodeNetworkService);
|
|
864
856
|
}
|
|
865
|
-
application.inject('route', 'network', 'service:network');
|
|
866
857
|
};
|
|
867
858
|
export default {
|
|
868
859
|
name: 'network-service',
|
|
@@ -871,11 +862,13 @@ const Application = Engine.extend({
|
|
|
871
862
|
```
|
|
872
863
|
```app/routes/post.js
|
|
873
864
|
import Route from '@ember/routing/route';
|
|
865
|
+
import { service } from '@ember/service';
|
|
874
866
|
// An example of how the (hypothetical) service is used in routes.
|
|
875
|
-
export default Route
|
|
876
|
-
|
|
867
|
+
export default class IndexRoute extends Route {
|
|
868
|
+
@service network;
|
|
869
|
+
model(params) {
|
|
877
870
|
return this.network.fetch(`/api/posts/${params.post_id}.json`);
|
|
878
|
-
}
|
|
871
|
+
}
|
|
879
872
|
afterModel(post) {
|
|
880
873
|
if (post.isExternalContent) {
|
|
881
874
|
return this.network.fetch(`/api/external/?url=${post.externalURL}`);
|
|
@@ -883,7 +876,7 @@ const Application = Engine.extend({
|
|
|
883
876
|
return post;
|
|
884
877
|
}
|
|
885
878
|
}
|
|
886
|
-
}
|
|
879
|
+
}
|
|
887
880
|
```
|
|
888
881
|
```javascript
|
|
889
882
|
// Finally, put all the pieces together
|
|
@@ -970,14 +963,4 @@ function commonSetupRegistry(registry) {
|
|
|
970
963
|
registry.register('service:router', RouterService);
|
|
971
964
|
}
|
|
972
965
|
|
|
973
|
-
function registerLibraries() {
|
|
974
|
-
if (!librariesRegistered) {
|
|
975
|
-
librariesRegistered = true;
|
|
976
|
-
|
|
977
|
-
if (JQUERY_INTEGRATION && hasDOM && !jQueryDisabled) {
|
|
978
|
-
libraries.registerCoreLibrary('jQuery', jQuery().jquery);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
966
|
export default Application;
|
|
@@ -19,7 +19,8 @@ export const DEFAULT_FEATURES = {
|
|
|
19
19
|
EMBER_MODERNIZED_BUILT_IN_COMPONENTS: true,
|
|
20
20
|
EMBER_STRICT_MODE: true,
|
|
21
21
|
EMBER_DYNAMIC_HELPERS_AND_MODIFIERS: true,
|
|
22
|
-
EMBER_ROUTING_ROUTER_SERVICE_REFRESH: null
|
|
22
|
+
EMBER_ROUTING_ROUTER_SERVICE_REFRESH: null,
|
|
23
|
+
EMBER_CACHED: null
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
26
|
The hash of enabled Canary features. Add to this, any canary features
|
|
@@ -76,4 +77,5 @@ export const EMBER_GLIMMER_INVOKE_HELPER = featureValue(FEATURES.EMBER_GLIMMER_I
|
|
|
76
77
|
export const EMBER_MODERNIZED_BUILT_IN_COMPONENTS = featureValue(FEATURES.EMBER_MODERNIZED_BUILT_IN_COMPONENTS);
|
|
77
78
|
export const EMBER_STRICT_MODE = featureValue(FEATURES.EMBER_STRICT_MODE);
|
|
78
79
|
export const EMBER_DYNAMIC_HELPERS_AND_MODIFIERS = featureValue(FEATURES.EMBER_DYNAMIC_HELPERS_AND_MODIFIERS);
|
|
79
|
-
export const EMBER_ROUTING_ROUTER_SERVICE_REFRESH = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE_REFRESH);
|
|
80
|
+
export const EMBER_ROUTING_ROUTER_SERVICE_REFRESH = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE_REFRESH);
|
|
81
|
+
export const EMBER_CACHED = featureValue(FEATURES.EMBER_CACHED);
|
|
@@ -2,7 +2,4 @@
|
|
|
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
4
|
export const ROUTER_EVENTS = !!'4.0.0';
|
|
5
|
-
export const JQUERY_INTEGRATION = !!'3.9.0';
|
|
6
|
-
export const APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1';
|
|
7
|
-
export const MOUSE_ENTER_LEAVE_MOVE_EVENTS = !!'3.13.0-beta.1';
|
|
8
5
|
export const ASSIGN = !!'4.0.0-beta.1';
|
|
@@ -417,17 +417,13 @@ function commonSetupRegistry(registry) {
|
|
|
417
417
|
});
|
|
418
418
|
registry.register('controller:basic', Controller, {
|
|
419
419
|
instantiate: false
|
|
420
|
-
});
|
|
421
|
-
registry.injection('renderer', '_viewRegistry', '-view-registry:main');
|
|
422
|
-
registry.injection('view:-outlet', 'namespace', 'application:main'); // Register the routing service...
|
|
420
|
+
}); // Register the routing service...
|
|
423
421
|
|
|
424
422
|
registry.register('service:-routing', RoutingService); // DEBUGGING
|
|
425
423
|
|
|
426
424
|
registry.register('resolver-for-debugging:main', registry.resolver, {
|
|
427
425
|
instantiate: false
|
|
428
426
|
});
|
|
429
|
-
registry.injection('container-debug-adapter:main', 'resolver', 'resolver-for-debugging:main'); // Custom resolver authors may want to register their own ContainerDebugAdapter with this key
|
|
430
|
-
|
|
431
427
|
registry.register('container-debug-adapter:main', ContainerDebugAdapter);
|
|
432
428
|
registry.register('component-lookup:main', ComponentLookup);
|
|
433
429
|
}
|