ember-source 7.1.0-beta.1 → 7.1.0

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 (93) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/dev/packages/@ember/-internals/glimmer/index.js +5 -5
  3. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +1 -1
  4. package/dist/dev/packages/@ember/application/index.js +1 -1
  5. package/dist/dev/packages/@ember/application/instance.js +1 -1
  6. package/dist/dev/packages/@ember/array/index.js +4 -0
  7. package/dist/dev/packages/@ember/component/helper.js +1 -1
  8. package/dist/dev/packages/@ember/component/index.js +9 -3
  9. package/dist/dev/packages/@ember/engine/index.js +1 -1
  10. package/dist/dev/packages/@ember/helper/index.js +4 -23
  11. package/dist/dev/packages/@ember/modifier/on.js +1 -1
  12. package/dist/dev/packages/@ember/object/index.js +22 -17
  13. package/dist/dev/packages/@ember/renderer/index.js +1 -1
  14. package/dist/dev/packages/@ember/routing/index.js +8 -4
  15. package/dist/dev/packages/@ember/routing/route.js +1 -1
  16. package/dist/dev/packages/@ember/routing/router-service.js +19 -12
  17. package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +3 -3
  18. package/dist/dev/packages/@glimmer/runtime/index.js +4 -4
  19. package/dist/dev/packages/ember/version.js +1 -1
  20. package/dist/dev/packages/shared-chunks/{element-DQJOvSlQ.js → element-Cf3hqNOD.js} +2 -0
  21. package/dist/dev/packages/shared-chunks/{get-D5b5QlqE.js → get-BehtPmsu.js} +30 -33
  22. package/dist/dev/packages/shared-chunks/{hash-BRRFQJ99.js → hash-BTwOuDGQ.js} +15 -9
  23. package/dist/dev/packages/shared-chunks/{helper-Do7NCZHI.js → helper-BubrhyuN.js} +18 -6
  24. package/dist/dev/packages/shared-chunks/{index-CwnQYqK5.js → index-CL1zjHwo.js} +80 -102
  25. package/dist/dev/packages/shared-chunks/{on-BueSMv9L.js → on-BQii6ILK.js} +6 -6
  26. package/dist/dev/packages/shared-chunks/{or-O0eJQ4K-.js → or-BTH3yuFG.js} +1 -1
  27. package/dist/dev/packages/shared-chunks/{setup-registry-BC5VMvei.js → setup-registry-BQZJfq-Y.js} +2 -2
  28. package/dist/dev/packages/shared-chunks/{textarea-WSlUEr0y.js → textarea-lD4apgrP.js} +6 -2
  29. package/dist/prod/packages/@ember/-internals/glimmer/index.js +5 -5
  30. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +1 -1
  31. package/dist/prod/packages/@ember/application/index.js +1 -1
  32. package/dist/prod/packages/@ember/application/instance.js +1 -1
  33. package/dist/prod/packages/@ember/array/index.js +4 -0
  34. package/dist/prod/packages/@ember/component/helper.js +1 -1
  35. package/dist/prod/packages/@ember/component/index.js +9 -3
  36. package/dist/prod/packages/@ember/engine/index.js +1 -1
  37. package/dist/prod/packages/@ember/helper/index.js +4 -23
  38. package/dist/prod/packages/@ember/modifier/on.js +1 -1
  39. package/dist/prod/packages/@ember/object/index.js +22 -17
  40. package/dist/prod/packages/@ember/renderer/index.js +1 -1
  41. package/dist/prod/packages/@ember/routing/index.js +8 -4
  42. package/dist/prod/packages/@ember/routing/route.js +1 -1
  43. package/dist/prod/packages/@ember/routing/router-service.js +19 -12
  44. package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +3 -3
  45. package/dist/prod/packages/@glimmer/runtime/index.js +4 -4
  46. package/dist/prod/packages/ember/version.js +1 -1
  47. package/dist/prod/packages/shared-chunks/{element-DUOVW5Ho.js → element-9DRa_9dO.js} +2 -0
  48. package/dist/prod/packages/shared-chunks/{get-t0-itmA-.js → get-Dt5L0TcU.js} +30 -33
  49. package/dist/prod/packages/shared-chunks/{hash-mcs3pEFO.js → hash-Dkj3I4L4.js} +15 -9
  50. package/dist/prod/packages/shared-chunks/{helper-DLjV2ZZW.js → helper-CN6UzshW.js} +18 -6
  51. package/dist/prod/packages/shared-chunks/{index-qDFz6Mfe.js → index-ClxHbCe9.js} +80 -102
  52. package/dist/prod/packages/shared-chunks/{on-B5NVufs_.js → on-CWgOWNSL.js} +6 -6
  53. package/dist/prod/packages/shared-chunks/{or-3AxY5TPj.js → or-Crsa2wci.js} +1 -1
  54. package/dist/prod/packages/shared-chunks/{setup-registry-C2KfZJWI.js → setup-registry-B3DhqtxX.js} +2 -2
  55. package/dist/prod/packages/shared-chunks/{textarea-CHqL0Rdh.js → textarea-Byj32raR.js} +6 -2
  56. package/docs/data.json +180 -180
  57. package/package.json +3 -6
  58. package/types/stable/@ember/-internals/glimmer/index.d.ts +165 -121
  59. package/types/stable/@ember/-internals/glimmer/lib/component.d.ts +8 -2
  60. package/types/stable/@ember/-internals/glimmer/lib/glimmer-tracking-docs.d.ts +12 -12
  61. package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +18 -6
  62. package/types/stable/@ember/-internals/glimmer/lib/helpers/array.d.ts +3 -1
  63. package/types/stable/@ember/-internals/glimmer/lib/helpers/component.d.ts +65 -121
  64. package/types/stable/@ember/-internals/glimmer/lib/helpers/concat.d.ts +8 -4
  65. package/types/stable/@ember/-internals/glimmer/lib/helpers/each-in.d.ts +16 -14
  66. package/types/stable/@ember/-internals/glimmer/lib/helpers/element.d.ts +2 -0
  67. package/types/stable/@ember/-internals/glimmer/lib/helpers/fn.d.ts +11 -7
  68. package/types/stable/@ember/-internals/glimmer/lib/helpers/get.d.ts +23 -29
  69. package/types/stable/@ember/-internals/glimmer/lib/helpers/hash.d.ts +3 -1
  70. package/types/stable/@ember/-internals/glimmer/lib/helpers/if-unless.d.ts +95 -49
  71. package/types/stable/@ember/-internals/glimmer/lib/helpers/mut.d.ts +23 -54
  72. package/types/stable/@ember/-internals/glimmer/lib/helpers/page-title.d.ts +6 -2
  73. package/types/stable/@ember/-internals/glimmer/lib/helpers/readonly.d.ts +4 -8
  74. package/types/stable/@ember/-internals/glimmer/lib/modifiers/on.d.ts +10 -10
  75. package/types/stable/@ember/-internals/glimmer/lib/syntax/in-element.d.ts +2 -0
  76. package/types/stable/@ember/-internals/glimmer/lib/syntax/let.d.ts +2 -14
  77. package/types/stable/@ember/-internals/glimmer/lib/syntax/mount.d.ts +15 -11
  78. package/types/stable/@ember/-internals/glimmer/lib/syntax/outlet.d.ts +17 -10
  79. package/types/stable/@ember/-internals/runtime/lib/mixins/target_action_support.d.ts +1 -1
  80. package/types/stable/@ember/array/index.d.ts +4 -0
  81. package/types/stable/@ember/controller/index.d.ts +1 -1
  82. package/types/stable/@ember/helper/index.d.ts +0 -19
  83. package/types/stable/@ember/object/index.d.ts +4 -3
  84. package/types/stable/@ember/object/observable.d.ts +4 -0
  85. package/types/stable/@ember/routing/route.d.ts +1 -1
  86. package/types/stable/@ember/routing/router-service.d.ts +20 -12
  87. package/types/stable/@glimmer/runtime/lib/helpers/array.d.ts +1 -1
  88. package/types/stable/@glimmer/runtime/lib/helpers/concat.d.ts +8 -3
  89. package/types/stable/@glimmer/runtime/lib/helpers/fn.d.ts +13 -7
  90. package/types/stable/@glimmer/runtime/lib/helpers/get.d.ts +21 -29
  91. package/types/stable/@glimmer/runtime/lib/helpers/hash.d.ts +1 -1
  92. package/types/stable/@glimmer/syntax/lib/get-template-locals.d.ts +1 -1
  93. package/types/stable/@glimmer/tracking/index.d.ts +12 -12
