ember-source 4.1.0-alpha.4 → 4.1.0-alpha.8
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 +88 -56
- 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/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/validator.js +19 -51
- package/dist/ember-template-compiler.js +378 -696
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +3299 -6328
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +1 -1
- package/dist/packages/@ember/-internals/environment/index.js +0 -15
- package/dist/packages/@ember/-internals/glimmer/index.js +4824 -6772
- package/dist/packages/@ember/-internals/metal/index.js +57 -103
- package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +1 -0
- package/dist/packages/@ember/-internals/routing/lib/location/api.js +10 -1
- package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +7 -2
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +8 -8
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +5 -43
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +36 -46
- 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/utils/index.js +0 -3
- package/dist/packages/@ember/-internals/views/index.js +0 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -4
- package/dist/packages/@ember/application/lib/application.js +8 -9
- package/dist/packages/@ember/canary-features/index.js +1 -3
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/deprecated-features/index.js +0 -1
- package/dist/packages/@ember/destroyable/index.js +15 -4
- package/dist/packages/@ember/engine/index.js +1 -2
- package/dist/packages/@ember/routing/index.js +1 -1
- package/dist/packages/@ember/service/index.js +19 -5
- package/dist/packages/@glimmer/tracking/index.js +203 -1
- package/dist/packages/ember/index.js +11 -63
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +459 -1384
- package/lib/index.js +13 -76
- package/package.json +19 -20
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -345
- 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/jquery/index.js +0 -2
package/lib/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const MergeTrees = require('broccoli-merge-trees');
|
|
4
4
|
const Funnel = require('broccoli-funnel');
|
|
5
5
|
const path = require('path');
|
|
6
|
-
const resolve = require('resolve');
|
|
7
6
|
const concatBundle = require('./concat-bundle');
|
|
8
7
|
const buildDebugMacroPlugin = require('./build-debug-macro-plugin');
|
|
9
8
|
const buildStripClassCallcheckPlugin = require('./build-strip-class-callcheck-plugin');
|
|
@@ -11,6 +10,7 @@ const injectBabelHelpers = require('./transforms/inject-babel-helpers').injectBa
|
|
|
11
10
|
const debugTree = require('broccoli-debug').buildDebugCallback('ember-source:addon');
|
|
12
11
|
const vmBabelPlugins = require('@glimmer/vm-babel-plugins');
|
|
13
12
|
const Overrides = require('./overrides');
|
|
13
|
+
const SilentError = require('silent-error');
|
|
14
14
|
|
|
15
15
|
const PRE_BUILT_TARGETS = [
|
|
16
16
|
'last 1 Chrome versions',
|
|
@@ -33,7 +33,6 @@ function add(paths, name, path) {
|
|
|
33
33
|
add(paths, 'prod', 'vendor/ember/ember.js');
|
|
34
34
|
add(paths, 'debug', 'vendor/ember/ember.js');
|
|
35
35
|
add(paths, 'testing', 'vendor/ember/ember-testing.js');
|
|
36
|
-
add(paths, 'jquery', 'vendor/ember/jquery/jquery.js');
|
|
37
36
|
|
|
38
37
|
add(
|
|
39
38
|
absolutePaths,
|
|
@@ -45,13 +44,6 @@ module.exports = {
|
|
|
45
44
|
init() {
|
|
46
45
|
this._super.init && this._super.init.apply(this, arguments);
|
|
47
46
|
|
|
48
|
-
if ('ember' in this.project.bowerDependencies()) {
|
|
49
|
-
// TODO: move this to a throw soon.
|
|
50
|
-
this.ui.writeWarnLine(
|
|
51
|
-
'Ember.js is now provided by node_module `ember-source`, please remove it from bower'
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
47
|
// resets `this.root` to the correct location by default ember-cli
|
|
56
48
|
// considers `__dirname` here to be the root, but since our main entry
|
|
57
49
|
// point is within a subfolder we need to correct that
|
|
@@ -65,7 +57,6 @@ module.exports = {
|
|
|
65
57
|
name: 'ember-source',
|
|
66
58
|
paths,
|
|
67
59
|
absolutePaths,
|
|
68
|
-
_jqueryIntegrationEnabled: true,
|
|
69
60
|
_overrideTree: undefined,
|
|
70
61
|
|
|
71
62
|
included() {
|
|
@@ -95,25 +86,6 @@ module.exports = {
|
|
|
95
86
|
);
|
|
96
87
|
}
|
|
97
88
|
|
|
98
|
-
if (
|
|
99
|
-
optionalFeaturesMissing ||
|
|
100
|
-
typeof optionalFeatures.isFeatureExplicitlySet !== 'function'
|
|
101
|
-
) {
|
|
102
|
-
message.push(
|
|
103
|
-
'* Unable to detect if jquery-integration is explicitly set to a value, please update `@ember/optional-features` to the latest version'
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
optionalFeaturesMissing ||
|
|
109
|
-
(typeof optionalFeatures.isFeatureExplicitlySet === 'function' &&
|
|
110
|
-
!optionalFeatures.isFeatureExplicitlySet('jquery-integration'))
|
|
111
|
-
) {
|
|
112
|
-
message.push(
|
|
113
|
-
`* The jquery-integration optional feature should be explicitly set to a value under Octane, run \`ember feature:disable jquery-integration\` to disable it, or \`ember feature:enable jquery-integration\` to explicitly enable it`
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
89
|
if (
|
|
118
90
|
optionalFeaturesMissing ||
|
|
119
91
|
optionalFeatures.isFeatureEnabled('application-template-wrapper')
|
|
@@ -137,39 +109,22 @@ module.exports = {
|
|
|
137
109
|
`You have configured your application to indicate that it is using the 'octane' edition (via \`setEdition('octane')\`), but the appropriate Octane features were not enabled:\n`
|
|
138
110
|
);
|
|
139
111
|
|
|
140
|
-
const SilentError = require('silent-error');
|
|
141
112
|
throw new SilentError(message.join('\n\t'));
|
|
142
113
|
}
|
|
143
114
|
} else {
|
|
144
|
-
|
|
145
|
-
'The Ember Classic edition has been
|
|
115
|
+
throw new SilentError(
|
|
116
|
+
'The Ember Classic edition has been removed. Specifying "classic" in your package.json, or not specifying a value at all, is no longer supported. You must explicitly set the "ember.edition" property to "octane". You can also run `npx @ember/octanify` to do this. \n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_editions-classic'
|
|
146
117
|
);
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
optionalFeaturesMissing ||
|
|
150
|
-
optionalFeatures.isFeatureEnabled('application-template-wrapper')
|
|
151
|
-
) {
|
|
152
|
-
this.ui.writeWarnLine(
|
|
153
|
-
'Setting the `application-template-wrapper` optional feature flag to `true`, or not providing a setting at all, has been deprecated. You must add the `@ember/optional-features` addon and set this feature to `false`. You can also run `npx @ember/octanify` to do this. This warning will become an error in Ember 4.0.0.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_optional-feature-application-template-wrapper'
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
optionalFeaturesMissing ||
|
|
159
|
-
!optionalFeatures.isFeatureEnabled('template-only-glimmer-components')
|
|
160
|
-
) {
|
|
161
|
-
this.ui.writeWarnLine(
|
|
162
|
-
'Setting the `template-only-glimmer-components` optional feature flag to `false`, or not providing a setting at all, has been deprecated. You must add the `@ember/optional-features` addon and set this feature to `true`. You can also run `npx @ember/octanify` to do this. This warning will become an error in Ember 4.0.0.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_optional-feature-template-only-glimmer-components'
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
118
|
}
|
|
166
119
|
|
|
167
|
-
|
|
168
|
-
optionalFeaturesMissing
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
120
|
+
if (
|
|
121
|
+
!optionalFeaturesMissing &&
|
|
122
|
+
optionalFeatures.isFeatureEnabled('jquery-integration') &&
|
|
123
|
+
typeof optionalFeatures.isFeatureExplicitlySet === 'function' &&
|
|
124
|
+
optionalFeatures.isFeatureExplicitlySet('jquery-integration')
|
|
125
|
+
) {
|
|
126
|
+
throw new SilentError(
|
|
127
|
+
'Setting the `jquery-integration` optional feature flag to `true` was deprecated in Ember 3.x and removed in Ember 4.0.0. You must add the `@ember/optional-features` addon and set this feature to `false`.\n\nFor more information, see the deprecation guide: https://deprecations.emberjs.com/v3.x/#toc_optional-feature-jquery-integration'
|
|
173
128
|
);
|
|
174
129
|
}
|
|
175
130
|
},
|
|
@@ -237,10 +192,7 @@ module.exports = {
|
|
|
237
192
|
false
|
|
238
193
|
);
|
|
239
194
|
|
|
240
|
-
let exclude = [
|
|
241
|
-
isProduction ? 'ember-testing/**' : null,
|
|
242
|
-
!this._jqueryIntegrationEnabled ? 'jquery' : null,
|
|
243
|
-
].filter((value) => value !== null);
|
|
195
|
+
let exclude = isProduction ? ['ember-testing/**'] : [];
|
|
244
196
|
|
|
245
197
|
let emberFiles = new MergeTrees([new Funnel(packages, { exclude }), dependencies, headerFiles]);
|
|
246
198
|
|
|
@@ -270,21 +222,6 @@ module.exports = {
|
|
|
270
222
|
},
|
|
271
223
|
|
|
272
224
|
treeForVendor(tree) {
|
|
273
|
-
let jqueryPath;
|
|
274
|
-
|
|
275
|
-
try {
|
|
276
|
-
jqueryPath = path.dirname(
|
|
277
|
-
resolve.sync('jquery/package.json', { basedir: this.project.root })
|
|
278
|
-
);
|
|
279
|
-
} catch (error) {
|
|
280
|
-
jqueryPath = path.dirname(require.resolve('jquery/package.json'));
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
let jquery = new Funnel(jqueryPath + '/dist', {
|
|
284
|
-
destDir: 'ember/jquery',
|
|
285
|
-
files: ['jquery.js'],
|
|
286
|
-
});
|
|
287
|
-
|
|
288
225
|
let templateCompiler = new Funnel(tree, {
|
|
289
226
|
destDir: 'ember',
|
|
290
227
|
include: ['ember-template-compiler.js', 'ember-template-compiler.map'],
|
|
@@ -319,6 +256,6 @@ module.exports = {
|
|
|
319
256
|
});
|
|
320
257
|
}
|
|
321
258
|
|
|
322
|
-
return debugTree(new MergeTrees([ember, templateCompiler
|
|
259
|
+
return debugTree(new MergeTrees([ember, templateCompiler]), 'vendor:final');
|
|
323
260
|
},
|
|
324
261
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-source",
|
|
3
|
-
"version": "4.1.0-alpha.
|
|
3
|
+
"version": "4.1.0-alpha.8",
|
|
4
4
|
"description": "A JavaScript framework for creating ambitious web applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"test:browserstack": "node bin/run-browserstack-tests.js"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@babel/helper-module-imports": "^7.
|
|
51
|
-
"@babel/plugin-transform-block-scoping": "^7.
|
|
50
|
+
"@babel/helper-module-imports": "^7.16.0",
|
|
51
|
+
"@babel/plugin-transform-block-scoping": "^7.16.0",
|
|
52
52
|
"@ember/edition-utils": "^1.2.0",
|
|
53
|
-
"@glimmer/vm-babel-plugins": "0.
|
|
53
|
+
"@glimmer/vm-babel-plugins": "0.83.1",
|
|
54
54
|
"babel-plugin-debug-macros": "^0.3.4",
|
|
55
55
|
"babel-plugin-filter-imports": "^4.0.0",
|
|
56
56
|
"broccoli-concat": "^4.2.5",
|
|
@@ -69,26 +69,25 @@
|
|
|
69
69
|
"ember-cli-version-checker": "^5.1.1",
|
|
70
70
|
"ember-router-generator": "^2.0.0",
|
|
71
71
|
"inflection": "^1.13.1",
|
|
72
|
-
"jquery": "^3.5.1",
|
|
73
72
|
"resolve": "^1.17.0",
|
|
74
73
|
"semver": "^7.3.4",
|
|
75
74
|
"silent-error": "^1.1.1"
|
|
76
75
|
},
|
|
77
76
|
"devDependencies": {
|
|
78
77
|
"@babel/preset-env": "^7.9.5",
|
|
79
|
-
"@glimmer/compiler": "0.
|
|
80
|
-
"@glimmer/destroyable": "0.
|
|
78
|
+
"@glimmer/compiler": "0.83.1",
|
|
79
|
+
"@glimmer/destroyable": "0.83.1",
|
|
81
80
|
"@glimmer/env": "^0.1.7",
|
|
82
|
-
"@glimmer/global-context": "0.
|
|
83
|
-
"@glimmer/interfaces": "0.
|
|
84
|
-
"@glimmer/manager": "0.
|
|
85
|
-
"@glimmer/node": "0.
|
|
86
|
-
"@glimmer/opcode-compiler": "0.
|
|
87
|
-
"@glimmer/owner": "0.
|
|
88
|
-
"@glimmer/program": "0.
|
|
89
|
-
"@glimmer/reference": "0.
|
|
90
|
-
"@glimmer/runtime": "0.
|
|
91
|
-
"@glimmer/validator": "0.
|
|
81
|
+
"@glimmer/global-context": "0.83.1",
|
|
82
|
+
"@glimmer/interfaces": "0.83.1",
|
|
83
|
+
"@glimmer/manager": "0.83.1",
|
|
84
|
+
"@glimmer/node": "0.83.1",
|
|
85
|
+
"@glimmer/opcode-compiler": "0.83.1",
|
|
86
|
+
"@glimmer/owner": "0.83.1",
|
|
87
|
+
"@glimmer/program": "0.83.1",
|
|
88
|
+
"@glimmer/reference": "0.83.1",
|
|
89
|
+
"@glimmer/runtime": "0.83.1",
|
|
90
|
+
"@glimmer/validator": "0.83.1",
|
|
92
91
|
"@simple-dom/document": "^1.4.0",
|
|
93
92
|
"@types/qunit": "^2.11.1",
|
|
94
93
|
"@types/rsvp": "^4.0.4",
|
|
@@ -131,7 +130,7 @@
|
|
|
131
130
|
"fs-extra": "^9.1.0",
|
|
132
131
|
"git-repo-info": "^2.1.1",
|
|
133
132
|
"github": "^0.2.3",
|
|
134
|
-
"glob": "^7.
|
|
133
|
+
"glob": "^7.2.0",
|
|
135
134
|
"html-differ": "^1.4.0",
|
|
136
135
|
"lodash.uniq": "^4.5.0",
|
|
137
136
|
"mkdirp": "^1.0.4",
|
|
@@ -146,7 +145,7 @@
|
|
|
146
145
|
"rsvp": "^4.8.5",
|
|
147
146
|
"serve-static": "^1.14.1",
|
|
148
147
|
"simple-dom": "^1.4.0",
|
|
149
|
-
"testem": "^3.
|
|
148
|
+
"testem": "^3.6.0",
|
|
150
149
|
"testem-failure-only-reporter": "^0.0.1",
|
|
151
150
|
"tslint": "^5.20.1",
|
|
152
151
|
"typescript": "^4.2.4"
|
|
@@ -157,7 +156,7 @@
|
|
|
157
156
|
"ember-addon": {
|
|
158
157
|
"after": "ember-cli-legacy-blueprints"
|
|
159
158
|
},
|
|
160
|
-
"_originalVersion": "4.1.0-alpha.
|
|
159
|
+
"_originalVersion": "4.1.0-alpha.8",
|
|
161
160
|
"_versionPreviouslyCalculated": true,
|
|
162
161
|
"publishConfig": {
|
|
163
162
|
"tag": "alpha"
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
@module ember
|
|
3
|
-
*/
|
|
4
|
-
import { get, set, Mixin } from '@ember/-internals/metal';
|
|
5
|
-
import { deprecate } from '@ember/debug';
|
|
6
|
-
import { MUTABLE_CELL } from '@ember/-internals/views';
|
|
7
|
-
import { DEBUG } from '@glimmer/env';
|
|
8
|
-
|
|
9
|
-
if (DEBUG && true
|
|
10
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
11
|
-
) {
|
|
12
|
-
Mixin._disableDebugSeal = true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const KEY_EVENTS = {
|
|
16
|
-
Enter: 'insertNewline',
|
|
17
|
-
Escape: 'cancel'
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
`TextSupport` is a shared mixin used by both `TextField` and
|
|
21
|
-
`TextArea`. `TextSupport` adds a number of methods that allow you to
|
|
22
|
-
specify a controller action to invoke when a certain event is fired on your
|
|
23
|
-
text field or textarea. The specified controller action would get the current
|
|
24
|
-
value of the field passed in as the only argument unless the value of
|
|
25
|
-
the field is empty. In that case, the instance of the field itself is passed
|
|
26
|
-
in as the only argument.
|
|
27
|
-
|
|
28
|
-
Let's use the pressing of the escape key as an example. If you wanted to
|
|
29
|
-
invoke a controller action when a user presses the escape key while on your
|
|
30
|
-
field, you would use the `escape-press` attribute on your field like so:
|
|
31
|
-
|
|
32
|
-
```handlebars
|
|
33
|
-
{{! application.hbs}}
|
|
34
|
-
|
|
35
|
-
{{input escape-press='alertUser'}}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
```javascript
|
|
39
|
-
import Application from '@ember/application';
|
|
40
|
-
import Controller from '@ember/controller';
|
|
41
|
-
App = Application.create();
|
|
42
|
-
|
|
43
|
-
App.ApplicationController = Controller.extend({
|
|
44
|
-
actions: {
|
|
45
|
-
alertUser: function ( currentValue ) {
|
|
46
|
-
alert( 'escape pressed, current value: ' + currentValue );
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The following chart is a visual representation of what takes place when the
|
|
53
|
-
escape key is pressed in this scenario:
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
The Template
|
|
57
|
-
+---------------------------+
|
|
58
|
-
| |
|
|
59
|
-
| escape-press='alertUser' |
|
|
60
|
-
| | TextSupport Mixin
|
|
61
|
-
+----+----------------------+ +-------------------------------+
|
|
62
|
-
| | cancel method |
|
|
63
|
-
| escape button pressed | |
|
|
64
|
-
+-------------------------------> | checks for the `escape-press` |
|
|
65
|
-
| attribute and pulls out the |
|
|
66
|
-
+-------------------------------+ | `alertUser` value |
|
|
67
|
-
| action name 'alertUser' +-------------------------------+
|
|
68
|
-
| sent to controller
|
|
69
|
-
v
|
|
70
|
-
Controller
|
|
71
|
-
+------------------------------------------ +
|
|
72
|
-
| |
|
|
73
|
-
| actions: { |
|
|
74
|
-
| alertUser: function( currentValue ){ |
|
|
75
|
-
| alert( 'the esc key was pressed!' ) |
|
|
76
|
-
| } |
|
|
77
|
-
| } |
|
|
78
|
-
| |
|
|
79
|
-
+-------------------------------------------+
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Here are the events that we currently support along with the name of the
|
|
83
|
-
attribute you would need to use on your field. To reiterate, you would use the
|
|
84
|
-
attribute name like so:
|
|
85
|
-
|
|
86
|
-
```handlebars
|
|
87
|
-
{{input attribute-name='controllerAction'}}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
+--------------------+----------------+
|
|
92
|
-
| | |
|
|
93
|
-
| event | attribute name |
|
|
94
|
-
+--------------------+----------------+
|
|
95
|
-
| new line inserted | insert-newline |
|
|
96
|
-
| | |
|
|
97
|
-
| enter key pressed | enter |
|
|
98
|
-
| | |
|
|
99
|
-
| cancel key pressed | escape-press |
|
|
100
|
-
| | |
|
|
101
|
-
| focusin | focus-in |
|
|
102
|
-
| | |
|
|
103
|
-
| focusout | focus-out |
|
|
104
|
-
| | |
|
|
105
|
-
| keypress | key-press |
|
|
106
|
-
| | |
|
|
107
|
-
| keyup | key-up |
|
|
108
|
-
| | |
|
|
109
|
-
| keydown | key-down |
|
|
110
|
-
+--------------------+----------------+
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
@class TextSupport
|
|
114
|
-
@namespace Ember
|
|
115
|
-
@uses Ember.TargetActionSupport
|
|
116
|
-
@extends Mixin
|
|
117
|
-
@private
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
const TextSupport = Mixin.create({
|
|
121
|
-
value: '',
|
|
122
|
-
attributeBindings: ['autocapitalize', 'autocorrect', 'autofocus', 'disabled', 'form', 'maxlength', 'minlength', 'placeholder', 'readonly', 'required', 'selectionDirection', 'spellcheck', 'tabindex', 'title'],
|
|
123
|
-
placeholder: null,
|
|
124
|
-
disabled: false,
|
|
125
|
-
maxlength: null,
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
Whether the `keyUp` event that triggers an `action` to be sent continues
|
|
129
|
-
propagating to other views.
|
|
130
|
-
By default, when the user presses the return key on their keyboard and
|
|
131
|
-
the text field has an `action` set, the action will be sent to the view's
|
|
132
|
-
controller and the key event will stop propagating.
|
|
133
|
-
If you would like parent views to receive the `keyUp` event even after an
|
|
134
|
-
action has been dispatched, set `bubbles` to true.
|
|
135
|
-
@property bubbles
|
|
136
|
-
@type Boolean
|
|
137
|
-
@default false
|
|
138
|
-
@private
|
|
139
|
-
*/
|
|
140
|
-
bubbles: false,
|
|
141
|
-
|
|
142
|
-
interpretKeyEvents(event) {
|
|
143
|
-
let method = KEY_EVENTS[event.key];
|
|
144
|
-
|
|
145
|
-
this._elementValueDidChange();
|
|
146
|
-
|
|
147
|
-
if (method) {
|
|
148
|
-
return this[method](event);
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
_elementValueDidChange() {
|
|
153
|
-
set(this, 'value', this.element.value);
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
change(event) {
|
|
157
|
-
this._elementValueDidChange(event);
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
paste(event) {
|
|
161
|
-
this._elementValueDidChange(event);
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
cut(event) {
|
|
165
|
-
this._elementValueDidChange(event);
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
input(event) {
|
|
169
|
-
this._elementValueDidChange(event);
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
Allows you to specify a controller action to invoke when either the `enter`
|
|
174
|
-
key is pressed or, in the case of the field being a textarea, when a newline
|
|
175
|
-
is inserted. To use this method, give your field an `insert-newline`
|
|
176
|
-
attribute. The value of that attribute should be the name of the action
|
|
177
|
-
in your controller that you wish to invoke.
|
|
178
|
-
For an example on how to use the `insert-newline` attribute, please
|
|
179
|
-
reference the example near the top of this file.
|
|
180
|
-
@method insertNewline
|
|
181
|
-
@param {Event} event
|
|
182
|
-
@private
|
|
183
|
-
*/
|
|
184
|
-
insertNewline(event) {
|
|
185
|
-
sendAction('enter', this, event);
|
|
186
|
-
sendAction('insert-newline', this, event);
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
Allows you to specify a controller action to invoke when the escape button
|
|
191
|
-
is pressed. To use this method, give your field an `escape-press`
|
|
192
|
-
attribute. The value of that attribute should be the name of the action
|
|
193
|
-
in your controller that you wish to invoke.
|
|
194
|
-
For an example on how to use the `escape-press` attribute, please reference
|
|
195
|
-
the example near the top of this file.
|
|
196
|
-
@method cancel
|
|
197
|
-
@param {Event} event
|
|
198
|
-
@private
|
|
199
|
-
*/
|
|
200
|
-
cancel(event) {
|
|
201
|
-
sendAction('escape-press', this, event);
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
Allows you to specify a controller action to invoke when a field receives
|
|
206
|
-
focus. To use this method, give your field a `focus-in` attribute. The value
|
|
207
|
-
of that attribute should be the name of the action in your controller
|
|
208
|
-
that you wish to invoke.
|
|
209
|
-
For an example on how to use the `focus-in` attribute, please reference the
|
|
210
|
-
example near the top of this file.
|
|
211
|
-
@method focusIn
|
|
212
|
-
@param {Event} event
|
|
213
|
-
@private
|
|
214
|
-
*/
|
|
215
|
-
focusIn(event) {
|
|
216
|
-
sendAction('focus-in', this, event);
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
Allows you to specify a controller action to invoke when a field loses
|
|
221
|
-
focus. To use this method, give your field a `focus-out` attribute. The value
|
|
222
|
-
of that attribute should be the name of the action in your controller
|
|
223
|
-
that you wish to invoke.
|
|
224
|
-
For an example on how to use the `focus-out` attribute, please reference the
|
|
225
|
-
example near the top of this file.
|
|
226
|
-
@method focusOut
|
|
227
|
-
@param {Event} event
|
|
228
|
-
@private
|
|
229
|
-
*/
|
|
230
|
-
focusOut(event) {
|
|
231
|
-
this._elementValueDidChange(event);
|
|
232
|
-
|
|
233
|
-
sendAction('focus-out', this, event);
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
Allows you to specify a controller action to invoke when a key is pressed.
|
|
238
|
-
To use this method, give your field a `key-press` attribute. The value of
|
|
239
|
-
that attribute should be the name of the action in your controller you
|
|
240
|
-
that wish to invoke.
|
|
241
|
-
For an example on how to use the `key-press` attribute, please reference the
|
|
242
|
-
example near the top of this file.
|
|
243
|
-
@method keyPress
|
|
244
|
-
@param {Event} event
|
|
245
|
-
@private
|
|
246
|
-
*/
|
|
247
|
-
keyPress(event) {
|
|
248
|
-
sendAction('key-press', this, event);
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
Allows you to specify a controller action to invoke when a key-up event is
|
|
253
|
-
fired. To use this method, give your field a `key-up` attribute. The value
|
|
254
|
-
of that attribute should be the name of the action in your controller
|
|
255
|
-
that you wish to invoke.
|
|
256
|
-
For an example on how to use the `key-up` attribute, please reference the
|
|
257
|
-
example near the top of this file.
|
|
258
|
-
@method keyUp
|
|
259
|
-
@param {Event} event
|
|
260
|
-
@private
|
|
261
|
-
*/
|
|
262
|
-
keyUp(event) {
|
|
263
|
-
this.interpretKeyEvents(event);
|
|
264
|
-
sendAction('key-up', this, event);
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
Allows you to specify a controller action to invoke when a key-down event is
|
|
269
|
-
fired. To use this method, give your field a `key-down` attribute. The value
|
|
270
|
-
of that attribute should be the name of the action in your controller that
|
|
271
|
-
you wish to invoke.
|
|
272
|
-
For an example on how to use the `key-down` attribute, please reference the
|
|
273
|
-
example near the top of this file.
|
|
274
|
-
@method keyDown
|
|
275
|
-
@param {Event} event
|
|
276
|
-
@private
|
|
277
|
-
*/
|
|
278
|
-
keyDown(event) {
|
|
279
|
-
sendAction('key-down', this, event);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
}); // In principle, this shouldn't be necessary, but the legacy
|
|
283
|
-
// sendAction semantics for TextField are different from
|
|
284
|
-
// the component semantics so this method normalizes them.
|
|
285
|
-
|
|
286
|
-
function sendAction(eventName, view, event) {
|
|
287
|
-
let action = get(view, `attrs.${eventName}`);
|
|
288
|
-
|
|
289
|
-
if (action !== null && typeof action === 'object' && action[MUTABLE_CELL] === true) {
|
|
290
|
-
action = action.value;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (action === undefined) {
|
|
294
|
-
action = get(view, eventName);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
let value = get(view, 'value');
|
|
298
|
-
|
|
299
|
-
if (typeof action === 'function') {
|
|
300
|
-
action(value, event);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (action && !get(view, 'bubbles')) {
|
|
304
|
-
event.stopPropagation();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if (true
|
|
309
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
310
|
-
) {
|
|
311
|
-
Object.defineProperty(TextSupport, '_wasReopened', {
|
|
312
|
-
configurable: true,
|
|
313
|
-
enumerable: false,
|
|
314
|
-
writable: true,
|
|
315
|
-
value: false
|
|
316
|
-
});
|
|
317
|
-
Object.defineProperty(TextSupport, 'reopen', {
|
|
318
|
-
configurable: true,
|
|
319
|
-
enumerable: false,
|
|
320
|
-
writable: true,
|
|
321
|
-
value: function reopen(...args) {
|
|
322
|
-
if (this === TextSupport) {
|
|
323
|
-
deprecate('Reopening Ember.TextSupport is deprecated.', false, {
|
|
324
|
-
id: 'ember.built-in-components.reopen',
|
|
325
|
-
for: 'ember-source',
|
|
326
|
-
since: {
|
|
327
|
-
enabled: '3.27.0'
|
|
328
|
-
},
|
|
329
|
-
until: '4.0.0',
|
|
330
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen'
|
|
331
|
-
});
|
|
332
|
-
TextSupport._wasReopened = true;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return Mixin.prototype.reopen.call(this, ...args);
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
if (DEBUG) {
|
|
340
|
-
Object.seal(TextSupport);
|
|
341
|
-
Mixin._disableDebugSeal = false;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
export default TextSupport;
|
|
@@ -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,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';
|