ember-source 3.28.5 → 4.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -10
- package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +3 -3
- package/blueprints/helper-test/index.js +4 -22
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +1 -13
- package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +0 -13
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -12
- package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -13
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -14
- package/blueprints/initializer/files/__root__/initializers/__name__.js +0 -1
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -1
- package/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/manager.js +19 -98
- package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
- package/dist/dependencies/@glimmer/runtime.js +1 -55
- package/dist/dependencies/@glimmer/validator.js +19 -51
- package/dist/ember-template-compiler.js +3692 -5667
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +12 -560
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +4357 -12470
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/bootstrap/index.js +2 -55
- package/dist/packages/@ember/-internals/container/index.js +35 -206
- package/dist/packages/@ember/-internals/environment/index.js +3 -46
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +1 -2
- package/dist/packages/@ember/-internals/glimmer/index.js +4774 -7035
- package/dist/packages/@ember/-internals/meta/lib/meta.js +2 -50
- package/dist/packages/@ember/-internals/metal/index.js +785 -1109
- package/dist/packages/@ember/-internals/overrides/index.js +1 -3
- package/dist/packages/@ember/-internals/owner/index.js +1 -19
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +1 -51
- package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -0
- package/dist/packages/@ember/-internals/routing/lib/location/history_location.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +0 -7
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +34 -2
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -3
- package/dist/packages/@ember/-internals/routing/lib/system/dsl.js +5 -6
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +192 -652
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +119 -248
- package/dist/packages/@ember/-internals/routing/lib/system/router_state.js +1 -2
- package/dist/packages/@ember/-internals/routing/lib/utils.js +1 -2
- package/dist/packages/@ember/-internals/runtime/index.js +1 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +4 -175
- package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +1 -18
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
- package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +10 -141
- package/dist/packages/@ember/-internals/utils/index.js +3 -59
- package/dist/packages/@ember/-internals/views/index.js +0 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -121
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -40
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +115 -190
- package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/pre_render.js +1 -2
- package/dist/packages/@ember/application/instance.js +3 -25
- package/dist/packages/@ember/application/lib/application.js +14 -32
- package/dist/packages/@ember/canary-features/index.js +5 -6
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/component/template-only.js +2 -0
- package/dist/packages/@ember/debug/lib/deprecate.js +7 -41
- package/dist/packages/@ember/deprecated-features/index.js +1 -14
- package/dist/packages/@ember/engine/index.js +3 -17
- package/dist/packages/@ember/engine/instance.js +0 -4
- package/dist/packages/@ember/helper/index.js +12 -4
- package/dist/packages/@ember/object/index.js +3 -101
- package/dist/packages/@ember/object/internals.js +0 -1
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +12 -384
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +9 -360
- package/dist/packages/@ember/polyfills/index.js +1 -6
- package/dist/packages/@ember/polyfills/lib/assign.js +12 -28
- package/dist/packages/@ember/routing/index.js +1 -1
- package/dist/packages/@ember/runloop/index.js +1 -83
- package/dist/packages/@ember/string/index.js +1 -206
- package/dist/packages/@ember/utils/index.js +0 -1
- package/dist/packages/ember/index.js +17 -180
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/index.js +0 -2
- package/dist/packages/ember-testing/lib/helpers.js +0 -12
- package/dist/packages/ember-testing/lib/setup_for_testing.js +0 -10
- package/docs/data.json +1637 -3659
- package/lib/index.js +14 -59
- package/lib/overrides.js +0 -61
- package/lib/transforms/inject-babel-helpers.js +1 -3
- package/package.json +27 -23
- package/dist/packages/@ember/-internals/console/index.js +0 -190
- package/dist/packages/@ember/-internals/runtime/lib/copy.js +0 -119
- package/dist/packages/@ember/-internals/runtime/lib/ext/function.js +0 -155
- package/dist/packages/@ember/-internals/runtime/lib/mixins/copyable.js +0 -31
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -357
- package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
- package/dist/packages/@ember/-internals/views/lib/system/jquery_event_deprecation.js +0 -60
- package/dist/packages/@ember/application/deprecations.js +0 -25
- package/dist/packages/@ember/application/globals-resolver.js +0 -434
- package/dist/packages/@ember/application/resolver.js +0 -1
- package/dist/packages/@ember/component/checkbox.js +0 -17
- package/dist/packages/@ember/component/text-area.js +0 -17
- package/dist/packages/@ember/component/text-field.js +0 -17
- package/dist/packages/@ember/polyfills/lib/merge.js +0 -50
- package/dist/packages/@ember/routing/link-component.js +0 -17
- package/dist/packages/ember-testing/lib/events.js +0 -102
- package/dist/packages/ember-testing/lib/helpers/-is-form-control.js +0 -19
- package/dist/packages/ember-testing/lib/helpers/click.js +0 -32
- package/dist/packages/ember-testing/lib/helpers/fill_in.js +0 -47
- package/dist/packages/ember-testing/lib/helpers/find.js +0 -40
- package/dist/packages/ember-testing/lib/helpers/find_with_assert.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/key_event.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/trigger_event.js +0 -61
- package/dist/packages/ember-testing/lib/support.js +0 -57
- package/dist/packages/jquery/index.js +0 -2
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@module @ember/application
|
|
3
|
-
*/
|
|
4
|
-
import { dictionary, getName } from '@ember/-internals/utils';
|
|
5
|
-
import { get, findNamespace } from '@ember/-internals/metal';
|
|
6
|
-
import { assert, info, deprecate } from '@ember/debug';
|
|
7
|
-
import { capitalize, classify, dasherize, decamelize } from '@ember/string';
|
|
8
|
-
import { Object as EmberObject } from '@ember/-internals/runtime';
|
|
9
|
-
import { getTemplate } from '@ember/-internals/glimmer';
|
|
10
|
-
import { DEBUG } from '@glimmer/env';
|
|
11
|
-
import { GLOBALS_RESOLVER } from '@ember/deprecated-features';
|
|
12
|
-
import { processAllNamespaces } from '@ember/-internals/metal';
|
|
13
|
-
/**
|
|
14
|
-
The DefaultResolver defines the default lookup rules to resolve
|
|
15
|
-
container lookups before consulting the container for registered
|
|
16
|
-
items:
|
|
17
|
-
|
|
18
|
-
* templates are looked up on `Ember.TEMPLATES`
|
|
19
|
-
* other names are looked up on the application after converting
|
|
20
|
-
the name. For example, `controller:post` looks up
|
|
21
|
-
`App.PostController` by default.
|
|
22
|
-
* there are some nuances (see examples below)
|
|
23
|
-
|
|
24
|
-
### How Resolving Works
|
|
25
|
-
|
|
26
|
-
The container calls this object's `resolve` method with the
|
|
27
|
-
`fullName` argument.
|
|
28
|
-
|
|
29
|
-
It first parses the fullName into an object using `parseName`.
|
|
30
|
-
|
|
31
|
-
Then it checks for the presence of a type-specific instance
|
|
32
|
-
method of the form `resolve[Type]` and calls it if it exists.
|
|
33
|
-
For example if it was resolving 'template:post', it would call
|
|
34
|
-
the `resolveTemplate` method.
|
|
35
|
-
|
|
36
|
-
Its last resort is to call the `resolveOther` method.
|
|
37
|
-
|
|
38
|
-
The methods of this object are designed to be easy to override
|
|
39
|
-
in a subclass. For example, you could enhance how a template
|
|
40
|
-
is resolved like so:
|
|
41
|
-
|
|
42
|
-
```app/app.js
|
|
43
|
-
import Application from '@ember/application';
|
|
44
|
-
import GlobalsResolver from '@ember/application/globals-resolver';
|
|
45
|
-
|
|
46
|
-
App = Application.create({
|
|
47
|
-
Resolver: GlobalsResolver.extend({
|
|
48
|
-
resolveTemplate(parsedName) {
|
|
49
|
-
let resolvedTemplate = this._super(parsedName);
|
|
50
|
-
if (resolvedTemplate) { return resolvedTemplate; }
|
|
51
|
-
|
|
52
|
-
return Ember.TEMPLATES['not_found'];
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
});
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Some examples of how names are resolved:
|
|
59
|
-
|
|
60
|
-
```text
|
|
61
|
-
'template:post' //=> Ember.TEMPLATES['post']
|
|
62
|
-
'template:posts/byline' //=> Ember.TEMPLATES['posts/byline']
|
|
63
|
-
'template:posts.byline' //=> Ember.TEMPLATES['posts/byline']
|
|
64
|
-
'template:blogPost' //=> Ember.TEMPLATES['blog-post']
|
|
65
|
-
'controller:post' //=> App.PostController
|
|
66
|
-
'controller:posts.index' //=> App.PostsIndexController
|
|
67
|
-
'controller:blog/post' //=> Blog.PostController
|
|
68
|
-
'controller:basic' //=> Controller
|
|
69
|
-
'route:post' //=> App.PostRoute
|
|
70
|
-
'route:posts.index' //=> App.PostsIndexRoute
|
|
71
|
-
'route:blog/post' //=> Blog.PostRoute
|
|
72
|
-
'route:basic' //=> Route
|
|
73
|
-
'foo:post' //=> App.PostFoo
|
|
74
|
-
'model:post' //=> App.Post
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
@class GlobalsResolver
|
|
78
|
-
@extends EmberObject
|
|
79
|
-
@public
|
|
80
|
-
@deprecated
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
let DefaultResolver;
|
|
84
|
-
|
|
85
|
-
if (GLOBALS_RESOLVER) {
|
|
86
|
-
DefaultResolver = class DefaultResolver extends EmberObject {
|
|
87
|
-
static create(props) {
|
|
88
|
-
// DO NOT REMOVE even though this doesn't do anything
|
|
89
|
-
// This is required for a FireFox 60+ JIT bug with our tests.
|
|
90
|
-
// without it, create(props) in our tests would lose props on a deopt.
|
|
91
|
-
return super.create(props);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
This will be set to the Application instance when it is
|
|
95
|
-
created.
|
|
96
|
-
@property namespace
|
|
97
|
-
@public
|
|
98
|
-
@deprecated
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
init() {
|
|
103
|
-
deprecate('Using the globals resolver is deprecated. Use the ember-resolver package instead. See https://deprecations.emberjs.com/v3.x#toc_ember-deprecate-globals-resolver', false, {
|
|
104
|
-
until: '4.0.0',
|
|
105
|
-
id: 'globals-resolver',
|
|
106
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-deprecate-globals-resolver',
|
|
107
|
-
for: 'ember-source',
|
|
108
|
-
since: {
|
|
109
|
-
enabled: '3.16.0'
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
this._parseNameCache = dictionary(null);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
normalize(fullName) {
|
|
116
|
-
let [type, name] = fullName.split(':');
|
|
117
|
-
assert('Tried to normalize a container name without a colon (:) in it. ' + 'You probably tried to lookup a name that did not contain a type, ' + 'a colon, and a name. A proper lookup name would be `view:post`.', fullName.split(':').length === 2);
|
|
118
|
-
|
|
119
|
-
if (type !== 'template') {
|
|
120
|
-
let result = name.replace(/(\.|_|-)./g, m => m.charAt(1).toUpperCase());
|
|
121
|
-
return `${type}:${result}`;
|
|
122
|
-
} else {
|
|
123
|
-
return fullName;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
This method is called via the container's resolver method.
|
|
128
|
-
It parses the provided `fullName` and then looks up and
|
|
129
|
-
returns the appropriate template or class.
|
|
130
|
-
@method resolve
|
|
131
|
-
@param {String} fullName the lookup string
|
|
132
|
-
@return {Object} the resolved factory
|
|
133
|
-
@public
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
resolve(fullName) {
|
|
138
|
-
let parsedName = this.parseName(fullName);
|
|
139
|
-
let resolveMethodName = parsedName.resolveMethodName;
|
|
140
|
-
let resolved;
|
|
141
|
-
|
|
142
|
-
if (this[resolveMethodName]) {
|
|
143
|
-
resolved = this[resolveMethodName](parsedName);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
resolved = resolved || this.resolveOther(parsedName);
|
|
147
|
-
|
|
148
|
-
if (DEBUG) {
|
|
149
|
-
if (parsedName.root && parsedName.root.LOG_RESOLVER) {
|
|
150
|
-
this._logLookup(resolved, parsedName);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (resolved) {
|
|
154
|
-
let VALIDATED_TYPES = {
|
|
155
|
-
route: ['isRouteFactory', 'Ember.Route'],
|
|
156
|
-
component: ['isComponentFactory', 'Ember.Component'],
|
|
157
|
-
view: ['isViewFactory', 'Ember.View'],
|
|
158
|
-
service: ['isServiceFactory', 'Ember.Service']
|
|
159
|
-
};
|
|
160
|
-
let validationAttributes = VALIDATED_TYPES[parsedName.type];
|
|
161
|
-
|
|
162
|
-
if (validationAttributes) {
|
|
163
|
-
let [factoryFlag, expectedType] = validationAttributes;
|
|
164
|
-
processAllNamespaces();
|
|
165
|
-
assert(`Expected ${parsedName.fullName} to resolve to an ${expectedType} but ` + `instead it was ${getName(resolved)}.`, Boolean(resolved[factoryFlag]));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return resolved;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
Convert the string name of the form 'type:name' to
|
|
174
|
-
a Javascript object with the parsed aspects of the name
|
|
175
|
-
broken out.
|
|
176
|
-
@param {String} fullName the lookup string
|
|
177
|
-
@method parseName
|
|
178
|
-
@protected
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
parseName(fullName) {
|
|
183
|
-
return this._parseNameCache[fullName] || (this._parseNameCache[fullName] = this._parseName(fullName));
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
_parseName(fullName) {
|
|
187
|
-
let [type, fullNameWithoutType] = fullName.split(':');
|
|
188
|
-
let name = fullNameWithoutType;
|
|
189
|
-
let namespace = get(this, 'namespace');
|
|
190
|
-
let root = namespace;
|
|
191
|
-
let lastSlashIndex = name.lastIndexOf('/');
|
|
192
|
-
let dirname = lastSlashIndex !== -1 ? name.slice(0, lastSlashIndex) : null;
|
|
193
|
-
|
|
194
|
-
if (type !== 'template' && lastSlashIndex !== -1) {
|
|
195
|
-
let parts = name.split('/');
|
|
196
|
-
name = parts[parts.length - 1];
|
|
197
|
-
let namespaceName = capitalize(parts.slice(0, -1).join('.'));
|
|
198
|
-
root = findNamespace(namespaceName);
|
|
199
|
-
assert(`You are looking for a ${name} ${type} in the ${namespaceName} namespace, but the namespace could not be found`, root);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
let resolveMethodName = fullNameWithoutType === 'main' ? 'Main' : classify(type);
|
|
203
|
-
|
|
204
|
-
if (!(name && type)) {
|
|
205
|
-
throw new TypeError(`Invalid fullName: \`${fullName}\`, must be of the form \`type:name\` `);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return {
|
|
209
|
-
fullName,
|
|
210
|
-
type,
|
|
211
|
-
fullNameWithoutType,
|
|
212
|
-
dirname,
|
|
213
|
-
name,
|
|
214
|
-
root,
|
|
215
|
-
resolveMethodName: `resolve${resolveMethodName}`
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
Returns a human-readable description for a fullName. Used by the
|
|
220
|
-
Application namespace in assertions to describe the
|
|
221
|
-
precise name of the class that Ember is looking for, rather than
|
|
222
|
-
container keys.
|
|
223
|
-
@param {String} fullName the lookup string
|
|
224
|
-
@method lookupDescription
|
|
225
|
-
@protected
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
lookupDescription(fullName) {
|
|
230
|
-
let parsedName = this.parseName(fullName);
|
|
231
|
-
let description;
|
|
232
|
-
|
|
233
|
-
if (parsedName.type === 'template') {
|
|
234
|
-
return `template at ${parsedName.fullNameWithoutType.replace(/\./g, '/')}`;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
description = `${parsedName.root}.${classify(parsedName.name).replace(/\./g, '')}`;
|
|
238
|
-
|
|
239
|
-
if (parsedName.type !== 'model') {
|
|
240
|
-
description += classify(parsedName.type);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return description;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
makeToString(factory) {
|
|
247
|
-
return typeof factory === 'string' ? factory : factory.name ?? '(unknown class)';
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
Given a parseName object (output from `parseName`), apply
|
|
251
|
-
the conventions expected by `Router`
|
|
252
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
253
|
-
fullName lookup string
|
|
254
|
-
@method useRouterNaming
|
|
255
|
-
@protected
|
|
256
|
-
*/
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
useRouterNaming(parsedName) {
|
|
260
|
-
if (parsedName.name === 'basic') {
|
|
261
|
-
parsedName.name = '';
|
|
262
|
-
} else {
|
|
263
|
-
parsedName.name = parsedName.name.replace(/\./g, '_');
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
Look up the template in Ember.TEMPLATES
|
|
268
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
269
|
-
fullName lookup string
|
|
270
|
-
@method resolveTemplate
|
|
271
|
-
@protected
|
|
272
|
-
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
resolveTemplate(parsedName) {
|
|
276
|
-
let templateName = parsedName.fullNameWithoutType.replace(/\./g, '/');
|
|
277
|
-
return getTemplate(templateName) || getTemplate(decamelize(templateName));
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
Lookup the view using `resolveOther`
|
|
281
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
282
|
-
fullName lookup string
|
|
283
|
-
@method resolveView
|
|
284
|
-
@protected
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
resolveView(parsedName) {
|
|
289
|
-
this.useRouterNaming(parsedName);
|
|
290
|
-
return this.resolveOther(parsedName);
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
Lookup the controller using `resolveOther`
|
|
294
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
295
|
-
fullName lookup string
|
|
296
|
-
@method resolveController
|
|
297
|
-
@protected
|
|
298
|
-
*/
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
resolveController(parsedName) {
|
|
302
|
-
this.useRouterNaming(parsedName);
|
|
303
|
-
return this.resolveOther(parsedName);
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
Lookup the route using `resolveOther`
|
|
307
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
308
|
-
fullName lookup string
|
|
309
|
-
@method resolveRoute
|
|
310
|
-
@protected
|
|
311
|
-
*/
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
resolveRoute(parsedName) {
|
|
315
|
-
this.useRouterNaming(parsedName);
|
|
316
|
-
return this.resolveOther(parsedName);
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
Lookup the model on the Application namespace
|
|
320
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
321
|
-
fullName lookup string
|
|
322
|
-
@method resolveModel
|
|
323
|
-
@protected
|
|
324
|
-
*/
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
resolveModel(parsedName) {
|
|
328
|
-
let className = classify(parsedName.name);
|
|
329
|
-
let factory = get(parsedName.root, className);
|
|
330
|
-
return factory;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
Look up the specified object (from parsedName) on the appropriate
|
|
334
|
-
namespace (usually on the Application)
|
|
335
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
336
|
-
fullName lookup string
|
|
337
|
-
@method resolveHelper
|
|
338
|
-
@protected
|
|
339
|
-
*/
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
resolveHelper(parsedName) {
|
|
343
|
-
return this.resolveOther(parsedName);
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
Look up the specified object (from parsedName) on the appropriate
|
|
347
|
-
namespace (usually on the Application)
|
|
348
|
-
@param {Object} parsedName a parseName object with the parsed
|
|
349
|
-
fullName lookup string
|
|
350
|
-
@method resolveOther
|
|
351
|
-
@protected
|
|
352
|
-
*/
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
resolveOther(parsedName) {
|
|
356
|
-
let className = classify(parsedName.name) + classify(parsedName.type);
|
|
357
|
-
let factory = get(parsedName.root, className);
|
|
358
|
-
return factory;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
resolveMain(parsedName) {
|
|
362
|
-
let className = classify(parsedName.type);
|
|
363
|
-
return get(parsedName.root, className);
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
Used to iterate all items of a given type.
|
|
367
|
-
@method knownForType
|
|
368
|
-
@param {String} type the type to search for
|
|
369
|
-
@private
|
|
370
|
-
*/
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
knownForType(type) {
|
|
374
|
-
let namespace = get(this, 'namespace');
|
|
375
|
-
let suffix = classify(type);
|
|
376
|
-
let typeRegexp = new RegExp(`${suffix}$`);
|
|
377
|
-
let known = dictionary(null);
|
|
378
|
-
let knownKeys = Object.keys(namespace);
|
|
379
|
-
|
|
380
|
-
for (let index = 0; index < knownKeys.length; index++) {
|
|
381
|
-
let name = knownKeys[index];
|
|
382
|
-
|
|
383
|
-
if (typeRegexp.test(name)) {
|
|
384
|
-
let containerName = this.translateToContainerFullname(type, name);
|
|
385
|
-
known[containerName] = true;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
return known;
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
Converts provided name from the backing namespace into a container lookup name.
|
|
393
|
-
Examples:
|
|
394
|
-
* App.FooBarHelper -> helper:foo-bar
|
|
395
|
-
* App.THelper -> helper:t
|
|
396
|
-
@method translateToContainerFullname
|
|
397
|
-
@param {String} type
|
|
398
|
-
@param {String} name
|
|
399
|
-
@private
|
|
400
|
-
*/
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
translateToContainerFullname(type, name) {
|
|
404
|
-
let suffix = classify(type);
|
|
405
|
-
let namePrefix = name.slice(0, suffix.length * -1);
|
|
406
|
-
let dasherizedName = dasherize(namePrefix);
|
|
407
|
-
return `${type}:${dasherizedName}`;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
};
|
|
411
|
-
|
|
412
|
-
if (DEBUG) {
|
|
413
|
-
/**
|
|
414
|
-
@method _logLookup
|
|
415
|
-
@param {Boolean} found
|
|
416
|
-
@param {Object} parsedName
|
|
417
|
-
@private
|
|
418
|
-
*/
|
|
419
|
-
DefaultResolver.prototype._logLookup = function (found, parsedName) {
|
|
420
|
-
let symbol = found ? '[✓]' : '[ ]';
|
|
421
|
-
let padding;
|
|
422
|
-
|
|
423
|
-
if (parsedName.fullName.length > 60) {
|
|
424
|
-
padding = '.';
|
|
425
|
-
} else {
|
|
426
|
-
padding = new Array(60 - parsedName.fullName.length).join('.');
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
info(symbol, parsedName.fullName, padding, this.lookupDescription(parsedName.fullName));
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
export default DefaultResolver;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './globals-resolver';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { deprecate } from '@ember/debug';
|
|
2
|
-
|
|
3
|
-
if (true
|
|
4
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
5
|
-
) {
|
|
6
|
-
deprecate(`Using Ember.Checkbox or importing from 'Checkbox' has been deprecated, install the ` + `\`@ember/legacy-built-in-components\` addon and use \`import { Checkbox } from ` + `'@ember/legacy-built-in-components';\` instead`, false, {
|
|
7
|
-
id: 'ember.built-in-components.import',
|
|
8
|
-
until: '4.0.0',
|
|
9
|
-
for: 'ember-source',
|
|
10
|
-
since: {
|
|
11
|
-
enabled: '3.27.0'
|
|
12
|
-
},
|
|
13
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-import'
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { Checkbox as default } from '@ember/-internals/glimmer';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { deprecate } from '@ember/debug';
|
|
2
|
-
|
|
3
|
-
if (true
|
|
4
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
5
|
-
) {
|
|
6
|
-
deprecate(`Using Ember.TextArea or importing from 'TextArea' has been deprecated, install the ` + `\`@ember/legacy-built-in-components\` addon and use \`import { TextArea } from ` + `'@ember/legacy-built-in-components';\` instead`, false, {
|
|
7
|
-
id: 'ember.built-in-components.import',
|
|
8
|
-
until: '4.0.0',
|
|
9
|
-
for: 'ember-source',
|
|
10
|
-
since: {
|
|
11
|
-
enabled: '3.27.0'
|
|
12
|
-
},
|
|
13
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-import'
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { TextArea as default } from '@ember/-internals/glimmer';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { deprecate } from '@ember/debug';
|
|
2
|
-
|
|
3
|
-
if (true
|
|
4
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
5
|
-
) {
|
|
6
|
-
deprecate(`Using Ember.TextField or importing from 'TextField' has been deprecated, install the ` + `\`@ember/legacy-built-in-components\` addon and use \`import { TextField } from ` + `'@ember/legacy-built-in-components';\` instead`, false, {
|
|
7
|
-
id: 'ember.built-in-components.import',
|
|
8
|
-
until: '4.0.0',
|
|
9
|
-
for: 'ember-source',
|
|
10
|
-
since: {
|
|
11
|
-
enabled: '3.27.0'
|
|
12
|
-
},
|
|
13
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-import'
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { TextField as default } from '@ember/-internals/glimmer';
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { deprecate } from '@ember/debug';
|
|
2
|
-
/**
|
|
3
|
-
Merge the contents of two objects together into the first object.
|
|
4
|
-
|
|
5
|
-
```javascript
|
|
6
|
-
import { merge } from '@ember/polyfills';
|
|
7
|
-
|
|
8
|
-
merge({ first: 'Tom' }, { last: 'Dale' }); // { first: 'Tom', last: 'Dale' }
|
|
9
|
-
var a = { first: 'Yehuda' };
|
|
10
|
-
var b = { last: 'Katz' };
|
|
11
|
-
merge(a, b); // a == { first: 'Yehuda', last: 'Katz' }, b == { last: 'Katz' }
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
@method merge
|
|
15
|
-
@static
|
|
16
|
-
@for @ember/polyfills
|
|
17
|
-
@param {Object} original The object to merge into
|
|
18
|
-
@param {Object} updates The object to copy properties from
|
|
19
|
-
@return {Object}
|
|
20
|
-
@deprecated
|
|
21
|
-
@public
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function merge(original, updates) {
|
|
25
|
-
deprecate('Use of `merge` has been deprecated. Please use `assign` instead.', false, {
|
|
26
|
-
id: 'ember-polyfills.deprecate-merge',
|
|
27
|
-
until: '4.0.0',
|
|
28
|
-
url: 'https://deprecations.emberjs.com/v3.x/#toc_ember-polyfills-deprecate-merge',
|
|
29
|
-
for: 'ember-source',
|
|
30
|
-
since: {
|
|
31
|
-
enabled: '3.6.0-beta.1'
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (updates === null || typeof updates !== 'object') {
|
|
36
|
-
return original;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let props = Object.keys(updates);
|
|
40
|
-
let prop;
|
|
41
|
-
|
|
42
|
-
for (let i = 0; i < props.length; i++) {
|
|
43
|
-
prop = props[i];
|
|
44
|
-
original[prop] = updates[prop];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return original;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default merge;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { deprecate } from '@ember/debug';
|
|
2
|
-
|
|
3
|
-
if (true
|
|
4
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
5
|
-
) {
|
|
6
|
-
deprecate(`Using Ember.LinkComponent or importing from 'LinkComponent' has been deprecated, install the ` + `\`@ember/legacy-built-in-components\` addon and use \`import { LinkComponent } from ` + `'@ember/legacy-built-in-components';\` instead`, false, {
|
|
7
|
-
id: 'ember.built-in-components.import',
|
|
8
|
-
until: '4.0.0',
|
|
9
|
-
for: 'ember-source',
|
|
10
|
-
since: {
|
|
11
|
-
enabled: '3.27.0'
|
|
12
|
-
},
|
|
13
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-import'
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { LinkComponent as default } from '@ember/-internals/glimmer';
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { run } from '@ember/runloop';
|
|
2
|
-
import { assign } from '@ember/polyfills';
|
|
3
|
-
import isFormControl from './helpers/-is-form-control';
|
|
4
|
-
const DEFAULT_EVENT_OPTIONS = {
|
|
5
|
-
canBubble: true,
|
|
6
|
-
cancelable: true
|
|
7
|
-
};
|
|
8
|
-
const KEYBOARD_EVENT_TYPES = ['keydown', 'keypress', 'keyup'];
|
|
9
|
-
const MOUSE_EVENT_TYPES = ['click', 'mousedown', 'mouseup', 'dblclick', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover'];
|
|
10
|
-
export function focus(el) {
|
|
11
|
-
if (!el) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (el.isContentEditable || isFormControl(el)) {
|
|
16
|
-
let type = el.getAttribute('type');
|
|
17
|
-
|
|
18
|
-
if (type !== 'checkbox' && type !== 'radio' && type !== 'hidden') {
|
|
19
|
-
run(null, function () {
|
|
20
|
-
let browserIsNotFocused = document.hasFocus && !document.hasFocus(); // makes `document.activeElement` be `element`. If the browser is focused, it also fires a focus event
|
|
21
|
-
|
|
22
|
-
el.focus(); // Firefox does not trigger the `focusin` event if the window
|
|
23
|
-
// does not have focus. If the document does not have focus then
|
|
24
|
-
// fire `focusin` event as well.
|
|
25
|
-
|
|
26
|
-
if (browserIsNotFocused) {
|
|
27
|
-
// if the browser is not focused the previous `el.focus()` didn't fire an event, so we simulate it
|
|
28
|
-
fireEvent(el, 'focus', {
|
|
29
|
-
bubbles: false
|
|
30
|
-
});
|
|
31
|
-
fireEvent(el, 'focusin');
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export function fireEvent(element, type, options = {}) {
|
|
38
|
-
if (!element) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let event;
|
|
43
|
-
|
|
44
|
-
if (KEYBOARD_EVENT_TYPES.indexOf(type) > -1) {
|
|
45
|
-
event = buildKeyboardEvent(type, options);
|
|
46
|
-
} else if (MOUSE_EVENT_TYPES.indexOf(type) > -1) {
|
|
47
|
-
let rect = element.getBoundingClientRect();
|
|
48
|
-
let x = rect.left + 1;
|
|
49
|
-
let y = rect.top + 1;
|
|
50
|
-
let simulatedCoordinates = {
|
|
51
|
-
screenX: x + 5,
|
|
52
|
-
screenY: y + 95,
|
|
53
|
-
clientX: x,
|
|
54
|
-
clientY: y
|
|
55
|
-
};
|
|
56
|
-
event = buildMouseEvent(type, assign(simulatedCoordinates, options));
|
|
57
|
-
} else {
|
|
58
|
-
event = buildBasicEvent(type, options);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
element.dispatchEvent(event);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function buildBasicEvent(type, options = {}) {
|
|
65
|
-
let event = document.createEvent('Events'); // Event.bubbles is read only
|
|
66
|
-
|
|
67
|
-
let bubbles = options.bubbles !== undefined ? options.bubbles : true;
|
|
68
|
-
let cancelable = options.cancelable !== undefined ? options.cancelable : true;
|
|
69
|
-
delete options.bubbles;
|
|
70
|
-
delete options.cancelable;
|
|
71
|
-
event.initEvent(type, bubbles, cancelable);
|
|
72
|
-
assign(event, options);
|
|
73
|
-
return event;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function buildMouseEvent(type, options = {}) {
|
|
77
|
-
let event;
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
event = document.createEvent('MouseEvents');
|
|
81
|
-
let eventOpts = assign({}, DEFAULT_EVENT_OPTIONS, options);
|
|
82
|
-
event.initMouseEvent(type, eventOpts.canBubble, eventOpts.cancelable, window, eventOpts.detail, eventOpts.screenX, eventOpts.screenY, eventOpts.clientX, eventOpts.clientY, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.button, eventOpts.relatedTarget);
|
|
83
|
-
} catch (e) {
|
|
84
|
-
event = buildBasicEvent(type, options);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return event;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function buildKeyboardEvent(type, options = {}) {
|
|
91
|
-
let event;
|
|
92
|
-
|
|
93
|
-
try {
|
|
94
|
-
event = document.createEvent('KeyEvents');
|
|
95
|
-
let eventOpts = assign({}, DEFAULT_EVENT_OPTIONS, options);
|
|
96
|
-
event.initKeyEvent(type, eventOpts.canBubble, eventOpts.cancelable, window, eventOpts.ctrlKey, eventOpts.altKey, eventOpts.shiftKey, eventOpts.metaKey, eventOpts.keyCode, eventOpts.charCode);
|
|
97
|
-
} catch (e) {
|
|
98
|
-
event = buildBasicEvent(type, options);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return event;
|
|
102
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const FORM_CONTROL_TAGS = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'];
|
|
2
|
-
/**
|
|
3
|
-
@private
|
|
4
|
-
@param {Element} element the element to check
|
|
5
|
-
@returns {boolean} `true` when the element is a form control, `false` otherwise
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export default function isFormControl(element) {
|
|
9
|
-
let {
|
|
10
|
-
tagName,
|
|
11
|
-
type
|
|
12
|
-
} = element;
|
|
13
|
-
|
|
14
|
-
if (type === 'hidden') {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return FORM_CONTROL_TAGS.indexOf(tagName) > -1;
|
|
19
|
-
}
|