ember-source 7.3.0-alpha.5 → 7.4.0-alpha.1

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 (159) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/dev/packages/@ember/-internals/deprecations/index.js +9 -0
  3. package/dist/dev/packages/@ember/-internals/glimmer/index.js +7 -7
  4. package/dist/dev/packages/@ember/-internals/routing/index.js +2 -2
  5. package/dist/dev/packages/@ember/-internals/runtime/index.js +1 -1
  6. package/dist/dev/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
  7. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -0
  8. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -0
  9. package/dist/dev/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -0
  10. package/dist/dev/packages/@ember/application/index.js +3 -3
  11. package/dist/dev/packages/@ember/application/instance.js +9 -9
  12. package/dist/dev/packages/@ember/component/helper.js +2 -2
  13. package/dist/dev/packages/@ember/component/index.js +3 -3
  14. package/dist/dev/packages/@ember/engine/index.js +3 -3
  15. package/dist/dev/packages/@ember/engine/instance.js +1 -1
  16. package/dist/dev/packages/@ember/helper/index.js +1132 -79
  17. package/dist/dev/packages/@ember/modifier/on.js +1 -1
  18. package/dist/dev/packages/@ember/object/compat.js +0 -32
  19. package/dist/dev/packages/@ember/renderer/index.js +1 -1
  20. package/dist/dev/packages/@ember/routing/-internals.js +2 -2
  21. package/dist/dev/packages/@ember/routing/index.js +11 -28
  22. package/dist/dev/packages/@ember/routing/lib/utils.js +2 -2
  23. package/dist/dev/packages/@ember/routing/route.js +2 -2
  24. package/dist/dev/packages/@ember/routing/router-service.js +9 -9
  25. package/dist/dev/packages/@ember/routing/router.js +2 -2
  26. package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +3 -3
  27. package/dist/dev/packages/@ember/template-compiler/lib/template.js +2 -2
  28. package/dist/dev/packages/@ember/template-factory/index.js +1 -1
  29. package/dist/dev/packages/@glimmer/opcode-compiler/index.js +2 -2
  30. package/dist/dev/packages/@glimmer/program/index.js +3 -3
  31. package/dist/dev/packages/@glimmer/runtime/index.js +7 -7
  32. package/dist/dev/packages/@glimmer/wire-format/index.js +2 -5
  33. package/dist/dev/packages/ember/version.js +1 -1
  34. package/dist/dev/packages/ember-template-compiler/index.js +2 -2
  35. package/dist/dev/packages/router_js/index.js +2 -2
  36. package/dist/dev/packages/rsvp/index.js +1 -2281
  37. package/dist/dev/packages/shared-chunks/{arguments-CDkbOqTS.js → arguments-DniR8eF2.js} +5 -18
  38. package/dist/dev/packages/shared-chunks/{compiler-QUSl_urU.js → compiler-BHFFl-fv.js} +1 -1
  39. package/dist/dev/packages/shared-chunks/{curly-BbL6STF2.js → curly-BCD_vyHq.js} +1 -1
  40. package/dist/dev/packages/shared-chunks/{element-BYLB-q7a.js → element-Cgoi4ldD.js} +0 -24
  41. package/dist/dev/packages/shared-chunks/get-zsePWrJL.js +40 -0
  42. package/dist/dev/packages/shared-chunks/hash-BFu91gtE.js +57 -0
  43. package/dist/dev/packages/shared-chunks/{index-DaFzpTIE.js → index-BYUSIu_W.js} +3 -3
  44. package/dist/dev/packages/shared-chunks/{index-Czn34wUZ.js → index-Bv9SQpEx.js} +218 -78
  45. package/dist/dev/packages/shared-chunks/{invoke-d9sqa50M.js → invoke-CgF42joE.js} +1 -1
  46. package/dist/dev/packages/shared-chunks/{not-DYh6AY9Z.js → not-0cVb-rLf.js} +1 -1
  47. package/dist/dev/packages/shared-chunks/{on-DlF0Wy7P.js → on-CVIjn2C-.js} +22 -11
  48. package/dist/dev/packages/shared-chunks/{opcodes-CplRyHl_.js → opcodes-DDajoGhq.js} +0 -4
  49. package/dist/dev/packages/shared-chunks/{outlet-B4qORyui.js → outlet-BO5-QFmm.js} +3 -3
  50. package/dist/dev/packages/shared-chunks/{program-context-Dq8xN2HI.js → program-context-BBB1Ga5h.js} +2 -2
  51. package/dist/dev/packages/shared-chunks/{render-CtH73XOv.js → render-D_Rawf-r.js} +2 -2
  52. package/dist/{prod/packages/shared-chunks/rsvp.es-DR7yS7qg.js → dev/packages/shared-chunks/rsvp-aLN_pQtn.js} +152 -148
  53. package/dist/dev/packages/shared-chunks/{setup-registry-h519ZsHS.js → setup-registry-Ci8Af2Bz.js} +35 -13
  54. package/dist/{prod/packages/shared-chunks/syscall-ops-CN7STuUn.js → dev/packages/shared-chunks/syscall-ops-CkPT1Kfx.js} +1 -2
  55. package/dist/dev/packages/shared-chunks/{textarea-DEvw4ezm.js → textarea-DvS6Xmdh.js} +3 -23
  56. package/dist/dev/packages/shared-chunks/{unique-id-DQOhouG1.js → unique-id-Csxuh1I7.js} +0 -4
  57. package/dist/dev/packages/shared-chunks/{unrecognized-url-error-B8loxkay.js → unrecognized-url-error-cXUp-SK3.js} +1 -1
  58. package/dist/prod/packages/@ember/-internals/deprecations/index.js +9 -0
  59. package/dist/prod/packages/@ember/-internals/glimmer/index.js +7 -7
  60. package/dist/prod/packages/@ember/-internals/routing/index.js +2 -2
  61. package/dist/prod/packages/@ember/-internals/runtime/index.js +1 -1
  62. package/dist/prod/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
  63. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -0
  64. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -0
  65. package/dist/prod/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -0
  66. package/dist/prod/packages/@ember/application/index.js +3 -3
  67. package/dist/prod/packages/@ember/application/instance.js +9 -9
  68. package/dist/prod/packages/@ember/component/helper.js +2 -2
  69. package/dist/prod/packages/@ember/component/index.js +3 -3
  70. package/dist/prod/packages/@ember/engine/index.js +3 -3
  71. package/dist/prod/packages/@ember/engine/instance.js +1 -1
  72. package/dist/prod/packages/@ember/helper/index.js +1132 -79
  73. package/dist/prod/packages/@ember/modifier/on.js +1 -1
  74. package/dist/prod/packages/@ember/object/compat.js +0 -32
  75. package/dist/prod/packages/@ember/renderer/index.js +1 -1
  76. package/dist/prod/packages/@ember/routing/index.js +10 -27
  77. package/dist/prod/packages/@ember/routing/lib/utils.js +2 -2
  78. package/dist/prod/packages/@ember/routing/route.js +2 -2
  79. package/dist/prod/packages/@ember/routing/router-service.js +9 -9
  80. package/dist/prod/packages/@ember/routing/router.js +2 -2
  81. package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +3 -3
  82. package/dist/prod/packages/@ember/template-compiler/lib/template.js +2 -2
  83. package/dist/prod/packages/@ember/template-factory/index.js +1 -1
  84. package/dist/prod/packages/@glimmer/opcode-compiler/index.js +2 -2
  85. package/dist/prod/packages/@glimmer/program/index.js +3 -3
  86. package/dist/prod/packages/@glimmer/runtime/index.js +7 -7
  87. package/dist/prod/packages/@glimmer/wire-format/index.js +2 -5
  88. package/dist/prod/packages/ember/version.js +1 -1
  89. package/dist/prod/packages/ember-template-compiler/index.js +2 -2
  90. package/dist/prod/packages/router_js/index.js +2 -2
  91. package/dist/prod/packages/rsvp/index.js +1 -2281
  92. package/dist/prod/packages/shared-chunks/{arguments-BzAkZVBa.js → arguments-CCYATlEH.js} +1 -18
  93. package/dist/prod/packages/shared-chunks/{compiler-lBSssiWp.js → compiler-Wt5SWcrF.js} +1 -1
  94. package/dist/prod/packages/shared-chunks/{curly-CU2jYOtm.js → curly-CdvJuTyW.js} +1 -1
  95. package/dist/prod/packages/shared-chunks/{element-DgHdPZ8u.js → element-BmBjPjkQ.js} +0 -24
  96. package/dist/prod/packages/shared-chunks/get-CEjFJzGs.js +40 -0
  97. package/dist/prod/packages/shared-chunks/hash-BitfXhCx.js +57 -0
  98. package/dist/prod/packages/shared-chunks/{index-XmtQRWbX.js → index-D8cl-pfl.js} +218 -78
  99. package/dist/prod/packages/shared-chunks/{index-Bf53M8eS.js → index-kwuZeaNz.js} +3 -3
  100. package/dist/prod/packages/shared-chunks/{invoke-DhQ5QRp2.js → invoke-4JGJYH7Z.js} +1 -1
  101. package/dist/prod/packages/shared-chunks/{not-BOIVROuv.js → not-Dn5s9qVZ.js} +1 -1
  102. package/dist/prod/packages/shared-chunks/{on-BZHAxzdq.js → on-ov4KAucw.js} +22 -11
  103. package/dist/prod/packages/shared-chunks/{opcodes-CplRyHl_.js → opcodes-DDajoGhq.js} +0 -4
  104. package/dist/prod/packages/shared-chunks/{outlet-CsNMfeOj.js → outlet-BWnaVOrA.js} +3 -3
  105. package/dist/prod/packages/shared-chunks/{program-context-COSioH46.js → program-context-WVlzpPdi.js} +2 -2
  106. package/dist/prod/packages/shared-chunks/{render-Bf7GviCY.js → render-BAVl5E6X.js} +2 -2
  107. package/dist/{dev/packages/shared-chunks/rsvp.es-DR7yS7qg.js → prod/packages/shared-chunks/rsvp-aLN_pQtn.js} +152 -148
  108. package/dist/prod/packages/shared-chunks/{setup-registry-DFSQHIUs.js → setup-registry-DeyoFe6Q.js} +35 -13
  109. package/dist/{dev/packages/shared-chunks/syscall-ops-CN7STuUn.js → prod/packages/shared-chunks/syscall-ops-CkPT1Kfx.js} +1 -2
  110. package/dist/prod/packages/shared-chunks/{textarea-DMmdvgk2.js → textarea-B-sssXGa.js} +3 -23
  111. package/dist/prod/packages/shared-chunks/{unique-id-o2pS74go.js → unique-id-BJb1p8EG.js} +0 -4
  112. package/dist/prod/packages/shared-chunks/{unrecognized-url-error-jjQ-FqKB.js → unrecognized-url-error-xC654tCo.js} +1 -1
  113. package/docs/data.json +1237 -1395
  114. package/package.json +52 -47
  115. package/types/stable/@ember/-internals/deprecations/index.d.ts +6 -0
  116. package/types/stable/@ember/-internals/glimmer/index.d.ts +7 -380
  117. package/types/stable/@ember/-internals/glimmer/lib/component.d.ts +1 -1
  118. package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +2 -2
  119. package/types/stable/@ember/-internals/glimmer/lib/helpers/each-in.d.ts +196 -63
  120. package/types/stable/@ember/-internals/glimmer/lib/helpers/element.d.ts +0 -24
  121. package/types/stable/@ember/-internals/glimmer/lib/helpers/mut.d.ts +3 -2
  122. package/types/stable/@ember/-internals/glimmer/lib/helpers/readonly.d.ts +3 -1
  123. package/types/stable/@ember/-internals/glimmer/lib/helpers/unbound.d.ts +6 -2
  124. package/types/stable/@ember/-internals/glimmer/lib/helpers/unique-id.d.ts +0 -3
  125. package/types/stable/@ember/-internals/glimmer/lib/syntax/mount.d.ts +4 -2
  126. package/types/stable/@ember/-internals/glimmer/lib/syntax/outlet.d.ts +7 -2
  127. package/types/stable/@ember/helper/index.d.ts +1113 -73
  128. package/types/stable/@ember/object/compat.d.ts +0 -32
  129. package/types/stable/@ember/object/core.d.ts +1 -1
  130. package/types/stable/@ember/routing/router-service.d.ts +9 -9
  131. package/types/stable/@glimmer/interfaces/lib/compile/wire-format/api.d.ts +1 -9
  132. package/types/stable/@glimmer/interfaces/lib/compile/wire-format/opcodes.d.ts +0 -4
  133. package/types/stable/@glimmer/interfaces/lib/vm-opcodes.d.ts +0 -4
  134. package/types/stable/@glimmer/opcode-compiler/lib/opcode-builder/helpers/conditional.d.ts +1 -1
  135. package/types/stable/@glimmer/opcode-compiler/lib/syntax/statements.d.ts +1 -1
  136. package/types/stable/@glimmer/runtime/lib/helpers/array.d.ts +0 -33
  137. package/types/stable/@glimmer/runtime/lib/helpers/concat.d.ts +0 -25
  138. package/types/stable/@glimmer/runtime/lib/helpers/fn.d.ts +0 -70
  139. package/types/stable/@glimmer/runtime/lib/helpers/get.d.ts +0 -69
  140. package/types/stable/@glimmer/runtime/lib/helpers/hash.d.ts +0 -36
  141. package/types/stable/index.d.ts +0 -14
  142. package/dist/dev/packages/shared-chunks/get-6I3sjd-I.js +0 -135
  143. package/dist/dev/packages/shared-chunks/hash-6NDs_5_f.js +0 -198
  144. package/dist/prod/packages/shared-chunks/get-Dago5uGl.js +0 -135
  145. package/dist/prod/packages/shared-chunks/hash-gEXIsSO4.js +0 -198
  146. package/types/stable/@ember/-internals/glimmer/lib/helpers/array.d.ts +0 -43
  147. package/types/stable/@ember/-internals/glimmer/lib/helpers/component.d.ts +0 -93
  148. package/types/stable/@ember/-internals/glimmer/lib/helpers/concat.d.ts +0 -32
  149. package/types/stable/@ember/-internals/glimmer/lib/helpers/fn.d.ts +0 -77
  150. package/types/stable/@ember/-internals/glimmer/lib/helpers/get.d.ts +0 -94
  151. package/types/stable/@ember/-internals/glimmer/lib/helpers/hash.d.ts +0 -46
  152. package/types/stable/@ember/-internals/glimmer/lib/helpers/helper.d.ts +0 -43
  153. package/types/stable/@ember/-internals/glimmer/lib/helpers/if-unless.d.ts +0 -228
  154. package/types/stable/@ember/-internals/glimmer/lib/helpers/log.d.ts +0 -19
  155. package/types/stable/@ember/-internals/glimmer/lib/helpers/modifier.d.ts +0 -42
  156. package/types/stable/@ember/-internals/glimmer/lib/helpers/page-title.d.ts +0 -24
  157. package/types/stable/@ember/-internals/glimmer/lib/modifiers/on.d.ts +0 -95
  158. package/types/stable/@ember/-internals/glimmer/lib/syntax/in-element.d.ts +0 -49
  159. package/types/stable/@ember/-internals/glimmer/lib/syntax/let.d.ts +0 -43
