ember-source 4.4.0-alpha.3 → 4.4.0-alpha.4

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 (39) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/blueprints/acceptance-test/mocha-rfc-232-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/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  5. package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
  6. package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
  7. package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
  8. package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +1 -1
  9. package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +1 -1
  10. package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
  11. package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
  12. package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
  13. package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
  14. package/build-metadata.json +3 -3
  15. package/dist/ember-template-compiler.js +7 -3
  16. package/dist/ember-template-compiler.map +1 -1
  17. package/dist/ember-testing.js +2 -2
  18. package/dist/ember-testing.map +1 -1
  19. package/dist/ember.debug.js +298 -957
  20. package/dist/ember.debug.map +1 -1
  21. package/dist/header/license.js +1 -1
  22. package/dist/packages/@ember/-internals/container/index.js +0 -16
  23. package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +10 -19
  24. package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +113 -112
  25. package/dist/packages/@ember/-internals/glimmer/index.js +112 -748
  26. package/dist/packages/@ember/-internals/metal/index.js +1 -4
  27. package/dist/packages/@ember/-internals/routing/lib/system/router.js +1 -1
  28. package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +8 -4
  29. package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
  30. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
  31. package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
  32. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
  33. package/dist/packages/@ember/-internals/views/lib/system/utils.js +4 -2
  34. package/dist/packages/@ember/-internals/views/lib/views/core_view.js +5 -22
  35. package/dist/packages/@ember/debug/index.js +1 -1
  36. package/dist/packages/@ember/renderer/index.js +21 -0
  37. package/dist/packages/ember/version.js +1 -1
  38. package/docs/data.json +400 -210
  39. package/package.json +9 -9
