ember-source 4.4.0-alpha.1 → 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 (110) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/blueprints/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +4 -4
  3. package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +3 -3
  4. package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +2 -2
  5. package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +3 -3
  6. package/blueprints/component/index.js +2 -2
  7. package/blueprints/component-class/index.js +2 -2
  8. package/blueprints/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +4 -4
  9. package/blueprints/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +7 -5
  10. package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +6 -6
  11. package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +4 -4
  12. package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +6 -6
  13. package/blueprints/controller/files/__root__/__path__/__name__.js +1 -2
  14. package/blueprints/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
  15. package/blueprints/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
  16. package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +3 -3
  17. package/blueprints/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
  18. package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +3 -3
  19. package/blueprints/helper/files/__root__/__collection__/__name__.js +1 -1
  20. package/blueprints/helper/mu-files/__root__/__collection__/__name__.js +1 -1
  21. package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +3 -3
  22. package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +6 -4
  23. package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +3 -3
  24. package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
  25. package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +3 -3
  26. package/blueprints/initializer/files/__root__/initializers/__name__.js +2 -3
  27. package/blueprints/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +6 -7
  28. package/blueprints/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
  29. package/blueprints/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +3 -4
  30. package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +2 -3
  31. package/blueprints/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +5 -5
  32. package/blueprints/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
  33. package/blueprints/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +2 -2
  34. package/blueprints/mixin/files/__root__/mixins/__name__.js +1 -2
  35. package/blueprints/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
  36. package/blueprints/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
  37. package/blueprints/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
  38. package/blueprints/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +1 -1
  39. package/blueprints/route/files/__root__/__path__/__name__.js +2 -2
  40. package/blueprints/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
  41. package/blueprints/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
  42. package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +3 -3
  43. package/blueprints/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
  44. package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +3 -3
  45. package/blueprints/service/files/__root__/__path__/__name__.js +1 -2
  46. package/blueprints/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
  47. package/blueprints/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
  48. package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +3 -3
  49. package/blueprints/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
  50. package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +3 -3
  51. package/blueprints/util-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
  52. package/blueprints/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
  53. package/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
  54. package/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +2 -3
  55. package/build-metadata.json +3 -3
  56. package/dist/dependencies/router_js.js +1 -1
  57. package/dist/ember-template-compiler.js +20 -143
  58. package/dist/ember-template-compiler.map +1 -1
  59. package/dist/ember-testing.js +5 -3
  60. package/dist/ember-testing.map +1 -1
  61. package/dist/ember.debug.js +1132 -1719
  62. package/dist/ember.debug.map +1 -1
  63. package/dist/header/license.js +1 -1
  64. package/dist/packages/@ember/-internals/container/index.js +3 -19
  65. package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +10 -19
  66. package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +113 -112
  67. package/dist/packages/@ember/-internals/glimmer/index.js +163 -773
  68. package/dist/packages/@ember/-internals/metal/index.js +19 -32
  69. package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -1
  70. package/dist/packages/@ember/-internals/routing/lib/services/router.js +67 -12
  71. package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -0
  72. package/dist/packages/@ember/-internals/routing/lib/system/generate_controller.js +3 -1
  73. package/dist/packages/@ember/-internals/routing/lib/system/route.js +15 -7
  74. package/dist/packages/@ember/-internals/routing/lib/system/router.js +16 -21
  75. package/dist/packages/@ember/-internals/routing/lib/utils.js +2 -1
  76. package/dist/packages/@ember/-internals/runtime/lib/compare.js +19 -5
  77. package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +8 -4
  78. package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
  79. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
  80. package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +4 -4
  81. package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +29 -29
  82. package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
  83. package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +51 -50
  84. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
  85. package/dist/packages/@ember/-internals/utils/index.js +1 -1
  86. package/dist/packages/@ember/-internals/views/lib/system/utils.js +4 -2
  87. package/dist/packages/@ember/-internals/views/lib/views/core_view.js +5 -22
  88. package/dist/packages/@ember/application/instance.js +3 -3
  89. package/dist/packages/@ember/canary-features/index.js +4 -12
  90. package/dist/packages/@ember/debug/index.js +1 -1
  91. package/dist/packages/@ember/debug/lib/capture-render-tree.js +2 -0
  92. package/dist/packages/@ember/debug/lib/handlers.js +1 -1
  93. package/dist/packages/@ember/renderer/index.js +21 -0
  94. package/dist/packages/@ember/runloop/index.js +31 -528
  95. package/dist/packages/@ember/runloop/type-tests.ts/begin-end.test.js +5 -0
  96. package/dist/packages/@ember/runloop/type-tests.ts/bind.test.js +59 -0
  97. package/dist/packages/@ember/runloop/type-tests.ts/cancel.test.js +5 -0
  98. package/dist/packages/@ember/runloop/type-tests.ts/debounce.test.js +77 -0
  99. package/dist/packages/@ember/runloop/type-tests.ts/join.test.js +38 -0
  100. package/dist/packages/@ember/runloop/type-tests.ts/later.test.js +38 -0
  101. package/dist/packages/@ember/runloop/type-tests.ts/next.test.js +38 -0
  102. package/dist/packages/@ember/runloop/type-tests.ts/once.test.js +38 -0
  103. package/dist/packages/@ember/runloop/type-tests.ts/run.test.js +38 -0
  104. package/dist/packages/@ember/runloop/type-tests.ts/schedule-once.test.js +39 -0
  105. package/dist/packages/@ember/runloop/type-tests.ts/schedule.test.js +39 -0
  106. package/dist/packages/@ember/runloop/type-tests.ts/throttle.test.js +77 -0
  107. package/dist/packages/ember/index.js +4 -14
  108. package/dist/packages/ember/version.js +1 -1
  109. package/docs/data.json +658 -383
  110. package/package.json +10 -10