@@ -5,7 +5,7 @@ import { associateDestroyableChild, destroy, registerDestructor, isDestroyed, is
5
5
  import { artifacts } from '../@glimmer/program/index.js';
6
6
  import { R as RuntimeOpImpl } from './program-DlgjqLa6.js';
7
7
  import { c as clientBuilder } from './api-Dz70AUL_.js';
8
- import { g as runtimeOptions, i as inTransaction, r as renderComponent$1 } from './render-CtH73XOv.js';
8
+ import { g as runtimeOptions, i as inTransaction, r as renderComponent$1 } from './render-D_Rawf-r.js';
9
9
  import { c as consumeTag, z as isTracking, e as debug, a as valueForTag, k as CURRENT_TAG, v as validateTag } from './cache-DGDPVCpC.js';
10
10
  import { h as hasDOM } from './index-BGP1rw3B.js';
11
11
  import { g as get$1, b as _getProp } from './property_get-DXwpgTe7.js';
@@ -28,15 +28,15 @@ import { isFactory } from '../@ember/-internals/owner/index.js';
28
28
  import { _instrumentStart } from '../@ember/instrumentation/index.js';
29
29
  import { g as getComponentTemplate } from './template-R_5UMHhb.js';
30
30
  import { a as getInternalHelperManager, j as setInternalHelperManager, g as getInternalComponentManager } from './api-DuLOZMO_.js';
31
- import { h as hash, f as fn, a as array } from './hash-6NDs_5_f.js';
32
- import { g as get, c as concat } from './get-6I3sjd-I.js';
33
- import { o as on } from './on-DlF0Wy7P.js';
31
+ import { h as hash, f as fn, a as array } from './hash-BFu91gtE.js';
32
+ import { g as get, c as concat } from './get-zsePWrJL.js';
33
+ import { o as on } from './on-CVIjn2C-.js';
34
34
  import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-Cu639ICT.js';
35
35
  import { i as isCurlyManager } from './curly-brand-B_F79Dep.js';
36
36
  import { i as isClassicHelper } from './helper-brand-C9_8vvOf.js';
37
37
  import { dasherize } from '../@ember/-internals/string/index.js';
38
- import { a as uniqueId } from './unique-id-DQOhouG1.js';
39
- import { E as EvaluationContextImpl } from './program-context-Dq8xN2HI.js';
38
+ import { a as uniqueId } from './unique-id-Csxuh1I7.js';
39
+ import { E as EvaluationContextImpl } from './program-context-BBB1Ga5h.js';
40
40
 
41
41
  /**
42
42
  @module ember
@@ -150,7 +150,7 @@ const trackArray = internalHelper(({
150
150
  });
151
151
 
152
152
  /**
153
- @module ember
153
+ @module @ember/helper
154
154
  */
155
155
 
156
156
  /**
@@ -160,46 +160,91 @@ const trackArray = internalHelper(({
160
160
  The default behavior of `{{#each}}` is to yield its inner block once for every
161
161
  item in an array passing the item as the first block parameter.
162
162
 
163
- Assuming the `@developers` argument contains this array:
163
+ ```gjs {data-filename="app/components/developer-list.gjs"}
164
+ import Component from '@glimmer/component';
164
165
 
165
- ```javascript
166
- [{ name: 'Yehuda' },{ name: 'Tom' }, { name: 'Paul' }];
167
- ```
166
+ export default class DeveloperList extends Component {
167
+ developers = [
168
+ { name: 'Yehuda' },
169
+ { name: 'Tom' },
170
+ { name: 'Paul' },
171
+ ];
168
172
 
169
- ```handlebars
170
- <ul>
171
- {{#each @developers as |person|}}
172
- <li>Hello, {{person.name}}!</li>
173
- {{/each}}
174
- </ul>
173
+ <template>
174
+ <ul>
175
+ {{#each this.developers as |person|}}
176
+ <li>Hello, {{person.name}}!</li>
177
+ {{/each}}
178
+ </ul>
179
+ </template>
180
+ }
175
181
  ```
176
182
 
177
- The same rules apply to arrays of primitives.
183
+ The same rules apply to arrays of primitives:
184
+
185
+ ```gjs {data-filename="app/components/developer-names.gjs"}
186
+ import Component from '@glimmer/component';
187
+
188
+ export default class DeveloperNames extends Component {
189
+ developerNames = ['Yehuda', 'Tom', 'Paul'];
178
190
 
179
- ```javascript
180
- ['Yehuda', 'Tom', 'Paul']
191
+ <template>
192
+ <ul>
193
+ {{#each this.developerNames as |name|}}
194
+ <li>Hello, {{name}}!</li>
195
+ {{/each}}
196
+ </ul>
197
+ </template>
198
+ }
181
199
  ```
182
200
 
183
- ```handlebars
184
- <ul>
185
- {{#each @developerNames as |name|}}
186
- <li>Hello, {{name}}!</li>
187
- {{/each}}
188
- </ul>
201
+ `{{#each}}` also supports native JavaScript [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)
202
+ values and other iterables:
203
+
204
+ ```gjs {data-filename="app/components/developer-set.gjs"}
205
+ import Component from '@glimmer/component';
206
+
207
+ export default class DeveloperSet extends Component {
208
+ developers = new Set([
209
+ { name: 'Yehuda' },
210
+ { name: 'Tom' },
211
+ { name: 'Paul' },
212
+ ]);
213
+
214
+ <template>
215
+ <ul>
216
+ {{#each this.developers as |person|}}
217
+ <li>Hello, {{person.name}}!</li>
218
+ {{/each}}
219
+ </ul>
220
+ </template>
221
+ }
189
222
  ```
190
223
 
191
- During iteration, the index of each item in the array is provided as a second block
192
- parameter.
224
+ During iteration, the index of each item in the array is provided as a second
225
+ block parameter:
193
226
 
194
- ```handlebars
195
- <ul>
196
- {{#each @developers as |person index|}}
197
- <li>Hello, {{person.name}}! You're number {{index}} in line</li>
198
- {{/each}}
199
- </ul>
227
+ ```gjs {data-filename="app/components/developer-list-with-index.gjs"}
228
+ import Component from '@glimmer/component';
229
+
230
+ export default class DeveloperListWithIndex extends Component {
231
+ developers = [
232
+ { name: 'Yehuda' },
233
+ { name: 'Tom' },
234
+ { name: 'Paul' },
235
+ ];
236
+
237
+ <template>
238
+ <ul>
239
+ {{#each this.developers as |person index|}}
240
+ <li>Hello, {{person.name}}! You're number {{index}} in line</li>
241
+ {{/each}}
242
+ </ul>
243
+ </template>
244
+ }
200
245
  ```
201
-
202
- `#each` is a keyword and does not need to be imported.
246
+
247
+ `#each` is a keyword and does not need to be imported.
203
248
 
204
249
  ### Specifying Keys
205
250
 
@@ -215,72 +260,91 @@ const trackArray = internalHelper(({
215
260
  needed. However, in some rare cases, the objects' identities may change even
216
261
  though they represent the same underlying data.
217
262
 
218
- For example:
263
+ For example, mapping over `people` produces a new array of new objects on each
264
+ render. Use `key` so Ember can match items across those renders:
219
265
 
220
- ```javascript
221
- people.map(person => {
222
- return { ...person, type: 'developer' };
223
- });
224
- ```
266
+ ```gjs {data-filename="app/components/mapped-developers.gjs"}
267
+ import Component from '@glimmer/component';
225
268
 
226
- In this case, each time the `people` array is `map`-ed over, it will produce
227
- an new array with completely different objects between renders. In these cases,
228
- you can help Ember determine how these objects related to each other with the
229
- `key` option:
269
+ export default class MappedDevelopers extends Component {
270
+ people = [
271
+ { name: 'Yehuda' },
272
+ { name: 'Tom' },
273
+ { name: 'Paul' },
274
+ ];
230
275
 
231
- ```handlebars
232
- <ul>
233
- {{#each @developers key="name" as |person|}}
234
- <li>Hello, {{person.name}}!</li>
235
- {{/each}}
236
- </ul>
276
+ get developers() {
277
+ return this.people.map((person) => {
278
+ return { ...person, type: 'developer' };
279
+ });
280
+ }
281
+
282
+ <template>
283
+ <ul>
284
+ {{#each this.developers key="name" as |person|}}
285
+ <li>Hello, {{person.name}}!</li>
286
+ {{/each}}
287
+ </ul>
288
+ </template>
289
+ }
237
290
  ```
238
291
 
239
292
  By doing so, Ember will use the value of the property specified (`person.name`
240
293
  in the example) to find a "match" from the previous render. That is, if Ember
241
- has previously seen an object from the `@developers` array with a matching
294
+ has previously seen an object from the `developers` array with a matching
242
295
  name, its DOM elements will be re-used.
243
296
 
244
297
  There are two special values for `key`:
245
298
 
299
+ * `@identity` - The item in the array itself. This is the default.
246
300
  * `@index` - The index of the item in the array.
247
- * `@identity` - The item in the array itself.
248
301
 
249
302
  ### {{else}} condition
250
303
 
251
304
  `{{#each}}` can have a matching `{{else}}`. The contents of this block will render
252
305
  if the collection is empty.
253
306
 
254
- ```handlebars
255
- <ul>
256
- {{#each @developers as |person|}}
257
- <li>{{person.name}} is available!</li>
258
- {{else}}
259
- <li>Sorry, nobody is available for this task.</li>
260
- {{/each}}
261
- </ul>
307
+ ```gjs {data-filename="app/components/available-developers.gjs"}
308
+ import Component from '@glimmer/component';
309
+
310
+ export default class AvailableDevelopers extends Component {
311
+ developers = [];
312
+
313
+ <template>
314
+ <ul>
315
+ {{#each this.developers as |person|}}
316
+ <li>{{person.name}} is available!</li>
317
+ {{else}}
318
+ <li>Sorry, nobody is available for this task.</li>
319
+ {{/each}}
320
+ </ul>
321
+ </template>
322
+ }
262
323
  ```
263
324
 
264
325
  @method each
265
- @for Ember.Templates.helpers
326
+ @for Keywords
327
+ @static
328
+ @noimport
266
329
  @public
267
330
  */
268
331
 
269
332
  /**
270
- The `{{#each-in}}` keyword loops over properties on an object.
333
+ The `{{#each-in}}` keyword loops over properties on an object, or entries in a
334
+ native JavaScript [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).
271
335
 
272
336
  For example, given this component definition:
273
337
 
274
- ```app/components/developer-details.gjs
338
+ ```gjs {data-filename="app/components/developer-details.gjs"}
275
339
  import Component from '@glimmer/component';
276
340
  import { tracked } from '@glimmer/tracking';
277
341
 
278
- export default class extends Component {
342
+ export default class DeveloperDetails extends Component {
279
343
  @tracked developer = {
280
- "name": "Shelly Sails",
281
- "age": 42
344
+ name: 'Shelly Sails',
345
+ age: 42,
282
346
  };
283
-
347
+
284
348
  <template>
285
349
  <ul>
286
350
  {{#each-in this.developer as |key value|}}
@@ -300,11 +364,80 @@ const trackArray = internalHelper(({
300
364
  <li>age: 42</li>
301
365
  </ul>
302
366
  ```
303
-
367
+
368
+ The same pattern works with a `Map`:
369
+
370
+ ```gjs {data-filename="app/components/developer-map.gjs"}
371
+ import Component from '@glimmer/component';
372
+
373
+ export default class DeveloperMap extends Component {
374
+ map = new Map([
375
+ ['name', 'Shelly Sails'],
376
+ ['age', 42],
377
+ ]);
378
+
379
+ <template>
380
+ <ul>
381
+ {{#each-in this.map as |key value|}}
382
+ <li>{{key}}: {{value}}</li>
383
+ {{/each-in}}
384
+ </ul>
385
+ </template>
386
+ }
387
+ ```
388
+
389
+ When a `Map` uses object keys, you can pass `key="@identity"` to explicitly
390
+ track entries across re-renders using the JavaScript identity of each key:
391
+
392
+ ```gjs {data-filename="app/components/object-keyed-map.gjs"}
393
+ import Component from '@glimmer/component';
394
+
395
+ export default class ObjectKeyedMap extends Component {
396
+ map = new Map([
397
+ [{ name: 'one' }, 'foo'],
398
+ [{ name: 'two' }, 'bar'],
399
+ ]);
400
+
401
+ <template>
402
+ <ul>
403
+ {{#each-in this.map key="@identity" as |key value|}}
404
+ <li>{{key.name}}: {{value}}</li>
405
+ {{/each-in}}
406
+ </ul>
407
+ </template>
408
+ }
409
+ ```
410
+
304
411
  `#each-in` is a keyword and does not need to be imported.
305
412
 
413
+ ### Specifying Keys
414
+
415
+ Like `{{#each}}`, `{{#each-in}}` accepts a `key` option to decide which DOM
416
+ elements can be reused between renders. Since `{{#each-in}}` yields two block
417
+ params, the special values pick which one is used:
418
+
419
+ * `@identity` - The second block param: the property's value. This is the
420
+ default. Changing a value replaces that entry's DOM instead of updating it
421
+ in place.
422
+ * `@key` - The first block param: the property name, or for a `Map`, its key.
423
+
424
+ Any other string is a path, looked up on the value: `key="id"` keys each entry
425
+ by its `value.id`.
426
+
427
+ For example, `@key` keeps each entry's DOM as its score changes, so anything
428
+ stateful inside it — focus, a running transition, a component instance — survives
429
+ the update:
430
+
431
+ ```handlebars
432
+ {{#each-in this.scores key="@key" as |player score|}}
433
+ <PlayerScore @name={{player}} @score={{score}} />
434
+ {{/each-in}}
435
+ ```
436
+
306
437
  @method each-in
307
- @for Ember.Templates.helpers
438
+ @static
439
+ @noimport
440
+ @for Keywords
308
441
  @public
309
442
  @since 2.1.0
310
443
  */
@@ -331,7 +464,7 @@ const eachIn = internalHelper(({
331
464
  });
332
465
 
333
466
  /**
334
- @module ember
467
+ @module @ember/helper
335
468
  */
336
469
 
337
470
  /**
@@ -351,7 +484,7 @@ const eachIn = internalHelper(({
351
484
 
352
485
  The child `Component` would invoke the function with the new click count:
353
486
 
354
- ```app/components/my-child.gjs
487
+ ```gjs {data-filename="app/components/my-child.gjs"}
355
488
  import Component from '@glimmer/component';
356
489
  import { action } from '@ember/object';
357
490
 
@@ -373,7 +506,8 @@ const eachIn = internalHelper(({
373
506
 
374
507
  @method mut
375
508
  @param {Object} [attr] the "two-way" attribute that can be modified.
376
- @for Ember.Templates.helpers
509
+ @static
510
+ @for Keywords
377
511
  @public
378
512
  */
379
513
 
@@ -398,7 +532,7 @@ const mut = internalHelper(({
398
532
  });
399
533
 
400
534
  /**
401
- @module ember
535
+ @module @ember/helper
402
536
  */
403
537
 
404
538
 
@@ -510,7 +644,9 @@ const mut = internalHelper(({
510
644
 
511
645
  @method readonly
512
646
  @param {Object} [attr] the read-only attribute.
513
- @for Ember.Templates.helpers
647
+ @for Keywords
648
+ @noimport
649
+ @static
514
650
  @private
515
651
  */
516
652
  const readonly = internalHelper(({
@@ -522,7 +658,7 @@ const readonly = internalHelper(({
522
658
  });
523
659
 
524
660
  /**
525
- @module ember
661
+ @module @ember/helper
526
662
  */
527
663
 
528
664
 
@@ -548,9 +684,13 @@ const readonly = internalHelper(({
548
684
 
549
685
  The `unbound` helper only accepts a single argument, and it return an
550
686
  unbound value.
687
+
688
+ `unbound` is a template keyword and does not need to be imported.
551
689
 
552
690
  @method unbound
553
- @for Ember.Templates.helpers
691
+ @static
692
+ @noimport
693
+ @for Keywords
554
694
  @public
555
695
  */
556
696
 
@@ -2,7 +2,7 @@ import { isDestroying, isDestroyed, associateDestroyableChild } from '../@glimme
2
2
  import { a as getInternalHelperManager, f as hasValue, h as hasDestroyable } from './api-DuLOZMO_.js';
3
3
  import { getOwner } from '../@glimmer/owner/index.js';
4
4
  import { g as createCache, h as getValue } from './cache-DGDPVCpC.js';
5
- import { E as EMPTY_ARGS, a as EMPTY_NAMED, b as EMPTY_POSITIONAL } from './arguments-CDkbOqTS.js';
5
+ import { E as EMPTY_ARGS, a as EMPTY_NAMED, b as EMPTY_POSITIONAL } from './arguments-DniR8eF2.js';
6
6
 
7
7
  let ARGS_CACHES = new WeakMap() ;
8
8
  function getArgs(proxy) {
@@ -1,6 +1,6 @@
1
1
  import { toBool } from '../@glimmer/global-context/index.js';
2
2
  import { c as createComputeRef, v as valueForRef } from './reference-BqOLhKFy.js';
3
- import { i as internalHelper } from './hash-6NDs_5_f.js';
3
+ import { i as internalHelper } from './hash-BFu91gtE.js';
4
4
 
5
5
  /**
6
6
  * Performs a strict equality comparison.
@@ -1,4 +1,4 @@
1
- import { g as buildUntouchableThis, h as check, e as reifyNamed } from './arguments-CDkbOqTS.js';
1
+ import { g as buildUntouchableThis, h as check, e as reifyNamed } from './arguments-DniR8eF2.js';
2
2
  import { registerDestructor } from '../@glimmer/destroyable/index.js';
3
3
  import { k as setInternalModifierManager } from './api-DuLOZMO_.js';
4
4
  import { v as valueForRef } from './reference-BqOLhKFy.js';
@@ -131,6 +131,10 @@ function addEventListener(element, eventName, callback, options) {
131
131
  element.addEventListener(eventName, callback, options);
132
132
  }
133
133
 
134
+ /**
135
+ @module @ember/helper
136
+ */
137
+
134
138
  /**
135
139
  The `{{on}}` modifier lets you easily add event listeners (it uses
136
140
  [EventTarget.addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)
@@ -139,12 +143,13 @@ function addEventListener(element, eventName, callback, options) {
139
143
  For example, if you'd like to run a function on your component when a `<button>`
140
144
  in the components template is clicked you might do something like:
141
145
 
142
- ```app/components/like-post.gjs
146
+ ```gjs {data-filename="app/components/like-post.gjs"}
143
147
  import Component from '@glimmer/component';
144
148
  import { action } from '@ember/object';
145
149
 
146
- export default class LikePostComponent extends Component {
147
- saveLike = () => {
150
+ export default class LikePost extends Component {
151
+ @action
152
+ saveLike() {
148
153
  // someone likes your post!
149
154
  // better send a request off to your server...
150
155
  }
@@ -186,7 +191,7 @@ function addEventListener(element, eventName, callback, options) {
186
191
  For example, in our example case above if you'd like to pass in the post that
187
192
  was being liked when the button is clicked you could do something like:
188
193
 
189
- ```app/components/like-post.hbs
194
+ ```hbs
190
195
  <button {{on 'click' (fn this.saveLike @post)}}>Like this post!</button>
191
196
  ```
192
197
 
@@ -195,14 +200,14 @@ function addEventListener(element, eventName, callback, options) {
195
200
 
196
201
  ### Function Context
197
202
 
198
- In the example above, we used an arrow function to ensure that `likePost` is
199
- properly bound to the `items-list`, but let's explore what happens if we
200
- left out the arrow function:
203
+ In the example above, we used `@action` to ensure that `likePost` is
204
+ properly bound to the `LikePost` Component, but let's explore what happens if we
205
+ left out `@action`:
201
206
 
202
- ```app/components/like-post.gjs
207
+ ```gjs {data-filename="app/components/like-post.gjs"}
203
208
  import Component from '@glimmer/component';
204
209
 
205
- export default class LikePostComponent extends Component {
210
+ export default class LikePost extends Component {
206
211
  saveLike() {
207
212
  // ...snip...
208
213
  }
@@ -212,10 +217,16 @@ function addEventListener(element, eventName, callback, options) {
212
217
  In this example, when the button is clicked `saveLike` will be invoked,
213
218
  it will **not** have access to the component instance. In other
214
219
  words, it will have no `this` context, so please make sure your functions
215
- are bound (via an arrow function or other means) before passing into `on`!
220
+ are bound (via `@action` or other means) before passing into `on`!
221
+
222
+ The `on` modifier is a keyword and does not need to be imported.
216
223
 
217
224
  @method on
225
+ @static
226
+ @for Keywords
227
+ @noimport
218
228
  @public
229
+ @since 3.11.0
219
230
  */
220
231
  class OnModifierManager {
221
232
  getDebugName() {
@@ -3,9 +3,7 @@ const opcodes = {
3
3
  TrustingAppend: 2,
4
4
  Comment: 3,
5
5
  Modifier: 4,
6
- StrictModifier: 5,
7
6
  Block: 6,
8
- StrictBlock: 7,
9
7
  Component: 8,
10
8
  OpenElement: 10,
11
9
  OpenElementWithSplat: 11,
@@ -16,8 +14,6 @@ const opcodes = {
16
14
  ComponentAttr: 16,
17
15
  AttrSplat: 17,
18
16
  Yield: 18,
19
- DynamicArg: 20,
20
- StaticArg: 21,
21
17
  TrustingDynamicAttr: 22,
22
18
  TrustingComponentAttr: 23,
23
19
  StaticComponentAttr: 24,
@@ -2,9 +2,9 @@ import '../@ember/debug/index.js';
2
2
  import { _instrumentStart } from '../@ember/instrumentation/index.js';
3
3
  import { c as capabilityFlagsFrom } from './capabilities-CajW4QjE.js';
4
4
  import { v as valueForRef, U as UNDEFINED_REFERENCE } from './reference-BqOLhKFy.js';
5
- import { E as EMPTY_ARGS } from './arguments-CDkbOqTS.js';
6
- import { u as unwrapTemplate } from './curly-BbL6STF2.js';
7
- import { t as templateFactory } from './index-DaFzpTIE.js';
5
+ import { E as EMPTY_ARGS } from './arguments-DniR8eF2.js';
6
+ import { u as unwrapTemplate } from './curly-BCD_vyHq.js';
7
+ import { t as templateFactory } from './index-BYUSIu_W.js';
8
8
  import { assert } from '../@ember/debug/lib/assert.js';
9
9
 
10
10
  function instrumentationPayload(def) {
@@ -1,8 +1,8 @@
1
- import { V as VM_MAIN_OP, a as VM_CONTENT_TYPE_OP, b as VM_ASSERT_SAME_OP, c as VM_APPEND_HTML_OP, d as VM_APPEND_TEXT_OP, e as VM_RESOLVE_CURRIED_COMPONENT_OP, f as VM_PUSH_DYNAMIC_COMPONENT_INSTANCE_OP, g as VM_APPEND_SAFE_HTML_OP, h as VM_APPEND_DOCUMENT_FRAGMENT_OP, i as VM_APPEND_NODE_OP } from './syscall-ops-CN7STuUn.js';
1
+ import { V as VM_MAIN_OP, a as VM_CONTENT_TYPE_OP, b as VM_ASSERT_SAME_OP, c as VM_APPEND_HTML_OP, d as VM_APPEND_TEXT_OP, e as VM_RESOLVE_CURRIED_COMPONENT_OP, f as VM_PUSH_DYNAMIC_COMPONENT_INSTANCE_OP, g as VM_APPEND_SAFE_HTML_OP, h as VM_APPEND_DOCUMENT_FRAGMENT_OP, i as VM_APPEND_NODE_OP } from './syscall-ops-CkPT1Kfx.js';
2
2
  import { V as VM_INVOKE_STATIC_OP } from './vm-ops-ImHv0Wtg.js';
3
3
  import { $ as $s0 } from './registers-C_W2qYHJ.js';
4
4
  import { ContentType } from '../@glimmer/vm/index.js';
5
- import { f as EncoderImpl, g as encodeOp, i as invokePreparedComponent, S as SwitchCases, h as InvokeBareComponent, C as CallDynamic } from './index-DaFzpTIE.js';
5
+ import { f as EncoderImpl, g as encodeOp, i as invokePreparedComponent, S as SwitchCases, h as InvokeBareComponent, C as CallDynamic } from './index-BYUSIu_W.js';
6
6
 
7
7
  class StdLib {
8
8
  constructor(main, trustingGuardedAppend, cautiousGuardedAppend, trustingNonDynamicAppend, cautiousNonDynamicAppend) {
@@ -4,7 +4,7 @@ import { U as UNDEFINED_REFERENCE, c as createComputeRef, v as valueForRef, f as
4
4
  import { t as track, U as UPDATE_TAG, e as debug, B as resetTracking, o as beginTrackFrame, s as endTrackFrame } from './cache-DGDPVCpC.js';
5
5
  import { a as assert } from './assert-Zqc4wiAV.js';
6
6
  import { P as ProgramImpl } from './program-DlgjqLa6.js';
7
- import { D as DebugRenderTreeImpl, i as isArgumentError, j as isCurriedType, d as curry, A as APPEND_OPCODES, h as check, k as resolveCurriedValue, f as reifyPositional, l as AssertFilter, V as VMArgumentsImpl, m as externs, J as JumpIfNotModifiedOpcode, B as BeginTrackFrameOpcode, n as EndTrackFrameOpcode } from './arguments-CDkbOqTS.js';
7
+ import { D as DebugRenderTreeImpl, i as isArgumentError, j as isCurriedType, d as curry, A as APPEND_OPCODES, h as check, k as resolveCurriedValue, f as reifyPositional, l as AssertFilter, V as VMArgumentsImpl, m as externs, J as JumpIfNotModifiedOpcode, B as BeginTrackFrameOpcode, n as EndTrackFrameOpcode } from './arguments-DniR8eF2.js';
8
8
  import { B as BLACKLIST_TABLE, f as DOMOperations, D as DOMTreeConstruction, N as NewTreeBuilder } from './api-Dz70AUL_.js';
9
9
  import { a as assign } from './object-utils-AijlD-JH.js';
10
10
  import { associateDestroyableChild, _hasDestroyableChildren, destroy, destroyChildren, registerDestructor } from '../@glimmer/destroyable/index.js';
@@ -14,7 +14,7 @@ import { r as reverse } from './array-utils-CZQxrdD3.js';
14
14
  import { a as $v0, d as $pc, e as $ra, f as $fp, g as $sp, i as isLowLevelRegister } from './registers-C_W2qYHJ.js';
15
15
  import { a as VM_RETURN_TO_OP, b as VM_RETURN_OP, c as VM_JUMP_OP, d as VM_INVOKE_VIRTUAL_OP, V as VM_INVOKE_STATIC_OP, e as VM_POP_FRAME_OP, f as VM_PUSH_FRAME_OP } from './vm-ops-ImHv0Wtg.js';
16
16
  import { a as CURRIED_COMPONENT, b as CURRIED_HELPER } from './curried-BZnYakIg.js';
17
- import { ai as VM_CURRY_OP, p as decodeHandle, aj as VM_DYNAMIC_HELPER_OP, ak as VM_HELPER_OP, al as VM_GET_VARIABLE_OP, am as VM_SET_VARIABLE_OP, an as VM_SET_BLOCK_OP, ao as VM_ROOT_SCOPE_OP, ap as VM_GET_PROPERTY_OP, aq as VM_GET_BLOCK_OP, ar as VM_SPREAD_BLOCK_OP, as as VM_HAS_BLOCK_OP, at as VM_HAS_BLOCK_PARAMS_OP, au as VM_CONCAT_OP, av as VM_IF_INLINE_OP, aw as VM_NOT_OP, ax as VM_GET_DYNAMIC_VAR_OP, ay as VM_LOG_OP, a as VM_CONTENT_TYPE_OP, az as VM_DYNAMIC_CONTENT_TYPE_OP, c as VM_APPEND_HTML_OP, g as VM_APPEND_SAFE_HTML_OP, d as VM_APPEND_TEXT_OP, h as VM_APPEND_DOCUMENT_FRAGMENT_OP, i as VM_APPEND_NODE_OP, aA as VM_DEBUGGER_OP, aB as VM_ENTER_LIST_OP, aC as VM_EXIT_LIST_OP, aD as VM_ITERATE_OP } from './syscall-ops-CN7STuUn.js';
17
+ import { ah as VM_CURRY_OP, p as decodeHandle, ai as VM_DYNAMIC_HELPER_OP, aj as VM_HELPER_OP, ak as VM_GET_VARIABLE_OP, al as VM_SET_VARIABLE_OP, am as VM_SET_BLOCK_OP, an as VM_ROOT_SCOPE_OP, ao as VM_GET_PROPERTY_OP, ap as VM_GET_BLOCK_OP, aq as VM_SPREAD_BLOCK_OP, ar as VM_HAS_BLOCK_OP, as as VM_HAS_BLOCK_PARAMS_OP, at as VM_CONCAT_OP, au as VM_IF_INLINE_OP, av as VM_NOT_OP, aw as VM_GET_DYNAMIC_VAR_OP, ax as VM_LOG_OP, a as VM_CONTENT_TYPE_OP, ay as VM_DYNAMIC_CONTENT_TYPE_OP, c as VM_APPEND_HTML_OP, g as VM_APPEND_SAFE_HTML_OP, d as VM_APPEND_TEXT_OP, h as VM_APPEND_DOCUMENT_FRAGMENT_OP, i as VM_APPEND_NODE_OP, az as VM_DEBUGGER_OP, aA as VM_ENTER_LIST_OP, aB as VM_EXIT_LIST_OP, aC as VM_ITERATE_OP } from './syscall-ops-CkPT1Kfx.js';
18
18
  import { d as debugToString } from './debug-to-string-C6LsA_qz.js';
19
19
  import { a as getInternalHelperManager, c as hasInternalComponentManager, d as hasInternalHelperManager } from './api-DuLOZMO_.js';
20
20
  import { ContentType } from '../@glimmer/vm/index.js';