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
@@ -36,11 +36,11 @@ import { i as isHTMLSafe } from './index-D-xTBV4B.js';
36
36
  import { isArray } from '../@ember/array/index.js';
37
37
  import { g as getComponentTemplate } from './template-Dc_cBOoX.js';
38
38
  import { c as hasInternalComponentManager, j as setInternalHelperManager, g as getInternalComponentManager } from './api-zh_k31vb.js';
39
- import { h as hash, f as fn, a as array } from './hash-mcs3pEFO.js';
40
- import { g as get$1, c as concat } from './get-t0-itmA-.js';
41
- import { o as on } from './on-B5NVufs_.js';
39
+ import { h as hash, f as fn, a as array } from './hash-Dkj3I4L4.js';
40
+ import { g as get$1, c as concat } from './get-Dt5L0TcU.js';
41
+ import { o as on } from './on-CWgOWNSL.js';
42
42
  import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-BtLl0uH0.js';
43
- import { i as isClassicHelper, C as CLASSIC_HELPER_MANAGER } from './helper-DLjV2ZZW.js';
43
+ import { i as isClassicHelper, C as CLASSIC_HELPER_MANAGER } from './helper-CN6UzshW.js';
44
44
  import { dasherize } from '../@ember/-internals/string/index.js';
45
45
  import { a as uniqueId } from './unique-id-CfHImDRV.js';
46
46
  import '../route-recognizer/index.js';