@@ -300,7 +300,7 @@ class ForkedValue {
300
300
  class AbstractInput extends InternalComponent {
301
301
  constructor() {
302
302
  super(...arguments);
303
- this._value = valueFrom(this.args.named.value);
303
+ this._value = valueFrom(this.args.named['value']);
304
304
  }
305
305
 
306
306
  validateArguments() {
@@ -555,7 +555,7 @@ if (hasDOM) {
555
555
  class Input extends AbstractInput {
556
556
  constructor() {
557
557
  super(...arguments);
558
- this._checked = valueFrom(this.args.named.checked);
558
+ this._checked = valueFrom(this.args.named['checked']);
559
559
  }
560
560
 
561
561
  static toString() {
@@ -595,7 +595,7 @@ class Input extends AbstractInput {
595
595
 
596
596
  get checked() {
597
597
  if (this.isCheckbox) {
598
- warn('`<Input @type="checkbox" />` reflects its checked state via the `@checked` argument. ' + 'You wrote `<Input @type="checkbox" @value={{...}} />` which is likely not what you intended. ' + 'Did you mean `<Input @type="checkbox" @checked={{...}} />`?', untrack(() => this.args.named.checked !== undefined || this.args.named.value === undefined || typeof valueForRef(this.args.named.value) === 'string'), {
598
+ warn('`<Input @type="checkbox" />` reflects its checked state via the `@checked` argument. ' + 'You wrote `<Input @type="checkbox" @value={{...}} />` which is likely not what you intended. ' + 'Did you mean `<Input @type="checkbox" @checked={{...}} />`?', untrack(() => this.args.named['checked'] !== undefined || this.args.named['value'] === undefined || typeof valueForRef(this.args.named['value']) === 'string'), {
599
599
  id: 'ember.built-in-components.input-checkbox-value'
600
600
  });
601
601
  return this._checked.get();
@@ -605,7 +605,7 @@ class Input extends AbstractInput {
605
605
  }
606
606
 
607
607
  set checked(checked) {
608
- warn('`<Input @type="checkbox" />` reflects its checked state via the `@checked` argument. ' + 'You wrote `<Input @type="checkbox" @value={{...}} />` which is likely not what you intended. ' + 'Did you mean `<Input @type="checkbox" @checked={{...}} />`?', untrack(() => this.args.named.checked !== undefined || this.args.named.value === undefined || typeof valueForRef(this.args.named.value) === 'string'), {
608
+ warn('`<Input @type="checkbox" />` reflects its checked state via the `@checked` argument. ' + 'You wrote `<Input @type="checkbox" @value={{...}} />` which is likely not what you intended. ' + 'Did you mean `<Input @type="checkbox" @checked={{...}} />`?', untrack(() => this.args.named['checked'] !== undefined || this.args.named['value'] === undefined || typeof valueForRef(this.args.named['value']) === 'string'), {
609
609
  id: 'ember.built-in-components.input-checkbox-value'
610
610
  });
611
611
 
@@ -1898,8 +1898,8 @@ var action$1 = internalHelper(args => {
1898
1898
  let [context, action$$1, ...restArgs] = positional;
1899
1899
  assert('hash position arguments', context && action$$1);
1900
1900
  let debugKey = action$$1.debugLabel;
1901
- let target = 'target' in named && named.target ? named.target : context;
1902
- let processArgs = makeArgsProcessor('value' in named && named.value || false, restArgs);
1901
+ let target = 'target' in named ? named['target'] : context;
1902
+ let processArgs = makeArgsProcessor('value' in named && named['value'] || false, restArgs);
1903
1903
  let fn$$1;
1904
1904
 
1905
1905
  if (isInvokableRef(action$$1)) {
@@ -2492,625 +2492,6 @@ function isCurlyManager(manager) {
2492
2492
  }
2493
2493
 
2494
2494
  let lazyEventsProcessed = new WeakMap();
2495
- /**
2496
- @module @ember/component
2497
- */
2498
-
2499
- /**
2500
- A component is a reusable UI element that consists of a `.hbs` template and an
2501
- optional JavaScript class that defines its behavior. For example, someone
2502
- might make a `button` in the template and handle the click behavior in the
2503
- JavaScript file that shares the same name as the template.
2504
-
2505
- Components are broken down into two categories:
2506
-
2507
- - Components _without_ JavaScript, that are based only on a template. These
2508
- are called Template-only or TO components.
2509
- - Components _with_ JavaScript, which consist of a template and a backing
2510
- class.
2511
-
2512
- Ember ships with two types of JavaScript classes for components:
2513
-
2514
- 1. Glimmer components, imported from `@glimmer/component`, which are the
2515
- default component's for Ember Octane (3.15) and more recent editions.
2516
- 2. Classic components, imported from `@ember/component`, which were the
2517
- default for older editions of Ember (pre 3.15).
2518
-
2519
- Below is the documentation for Classic components. If you are looking for the
2520
- API documentation for Template-only or Glimmer components, it is
2521
- [available here](/ember/release/modules/@glimmer%2Fcomponent).
2522
-
2523
- ## Defining a Classic Component
2524
-
2525
- If you want to customize the component in order to handle events, transform
2526
- arguments or maintain internal state, you implement a subclass of `Component`.
2527
-
2528
- One example is to add computed properties to your component:
2529
-
2530
- ```app/components/person-profile.js
2531
- import Component from '@ember/component';
2532
-
2533
- export default Component.extend({
2534
- displayName: computed('person.title', 'person.firstName', 'person.lastName', function() {
2535
- let { title, firstName, lastName } = this.person;
2536
-
2537
- if (title) {
2538
- return `${title} ${lastName}`;
2539
- } else {
2540
- return `${firstName} ${lastName}`;
2541
- }
2542
- })
2543
- });
2544
- ```
2545
-
2546
- And then use it in the component's template:
2547
-
2548
- ```app/templates/components/person-profile.hbs
2549
- <h1>{{this.displayName}}</h1>
2550
- {{yield}}
2551
- ```
2552
-
2553
- ## Customizing a Classic Component's HTML Element in JavaScript
2554
-
2555
- ### HTML Tag
2556
-
2557
- The default HTML tag name used for a component's HTML representation is `div`.
2558
- This can be customized by setting the `tagName` property.
2559
-
2560
- Consider the following component class:
2561
-
2562
- ```app/components/emphasized-paragraph.js
2563
- import Component from '@ember/component';
2564
-
2565
- export default Component.extend({
2566
- tagName: 'em'
2567
- });
2568
- ```
2569
-
2570
- When invoked, this component would produce output that looks something like
2571
- this:
2572
-
2573
- ```html
2574
- <em id="ember1" class="ember-view"></em>
2575
- ```
2576
-
2577
- ### HTML `class` Attribute
2578
-
2579
- The HTML `class` attribute of a component's tag can be set by providing a
2580
- `classNames` property that is set to an array of strings:
2581
-
2582
- ```app/components/my-widget.js
2583
- import Component from '@ember/component';
2584
-
2585
- export default Component.extend({
2586
- classNames: ['my-class', 'my-other-class']
2587
- });
2588
- ```
2589
-
2590
- Invoking this component will produce output that looks like this:
2591
-
2592
- ```html
2593
- <div id="ember1" class="ember-view my-class my-other-class"></div>
2594
- ```
2595
-
2596
- `class` attribute values can also be set by providing a `classNameBindings`
2597
- property set to an array of properties names for the component. The return
2598
- value of these properties will be added as part of the value for the
2599
- components's `class` attribute. These properties can be computed properties:
2600
-
2601
- ```app/components/my-widget.js
2602
- import Component from '@ember/component';
2603
- import { computed } from '@ember/object';
2604
-
2605
- export default Component.extend({
2606
- classNames: ['my-class', 'my-other-class'],
2607
- classNameBindings: ['propertyA', 'propertyB'],
2608
-
2609
- propertyA: 'from-a',
2610
- propertyB: computed(function() {
2611
- if (someLogic) { return 'from-b'; }
2612
- })
2613
- });
2614
- ```
2615
-
2616
- Invoking this component will produce HTML that looks like:
2617
-
2618
- ```html
2619
- <div id="ember1" class="ember-view my-class my-other-class from-a from-b"></div>
2620
- ```
2621
-
2622
- Note that `classNames` and `classNameBindings` is in addition to the `class`
2623
- attribute passed with the angle bracket invocation syntax. Therefore, if this
2624
- component was invoked like so:
2625
-
2626
- ```handlebars
2627
- <MyWidget class="from-invocation" />
2628
- ```
2629
-
2630
- The resulting HTML will look similar to this:
2631
-
2632
- ```html
2633
- <div id="ember1" class="from-invocation ember-view my-class my-other-class from-a from-b"></div>
2634
- ```
2635
-
2636
- If the value of a class name binding returns a boolean the property name
2637
- itself will be used as the class name if the property is true. The class name
2638
- will not be added if the value is `false` or `undefined`.
2639
-
2640
- ```app/components/my-widget.js
2641
- import Component from '@ember/component';
2642
-
2643
- export default Component.extend({
2644
- classNameBindings: ['hovered'],
2645
-
2646
- hovered: true
2647
- });
2648
- ```
2649
-
2650
- Invoking this component will produce HTML that looks like:
2651
-
2652
- ```html
2653
- <div id="ember1" class="ember-view hovered"></div>
2654
- ```
2655
-
2656
- ### Custom Class Names for Boolean Values
2657
-
2658
- When using boolean class name bindings you can supply a string value other
2659
- than the property name for use as the `class` HTML attribute by appending the
2660
- preferred value after a ":" character when defining the binding:
2661
-
2662
- ```app/components/my-widget.js
2663
- import Component from '@ember/component';
2664
-
2665
- export default Component.extend({
2666
- classNameBindings: ['awesome:so-very-cool'],
2667
-
2668
- awesome: true
2669
- });
2670
- ```
2671
-
2672
- Invoking this component will produce HTML that looks like:
2673
-
2674
- ```html
2675
- <div id="ember1" class="ember-view so-very-cool"></div>
2676
- ```
2677
-
2678
- Boolean value class name bindings whose property names are in a
2679
- camelCase-style format will be converted to a dasherized format:
2680
-
2681
- ```app/components/my-widget.js
2682
- import Component from '@ember/component';
2683
-
2684
- export default Component.extend({
2685
- classNameBindings: ['isUrgent'],
2686
-
2687
- isUrgent: true
2688
- });
2689
- ```
2690
-
2691
- Invoking this component will produce HTML that looks like:
2692
-
2693
- ```html
2694
- <div id="ember1" class="ember-view is-urgent"></div>
2695
- ```
2696
-
2697
- Class name bindings can also refer to object values that are found by
2698
- traversing a path relative to the component itself:
2699
-
2700
- ```app/components/my-widget.js
2701
- import Component from '@ember/component';
2702
- import EmberObject from '@ember/object';
2703
-
2704
- export default Component.extend({
2705
- classNameBindings: ['messages.empty'],
2706
-
2707
- messages: EmberObject.create({
2708
- empty: true
2709
- })
2710
- });
2711
- ```
2712
-
2713
- Invoking this component will produce HTML that looks like:
2714
-
2715
- ```html
2716
- <div id="ember1" class="ember-view empty"></div>
2717
- ```
2718
-
2719
- If you want to add a class name for a property which evaluates to true and
2720
- and a different class name if it evaluates to false, you can pass a binding
2721
- like this:
2722
-
2723
- ```app/components/my-widget.js
2724
- import Component from '@ember/component';
2725
-
2726
- export default Component.extend({
2727
- classNameBindings: ['isEnabled:enabled:disabled'],
2728
- isEnabled: true
2729
- });
2730
- ```
2731
-
2732
- Invoking this component will produce HTML that looks like:
2733
-
2734
- ```html
2735
- <div id="ember1" class="ember-view enabled"></div>
2736
- ```
2737
-
2738
- When isEnabled is `false`, the resulting HTML representation looks like this:
2739
-
2740
- ```html
2741
- <div id="ember1" class="ember-view disabled"></div>
2742
- ```
2743
-
2744
- This syntax offers the convenience to add a class if a property is `false`:
2745
-
2746
- ```app/components/my-widget.js
2747
- import Component from '@ember/component';
2748
-
2749
- // Applies no class when isEnabled is true and class 'disabled' when isEnabled is false
2750
- export default Component.extend({
2751
- classNameBindings: ['isEnabled::disabled'],
2752
- isEnabled: true
2753
- });
2754
- ```
2755
-
2756
- Invoking this component when the `isEnabled` property is true will produce
2757
- HTML that looks like:
2758
-
2759
- ```html
2760
- <div id="ember1" class="ember-view"></div>
2761
- ```
2762
-
2763
- Invoking it when the `isEnabled` property on the component is `false` will
2764
- produce HTML that looks like:
2765
-
2766
- ```html
2767
- <div id="ember1" class="ember-view disabled"></div>
2768
- ```
2769
-
2770
- Updates to the value of a class name binding will result in automatic update
2771
- of the HTML `class` attribute in the component's rendered HTML
2772
- representation. If the value becomes `false` or `undefined` the class name
2773
- will be removed.
2774
-
2775
- Both `classNames` and `classNameBindings` are concatenated properties. See
2776
- [EmberObject](/ember/release/classes/EmberObject) documentation for more
2777
- information about concatenated properties.
2778
-
2779
- ### Other HTML Attributes
2780
-
2781
- The HTML attribute section of a component's tag can be set by providing an
2782
- `attributeBindings` property set to an array of property names on the component.
2783
- The return value of these properties will be used as the value of the component's
2784
- HTML associated attribute:
2785
-
2786
- ```app/components/my-anchor.js
2787
- import Component from '@ember/component';
2788
-
2789
- export default Component.extend({
2790
- tagName: 'a',
2791
- attributeBindings: ['href'],
2792
-
2793
- href: 'http://google.com'
2794
- });
2795
- ```
2796
-
2797
- Invoking this component will produce HTML that looks like:
2798
-
2799
- ```html
2800
- <a id="ember1" class="ember-view" href="http://google.com"></a>
2801
- ```
2802
-
2803
- One property can be mapped on to another by placing a ":" between
2804
- the source property and the destination property:
2805
-
2806
- ```app/components/my-anchor.js
2807
- import Component from '@ember/component';
2808
-
2809
- export default Component.extend({
2810
- tagName: 'a',
2811
- attributeBindings: ['url:href'],
2812
-
2813
- url: 'http://google.com'
2814
- });
2815
- ```
2816
-
2817
- Invoking this component will produce HTML that looks like:
2818
-
2819
- ```html
2820
- <a id="ember1" class="ember-view" href="http://google.com"></a>
2821
- ```
2822
-
2823
- HTML attributes passed with angle bracket invocations will take precedence
2824
- over those specified in `attributeBindings`. Therefore, if this component was
2825
- invoked like so:
2826
-
2827
- ```handlebars
2828
- <MyAnchor href="http://bing.com" @url="http://google.com" />
2829
- ```
2830
-
2831
- The resulting HTML will looks like this:
2832
-
2833
- ```html
2834
- <a id="ember1" class="ember-view" href="http://bing.com"></a>
2835
- ```
2836
-
2837
- Note that the `href` attribute is ultimately set to `http://bing.com`,
2838
- despite it having attribute binidng to the `url` property, which was
2839
- set to `http://google.com`.
2840
-
2841
- Namespaced attributes (e.g. `xlink:href`) are supported, but have to be
2842
- mapped, since `:` is not a valid character for properties in Javascript:
2843
-
2844
- ```app/components/my-use.js
2845
- import Component from '@ember/component';
2846
-
2847
- export default Component.extend({
2848
- tagName: 'use',
2849
- attributeBindings: ['xlinkHref:xlink:href'],
2850
-
2851
- xlinkHref: '#triangle'
2852
- });
2853
- ```
2854
-
2855
- Invoking this component will produce HTML that looks like:
2856
-
2857
- ```html
2858
- <use xlink:href="#triangle"></use>
2859
- ```
2860
-
2861
- If the value of a property monitored by `attributeBindings` is a boolean, the
2862
- attribute will be present or absent depending on the value:
2863
-
2864
- ```app/components/my-text-input.js
2865
- import Component from '@ember/component';
2866
-
2867
- export default Component.extend({
2868
- tagName: 'input',
2869
- attributeBindings: ['disabled'],
2870
-
2871
- disabled: false
2872
- });
2873
- ```
2874
-
2875
- Invoking this component will produce HTML that looks like:
2876
-
2877
- ```html
2878
- <input id="ember1" class="ember-view" />
2879
- ```
2880
-
2881
- `attributeBindings` can refer to computed properties:
2882
-
2883
- ```app/components/my-text-input.js
2884
- import Component from '@ember/component';
2885
- import { computed } from '@ember/object';
2886
-
2887
- export default Component.extend({
2888
- tagName: 'input',
2889
- attributeBindings: ['disabled'],
2890
-
2891
- disabled: computed(function() {
2892
- if (someLogic) {
2893
- return true;
2894
- } else {
2895
- return false;
2896
- }
2897
- })
2898
- });
2899
- ```
2900
-
2901
- To prevent setting an attribute altogether, use `null` or `undefined` as the
2902
- value of the property used in `attributeBindings`:
2903
-
2904
- ```app/components/my-text-input.js
2905
- import Component from '@ember/component';
2906
-
2907
- export default Component.extend({
2908
- tagName: 'form',
2909
- attributeBindings: ['novalidate'],
2910
- novalidate: null
2911
- });
2912
- ```
2913
-
2914
- Updates to the property of an attribute binding will result in automatic
2915
- update of the HTML attribute in the component's HTML output.
2916
-
2917
- `attributeBindings` is a concatenated property. See
2918
- [EmberObject](/ember/release/classes/EmberObject) documentation for more
2919
- information about concatenated properties.
2920
-
2921
- ## Layouts
2922
-
2923
- The `layout` property can be used to dynamically specify a template associated
2924
- with a component class, instead of relying on Ember to link together a
2925
- component class and a template based on file names.
2926
-
2927
- In general, applications should not use this feature, but it's commonly used
2928
- in addons for historical reasons.
2929
-
2930
- The `layout` property should be set to the default export of a template
2931
- module, which is the name of a template file without the `.hbs` extension.
2932
-
2933
- ```app/templates/components/person-profile.hbs
2934
- <h1>Person's Title</h1>
2935
- <div class='details'>{{yield}}</div>
2936
- ```
2937
-
2938
- ```app/components/person-profile.js
2939
- import Component from '@ember/component';
2940
- import layout from '../templates/components/person-profile';
2941
-
2942
- export default Component.extend({
2943
- layout
2944
- });
2945
- ```
2946
-
2947
- If you invoke the component:
2948
-
2949
- ```handlebars
2950
- <PersonProfile>
2951
- <h2>Chief Basket Weaver</h2>
2952
- <h3>Fisherman Industries</h3>
2953
- </PersonProfile>
2954
- ```
2955
-
2956
- or
2957
-
2958
- ```handlebars
2959
- {{#person-profile}}
2960
- <h2>Chief Basket Weaver</h2>
2961
- <h3>Fisherman Industries</h3>
2962
- {{/person-profile}}
2963
- ```
2964
-
2965
- It will result in the following HTML output:
2966
-
2967
- ```html
2968
- <h1>Person's Title</h1>
2969
- <div class="details">
2970
- <h2>Chief Basket Weaver</h2>
2971
- <h3>Fisherman Industries</h3>
2972
- </div>
2973
- ```
2974
-
2975
- ## Handling Browser Events
2976
-
2977
- Components can respond to user-initiated events in one of three ways: passing
2978
- actions with angle bracket invocation, adding event handler methods to the
2979
- component's class, or adding actions to the component's template.
2980
-
2981
- ### Passing Actions With Angle Bracket Invocation
2982
-
2983
- For one-off events specific to particular instance of a component, it is possible
2984
- to pass actions to the component's element using angle bracket invocation syntax.
2985
-
2986
- ```handlebars
2987
- <MyWidget {{action 'firstWidgetClicked'}} />
2988
-
2989
- <MyWidget {{action 'secondWidgetClicked'}} />
2990
- ```
2991
-
2992
- In this case, when the first component is clicked on, Ember will invoke the
2993
- `firstWidgetClicked` action. When the second component is clicked on, Ember
2994
- will invoke the `secondWidgetClicked` action instead.
2995
-
2996
- Besides `{{action}}`, it is also possible to pass any arbitrary element modifiers
2997
- using the angle bracket invocation syntax.
2998
-
2999
- ### Event Handler Methods
3000
-
3001
- Components can also respond to user-initiated events by implementing a method
3002
- that matches the event name. This approach is appropriate when the same event
3003
- should be handled by all instances of the same component.
3004
-
3005
- An event object will be passed as the argument to the event handler method.
3006
-
3007
- ```app/components/my-widget.js
3008
- import Component from '@ember/component';
3009
-
3010
- export default Component.extend({
3011
- click(event) {
3012
- // `event.target` is either the component's element or one of its children
3013
- let tag = event.target.tagName.toLowerCase();
3014
- console.log('clicked on a `<${tag}>` HTML element!');
3015
- }
3016
- });
3017
- ```
3018
-
3019
- In this example, whenever the user clicked anywhere inside the component, it
3020
- will log a message to the console.
3021
-
3022
- It is possible to handle event types other than `click` by implementing the
3023
- following event handler methods. In addition, custom events can be registered
3024
- by using `Application.customEvents`.
3025
-
3026
- Touch events:
3027
-
3028
- * `touchStart`
3029
- * `touchMove`
3030
- * `touchEnd`
3031
- * `touchCancel`
3032
-
3033
- Keyboard events:
3034
-
3035
- * `keyDown`
3036
- * `keyUp`
3037
- * `keyPress`
3038
-
3039
- Mouse events:
3040
-
3041
- * `mouseDown`
3042
- * `mouseUp`
3043
- * `contextMenu`
3044
- * `click`
3045
- * `doubleClick`
3046
- * `focusIn`
3047
- * `focusOut`
3048
-
3049
- Form events:
3050
-
3051
- * `submit`
3052
- * `change`
3053
- * `focusIn`
3054
- * `focusOut`
3055
- * `input`
3056
-
3057
- Drag and drop events:
3058
-
3059
- * `dragStart`
3060
- * `drag`
3061
- * `dragEnter`
3062
- * `dragLeave`
3063
- * `dragOver`
3064
- * `dragEnd`
3065
- * `drop`
3066
-
3067
- ### `{{action}}` Helper
3068
-
3069
- Instead of handling all events of a particular type anywhere inside the
3070
- component's element, you may instead want to limit it to a particular
3071
- element in the component's template. In this case, it would be more
3072
- convenient to implement an action instead.
3073
-
3074
- For example, you could implement the action `hello` for the `person-profile`
3075
- component:
3076
-
3077
- ```app/components/person-profile.js
3078
- import Component from '@ember/component';
3079
-
3080
- export default Component.extend({
3081
- actions: {
3082
- hello(name) {
3083
- console.log("Hello", name);
3084
- }
3085
- }
3086
- });
3087
- ```
3088
-
3089
- And then use it in the component's template:
3090
-
3091
- ```app/templates/components/person-profile.hbs
3092
- <h1>{{@person.name}}</h1>
3093
-
3094
- <button {{action 'hello' @person.name}}>
3095
- Say Hello to {{@person.name}}
3096
- </button>
3097
- ```
3098
-
3099
- When the user clicks the button, Ember will invoke the `hello` action,
3100
- passing in the current value of `@person.name` as an argument.
3101
-
3102
- See [Ember.Templates.helpers.action](/ember/release/classes/Ember.Templates.helpers/methods/action?anchor=action).
3103
-
3104
- @class Component
3105
- @extends Ember.CoreView
3106
- @uses Ember.TargetActionSupport
3107
- @uses Ember.ClassNamesSupport
3108
- @uses Ember.ActionSupport
3109
- @uses Ember.ViewMixin
3110
- @uses Ember.ViewStateSupport
3111
- @public
3112
- */
3113
-
3114
2495
  const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassNamesSupport, TargetActionSupport, ActionSupport, ViewMixin, {
3115
2496
  isComponent: true,
3116
2497
 
@@ -3417,23 +2798,6 @@ const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassName
3417
2798
  @since 1.13.0
3418
2799
  */
3419
2800
 
3420
- /**
3421
- Layout can be used to wrap content in a component.
3422
- @property layout
3423
- @type Function
3424
- @public
3425
- */
3426
-
3427
- /**
3428
- The name of the layout to lookup if no layout is provided.
3429
- By default `Component` will lookup a template with this name in
3430
- `Ember.TEMPLATES` (a shared global object).
3431
- @property layoutName
3432
- @type String
3433
- @default null
3434
- @private
3435
- */
3436
-
3437
2801
  /**
3438
2802
  The HTML `id` of the component's element in the DOM. You can provide this
3439
2803
  value yourself but it must be unique (just as in HTML):
@@ -4470,7 +3834,7 @@ setGlobalContext({
4470
3834
  },
4471
3835
 
4472
3836
  warnIfStyleNotTrusted(value) {
4473
- warn(constructStyleDeprecationMessage(value), (() => {
3837
+ warn(constructStyleDeprecationMessage(String(value)), (() => {
4474
3838
  if (value === null || value === undefined || isHTMLSafe$1(value)) {
4475
3839
  return true;
4476
3840
  }
@@ -4558,9 +3922,9 @@ var disallowDynamicResolution = internalHelper(({
4558
3922
  }) => {
4559
3923
  const nameOrValueRef = positional[0];
4560
3924
  assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1 && nameOrValueRef);
4561
- let typeRef = named.type;
4562
- let locRef = named.loc;
4563
- let originalRef = named.original;
3925
+ let typeRef = named['type'];
3926
+ let locRef = named['loc'];
3927
+ let originalRef = named['original'];
4564
3928
  assert(`[BUG] expecting \`type\` named argument`, typeRef);
4565
3929
  assert(`[BUG] expecting \`loc\` named argument`, locRef);
4566
3930
  assert(`[BUG] expecting \`original\` named argument`, originalRef); // Bug: why do these fail?
@@ -5462,7 +4826,7 @@ const outletHelper = internalHelper((_args, owner, scope) => {
5462
4826
  let outletRef = createComputeRef(() => {
5463
4827
  let state = valueForRef(scope.get('outletState'));
5464
4828
  let outlets = state !== undefined ? state.outlets : undefined;
5465
- return outlets !== undefined ? outlets.main : undefined;
4829
+ return outlets !== undefined ? outlets['main'] : undefined;
5466
4830
  });
5467
4831
  let lastState = null;
5468
4832
  let definition = null;
@@ -5487,7 +4851,7 @@ const outletHelper = internalHelper((_args, owner, scope) => {
5487
4851
  // provide the correct updated value. So we stop updating and return
5488
4852
  // the _last_ model value for that outlet.
5489
4853
 
5490
- named.model = createComputeRef(() => {
4854
+ named['model'] = createComputeRef(() => {
5491
4855
  if (lastState === state) {
5492
4856
  model = valueForRef(modelRef);
5493
4857
  }
@@ -5496,7 +4860,7 @@ const outletHelper = internalHelper((_args, owner, scope) => {
5496
4860
  });
5497
4861
 
5498
4862
  if (DEBUG) {
5499
- named.model = createDebugAliasRef('@model', named.model);
4863
+ named['model'] = createDebugAliasRef('@model', named['model']);
5500
4864
  }
5501
4865
 
5502
4866
  let args = createCapturedArgs(named, EMPTY_POSITIONAL);
@@ -5777,6 +5141,104 @@ class ResolverImpl {
5777
5141
 
5778
5142
  }
5779
5143
 
5144
+ const TOP_LEVEL_NAME = '-top-level';
5145
+ const TOP_LEVEL_OUTLET = 'main';
5146
+ class OutletView {
5147
+ constructor(_environment, owner, template, namespace) {
5148
+ this._environment = _environment;
5149
+ this.owner = owner;
5150
+ this.template = template;
5151
+ this.namespace = namespace;
5152
+ let outletStateTag = createTag();
5153
+ let outletState = {
5154
+ outlets: {
5155
+ main: undefined
5156
+ },
5157
+ render: {
5158
+ owner: owner,
5159
+ into: undefined,
5160
+ outlet: TOP_LEVEL_OUTLET,
5161
+ name: TOP_LEVEL_NAME,
5162
+ controller: undefined,
5163
+ model: undefined,
5164
+ template
5165
+ }
5166
+ };
5167
+ let ref = this.ref = createComputeRef(() => {
5168
+ consumeTag(outletStateTag);
5169
+ return outletState;
5170
+ }, state => {
5171
+ dirtyTag(outletStateTag);
5172
+ outletState.outlets['main'] = state;
5173
+ });
5174
+ this.state = {
5175
+ ref,
5176
+ name: TOP_LEVEL_NAME,
5177
+ outlet: TOP_LEVEL_OUTLET,
5178
+ template,
5179
+ controller: undefined,
5180
+ model: undefined
5181
+ };
5182
+ }
5183
+
5184
+ static extend(injections) {
5185
+ return class extends OutletView {
5186
+ static create(options) {
5187
+ if (options) {
5188
+ return super.create(Object.assign({}, injections, options));
5189
+ } else {
5190
+ return super.create(injections);
5191
+ }
5192
+ }
5193
+
5194
+ };
5195
+ }
5196
+
5197
+ static reopenClass(injections) {
5198
+ Object.assign(this, injections);
5199
+ }
5200
+
5201
+ static create(options) {
5202
+ let {
5203
+ environment: _environment,
5204
+ application: namespace,
5205
+ template: templateFactory$$1
5206
+ } = options;
5207
+ let owner = getOwner(options);
5208
+ assert('OutletView is unexpectedly missing an owner', owner);
5209
+ let template = templateFactory$$1(owner);
5210
+ return new OutletView(_environment, owner, template, namespace);
5211
+ }
5212
+
5213
+ appendTo(selector) {
5214
+ let target;
5215
+
5216
+ if (this._environment.hasDOM) {
5217
+ target = typeof selector === 'string' ? document.querySelector(selector) : selector;
5218
+ } else {
5219
+ target = selector;
5220
+ }
5221
+
5222
+ let renderer = this.owner.lookup('renderer:-dom'); // SAFETY: It's not clear that this cast is safe.
5223
+ // The types for appendOutletView may be incorrect or this is a potential bug.
5224
+
5225
+ schedule('render', renderer, 'appendOutletView', this, target);
5226
+ }
5227
+
5228
+ rerender() {
5229
+ /**/
5230
+ }
5231
+
5232
+ setOutletState(state) {
5233
+ updateRef(this.ref, state);
5234
+ }
5235
+
5236
+ destroy() {
5237
+ /**/
5238
+ }
5239
+
5240
+ }
5241
+
5780
5242
  class DynamicScope {
5781
5243
  constructor(view, outletState) {
5782
5244
  this.view = view;
@@ -5831,7 +5293,7 @@ class RootState {
5831
5293
  this.root = root;
5832
5294
  this.runtime = runtime;
5833
5295
  assert(`You cannot render \`${valueForRef(self)}\` without a template.`, template !== undefined);
5834
- this.id = getViewId(root);
5296
+ this.id = root instanceof OutletView ? guidFor(root) : getViewId(root);
5835
5297
  this.result = undefined;
5836
5298
  this.destroyed = false;
5837
5299
  this.render = errorLoopTransaction(() => {
@@ -6263,104 +5725,6 @@ var OutletTemplate = templateFactory({
6263
5725
  "isStrictMode": false
6264
5726
  });
6265
5727
 
6266
- const TOP_LEVEL_NAME = '-top-level';
6267
- const TOP_LEVEL_OUTLET = 'main';
6268
- class OutletView {
6269
- constructor(_environment, owner, template, namespace) {
6270
- this._environment = _environment;
6271
- this.owner = owner;
6272
- this.template = template;
6273
- this.namespace = namespace;
6274
- let outletStateTag = createTag();
6275
- let outletState = {
6276
- outlets: {
6277
- main: undefined
6278
- },
6279
- render: {
6280
- owner: owner,
6281
- into: undefined,
6282
- outlet: TOP_LEVEL_OUTLET,
6283
- name: TOP_LEVEL_NAME,
6284
- controller: undefined,
6285
- model: undefined,
6286
- template
6287
- }
6288
- };
6289
- let ref = this.ref = createComputeRef(() => {
6290
- consumeTag(outletStateTag);
6291
- return outletState;
6292
- }, state => {
6293
- dirtyTag(outletStateTag);
6294
- outletState.outlets.main = state;
6295
- });
6296
- this.state = {
6297
- ref,
6298
- name: TOP_LEVEL_NAME,
6299
- outlet: TOP_LEVEL_OUTLET,
6300
- template,
6301
- controller: undefined,
6302
- model: undefined
6303
- };
6304
- }
6305
-
6306
- static extend(injections) {
6307
- return class extends OutletView {
6308
- static create(options) {
6309
- if (options) {
6310
- return super.create(Object.assign({}, injections, options));
6311
- } else {
6312
- return super.create(injections);
6313
- }
6314
- }
6315
-
6316
- };
6317
- }
6318
-
6319
- static reopenClass(injections) {
6320
- Object.assign(this, injections);
6321
- }
6322
-
6323
- static create(options) {
6324
- let {
6325
- environment: _environment,
6326
- application: namespace,
6327
- template: templateFactory$$1
6328
- } = options;
6329
- let owner = getOwner(options);
6330
- assert('OutletView is unexpectedly missing an owner', owner);
6331
- let template = templateFactory$$1(owner);
6332
- return new OutletView(_environment, owner, template, namespace);
6333
- }
6334
-
6335
- appendTo(selector) {
6336
- let target;
6337
-
6338
- if (this._environment.hasDOM) {
6339
- target = typeof selector === 'string' ? document.querySelector(selector) : selector;
6340
- } else {
6341
- target = selector;
6342
- }
6343
-
6344
- let renderer = this.owner.lookup('renderer:-dom'); // SAFETY: It's not clear that this cast is safe.
6345
- // The types for appendOutletView may be incorrect or this is a potential bug.
6346
-
6347
- schedule('render', renderer, 'appendOutletView', this, target);
6348
- }
6349
-
6350
- rerender() {
6351
- /**/
6352
- }
6353
-
6354
- setOutletState(state) {
6355
- updateRef(this.ref, state);
6356
- }
6357
-
6358
- destroy() {
6359
- /**/
6360
- }
6361
-
6362
- }
6363
-
6364
5728
  function setupApplicationRegistry(registry) {
6365
5729
  // because we are using injections we can't use instantiate false
6366
5730
  // we need to use bind() to copy the function so factory for