ember-source 5.6.0-alpha.6 → 5.6.0-beta.2

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 (64) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/ember-template-compiler.js +33 -2
  3. package/dist/ember-template-compiler.map +1 -1
  4. package/dist/ember-testing.js +2 -2
  5. package/dist/ember-testing.map +1 -1
  6. package/dist/ember.debug.js +117 -39
  7. package/dist/ember.debug.map +1 -1
  8. package/dist/header/license.js +1 -1
  9. package/dist/packages/@ember/-internals/container/index.js +0 -1
  10. package/dist/packages/@ember/-internals/glimmer/index.js +88 -29
  11. package/dist/packages/@ember/-internals/meta/lib/meta.js +14 -10
  12. package/dist/packages/@ember/test/adapter.js +1 -2
  13. package/dist/packages/@ember/test/index.js +1 -1
  14. package/dist/packages/ember/version.js +1 -1
  15. package/dist/packages/ember-testing/index.js +2 -2
  16. package/docs/data.json +17 -17
  17. package/lib/index.js +12 -0
  18. package/package.json +6 -5
  19. package/types/publish.mjs +2 -16
  20. package/types/stable/@ember/-internals/container/index.d.ts +1 -1
  21. package/types/stable/@ember/-internals/glimmer/index.d.ts +3 -3
  22. package/types/stable/@ember/-internals/glimmer/lib/glimmer-component-docs.d.ts +388 -1
  23. package/types/stable/@ember/-internals/glimmer/lib/glimmer-tracking-docs.d.ts +245 -1
  24. package/types/stable/@ember/-internals/glimmer/lib/helpers/array.d.ts +41 -1
  25. package/types/stable/@ember/-internals/glimmer/lib/helpers/component.d.ts +149 -1
  26. package/types/stable/@ember/-internals/glimmer/lib/helpers/concat.d.ts +28 -1
  27. package/types/stable/@ember/-internals/glimmer/lib/helpers/fn.d.ts +73 -1
  28. package/types/stable/@ember/-internals/glimmer/lib/helpers/get.d.ts +100 -1
  29. package/types/stable/@ember/-internals/glimmer/lib/helpers/hash.d.ts +44 -1
  30. package/types/stable/@ember/-internals/glimmer/lib/helpers/helper.d.ts +43 -1
  31. package/types/stable/@ember/-internals/glimmer/lib/helpers/if-unless.d.ts +182 -1
  32. package/types/stable/@ember/-internals/glimmer/lib/helpers/log.d.ts +19 -1
  33. package/types/stable/@ember/-internals/glimmer/lib/helpers/modifier.d.ts +42 -1
  34. package/types/stable/@ember/-internals/glimmer/lib/helpers/page-title.d.ts +20 -1
  35. package/types/stable/@ember/-internals/glimmer/lib/modifiers/on.d.ts +95 -1
  36. package/types/stable/@ember/-internals/glimmer/lib/syntax/in-element.d.ts +47 -1
  37. package/types/stable/@ember/-internals/glimmer/lib/syntax/let.d.ts +55 -1
  38. package/types/stable/@ember/-internals/glimmer/lib/templates/empty.d.ts +2 -3
  39. package/types/stable/@ember/-internals/glimmer/lib/templates/input.d.ts +2 -3
  40. package/types/stable/@ember/-internals/glimmer/lib/templates/link-to.d.ts +2 -3
  41. package/types/stable/@ember/-internals/glimmer/lib/templates/outlet.d.ts +2 -3
  42. package/types/stable/@ember/-internals/glimmer/lib/templates/root.d.ts +2 -3
  43. package/types/stable/@ember/-internals/glimmer/lib/templates/textarea.d.ts +2 -3
  44. package/types/stable/@ember/-internals/meta/index.d.ts +1 -1
  45. package/types/stable/@ember/-internals/metal/index.d.ts +10 -10
  46. package/types/stable/@ember/-internals/metal/lib/dependent_keys.d.ts +3 -1
  47. package/types/stable/@ember/debug/index.d.ts +1 -1
  48. package/types/stable/@ember/owner/index.d.ts +9 -9
  49. package/types/stable/@ember/routing/-internals.d.ts +4 -4
  50. package/types/stable/@ember/routing/lib/route-info.d.ts +1 -1
  51. package/types/stable/@ember/routing/router-service.d.ts +2 -2
  52. package/types/stable/@ember/runloop/-private/backburner.d.ts +2 -2
  53. package/types/stable/@ember/runloop/index.d.ts +2 -2
  54. package/types/stable/@ember/template-compilation/index.d.ts +8 -12
  55. package/types/stable/@ember/test/adapter.d.ts +1 -2
  56. package/types/stable/@ember/test/index.d.ts +1 -1
  57. package/types/stable/ember/version.d.ts +2 -2
  58. package/types/stable/ember-template-compiler/lib/public-api.d.ts +1 -1
  59. package/types/stable/ember-template-compiler/minimal.d.ts +5 -0
  60. package/types/stable/index.d.ts +1 -0
  61. /package/blueprints/component-addon/files/__root__/__path__/{__name__.ts → __name__.js} +0 -0
  62. /package/blueprints/component-class-addon/files/__root__/__path__/{__name__.ts → __name__.js} +0 -0
  63. /package/blueprints/helper-addon/files/__root__/__path__/{__name__.ts → __name__.js} +0 -0
  64. /package/blueprints/route-addon/files/__root__/__path__/{__name__.ts → __name__.js} +0 -0