@@ -38,8 +38,8 @@ class EmberObject extends CoreObject.extend(Observable) {
38
38
  Decorator that turns the target function into an Action which can be accessed
39
39
  directly by reference.
40
40
 
41
- ```js
42
- import Component from '@ember/component';
41
+ ```gjs
42
+ import Component from '@glimmer/component';
43
43
  import { tracked } from '@glimmer/tracking';
44
44
  import { action } from '@ember/object';
45
45
 
@@ -50,24 +50,24 @@ class EmberObject extends CoreObject.extend(Observable) {
50
50
  toggleShowing() {
51
51
  this.isShowing = !this.isShowing;
52
52
  }
53
+
54
+ <template>
55
+ <button {{on "click" this.toggleShowing}}>Show tooltip</button>
56
+
57
+ {{#if isShowing}}
58
+ <div class="tooltip">
59
+ I'm a tooltip!
60
+ </div>
61
+ {{/if}}
62
+ </template>
53
63
  }
54
64
  ```
55
- ```hbs
56
- <!-- template.hbs -->
57
- <button {{on "click" this.toggleShowing}}>Show tooltip</button>
58
-
59
- {{#if isShowing}}
60
- <div class="tooltip">
61
- I'm a tooltip!
62
- </div>
63
- {{/if}}
64
- ```
65
65
 
66
66
  It also binds the function directly to the instance, so it can be used in any
67
67
  context and will correctly refer to the class it came from:
68
68
 
69
- ```js
70
- import Component from '@ember/component';
69
+ ```gjs
70
+ import Component from '@glimmer/component';
71
71
  import { tracked } from '@glimmer/tracking';
72
72
  import { action } from '@ember/object';
73
73
 
@@ -86,6 +86,10 @@ class EmberObject extends CoreObject.extend(Observable) {
86
86
  toggleShowing() {
87
87
  this.isShowing = !this.isShowing;
88
88
  }
89
+
90
+ <template>
91
+ {{!-- ...--}}
92
+ </template>
89
93
  }
90
94
  ```
91
95
 
@@ -164,9 +168,10 @@ setClassicDecorator(action);
164
168
  });
165
169
  ```
166
170
 
167
- Also available as `Function.prototype.observes` if prototype extensions are
168
- enabled.
169
-
171
+ While observers are still supported, there are [plans to deprecate them](https://github.com/emberjs/rfcs/pull/1115)
172
+ See the [in-progress deprecation guide](https://github.com/ember-learn/deprecation-app/pull/1407)
173
+ for guidance on how to avoid using observers.
174
+
170
175
  @method observer
171
176
  @for @ember/object
172
177
  @param {String} propertyNames*
@@ -1 +1 @@
1
- export { a as renderComponent, r as renderSettled } from '../../shared-chunks/index-qDFz6Mfe.js';
1
+ export { a as renderComponent, r as renderSettled } from '../../shared-chunks/index-ClxHbCe9.js';
@@ -58,10 +58,14 @@ function isQueryParams(value) {
58
58
  supplied model to the route as its `model` context of the route. The block for `LinkTo`
59
59
  becomes the contents of the rendered element:
60
60
 
61
- ```handlebars
62
- <LinkTo @route='photoGallery'>
63
- Great Hamster Photos
64
- </LinkTo>
61
+ ```gjs
62
+ import { LinkTo } from '@ember/routing';
63
+
64
+ <template>
65
+ <LinkTo @route='photoGallery'>
66
+ Great Hamster Photos
67
+ </LinkTo>
68
+ </template>
65
69
  ```
66
70
 
67
71
  This will result in:
@@ -762,7 +762,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) {
762
762
  ```
763
763
  Note that for routes with dynamic segments, this hook is not always
764
764
  executed. If the route is entered through a transition (e.g. when
765
- using the `link-to` Handlebars helper or the `transitionTo` method
765
+ using the `link-to` helper or the `transitionTo` method
766
766
  of routes), and a model context is already provided this hook
767
767
  is not called.
768
768
  A model context does not include a primitive string or number,
@@ -35,7 +35,7 @@ function cleanURL(url, rootURL) {
35
35
  In this example, the Router service is injected into a component to initiate a transition
36
36
  to a dedicated route:
37
37
 
38
- ```app/components/example.js
38
+ ```app/components/example.gjs
39
39
  import Component from '@glimmer/component';
40
40
  import { action } from '@ember/object';
41
41
  import { service } from '@ember/service';
@@ -82,7 +82,7 @@ class RouterService extends Service.extend(Evented) {
82
82
  In the following example we use the Router service to navigate to a route with a
83
83
  specific model from a Component in the first action, and in the second we trigger
84
84
  a query-params only transition.
85
- ```app/components/example.js
85
+ ```app/components/example.gjs
86
86
  import Component from '@glimmer/component';
87
87
  import { action } from '@ember/object';
88
88
  import { service } from '@ember/service';
@@ -167,10 +167,14 @@ class RouterService extends Service.extend(Evented) {
167
167
  URL is returned as a string that can be used for any purpose.
168
168
  In this example, the URL for the `author.books` route for a given author
169
169
  is copied to the clipboard.
170
- ```app/templates/application.hbs
171
- <CopyLink @author={{hash id="tomster" name="Tomster"}} />
170
+ ```app/templates/application.gjs
171
+ import CopyLink from '../components/copy-link';
172
+
173
+ <template>
174
+ <CopyLink @author={{hash id="tomster" name="Tomster"}} />
175
+ </template>
172
176
  ```
173
- ```app/components/copy-link.js
177
+ ```app/components/copy-link.gjs
174
178
  import Component from '@glimmer/component';
175
179
  import { service } from '@ember/service';
176
180
  import { action } from '@ember/object';
@@ -189,10 +193,13 @@ class RouterService extends Service.extend(Evented) {
189
193
  ```
190
194
  Just like with `transitionTo` and `replaceWith`, `urlFor` can also handle
191
195
  query parameters.
192
- ```app/templates/application.hbs
193
- <CopyLink @author={{hash id="tomster" name="Tomster"}} />
196
+ ```app/templates/application.gjs
197
+ import CopyLink from '../components/copy-link';
198
+ <template>
199
+ <CopyLink @author={{hash id="tomster" name="Tomster"}} />
200
+ </template>
194
201
  ```
195
- ```app/components/copy-link.js
202
+ ```app/components/copy-link.gjs
196
203
  import Component from '@glimmer/component';
197
204
  import { service } from '@ember/service';
198
205
  import { action } from '@ember/object';
@@ -229,7 +236,7 @@ class RouterService extends Service.extend(Evented) {
229
236
  See [model](api/ember/release/classes/Route/methods/model?anchor=model) and
230
237
  [queryParams](/api/ember/3.7/classes/Route/properties/queryParams?anchor=queryParams) for more information about these arguments.
231
238
  In the following example, `isActive` will return `true` if the current route is `/posts`.
232
- ```app/components/posts.js
239
+ ```app/components/posts.gjs
233
240
  import Component from '@glimmer/component';
234
241
  import { service } from '@ember/service';
235
242
  export default class extends Component {
@@ -241,7 +248,7 @@ class RouterService extends Service.extend(Evented) {
241
248
  ```
242
249
  The next example includes a dynamic segment, and will return `true` if the current route is `/posts/1`,
243
250
  assuming the post has an id of 1:
244
- ```app/components/posts.js
251
+ ```app/components/posts.gjs
245
252
  import Component from '@glimmer/component';
246
253
  import { service } from '@ember/service';
247
254
  export default class extends Component {
@@ -315,7 +322,7 @@ class RouterService extends Service.extend(Evented) {
315
322
  See [RouteInfo](/ember/release/classes/RouteInfo) for more info.
316
323
  In the following example `recognize` is used to verify if a path belongs to our
317
324
  application before transitioning to it.
318
- ```
325
+ ```js
319
326
  import Component from '@ember/component';
320
327
  import { service } from '@ember/service';
321
328
  export default class extends Component {
@@ -613,7 +620,7 @@ class RouterService extends Service.extend(Evented) {
613
620
  happens (even when that transition only changes parameters
614
621
  and doesn't change the active route).
615
622
  Usage example:
616
- ```app/components/header.js
623
+ ```app/components/header.gjs
617
624
  import Component from '@glimmer/component';
618
625
  import { service } from '@ember/service';
619
626
  import { notEmpty } from '@ember/object/computed';
@@ -1,6 +1,6 @@
1
- import { o as or, d as not, c as lte, l as lt, b as gte, g as gt, n as neq, a as and, e as eq } from '../../../shared-chunks/or-3AxY5TPj.js';
2
- import { h as hash, f as fn, a as array } from '../../../shared-chunks/hash-mcs3pEFO.js';
3
- import { e as element } from '../../../shared-chunks/element-DUOVW5Ho.js';
1
+ import { o as or, d as not, c as lte, l as lt, b as gte, g as gt, n as neq, a as and, e as eq } from '../../../shared-chunks/or-Crsa2wci.js';
2
+ import { h as hash, f as fn, a as array } from '../../../shared-chunks/hash-Dkj3I4L4.js';
3
+ import { e as element } from '../../../shared-chunks/element-9DRa_9dO.js';
4
4
  import { on } from '../../modifier/on.js';
5
5
  import { STRICT_MODE_KEYWORDS, STRICT_MODE_TRANSFORMS, RESOLUTION_MODE_TRANSFORMS } from './plugins/index.js';
6
6
  import { ALLOWED_GLOBALS } from './plugins/allowed-globals.js';
@@ -3,11 +3,11 @@ export { D as DOMChanges, a as DynamicScopeImpl, E as EnvironmentImpl, b as IDOM
3
3
  export { T as TEMPLATE_ONLY_COMPONENT_MANAGER, a as TemplateOnlyComponent, b as TemplateOnlyComponentManager, t as templateOnlyComponent } from '../../shared-chunks/template-only-BtLl0uH0.js';
4
4
  export { C as CurriedValue, E as EMPTY_ARGS, a as EMPTY_NAMED, b as EMPTY_POSITIONAL, c as createCapturedArgs, d as curry, r as reifyArgs, e as reifyNamed, f as reifyPositional } from '../../shared-chunks/debug-render-tree-CF5O4-WI.js';
5
5
  export { n as normalizeProperty } from '../../shared-chunks/props-fiqxqhAH.js';
6
- export { a as and, e as eq, g as gt, b as gte, l as lt, c as lte, n as neq, d as not, o as or } from '../../shared-chunks/or-3AxY5TPj.js';
7
- export { a as array, f as fn, h as hash } from '../../shared-chunks/hash-mcs3pEFO.js';
8
- export { c as concat, g as get } from '../../shared-chunks/get-t0-itmA-.js';
6
+ export { a as and, e as eq, g as gt, b as gte, l as lt, c as lte, n as neq, d as not, o as or } from '../../shared-chunks/or-Crsa2wci.js';
7
+ export { a as array, f as fn, h as hash } from '../../shared-chunks/hash-Dkj3I4L4.js';
8
+ export { c as concat, g as get } from '../../shared-chunks/get-Dt5L0TcU.js';
9
9
  export { i as invokeHelper } from '../../shared-chunks/invoke-Cj5zMqHz.js';
10
- export { o as on } from '../../shared-chunks/on-B5NVufs_.js';
10
+ export { o as on } from '../../shared-chunks/on-CWgOWNSL.js';
11
11
  export { destroy, isDestroyed, isDestroying, registerDestructor } from '../destroyable/index.js';
12
12
  import '../../shared-chunks/cache-BIlOoPA7.js';
13
13
  import '../../shared-chunks/reference-BshxG6wn.js';
@@ -1,4 +1,4 @@
1
1
  // this file gets replaced with the real value during the build
2
- const VERSION = '7.1.0-beta.1';
2
+ const VERSION = '7.1.0';
3
3
 
4
4
  export { VERSION as default };
@@ -82,6 +82,8 @@ function getElementDefinition(tagName) {
82
82
  Passing `null`, `undefined`, or non-string values will throw an assertion error.
83
83
 
84
84
  Changing the tag name will tear down and recreate the element and its contents.
85
+
86
+ The `element` helper is built-in and does not need to be imported.
85
87
 
86
88
  @method element
87
89
  @for Ember.Templates.helpers
@@ -1,6 +1,6 @@
1
1
  import { a as createComputeRef, U as UNDEFINED_REFERENCE, v as valueForRef } from './reference-BshxG6wn.js';
2
2
  import { f as reifyPositional } from './debug-render-tree-CF5O4-WI.js';
3
- import { i as internalHelper } from './hash-mcs3pEFO.js';
3
+ import { i as internalHelper } from './hash-Dkj3I4L4.js';
4
4
  import { setPath, getPath } from '../@glimmer/global-context/index.js';
5
5
  import { i as isDict } from './collections-C3Y8z_9v.js';
6
6
 
@@ -19,10 +19,15 @@ const normalizeTextValue = value => {
19
19
 
20
20
  Example:
21
21
 
22
- ```handlebars
23
- {{some-component name=(concat firstName " " lastName)}}
24
22
 
25
- {{! would pass name="<first name value> <last name value>" to the component}}
23
+ ```gjs
24
+ import { concat } from '@ember/helper';
25
+
26
+ <template>
27
+ {{yield (concat firstName " " lastName)}}
28
+
29
+ {{! would yield name="<first name value> <last name value>" to the component}}
30
+ </template>
26
31
  ```
27
32
 
28
33
  or for angle bracket invocation, you actually don't need concat at all.
@@ -46,28 +51,31 @@ const concat = internalHelper(({
46
51
 
47
52
  For example, these two usages are equivalent:
48
53
 
49
- ```app/components/developer-detail.js
54
+ ```app/components/developer-detail.gjs
50
55
  import Component from '@glimmer/component';
51
56
  import { tracked } from '@glimmer/tracking';
57
+ import { get } from '@ember/object';
52
58
 
53
59
  export default class extends Component {
54
60
  @tracked developer = {
55
61
  name: "Sandi Metz",
56
62
  language: "Ruby"
57
63
  }
64
+
65
+ <template>
66
+ {{this.developer.name}}
67
+ {{get this.developer "name"}}
68
+ </template>
58
69
  }
59
70
  ```
60
71
 
61
- ```handlebars
62
- {{this.developer.name}}
63
- {{get this.developer "name"}}
64
- ```
65
-
66
72
  If there were several facts about a person, the `{{get}}` helper can dynamically
67
73
  pick one:
68
74
 
69
- ```app/templates/application.hbs
70
- <DeveloperDetail @factName="language" />
75
+ ```app/templates/application.gjs
76
+ <template>
77
+ <DeveloperDetail @factName="language" />
78
+ </template>
71
79
  ```
72
80
 
73
81
  ```handlebars
@@ -77,10 +85,11 @@ const concat = internalHelper(({
77
85
  For a more complex example, this template would allow the user to switch
78
86
  between showing the user's height and weight with a click:
79
87
 
80
- ```app/components/developer-detail.js
88
+ ```app/components/developer-detail.gjs
81
89
  import Component from '@glimmer/component';
82
90
  import { tracked } from '@glimmer/tracking';
83
-
91
+ import { get } from '@ember/object';
92
+
84
93
  export default class extends Component {
85
94
  @tracked developer = {
86
95
  name: "Sandi Metz",
@@ -92,28 +101,16 @@ const concat = internalHelper(({
92
101
  showFact = (fact) => {
93
102
  this.currentFact = fact;
94
103
  }
95
- }
96
- ```
97
-
98
- ```app/components/developer-detail.js
99
- {{get this.developer this.currentFact}}
100
-
101
- <button {{on 'click' (fn this.showFact "name")}}>Show name</button>
102
- <button {{on 'click' (fn this.showFact "language")}}>Show language</button>
103
- ```
104
+
105
+ <template>
106
+ {{get this.developer this.currentFact}}
104
107
 
105
- The `{{get}}` helper can also respect mutable values itself. For example:
106
-
107
- ```app/components/developer-detail.js
108
- <Input @value={{mut (get this.person this.currentFact)}} />
109
-
110
- <button {{on 'click' (fn this.showFact "name")}}>Show name</button>
111
- <button {{on 'click' (fn this.showFact "language")}}>Show language</button>
108
+ <button {{on 'click' (fn this.showFact "name")}}>Show name</button>
109
+ <button {{on 'click' (fn this.showFact "language")}}>Show language</button>
110
+ </template>
111
+ }
112
112
  ```
113
113
 
114
- Would allow the user to swap what fact is being displayed, and also edit
115
- that fact via a two-way mutable binding.
116
-
117
114
  @public
118
115
  @method get
119
116
  */
@@ -19,7 +19,7 @@ function internalHelper(helper) {
19
19
  ```
20
20
  or
21
21
  ```handlebars
22
- {{my-component people=(array
22
+ {{yield people=(array
23
23
  'Tom Dale'
24
24
  'Yehuda Katz'
25
25
  this.myOtherPerson)
@@ -64,13 +64,17 @@ const context = buildUntouchableThis();
64
64
  to a component invoked within the loop. Here's how you could use the `fn`
65
65
  helper to pass both the function and its arguments together:
66
66
 
67
- ```app/templates/components/items-listing.hbs
68
- {{#each @items as |item|}}
69
- <DisplayItem @item=item @select={{fn this.handleSelected item}} />
70
- {{/each}}
67
+ ```app/components/items-listing.gjs
68
+ import DisplayItem from './display-item';
69
+
70
+ <template>
71
+ {{#each @items as |item|}}
72
+ <DisplayItem @item=item @select={{fn this.handleSelected item}} />
73
+ {{/each}}
74
+ </template>
71
75
  ```
72
76
 
73
- ```app/components/items-list.js
77
+ ```app/components/items-list.gjs
74
78
  import Component from '@glimmer/component';
75
79
  import { action } from '@ember/object';
76
80
 
@@ -81,7 +85,7 @@ const context = buildUntouchableThis();
81
85
  }
82
86
  ```
83
87
 
84
- In this case the `display-item` component will receive a normal function
88
+ In this case the `DisplayItem` component will receive a normal function
85
89
  that it can invoke. When it invokes the function, the `handleSelected`
86
90
  function will receive the `item` and any arguments passed, thanks to the
87
91
  `fn` helper.
@@ -98,7 +102,7 @@ const context = buildUntouchableThis();
98
102
  `handleSelected` is properly bound to the `items-list`, but let's explore what
99
103
  happens if we left out the arrow function:
100
104
 
101
- ```app/components/items-list.js
105
+ ```app/components/items-list.gjs
102
106
  import Component from '@glimmer/component';
103
107
 
104
108
  export default class ItemsList extends Component {
@@ -115,6 +119,8 @@ const context = buildUntouchableThis();
115
119
 
116
120
  See also [partial application](https://en.wikipedia.org/wiki/Partial_application).
117
121
 
122
+ `fn` is built-in and does not require any additional imports.
123
+
118
124
  @method fn
119
125
  @public
120
126
  */
@@ -138,7 +144,7 @@ const fn = internalHelper(({
138
144
 
139
145
  /**
140
146
  Use the `{{hash}}` helper to create a hash to pass as an option to your
141
- components. This is specially useful for contextual components where you can
147
+ components. This is especially useful for contextual components where you can
142
148
  just yield a hash:
143
149
 
144
150
  ```handlebars
@@ -27,20 +27,32 @@ const IS_CLASSIC_HELPER = Symbol('IS_CLASSIC_HELPER');
27
27
  Ember Helpers are functions that can compute values, and are used in templates.
28
28
  For example, this code calls a helper named `format-currency`:
29
29
 
30
- ```app/templates/application.hbs
31
- <Cost @cents={{230}} />
30
+ ```app/templates/application.gjs
31
+ import Cost from '../components/cost';
32
+
33
+ <template>
34
+ <Cost @cents={{230}} />
35
+ </template>
32
36
  ```
33
37
 
34
- ```app/components/cost.hbs
35
- <div>{{format-currency @cents currency="$"}}</div>
38
+ ```app/components/cost.gjs
39
+ import formatCurrency from '../helpers/format-currency';
40
+
41
+ <template>
42
+ <div>{{formatCurrency @cents currency="$"}}</div>
43
+ </template>
36
44
  ```
37
45
 
38
46
  Additionally a helper can be called as a nested helper.
39
47
  In this example, we show the formatted currency value if the `showMoney`
40
48
  named argument is truthy.
41
49
 
42
- ```handlebars
43
- {{if @showMoney (format-currency @cents currency="$")}}
50
+ ```gjs
51
+ import formatCurrency from '../helpers/format-currency';
52
+
53
+ <template>
54
+ {{if @showMoney (formatCurrency @cents currency="$")}}
55
+ </template>
44
56
  ```
45
57
 
46
58
  Helpers defined using a class must provide a `compute` function. For example: