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.
Files changed (115) hide show
  1. package/CHANGELOG.md +113 -10
  2. package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +1 -1
  3. package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
  4. package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +3 -3
  5. package/blueprints/helper-test/index.js +4 -22
  6. package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +1 -13
  7. package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +0 -13
  8. package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -12
  9. package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -13
  10. package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -14
  11. package/blueprints/initializer/files/__root__/initializers/__name__.js +0 -1
  12. package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -1
  13. package/build-metadata.json +3 -3
  14. package/dist/dependencies/@glimmer/manager.js +19 -98
  15. package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
  16. package/dist/dependencies/@glimmer/runtime.js +1 -55
  17. package/dist/dependencies/@glimmer/validator.js +19 -51
  18. package/dist/ember-template-compiler.js +3692 -5667
  19. package/dist/ember-template-compiler.map +1 -1
  20. package/dist/ember-testing.js +12 -560
  21. package/dist/ember-testing.map +1 -1
  22. package/dist/ember.debug.js +4357 -12470
  23. package/dist/ember.debug.map +1 -1
  24. package/dist/header/license.js +1 -1
  25. package/dist/packages/@ember/-internals/bootstrap/index.js +2 -55
  26. package/dist/packages/@ember/-internals/container/index.js +35 -206
  27. package/dist/packages/@ember/-internals/environment/index.js +3 -46
  28. package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
  29. package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +1 -2
  30. package/dist/packages/@ember/-internals/glimmer/index.js +4774 -7035
  31. package/dist/packages/@ember/-internals/meta/lib/meta.js +2 -50
  32. package/dist/packages/@ember/-internals/metal/index.js +785 -1109
  33. package/dist/packages/@ember/-internals/overrides/index.js +1 -3
  34. package/dist/packages/@ember/-internals/owner/index.js +1 -19
  35. package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +1 -51
  36. package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -0
  37. package/dist/packages/@ember/-internals/routing/lib/location/history_location.js +3 -1
  38. package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +0 -7
  39. package/dist/packages/@ember/-internals/routing/lib/services/router.js +34 -2
  40. package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -3
  41. package/dist/packages/@ember/-internals/routing/lib/system/dsl.js +5 -6
  42. package/dist/packages/@ember/-internals/routing/lib/system/route.js +192 -652
  43. package/dist/packages/@ember/-internals/routing/lib/system/router.js +119 -248
  44. package/dist/packages/@ember/-internals/routing/lib/system/router_state.js +1 -2
  45. package/dist/packages/@ember/-internals/routing/lib/utils.js +1 -2
  46. package/dist/packages/@ember/-internals/runtime/index.js +1 -4
  47. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +4 -175
  48. package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +1 -18
  49. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
  50. package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
  51. package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +10 -141
  52. package/dist/packages/@ember/-internals/utils/index.js +3 -59
  53. package/dist/packages/@ember/-internals/views/index.js +0 -2
  54. package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -121
  55. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -40
  56. package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +115 -190
  57. package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -2
  58. package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +1 -2
  59. package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +1 -2
  60. package/dist/packages/@ember/-internals/views/lib/views/states/pre_render.js +1 -2
  61. package/dist/packages/@ember/application/instance.js +3 -25
  62. package/dist/packages/@ember/application/lib/application.js +14 -32
  63. package/dist/packages/@ember/canary-features/index.js +5 -6
  64. package/dist/packages/@ember/component/index.js +1 -1
  65. package/dist/packages/@ember/component/template-only.js +2 -0
  66. package/dist/packages/@ember/debug/lib/deprecate.js +7 -41
  67. package/dist/packages/@ember/deprecated-features/index.js +1 -14
  68. package/dist/packages/@ember/engine/index.js +3 -17
  69. package/dist/packages/@ember/engine/instance.js +0 -4
  70. package/dist/packages/@ember/helper/index.js +12 -4
  71. package/dist/packages/@ember/object/index.js +3 -101
  72. package/dist/packages/@ember/object/internals.js +0 -1
  73. package/dist/packages/@ember/object/lib/computed/computed_macros.js +12 -384
  74. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +9 -360
  75. package/dist/packages/@ember/polyfills/index.js +1 -6
  76. package/dist/packages/@ember/polyfills/lib/assign.js +12 -28
  77. package/dist/packages/@ember/routing/index.js +1 -1
  78. package/dist/packages/@ember/runloop/index.js +1 -83
  79. package/dist/packages/@ember/string/index.js +1 -206
  80. package/dist/packages/@ember/utils/index.js +0 -1
  81. package/dist/packages/ember/index.js +17 -180
  82. package/dist/packages/ember/version.js +1 -1
  83. package/dist/packages/ember-testing/index.js +0 -2
  84. package/dist/packages/ember-testing/lib/helpers.js +0 -12
  85. package/dist/packages/ember-testing/lib/setup_for_testing.js +0 -10
  86. package/docs/data.json +1637 -3659
  87. package/lib/index.js +14 -59
  88. package/lib/overrides.js +0 -61
  89. package/lib/transforms/inject-babel-helpers.js +1 -3
  90. package/package.json +27 -23
  91. package/dist/packages/@ember/-internals/console/index.js +0 -190
  92. package/dist/packages/@ember/-internals/runtime/lib/copy.js +0 -119
  93. package/dist/packages/@ember/-internals/runtime/lib/ext/function.js +0 -155
  94. package/dist/packages/@ember/-internals/runtime/lib/mixins/copyable.js +0 -31
  95. package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -357
  96. package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
  97. package/dist/packages/@ember/-internals/views/lib/system/jquery_event_deprecation.js +0 -60
  98. package/dist/packages/@ember/application/deprecations.js +0 -25
  99. package/dist/packages/@ember/application/globals-resolver.js +0 -434
  100. package/dist/packages/@ember/application/resolver.js +0 -1
  101. package/dist/packages/@ember/component/checkbox.js +0 -17
  102. package/dist/packages/@ember/component/text-area.js +0 -17
  103. package/dist/packages/@ember/component/text-field.js +0 -17
  104. package/dist/packages/@ember/polyfills/lib/merge.js +0 -50
  105. package/dist/packages/@ember/routing/link-component.js +0 -17
  106. package/dist/packages/ember-testing/lib/events.js +0 -102
  107. package/dist/packages/ember-testing/lib/helpers/-is-form-control.js +0 -19
  108. package/dist/packages/ember-testing/lib/helpers/click.js +0 -32
  109. package/dist/packages/ember-testing/lib/helpers/fill_in.js +0 -47
  110. package/dist/packages/ember-testing/lib/helpers/find.js +0 -40
  111. package/dist/packages/ember-testing/lib/helpers/find_with_assert.js +0 -37
  112. package/dist/packages/ember-testing/lib/helpers/key_event.js +0 -37
  113. package/dist/packages/ember-testing/lib/helpers/trigger_event.js +0 -61
  114. package/dist/packages/ember-testing/lib/support.js +0 -57
  115. package/dist/packages/jquery/index.js +0 -2