@@ -9,8 +9,9 @@ import { untrack, consumeTag, createCache, getValue, tagFor, beginUntrackFrame,
9
9
  import { tracked, get, PROPERTY_DID_CHANGE, tagForObject, objectAt, tagForProperty, set, _getProp, _setProp } from '@ember/-internals/metal';
10
10
  import { action } from '@ember/object';
11
11
  import { hasDOM } from '@ember/-internals/browser-environment';
12
- import { isSimpleClick, clearElementView, clearViewElement, getViewElement, MUTABLE_CELL, addChildView, setElementView, setViewElement, ActionSupport, ChildViewsSupport, ClassNamesSupport, CoreView, ViewMixin, ViewStateSupport, constructStyleDeprecationMessage, ActionManager, getViewId } from '@ember/-internals/views';
12
+ import { isSimpleClick, clearElementView, clearViewElement, getViewElement, MUTABLE_CELL, addChildView, setElementView, setViewElement, ActionSupport, ChildViewsSupport, ClassNamesSupport, CoreView, EventDispatcher, ViewMixin, ViewStateSupport, constructStyleDeprecationMessage, ActionManager, getViewId } from '@ember/-internals/views';
13
13
  import { getEngineParent } from '@ember/engine';
14
+ import EngineInstance from '@ember/engine/instance';
14
15
  import { flaggedInstrument, _instrumentStart } from '@ember/instrumentation';
15
16
  import { service } from '@ember/service';
16
17
  import { DEBUG } from '@glimmer/env';
@@ -299,7 +300,7 @@ class ForkedValue {
299
300
  class AbstractInput extends InternalComponent {
300
301
  constructor() {
301
302
  super(...arguments);
302
- this._value = valueFrom(this.args.named.value);
303
+ this._value = valueFrom(this.args.named['value']);
303
304
  }
304
305
 
305
306
  validateArguments() {
@@ -554,7 +555,7 @@ if (hasDOM) {
554
555
  class Input extends AbstractInput {
555
556
  constructor() {
556
557
  super(...arguments);
557
- this._checked = valueFrom(this.args.named.checked);
558
+ this._checked = valueFrom(this.args.named['checked']);
558
559
  }
559
560
 
560
561
  static toString() {
@@ -594,7 +595,7 @@ class Input extends AbstractInput {
594
595
 
595
596
  get checked() {
596
597
  if (this.isCheckbox) {
597
- 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'), {
598
599
  id: 'ember.built-in-components.input-checkbox-value'
599
600
  });
600
601
  return this._checked.get();
@@ -604,7 +605,7 @@ class Input extends AbstractInput {
604
605
  }
605
606
 
606
607
  set checked(checked) {
607
- 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'), {
608
609
  id: 'ember.built-in-components.input-checkbox-value'
609
610
  });
610
611
 
@@ -1099,11 +1100,13 @@ class LinkTo extends InternalComponent {
1099
1100
  }
1100
1101
 
1101
1102
  get isEngine() {
1102
- return getEngineParent(this.owner) !== undefined;
1103
+ let owner = this.owner;
1104
+ return owner instanceof EngineInstance && getEngineParent(owner) !== undefined;
1103
1105
  }
1104
1106
 
1105
1107
  get engineMountPoint() {
1106
- return this.owner.mountPoint;
1108
+ let owner = this.owner;
1109
+ return owner instanceof EngineInstance ? owner.mountPoint : undefined;
1107
1110
  }
1108
1111
 
1109
1112
  classFor(state) {
@@ -1895,8 +1898,8 @@ var action$1 = internalHelper(args => {
1895
1898
  let [context, action$$1, ...restArgs] = positional;
1896
1899
  assert('hash position arguments', context && action$$1);
1897
1900
  let debugKey = action$$1.debugLabel;
1898
- let target = 'target' in named && named.target ? named.target : context;
1899
- 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);
1900
1903
  let fn$$1;
1901
1904
 
1902
1905
  if (isInvokableRef(action$$1)) {
@@ -1960,13 +1963,12 @@ function makeClosureAction(context, target, action$$1, processArgs, debugKey) {
1960
1963
  let self;
1961
1964
  let fn$$1;
1962
1965
  assert(`Action passed is null or undefined in (action) from ${target}.`, action$$1 !== undefined && action$$1 !== null);
1963
- let typeofAction = typeof action$$1;
1964
1966
 
1965
- if (typeofAction === 'string') {
1967
+ if (typeof action$$1 === 'string') {
1966
1968
  self = target;
1967
1969
  fn$$1 = target.actions && target.actions[action$$1];
1968
1970
  assert(`An action named '${action$$1}' was not found in ${target}`, Boolean(fn$$1));
1969
- } else if (typeofAction === 'function') {
1971
+ } else if (typeof action$$1 === 'function') {
1970
1972
  self = context;
1971
1973
  fn$$1 = action$$1;
1972
1974
  } else {
@@ -2490,625 +2492,6 @@ function isCurlyManager(manager) {
2490
2492
  }
2491
2493
 
2492
2494
  let lazyEventsProcessed = new WeakMap();
2493
- /**
2494
- @module @ember/component
2495
- */
2496
-
2497
- /**
2498
- A component is a reusable UI element that consists of a `.hbs` template and an
2499
- optional JavaScript class that defines its behavior. For example, someone
2500
- might make a `button` in the template and handle the click behavior in the
2501
- JavaScript file that shares the same name as the template.
2502
-
2503
- Components are broken down into two categories:
2504
-
2505
- - Components _without_ JavaScript, that are based only on a template. These
2506
- are called Template-only or TO components.
2507
- - Components _with_ JavaScript, which consist of a template and a backing
2508
- class.
2509
-
2510
- Ember ships with two types of JavaScript classes for components:
2511
-
2512
- 1. Glimmer components, imported from `@glimmer/component`, which are the
2513
- default component's for Ember Octane (3.15) and more recent editions.
2514
- 2. Classic components, imported from `@ember/component`, which were the
2515
- default for older editions of Ember (pre 3.15).
2516
-
2517
- Below is the documentation for Classic components. If you are looking for the
2518
- API documentation for Template-only or Glimmer components, it is
2519
- [available here](/ember/release/modules/@glimmer%2Fcomponent).
2520
-
2521
- ## Defining a Classic Component
2522
-
2523
- If you want to customize the component in order to handle events, transform
2524
- arguments or maintain internal state, you implement a subclass of `Component`.
2525
-
2526
- One example is to add computed properties to your component:
2527
-
2528
- ```app/components/person-profile.js
2529
- import Component from '@ember/component';
2530
-
2531
- export default Component.extend({
2532
- displayName: computed('person.title', 'person.firstName', 'person.lastName', function() {
2533
- let { title, firstName, lastName } = this.person;
2534
-
2535
- if (title) {
2536
- return `${title} ${lastName}`;
2537
- } else {
2538
- return `${firstName} ${lastName}`;
2539
- }
2540
- })
2541
- });
2542
- ```
2543
-
2544
- And then use it in the component's template:
2545
-
2546
- ```app/templates/components/person-profile.hbs
2547
- <h1>{{this.displayName}}</h1>
2548
- {{yield}}
2549
- ```
2550
-
2551
- ## Customizing a Classic Component's HTML Element in JavaScript
2552
-
2553
- ### HTML Tag
2554
-
2555
- The default HTML tag name used for a component's HTML representation is `div`.
2556
- This can be customized by setting the `tagName` property.
2557
-
2558
- Consider the following component class:
2559
-
2560
- ```app/components/emphasized-paragraph.js
2561
- import Component from '@ember/component';
2562
-
2563
- export default Component.extend({
2564
- tagName: 'em'
2565
- });
2566
- ```
2567
-
2568
- When invoked, this component would produce output that looks something like
2569
- this:
2570
-
2571
- ```html
2572
- <em id="ember1" class="ember-view"></em>
2573
- ```
2574
-
2575
- ### HTML `class` Attribute
2576
-
2577
- The HTML `class` attribute of a component's tag can be set by providing a
2578
- `classNames` property that is set to an array of strings:
2579
-
2580
- ```app/components/my-widget.js
2581
- import Component from '@ember/component';
2582
-
2583
- export default Component.extend({
2584
- classNames: ['my-class', 'my-other-class']
2585
- });
2586
- ```
2587
-
2588
- Invoking this component will produce output that looks like this:
2589
-
2590
- ```html
2591
- <div id="ember1" class="ember-view my-class my-other-class"></div>
2592
- ```
2593
-
2594
- `class` attribute values can also be set by providing a `classNameBindings`
2595
- property set to an array of properties names for the component. The return
2596
- value of these properties will be added as part of the value for the
2597
- components's `class` attribute. These properties can be computed properties:
2598
-
2599
- ```app/components/my-widget.js
2600
- import Component from '@ember/component';
2601
- import { computed } from '@ember/object';
2602
-
2603
- export default Component.extend({
2604
- classNames: ['my-class', 'my-other-class'],
2605
- classNameBindings: ['propertyA', 'propertyB'],
2606
-
2607
- propertyA: 'from-a',
2608
- propertyB: computed(function() {
2609
- if (someLogic) { return 'from-b'; }
2610
- })
2611
- });
2612
- ```
2613
-
2614
- Invoking this component will produce HTML that looks like:
2615
-
2616
- ```html
2617
- <div id="ember1" class="ember-view my-class my-other-class from-a from-b"></div>
2618
- ```
2619
-
2620
- Note that `classNames` and `classNameBindings` is in addition to the `class`
2621
- attribute passed with the angle bracket invocation syntax. Therefore, if this
2622
- component was invoked like so:
2623
-
2624
- ```handlebars
2625
- <MyWidget class="from-invocation" />
2626
- ```
2627
-
2628
- The resulting HTML will look similar to this:
2629
-
2630
- ```html
2631
- <div id="ember1" class="from-invocation ember-view my-class my-other-class from-a from-b"></div>
2632
- ```
2633
-
2634
- If the value of a class name binding returns a boolean the property name
2635
- itself will be used as the class name if the property is true. The class name
2636
- will not be added if the value is `false` or `undefined`.
2637
-
2638
- ```app/components/my-widget.js
2639
- import Component from '@ember/component';
2640
-
2641
- export default Component.extend({
2642
- classNameBindings: ['hovered'],
2643
-
2644
- hovered: true
2645
- });
2646
- ```
2647
-
2648
- Invoking this component will produce HTML that looks like:
2649
-
2650
- ```html
2651
- <div id="ember1" class="ember-view hovered"></div>
2652
- ```
2653
-
2654
- ### Custom Class Names for Boolean Values
2655
-
2656
- When using boolean class name bindings you can supply a string value other
2657
- than the property name for use as the `class` HTML attribute by appending the
2658
- preferred value after a ":" character when defining the binding:
2659
-
2660
- ```app/components/my-widget.js
2661
- import Component from '@ember/component';
2662
-
2663
- export default Component.extend({
2664
- classNameBindings: ['awesome:so-very-cool'],
2665
-
2666
- awesome: true
2667
- });
2668
- ```
2669
-
2670
- Invoking this component will produce HTML that looks like:
2671
-
2672
- ```html
2673
- <div id="ember1" class="ember-view so-very-cool"></div>
2674
- ```
2675
-
2676
- Boolean value class name bindings whose property names are in a
2677
- camelCase-style format will be converted to a dasherized format:
2678
-
2679
- ```app/components/my-widget.js
2680
- import Component from '@ember/component';
2681
-
2682
- export default Component.extend({
2683
- classNameBindings: ['isUrgent'],
2684
-
2685
- isUrgent: true
2686
- });
2687
- ```
2688
-
2689
- Invoking this component will produce HTML that looks like:
2690
-
2691
- ```html
2692
- <div id="ember1" class="ember-view is-urgent"></div>
2693
- ```
2694
-
2695
- Class name bindings can also refer to object values that are found by
2696
- traversing a path relative to the component itself:
2697
-
2698
- ```app/components/my-widget.js
2699
- import Component from '@ember/component';
2700
- import EmberObject from '@ember/object';
2701
-
2702
- export default Component.extend({
2703
- classNameBindings: ['messages.empty'],
2704
-
2705
- messages: EmberObject.create({
2706
- empty: true
2707
- })
2708
- });
2709
- ```
2710
-
2711
- Invoking this component will produce HTML that looks like:
2712
-
2713
- ```html
2714
- <div id="ember1" class="ember-view empty"></div>
2715
- ```
2716
-
2717
- If you want to add a class name for a property which evaluates to true and
2718
- and a different class name if it evaluates to false, you can pass a binding
2719
- like this:
2720
-
2721
- ```app/components/my-widget.js
2722
- import Component from '@ember/component';
2723
-
2724
- export default Component.extend({
2725
- classNameBindings: ['isEnabled:enabled:disabled'],
2726
- isEnabled: true
2727
- });
2728
- ```
2729
-
2730
- Invoking this component will produce HTML that looks like:
2731
-
2732
- ```html
2733
- <div id="ember1" class="ember-view enabled"></div>
2734
- ```
2735
-
2736
- When isEnabled is `false`, the resulting HTML representation looks like this:
2737
-
2738
- ```html
2739
- <div id="ember1" class="ember-view disabled"></div>
2740
- ```
2741
-
2742
- This syntax offers the convenience to add a class if a property is `false`:
2743
-
2744
- ```app/components/my-widget.js
2745
- import Component from '@ember/component';
2746
-
2747
- // Applies no class when isEnabled is true and class 'disabled' when isEnabled is false
2748
- export default Component.extend({
2749
- classNameBindings: ['isEnabled::disabled'],
2750
- isEnabled: true
2751
- });
2752
- ```
2753
-
2754
- Invoking this component when the `isEnabled` property is true will produce
2755
- HTML that looks like:
2756
-
2757
- ```html
2758
- <div id="ember1" class="ember-view"></div>
2759
- ```
2760
-
2761
- Invoking it when the `isEnabled` property on the component is `false` will
2762
- produce HTML that looks like:
2763
-
2764
- ```html
2765
- <div id="ember1" class="ember-view disabled"></div>
2766
- ```
2767
-
2768
- Updates to the value of a class name binding will result in automatic update
2769
- of the HTML `class` attribute in the component's rendered HTML
2770
- representation. If the value becomes `false` or `undefined` the class name
2771
- will be removed.
2772
-
2773
- Both `classNames` and `classNameBindings` are concatenated properties. See
2774
- [EmberObject](/ember/release/classes/EmberObject) documentation for more
2775
- information about concatenated properties.
2776
-
2777
- ### Other HTML Attributes
2778
-
2779
- The HTML attribute section of a component's tag can be set by providing an
2780
- `attributeBindings` property set to an array of property names on the component.
2781
- The return value of these properties will be used as the value of the component's
2782
- HTML associated attribute:
2783
-
2784
- ```app/components/my-anchor.js
2785
- import Component from '@ember/component';
2786
-
2787
- export default Component.extend({
2788
- tagName: 'a',
2789
- attributeBindings: ['href'],
2790
-
2791
- href: 'http://google.com'
2792
- });
2793
- ```
2794
-
2795
- Invoking this component will produce HTML that looks like:
2796
-
2797
- ```html
2798
- <a id="ember1" class="ember-view" href="http://google.com"></a>
2799
- ```
2800
-
2801
- One property can be mapped on to another by placing a ":" between
2802
- the source property and the destination property:
2803
-
2804
- ```app/components/my-anchor.js
2805
- import Component from '@ember/component';
2806
-
2807
- export default Component.extend({
2808
- tagName: 'a',
2809
- attributeBindings: ['url:href'],
2810
-
2811
- url: 'http://google.com'
2812
- });
2813
- ```
2814
-
2815
- Invoking this component will produce HTML that looks like:
2816
-
2817
- ```html
2818
- <a id="ember1" class="ember-view" href="http://google.com"></a>
2819
- ```
2820
-
2821
- HTML attributes passed with angle bracket invocations will take precedence
2822
- over those specified in `attributeBindings`. Therefore, if this component was
2823
- invoked like so:
2824
-
2825
- ```handlebars
2826
- <MyAnchor href="http://bing.com" @url="http://google.com" />
2827
- ```
2828
-
2829
- The resulting HTML will looks like this:
2830
-
2831
- ```html
2832
- <a id="ember1" class="ember-view" href="http://bing.com"></a>
2833
- ```
2834
-
2835
- Note that the `href` attribute is ultimately set to `http://bing.com`,
2836
- despite it having attribute binidng to the `url` property, which was
2837
- set to `http://google.com`.
2838
-
2839
- Namespaced attributes (e.g. `xlink:href`) are supported, but have to be
2840
- mapped, since `:` is not a valid character for properties in Javascript:
2841
-
2842
- ```app/components/my-use.js
2843
- import Component from '@ember/component';
2844
-
2845
- export default Component.extend({
2846
- tagName: 'use',
2847
- attributeBindings: ['xlinkHref:xlink:href'],
2848
-
2849
- xlinkHref: '#triangle'
2850
- });
2851
- ```
2852
-
2853
- Invoking this component will produce HTML that looks like:
2854
-
2855
- ```html
2856
- <use xlink:href="#triangle"></use>
2857
- ```
2858
-
2859
- If the value of a property monitored by `attributeBindings` is a boolean, the
2860
- attribute will be present or absent depending on the value:
2861
-
2862
- ```app/components/my-text-input.js
2863
- import Component from '@ember/component';
2864
-
2865
- export default Component.extend({
2866
- tagName: 'input',
2867
- attributeBindings: ['disabled'],
2868
-
2869
- disabled: false
2870
- });
2871
- ```
2872
-
2873
- Invoking this component will produce HTML that looks like:
2874
-
2875
- ```html
2876
- <input id="ember1" class="ember-view" />
2877
- ```
2878
-
2879
- `attributeBindings` can refer to computed properties:
2880
-
2881
- ```app/components/my-text-input.js
2882
- import Component from '@ember/component';
2883
- import { computed } from '@ember/object';
2884
-
2885
- export default Component.extend({
2886
- tagName: 'input',
2887
- attributeBindings: ['disabled'],
2888
-
2889
- disabled: computed(function() {
2890
- if (someLogic) {
2891
- return true;
2892
- } else {
2893
- return false;
2894
- }
2895
- })
2896
- });
2897
- ```
2898
-
2899
- To prevent setting an attribute altogether, use `null` or `undefined` as the
2900
- value of the property used in `attributeBindings`:
2901
-
2902
- ```app/components/my-text-input.js
2903
- import Component from '@ember/component';
2904
-
2905
- export default Component.extend({
2906
- tagName: 'form',
2907
- attributeBindings: ['novalidate'],
2908
- novalidate: null
2909
- });
2910
- ```
2911
-
2912
- Updates to the property of an attribute binding will result in automatic
2913
- update of the HTML attribute in the component's HTML output.
2914
-
2915
- `attributeBindings` is a concatenated property. See
2916
- [EmberObject](/ember/release/classes/EmberObject) documentation for more
2917
- information about concatenated properties.
2918
-
2919
- ## Layouts
2920
-
2921
- The `layout` property can be used to dynamically specify a template associated
2922
- with a component class, instead of relying on Ember to link together a
2923
- component class and a template based on file names.
2924
-
2925
- In general, applications should not use this feature, but it's commonly used
2926
- in addons for historical reasons.
2927
-
2928
- The `layout` property should be set to the default export of a template
2929
- module, which is the name of a template file without the `.hbs` extension.
2930
-
2931
- ```app/templates/components/person-profile.hbs
2932
- <h1>Person's Title</h1>
2933
- <div class='details'>{{yield}}</div>
2934
- ```
2935
-
2936
- ```app/components/person-profile.js
2937
- import Component from '@ember/component';
2938
- import layout from '../templates/components/person-profile';
2939
-
2940
- export default Component.extend({
2941
- layout
2942
- });
2943
- ```
2944
-
2945
- If you invoke the component:
2946
-
2947
- ```handlebars
2948
- <PersonProfile>
2949
- <h2>Chief Basket Weaver</h2>
2950
- <h3>Fisherman Industries</h3>
2951
- </PersonProfile>
2952
- ```
2953
-
2954
- or
2955
-
2956
- ```handlebars
2957
- {{#person-profile}}
2958
- <h2>Chief Basket Weaver</h2>
2959
- <h3>Fisherman Industries</h3>
2960
- {{/person-profile}}
2961
- ```
2962
-
2963
- It will result in the following HTML output:
2964
-
2965
- ```html
2966
- <h1>Person's Title</h1>
2967
- <div class="details">
2968
- <h2>Chief Basket Weaver</h2>
2969
- <h3>Fisherman Industries</h3>
2970
- </div>
2971
- ```
2972
-
2973
- ## Handling Browser Events
2974
-
2975
- Components can respond to user-initiated events in one of three ways: passing
2976
- actions with angle bracket invocation, adding event handler methods to the
2977
- component's class, or adding actions to the component's template.
2978
-
2979
- ### Passing Actions With Angle Bracket Invocation
2980
-
2981
- For one-off events specific to particular instance of a component, it is possible
2982
- to pass actions to the component's element using angle bracket invocation syntax.
2983
-
2984
- ```handlebars
2985
- <MyWidget {{action 'firstWidgetClicked'}} />
2986
-
2987
- <MyWidget {{action 'secondWidgetClicked'}} />
2988
- ```
2989
-
2990
- In this case, when the first component is clicked on, Ember will invoke the
2991
- `firstWidgetClicked` action. When the second component is clicked on, Ember
2992
- will invoke the `secondWidgetClicked` action instead.
2993
-
2994
- Besides `{{action}}`, it is also possible to pass any arbitrary element modifiers
2995
- using the angle bracket invocation syntax.
2996
-
2997
- ### Event Handler Methods
2998
-
2999
- Components can also respond to user-initiated events by implementing a method
3000
- that matches the event name. This approach is appropriate when the same event
3001
- should be handled by all instances of the same component.
3002
-
3003
- An event object will be passed as the argument to the event handler method.
3004
-
3005
- ```app/components/my-widget.js
3006
- import Component from '@ember/component';
3007
-
3008
- export default Component.extend({
3009
- click(event) {
3010
- // `event.target` is either the component's element or one of its children
3011
- let tag = event.target.tagName.toLowerCase();
3012
- console.log('clicked on a `<${tag}>` HTML element!');
3013
- }
3014
- });
3015
- ```
3016
-
3017
- In this example, whenever the user clicked anywhere inside the component, it
3018
- will log a message to the console.
3019
-
3020
- It is possible to handle event types other than `click` by implementing the
3021
- following event handler methods. In addition, custom events can be registered
3022
- by using `Application.customEvents`.
3023
-
3024
- Touch events:
3025
-
3026
- * `touchStart`
3027
- * `touchMove`
3028
- * `touchEnd`
3029
- * `touchCancel`
3030
-
3031
- Keyboard events:
3032
-
3033
- * `keyDown`
3034
- * `keyUp`
3035
- * `keyPress`
3036
-
3037
- Mouse events:
3038
-
3039
- * `mouseDown`
3040
- * `mouseUp`
3041
- * `contextMenu`
3042
- * `click`
3043
- * `doubleClick`
3044
- * `focusIn`
3045
- * `focusOut`
3046
-
3047
- Form events:
3048
-
3049
- * `submit`
3050
- * `change`
3051
- * `focusIn`
3052
- * `focusOut`
3053
- * `input`
3054
-
3055
- Drag and drop events:
3056
-
3057
- * `dragStart`
3058
- * `drag`
3059
- * `dragEnter`
3060
- * `dragLeave`
3061
- * `dragOver`
3062
- * `dragEnd`
3063
- * `drop`
3064
-
3065
- ### `{{action}}` Helper
3066
-
3067
- Instead of handling all events of a particular type anywhere inside the
3068
- component's element, you may instead want to limit it to a particular
3069
- element in the component's template. In this case, it would be more
3070
- convenient to implement an action instead.
3071
-
3072
- For example, you could implement the action `hello` for the `person-profile`
3073
- component:
3074
-
3075
- ```app/components/person-profile.js
3076
- import Component from '@ember/component';
3077
-
3078
- export default Component.extend({
3079
- actions: {
3080
- hello(name) {
3081
- console.log("Hello", name);
3082
- }
3083
- }
3084
- });
3085
- ```
3086
-
3087
- And then use it in the component's template:
3088
-
3089
- ```app/templates/components/person-profile.hbs
3090
- <h1>{{@person.name}}</h1>
3091
-
3092
- <button {{action 'hello' @person.name}}>
3093
- Say Hello to {{@person.name}}
3094
- </button>
3095
- ```
3096
-
3097
- When the user clicks the button, Ember will invoke the `hello` action,
3098
- passing in the current value of `@person.name` as an argument.
3099
-
3100
- See [Ember.Templates.helpers.action](/ember/release/classes/Ember.Templates.helpers/methods/action?anchor=action).
3101
-
3102
- @class Component
3103
- @extends Ember.CoreView
3104
- @uses Ember.TargetActionSupport
3105
- @uses Ember.ClassNamesSupport
3106
- @uses Ember.ActionSupport
3107
- @uses Ember.ViewMixin
3108
- @uses Ember.ViewStateSupport
3109
- @public
3110
- */
3111
-
3112
2495
  const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassNamesSupport, TargetActionSupport, ActionSupport, ViewMixin, {
3113
2496
  isComponent: true,
3114
2497
 
@@ -3165,6 +2548,7 @@ const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassName
3165
2548
 
3166
2549
  if (owner.lookup('-environment:main').isInteractive) {
3167
2550
  this.__dispatcher = owner.lookup('event_dispatcher:main');
2551
+ assert('Expected dispatcher to be an EventDispatcher', this.__dispatcher instanceof EventDispatcher);
3168
2552
  } else {
3169
2553
  // In FastBoot we have no EventDispatcher. Set to null to not try again to look it up.
3170
2554
  this.__dispatcher = null;
@@ -3414,23 +2798,6 @@ const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassName
3414
2798
  @since 1.13.0
3415
2799
  */
3416
2800
 
3417
- /**
3418
- Layout can be used to wrap content in a component.
3419
- @property layout
3420
- @type Function
3421
- @public
3422
- */
3423
-
3424
- /**
3425
- The name of the layout to lookup if no layout is provided.
3426
- By default `Component` will lookup a template with this name in
3427
- `Ember.TEMPLATES` (a shared global object).
3428
- @property layoutName
3429
- @type String
3430
- @default null
3431
- @private
3432
- */
3433
-
3434
2801
  /**
3435
2802
  The HTML `id` of the component's element in the DOM. You can provide this
3436
2803
  value yourself but it must be unique (just as in HTML):
@@ -3787,11 +3154,9 @@ class OutletComponentManager {
3787
3154
  let currentOwner = valueForRef(currentStateRef).render.owner;
3788
3155
 
3789
3156
  if (parentOwner && parentOwner !== currentOwner) {
3790
- let engine = currentOwner;
3791
- assert('invalid engine: missing mountPoint', typeof currentOwner.mountPoint === 'string');
3792
- assert('invalid engine: missing routable', currentOwner.routable === true);
3793
- let mountPoint = engine.mountPoint;
3794
- state.engine = engine;
3157
+ assert('Expected currentOwner to be an EngineInstance', currentOwner instanceof EngineInstance);
3158
+ let mountPoint = currentOwner.mountPoint;
3159
+ state.engine = currentOwner;
3795
3160
  state.engineBucket = {
3796
3161
  mountPoint
3797
3162
  };
@@ -4469,7 +3834,7 @@ setGlobalContext({
4469
3834
  },
4470
3835
 
4471
3836
  warnIfStyleNotTrusted(value) {
4472
- warn(constructStyleDeprecationMessage(value), (() => {
3837
+ warn(constructStyleDeprecationMessage(String(value)), (() => {
4473
3838
  if (value === null || value === undefined || isHTMLSafe$1(value)) {
4474
3839
  return true;
4475
3840
  }
@@ -4557,9 +3922,9 @@ var disallowDynamicResolution = internalHelper(({
4557
3922
  }) => {
4558
3923
  const nameOrValueRef = positional[0];
4559
3924
  assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1 && nameOrValueRef);
4560
- let typeRef = named.type;
4561
- let locRef = named.loc;
4562
- let originalRef = named.original;
3925
+ let typeRef = named['type'];
3926
+ let locRef = named['loc'];
3927
+ let originalRef = named['original'];
4563
3928
  assert(`[BUG] expecting \`type\` named argument`, typeRef);
4564
3929
  assert(`[BUG] expecting \`loc\` named argument`, locRef);
4565
3930
  assert(`[BUG] expecting \`original\` named argument`, originalRef); // Bug: why do these fail?
@@ -4575,7 +3940,7 @@ var disallowDynamicResolution = internalHelper(({
4575
3940
  assert('[BUG] expecting a string literal for the `original` argument', typeof original === 'string');
4576
3941
  return createComputeRef(() => {
4577
3942
  let nameOrValue = valueForRef(nameOrValueRef);
4578
- assert(`Passing a dynamic string to the \`(${type})\` keyword is disallowed. ` + `(You specified \`(${type} ${original})\` and \`${original}\` evaluated into "${nameOrValue}".) ` + `This ensures we can statically analyze the template and determine which ${type}s are used. ` + `If the ${type} name is always the same, use a string literal instead, i.e. \`(${type} "${nameOrValue}")\`. ` + `Otherwise, import the ${type}s into JavaScript and pass them to the ${type} keyword. ` + 'See https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md#4-no-dynamic-resolution for details. ' + loc, typeof nameOrValue !== 'string');
3943
+ assert(`Passing a dynamic string to the \`(${type})\` keyword is disallowed. ` + `(You specified \`(${type} ${original})\` and \`${original}\` evaluated into "${nameOrValue}".) ` + `This ensures we can statically analyze the template and determine which ${type}s are used. ` + `If the ${type} name is always the same, use a string literal instead, i.e. \`(${type} "${nameOrValue}")\`. ` + `Otherwise, import the ${type}s into JavaScript and pass them directly. ` + 'See https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md#4-no-dynamic-resolution for details. ' + loc, typeof nameOrValue !== 'string');
4579
3944
  return nameOrValue;
4580
3945
  });
4581
3946
  });
@@ -4933,6 +4298,25 @@ var unbound = internalHelper(({
4933
4298
  return createUnboundRef(valueForRef(positional[0]), '(result of an `unbound` helper)');
4934
4299
  });
4935
4300
 
4301
+ /**
4302
+ @module ember
4303
+ */
4304
+ internalHelper(() => {
4305
+ return createConstRef(uniqueId$1(), 'unique-id');
4306
+ }); // From https://gist.github.com/selfish/fef2c0ba6cdfe07af76e64cecd74888b
4307
+ //
4308
+ // This code should be reasonably fast, and provide a unique value every time
4309
+ // it's called, which is what we need here. It produces a string formatted as a
4310
+ // standard UUID, which avoids accidentally turning Ember-specific
4311
+ // implementation details into an intimate API.
4312
+
4313
+ function uniqueId$1() {
4314
+ // @ts-expect-error this one-liner abuses weird JavaScript semantics that
4315
+ // TypeScript (legitimately) doesn't like, but they're nonetheless valid and
4316
+ // specced.
4317
+ return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, a => (a ^ Math.random() * 16 >> a / 4).toString(16));
4318
+ }
4319
+
4936
4320
  const MODIFIERS = ['alt', 'shift', 'meta', 'ctrl'];
4937
4321
  const POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/;
4938
4322
 
@@ -5165,6 +4549,7 @@ class ActionModifierManager {
5165
4549
 
5166
4550
  ensureEventSetup(actionState) {
5167
4551
  let dispatcher = actionState.owner.lookup('event_dispatcher:main');
4552
+ assert('Expected dispatcher to be an EventDispatcher', dispatcher instanceof EventDispatcher);
5168
4553
  dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.setupHandlerForEmberEvent(actionState.eventName);
5169
4554
  }
5170
4555
 
@@ -5218,6 +4603,7 @@ class MountManager {
5218
4603
  // mount is a runtime helper, this shouldn't use dynamic layout
5219
4604
  // we should resolve the engine app template in the helper
5220
4605
  // it also should use the owner that looked up the mount helper.
4606
+ assert('Expected owner to be an EngineInstance', owner instanceof EngineInstance);
5221
4607
  let engine = owner.buildChildEngineInstance(name);
5222
4608
  engine.boot();
5223
4609
  let applicationFactory = engine.factoryFor(`controller:application`);
@@ -5430,28 +4816,17 @@ const mountHelper = internalHelper((args, owner) => {
5430
4816
  Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
5431
4817
 
5432
4818
  @method outlet
5433
- @param {String} [name]
5434
4819
  @for Ember.Templates.helpers
5435
4820
  @public
5436
4821
  */
5437
4822
 
5438
- const outletHelper = internalHelper((args, owner, scope) => {
4823
+ const outletHelper = internalHelper((_args, owner, scope) => {
5439
4824
  assert('Expected owner to be present, {{outlet}} requires an owner', owner);
5440
4825
  assert('Expected dynamic scope to be present. You may have attempted to use the {{outlet}} keyword dynamically. This keyword cannot be used dynamically.', scope);
5441
- let nameRef;
5442
-
5443
- if (args.positional.length === 0) {
5444
- nameRef = createPrimitiveRef('main');
5445
- } else {
5446
- let maybeNameRef = args.positional[0];
5447
- assert('Expected at least one positional arg', maybeNameRef);
5448
- nameRef = maybeNameRef;
5449
- }
5450
-
5451
4826
  let outletRef = createComputeRef(() => {
5452
4827
  let state = valueForRef(scope.get('outletState'));
5453
4828
  let outlets = state !== undefined ? state.outlets : undefined;
5454
- return outlets !== undefined ? outlets[valueForRef(nameRef)] : undefined;
4829
+ return outlets !== undefined ? outlets['main'] : undefined;
5455
4830
  });
5456
4831
  let lastState = null;
5457
4832
  let definition = null;
@@ -5476,7 +4851,7 @@ const outletHelper = internalHelper((args, owner, scope) => {
5476
4851
  // provide the correct updated value. So we stop updating and return
5477
4852
  // the _last_ model value for that outlet.
5478
4853
 
5479
- named.model = createComputeRef(() => {
4854
+ named['model'] = createComputeRef(() => {
5480
4855
  if (lastState === state) {
5481
4856
  model = valueForRef(modelRef);
5482
4857
  }
@@ -5485,7 +4860,7 @@ const outletHelper = internalHelper((args, owner, scope) => {
5485
4860
  });
5486
4861
 
5487
4862
  if (DEBUG) {
5488
- named.model = createDebugAliasRef('@model', named.model);
4863
+ named['model'] = createDebugAliasRef('@model', named['model']);
5489
4864
  }
5490
4865
 
5491
4866
  let args = createCapturedArgs(named, EMPTY_POSITIONAL);
@@ -5541,9 +4916,9 @@ function instrumentationPayload$1(name) {
5541
4916
  };
5542
4917
  }
5543
4918
 
5544
- function componentFor(name, owner, options) {
4919
+ function componentFor(name, owner) {
5545
4920
  let fullName = `component:${name}`;
5546
- return owner.factoryFor(fullName, options) || null;
4921
+ return owner.factoryFor(fullName) || null;
5547
4922
  }
5548
4923
 
5549
4924
  function layoutFor(name, owner, options) {
@@ -5552,7 +4927,7 @@ function layoutFor(name, owner, options) {
5552
4927
  }
5553
4928
 
5554
4929
  function lookupComponentPair(owner, name, options) {
5555
- let component = componentFor(name, owner, options);
4930
+ let component = componentFor(name, owner);
5556
4931
 
5557
4932
  if (component !== null && component.class !== undefined) {
5558
4933
  let layout = getComponentTemplate(component.class);
@@ -5613,6 +4988,7 @@ const BUILTIN_HELPERS = Object.assign(Object.assign({}, BUILTIN_KEYWORD_HELPERS)
5613
4988
  get: get$1,
5614
4989
  hash
5615
4990
  });
4991
+
5616
4992
  const BUILTIN_KEYWORD_MODIFIERS = {
5617
4993
  action: actionModifier
5618
4994
  };
@@ -5765,6 +5141,104 @@ class ResolverImpl {
5765
5141
 
5766
5142
  }
5767
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
+
5768
5242
  class DynamicScope {
5769
5243
  constructor(view, outletState) {
5770
5244
  this.view = view;
@@ -5819,7 +5293,7 @@ class RootState {
5819
5293
  this.root = root;
5820
5294
  this.runtime = runtime;
5821
5295
  assert(`You cannot render \`${valueForRef(self)}\` without a template.`, template !== undefined);
5822
- this.id = getViewId(root);
5296
+ this.id = root instanceof OutletView ? guidFor(root) : getViewId(root);
5823
5297
  this.result = undefined;
5824
5298
  this.destroyed = false;
5825
5299
  this.render = errorLoopTransaction(() => {
@@ -6251,102 +5725,6 @@ var OutletTemplate = templateFactory({
6251
5725
  "isStrictMode": false
6252
5726
  });
6253
5727
 
6254
- const TOP_LEVEL_NAME = '-top-level';
6255
- const TOP_LEVEL_OUTLET = 'main';
6256
- class OutletView {
6257
- constructor(_environment, owner, template, namespace) {
6258
- this._environment = _environment;
6259
- this.owner = owner;
6260
- this.template = template;
6261
- this.namespace = namespace;
6262
- let outletStateTag = createTag();
6263
- let outletState = {
6264
- outlets: {
6265
- main: undefined
6266
- },
6267
- render: {
6268
- owner: owner,
6269
- into: undefined,
6270
- outlet: TOP_LEVEL_OUTLET,
6271
- name: TOP_LEVEL_NAME,
6272
- controller: undefined,
6273
- model: undefined,
6274
- template
6275
- }
6276
- };
6277
- let ref = this.ref = createComputeRef(() => {
6278
- consumeTag(outletStateTag);
6279
- return outletState;
6280
- }, state => {
6281
- dirtyTag(outletStateTag);
6282
- outletState.outlets.main = state;
6283
- });
6284
- this.state = {
6285
- ref,
6286
- name: TOP_LEVEL_NAME,
6287
- outlet: TOP_LEVEL_OUTLET,
6288
- template,
6289
- controller: undefined,
6290
- model: undefined
6291
- };
6292
- }
6293
-
6294
- static extend(injections) {
6295
- return class extends OutletView {
6296
- static create(options) {
6297
- if (options) {
6298
- return super.create(Object.assign({}, injections, options));
6299
- } else {
6300
- return super.create(injections);
6301
- }
6302
- }
6303
-
6304
- };
6305
- }
6306
-
6307
- static reopenClass(injections) {
6308
- Object.assign(this, injections);
6309
- }
6310
-
6311
- static create(options) {
6312
- let {
6313
- environment: _environment,
6314
- application: namespace,
6315
- template: templateFactory$$1
6316
- } = options;
6317
- let owner = getOwner(options);
6318
- assert('OutletView is unexpectedly missing an owner', owner);
6319
- let template = templateFactory$$1(owner);
6320
- return new OutletView(_environment, owner, template, namespace);
6321
- }
6322
-
6323
- appendTo(selector) {
6324
- let target;
6325
-
6326
- if (this._environment.hasDOM) {
6327
- target = typeof selector === 'string' ? document.querySelector(selector) : selector;
6328
- } else {
6329
- target = selector;
6330
- }
6331
-
6332
- let renderer = this.owner.lookup('renderer:-dom');
6333
- schedule('render', renderer, 'appendOutletView', this, target);
6334
- }
6335
-
6336
- rerender() {
6337
- /**/
6338
- }
6339
-
6340
- setOutletState(state) {
6341
- updateRef(this.ref, state);
6342
- }
6343
-
6344
- destroy() {
6345
- /**/
6346
- }
6347
-
6348
- }
6349
-
6350
5728
  function setupApplicationRegistry(registry) {
6351
5729
  // because we are using injections we can't use instantiate false
6352
5730
  // we need to use bind() to copy the function so factory for
@@ -6391,6 +5769,18 @@ function setupEngineRegistry(registry) {
6391
5769
  }
6392
5770
  }
6393
5771
 
5772
+ /**
5773
+ Associate a class with a component manager (an object that is responsible for
5774
+ coordinating the lifecycle events that occurs when invoking, rendering and
5775
+ re-rendering a component).
5776
+
5777
+ @method setComponentManager
5778
+ @param {Function} factory a function to create the owner for an object
5779
+ @param {Object} obj the object to associate with the componetn manager
5780
+ @return {Object} the same object passed in
5781
+ @public
5782
+ */
5783
+
6394
5784
  function setComponentManager$1(manager, obj) {
6395
5785
  return setComponentManager(manager, obj);
6396
5786
  }