@@ -239,7 +239,7 @@ class RootComponentDefinition {
239
239
  */
240
240
 
241
241
  /**
242
- The `{{#each}}` helper loops over elements in a collection. It is an extension
242
+ The `{{#each}}` keyword loops over elements in a collection. It is an extension
243
243
  of the base Handlebars `{{#each}}` helper.
244
244
 
245
245
  The default behavior of `{{#each}}` is to yield its inner block once for every
@@ -283,6 +283,8 @@ class RootComponentDefinition {
283
283
  {{/each}}
284
284
  </ul>
285
285
  ```
286
+
287
+ `#each` is a keyword and does not need to be imported.
286
288
 
287
289
  ### Specifying Keys
288
290
 
@@ -350,11 +352,11 @@ class RootComponentDefinition {
350
352
  */
351
353
 
352
354
  /**
353
- The `{{each-in}}` helper loops over properties on an object.
355
+ The `{{#each-in}}` keyword loops over properties on an object.
354
356
 
355
357
  For example, given this component definition:
356
358
 
357
- ```app/components/developer-details.js
359
+ ```app/components/developer-details.gjs
358
360
  import Component from '@glimmer/component';
359
361
  import { tracked } from '@glimmer/tracking';
360
362
 
@@ -363,21 +365,19 @@ class RootComponentDefinition {
363
365
  "name": "Shelly Sails",
364
366
  "age": 42
365
367
  };
368
+
369
+ <template>
370
+ <ul>
371
+ {{#each-in this.developer as |key value|}}
372
+ <li>{{key}}: {{value}}</li>
373
+ {{/each-in}}
374
+ </ul>
375
+ </template>
366
376
  }
367
377
  ```
368
378
 
369
379
  This template would display all properties on the `developer`
370
- object in a list:
371
-
372
- ```app/components/developer-details.hbs
373
- <ul>
374
- {{#each-in this.developer as |key value|}}
375
- <li>{{key}}: {{value}}</li>
376
- {{/each-in}}
377
- </ul>
378
- ```
379
-
380
- Outputting their name and age:
380
+ object in a list, outputting their name and age:
381
381
 
382
382
  ```html
383
383
  <ul>
@@ -385,6 +385,8 @@ class RootComponentDefinition {
385
385
  <li>age: 42</li>
386
386
  </ul>
387
387
  ```
388
+
389
+ `#each-in` is a keyword and does not need to be imported.
388
390
 
389
391
  @method each-in
390
392
  @for Ember.Templates.helpers
@@ -776,73 +778,42 @@ const trackArray = internalHelper(({
776
778
  */
777
779
 
778
780
  /**
779
- The `mut` helper lets you __clearly specify__ that a child `Component` can update the
780
- (mutable) value passed to it, which will __change the value of the parent component__.
781
-
782
- To specify that a parameter is mutable, when invoking the child `Component`:
781
+ The `mut` helper is a shortcut for updating for args.
782
+
783
+ However, defining update functions on your backing class is preferable to using `mut`.
784
+
785
+ More directly: Don't use `mut`.
783
786
 
784
- ```handlebars
785
- <MyChild @childClickCount={{fn (mut totalClicks)}} />
786
- ```
787
-
788
- or
789
-
790
- ```handlebars
791
- {{my-child childClickCount=(mut totalClicks)}}
792
- ```
793
-
794
- The child `Component` can then modify the parent's value just by modifying its own
795
- property:
796
-
797
- ```javascript
798
- // my-child.js
799
- export default class MyChild extends Component {
800
- click() {
801
- this.incrementProperty('childClickCount');
802
- }
803
- }
804
- ```
805
-
806
- Note that for curly components (`{{my-component}}`) the bindings are already mutable,
807
- making the `mut` unnecessary.
808
-
809
- Additionally, the `mut` helper can be combined with the `fn` helper to
810
- mutate a value. For example:
811
-
812
- ```handlebars
813
- <MyChild @childClickCount={{this.totalClicks}} @click-count-change={{fn (mut totalClicks))}} />
814
- ```
815
-
816
- or
787
+ The `mut` helper, when used with `fn`, will return a function that
788
+ sets the value passed to `mut` to its first argument. As an example, we can create a
789
+ button that increments a value passing the value directly to the `fn`:
817
790
 
818
791
  ```handlebars
819
- {{my-child childClickCount=totalClicks click-count-change=(fn (mut totalClicks))}}
792
+ <MyChild @childClickCount={{this.totalClicks}} @clickCountChange={{fn (mut this.totalClicks)}} />
820
793
  ```
821
794
 
822
- The child `Component` would invoke the function with the new click value:
795
+ The child `Component` would invoke the function with the new click count:
823
796
 
824
- ```javascript
825
- // my-child.js
797
+ ```app/components/my-child.gjs
798
+ import Component from '@glimmer/component';
799
+ import { action } from '@ember/object';
800
+
826
801
  export default class MyChild extends Component {
827
- click() {
828
- this.get('click-count-change')(this.get('childClickCount') + 1);
802
+ @action
803
+ update() {
804
+ this.args.clickCountChange(this.args.childClickCount + 1);
829
805
  }
806
+
807
+ <template>
808
+ <button {{on "click" this.update}}>
809
+ Click me!
810
+ </button>
811
+ </template>
830
812
  }
831
813
  ```
832
814
 
833
815
  The `mut` helper changes the `totalClicks` value to what was provided as the `fn` argument.
834
816
 
835
- The `mut` helper, when used with `fn`, will return a function that
836
- sets the value passed to `mut` to its first argument. As an example, we can create a
837
- button that increments a value passing the value directly to the `fn`:
838
-
839
- ```handlebars
840
- {{! inc helper is not provided by Ember }}
841
- <button onclick={{fn (mut count) (inc count)}}>
842
- Increment count
843
- </button>
844
- ```
845
-
846
817
  @method mut
847
818
  @param {Object} [attr] the "two-way" attribute that can be modified.
848
819
  @for Ember.Templates.helpers
@@ -864,6 +835,10 @@ const mut = internalHelper(({
864
835
  /**
865
836
  The `readonly` helper let's you specify that a binding is one-way only,
866
837
  instead of two-way.
838
+
839
+ This is a vestigial helper from the days of `@ember/component` and does not apply to
840
+ components extending from `@glimmer/component`.
841
+
867
842
  When you pass a `readonly` binding from an outer context (e.g. parent component),
868
843
  to to an inner context (e.g. child component), you are saying that changing that
869
844
  property in the inner context does not change the value in the outer context.
@@ -876,14 +851,6 @@ const mut = internalHelper(({
876
851
  }
877
852
  ```
878
853
 
879
- ```app/templates/components/my-parent.hbs
880
- {{log totalClicks}} // -> 3
881
- <MyChild @childClickCount={{readonly totalClicks}} />
882
- ```
883
- ```
884
- {{my-child childClickCount=(readonly totalClicks)}}
885
- ```
886
-
887
854
  Now, when you update `childClickCount`:
888
855
 
889
856
  ```app/components/my-child.js
@@ -1160,15 +1127,14 @@ class MountDefinition {
1160
1127
 
1161
1128
  For example, the following template mounts the `ember-chat` engine:
1162
1129
 
1163
- ```handlebars
1164
- {{! application.hbs }}
1130
+ ```app/templates/application.gjs
1165
1131
  {{mount "ember-chat"}}
1166
1132
  ```
1167
1133
 
1168
1134
  Additionally, you can also pass in a `model` argument that will be
1169
1135
  set as the engines model. This can be an existing object:
1170
1136
 
1171
- ```
1137
+ ```hbs
1172
1138
  <div>
1173
1139
  {{mount 'admin' model=userSettings}}
1174
1140
  </div>
@@ -1176,15 +1142,20 @@ class MountDefinition {
1176
1142
 
1177
1143
  Or an inline `hash`, and you can even pass components:
1178
1144
 
1145
+ ```gjs
1146
+ import SignInButton from '../components/sign-in-button';
1147
+ <template>
1148
+ <div>
1149
+ <h1>Application template!</h1>
1150
+ {{mount 'admin' model=(hash
1151
+ title='Secret Admin'
1152
+ signInButton=SignInButton
1153
+ )}}
1154
+ </div>
1155
+ </template>
1179
1156
  ```
1180
- <div>
1181
- <h1>Application template!</h1>
1182
- {{mount 'admin' model=(hash
1183
- title='Secret Admin'
1184
- signInButton=(component 'sign-in-button')
1185
- )}}
1186
- </div>
1187
- ```
1157
+
1158
+ `mount` is built-in and does not need to be imported.
1188
1159
 
1189
1160
  @method mount
1190
1161
  @param {String} name Name of the engine to mount.
@@ -1316,23 +1287,30 @@ function makeRouteTemplate(owner, name, template) {
1316
1287
  /**
1317
1288
  The `{{outlet}}` helper lets you specify where a child route will render in
1318
1289
  your template. An important use of the `{{outlet}}` helper is in your
1319
- application's `application.hbs` file:
1320
-
1321
- ```app/templates/application.hbs
1322
- <MyHeader />
1323
-
1324
- <div class="my-dynamic-content">
1325
- <!-- this content will change based on the current route, which depends on the current URL -->
1326
- {{outlet}}
1327
- </div>
1328
-
1329
- <MyFooter />
1290
+ application's `application.gjs` file:
1291
+
1292
+ ```app/templates/application.gjs
1293
+ import MyHeader from '../components/my-header';
1294
+ import MyFooter from '../components/my-footer';
1295
+
1296
+ <template>
1297
+ <MyHeader />
1298
+
1299
+ <div class="my-dynamic-content">
1300
+ <!-- this content will change based on the current route, which depends on the current URL -->
1301
+ {{outlet}}
1302
+ </div>
1303
+
1304
+ <MyFooter />
1305
+ </template>
1330
1306
  ```
1331
1307
 
1332
1308
  See the [routing guide](https://guides.emberjs.com/release/routing/rendering-a-template/) for more
1333
1309
  information on how your `route` interacts with the `{{outlet}}` helper.
1334
1310
  Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
1335
1311
 
1312
+ `outlet` is built-in and does not need to be imported.
1313
+
1336
1314
  @method outlet
1337
1315
  @for Ember.Templates.helpers
1338
1316
  @public
@@ -114,11 +114,7 @@ function addEventListener(element, eventName, callback, options) {
114
114
  For example, if you'd like to run a function on your component when a `<button>`
115
115
  in the components template is clicked you might do something like:
116
116
 
117
- ```app/components/like-post.hbs
118
- <button {{on 'click' this.saveLike}}>Like this post!</button>
119
- ```
120
-
121
- ```app/components/like-post.js
117
+ ```app/components/like-post.gjs
122
118
  import Component from '@glimmer/component';
123
119
  import { action } from '@ember/object';
124
120
 
@@ -127,6 +123,10 @@ function addEventListener(element, eventName, callback, options) {
127
123
  // someone likes your post!
128
124
  // better send a request off to your server...
129
125
  }
126
+
127
+ <template>
128
+ <button {{on 'click' this.saveLike}}>Like this post!</button>
129
+ </template>
130
130
  }
131
131
  ```
132
132
 
@@ -174,7 +174,7 @@ function addEventListener(element, eventName, callback, options) {
174
174
  properly bound to the `items-list`, but let's explore what happens if we
175
175
  left out the arrow function:
176
176
 
177
- ```app/components/like-post.js
177
+ ```app/components/like-post.gjs
178
178
  import Component from '@glimmer/component';
179
179
 
180
180
  export default class LikePostComponent extends Component {
@@ -1,6 +1,6 @@
1
1
  import { toBool } from '../@glimmer/global-context/index.js';
2
2
  import { a as createComputeRef, v as valueForRef } from './reference-BshxG6wn.js';
3
- import { i as internalHelper } from './hash-mcs3pEFO.js';
3
+ import { i as internalHelper } from './hash-Dkj3I4L4.js';
4
4
 
5
5
  const and = internalHelper(({
6
6
  positional
@@ -1,12 +1,12 @@
1
1
  import { privatize } from '../@ember/-internals/container/index.js';
2
2
  import { getOwner } from '../@ember/-internals/owner/index.js';
3
- import { I as Input, T as Textarea } from './textarea-CHqL0Rdh.js';
3
+ import { I as Input, T as Textarea } from './textarea-Byj32raR.js';
4
4
  import { LinkTo } from '../@ember/routing/index.js';
5
5
  import './render-DkJJmoI4.js';
6
6
  import { c as clientBuilder } from './element-builder-CnlTPNyw.js';
7
7
  import { r as rehydrationBuilder } from './rehydrate-builder-DJ8k-6fg.js';
8
8
  import { s as serializeBuilder } from './serialize-builder-R3Ozg0sC.js';
9
- import { o as outletHelper, O as OutletView, R as Renderer } from './index-qDFz6Mfe.js';
9
+ import { o as outletHelper, O as OutletView, R as Renderer } from './index-ClxHbCe9.js';
10
10
  import { t as templateFactory } from './index-Bj71BDDA.js';
11
11
 
12
12
  const OutletTemplate = templateFactory(
@@ -226,8 +226,12 @@ if (hasDOM) {
226
226
  /**
227
227
  The `Input` component lets you create an HTML `<input>` element.
228
228
 
229
- ```handlebars
230
- <Input @value="987" />
229
+ ```gjs
230
+ import { Input } from '@ember/component';
231
+
232
+ <template>
233
+ <Input @value="987" />
234
+ </template>
231
235
  ```
232
236
 
233
237
  creates an `<input>` element with `type="text"` and value set to 987.