@@ -1,6 +1,6 @@
1
1
  import { DEBUG } from '@glimmer/env';
2
2
  import { _WeakSet } from '@glimmer/util';
3
- import { deprecate, assert } from '@ember/debug';
3
+ import { assert } from '@ember/debug';
4
4
 
5
5
  /**
6
6
  Strongly hint runtimes to intern the provided string.
@@ -74,9 +74,6 @@ function isObject(value) {
74
74
  */
75
75
 
76
76
  /**
77
- Previously we used `Ember.$.uuid`, however `$.uuid` has been removed from
78
- jQuery master. We'll just bootstrap our own uuid now.
79
-
80
77
  @private
81
78
  @return {Number} the uuid
82
79
  */
@@ -199,14 +196,6 @@ function guidFor(value) {
199
196
  return guid;
200
197
  }
201
198
 
202
- const HAS_NATIVE_SYMBOL = function () {
203
- if (typeof Symbol !== 'function') {
204
- return false;
205
- }
206
-
207
- return typeof Symbol() === 'symbol';
208
- }();
209
-
210
199
  const GENERATED_SYMBOLS = [];
211
200
  function isInternalSymbol(possibleSymbol) {
212
201
  return GENERATED_SYMBOLS.indexOf(possibleSymbol) !== -1;
@@ -227,7 +216,7 @@ function enumerableSymbol(debugName) {
227
216
 
228
217
  return symbol;
229
218
  }
230
- const symbol = HAS_NATIVE_SYMBOL ? Symbol : enumerableSymbol;
219
+ const symbol = Symbol;
231
220
 
232
221
  // the delete is meant to hint at runtimes that this object should remain in
233
222
  // dictionary mode. This is clearly a runtime specific hack, but currently it
@@ -581,7 +570,6 @@ function lookupDescriptor(obj, keyName) {
581
570
  @return {Boolean}
582
571
  @private
583
572
  */
584
-
585
573
  function canInvoke(obj, methodName) {
586
574
  return obj !== null && obj !== undefined && typeof obj[methodName] === 'function';
587
575
  }
@@ -589,48 +577,6 @@ function canInvoke(obj, methodName) {
589
577
  @module @ember/utils
590
578
  */
591
579
 
592
- /**
593
- Checks to see if the `methodName` exists on the `obj`,
594
- and if it does, invokes it with the arguments passed.
595
-
596
- ```javascript
597
- import { tryInvoke } from '@ember/utils';
598
-
599
- let d = new Date('03/15/2013');
600
-
601
- tryInvoke(d, 'getTime'); // 1363320000000
602
- tryInvoke(d, 'setFullYear', [2014]); // 1394856000000
603
- tryInvoke(d, 'noSuchMethod', [2014]); // undefined
604
- ```
605
-
606
- @method tryInvoke
607
- @for @ember/utils
608
- @static
609
- @param {Object} obj The object to check for the method
610
- @param {String} methodName The method name to check for
611
- @param {Array} [args] The arguments to pass to the method
612
- @return {*} the return value of the invoked method or undefined if it cannot be invoked
613
- @public
614
- @deprecated Use Javascript's optional chaining instead.
615
- */
616
-
617
- function tryInvoke(obj, methodName, args) {
618
- deprecate(`Use of tryInvoke is deprecated. Instead, consider using JavaScript's optional chaining.`, false, {
619
- id: 'ember-utils.try-invoke',
620
- until: '4.0.0',
621
- for: 'ember-source',
622
- since: {
623
- enabled: '3.24.0'
624
- },
625
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-utils-try-invoke'
626
- });
627
-
628
- if (canInvoke(obj, methodName)) {
629
- let method = obj[methodName];
630
- return method.apply(obj, args);
631
- }
632
- }
633
-
634
580
  const {
635
581
  isArray: isArray$1
636
582
  } = Array;
@@ -695,8 +641,6 @@ function toString(obj) {
695
641
  return objectToString$1.call(obj);
696
642
  }
697
643
 
698
- const HAS_NATIVE_PROXY = typeof Proxy === 'function';
699
-
700
644
  const PROXIES = new _WeakSet();
701
645
  function isProxy(value) {
702
646
  if (isObject(value)) {
@@ -881,4 +825,4 @@ if (DEBUG) {
881
825
  elsewhere (so they can be lazily evaluated / parsed).
882
826
  */
883
827
 
884
- export { symbol, enumerableSymbol, isInternalSymbol, makeDictionary as dictionary, getDebugName$1 as getDebugName, uuid, GUID_KEY, generateGuid, guidFor, intern, checkHasSuper, ROOT, wrap, observerListenerMetaFor, setObservers, setListeners, inspect, lookupDescriptor, canInvoke, tryInvoke, makeArray, getName, setName, toString, isObject, HAS_NATIVE_SYMBOL, HAS_NATIVE_PROXY, isProxy, setProxy, Cache, setEmberArray, isEmberArray, setupMandatorySetter, teardownMandatorySetter, setWithMandatorySetter };
828
+ export { symbol, enumerableSymbol, isInternalSymbol, makeDictionary as dictionary, getDebugName$1 as getDebugName, uuid, GUID_KEY, generateGuid, guidFor, intern, checkHasSuper, ROOT, wrap, observerListenerMetaFor, setObservers, setListeners, inspect, lookupDescriptor, canInvoke, makeArray, getName, setName, toString, isObject, isProxy, setProxy, Cache, setEmberArray, isEmberArray, setupMandatorySetter, teardownMandatorySetter, setWithMandatorySetter };
@@ -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';
@@ -3,9 +3,7 @@
3
3
  */
4
4
  import { inspect } from '@ember/-internals/utils';
5
5
  import { Mixin, get } from '@ember/-internals/metal';
6
- import { assert, deprecate } from '@ember/debug';
7
- import { MUTABLE_CELL } from '../compat/attrs';
8
- import { SEND_ACTION } from '@ember/deprecated-features';
6
+ import { assert } from '@ember/debug';
9
7
  const mixinObj = {
10
8
  send(actionName, ...args) {
11
9
  assert(`Attempted to call .send() with the action '${actionName}' on the destroyed object '${this}'.`, !this.isDestroying && !this.isDestroyed);
@@ -30,128 +28,10 @@ const mixinObj = {
30
28
  }
31
29
 
32
30
  };
33
-
34
- if (SEND_ACTION) {
35
- /**
36
- Calls an action passed to a component.
37
- For example a component for playing or pausing music may translate click events
38
- into action notifications of "play" or "stop" depending on some internal state
39
- of the component:
40
- ```app/components/play-button.js
41
- import Component from '@ember/component';
42
- export default Component.extend({
43
- click() {
44
- if (this.get('isPlaying')) {
45
- this.sendAction('play');
46
- } else {
47
- this.sendAction('stop');
48
- }
49
- }
50
- });
51
- ```
52
- The actions "play" and "stop" must be passed to this `play-button` component:
53
- ```handlebars
54
- {{! app/templates/application.hbs }}
55
- {{play-button play=(action "musicStarted") stop=(action "musicStopped")}}
56
- ```
57
- When the component receives a browser `click` event it translate this
58
- interaction into application-specific semantics ("play" or "stop") and
59
- calls the specified action.
60
- ```app/controller/application.js
61
- import Controller from '@ember/controller';
62
- export default Controller.extend({
63
- actions: {
64
- musicStarted() {
65
- // called when the play button is clicked
66
- // and the music started playing
67
- },
68
- musicStopped() {
69
- // called when the play button is clicked
70
- // and the music stopped playing
71
- }
72
- }
73
- });
74
- ```
75
- If no action is passed to `sendAction` a default name of "action"
76
- is assumed.
77
- ```app/components/next-button.js
78
- import Component from '@ember/component';
79
- export default Component.extend({
80
- click() {
81
- this.sendAction();
82
- }
83
- });
84
- ```
85
- ```handlebars
86
- {{! app/templates/application.hbs }}
87
- {{next-button action=(action "playNextSongInAlbum")}}
88
- ```
89
- ```app/controllers/application.js
90
- import Controller from '@ember/controller';
91
- export default Controller.extend({
92
- actions: {
93
- playNextSongInAlbum() {
94
- ...
95
- }
96
- }
97
- });
98
- ```
99
- @method sendAction
100
- @param [action] {String} the action to call
101
- @param [params] {*} arguments for the action
102
- @public
103
- @deprecated
104
- */
105
- let sendAction = function sendAction(action, ...contexts) {
106
- assert(`Attempted to call .sendAction() with the action '${action}' on the destroyed object '${this}'.`, !this.isDestroying && !this.isDestroyed);
107
- deprecate(`You called ${inspect(this)}.sendAction(${typeof action === 'string' ? `"${action}"` : ''}) but Component#sendAction is deprecated. Please use closure actions instead.`, false, {
108
- id: 'ember-component.send-action',
109
- until: '4.0.0',
110
- url: 'https://deprecations.emberjs.com/v3.x#toc_ember-component-send-action',
111
- for: 'ember-source',
112
- since: {
113
- enabled: '3.4.0'
114
- }
115
- });
116
- let actionName; // Send the default action
117
-
118
- if (action === undefined) {
119
- action = 'action';
120
- }
121
-
122
- actionName = get(this, `attrs.${action}`) || get(this, action);
123
- actionName = validateAction(this, actionName); // If no action name for that action could be found, just abort.
124
-
125
- if (actionName === undefined) {
126
- return;
127
- }
128
-
129
- if (typeof actionName === 'function') {
130
- actionName(...contexts);
131
- } else {
132
- this.triggerAction({
133
- action: actionName,
134
- actionContext: contexts
135
- });
136
- }
137
- };
138
-
139
- let validateAction = function validateAction(component, actionName) {
140
- if (actionName && actionName[MUTABLE_CELL]) {
141
- actionName = actionName.value;
142
- }
143
-
144
- assert(`The default action was triggered on the component ${component.toString()}, but the action name (${actionName}) was not a string.`, actionName === null || actionName === undefined || typeof actionName === 'string' || typeof actionName === 'function');
145
- return actionName;
146
- };
147
-
148
- mixinObj.sendAction = sendAction;
149
- }
150
31
  /**
151
32
  @class ActionSupport
152
33
  @namespace Ember
153
34
  @private
154
35
  */
155
36
 
156
-
157
37
  export default Mixin.create(mixinObj);
@@ -3,9 +3,6 @@ import { descriptorForProperty, Mixin, nativeDescDecorator } from '@ember/-inter
3
3
  import { assert } from '@ember/debug';
4
4
  import { hasDOM } from '@ember/-internals/browser-environment';
5
5
  import { matches } from '../system/utils';
6
- import { jQuery, jQueryDisabled } from '../system/jquery';
7
- import { deprecate } from '@ember/debug';
8
- import { JQUERY_INTEGRATION } from '@ember/deprecated-features';
9
6
 
10
7
  function K() {
11
8
  return this;
@@ -149,7 +146,7 @@ let mixin = {
149
146
  the target element you are providing is associated with an `Application`
150
147
  and does not have an ancestor element that is associated with an Ember view.
151
148
  @method appendTo
152
- @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object
149
+ @param {String|DOMElement} A selector, element, HTML string
153
150
  @return {Ember.View} receiver
154
151
  @private
155
152
  */
@@ -175,8 +172,8 @@ let mixin = {
175
172
  })());
176
173
  } else {
177
174
  target = selector;
178
- assert(`You tried to append to a selector string (${selector}) in an environment without jQuery`, typeof target !== 'string');
179
- assert(`You tried to append to a non-Element (${selector}) in an environment without jQuery`, typeof selector.appendChild === 'function');
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');
180
177
  }
181
178
 
182
179
  this.renderer.appendTo(this, target);
@@ -306,7 +303,7 @@ let mixin = {
306
303
  Component properties that depend on the presence of an outer element, such
307
304
  as `classNameBindings` and `attributeBindings`, do not work with tagless
308
305
  components. Tagless components cannot implement methods to handle events,
309
- and have no associated jQuery object to return with `$()`.
306
+ and their `element` property has a `null` value.
310
307
  @property tagName
311
308
  @type String
312
309
  @default null
@@ -359,43 +356,10 @@ let mixin = {
359
356
  }
360
357
 
361
358
  };
362
-
363
- if (JQUERY_INTEGRATION) {
364
- /**
365
- Returns a jQuery object for this view's element. If you pass in a selector
366
- string, this method will return a jQuery object, using the current element
367
- as its buffer.
368
- For example, calling `view.$('li')` will return a jQuery object containing
369
- all of the `li` elements inside the DOM element of this view.
370
- @method $
371
- @param {String} [selector] a jQuery-compatible selector string
372
- @return {jQuery} the jQuery object for the DOM node
373
- @public
374
- @deprecated
375
- */
376
- mixin.$ = function $(sel) {
377
- assert("You cannot access this.$() on a component with `tagName: ''` specified.", this.tagName !== '');
378
- assert('You cannot access this.$() with `jQuery` disabled.', !jQueryDisabled);
379
- deprecate('Using this.$() in a component has been deprecated, consider using this.element', false, {
380
- id: 'ember-views.curly-components.jquery-element',
381
- until: '4.0.0',
382
- url: 'https://deprecations.emberjs.com/v3.x#toc_jquery-apis',
383
- for: 'ember-source',
384
- since: {
385
- enabled: '3.9.0'
386
- }
387
- });
388
-
389
- if (this.element) {
390
- return sel ? jQuery(sel, this.element) : jQuery(this.element);
391
- }
392
- };
393
- }
394
359
  /**
395
360
  @class ViewMixin
396
361
  @namespace Ember
397
362
  @private
398
363
  */
399
364
 
400
-
401
365
  export default Mixin.create(mixin);