@@ -1 +1,149 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/component' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/component' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ The `{{component}}` helper lets you add instances of `Component` to a
7
+ template. See [Component](/ember/release/classes/Component) for
8
+ additional information on how a `Component` functions.
9
+ `{{component}}`'s primary use is for cases where you want to dynamically
10
+ change which type of component is rendered as the state of your application
11
+ changes. This helper has three modes: inline, block, and nested.
12
+
13
+ ### Inline Form
14
+
15
+ Given the following template:
16
+
17
+ ```app/application.hbs
18
+ {{component this.infographicComponentName}}
19
+ ```
20
+
21
+ And the following application code:
22
+
23
+ ```app/controllers/application.js
24
+ import Controller from '@ember/controller';
25
+ import { tracked } from '@glimmer/tracking';
26
+
27
+ export default class ApplicationController extends Controller {
28
+ @tracked isMarketOpen = 'live-updating-chart'
29
+
30
+ get infographicComponentName() {
31
+ return this.isMarketOpen ? 'live-updating-chart' : 'market-close-summary';
32
+ }
33
+ }
34
+ ```
35
+
36
+ The `live-updating-chart` component will be appended when `isMarketOpen` is
37
+ `true`, and the `market-close-summary` component will be appended when
38
+ `isMarketOpen` is `false`. If the value changes while the app is running,
39
+ the component will be automatically swapped out accordingly.
40
+ Note: You should not use this helper when you are consistently rendering the same
41
+ component. In that case, use standard component syntax, for example:
42
+
43
+ ```app/templates/application.hbs
44
+ <LiveUpdatingChart />
45
+ ```
46
+
47
+ or
48
+
49
+ ```app/templates/application.hbs
50
+ {{live-updating-chart}}
51
+ ```
52
+
53
+ ### Block Form
54
+
55
+ Using the block form of this helper is similar to using the block form
56
+ of a component. Given the following application template:
57
+
58
+ ```app/templates/application.hbs
59
+ {{#component this.infographicComponentName}}
60
+ Last update: {{this.lastUpdateTimestamp}}
61
+ {{/component}}
62
+ ```
63
+
64
+ The following controller code:
65
+
66
+ ```app/controllers/application.js
67
+ import Controller from '@ember/controller';
68
+ import { computed } from '@ember/object';
69
+ import { tracked } from '@glimmer/tracking';
70
+
71
+ export default class ApplicationController extends Controller {
72
+ @tracked isMarketOpen = 'live-updating-chart'
73
+
74
+ get lastUpdateTimestamp() {
75
+ return new Date();
76
+ }
77
+
78
+ get infographicComponentName() {
79
+ return this.isMarketOpen ? 'live-updating-chart' : 'market-close-summary';
80
+ }
81
+ }
82
+ ```
83
+
84
+ And the following component template:
85
+
86
+ ```app/templates/components/live-updating-chart.hbs
87
+ {{! chart }}
88
+ {{yield}}
89
+ ```
90
+
91
+ The `Last Update: {{this.lastUpdateTimestamp}}` will be rendered in place of the `{{yield}}`.
92
+
93
+ ### Nested Usage
94
+
95
+ The `component` helper can be used to package a component path with initial attrs.
96
+ The included attrs can then be merged during the final invocation.
97
+ For example, given a `person-form` component with the following template:
98
+
99
+ ```app/templates/components/person-form.hbs
100
+ {{yield (hash
101
+ nameInput=(component "my-input-component" value=@model.name placeholder="First Name")
102
+ )}}
103
+ ```
104
+
105
+ When yielding the component via the `hash` helper, the component is invoked directly.
106
+ See the following snippet:
107
+
108
+ ```
109
+ <PersonForm as |form|>
110
+ <form.nameInput @placeholder="Username" />
111
+ </PersonForm>
112
+ ```
113
+
114
+ or
115
+ ```
116
+ {{#person-form as |form|}}
117
+ {{form.nameInput placeholder="Username"}}
118
+ {{/person-form}}
119
+ ```
120
+
121
+ Which outputs an input whose value is already bound to `model.name` and `placeholder`
122
+ is "Username".
123
+
124
+ When yielding the component without the `hash` helper use the `component` helper.
125
+ For example, below is a `full-name` component template:
126
+
127
+ ```handlebars
128
+ {{yield (component "my-input-component" value=@model.name placeholder="Name")}}
129
+ ```
130
+
131
+ ```
132
+ <FullName as |field|>
133
+ {{component field placeholder="Full name"}}
134
+ </FullName>
135
+ ```
136
+ or
137
+ ```
138
+ {{#full-name as |field|}}
139
+ {{component field placeholder="Full name"}}
140
+ {{/full-name}}
141
+ ```
142
+
143
+ @method component
144
+ @since 1.11.0
145
+ @for Ember.Templates.helpers
146
+ @public
147
+ */
148
+ export {};
149
+ }
@@ -1 +1,28 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/concat' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/concat' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ Concatenates the given arguments into a string.
7
+
8
+ Example:
9
+
10
+ ```handlebars
11
+ {{some-component name=(concat firstName " " lastName)}}
12
+
13
+ {{! would pass name="<first name value> <last name value>" to the component}}
14
+ ```
15
+
16
+ or for angle bracket invocation, you actually don't need concat at all.
17
+
18
+ ```handlebars
19
+ <SomeComponent @name="{{firstName}} {{lastName}}" />
20
+ ```
21
+
22
+ @public
23
+ @method concat
24
+ @for @ember/helper
25
+ @since 1.13.0
26
+ */
27
+ export {};
28
+ }
@@ -1 +1,73 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/fn' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/fn' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ The `fn` helper allows you to ensure a function that you are passing off
7
+ to another component, helper, or modifier has access to arguments that are
8
+ available in the template.
9
+
10
+ For example, if you have an `each` helper looping over a number of items, you
11
+ may need to pass a function that expects to receive the item as an argument
12
+ to a component invoked within the loop. Here's how you could use the `fn`
13
+ helper to pass both the function and its arguments together:
14
+
15
+ ```app/templates/components/items-listing.hbs
16
+ {{#each @items as |item|}}
17
+ <DisplayItem @item=item @select={{fn this.handleSelected item}} />
18
+ {{/each}}
19
+ ```
20
+
21
+ ```app/components/items-list.js
22
+ import Component from '@glimmer/component';
23
+ import { action } from '@ember/object';
24
+
25
+ export default class ItemsList extends Component {
26
+ @action
27
+ handleSelected(item) {
28
+ // ...snip...
29
+ }
30
+ }
31
+ ```
32
+
33
+ In this case the `display-item` component will receive a normal function
34
+ that it can invoke. When it invokes the function, the `handleSelected`
35
+ function will receive the `item` and any arguments passed, thanks to the
36
+ `fn` helper.
37
+
38
+ Let's take look at what that means in a couple circumstances:
39
+
40
+ - When invoked as `this.args.select()` the `handleSelected` function will
41
+ receive the `item` from the loop as its first and only argument.
42
+ - When invoked as `this.args.select('foo')` the `handleSelected` function
43
+ will receive the `item` from the loop as its first argument and the
44
+ string `'foo'` as its second argument.
45
+
46
+ In the example above, we used `@action` to ensure that `handleSelected` is
47
+ properly bound to the `items-list`, but let's explore what happens if we
48
+ left out `@action`:
49
+
50
+ ```app/components/items-list.js
51
+ import Component from '@glimmer/component';
52
+
53
+ export default class ItemsList extends Component {
54
+ handleSelected(item) {
55
+ // ...snip...
56
+ }
57
+ }
58
+ ```
59
+
60
+ In this example, when `handleSelected` is invoked inside the `display-item`
61
+ component, it will **not** have access to the component instance. In other
62
+ words, it will have no `this` context, so please make sure your functions
63
+ are bound (via `@action` or other means) before passing into `fn`!
64
+
65
+ See also [partial application](https://en.wikipedia.org/wiki/Partial_application).
66
+
67
+ @method fn
68
+ @for @ember/helper
69
+ @public
70
+ @since 3.11.0
71
+ */
72
+ export {};
73
+ }
@@ -1 +1,100 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/get' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/get' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ Dynamically look up a property on an object or an element in an array.
7
+ The second argument to `{{get}}` should have a string or number value,
8
+ although it can be bound.
9
+
10
+ For example, these two usages are equivalent:
11
+
12
+ ```app/components/developer-detail.js
13
+ import Component from '@glimmer/component';
14
+ import { tracked } from '@glimmer/tracking';
15
+
16
+ export default class extends Component {
17
+ @tracked developer = {
18
+ name: "Sandi Metz",
19
+ language: "Ruby"
20
+ }
21
+ }
22
+ ```
23
+
24
+ ```handlebars
25
+ {{this.developer.name}}
26
+ {{get this.developer "name"}}
27
+ ```
28
+
29
+ If there were several facts about a person, the `{{get}}` helper can dynamically
30
+ pick one:
31
+
32
+ ```app/templates/application.hbs
33
+ <DeveloperDetail @factName="language" />
34
+ ```
35
+
36
+ ```handlebars
37
+ {{get this.developer @factName}}
38
+ ```
39
+
40
+ For a more complex example, this template would allow the user to switch
41
+ between showing the user's name and preferred coding language with a click:
42
+
43
+ ```app/components/developer-detail.js
44
+ import Component from '@glimmer/component';
45
+ import { tracked } from '@glimmer/tracking';
46
+
47
+ export default class extends Component {
48
+ @tracked developer = {
49
+ name: "Sandi Metz",
50
+ language: "Ruby"
51
+ }
52
+
53
+ @tracked currentFact = 'name'
54
+
55
+ @action
56
+ showFact(fact) {
57
+ this.currentFact = fact;
58
+ }
59
+ }
60
+ ```
61
+
62
+ ```app/components/developer-detail.js
63
+ {{get this.developer this.currentFact}}
64
+
65
+ <button {{on 'click' (fn this.showFact "name")}}>Show name</button>
66
+ <button {{on 'click' (fn this.showFact "language")}}>Show language</button>
67
+ ```
68
+
69
+ The `{{get}}` helper can also respect mutable values itself. For example:
70
+
71
+ ```app/components/developer-detail.js
72
+ <Input @value={{mut (get this.person this.currentFact)}} />
73
+
74
+ <button {{on 'click' (fn this.showFact "name")}}>Show name</button>
75
+ <button {{on 'click' (fn this.showFact "language")}}>Show language</button>
76
+ ```
77
+
78
+ Would allow the user to swap what fact is being displayed, and also edit
79
+ that fact via a two-way mutable binding.
80
+
81
+ The `{{get}}` helper can also be used for array element access via index.
82
+ This would display the value of the first element in the array `this.names`:
83
+
84
+ ```handlebars
85
+ {{get this.names 0}}
86
+ ```
87
+
88
+ Array element access also works with a dynamic second argument:
89
+
90
+ ```handlebars
91
+ {{get this.names @index}}
92
+ ```
93
+
94
+ @public
95
+ @method get
96
+ @for @ember/helper
97
+ @since 2.1.0
98
+ */
99
+ export {};
100
+ }
@@ -1 +1,44 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/hash' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/hash' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ Use the `{{hash}}` helper to create a hash to pass as an option to your
7
+ components. This is specially useful for contextual components where you can
8
+ just yield a hash:
9
+
10
+ ```handlebars
11
+ {{yield (hash
12
+ name='Sarah'
13
+ title=office
14
+ )}}
15
+ ```
16
+
17
+ Would result in an object such as:
18
+
19
+ ```js
20
+ { name: 'Sarah', title: this.get('office') }
21
+ ```
22
+
23
+ Where the `title` is bound to updates of the `office` property.
24
+
25
+ Note that the hash is an empty object with no prototype chain, therefore
26
+ common methods like `toString` are not available in the resulting hash.
27
+ If you need to use such a method, you can use the `call` or `apply`
28
+ approach:
29
+
30
+ ```js
31
+ function toString(obj) {
32
+ return Object.prototype.toString.apply(obj);
33
+ }
34
+ ```
35
+
36
+ @method hash
37
+ @for @ember/helper
38
+ @param {Object} options
39
+ @return {Object} Hash
40
+ @since 2.3.0
41
+ @public
42
+ */
43
+ export {};
44
+ }
@@ -1 +1,43 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/helper' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/helper' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ Use the `{{helper}}` helper to create contextual helper so
7
+ that it can be passed around as first-class values in templates.
8
+
9
+ ```handlebars
10
+ {{#let (helper "join-words" "foo" "bar" separator=" ") as |foo-bar|}}
11
+
12
+ {{!-- this is equivalent to invoking `{{join-words "foo" "bar" separator=" "}}` --}}
13
+ {{foo-bar}}
14
+
15
+ {{!-- this will pass the helper itself into the component, instead of invoking it now --}}
16
+ <MyComponent @helper={{helper foo-bar "baz"}} />
17
+
18
+ {{!-- this will yield the helper itself ("contextual helper"), instead of invoking it now --}}
19
+ {{yield foo-bar}}
20
+ {{/let}}
21
+ ```
22
+
23
+ ### Arguments
24
+
25
+ The `{{helper}}` helper works similarly to the [`{{component}}`](./component?anchor=component) and
26
+ [`{{modifier}}`](./modifier?anchor=modifier) helper:
27
+
28
+ * When passed a string (e.g. `(helper "foo")`) as the first argument,
29
+ it will produce an opaque, internal "helper definition" object
30
+ that can be passed around and invoked elsewhere.
31
+
32
+ * Any additional positional and/or named arguments (a.k.a. params and hash)
33
+ will be stored ("curried") inside the definition object, such that, when invoked,
34
+ these arguments will be passed along to the referenced helper.
35
+
36
+
37
+ @method helper
38
+ @for Ember.Templates.helpers
39
+ @public
40
+ @since 3.27.0
41
+ */
42
+ export {};
43
+ }
@@ -1 +1,182 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/if-unless' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/if-unless' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ The `if` helper allows you to conditionally render one of two branches,
7
+ depending on the "truthiness" of a property.
8
+ For example the following values are all falsey: `false`, `undefined`, `null`, `""`, `0`, `NaN` or an empty array.
9
+
10
+ This helper has two forms, block and inline.
11
+
12
+ ## Block form
13
+
14
+ You can use the block form of `if` to conditionally render a section of the template.
15
+
16
+ To use it, pass the conditional value to the `if` helper,
17
+ using the block form to wrap the section of template you want to conditionally render.
18
+ Like so:
19
+
20
+ ```app/templates/application.hbs
21
+ <Weather />
22
+ ```
23
+
24
+ ```app/components/weather.hbs
25
+ {{! will not render because greeting is undefined}}
26
+ {{#if @isRaining}}
27
+ Yes, grab an umbrella!
28
+ {{/if}}
29
+ ```
30
+
31
+ You can also define what to show if the property is falsey by using
32
+ the `else` helper.
33
+
34
+ ```app/components/weather.hbs
35
+ {{#if @isRaining}}
36
+ Yes, grab an umbrella!
37
+ {{else}}
38
+ No, it's lovely outside!
39
+ {{/if}}
40
+ ```
41
+
42
+ You are also able to combine `else` and `if` helpers to create more complex
43
+ conditional logic.
44
+
45
+ For the following template:
46
+
47
+ ```app/components/weather.hbs
48
+ {{#if @isRaining}}
49
+ Yes, grab an umbrella!
50
+ {{else if @isCold}}
51
+ Grab a coat, it's chilly!
52
+ {{else}}
53
+ No, it's lovely outside!
54
+ {{/if}}
55
+ ```
56
+
57
+ If you call it by saying `isCold` is true:
58
+
59
+ ```app/templates/application.hbs
60
+ <Weather @isCold={{true}} />
61
+ ```
62
+
63
+ Then `Grab a coat, it's chilly!` will be rendered.
64
+
65
+ ## Inline form
66
+
67
+ The inline `if` helper conditionally renders a single property or string.
68
+
69
+ In this form, the `if` helper receives three arguments, the conditional value,
70
+ the value to render when truthy, and the value to render when falsey.
71
+
72
+ For example, if `useLongGreeting` is truthy, the following:
73
+
74
+ ```app/templates/application.hbs
75
+ <Greeting @useLongGreeting={{true}} />
76
+ ```
77
+
78
+ ```app/components/greeting.hbs
79
+ {{if @useLongGreeting "Hello" "Hi"}} Alex
80
+ ```
81
+
82
+ Will render:
83
+
84
+ ```html
85
+ Hello Alex
86
+ ```
87
+
88
+ One detail to keep in mind is that both branches of the `if` helper will be evaluated,
89
+ so if you have `{{if condition "foo" (expensive-operation "bar")`,
90
+ `expensive-operation` will always calculate.
91
+
92
+ @method if
93
+ @for Ember.Templates.helpers
94
+ @public
95
+ */
96
+ /**
97
+ The `unless` helper is the inverse of the `if` helper. It displays if a value
98
+ is falsey ("not true" or "is false"). Example values that will display with
99
+ `unless`: `false`, `undefined`, `null`, `""`, `0`, `NaN` or an empty array.
100
+
101
+ ## Inline form
102
+
103
+ The inline `unless` helper conditionally renders a single property or string.
104
+ This helper acts like a ternary operator. If the first property is falsy,
105
+ the second argument will be displayed, otherwise, the third argument will be
106
+ displayed
107
+
108
+ For example, if you pass a falsey `useLongGreeting` to the `Greeting` component:
109
+
110
+ ```app/templates/application.hbs
111
+ <Greeting @useLongGreeting={{false}} />
112
+ ```
113
+
114
+ ```app/components/greeting.hbs
115
+ {{unless @useLongGreeting "Hi" "Hello"}} Ben
116
+ ```
117
+
118
+ Then it will display:
119
+
120
+ ```html
121
+ Hi Ben
122
+ ```
123
+
124
+ ## Block form
125
+
126
+ Like the `if` helper, the `unless` helper also has a block form.
127
+
128
+ The following will not render anything:
129
+
130
+ ```app/templates/application.hbs
131
+ <Greeting />
132
+ ```
133
+
134
+ ```app/components/greeting.hbs
135
+ {{#unless @greeting}}
136
+ No greeting was found. Why not set one?
137
+ {{/unless}}
138
+ ```
139
+
140
+ You can also use an `else` helper with the `unless` block. The
141
+ `else` will display if the value is truthy.
142
+
143
+ If you have the following component:
144
+
145
+ ```app/components/logged-in.hbs
146
+ {{#unless @userData}}
147
+ Please login.
148
+ {{else}}
149
+ Welcome back!
150
+ {{/unless}}
151
+ ```
152
+
153
+ Calling it with a truthy `userData`:
154
+
155
+ ```app/templates/application.hbs
156
+ <LoggedIn @userData={{hash username="Zoey"}} />
157
+ ```
158
+
159
+ Will render:
160
+
161
+ ```html
162
+ Welcome back!
163
+ ```
164
+
165
+ and calling it with a falsey `userData`:
166
+
167
+ ```app/templates/application.hbs
168
+ <LoggedIn @userData={{false}} />
169
+ ```
170
+
171
+ Will render:
172
+
173
+ ```html
174
+ Please login.
175
+ ```
176
+
177
+ @method unless
178
+ @for Ember.Templates.helpers
179
+ @public
180
+ */
181
+ export {};
182
+ }
@@ -1 +1,19 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/log' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/log' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ `log` allows you to output the value of variables in the current rendering
7
+ context. `log` also accepts primitive types such as strings or numbers.
8
+
9
+ ```handlebars
10
+ {{log "myVariable:" myVariable }}
11
+ ```
12
+
13
+ @method log
14
+ @for Ember.Templates.helpers
15
+ @param {Array} params
16
+ @public
17
+ */
18
+ export {};
19
+ }
@@ -1 +1,42 @@
1
- declare module '@ember/-internals/glimmer/lib/helpers/modifier' {}
1
+ declare module '@ember/-internals/glimmer/lib/helpers/modifier' {
2
+ /**
3
+ @module ember
4
+ */
5
+ /**
6
+ Use the `{{modifier}}` helper to create contextual modifier so
7
+ that it can be passed around as first-class values in templates.
8
+
9
+ ```handlebars
10
+ {{#let (modifier "click-outside" click=this.submit) as |on-click-outside|}}
11
+
12
+ {{!-- this is equivalent to `<MyComponent {{click-outside click=this.submit}} />` --}}
13
+ <MyComponent {{on-click-outside}} />
14
+
15
+ {{!-- this will pass the modifier itself into the component, instead of invoking it now --}}
16
+ <MyComponent @modifier={{modifier on-click-outside "extra" "args"}} />
17
+
18
+ {{!-- this will yield the modifier itself ("contextual modifier"), instead of invoking it now --}}
19
+ {{yield on-click-outside}}
20
+ {{/let}}
21
+ ```
22
+
23
+ ### Arguments
24
+
25
+ The `{{modifier}}` helper works similarly to the [`{{component}}`](./component?anchor=component) and
26
+ [`{{helper}}`](./helper?anchor=helper) helper:
27
+
28
+ * When passed a string (e.g. `(modifier "foo")`) as the first argument,
29
+ it will produce an opaque, internal "modifier definition" object
30
+ that can be passed around and invoked elsewhere.
31
+
32
+ * Any additional positional and/or named arguments (a.k.a. params and hash)
33
+ will be stored ("curried") inside the definition object, such that, when invoked,
34
+ these arguments will be passed along to the referenced modifier.
35
+
36
+ @method modifier
37
+ @for Ember.Templates.helpers
38
+ @public
39
+ @since 3.27.0
40
+ */
41
+ export {};
42
+ }