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.
- package/build-metadata.json +3 -3
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +5 -5
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +1 -1
- package/dist/dev/packages/@ember/application/index.js +1 -1
- package/dist/dev/packages/@ember/application/instance.js +1 -1
- package/dist/dev/packages/@ember/array/index.js +4 -0
- package/dist/dev/packages/@ember/component/helper.js +1 -1
- package/dist/dev/packages/@ember/component/index.js +9 -3
- package/dist/dev/packages/@ember/engine/index.js +1 -1
- package/dist/dev/packages/@ember/helper/index.js +4 -23
- package/dist/dev/packages/@ember/modifier/on.js +1 -1
- package/dist/dev/packages/@ember/object/index.js +22 -17
- package/dist/dev/packages/@ember/renderer/index.js +1 -1
- package/dist/dev/packages/@ember/routing/index.js +8 -4
- package/dist/dev/packages/@ember/routing/route.js +1 -1
- package/dist/dev/packages/@ember/routing/router-service.js +19 -12
- package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +3 -3
- package/dist/dev/packages/@glimmer/runtime/index.js +4 -4
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/shared-chunks/{element-DQJOvSlQ.js → element-Cf3hqNOD.js} +2 -0
- package/dist/dev/packages/shared-chunks/{get-D5b5QlqE.js → get-BehtPmsu.js} +30 -33
- package/dist/dev/packages/shared-chunks/{hash-BRRFQJ99.js → hash-BTwOuDGQ.js} +15 -9
- package/dist/dev/packages/shared-chunks/{helper-Do7NCZHI.js → helper-BubrhyuN.js} +18 -6
- package/dist/dev/packages/shared-chunks/{index-CwnQYqK5.js → index-CL1zjHwo.js} +80 -102
- package/dist/dev/packages/shared-chunks/{on-BueSMv9L.js → on-BQii6ILK.js} +6 -6
- package/dist/dev/packages/shared-chunks/{or-O0eJQ4K-.js → or-BTH3yuFG.js} +1 -1
- package/dist/dev/packages/shared-chunks/{setup-registry-BC5VMvei.js → setup-registry-BQZJfq-Y.js} +2 -2
- package/dist/dev/packages/shared-chunks/{textarea-WSlUEr0y.js → textarea-lD4apgrP.js} +6 -2
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +5 -5
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +1 -1
- package/dist/prod/packages/@ember/application/index.js +1 -1
- package/dist/prod/packages/@ember/application/instance.js +1 -1
- package/dist/prod/packages/@ember/array/index.js +4 -0
- package/dist/prod/packages/@ember/component/helper.js +1 -1
- package/dist/prod/packages/@ember/component/index.js +9 -3
- package/dist/prod/packages/@ember/engine/index.js +1 -1
- package/dist/prod/packages/@ember/helper/index.js +4 -23
- package/dist/prod/packages/@ember/modifier/on.js +1 -1
- package/dist/prod/packages/@ember/object/index.js +22 -17
- package/dist/prod/packages/@ember/renderer/index.js +1 -1
- package/dist/prod/packages/@ember/routing/index.js +8 -4
- package/dist/prod/packages/@ember/routing/route.js +1 -1
- package/dist/prod/packages/@ember/routing/router-service.js +19 -12
- package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +3 -3
- package/dist/prod/packages/@glimmer/runtime/index.js +4 -4
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/shared-chunks/{element-DUOVW5Ho.js → element-9DRa_9dO.js} +2 -0
- package/dist/prod/packages/shared-chunks/{get-t0-itmA-.js → get-Dt5L0TcU.js} +30 -33
- package/dist/prod/packages/shared-chunks/{hash-mcs3pEFO.js → hash-Dkj3I4L4.js} +15 -9
- package/dist/prod/packages/shared-chunks/{helper-DLjV2ZZW.js → helper-CN6UzshW.js} +18 -6
- package/dist/prod/packages/shared-chunks/{index-qDFz6Mfe.js → index-ClxHbCe9.js} +80 -102
- package/dist/prod/packages/shared-chunks/{on-B5NVufs_.js → on-CWgOWNSL.js} +6 -6
- package/dist/prod/packages/shared-chunks/{or-3AxY5TPj.js → or-Crsa2wci.js} +1 -1
- package/dist/prod/packages/shared-chunks/{setup-registry-C2KfZJWI.js → setup-registry-B3DhqtxX.js} +2 -2
- package/dist/prod/packages/shared-chunks/{textarea-CHqL0Rdh.js → textarea-Byj32raR.js} +6 -2
- package/docs/data.json +180 -180
- package/package.json +3 -6
- package/types/stable/@ember/-internals/glimmer/index.d.ts +165 -121
- package/types/stable/@ember/-internals/glimmer/lib/component.d.ts +8 -2
- package/types/stable/@ember/-internals/glimmer/lib/glimmer-tracking-docs.d.ts +12 -12
- package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +18 -6
- package/types/stable/@ember/-internals/glimmer/lib/helpers/array.d.ts +3 -1
- package/types/stable/@ember/-internals/glimmer/lib/helpers/component.d.ts +65 -121
- package/types/stable/@ember/-internals/glimmer/lib/helpers/concat.d.ts +8 -4
- package/types/stable/@ember/-internals/glimmer/lib/helpers/each-in.d.ts +16 -14
- package/types/stable/@ember/-internals/glimmer/lib/helpers/element.d.ts +2 -0
- package/types/stable/@ember/-internals/glimmer/lib/helpers/fn.d.ts +11 -7
- package/types/stable/@ember/-internals/glimmer/lib/helpers/get.d.ts +23 -29
- package/types/stable/@ember/-internals/glimmer/lib/helpers/hash.d.ts +3 -1
- package/types/stable/@ember/-internals/glimmer/lib/helpers/if-unless.d.ts +95 -49
- package/types/stable/@ember/-internals/glimmer/lib/helpers/mut.d.ts +23 -54
- package/types/stable/@ember/-internals/glimmer/lib/helpers/page-title.d.ts +6 -2
- package/types/stable/@ember/-internals/glimmer/lib/helpers/readonly.d.ts +4 -8
- package/types/stable/@ember/-internals/glimmer/lib/modifiers/on.d.ts +10 -10
- package/types/stable/@ember/-internals/glimmer/lib/syntax/in-element.d.ts +2 -0
- package/types/stable/@ember/-internals/glimmer/lib/syntax/let.d.ts +2 -14
- package/types/stable/@ember/-internals/glimmer/lib/syntax/mount.d.ts +15 -11
- package/types/stable/@ember/-internals/glimmer/lib/syntax/outlet.d.ts +17 -10
- package/types/stable/@ember/-internals/runtime/lib/mixins/target_action_support.d.ts +1 -1
- package/types/stable/@ember/array/index.d.ts +4 -0
- package/types/stable/@ember/controller/index.d.ts +1 -1
- package/types/stable/@ember/helper/index.d.ts +0 -19
- package/types/stable/@ember/object/index.d.ts +4 -3
- package/types/stable/@ember/object/observable.d.ts +4 -0
- package/types/stable/@ember/routing/route.d.ts +1 -1
- package/types/stable/@ember/routing/router-service.d.ts +20 -12
- package/types/stable/@glimmer/runtime/lib/helpers/array.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/helpers/concat.d.ts +8 -3
- package/types/stable/@glimmer/runtime/lib/helpers/fn.d.ts +13 -7
- package/types/stable/@glimmer/runtime/lib/helpers/get.d.ts +21 -29
- package/types/stable/@glimmer/runtime/lib/helpers/hash.d.ts +1 -1
- package/types/stable/@glimmer/syntax/lib/get-template-locals.d.ts +1 -1
- package/types/stable/@glimmer/tracking/index.d.ts +12 -12
|
@@ -29,20 +29,32 @@ const IS_CLASSIC_HELPER = Symbol('IS_CLASSIC_HELPER');
|
|
|
29
29
|
Ember Helpers are functions that can compute values, and are used in templates.
|
|
30
30
|
For example, this code calls a helper named `format-currency`:
|
|
31
31
|
|
|
32
|
-
```app/templates/application.
|
|
33
|
-
|
|
32
|
+
```app/templates/application.gjs
|
|
33
|
+
import Cost from '../components/cost';
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<Cost @cents={{230}} />
|
|
37
|
+
</template>
|
|
34
38
|
```
|
|
35
39
|
|
|
36
|
-
```app/components/cost.
|
|
37
|
-
|
|
40
|
+
```app/components/cost.gjs
|
|
41
|
+
import formatCurrency from '../helpers/format-currency';
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div>{{formatCurrency @cents currency="$"}}</div>
|
|
45
|
+
</template>
|
|
38
46
|
```
|
|
39
47
|
|
|
40
48
|
Additionally a helper can be called as a nested helper.
|
|
41
49
|
In this example, we show the formatted currency value if the `showMoney`
|
|
42
50
|
named argument is truthy.
|
|
43
51
|
|
|
44
|
-
```
|
|
45
|
-
|
|
52
|
+
```gjs
|
|
53
|
+
import formatCurrency from '../helpers/format-currency';
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
{{if @showMoney (formatCurrency @cents currency="$")}}
|
|
57
|
+
</template>
|
|
46
58
|
```
|
|
47
59
|
|
|
48
60
|
Helpers defined using a class must provide a `compute` function. For example:
|
|
@@ -38,11 +38,11 @@ import { i as isHTMLSafe } from './index-D-xTBV4B.js';
|
|
|
38
38
|
import { isArray } from '../@ember/array/index.js';
|
|
39
39
|
import { g as getComponentTemplate } from './template-R_5UMHhb.js';
|
|
40
40
|
import { c as hasInternalComponentManager, j as setInternalHelperManager, g as getInternalComponentManager } from './api-BawZUDYD.js';
|
|
41
|
-
import { h as hash, f as fn, a as array } from './hash-
|
|
42
|
-
import { g as get$1, c as concat } from './get-
|
|
43
|
-
import { o as on } from './on-
|
|
41
|
+
import { h as hash, f as fn, a as array } from './hash-BTwOuDGQ.js';
|
|
42
|
+
import { g as get$1, c as concat } from './get-BehtPmsu.js';
|
|
43
|
+
import { o as on } from './on-BQii6ILK.js';
|
|
44
44
|
import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-BqOt8bDl.js';
|
|
45
|
-
import { i as isClassicHelper, C as CLASSIC_HELPER_MANAGER } from './helper-
|
|
45
|
+
import { i as isClassicHelper, C as CLASSIC_HELPER_MANAGER } from './helper-BubrhyuN.js';
|
|
46
46
|
import { dasherize } from '../@ember/-internals/string/index.js';
|
|
47
47
|
import { a as uniqueId } from './unique-id-CgmHQiwi.js';
|
|
48
48
|
import '../route-recognizer/index.js';
|
|
@@ -246,7 +246,7 @@ class RootComponentDefinition {
|
|
|
246
246
|
*/
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
|
-
The `{{#each}}`
|
|
249
|
+
The `{{#each}}` keyword loops over elements in a collection. It is an extension
|
|
250
250
|
of the base Handlebars `{{#each}}` helper.
|
|
251
251
|
|
|
252
252
|
The default behavior of `{{#each}}` is to yield its inner block once for every
|
|
@@ -290,6 +290,8 @@ class RootComponentDefinition {
|
|
|
290
290
|
{{/each}}
|
|
291
291
|
</ul>
|
|
292
292
|
```
|
|
293
|
+
|
|
294
|
+
`#each` is a keyword and does not need to be imported.
|
|
293
295
|
|
|
294
296
|
### Specifying Keys
|
|
295
297
|
|
|
@@ -357,11 +359,11 @@ class RootComponentDefinition {
|
|
|
357
359
|
*/
|
|
358
360
|
|
|
359
361
|
/**
|
|
360
|
-
The `{{each-in}}`
|
|
362
|
+
The `{{#each-in}}` keyword loops over properties on an object.
|
|
361
363
|
|
|
362
364
|
For example, given this component definition:
|
|
363
365
|
|
|
364
|
-
```app/components/developer-details.
|
|
366
|
+
```app/components/developer-details.gjs
|
|
365
367
|
import Component from '@glimmer/component';
|
|
366
368
|
import { tracked } from '@glimmer/tracking';
|
|
367
369
|
|
|
@@ -370,21 +372,19 @@ class RootComponentDefinition {
|
|
|
370
372
|
"name": "Shelly Sails",
|
|
371
373
|
"age": 42
|
|
372
374
|
};
|
|
375
|
+
|
|
376
|
+
<template>
|
|
377
|
+
<ul>
|
|
378
|
+
{{#each-in this.developer as |key value|}}
|
|
379
|
+
<li>{{key}}: {{value}}</li>
|
|
380
|
+
{{/each-in}}
|
|
381
|
+
</ul>
|
|
382
|
+
</template>
|
|
373
383
|
}
|
|
374
384
|
```
|
|
375
385
|
|
|
376
386
|
This template would display all properties on the `developer`
|
|
377
|
-
object in a list:
|
|
378
|
-
|
|
379
|
-
```app/components/developer-details.hbs
|
|
380
|
-
<ul>
|
|
381
|
-
{{#each-in this.developer as |key value|}}
|
|
382
|
-
<li>{{key}}: {{value}}</li>
|
|
383
|
-
{{/each-in}}
|
|
384
|
-
</ul>
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
Outputting their name and age:
|
|
387
|
+
object in a list, outputting their name and age:
|
|
388
388
|
|
|
389
389
|
```html
|
|
390
390
|
<ul>
|
|
@@ -392,6 +392,8 @@ class RootComponentDefinition {
|
|
|
392
392
|
<li>age: 42</li>
|
|
393
393
|
</ul>
|
|
394
394
|
```
|
|
395
|
+
|
|
396
|
+
`#each-in` is a keyword and does not need to be imported.
|
|
395
397
|
|
|
396
398
|
@method each-in
|
|
397
399
|
@for Ember.Templates.helpers
|
|
@@ -861,73 +863,42 @@ const trackArray = internalHelper(({
|
|
|
861
863
|
*/
|
|
862
864
|
|
|
863
865
|
/**
|
|
864
|
-
The `mut` helper
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
866
|
+
The `mut` helper is a shortcut for updating for args.
|
|
867
|
+
|
|
868
|
+
However, defining update functions on your backing class is preferable to using `mut`.
|
|
869
|
+
|
|
870
|
+
More directly: Don't use `mut`.
|
|
868
871
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
or
|
|
874
|
-
|
|
875
|
-
```handlebars
|
|
876
|
-
{{my-child childClickCount=(mut totalClicks)}}
|
|
877
|
-
```
|
|
878
|
-
|
|
879
|
-
The child `Component` can then modify the parent's value just by modifying its own
|
|
880
|
-
property:
|
|
881
|
-
|
|
882
|
-
```javascript
|
|
883
|
-
// my-child.js
|
|
884
|
-
export default class MyChild extends Component {
|
|
885
|
-
click() {
|
|
886
|
-
this.incrementProperty('childClickCount');
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
Note that for curly components (`{{my-component}}`) the bindings are already mutable,
|
|
892
|
-
making the `mut` unnecessary.
|
|
893
|
-
|
|
894
|
-
Additionally, the `mut` helper can be combined with the `fn` helper to
|
|
895
|
-
mutate a value. For example:
|
|
896
|
-
|
|
897
|
-
```handlebars
|
|
898
|
-
<MyChild @childClickCount={{this.totalClicks}} @click-count-change={{fn (mut totalClicks))}} />
|
|
899
|
-
```
|
|
900
|
-
|
|
901
|
-
or
|
|
872
|
+
The `mut` helper, when used with `fn`, will return a function that
|
|
873
|
+
sets the value passed to `mut` to its first argument. As an example, we can create a
|
|
874
|
+
button that increments a value passing the value directly to the `fn`:
|
|
902
875
|
|
|
903
876
|
```handlebars
|
|
904
|
-
|
|
877
|
+
<MyChild @childClickCount={{this.totalClicks}} @clickCountChange={{fn (mut this.totalClicks)}} />
|
|
905
878
|
```
|
|
906
879
|
|
|
907
|
-
The child `Component` would invoke the function with the new click
|
|
880
|
+
The child `Component` would invoke the function with the new click count:
|
|
908
881
|
|
|
909
|
-
```
|
|
910
|
-
|
|
882
|
+
```app/components/my-child.gjs
|
|
883
|
+
import Component from '@glimmer/component';
|
|
884
|
+
import { action } from '@ember/object';
|
|
885
|
+
|
|
911
886
|
export default class MyChild extends Component {
|
|
912
|
-
|
|
913
|
-
|
|
887
|
+
@action
|
|
888
|
+
update() {
|
|
889
|
+
this.args.clickCountChange(this.args.childClickCount + 1);
|
|
914
890
|
}
|
|
891
|
+
|
|
892
|
+
<template>
|
|
893
|
+
<button {{on "click" this.update}}>
|
|
894
|
+
Click me!
|
|
895
|
+
</button>
|
|
896
|
+
</template>
|
|
915
897
|
}
|
|
916
898
|
```
|
|
917
899
|
|
|
918
900
|
The `mut` helper changes the `totalClicks` value to what was provided as the `fn` argument.
|
|
919
901
|
|
|
920
|
-
The `mut` helper, when used with `fn`, will return a function that
|
|
921
|
-
sets the value passed to `mut` to its first argument. As an example, we can create a
|
|
922
|
-
button that increments a value passing the value directly to the `fn`:
|
|
923
|
-
|
|
924
|
-
```handlebars
|
|
925
|
-
{{! inc helper is not provided by Ember }}
|
|
926
|
-
<button onclick={{fn (mut count) (inc count)}}>
|
|
927
|
-
Increment count
|
|
928
|
-
</button>
|
|
929
|
-
```
|
|
930
|
-
|
|
931
902
|
@method mut
|
|
932
903
|
@param {Object} [attr] the "two-way" attribute that can be modified.
|
|
933
904
|
@for Ember.Templates.helpers
|
|
@@ -962,6 +933,10 @@ const mut = internalHelper(({
|
|
|
962
933
|
/**
|
|
963
934
|
The `readonly` helper let's you specify that a binding is one-way only,
|
|
964
935
|
instead of two-way.
|
|
936
|
+
|
|
937
|
+
This is a vestigial helper from the days of `@ember/component` and does not apply to
|
|
938
|
+
components extending from `@glimmer/component`.
|
|
939
|
+
|
|
965
940
|
When you pass a `readonly` binding from an outer context (e.g. parent component),
|
|
966
941
|
to to an inner context (e.g. child component), you are saying that changing that
|
|
967
942
|
property in the inner context does not change the value in the outer context.
|
|
@@ -974,14 +949,6 @@ const mut = internalHelper(({
|
|
|
974
949
|
}
|
|
975
950
|
```
|
|
976
951
|
|
|
977
|
-
```app/templates/components/my-parent.hbs
|
|
978
|
-
{{log totalClicks}} // -> 3
|
|
979
|
-
<MyChild @childClickCount={{readonly totalClicks}} />
|
|
980
|
-
```
|
|
981
|
-
```
|
|
982
|
-
{{my-child childClickCount=(readonly totalClicks)}}
|
|
983
|
-
```
|
|
984
|
-
|
|
985
952
|
Now, when you update `childClickCount`:
|
|
986
953
|
|
|
987
954
|
```app/components/my-child.js
|
|
@@ -1265,15 +1232,14 @@ class MountDefinition {
|
|
|
1265
1232
|
|
|
1266
1233
|
For example, the following template mounts the `ember-chat` engine:
|
|
1267
1234
|
|
|
1268
|
-
```
|
|
1269
|
-
{{! application.hbs }}
|
|
1235
|
+
```app/templates/application.gjs
|
|
1270
1236
|
{{mount "ember-chat"}}
|
|
1271
1237
|
```
|
|
1272
1238
|
|
|
1273
1239
|
Additionally, you can also pass in a `model` argument that will be
|
|
1274
1240
|
set as the engines model. This can be an existing object:
|
|
1275
1241
|
|
|
1276
|
-
```
|
|
1242
|
+
```hbs
|
|
1277
1243
|
<div>
|
|
1278
1244
|
{{mount 'admin' model=userSettings}}
|
|
1279
1245
|
</div>
|
|
@@ -1281,15 +1247,20 @@ class MountDefinition {
|
|
|
1281
1247
|
|
|
1282
1248
|
Or an inline `hash`, and you can even pass components:
|
|
1283
1249
|
|
|
1250
|
+
```gjs
|
|
1251
|
+
import SignInButton from '../components/sign-in-button';
|
|
1252
|
+
<template>
|
|
1253
|
+
<div>
|
|
1254
|
+
<h1>Application template!</h1>
|
|
1255
|
+
{{mount 'admin' model=(hash
|
|
1256
|
+
title='Secret Admin'
|
|
1257
|
+
signInButton=SignInButton
|
|
1258
|
+
)}}
|
|
1259
|
+
</div>
|
|
1260
|
+
</template>
|
|
1284
1261
|
```
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
{{mount 'admin' model=(hash
|
|
1288
|
-
title='Secret Admin'
|
|
1289
|
-
signInButton=(component 'sign-in-button')
|
|
1290
|
-
)}}
|
|
1291
|
-
</div>
|
|
1292
|
-
```
|
|
1262
|
+
|
|
1263
|
+
`mount` is built-in and does not need to be imported.
|
|
1293
1264
|
|
|
1294
1265
|
@method mount
|
|
1295
1266
|
@param {String} name Name of the engine to mount.
|
|
@@ -1433,23 +1404,30 @@ function makeRouteTemplate(owner, name, template) {
|
|
|
1433
1404
|
/**
|
|
1434
1405
|
The `{{outlet}}` helper lets you specify where a child route will render in
|
|
1435
1406
|
your template. An important use of the `{{outlet}}` helper is in your
|
|
1436
|
-
application's `application.
|
|
1437
|
-
|
|
1438
|
-
```app/templates/application.
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1407
|
+
application's `application.gjs` file:
|
|
1408
|
+
|
|
1409
|
+
```app/templates/application.gjs
|
|
1410
|
+
import MyHeader from '../components/my-header';
|
|
1411
|
+
import MyFooter from '../components/my-footer';
|
|
1412
|
+
|
|
1413
|
+
<template>
|
|
1414
|
+
<MyHeader />
|
|
1415
|
+
|
|
1416
|
+
<div class="my-dynamic-content">
|
|
1417
|
+
<!-- this content will change based on the current route, which depends on the current URL -->
|
|
1418
|
+
{{outlet}}
|
|
1419
|
+
</div>
|
|
1420
|
+
|
|
1421
|
+
<MyFooter />
|
|
1422
|
+
</template>
|
|
1447
1423
|
```
|
|
1448
1424
|
|
|
1449
1425
|
See the [routing guide](https://guides.emberjs.com/release/routing/rendering-a-template/) for more
|
|
1450
1426
|
information on how your `route` interacts with the `{{outlet}}` helper.
|
|
1451
1427
|
Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
|
|
1452
1428
|
|
|
1429
|
+
`outlet` is built-in and does not need to be imported.
|
|
1430
|
+
|
|
1453
1431
|
@method outlet
|
|
1454
1432
|
@for Ember.Templates.helpers
|
|
1455
1433
|
@public
|
|
@@ -139,11 +139,7 @@ function addEventListener(element, eventName, callback, options) {
|
|
|
139
139
|
For example, if you'd like to run a function on your component when a `<button>`
|
|
140
140
|
in the components template is clicked you might do something like:
|
|
141
141
|
|
|
142
|
-
```app/components/like-post.
|
|
143
|
-
<button {{on 'click' this.saveLike}}>Like this post!</button>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
```app/components/like-post.js
|
|
142
|
+
```app/components/like-post.gjs
|
|
147
143
|
import Component from '@glimmer/component';
|
|
148
144
|
import { action } from '@ember/object';
|
|
149
145
|
|
|
@@ -152,6 +148,10 @@ function addEventListener(element, eventName, callback, options) {
|
|
|
152
148
|
// someone likes your post!
|
|
153
149
|
// better send a request off to your server...
|
|
154
150
|
}
|
|
151
|
+
|
|
152
|
+
<template>
|
|
153
|
+
<button {{on 'click' this.saveLike}}>Like this post!</button>
|
|
154
|
+
</template>
|
|
155
155
|
}
|
|
156
156
|
```
|
|
157
157
|
|
|
@@ -199,7 +199,7 @@ function addEventListener(element, eventName, callback, options) {
|
|
|
199
199
|
properly bound to the `items-list`, but let's explore what happens if we
|
|
200
200
|
left out the arrow function:
|
|
201
201
|
|
|
202
|
-
```app/components/like-post.
|
|
202
|
+
```app/components/like-post.gjs
|
|
203
203
|
import Component from '@glimmer/component';
|
|
204
204
|
|
|
205
205
|
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-BoPB2LfI.js';
|
|
3
|
-
import { i as internalHelper } from './hash-
|
|
3
|
+
import { i as internalHelper } from './hash-BTwOuDGQ.js';
|
|
4
4
|
|
|
5
5
|
const and = internalHelper(({
|
|
6
6
|
positional
|
package/dist/dev/packages/shared-chunks/{setup-registry-BC5VMvei.js → setup-registry-BQZJfq-Y.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { privatize } from '../@ember/-internals/container/index.js';
|
|
2
2
|
import { getOwner } from '../@ember/-internals/owner/index.js';
|
|
3
3
|
import '../@ember/debug/index.js';
|
|
4
|
-
import { I as Input, T as Textarea } from './textarea-
|
|
4
|
+
import { I as Input, T as Textarea } from './textarea-lD4apgrP.js';
|
|
5
5
|
import { LinkTo } from '../@ember/routing/index.js';
|
|
6
6
|
import './render-CpKaO-BO.js';
|
|
7
7
|
import { c as clientBuilder } from './element-builder--iTIJyCB.js';
|
|
8
8
|
import { r as rehydrationBuilder } from './rehydrate-builder-DCyIgnCR.js';
|
|
9
9
|
import { s as serializeBuilder } from './serialize-builder-DxgGRvH_.js';
|
|
10
|
-
import { o as outletHelper, O as OutletView, R as Renderer } from './index-
|
|
10
|
+
import { o as outletHelper, O as OutletView, R as Renderer } from './index-CL1zjHwo.js';
|
|
11
11
|
import { t as templateFactory } from './index-CyZiGiEI.js';
|
|
12
12
|
import { assert } from '../@ember/debug/lib/assert.js';
|
|
13
13
|
|
|
@@ -232,8 +232,12 @@ if (hasDOM) {
|
|
|
232
232
|
/**
|
|
233
233
|
The `Input` component lets you create an HTML `<input>` element.
|
|
234
234
|
|
|
235
|
-
```
|
|
236
|
-
|
|
235
|
+
```gjs
|
|
236
|
+
import { Input } from '@ember/component';
|
|
237
|
+
|
|
238
|
+
<template>
|
|
239
|
+
<Input @value="987" />
|
|
240
|
+
</template>
|
|
237
241
|
```
|
|
238
242
|
|
|
239
243
|
creates an `<input>` element with `type="text"` and value set to 987.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export { t as template, a as templateCacheCounters } from '../../../shared-chunks/index-Bj71BDDA.js';
|
|
2
|
-
export { R as RootTemplate, s as setupApplicationRegistry, a as setupEngineRegistry } from '../../../shared-chunks/setup-registry-
|
|
3
|
-
export { I as Input, T as Textarea } from '../../../shared-chunks/textarea-
|
|
2
|
+
export { R as RootTemplate, s as setupApplicationRegistry, a as setupEngineRegistry } from '../../../shared-chunks/setup-registry-B3DhqtxX.js';
|
|
3
|
+
export { I as Input, T as Textarea } from '../../../shared-chunks/textarea-Byj32raR.js';
|
|
4
4
|
export { LinkTo } from '../../routing/index.js';
|
|
5
5
|
export { default as Component, setComponentManager } from '../../component/index.js';
|
|
6
|
-
export { H as Helper, h as helper } from '../../../shared-chunks/helper-
|
|
6
|
+
export { H as Helper, h as helper } from '../../../shared-chunks/helper-CN6UzshW.js';
|
|
7
7
|
export { S as SafeString, T as TrustedHTML, h as htmlSafe, i as isHTMLSafe, a as isTrustedHTML, t as trustHTML } from '../../../shared-chunks/index-D-xTBV4B.js';
|
|
8
|
-
export { O as OutletView, R as Renderer, _ as _resetRenderers, a as renderComponent, r as renderSettled } from '../../../shared-chunks/index-
|
|
8
|
+
export { O as OutletView, R as Renderer, _ as _resetRenderers, a as renderComponent, r as renderSettled } from '../../../shared-chunks/index-ClxHbCe9.js';
|
|
9
9
|
export { D as DOMChanges } from '../../../shared-chunks/render-DkJJmoI4.js';
|
|
10
10
|
export { D as DOMTreeConstruction } from '../../../shared-chunks/element-builder-CnlTPNyw.js';
|
|
11
11
|
export { i as isSerializationFirstNode } from '../../../shared-chunks/rehydrate-builder-DJ8k-6fg.js';
|
|
12
12
|
export { NodeDOMTreeConstruction } from '../../../@glimmer/node/index.js';
|
|
13
|
-
export { e as element } from '../../../shared-chunks/element-
|
|
13
|
+
export { e as element } from '../../../shared-chunks/element-9DRa_9dO.js';
|
|
14
14
|
export { u as uniqueId } from '../../../shared-chunks/unique-id-CfHImDRV.js';
|
|
15
15
|
export { c as componentCapabilities, m as modifierCapabilities } from '../../../shared-chunks/api-CM1trl_4.js';
|
|
16
16
|
|
|
@@ -10,7 +10,7 @@ import Mixin from '../../../../object/mixin.js';
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
`TargetActionSupport` is a mixin that can be included in a class
|
|
13
|
-
to add a `triggerAction` method with semantics similar to the
|
|
13
|
+
to add a `triggerAction` method with semantics similar to the
|
|
14
14
|
`{{action}}` helper. In normal Ember usage, the `{{action}}` helper is
|
|
15
15
|
usually the best choice. This mixin is most often useful when you are
|
|
16
16
|
doing more complex event handling in Components.
|
|
@@ -24,7 +24,7 @@ import BucketCache from '../routing/lib/cache.js';
|
|
|
24
24
|
import ApplicationInstance from './instance.js';
|
|
25
25
|
import Engine, { buildInitializerMethod } from '../engine/index.js';
|
|
26
26
|
import { privatize } from '../-internals/container/index.js';
|
|
27
|
-
import { s as setupApplicationRegistry } from '../../shared-chunks/setup-registry-
|
|
27
|
+
import { s as setupApplicationRegistry } from '../../shared-chunks/setup-registry-B3DhqtxX.js';
|
|
28
28
|
import RouterService from '../routing/router-service.js';
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -2,7 +2,7 @@ import { g as get } from '../../shared-chunks/property_get-CAFdpRyu.js';
|
|
|
2
2
|
import { s as set } from '../../shared-chunks/property_set-BunbMFtp.js';
|
|
3
3
|
import { e as environment } from '../../shared-chunks/index-Cc8WmrB-.js';
|
|
4
4
|
import EngineInstance from '../engine/instance.js';
|
|
5
|
-
import { r as renderSettled } from '../../shared-chunks/index-
|
|
5
|
+
import { r as renderSettled } from '../../shared-chunks/index-ClxHbCe9.js';
|
|
6
6
|
import '../routing/router.js';
|
|
7
7
|
import '../object/index.js';
|
|
8
8
|
import '../../shared-chunks/guid-Cbq2sNV_.js';
|
|
@@ -494,6 +494,10 @@ const MutableArray = Mixin.create(EmberArray, MutableEnumerable, {
|
|
|
494
494
|
/**
|
|
495
495
|
Creates an `NativeArray` from an Array-like object.
|
|
496
496
|
Does not modify the original object's contents.
|
|
497
|
+
|
|
498
|
+
This exists primarily for historic reasons and should not be used
|
|
499
|
+
in new code. Prefer native [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
|
|
500
|
+
or [trackedArray](/ember/release/functions/@ember%2Freactive%2Fcollections/trackedArray).
|
|
497
501
|
|
|
498
502
|
Example
|
|
499
503
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { H as default, h as helper } from '../../shared-chunks/helper-
|
|
1
|
+
export { H as default, h as helper } from '../../shared-chunks/helper-CN6UzshW.js';
|
|
@@ -16,7 +16,7 @@ import { p as createTag, D as DIRTY_TAG$1 } from '../../shared-chunks/cache-BIlO
|
|
|
16
16
|
import { I as IS_DISPATCHING_ATTRS, D as DIRTY_TAG, B as BOUNDS, g as getComponentCapturedArgs, C as CURLY_COMPONENT_MANAGER } from '../../shared-chunks/curly-ZzX43b50.js';
|
|
17
17
|
import { h as hasDOM } from '../../shared-chunks/has-dom-DdQORPzI.js';
|
|
18
18
|
import { a as decorateMethodV2 } from '../../shared-chunks/runtime-CYyqkz5q-BOdRhmsS.js';
|
|
19
|
-
export { I as Input, T as Textarea } from '../../shared-chunks/textarea-
|
|
19
|
+
export { I as Input, T as Textarea } from '../../shared-chunks/textarea-Byj32raR.js';
|
|
20
20
|
import { s as setComponentManager$1 } from '../../shared-chunks/api-CM1trl_4.js';
|
|
21
21
|
export { c as capabilities } from '../../shared-chunks/api-CM1trl_4.js';
|
|
22
22
|
import '../../shared-chunks/capabilities-_5e35539.js';
|
|
@@ -55,6 +55,12 @@ const EMPTY_ARRAY = Object.freeze([]);
|
|
|
55
55
|
API documentation for Template-only or Glimmer components, it is [available
|
|
56
56
|
here](/ember/release/modules/@glimmer%2Fcomponent).
|
|
57
57
|
|
|
58
|
+
Note: Prior to Ember 6.8, by default, components were authored in paired `.hbs` and `.js`
|
|
59
|
+
files. This is still supported, but the default authoring format is now `.gjs` or "template tag".
|
|
60
|
+
The documentation for `@ember/component` still refers to the older authoring format. To read about
|
|
61
|
+
the new authoring format, see the
|
|
62
|
+
[Glimmer Component API documentation](/ember/release/modules/@glimmer%2Fcomponent).
|
|
63
|
+
|
|
58
64
|
## Defining a Classic Component
|
|
59
65
|
|
|
60
66
|
If you want to customize the component in order to handle events, transform
|
|
@@ -81,7 +87,7 @@ const EMPTY_ARRAY = Object.freeze([]);
|
|
|
81
87
|
|
|
82
88
|
And then use it in the component's template:
|
|
83
89
|
|
|
84
|
-
```app/
|
|
90
|
+
```app/components/person-profile.hbs
|
|
85
91
|
<h1>{{this.displayName}}</h1>
|
|
86
92
|
{{yield}}
|
|
87
93
|
```
|
|
@@ -469,7 +475,7 @@ const EMPTY_ARRAY = Object.freeze([]);
|
|
|
469
475
|
The `layout` property should be set to the default export of a template
|
|
470
476
|
module, which is the name of a template file without the `.hbs` extension.
|
|
471
477
|
|
|
472
|
-
```app/
|
|
478
|
+
```app/components/person-profile.hbs
|
|
473
479
|
<h1>Person's Title</h1>
|
|
474
480
|
<div class='details'>{{yield}}</div>
|
|
475
481
|
```
|
|
@@ -11,7 +11,7 @@ import '../../route-recognizer/index.js';
|
|
|
11
11
|
import '../../shared-chunks/rsvp-CnCSY930.js';
|
|
12
12
|
import '../../shared-chunks/unrecognized-url-error-DDBwfzdm.js';
|
|
13
13
|
import RoutingService from '../routing/lib/routing-service.js';
|
|
14
|
-
import { a as setupEngineRegistry } from '../../shared-chunks/setup-registry-
|
|
14
|
+
import { a as setupEngineRegistry } from '../../shared-chunks/setup-registry-B3DhqtxX.js';
|
|
15
15
|
import RegistryProxyMixin from '../-internals/runtime/lib/mixins/registry_proxy.js';
|
|
16
16
|
|
|
17
17
|
function props(obj) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { b as setHelperManager$1 } from '../../shared-chunks/api-CM1trl_4.js';
|
|
2
2
|
import { i as helperCapabilities } from '../../shared-chunks/api-zh_k31vb.js';
|
|
3
3
|
import { i as invokeHelper$1 } from '../../shared-chunks/invoke-Cj5zMqHz.js';
|
|
4
|
-
import { a as array$1, f as fn$1, h as hash$1 } from '../../shared-chunks/hash-
|
|
5
|
-
import { c as concat$1, g as get$1 } from '../../shared-chunks/get-
|
|
6
|
-
import { a as and$1, e as eq$1, g as gt$1, b as gte$1, l as lt$1, c as lte$1, n as neq$1, d as not$1, o as or$1 } from '../../shared-chunks/or-
|
|
7
|
-
import { e as element$1 } from '../../shared-chunks/element-
|
|
4
|
+
import { a as array$1, f as fn$1, h as hash$1 } from '../../shared-chunks/hash-Dkj3I4L4.js';
|
|
5
|
+
import { c as concat$1, g as get$1 } from '../../shared-chunks/get-Dt5L0TcU.js';
|
|
6
|
+
import { a as and$1, e as eq$1, g as gt$1, b as gte$1, l as lt$1, c as lte$1, n as neq$1, d as not$1, o as or$1 } from '../../shared-chunks/or-Crsa2wci.js';
|
|
7
|
+
import { e as element$1 } from '../../shared-chunks/element-9DRa_9dO.js';
|
|
8
8
|
import { u as uniqueId$1 } from '../../shared-chunks/unique-id-CfHImDRV.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -336,18 +336,12 @@ const invokeHelper = invokeHelper$1;
|
|
|
336
336
|
* as an argument to your components.
|
|
337
337
|
*
|
|
338
338
|
* ```
|
|
339
|
-
* import { hash } from '@ember/helper';
|
|
340
|
-
*
|
|
341
339
|
* <template>
|
|
342
340
|
* {{#each-in (hash givenName='Jen' familyName='Weber') as |key value|}}
|
|
343
341
|
* <p>{{key}}: {{value}}</p>
|
|
344
342
|
* {{/each-in}}
|
|
345
343
|
* </template>
|
|
346
344
|
* ```
|
|
347
|
-
*
|
|
348
|
-
* **NOTE:** this example uses the experimental `<template>` feature, which is
|
|
349
|
-
* the only place you need to import `hash` to use it (it is a built-in when
|
|
350
|
-
* writing standalone `.hbs` files).
|
|
351
345
|
*/
|
|
352
346
|
const hash = hash$1;
|
|
353
347
|
/**
|
|
@@ -355,7 +349,6 @@ const hash = hash$1;
|
|
|
355
349
|
* as an argument to your components.
|
|
356
350
|
*
|
|
357
351
|
* ```js
|
|
358
|
-
* import { array } from '@ember/helper';
|
|
359
352
|
*
|
|
360
353
|
* <template>
|
|
361
354
|
* <ul>
|
|
@@ -364,10 +357,6 @@ const hash = hash$1;
|
|
|
364
357
|
* {{/each}}
|
|
365
358
|
* </ul>
|
|
366
359
|
* </template>
|
|
367
|
-
*
|
|
368
|
-
* **NOTE:** this example uses the experimental `<template>` feature, which is
|
|
369
|
-
* the only place you need to import `array` to use it (it is a built-in when
|
|
370
|
-
* writing standalone `.hbs` files).
|
|
371
360
|
* ```
|
|
372
361
|
*/
|
|
373
362
|
const array = array$1;
|
|
@@ -388,10 +377,6 @@ const array = array$1;
|
|
|
388
377
|
*
|
|
389
378
|
* This will display the result of `@foo.item1` when `index` is `1`, and
|
|
390
379
|
* `this.foo.item2` when `index` is `2`, etc.
|
|
391
|
-
*
|
|
392
|
-
* **NOTE:** this example uses the experimental `<template>` feature, which is
|
|
393
|
-
* the only place you need to import `concat` to use it (it is a built-in when
|
|
394
|
-
* writing standalone `.hbs` files).
|
|
395
380
|
*/
|
|
396
381
|
const concat = concat$1;
|
|
397
382
|
/**
|
|
@@ -431,10 +416,6 @@ const concat = concat$1;
|
|
|
431
416
|
*
|
|
432
417
|
* This will display the result of `@foo.item1` when `index` is `1`, and
|
|
433
418
|
* `this.foo.item2` when `index` is `2`, etc.
|
|
434
|
-
*
|
|
435
|
-
* **NOTE:** this example uses the experimental `<template>` feature, which is
|
|
436
|
-
* the only place you need to import `concat` to use it (it is a built-in when
|
|
437
|
-
* writing standalone `.hbs` files).
|
|
438
419
|
*/
|
|
439
420
|
const get = get$1;
|
|
440
421
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as on$1 } from '../../shared-chunks/on-
|
|
1
|
+
import { o as on$1 } from '../../shared-chunks/on-CWgOWNSL.js';
|
|
2
2
|
|
|
3
3
|
// In normal TypeScript, this modifier is essentially an opaque token that just
|
|
4
4
|
// needs to be importable. Declaring it with a unique interface like this,
|