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.
- package/build-metadata.json +3 -3
- package/dist/dev/packages/@ember/-internals/deprecations/index.js +9 -0
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +7 -7
- package/dist/dev/packages/@ember/-internals/routing/index.js +2 -2
- package/dist/dev/packages/@ember/-internals/runtime/index.js +1 -1
- package/dist/dev/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -0
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -0
- package/dist/dev/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -0
- package/dist/dev/packages/@ember/application/index.js +3 -3
- package/dist/dev/packages/@ember/application/instance.js +9 -9
- package/dist/dev/packages/@ember/component/helper.js +2 -2
- package/dist/dev/packages/@ember/component/index.js +3 -3
- package/dist/dev/packages/@ember/engine/index.js +3 -3
- package/dist/dev/packages/@ember/engine/instance.js +1 -1
- package/dist/dev/packages/@ember/helper/index.js +1132 -79
- package/dist/dev/packages/@ember/modifier/on.js +1 -1
- package/dist/dev/packages/@ember/object/compat.js +0 -32
- package/dist/dev/packages/@ember/renderer/index.js +1 -1
- package/dist/dev/packages/@ember/routing/-internals.js +2 -2
- package/dist/dev/packages/@ember/routing/index.js +11 -28
- package/dist/dev/packages/@ember/routing/lib/utils.js +2 -2
- package/dist/dev/packages/@ember/routing/route.js +2 -2
- package/dist/dev/packages/@ember/routing/router-service.js +9 -9
- package/dist/dev/packages/@ember/routing/router.js +2 -2
- package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +3 -3
- package/dist/dev/packages/@ember/template-compiler/lib/template.js +2 -2
- package/dist/dev/packages/@ember/template-factory/index.js +1 -1
- package/dist/dev/packages/@glimmer/opcode-compiler/index.js +2 -2
- package/dist/dev/packages/@glimmer/program/index.js +3 -3
- package/dist/dev/packages/@glimmer/runtime/index.js +7 -7
- package/dist/dev/packages/@glimmer/wire-format/index.js +2 -5
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/ember-template-compiler/index.js +2 -2
- package/dist/dev/packages/router_js/index.js +2 -2
- package/dist/dev/packages/rsvp/index.js +1 -2281
- package/dist/dev/packages/shared-chunks/{arguments-CDkbOqTS.js → arguments-DniR8eF2.js} +5 -18
- package/dist/dev/packages/shared-chunks/{compiler-QUSl_urU.js → compiler-BHFFl-fv.js} +1 -1
- package/dist/dev/packages/shared-chunks/{curly-BbL6STF2.js → curly-BCD_vyHq.js} +1 -1
- package/dist/dev/packages/shared-chunks/{element-BYLB-q7a.js → element-Cgoi4ldD.js} +0 -24
- package/dist/dev/packages/shared-chunks/get-zsePWrJL.js +40 -0
- package/dist/dev/packages/shared-chunks/hash-BFu91gtE.js +57 -0
- package/dist/dev/packages/shared-chunks/{index-DaFzpTIE.js → index-BYUSIu_W.js} +3 -3
- package/dist/dev/packages/shared-chunks/{index-Czn34wUZ.js → index-Bv9SQpEx.js} +218 -78
- package/dist/dev/packages/shared-chunks/{invoke-d9sqa50M.js → invoke-CgF42joE.js} +1 -1
- package/dist/dev/packages/shared-chunks/{not-DYh6AY9Z.js → not-0cVb-rLf.js} +1 -1
- package/dist/dev/packages/shared-chunks/{on-DlF0Wy7P.js → on-CVIjn2C-.js} +22 -11
- package/dist/dev/packages/shared-chunks/{opcodes-CplRyHl_.js → opcodes-DDajoGhq.js} +0 -4
- package/dist/dev/packages/shared-chunks/{outlet-B4qORyui.js → outlet-BO5-QFmm.js} +3 -3
- package/dist/dev/packages/shared-chunks/{program-context-Dq8xN2HI.js → program-context-BBB1Ga5h.js} +2 -2
- package/dist/dev/packages/shared-chunks/{render-CtH73XOv.js → render-D_Rawf-r.js} +2 -2
- package/dist/{prod/packages/shared-chunks/rsvp.es-DR7yS7qg.js → dev/packages/shared-chunks/rsvp-aLN_pQtn.js} +152 -148
- package/dist/dev/packages/shared-chunks/{setup-registry-h519ZsHS.js → setup-registry-Ci8Af2Bz.js} +35 -13
- package/dist/{prod/packages/shared-chunks/syscall-ops-CN7STuUn.js → dev/packages/shared-chunks/syscall-ops-CkPT1Kfx.js} +1 -2
- package/dist/dev/packages/shared-chunks/{textarea-DEvw4ezm.js → textarea-DvS6Xmdh.js} +3 -23
- package/dist/dev/packages/shared-chunks/{unique-id-DQOhouG1.js → unique-id-Csxuh1I7.js} +0 -4
- package/dist/dev/packages/shared-chunks/{unrecognized-url-error-B8loxkay.js → unrecognized-url-error-cXUp-SK3.js} +1 -1
- package/dist/prod/packages/@ember/-internals/deprecations/index.js +9 -0
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +7 -7
- package/dist/prod/packages/@ember/-internals/routing/index.js +2 -2
- package/dist/prod/packages/@ember/-internals/runtime/index.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -0
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -0
- package/dist/prod/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -0
- package/dist/prod/packages/@ember/application/index.js +3 -3
- package/dist/prod/packages/@ember/application/instance.js +9 -9
- package/dist/prod/packages/@ember/component/helper.js +2 -2
- package/dist/prod/packages/@ember/component/index.js +3 -3
- package/dist/prod/packages/@ember/engine/index.js +3 -3
- package/dist/prod/packages/@ember/engine/instance.js +1 -1
- package/dist/prod/packages/@ember/helper/index.js +1132 -79
- package/dist/prod/packages/@ember/modifier/on.js +1 -1
- package/dist/prod/packages/@ember/object/compat.js +0 -32
- package/dist/prod/packages/@ember/renderer/index.js +1 -1
- package/dist/prod/packages/@ember/routing/index.js +10 -27
- package/dist/prod/packages/@ember/routing/lib/utils.js +2 -2
- package/dist/prod/packages/@ember/routing/route.js +2 -2
- package/dist/prod/packages/@ember/routing/router-service.js +9 -9
- package/dist/prod/packages/@ember/routing/router.js +2 -2
- package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +3 -3
- package/dist/prod/packages/@ember/template-compiler/lib/template.js +2 -2
- package/dist/prod/packages/@ember/template-factory/index.js +1 -1
- package/dist/prod/packages/@glimmer/opcode-compiler/index.js +2 -2
- package/dist/prod/packages/@glimmer/program/index.js +3 -3
- package/dist/prod/packages/@glimmer/runtime/index.js +7 -7
- package/dist/prod/packages/@glimmer/wire-format/index.js +2 -5
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/ember-template-compiler/index.js +2 -2
- package/dist/prod/packages/router_js/index.js +2 -2
- package/dist/prod/packages/rsvp/index.js +1 -2281
- package/dist/prod/packages/shared-chunks/{arguments-BzAkZVBa.js → arguments-CCYATlEH.js} +1 -18
- package/dist/prod/packages/shared-chunks/{compiler-lBSssiWp.js → compiler-Wt5SWcrF.js} +1 -1
- package/dist/prod/packages/shared-chunks/{curly-CU2jYOtm.js → curly-CdvJuTyW.js} +1 -1
- package/dist/prod/packages/shared-chunks/{element-DgHdPZ8u.js → element-BmBjPjkQ.js} +0 -24
- package/dist/prod/packages/shared-chunks/get-CEjFJzGs.js +40 -0
- package/dist/prod/packages/shared-chunks/hash-BitfXhCx.js +57 -0
- package/dist/prod/packages/shared-chunks/{index-XmtQRWbX.js → index-D8cl-pfl.js} +218 -78
- package/dist/prod/packages/shared-chunks/{index-Bf53M8eS.js → index-kwuZeaNz.js} +3 -3
- package/dist/prod/packages/shared-chunks/{invoke-DhQ5QRp2.js → invoke-4JGJYH7Z.js} +1 -1
- package/dist/prod/packages/shared-chunks/{not-BOIVROuv.js → not-Dn5s9qVZ.js} +1 -1
- package/dist/prod/packages/shared-chunks/{on-BZHAxzdq.js → on-ov4KAucw.js} +22 -11
- package/dist/prod/packages/shared-chunks/{opcodes-CplRyHl_.js → opcodes-DDajoGhq.js} +0 -4
- package/dist/prod/packages/shared-chunks/{outlet-CsNMfeOj.js → outlet-BWnaVOrA.js} +3 -3
- package/dist/prod/packages/shared-chunks/{program-context-COSioH46.js → program-context-WVlzpPdi.js} +2 -2
- package/dist/prod/packages/shared-chunks/{render-Bf7GviCY.js → render-BAVl5E6X.js} +2 -2
- package/dist/{dev/packages/shared-chunks/rsvp.es-DR7yS7qg.js → prod/packages/shared-chunks/rsvp-aLN_pQtn.js} +152 -148
- package/dist/prod/packages/shared-chunks/{setup-registry-DFSQHIUs.js → setup-registry-DeyoFe6Q.js} +35 -13
- package/dist/{dev/packages/shared-chunks/syscall-ops-CN7STuUn.js → prod/packages/shared-chunks/syscall-ops-CkPT1Kfx.js} +1 -2
- package/dist/prod/packages/shared-chunks/{textarea-DMmdvgk2.js → textarea-B-sssXGa.js} +3 -23
- package/dist/prod/packages/shared-chunks/{unique-id-o2pS74go.js → unique-id-BJb1p8EG.js} +0 -4
- package/dist/prod/packages/shared-chunks/{unrecognized-url-error-jjQ-FqKB.js → unrecognized-url-error-xC654tCo.js} +1 -1
- package/docs/data.json +1237 -1395
- package/package.json +52 -47
- package/types/stable/@ember/-internals/deprecations/index.d.ts +6 -0
- package/types/stable/@ember/-internals/glimmer/index.d.ts +7 -380
- package/types/stable/@ember/-internals/glimmer/lib/component.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +2 -2
- package/types/stable/@ember/-internals/glimmer/lib/helpers/each-in.d.ts +196 -63
- package/types/stable/@ember/-internals/glimmer/lib/helpers/element.d.ts +0 -24
- package/types/stable/@ember/-internals/glimmer/lib/helpers/mut.d.ts +3 -2
- package/types/stable/@ember/-internals/glimmer/lib/helpers/readonly.d.ts +3 -1
- package/types/stable/@ember/-internals/glimmer/lib/helpers/unbound.d.ts +6 -2
- package/types/stable/@ember/-internals/glimmer/lib/helpers/unique-id.d.ts +0 -3
- package/types/stable/@ember/-internals/glimmer/lib/syntax/mount.d.ts +4 -2
- package/types/stable/@ember/-internals/glimmer/lib/syntax/outlet.d.ts +7 -2
- package/types/stable/@ember/helper/index.d.ts +1113 -73
- package/types/stable/@ember/object/compat.d.ts +0 -32
- package/types/stable/@ember/object/core.d.ts +1 -1
- package/types/stable/@ember/routing/router-service.d.ts +9 -9
- package/types/stable/@glimmer/interfaces/lib/compile/wire-format/api.d.ts +1 -9
- package/types/stable/@glimmer/interfaces/lib/compile/wire-format/opcodes.d.ts +0 -4
- package/types/stable/@glimmer/interfaces/lib/vm-opcodes.d.ts +0 -4
- package/types/stable/@glimmer/opcode-compiler/lib/opcode-builder/helpers/conditional.d.ts +1 -1
- package/types/stable/@glimmer/opcode-compiler/lib/syntax/statements.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/helpers/array.d.ts +0 -33
- package/types/stable/@glimmer/runtime/lib/helpers/concat.d.ts +0 -25
- package/types/stable/@glimmer/runtime/lib/helpers/fn.d.ts +0 -70
- package/types/stable/@glimmer/runtime/lib/helpers/get.d.ts +0 -69
- package/types/stable/@glimmer/runtime/lib/helpers/hash.d.ts +0 -36
- package/types/stable/index.d.ts +0 -14
- package/dist/dev/packages/shared-chunks/get-6I3sjd-I.js +0 -135
- package/dist/dev/packages/shared-chunks/hash-6NDs_5_f.js +0 -198
- package/dist/prod/packages/shared-chunks/get-Dago5uGl.js +0 -135
- package/dist/prod/packages/shared-chunks/hash-gEXIsSO4.js +0 -198
- package/types/stable/@ember/-internals/glimmer/lib/helpers/array.d.ts +0 -43
- package/types/stable/@ember/-internals/glimmer/lib/helpers/component.d.ts +0 -93
- package/types/stable/@ember/-internals/glimmer/lib/helpers/concat.d.ts +0 -32
- package/types/stable/@ember/-internals/glimmer/lib/helpers/fn.d.ts +0 -77
- package/types/stable/@ember/-internals/glimmer/lib/helpers/get.d.ts +0 -94
- package/types/stable/@ember/-internals/glimmer/lib/helpers/hash.d.ts +0 -46
- package/types/stable/@ember/-internals/glimmer/lib/helpers/helper.d.ts +0 -43
- package/types/stable/@ember/-internals/glimmer/lib/helpers/if-unless.d.ts +0 -228
- package/types/stable/@ember/-internals/glimmer/lib/helpers/log.d.ts +0 -19
- package/types/stable/@ember/-internals/glimmer/lib/helpers/modifier.d.ts +0 -42
- package/types/stable/@ember/-internals/glimmer/lib/helpers/page-title.d.ts +0 -24
- package/types/stable/@ember/-internals/glimmer/lib/modifiers/on.d.ts +0 -95
- package/types/stable/@ember/-internals/glimmer/lib/syntax/in-element.d.ts +0 -49
- package/types/stable/@ember/-internals/glimmer/lib/syntax/let.d.ts +0 -43
|
@@ -36,38 +36,6 @@ declare module '@ember/object/compat' {
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Classic Example:
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
import { tracked } from '@glimmer/tracking';
|
|
43
|
-
import { dependentKeyCompat } from '@ember/object/compat';
|
|
44
|
-
import EmberObject, { computed, observer, set } from '@ember/object';
|
|
45
|
-
|
|
46
|
-
const Person = EmberObject.extend({
|
|
47
|
-
firstName: tracked(),
|
|
48
|
-
lastName: tracked(),
|
|
49
|
-
|
|
50
|
-
fullName: dependentKeyCompat(function() {
|
|
51
|
-
return `${this.firstName} ${this.lastName}`;
|
|
52
|
-
}),
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const Profile = EmberObject.extend({
|
|
56
|
-
person: null,
|
|
57
|
-
|
|
58
|
-
helloMessage: computed('person.fullName', function() {
|
|
59
|
-
return `Hello, ${this.person.fullName}!`;
|
|
60
|
-
}),
|
|
61
|
-
|
|
62
|
-
onNameUpdated: observer('person.fullName', function() {
|
|
63
|
-
console.log('person name updated!');
|
|
64
|
-
}),
|
|
65
|
-
});
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
`dependentKeyCompat()` can receive a getter function or an object containing
|
|
69
|
-
`get`/`set` methods when used in classic classes, like computed properties.
|
|
70
|
-
|
|
71
39
|
In general, only properties which you _expect_ to be watched by older,
|
|
72
40
|
untracked clases should be marked as dependency compatible. The decorator is
|
|
73
41
|
meant as an interop layer for parts of Ember's older classic APIs, and should
|
|
@@ -109,7 +109,7 @@ declare module '@ember/object/core' {
|
|
|
109
109
|
@method init
|
|
110
110
|
@public
|
|
111
111
|
*/
|
|
112
|
-
init(_properties
|
|
112
|
+
init(_properties?: object): void;
|
|
113
113
|
/**
|
|
114
114
|
Defines the properties that will be concatenated from the superclass
|
|
115
115
|
(instead of overridden).
|
|
@@ -17,7 +17,7 @@ declare module '@ember/routing/router-service' {
|
|
|
17
17
|
In this example, the Router service is injected into a component to initiate a transition
|
|
18
18
|
to a dedicated route:
|
|
19
19
|
|
|
20
|
-
```app/components/example.gjs
|
|
20
|
+
```gjs {data-filename="app/components/example.gjs"}
|
|
21
21
|
import Component from '@glimmer/component';
|
|
22
22
|
import { action } from '@ember/object';
|
|
23
23
|
import { service } from '@ember/service';
|
|
@@ -58,7 +58,7 @@ declare module '@ember/routing/router-service' {
|
|
|
58
58
|
specific model from a Component in the first action, and in the second we trigger
|
|
59
59
|
a query-params only transition.
|
|
60
60
|
|
|
61
|
-
```app/components/example.gjs
|
|
61
|
+
```gjs {data-filename="app/components/example.gjs"}
|
|
62
62
|
import Component from '@glimmer/component';
|
|
63
63
|
import { action } from '@ember/object';
|
|
64
64
|
import { service } from '@ember/service';
|
|
@@ -137,7 +137,7 @@ declare module '@ember/routing/router-service' {
|
|
|
137
137
|
In this example, the URL for the `author.books` route for a given author
|
|
138
138
|
is copied to the clipboard.
|
|
139
139
|
|
|
140
|
-
```app/templates/application.gjs
|
|
140
|
+
```gjs {data-filename="app/templates/application.gjs"}
|
|
141
141
|
import CopyLink from '../components/copy-link';
|
|
142
142
|
|
|
143
143
|
<template>
|
|
@@ -145,7 +145,7 @@ declare module '@ember/routing/router-service' {
|
|
|
145
145
|
</template>
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
```app/components/copy-link.gjs
|
|
148
|
+
```gjs {data-filename="app/components/copy-link.gjs"}
|
|
149
149
|
import Component from '@glimmer/component';
|
|
150
150
|
import { service } from '@ember/service';
|
|
151
151
|
import { action } from '@ember/object';
|
|
@@ -168,7 +168,7 @@ declare module '@ember/routing/router-service' {
|
|
|
168
168
|
Just like with `transitionTo` and `replaceWith`, `urlFor` can also handle
|
|
169
169
|
query parameters.
|
|
170
170
|
|
|
171
|
-
```app/templates/application.gjs
|
|
171
|
+
```gjs {data-filename="app/templates/application.gjs"}
|
|
172
172
|
import CopyLink from '../components/copy-link';
|
|
173
173
|
|
|
174
174
|
<template>
|
|
@@ -176,7 +176,7 @@ declare module '@ember/routing/router-service' {
|
|
|
176
176
|
</template>
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
```app/components/copy-link.gjs
|
|
179
|
+
```gjs {data-filename="app/components/copy-link.gjs"}
|
|
180
180
|
import Component from '@glimmer/component';
|
|
181
181
|
import { service } from '@ember/service';
|
|
182
182
|
import { action } from '@ember/object';
|
|
@@ -214,7 +214,7 @@ declare module '@ember/routing/router-service' {
|
|
|
214
214
|
|
|
215
215
|
In the following example, `isActive` will return `true` if the current route is `/posts`.
|
|
216
216
|
|
|
217
|
-
```app/components/posts.gjs
|
|
217
|
+
```gjs {data-filename="app/components/posts.gjs"}
|
|
218
218
|
import Component from '@glimmer/component';
|
|
219
219
|
import { service } from '@ember/service';
|
|
220
220
|
|
|
@@ -230,7 +230,7 @@ declare module '@ember/routing/router-service' {
|
|
|
230
230
|
The next example includes a dynamic segment, and will return `true` if the current route is `/posts/1`,
|
|
231
231
|
assuming the post has an id of 1:
|
|
232
232
|
|
|
233
|
-
```app/components/posts.gjs
|
|
233
|
+
```gjs {data-filename="app/components/posts.gjs"}
|
|
234
234
|
import Component from '@glimmer/component';
|
|
235
235
|
import { service } from '@ember/service';
|
|
236
236
|
|
|
@@ -576,7 +576,7 @@ declare module '@ember/routing/router-service' {
|
|
|
576
576
|
and doesn't change the active route).
|
|
577
577
|
|
|
578
578
|
Usage example:
|
|
579
|
-
```app/components/header.gjs
|
|
579
|
+
```gjs {data-filename="app/components/header.gjs"}
|
|
580
580
|
import Component from '@glimmer/component';
|
|
581
581
|
import { service } from '@ember/service';
|
|
582
582
|
import { notEmpty } from '@ember/object/computed';
|
|
@@ -15,7 +15,6 @@ declare module '@glimmer/interfaces/lib/compile/wire-format/api' {
|
|
|
15
15
|
ConcatOpcode,
|
|
16
16
|
CurryOpcode,
|
|
17
17
|
DebuggerOpcode,
|
|
18
|
-
DynamicArgOpcode,
|
|
19
18
|
DynamicAttrOpcode,
|
|
20
19
|
EachOpcode,
|
|
21
20
|
FlushElementOpcode,
|
|
@@ -39,7 +38,6 @@ declare module '@glimmer/interfaces/lib/compile/wire-format/api' {
|
|
|
39
38
|
NotOpcode,
|
|
40
39
|
OpenElementOpcode,
|
|
41
40
|
OpenElementWithSplatOpcode,
|
|
42
|
-
StaticArgOpcode,
|
|
43
41
|
StaticAttrOpcode,
|
|
44
42
|
StaticComponentAttrOpcode,
|
|
45
43
|
TrustingAppendOpcode,
|
|
@@ -242,8 +240,6 @@ declare module '@glimmer/interfaces/lib/compile/wire-format/api' {
|
|
|
242
240
|
|
|
243
241
|
export type AttrSplat = [AttrSplatOpcode, YieldTo];
|
|
244
242
|
export type Yield = [YieldOpcode, YieldTo, Nullable<Params>];
|
|
245
|
-
export type DynamicArg = [DynamicArgOpcode, string, Expression];
|
|
246
|
-
export type StaticArg = [StaticArgOpcode, string, Expression];
|
|
247
243
|
|
|
248
244
|
export type DynamicAttr = Attr<DynamicAttrOpcode>;
|
|
249
245
|
export type ComponentAttr = Attr<ComponentAttrOpcode>;
|
|
@@ -318,8 +314,6 @@ declare module '@glimmer/interfaces/lib/compile/wire-format/api' {
|
|
|
318
314
|
| Attribute
|
|
319
315
|
| AttrSplat
|
|
320
316
|
| Yield
|
|
321
|
-
| StaticArg
|
|
322
|
-
| DynamicArg
|
|
323
317
|
| Debugger
|
|
324
318
|
| InElement
|
|
325
319
|
| If
|
|
@@ -337,15 +331,13 @@ declare module '@glimmer/interfaces/lib/compile/wire-format/api' {
|
|
|
337
331
|
| TrustingComponentAttr;
|
|
338
332
|
|
|
339
333
|
export type ComponentFeature = Modifier | AttrSplat;
|
|
340
|
-
export type Argument = StaticArg | DynamicArg;
|
|
341
334
|
|
|
342
|
-
export type ElementParameter = Attribute |
|
|
335
|
+
export type ElementParameter = Attribute | ComponentFeature;
|
|
343
336
|
}
|
|
344
337
|
|
|
345
338
|
/** A Handlebars statement */
|
|
346
339
|
export type Statement = Statements.Statement;
|
|
347
340
|
export type Attribute = Statements.Attribute;
|
|
348
|
-
export type Argument = Statements.Argument;
|
|
349
341
|
export type ElementParameter = Statements.ElementParameter;
|
|
350
342
|
|
|
351
343
|
export type SexpSyntax = Statement | TupleExpression;
|
|
@@ -4,9 +4,7 @@ declare module '@glimmer/interfaces/lib/compile/wire-format/opcodes' {
|
|
|
4
4
|
export type TrustingAppendOpcode = 2;
|
|
5
5
|
export type CommentOpcode = 3;
|
|
6
6
|
export type ModifierOpcode = 4;
|
|
7
|
-
export type StrictModifierOpcode = 5;
|
|
8
7
|
export type BlockOpcode = 6;
|
|
9
|
-
export type StrictBlockOpcode = 7;
|
|
10
8
|
export type ComponentOpcode = 8;
|
|
11
9
|
|
|
12
10
|
export type OpenElementOpcode = 10;
|
|
@@ -20,8 +18,6 @@ declare module '@glimmer/interfaces/lib/compile/wire-format/opcodes' {
|
|
|
20
18
|
export type AttrSplatOpcode = 17;
|
|
21
19
|
export type YieldOpcode = 18;
|
|
22
20
|
|
|
23
|
-
export type DynamicArgOpcode = 20;
|
|
24
|
-
export type StaticArgOpcode = 21;
|
|
25
21
|
export type TrustingDynamicAttrOpcode = 22;
|
|
26
22
|
export type TrustingComponentAttrOpcode = 23;
|
|
27
23
|
export type StaticComponentAttrOpcode = 24;
|
|
@@ -69,7 +69,6 @@ declare module '@glimmer/interfaces/lib/vm-opcodes' {
|
|
|
69
69
|
export type VmPushBlockScope = 62;
|
|
70
70
|
export type VmPushSymbolTable = 63;
|
|
71
71
|
export type VmInvokeYield = 64;
|
|
72
|
-
export type VmJumpIf = 65;
|
|
73
72
|
export type VmJumpUnless = 66;
|
|
74
73
|
export type VmJumpEq = 67;
|
|
75
74
|
export type VmAssertSame = 68;
|
|
@@ -88,7 +87,6 @@ declare module '@glimmer/interfaces/lib/vm-opcodes' {
|
|
|
88
87
|
export type VmResolveCurriedComponent = 81;
|
|
89
88
|
export type VmPushArgs = 82;
|
|
90
89
|
export type VmPushEmptyArgs = 83;
|
|
91
|
-
export type VmPopArgs = 84;
|
|
92
90
|
export type VmPrepareArgs = 85;
|
|
93
91
|
export type VmCaptureArgs = 86;
|
|
94
92
|
export type VmCreateComponent = 87;
|
|
@@ -164,7 +162,6 @@ declare module '@glimmer/interfaces/lib/vm-opcodes' {
|
|
|
164
162
|
| VmPushBlockScope
|
|
165
163
|
| VmPushSymbolTable
|
|
166
164
|
| VmInvokeYield
|
|
167
|
-
| VmJumpIf
|
|
168
165
|
| VmJumpUnless
|
|
169
166
|
| VmJumpEq
|
|
170
167
|
| VmAssertSame
|
|
@@ -183,7 +180,6 @@ declare module '@glimmer/interfaces/lib/vm-opcodes' {
|
|
|
183
180
|
| VmResolveCurriedComponent
|
|
184
181
|
| VmPushArgs
|
|
185
182
|
| VmPushEmptyArgs
|
|
186
|
-
| VmPopArgs
|
|
187
183
|
| VmPrepareArgs
|
|
188
184
|
| VmCaptureArgs
|
|
189
185
|
| VmCreateComponent
|
|
@@ -46,7 +46,7 @@ declare module '@glimmer/opcode-compiler/lib/opcode-builder/helpers/conditional'
|
|
|
46
46
|
* # Updating Execution
|
|
47
47
|
*
|
|
48
48
|
* Updating execution for this `replayable` occurs if the `body` added an
|
|
49
|
-
* assertion, via one of the `
|
|
49
|
+
* assertion, via one of the `JumpUnless`, `JumpEq` or `AssertSame` opcodes.
|
|
50
50
|
*
|
|
51
51
|
* If, during updating executon, the assertion fails, the initial VM is
|
|
52
52
|
* restored, and the stored arguments are pushed onto the stack. The DOM
|
|
@@ -2,7 +2,7 @@ declare module '@glimmer/opcode-compiler/lib/syntax/statements' {
|
|
|
2
2
|
import type { WellKnownAttrName, WellKnownTagName } from "@glimmer/interfaces";
|
|
3
3
|
import type { PushStatementOp } from "@glimmer/opcode-compiler/lib/syntax/compilers";
|
|
4
4
|
import { Compilers } from "@glimmer/opcode-compiler/lib/syntax/compilers";
|
|
5
|
-
export const STATEMENTS: Compilers<PushStatementOp, 2 | 1 | 3 | 4 | 8 | 16 | 6 | 10 | 12 | 11 | 14 | 13 | 15 | 17 | 18 |
|
|
5
|
+
export const STATEMENTS: Compilers<PushStatementOp, 2 | 1 | 3 | 4 | 8 | 16 | 6 | 10 | 12 | 11 | 14 | 13 | 15 | 17 | 18 | 22 | 23 | 24 | 26 | 40 | 41 | 42 | 44 | 45 | 46>;
|
|
6
6
|
export function inflateTagName(tagName: string | WellKnownTagName): string;
|
|
7
7
|
export function inflateAttrName(attrName: string | WellKnownAttrName): string;
|
|
8
8
|
}
|
|
@@ -1,36 +1,3 @@
|
|
|
1
1
|
declare module '@glimmer/runtime/lib/helpers/array' {
|
|
2
|
-
/**
|
|
3
|
-
Use the `{{array}}` helper to create an array to pass as an option to your
|
|
4
|
-
components.
|
|
5
|
-
|
|
6
|
-
```handlebars
|
|
7
|
-
<MyComponent @people={{array
|
|
8
|
-
'Tom Dale'
|
|
9
|
-
'Yehuda Katz'
|
|
10
|
-
this.myOtherPerson}}
|
|
11
|
-
/>
|
|
12
|
-
```
|
|
13
|
-
or
|
|
14
|
-
```handlebars
|
|
15
|
-
{{yield people=(array
|
|
16
|
-
'Tom Dale'
|
|
17
|
-
'Yehuda Katz'
|
|
18
|
-
this.myOtherPerson)
|
|
19
|
-
}}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Would result in an object such as:
|
|
23
|
-
|
|
24
|
-
```js
|
|
25
|
-
['Tom Dale', 'Yehuda Katz', this.get('myOtherPerson')]
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Where the 3rd item in the array is bound to updates of the `myOtherPerson` property.
|
|
29
|
-
|
|
30
|
-
@method array
|
|
31
|
-
@param {Array} options
|
|
32
|
-
@return {Array} Array
|
|
33
|
-
@public
|
|
34
|
-
*/
|
|
35
2
|
export const array: object;
|
|
36
3
|
}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
1
|
declare module '@glimmer/runtime/lib/helpers/concat' {
|
|
2
|
-
/**
|
|
3
|
-
Concatenates the given arguments into a string.
|
|
4
|
-
|
|
5
|
-
Example:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
```gjs
|
|
9
|
-
import { concat } from '@ember/helper';
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
{{yield (concat firstName " " lastName)}}
|
|
13
|
-
|
|
14
|
-
{{! would yield name="<first name value> <last name value>" to the component}}
|
|
15
|
-
</template>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
or for angle bracket invocation, you actually don't need concat at all.
|
|
19
|
-
|
|
20
|
-
```handlebars
|
|
21
|
-
<SomeComponent @name="{{firstName}} {{lastName}}" />
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
@public
|
|
25
|
-
@method concat
|
|
26
|
-
*/
|
|
27
2
|
export const concat: object;
|
|
28
3
|
}
|
|
@@ -1,73 +1,3 @@
|
|
|
1
1
|
declare module '@glimmer/runtime/lib/helpers/fn' {
|
|
2
|
-
/**
|
|
3
|
-
The `fn` helper allows you to ensure a function that you are passing off
|
|
4
|
-
to another component, helper, or modifier has access to arguments that are
|
|
5
|
-
available in the template.
|
|
6
|
-
|
|
7
|
-
For example, if you have an `each` helper looping over a number of items, you
|
|
8
|
-
may need to pass a function that expects to receive the item as an argument
|
|
9
|
-
to a component invoked within the loop. Here's how you could use the `fn`
|
|
10
|
-
helper to pass both the function and its arguments together:
|
|
11
|
-
|
|
12
|
-
```app/components/items-listing.gjs
|
|
13
|
-
import DisplayItem from './display-item';
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
{{#each @items as |item|}}
|
|
17
|
-
<DisplayItem @item=item @select={{fn this.handleSelected item}} />
|
|
18
|
-
{{/each}}
|
|
19
|
-
</template>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
```app/components/items-list.gjs
|
|
23
|
-
import Component from '@glimmer/component';
|
|
24
|
-
import { action } from '@ember/object';
|
|
25
|
-
|
|
26
|
-
export default class ItemsList extends Component {
|
|
27
|
-
handleSelected = (item) => {
|
|
28
|
-
// ...snip...
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
In this case the `DisplayItem` 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 an arrow function to ensure that
|
|
47
|
-
`handleSelected` is properly bound to the `items-list`, but let's explore what
|
|
48
|
-
happens if we left out the arrow function:
|
|
49
|
-
|
|
50
|
-
```app/components/items-list.gjs
|
|
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 an arrow function or other means) before passing into `fn`!
|
|
64
|
-
|
|
65
|
-
See also [partial application](https://en.wikipedia.org/wiki/Partial_application).
|
|
66
|
-
|
|
67
|
-
`fn` is built-in and does not require any additional imports.
|
|
68
|
-
|
|
69
|
-
@method fn
|
|
70
|
-
@public
|
|
71
|
-
*/
|
|
72
2
|
export const fn: object;
|
|
73
3
|
}
|
|
@@ -1,72 +1,3 @@
|
|
|
1
1
|
declare module '@glimmer/runtime/lib/helpers/get' {
|
|
2
|
-
/**
|
|
3
|
-
Dynamically look up a property on an object. The second argument to `{{get}}`
|
|
4
|
-
should have a string value, although it can be bound.
|
|
5
|
-
|
|
6
|
-
For example, these two usages are equivalent:
|
|
7
|
-
|
|
8
|
-
```app/components/developer-detail.gjs
|
|
9
|
-
import Component from '@glimmer/component';
|
|
10
|
-
import { tracked } from '@glimmer/tracking';
|
|
11
|
-
import { get } from '@ember/object';
|
|
12
|
-
|
|
13
|
-
export default class extends Component {
|
|
14
|
-
@tracked developer = {
|
|
15
|
-
name: "Sandi Metz",
|
|
16
|
-
language: "Ruby"
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
<template>
|
|
20
|
-
{{this.developer.name}}
|
|
21
|
-
{{get this.developer "name"}}
|
|
22
|
-
</template>
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
If there were several facts about a person, the `{{get}}` helper can dynamically
|
|
27
|
-
pick one:
|
|
28
|
-
|
|
29
|
-
```app/templates/application.gjs
|
|
30
|
-
<template>
|
|
31
|
-
<DeveloperDetail @factName="language" />
|
|
32
|
-
</template>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
```handlebars
|
|
36
|
-
{{get this.developer @factName}}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
For a more complex example, this template would allow the user to switch
|
|
40
|
-
between showing the user's height and weight with a click:
|
|
41
|
-
|
|
42
|
-
```app/components/developer-detail.gjs
|
|
43
|
-
import Component from '@glimmer/component';
|
|
44
|
-
import { tracked } from '@glimmer/tracking';
|
|
45
|
-
import { get } from '@ember/object';
|
|
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
|
-
showFact = (fact) => {
|
|
56
|
-
this.currentFact = fact;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
<template>
|
|
60
|
-
{{get this.developer this.currentFact}}
|
|
61
|
-
|
|
62
|
-
<button {{on 'click' (fn this.showFact "name")}}>Show name</button>
|
|
63
|
-
<button {{on 'click' (fn this.showFact "language")}}>Show language</button>
|
|
64
|
-
</template>
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
@public
|
|
69
|
-
@method get
|
|
70
|
-
*/
|
|
71
2
|
export const get: object;
|
|
72
3
|
}
|
|
@@ -1,39 +1,3 @@
|
|
|
1
1
|
declare module '@glimmer/runtime/lib/helpers/hash' {
|
|
2
|
-
/**
|
|
3
|
-
Use the `{{hash}}` helper to create a hash to pass as an option to your
|
|
4
|
-
components. This is especially useful for contextual components where you can
|
|
5
|
-
just yield a hash:
|
|
6
|
-
|
|
7
|
-
```handlebars
|
|
8
|
-
{{yield (hash
|
|
9
|
-
name='Sarah'
|
|
10
|
-
title=office
|
|
11
|
-
)}}
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Would result in an object such as:
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
{ name: 'Sarah', title: this.get('office') }
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Where the `title` is bound to updates of the `office` property.
|
|
21
|
-
|
|
22
|
-
Note that the hash is an empty object with no prototype chain, therefore
|
|
23
|
-
common methods like `toString` are not available in the resulting hash.
|
|
24
|
-
If you need to use such a method, you can use the `call` or `apply`
|
|
25
|
-
approach:
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
function toString(obj) {
|
|
29
|
-
return Object.prototype.toString.apply(obj);
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
@method hash
|
|
34
|
-
@param {Object} options
|
|
35
|
-
@return {Object} Hash
|
|
36
|
-
@public
|
|
37
|
-
*/
|
|
38
2
|
export const hash: object;
|
|
39
3
|
}
|
package/types/stable/index.d.ts
CHANGED
|
@@ -589,27 +589,13 @@
|
|
|
589
589
|
/// <reference path="./@ember/-internals/glimmer/lib/templates/input.d.ts" />
|
|
590
590
|
/// <reference path="./@ember/-internals/glimmer/lib/syntax/outlet.d.ts" />
|
|
591
591
|
/// <reference path="./@ember/-internals/glimmer/lib/syntax/mount.d.ts" />
|
|
592
|
-
/// <reference path="./@ember/-internals/glimmer/lib/syntax/let.d.ts" />
|
|
593
|
-
/// <reference path="./@ember/-internals/glimmer/lib/syntax/in-element.d.ts" />
|
|
594
|
-
/// <reference path="./@ember/-internals/glimmer/lib/modifiers/on.d.ts" />
|
|
595
592
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/unique-id.d.ts" />
|
|
596
593
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/unbound.d.ts" />
|
|
597
594
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/readonly.d.ts" />
|
|
598
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/page-title.d.ts" />
|
|
599
595
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/mut.d.ts" />
|
|
600
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/modifier.d.ts" />
|
|
601
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/log.d.ts" />
|
|
602
596
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/internal-helper.d.ts" />
|
|
603
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/if-unless.d.ts" />
|
|
604
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/helper.d.ts" />
|
|
605
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/hash.d.ts" />
|
|
606
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/get.d.ts" />
|
|
607
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/fn.d.ts" />
|
|
608
597
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/element.d.ts" />
|
|
609
598
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/each-in.d.ts" />
|
|
610
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/concat.d.ts" />
|
|
611
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/component.d.ts" />
|
|
612
|
-
/// <reference path="./@ember/-internals/glimmer/lib/helpers/array.d.ts" />
|
|
613
599
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/-track-array.d.ts" />
|
|
614
600
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/-resolve.d.ts" />
|
|
615
601
|
/// <reference path="./@ember/-internals/glimmer/lib/helpers/-normalize-class.d.ts" />
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { c as createComputeRef, U as UNDEFINED_REFERENCE, v as valueForRef } from './reference-BqOLhKFy.js';
|
|
2
|
-
import { f as reifyPositional } from './arguments-CDkbOqTS.js';
|
|
3
|
-
import { i as internalHelper } from './hash-6NDs_5_f.js';
|
|
4
|
-
import { setPath, getPath } from '../@glimmer/global-context/index.js';
|
|
5
|
-
import { i as isDict } from './collections-DPkjqeA3.js';
|
|
6
|
-
|
|
7
|
-
const isEmpty = value => {
|
|
8
|
-
return value === null || value === undefined || typeof value.toString !== 'function';
|
|
9
|
-
};
|
|
10
|
-
const normalizeTextValue = value => {
|
|
11
|
-
if (isEmpty(value)) {
|
|
12
|
-
return '';
|
|
13
|
-
}
|
|
14
|
-
return String(value);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
Concatenates the given arguments into a string.
|
|
19
|
-
|
|
20
|
-
Example:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```gjs
|
|
24
|
-
import { concat } from '@ember/helper';
|
|
25
|
-
|
|
26
|
-
<template>
|
|
27
|
-
{{yield (concat firstName " " lastName)}}
|
|
28
|
-
|
|
29
|
-
{{! would yield name="<first name value> <last name value>" to the component}}
|
|
30
|
-
</template>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
or for angle bracket invocation, you actually don't need concat at all.
|
|
34
|
-
|
|
35
|
-
```handlebars
|
|
36
|
-
<SomeComponent @name="{{firstName}} {{lastName}}" />
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
@public
|
|
40
|
-
@method concat
|
|
41
|
-
*/
|
|
42
|
-
const concat = internalHelper(({
|
|
43
|
-
positional
|
|
44
|
-
}) => {
|
|
45
|
-
return createComputeRef(() => reifyPositional(positional).map(normalizeTextValue).join(''), null, 'concat');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
Dynamically look up a property on an object. The second argument to `{{get}}`
|
|
50
|
-
should have a string value, although it can be bound.
|
|
51
|
-
|
|
52
|
-
For example, these two usages are equivalent:
|
|
53
|
-
|
|
54
|
-
```app/components/developer-detail.gjs
|
|
55
|
-
import Component from '@glimmer/component';
|
|
56
|
-
import { tracked } from '@glimmer/tracking';
|
|
57
|
-
import { get } from '@ember/object';
|
|
58
|
-
|
|
59
|
-
export default class extends Component {
|
|
60
|
-
@tracked developer = {
|
|
61
|
-
name: "Sandi Metz",
|
|
62
|
-
language: "Ruby"
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
<template>
|
|
66
|
-
{{this.developer.name}}
|
|
67
|
-
{{get this.developer "name"}}
|
|
68
|
-
</template>
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
If there were several facts about a person, the `{{get}}` helper can dynamically
|
|
73
|
-
pick one:
|
|
74
|
-
|
|
75
|
-
```app/templates/application.gjs
|
|
76
|
-
<template>
|
|
77
|
-
<DeveloperDetail @factName="language" />
|
|
78
|
-
</template>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
```handlebars
|
|
82
|
-
{{get this.developer @factName}}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
For a more complex example, this template would allow the user to switch
|
|
86
|
-
between showing the user's height and weight with a click:
|
|
87
|
-
|
|
88
|
-
```app/components/developer-detail.gjs
|
|
89
|
-
import Component from '@glimmer/component';
|
|
90
|
-
import { tracked } from '@glimmer/tracking';
|
|
91
|
-
import { get } from '@ember/object';
|
|
92
|
-
|
|
93
|
-
export default class extends Component {
|
|
94
|
-
@tracked developer = {
|
|
95
|
-
name: "Sandi Metz",
|
|
96
|
-
language: "Ruby"
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@tracked currentFact = 'name'
|
|
100
|
-
|
|
101
|
-
showFact = (fact) => {
|
|
102
|
-
this.currentFact = fact;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
<template>
|
|
106
|
-
{{get this.developer this.currentFact}}
|
|
107
|
-
|
|
108
|
-
<button {{on 'click' (fn this.showFact "name")}}>Show name</button>
|
|
109
|
-
<button {{on 'click' (fn this.showFact "language")}}>Show language</button>
|
|
110
|
-
</template>
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
@public
|
|
115
|
-
@method get
|
|
116
|
-
*/
|
|
117
|
-
const get = internalHelper(({
|
|
118
|
-
positional
|
|
119
|
-
}) => {
|
|
120
|
-
let sourceRef = positional[0] ?? UNDEFINED_REFERENCE;
|
|
121
|
-
let pathRef = positional[1] ?? UNDEFINED_REFERENCE;
|
|
122
|
-
return createComputeRef(() => {
|
|
123
|
-
let source = valueForRef(sourceRef);
|
|
124
|
-
if (isDict(source)) {
|
|
125
|
-
return getPath(source, String(valueForRef(pathRef)));
|
|
126
|
-
}
|
|
127
|
-
}, value => {
|
|
128
|
-
let source = valueForRef(sourceRef);
|
|
129
|
-
if (isDict(source)) {
|
|
130
|
-
return setPath(source, String(valueForRef(pathRef)), value);
|
|
131
|
-
}
|
|
132
|
-
}, 'get');
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
export { concat as c, get as g };
|