ember-source 4.0.0-beta.1 → 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 +72 -0
- 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 +383 -961
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +4 -513
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +3246 -8084
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +17 -183
- package/dist/packages/@ember/-internals/environment/index.js +0 -27
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
- package/dist/packages/@ember/-internals/glimmer/index.js +4827 -6812
- package/dist/packages/@ember/-internals/metal/index.js +21 -45
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +8 -0
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +1 -41
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +22 -91
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +2 -173
- 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 +4 -90
- package/dist/packages/@ember/-internals/utils/index.js +0 -3
- package/dist/packages/@ember/-internals/views/index.js +0 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -4
- 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 +14 -32
- package/dist/packages/@ember/canary-features/index.js +0 -2
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/deprecated-features/index.js +0 -4
- package/dist/packages/@ember/engine/index.js +2 -7
- 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/routing/index.js +1 -1
- package/dist/packages/ember/index.js +9 -62
- 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 +598 -1901
- package/lib/index.js +13 -51
- package/package.json +18 -18
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -345
- package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
- 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/routing/link-component.js +0 -17
- package/dist/packages/ember-testing/lib/events.js +0 -101
- 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,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@module @ember/array
|
|
3
3
|
*/
|
|
4
|
-
import { get, objectAt, alias, PROPERTY_DID_CHANGE, addArrayObserver, removeArrayObserver, replace, arrayContentDidChange, tagForProperty } from '@ember/-internals/metal';
|
|
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
7
|
import { isArray, MutableArray } from '../mixins/array';
|
|
@@ -237,11 +237,11 @@ export default class ArrayProxy extends EmberObject {
|
|
|
237
237
|
|
|
238
238
|
this._removeArrangedContentArrayObserver();
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
arrayContentWillChange(this, 0, oldLength, newLength);
|
|
241
241
|
|
|
242
242
|
this._invalidate();
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
arrayContentDidChange(this, 0, oldLength, newLength, false);
|
|
245
245
|
|
|
246
246
|
this._addArrangedContentArrayObserver(arrangedContent);
|
|
247
247
|
}
|
|
@@ -250,21 +250,21 @@ export default class ArrayProxy extends EmberObject {
|
|
|
250
250
|
if (arrangedContent && !arrangedContent.isDestroyed) {
|
|
251
251
|
assert("Can't set ArrayProxy's content to itself", arrangedContent !== this);
|
|
252
252
|
assert(`ArrayProxy expects an Array or ArrayProxy, but you passed ${typeof arrangedContent}`, isArray(arrangedContent) || arrangedContent.isDestroyed);
|
|
253
|
-
addArrayObserver(arrangedContent, this, ARRAY_OBSERVER_MAPPING
|
|
253
|
+
addArrayObserver(arrangedContent, this, ARRAY_OBSERVER_MAPPING);
|
|
254
254
|
this._arrangedContent = arrangedContent;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
_removeArrangedContentArrayObserver() {
|
|
259
259
|
if (this._arrangedContent) {
|
|
260
|
-
removeArrayObserver(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING
|
|
260
|
+
removeArrayObserver(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
_arrangedContentArrayWillChange() {}
|
|
265
265
|
|
|
266
266
|
_arrangedContentArrayDidChange(proxy, idx, removedCnt, addedCnt) {
|
|
267
|
-
|
|
267
|
+
arrayContentWillChange(this, idx, removedCnt, addedCnt);
|
|
268
268
|
let dirtyIndex = idx;
|
|
269
269
|
|
|
270
270
|
if (dirtyIndex < 0) {
|
|
@@ -277,7 +277,7 @@ export default class ArrayProxy extends EmberObject {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
this._lengthDirty = true;
|
|
280
|
-
|
|
280
|
+
arrayContentDidChange(this, idx, removedCnt, addedCnt, false);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
_invalidate() {
|
|
@@ -324,12 +324,5 @@ ArrayProxy.reopen(MutableArray, {
|
|
|
324
324
|
@property arrangedContent
|
|
325
325
|
@public
|
|
326
326
|
*/
|
|
327
|
-
arrangedContent: alias('content')
|
|
328
|
-
|
|
329
|
-
// Array proxies don't need to notify when they change since their `[]` tag is
|
|
330
|
-
// already dependent on the `[]` tag of `arrangedContent`
|
|
331
|
-
arrayContentDidChange(startIdx, removeAmt, addAmt) {
|
|
332
|
-
return arrayContentDidChange(this, startIdx, removeAmt, addAmt, false);
|
|
333
|
-
}
|
|
334
|
-
|
|
327
|
+
arrangedContent: alias('content')
|
|
335
328
|
});
|
|
@@ -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,8 +1,6 @@
|
|
|
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';
|
|
5
|
-
export { default as TextSupport } from './lib/mixins/text_support';
|
|
6
4
|
export { default as CoreView } from './lib/views/core_view';
|
|
7
5
|
export { default as ClassNamesSupport } from './lib/mixins/class_names_support';
|
|
8
6
|
export { default as ChildViewsSupport } from './lib/mixins/child_views_support';
|
|
@@ -146,7 +146,7 @@ let mixin = {
|
|
|
146
146
|
the target element you are providing is associated with an `Application`
|
|
147
147
|
and does not have an ancestor element that is associated with an Ember view.
|
|
148
148
|
@method appendTo
|
|
149
|
-
@param {String|DOMElement
|
|
149
|
+
@param {String|DOMElement} A selector, element, HTML string
|
|
150
150
|
@return {Ember.View} receiver
|
|
151
151
|
@private
|
|
152
152
|
*/
|
|
@@ -172,8 +172,8 @@ let mixin = {
|
|
|
172
172
|
})());
|
|
173
173
|
} else {
|
|
174
174
|
target = selector;
|
|
175
|
-
assert(`You tried to append to a selector string (${selector}) in an environment without
|
|
176
|
-
assert(`You tried to append to a non-Element (${selector}) in an environment without
|
|
175
|
+
assert(`You tried to append to a selector string (${selector}) in an environment without a DOM`, typeof target !== 'string');
|
|
176
|
+
assert(`You tried to append to a non-Element (${selector}) in an environment without a DOM`, typeof selector.appendChild === 'function');
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
this.renderer.appendTo(this, target);
|
|
@@ -303,7 +303,7 @@ let mixin = {
|
|
|
303
303
|
Component properties that depend on the presence of an outer element, such
|
|
304
304
|
as `classNameBindings` and `attributeBindings`, do not work with tagless
|
|
305
305
|
components. Tagless components cannot implement methods to handle events,
|
|
306
|
-
and
|
|
306
|
+
and their `element` property has a `null` value.
|
|
307
307
|
@property tagName
|
|
308
308
|
@type String
|
|
309
309
|
@default null
|
|
@@ -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
|
|
@@ -112,7 +110,7 @@ let librariesRegistered = false;
|
|
|
112
110
|
});
|
|
113
111
|
```
|
|
114
112
|
|
|
115
|
-
The `rootElement` can be either a DOM element or a
|
|
113
|
+
The `rootElement` can be either a DOM element or a CSS selector
|
|
116
114
|
string. Note that *views appended to the DOM outside the root element will
|
|
117
115
|
not receive events.* If you specify a custom root element, make sure you only
|
|
118
116
|
append views inside it!
|
|
@@ -176,8 +174,7 @@ let librariesRegistered = false;
|
|
|
176
174
|
const Application = Engine.extend({
|
|
177
175
|
/**
|
|
178
176
|
The root DOM element of the Application. This can be specified as an
|
|
179
|
-
element or a
|
|
180
|
-
[jQuery-compatible selector string](http://api.jquery.com/category/selectors/).
|
|
177
|
+
element or a [selector string](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors#reference_table_of_selectors).
|
|
181
178
|
This is the element that will be passed to the Application's,
|
|
182
179
|
`eventDispatcher`, which sets up the listeners for event delegation. Every
|
|
183
180
|
view in your application should be a child of the element you specify here.
|
|
@@ -316,12 +313,6 @@ const Application = Engine.extend({
|
|
|
316
313
|
// eslint-disable-line no-unused-vars
|
|
317
314
|
this._super(...arguments);
|
|
318
315
|
|
|
319
|
-
if (!this.$) {
|
|
320
|
-
this.$ = jQuery;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
registerLibraries();
|
|
324
|
-
|
|
325
316
|
if (DEBUG) {
|
|
326
317
|
if (ENV.LOG_VERSION) {
|
|
327
318
|
// we only need to see this once per Application#init
|
|
@@ -489,10 +480,10 @@ const Application = Engine.extend({
|
|
|
489
480
|
import Application from '@ember/application';
|
|
490
481
|
let App = Application.create();
|
|
491
482
|
App.deferReadiness();
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
App.token = token;
|
|
483
|
+
fetch('/auth-token')
|
|
484
|
+
.then(response => response.json())
|
|
485
|
+
.then(data => {
|
|
486
|
+
App.token = data.token;
|
|
496
487
|
App.advanceReadiness();
|
|
497
488
|
});
|
|
498
489
|
```
|
|
@@ -839,7 +830,7 @@ const Application = Engine.extend({
|
|
|
839
830
|
in the non-browser environment, the stand-in `document` object only needs to
|
|
840
831
|
implement a limited subset of the full DOM API. The `SimpleDOM` library is known
|
|
841
832
|
to work.
|
|
842
|
-
Since there is no access
|
|
833
|
+
Since there is no DOM access in the non-browser environment, you must also
|
|
843
834
|
specify a DOM `Element` object in the same `document` for the `rootElement` option
|
|
844
835
|
(as opposed to a selector string like `"body"`).
|
|
845
836
|
See the documentation on the `isBrowser`, `document` and `rootElement` properties
|
|
@@ -862,7 +853,6 @@ const Application = Engine.extend({
|
|
|
862
853
|
} else { // node
|
|
863
854
|
application.register('service:network', NodeNetworkService);
|
|
864
855
|
}
|
|
865
|
-
application.inject('route', 'network', 'service:network');
|
|
866
856
|
};
|
|
867
857
|
export default {
|
|
868
858
|
name: 'network-service',
|
|
@@ -871,11 +861,13 @@ const Application = Engine.extend({
|
|
|
871
861
|
```
|
|
872
862
|
```app/routes/post.js
|
|
873
863
|
import Route from '@ember/routing/route';
|
|
864
|
+
import { inject as service } from '@ember/service';
|
|
874
865
|
// An example of how the (hypothetical) service is used in routes.
|
|
875
|
-
export default Route
|
|
876
|
-
|
|
866
|
+
export default class IndexRoute extends Route {
|
|
867
|
+
@service network;
|
|
868
|
+
model(params) {
|
|
877
869
|
return this.network.fetch(`/api/posts/${params.post_id}.json`);
|
|
878
|
-
}
|
|
870
|
+
}
|
|
879
871
|
afterModel(post) {
|
|
880
872
|
if (post.isExternalContent) {
|
|
881
873
|
return this.network.fetch(`/api/external/?url=${post.externalURL}`);
|
|
@@ -883,7 +875,7 @@ const Application = Engine.extend({
|
|
|
883
875
|
return post;
|
|
884
876
|
}
|
|
885
877
|
}
|
|
886
|
-
}
|
|
878
|
+
}
|
|
887
879
|
```
|
|
888
880
|
```javascript
|
|
889
881
|
// Finally, put all the pieces together
|
|
@@ -970,14 +962,4 @@ function commonSetupRegistry(registry) {
|
|
|
970
962
|
registry.register('service:router', RouterService);
|
|
971
963
|
}
|
|
972
964
|
|
|
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
965
|
export default Application;
|
|
@@ -16,7 +16,6 @@ export const DEFAULT_FEATURES = {
|
|
|
16
16
|
EMBER_NAMED_BLOCKS: true,
|
|
17
17
|
EMBER_GLIMMER_HELPER_MANAGER: true,
|
|
18
18
|
EMBER_GLIMMER_INVOKE_HELPER: true,
|
|
19
|
-
EMBER_MODERNIZED_BUILT_IN_COMPONENTS: true,
|
|
20
19
|
EMBER_STRICT_MODE: true,
|
|
21
20
|
EMBER_DYNAMIC_HELPERS_AND_MODIFIERS: true,
|
|
22
21
|
EMBER_ROUTING_ROUTER_SERVICE_REFRESH: false
|
|
@@ -73,7 +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
76
|
export const EMBER_DYNAMIC_HELPERS_AND_MODIFIERS = featureValue(FEATURES.EMBER_DYNAMIC_HELPERS_AND_MODIFIERS);
|
|
79
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';
|
|
@@ -1,8 +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 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
4
|
export const ASSIGN = !!'4.0.0-beta.1';
|
|
@@ -292,7 +292,6 @@ Engine.reopenClass({
|
|
|
292
292
|
and after.
|
|
293
293
|
Example instanceInitializer to preload data into the store.
|
|
294
294
|
```app/initializer/preload-data.js
|
|
295
|
-
import $ from 'jquery';
|
|
296
295
|
export function initialize(application) {
|
|
297
296
|
var userConfig, userConfigEncoded, store;
|
|
298
297
|
// We have a HTML escaped JSON representation of the user's basic
|
|
@@ -303,7 +302,7 @@ Engine.reopenClass({
|
|
|
303
302
|
// like all local models and data can be manipulated by the user, so it
|
|
304
303
|
// should not be relied upon for security or authorization.
|
|
305
304
|
// Grab the encoded data from the meta tag
|
|
306
|
-
userConfigEncoded =
|
|
305
|
+
userConfigEncoded = document.querySelector('head meta[name=app-user-config]').attr('content');
|
|
307
306
|
// Unescape the text, then parse the resulting JSON into a real object
|
|
308
307
|
userConfig = JSON.parse(unescape(userConfigEncoded));
|
|
309
308
|
// Lookup the store
|
|
@@ -417,17 +416,13 @@ function commonSetupRegistry(registry) {
|
|
|
417
416
|
});
|
|
418
417
|
registry.register('controller:basic', Controller, {
|
|
419
418
|
instantiate: false
|
|
420
|
-
});
|
|
421
|
-
registry.injection('renderer', '_viewRegistry', '-view-registry:main');
|
|
422
|
-
registry.injection('view:-outlet', 'namespace', 'application:main'); // Register the routing service...
|
|
419
|
+
}); // Register the routing service...
|
|
423
420
|
|
|
424
421
|
registry.register('service:-routing', RoutingService); // DEBUGGING
|
|
425
422
|
|
|
426
423
|
registry.register('resolver-for-debugging:main', registry.resolver, {
|
|
427
424
|
instantiate: false
|
|
428
425
|
});
|
|
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
426
|
registry.register('container-debug-adapter:main', ContainerDebugAdapter);
|
|
432
427
|
registry.register('component-lookup:main', ComponentLookup);
|
|
433
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
|
});
|