ember-source 7.3.0-alpha.1 → 7.3.0-alpha.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 (102) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/dev/packages/@ember/-internals/glimmer/index.js +6 -6
  3. package/dist/dev/packages/@ember/-internals/metal/index.js +8 -8
  4. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +2 -2
  5. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +1 -1
  6. package/dist/dev/packages/@ember/-internals/views/lib/system/event_dispatcher.js +1 -1
  7. package/dist/dev/packages/@ember/-internals/views/lib/views/core_view.js +1 -1
  8. package/dist/dev/packages/@ember/application/index.js +1 -1
  9. package/dist/dev/packages/@ember/application/instance.js +4 -4
  10. package/dist/dev/packages/@ember/array/index.js +3 -3
  11. package/dist/dev/packages/@ember/array/proxy.js +3 -3
  12. package/dist/dev/packages/@ember/component/index.js +2 -2
  13. package/dist/dev/packages/@ember/controller/index.js +2 -2
  14. package/dist/dev/packages/@ember/engine/index.js +2 -2
  15. package/dist/dev/packages/@ember/object/computed.js +2 -2
  16. package/dist/dev/packages/@ember/object/core.js +2 -2
  17. package/dist/dev/packages/@ember/object/index.js +4 -4
  18. package/dist/dev/packages/@ember/object/lib/computed/computed_macros.js +3 -3
  19. package/dist/dev/packages/@ember/object/lib/computed/reduce_computed_macros.js +1 -1
  20. package/dist/dev/packages/@ember/object/mixin.js +1 -1
  21. package/dist/dev/packages/@ember/object/observable.js +3 -3
  22. package/dist/dev/packages/@ember/object/promise-proxy-mixin.js +2 -2
  23. package/dist/dev/packages/@ember/renderer/index.js +1 -1
  24. package/dist/dev/packages/@ember/routing/route.js +3 -3
  25. package/dist/dev/packages/@ember/routing/router.js +2 -2
  26. package/dist/dev/packages/@ember/service/index.js +1 -1
  27. package/dist/dev/packages/@glimmer/node/index.js +2 -2
  28. package/dist/dev/packages/@glimmer/runtime/index.js +3 -3
  29. package/dist/dev/packages/@glimmer/tracking/index.js +1 -1
  30. package/dist/dev/packages/@glimmer/validator/index.js +1 -1
  31. package/dist/dev/packages/ember/version.js +1 -1
  32. package/dist/dev/packages/shared-chunks/{alias-DpqL1qx6.js → alias-CT_thCad.js} +2 -2
  33. package/dist/dev/packages/shared-chunks/{api-C0PAtEgQ.js → api-Dz70AUL_.js} +6 -4
  34. package/dist/dev/packages/shared-chunks/{array-CVEnNWng.js → array-DvaweI_T.js} +1 -1
  35. package/dist/dev/packages/shared-chunks/{computed-BPCtuOxQ.js → computed-DGxbeUbf.js} +1 -6
  36. package/dist/dev/packages/shared-chunks/{index-CCyXUNBa.js → index-D1AjYv31.js} +3 -3
  37. package/dist/dev/packages/shared-chunks/{injected_property-CbBLr5jt.js → injected_property-DbXd6Gax.js} +1 -1
  38. package/dist/dev/packages/shared-chunks/{property_set-qCUylPEK.js → property_set-CVlVgdor.js} +1 -1
  39. package/dist/dev/packages/shared-chunks/{rehydrate-builder-C6k1XhET.js → rehydrate-builder-CsnkZkur.js} +1 -1
  40. package/dist/dev/packages/shared-chunks/{render-87_sKZ_k.js → render-CtH73XOv.js} +10 -5
  41. package/dist/dev/packages/shared-chunks/{serialize-builder-BlxBjwO-.js → serialize-builder-D1oAeiyl.js} +1 -1
  42. package/dist/dev/packages/shared-chunks/{set_properties-C4TSebH6.js → set_properties-CEUT_EJn.js} +2 -2
  43. package/dist/dev/packages/shared-chunks/{setup-registry-BHdDJATP.js → setup-registry-DQ3c4Juo.js} +6 -6
  44. package/dist/dev/packages/shared-chunks/{textarea-C4lYkaHj.js → textarea-DEvw4ezm.js} +1 -1
  45. package/dist/dev/packages/shared-chunks/tracked-57EW14Ny.js +253 -0
  46. package/dist/dev/packages/shared-chunks/tracked-value-DhyJmrhG.js +115 -0
  47. package/dist/prod/packages/@ember/-internals/glimmer/index.js +6 -6
  48. package/dist/prod/packages/@ember/-internals/metal/index.js +8 -8
  49. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +2 -2
  50. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +1 -1
  51. package/dist/prod/packages/@ember/-internals/views/lib/system/event_dispatcher.js +1 -1
  52. package/dist/prod/packages/@ember/-internals/views/lib/views/core_view.js +1 -1
  53. package/dist/prod/packages/@ember/application/index.js +1 -1
  54. package/dist/prod/packages/@ember/application/instance.js +3 -3
  55. package/dist/prod/packages/@ember/array/index.js +3 -3
  56. package/dist/prod/packages/@ember/array/proxy.js +3 -3
  57. package/dist/prod/packages/@ember/component/index.js +2 -2
  58. package/dist/prod/packages/@ember/controller/index.js +2 -2
  59. package/dist/prod/packages/@ember/engine/index.js +2 -2
  60. package/dist/prod/packages/@ember/object/computed.js +2 -2
  61. package/dist/prod/packages/@ember/object/index.js +4 -4
  62. package/dist/prod/packages/@ember/object/lib/computed/computed_macros.js +3 -3
  63. package/dist/prod/packages/@ember/object/lib/computed/reduce_computed_macros.js +1 -1
  64. package/dist/prod/packages/@ember/object/mixin.js +1 -1
  65. package/dist/prod/packages/@ember/object/observable.js +3 -3
  66. package/dist/prod/packages/@ember/object/promise-proxy-mixin.js +2 -2
  67. package/dist/prod/packages/@ember/renderer/index.js +1 -1
  68. package/dist/prod/packages/@ember/routing/route.js +3 -3
  69. package/dist/prod/packages/@ember/routing/router.js +2 -2
  70. package/dist/prod/packages/@ember/service/index.js +1 -1
  71. package/dist/prod/packages/@glimmer/node/index.js +2 -2
  72. package/dist/prod/packages/@glimmer/runtime/index.js +3 -3
  73. package/dist/prod/packages/@glimmer/tracking/index.js +1 -1
  74. package/dist/prod/packages/@glimmer/validator/index.js +1 -1
  75. package/dist/prod/packages/ember/version.js +1 -1
  76. package/dist/prod/packages/shared-chunks/{alias-Bod6qdNp.js → alias-CHHuE0LE.js} +2 -2
  77. package/dist/prod/packages/shared-chunks/{api-CQexacBn.js → api-DzOa0Acr.js} +6 -4
  78. package/dist/prod/packages/shared-chunks/{array-BzReKMeW.js → array-CnXdmzOG.js} +1 -1
  79. package/dist/prod/packages/shared-chunks/{computed-DtIStxvq.js → computed-BNdMwGhH.js} +1 -6
  80. package/dist/prod/packages/shared-chunks/{index-npr2B-vu.js → index-CvQQ6l11.js} +3 -3
  81. package/dist/prod/packages/shared-chunks/{injected_property-Y-FadDej.js → injected_property-DqQ0XV7k.js} +1 -1
  82. package/dist/prod/packages/shared-chunks/{property_set-BaQJdVfS.js → property_set-CkLe4ht8.js} +1 -1
  83. package/dist/prod/packages/shared-chunks/{rehydrate-builder-Blt1x9MP.js → rehydrate-builder-n_8RCUj9.js} +1 -1
  84. package/dist/prod/packages/shared-chunks/{render-Dx7lr1hR.js → render-Bf7GviCY.js} +10 -5
  85. package/dist/prod/packages/shared-chunks/{serialize-builder-BvAXYHTr.js → serialize-builder-CsG9WHVw.js} +1 -1
  86. package/dist/prod/packages/shared-chunks/{set_properties-Qxhw4qzw.js → set_properties-Cs3rVemD.js} +2 -2
  87. package/dist/prod/packages/shared-chunks/{setup-registry-Dfu8EyLU.js → setup-registry-kOGgOucf.js} +6 -6
  88. package/dist/prod/packages/shared-chunks/{textarea-DOmZ1x0E.js → textarea-DMmdvgk2.js} +1 -1
  89. package/dist/prod/packages/shared-chunks/tracked-DvOpYI0o.js +235 -0
  90. package/dist/prod/packages/shared-chunks/tracked-value-CR6kx-73.js +115 -0
  91. package/docs/data.json +149 -10
  92. package/package.json +1 -1
  93. package/types/stable/@ember/-internals/glimmer/lib/glimmer-tracking-docs.d.ts +68 -0
  94. package/types/stable/@ember/-internals/metal/lib/tracked.d.ts +53 -6
  95. package/types/stable/@glimmer/tracking/index.d.ts +70 -1
  96. package/types/stable/@glimmer/validator/index.d.ts +1 -0
  97. package/types/stable/@glimmer/validator/lib/tracked-value.d.ts +58 -0
  98. package/types/stable/index.d.ts +1 -0
  99. package/dist/dev/packages/shared-chunks/tracked-DEyf0T_X.js +0 -148
  100. package/dist/dev/packages/shared-chunks/tracked-data-DgqqRdYO.js +0 -31
  101. package/dist/prod/packages/shared-chunks/tracked-B9380JtC.js +0 -132
  102. package/dist/prod/packages/shared-chunks/tracked-data-CHq42QHb.js +0 -31
@@ -1,5 +1,5 @@
1
- import { f as changeProperties } from './computed-BPCtuOxQ.js';
2
- import { s as set } from './property_set-qCUylPEK.js';
1
+ import { f as changeProperties } from './computed-DGxbeUbf.js';
2
+ import { s as set } from './property_set-CVlVgdor.js';
3
3
 
4
4
  /**
5
5
  @module @ember/object
@@ -1,12 +1,12 @@
1
1
  import { privatize } from '../@ember/-internals/container/index.js';
2
2
  import { getOwner } from '../@ember/-internals/owner/index.js';
3
3
  import '../@ember/debug/index.js';
4
- import { I as Input, T as Textarea } from './textarea-C4lYkaHj.js';
4
+ import { I as Input, T as Textarea } from './textarea-DEvw4ezm.js';
5
5
  import { LinkTo } from '../@ember/routing/index.js';
6
- import { i as inTransaction, d as renderMain } from './render-87_sKZ_k.js';
7
- import { c as clientBuilder } from './api-C0PAtEgQ.js';
8
- import { r as rehydrationBuilder } from './rehydrate-builder-C6k1XhET.js';
9
- import { s as serializeBuilder } from './serialize-builder-BlxBjwO-.js';
6
+ import { i as inTransaction, d as renderMain } from './render-CtH73XOv.js';
7
+ import { c as clientBuilder } from './api-Dz70AUL_.js';
8
+ import { r as rehydrationBuilder } from './rehydrate-builder-CsnkZkur.js';
9
+ import { s as serializeBuilder } from './serialize-builder-D1oAeiyl.js';
10
10
  import { g as guidFor } from './guid-Cbq2sNV_.js';
11
11
  import { getViewId, getViewElement } from '../@ember/-internals/views/lib/system/utils.js';
12
12
  import { associateDestroyableChild, isDestroyed, destroy, isDestroying } from '../@glimmer/destroyable/index.js';
@@ -20,7 +20,7 @@ import { _instrumentStart } from '../@ember/instrumentation/index.js';
20
20
  import { c as capabilityFlagsFrom } from './capabilities-CajW4QjE.js';
21
21
  import { C as CONSTANT_TAG, c as consumeTag, D as DIRTY_TAG$1, r as createTag } from './cache-DGDPVCpC.js';
22
22
  import { assert } from '../@ember/debug/lib/assert.js';
23
- import { R as ResolverImpl, B as BaseRenderer, e as errorLoopTransaction } from './index-CCyXUNBa.js';
23
+ import { R as ResolverImpl, B as BaseRenderer, e as errorLoopTransaction } from './index-D1AjYv31.js';
24
24
  import { generateControllerFactory } from '../@ember/routing/lib/generate_controller.js';
25
25
  import { i as internalHelper } from './internal-helper-CKrni0b_.js';
26
26
  import { c as hasInternalComponentManager } from './api-DuLOZMO_.js';
@@ -8,7 +8,7 @@ import { t as templateFactory } from './index-DaFzpTIE.js';
8
8
  import { I as InternalComponent, o as opaquify } from './internal-DTOXyEGM.js';
9
9
  import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from './runtime-CYyqkz5q-BOdRhmsS.js';
10
10
  import { assert } from '../@ember/debug/lib/assert.js';
11
- import { t as tracked } from './tracked-DEyf0T_X.js';
11
+ import { t as tracked } from './tracked-57EW14Ny.js';
12
12
 
13
13
  const InputTemplate = templateFactory(
14
14
  /*
@@ -0,0 +1,253 @@
1
+ import { meta } from '../@ember/-internals/meta/lib/meta.js';
2
+ import { isEmberArray } from '../@ember/array/-internals.js';
3
+ import '../@ember/debug/index.js';
4
+ import { c as consumeTag, u as untrack } from './cache-DGDPVCpC.js';
5
+ import { d as dirtyTagFor, t as tagFor } from './meta-BqC7f9Ia.js';
6
+ import { t as trackedValue, a as trackedData } from './tracked-value-DhyJmrhG.js';
7
+ import { S as SELF_TAG, C as CHAIN_PASS_THROUGH } from './chain-tags-uWSImHzB.js';
8
+ import { s as setClassicDecorator, i as isElementDescriptor, C as COMPUTED_SETTERS } from './decorator-B5Uh5NFI.js';
9
+ import { assert } from '../@ember/debug/lib/assert.js';
10
+
11
+ /**
12
+ @decorator
13
+ @private
14
+
15
+ Marks a property as tracked.
16
+
17
+ By default, a component's properties are expected to be static,
18
+ meaning you are not able to update them and have the template update accordingly.
19
+ Marking a property as tracked means that when that property changes,
20
+ a rerender of the component is scheduled so the template is kept up to date.
21
+
22
+ There are two usages for the `@tracked` decorator, shown below.
23
+
24
+ @example No dependencies
25
+
26
+ If you don't pass an argument to `@tracked`, only changes to that property
27
+ will be tracked:
28
+
29
+ ```typescript
30
+ import Component from '@glimmer/component';
31
+ import { tracked } from '@glimmer/tracking';
32
+
33
+ export default class MyComponent extends Component {
34
+ @tracked
35
+ remainingApples = 10
36
+ }
37
+ ```
38
+
39
+ When something changes the component's `remainingApples` property, the rerender
40
+ will be scheduled.
41
+
42
+ @example Dependents
43
+
44
+ In the case that you have a computed property that depends other
45
+ properties, you want to track both so that when one of the
46
+ dependents change, a rerender is scheduled.
47
+
48
+ In the following example we have two properties,
49
+ `eatenApples`, and `remainingApples`.
50
+
51
+ ```typescript
52
+ import Component from '@glimmer/component';
53
+ import { tracked } from '@glimmer/tracking';
54
+
55
+ const totalApples = 100;
56
+
57
+ export default class MyComponent extends Component {
58
+ @tracked
59
+ eatenApples = 0
60
+
61
+ get remainingApples() {
62
+ return totalApples - this.eatenApples;
63
+ }
64
+
65
+ increment() {
66
+ this.eatenApples = this.eatenApples + 1;
67
+ }
68
+ }
69
+ ```
70
+
71
+ @param dependencies Optional dependents to be tracked.
72
+ */
73
+ /**
74
+ * Reactivity options for the standalone `tracked(value, options)` form.
75
+ *
76
+ * - `equals` decides whether writing a value notifies consumers; it defaults to
77
+ * `Object.is`.
78
+ * - `description` is used in development for debugging.
79
+ *
80
+ * `equals` is a function-typed property (rather than method syntax) on purpose:
81
+ * this keeps its parameters checked strictly, so passing an `equals` typed for
82
+ * the wrong value type is a type error instead of being silently accepted.
83
+ */
84
+
85
+ /**
86
+ * Options for `tracked` used as a decorator, or as a field on a *classic* class
87
+ * (`EmberObject.extend({ foo: tracked({ value }) })`).
88
+ *
89
+ * All properties are optional because this single shape backs several usages:
90
+ * classic-field defaults (`tracked({ value })` / `tracked({ initializer })`) and
91
+ * options-only native decorators (`@tracked({ equals })`). The mutually
92
+ * exclusive combinations (e.g. both `value` and `initializer`) and the
93
+ * classic-only restriction on `value`/`initializer` are enforced at runtime via
94
+ * assertions rather than in the type, matching the runtime `isDecoratorOptions`
95
+ * check that accepts any object composed of these keys.
96
+ *
97
+ * - `value` / `initializer` supply a default value and are only valid on classic
98
+ * classes; native classes use class field initializers instead.
99
+ * - `equals` / `description` configure reactivity, mirroring
100
+ * {@link TrackedValueOptions}.
101
+ */
102
+
103
+ /**
104
+ * `tracked` as a decorator factory: `@tracked({ equals })`, or on classic
105
+ * classes `tracked({ value })` / `tracked({ initializer })`.
106
+ */
107
+
108
+ /**
109
+ * `tracked` as a bare decorator: `@tracked foo = 1`.
110
+ */
111
+
112
+ /**
113
+ * `tracked` as a standalone reactive value, usable outside of classes:
114
+ * `const count = tracked(0)`.
115
+ */
116
+
117
+ function tracked(...args) {
118
+ (!(!(isElementDescriptor(args.slice(0, 3)) && args.length === 5 && args[4] === true)) && assert(`@tracked can only be used directly as a native decorator. If you're using tracked in classic classes, add parenthesis to call it like a function: tracked()`, !(isElementDescriptor(args.slice(0, 3)) && args.length === 5 && args[4] === true)));
119
+ if (isElementDescriptor(args)) {
120
+ /*
121
+ Native-decorator form. The runtime invokes us with `(target, key, desc)`
122
+ and consumes the returned `DecoratorPropertyDescriptor`. The public API is
123
+ the decorated field itself — reading it consumes, assigning it dirties.
124
+ ```js
125
+ class Counter {
126
+ @tracked count = 0;
127
+ }
128
+ ```
129
+ */
130
+ return descriptorForField(args);
131
+ }
132
+ if (args.length === 0 || args.length === 1 && isDecoratorOptions(args[0])) {
133
+ /*
134
+ Decorator-factory / classic-field form. Returns an
135
+ `ExtendedMethodDecorator`. The public API is the resulting property on
136
+ instances (get/set), with any default supplied by `value`/`initializer`.
137
+ ```js
138
+ class Counter {
139
+ @tracked({ equals: (a, b) => a === b }) count = 0;
140
+ }
141
+ const Person = EmberObject.extend({
142
+ name: tracked({ value: 'Zoey' }),
143
+ });
144
+ ```
145
+ */
146
+ return makeTrackedDecorator(args[0]);
147
+ }
148
+ let [initialValue, options] = args;
149
+ (!(options === undefined || typeof options === 'object' && options !== null) && assert(`tracked() may only receive an options object containing 'equals' or 'description' as its second argument, received ${options}`, options === undefined || typeof options === 'object' && options !== null));
150
+ /*
151
+ Standalone-value form. Returns a `TrackedValue` usable outside of classes.
152
+ ```js
153
+ const count = tracked(0);
154
+ count.value; // read (consumes), `Object.is`-based equality
155
+ count.value = 1; // write (dirties)
156
+ count.get(); // function shorthand for reading
157
+ count.set(2); // returns `true` if the value changed
158
+ count.update((n) => n + 1); // write from current, without consuming
159
+ count.freeze(); // prevent further writes
160
+ ```
161
+ */
162
+ return trackedValue(initialValue, options);
163
+ }
164
+ const DECORATOR_OPTION_KEYS = ['value', 'initializer', 'equals', 'description'];
165
+ function isDecoratorOptions(value) {
166
+ if (typeof value !== 'object' || value === null) {
167
+ return false;
168
+ }
169
+ let proto = Object.getPrototypeOf(value);
170
+ if (proto !== Object.prototype && proto !== null) {
171
+ return false;
172
+ }
173
+ return Object.keys(value).every(key => DECORATOR_OPTION_KEYS.includes(key));
174
+ }
175
+ function makeTrackedDecorator(propertyDesc) {
176
+ if (propertyDesc) {
177
+ (!(!('value' in propertyDesc && 'initializer' in propertyDesc)) && assert(`The options object passed to tracked() may only contain a 'value' or an 'initializer' property, not both. Received: [${Object.keys(propertyDesc)}]`, !('value' in propertyDesc && 'initializer' in propertyDesc)));
178
+ (!(!('initializer' in propertyDesc) || typeof propertyDesc.initializer === 'function') && assert(`The initializer passed to tracked must be a function. Received ${propertyDesc.initializer}`, !('initializer' in propertyDesc) || typeof propertyDesc.initializer === 'function'));
179
+ (!(!('equals' in propertyDesc) || typeof propertyDesc.equals === 'function') && assert(`The 'equals' option passed to tracked must be a function. Received ${propertyDesc.equals}`, !('equals' in propertyDesc) || typeof propertyDesc.equals === 'function'));
180
+ (!(!('description' in propertyDesc) || typeof propertyDesc.description === 'string') && assert(`The 'description' option passed to tracked must be a string. Received ${propertyDesc.description}`, !('description' in propertyDesc) || typeof propertyDesc.description === 'string'));
181
+ }
182
+ let initializer = propertyDesc ? propertyDesc.initializer : undefined;
183
+ let value = propertyDesc ? propertyDesc.value : undefined;
184
+ let hasInitialValue = propertyDesc !== undefined && ('value' in propertyDesc || 'initializer' in propertyDesc);
185
+ let options = {
186
+ equals: propertyDesc?.equals,
187
+ description: propertyDesc?.description
188
+ };
189
+ let decorator = function (target, key, desc, _meta, isClassicDecorator) {
190
+ (!(isClassicDecorator || !hasInitialValue) && assert(`You attempted to set a default value for ${key} with the @tracked({ value: 'default' }) syntax. You can only use this syntax with classic classes. For native classes, you can use class initializers: @tracked field = 'default';`, isClassicDecorator || !hasInitialValue));
191
+ let fieldDesc = isClassicDecorator ? {
192
+ initializer: initializer || (() => value)
193
+ } : desc;
194
+ return descriptorForField([target, key, fieldDesc], options);
195
+ };
196
+ setClassicDecorator(decorator);
197
+ return decorator;
198
+ }
199
+ {
200
+ // Normally this isn't a classic decorator, but we want to throw a helpful
201
+ // error in development so we need it to treat it like one
202
+ setClassicDecorator(tracked);
203
+ }
204
+ function descriptorForField([target, key, desc], options) {
205
+ (!(!desc || !desc.value && !desc.get && !desc.set) && assert(`You attempted to use @tracked on ${key}, but that element is not a class field. @tracked is only usable on class fields. Native getters and setters will autotrack add any tracked fields they encounter, so there is no need mark getters and setters with @tracked.`, !desc || !desc.value && !desc.get && !desc.set));
206
+ let {
207
+ getter,
208
+ setter
209
+ } = trackedData(key, desc ? desc.initializer : undefined);
210
+ let equals = options?.equals;
211
+ function get() {
212
+ let value = getter(this);
213
+
214
+ // Add the tag of the returned value if it is an array, since arrays
215
+ // should always cause updates if they are consumed and then changed
216
+ if (Array.isArray(value) || isEmberArray(value)) {
217
+ consumeTag(tagFor(value, '[]'));
218
+ }
219
+ return value;
220
+ }
221
+ function set(newValue) {
222
+ if (equals !== undefined && equals(untrack(() => getter(this)), newValue)) {
223
+ return;
224
+ }
225
+ setter(this, newValue);
226
+ dirtyTagFor(this, SELF_TAG);
227
+ }
228
+ let newDesc = {
229
+ enumerable: true,
230
+ configurable: true,
231
+ isTracked: true,
232
+ get,
233
+ set
234
+ };
235
+ COMPUTED_SETTERS.add(set);
236
+ meta(target).writeDescriptors(key, new TrackedDescriptor(get, set));
237
+ return newDesc;
238
+ }
239
+ class TrackedDescriptor {
240
+ constructor(_get, _set) {
241
+ this._get = _get;
242
+ this._set = _set;
243
+ CHAIN_PASS_THROUGH.add(this);
244
+ }
245
+ get(obj) {
246
+ return this._get.call(obj);
247
+ }
248
+ set(obj, _key, value) {
249
+ this._set.call(obj, value);
250
+ }
251
+ }
252
+
253
+ export { TrackedDescriptor as T, tracked as t };
@@ -0,0 +1,115 @@
1
+ import { d as dirtyTagFor, t as tagFor } from './meta-BqC7f9Ia.js';
2
+ import { c as consumeTag, b as createUpdatableTag, D as DIRTY_TAG } from './cache-DGDPVCpC.js';
3
+
4
+ function trackedData(key, initializer) {
5
+ let values = new WeakMap();
6
+ let hasInitializer = typeof initializer === 'function';
7
+ function getter(self) {
8
+ consumeTag(tagFor(self, key));
9
+ let value;
10
+
11
+ // If the field has never been initialized, we should initialize it
12
+ if (hasInitializer && !values.has(self)) {
13
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
14
+ value = initializer.call(self);
15
+ values.set(self, value);
16
+ } else {
17
+ value = values.get(self);
18
+ }
19
+ return value;
20
+ }
21
+ function setter(self, value) {
22
+ dirtyTagFor(self, key);
23
+ values.set(self, value);
24
+ }
25
+ return {
26
+ getter,
27
+ setter
28
+ };
29
+ }
30
+
31
+ /**
32
+ * A mutable reactive value.
33
+ *
34
+ * Reading `value` consumes the underlying tag (entangling with any active
35
+ * tracking frame), and writing `value` dirties it.
36
+ */
37
+
38
+ /**
39
+ * A reactive value that can only be read.
40
+ */
41
+
42
+ class TrackedValue {
43
+ #isFrozen = false;
44
+ #value;
45
+ #options;
46
+ #tag;
47
+ constructor(value, options) {
48
+ this.#value = value;
49
+ this.#options = options;
50
+ this.#tag = createUpdatableTag();
51
+ }
52
+
53
+ /**
54
+ * The underlying value.
55
+ *
56
+ * Reading entangles with the current tracking frame, and writing notifies
57
+ * consumers (unless the configured `equals` deems the new value equal to
58
+ * the current one).
59
+ */
60
+ get value() {
61
+ consumeTag(this.#tag);
62
+ return this.#value;
63
+ }
64
+ set value(value) {
65
+ this.set(value);
66
+ }
67
+
68
+ /**
69
+ * Function short-hand for reading `value`.
70
+ */
71
+ get = () => {
72
+ return this.value;
73
+ };
74
+
75
+ /**
76
+ * Function short-hand for assigning `value`.
77
+ *
78
+ * Returns `true` if the value changed (and consumers were notified),
79
+ * `false` if the new value was equal to the current one.
80
+ */
81
+ set = value => {
82
+ if (this.#isFrozen) {
83
+ throw new Error(`Cannot update a frozen TrackedValue${this.#options.description ? ` (\`${this.#options.description}\`)` : ''}`);
84
+ }
85
+ if (this.#options.equals(this.#value, value)) {
86
+ return false;
87
+ }
88
+ this.#value = value;
89
+ DIRTY_TAG(this.#tag);
90
+ return true;
91
+ };
92
+
93
+ /**
94
+ * Update the value based on the current value, without consuming it.
95
+ */
96
+ update = updater => {
97
+ this.set(updater(this.#value));
98
+ };
99
+
100
+ /**
101
+ * Prevents further updates, making the TrackedValue behave as a
102
+ * ReadOnlyReactive.
103
+ */
104
+ freeze = () => {
105
+ this.#isFrozen = true;
106
+ };
107
+ }
108
+ function trackedValue(value, options) {
109
+ return new TrackedValue(value, {
110
+ equals: options?.equals ?? Object.is,
111
+ description: options?.description
112
+ });
113
+ }
114
+
115
+ export { TrackedValue as T, trackedData as a, trackedValue as t };
@@ -1,17 +1,17 @@
1
1
  export { t as template, a as templateCacheCounters } from '../../../shared-chunks/index-Bf53M8eS.js';
2
- export { O as OutletView, R as Renderer, a as RootTemplate, s as setupApplicationRegistry, b as setupEngineRegistry } from '../../../shared-chunks/setup-registry-Dfu8EyLU.js';
3
- export { I as Input, T as Textarea } from '../../../shared-chunks/textarea-DOmZ1x0E.js';
2
+ export { O as OutletView, R as Renderer, a as RootTemplate, s as setupApplicationRegistry, b as setupEngineRegistry } from '../../../shared-chunks/setup-registry-kOGgOucf.js';
3
+ export { I as Input, T as Textarea } from '../../../shared-chunks/textarea-DMmdvgk2.js';
4
4
  export { LinkTo } from '../../routing/index.js';
5
5
  export { default as Component, setComponentManager } from '../../component/index.js';
6
6
  export { default as Helper, helper } from '../../component/helper.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 { D as DOMChanges } from '../../../shared-chunks/render-Dx7lr1hR.js';
9
- export { D as DOMTreeConstruction } from '../../../shared-chunks/api-CQexacBn.js';
10
- export { i as isSerializationFirstNode } from '../../../shared-chunks/rehydrate-builder-Blt1x9MP.js';
8
+ export { D as DOMChanges } from '../../../shared-chunks/render-Bf7GviCY.js';
9
+ export { D as DOMTreeConstruction } from '../../../shared-chunks/api-DzOa0Acr.js';
10
+ export { i as isSerializationFirstNode } from '../../../shared-chunks/rehydrate-builder-n_8RCUj9.js';
11
11
  export { NodeDOMTreeConstruction } from '../../../@glimmer/node/index.js';
12
12
  export { e as element } from '../../../shared-chunks/element-DgHdPZ8u.js';
13
13
  export { u as uniqueId } from '../../../shared-chunks/unique-id-o2pS74go.js';
14
- export { _ as _resetRenderers, r as renderComponent, a as renderSettled } from '../../../shared-chunks/index-npr2B-vu.js';
14
+ export { _ as _resetRenderers, r as renderComponent, a as renderSettled } from '../../../shared-chunks/index-CvQQ6l11.js';
15
15
  export { c as componentCapabilities, m as modifierCapabilities } from '../../../shared-chunks/api-B_poQGXS.js';
16
16
 
17
17
  // STATE within a module is frowned upon, this exists
@@ -1,20 +1,20 @@
1
- export { C as ComputedProperty, P as PROPERTY_DID_CHANGE, i as autoComputed, b as beginPropertyChanges, f as changeProperties, c as computed, h as defineDecorator, d as defineProperty, g as defineValue, a as endPropertyChanges, e as expandProperties, j as isComputed, n as notifyPropertyChange } from '../../../shared-chunks/computed-DtIStxvq.js';
1
+ export { C as ComputedProperty, P as PROPERTY_DID_CHANGE, i as autoComputed, b as beginPropertyChanges, f as changeProperties, c as computed, h as defineDecorator, d as defineProperty, g as defineValue, a as endPropertyChanges, e as expandProperties, j as isComputed, n as notifyPropertyChange } from '../../../shared-chunks/computed-BNdMwGhH.js';
2
2
  export { g as getCachedValueFor } from '../../../shared-chunks/computed_cache-DmYKevAP.js';
3
- export { a as alias } from '../../../shared-chunks/alias-Bod6qdNp.js';
3
+ export { a as alias } from '../../../shared-chunks/alias-CHHuE0LE.js';
4
4
  import { g as get } from '../../../shared-chunks/property_get-DAKgbeJX.js';
5
5
  export { P as PROXY_CONTENT, _ as _getPath, a as _getProp, h as hasUnknownProperty } from '../../../shared-chunks/property_get-DAKgbeJX.js';
6
- import { s as set } from '../../../shared-chunks/property_set-BaQJdVfS.js';
7
- export { _ as _setProp, t as trySet } from '../../../shared-chunks/property_set-BaQJdVfS.js';
8
- export { c as addArrayObserver, b as arrayContentDidChange, a as arrayContentWillChange, d as removeArrayObserver, r as replace, e as replaceInNativeArray } from '../../../shared-chunks/array-BzReKMeW.js';
6
+ import { s as set } from '../../../shared-chunks/property_set-CkLe4ht8.js';
7
+ export { _ as _setProp, t as trySet } from '../../../shared-chunks/property_set-CkLe4ht8.js';
8
+ export { c as addArrayObserver, b as arrayContentDidChange, a as arrayContentWillChange, d as removeArrayObserver, r as replace, e as replaceInNativeArray } from '../../../shared-chunks/array-CnXdmzOG.js';
9
9
  export { a as addListener, h as hasListeners, o as on, r as removeListener, s as sendEvent } from '../../../shared-chunks/events-DYrYz3V8.js';
10
10
  export { c as ComputedDescriptor, b as descriptorForDecorator, d as descriptorForProperty, a as isClassicDecorator, i as isElementDescriptor, m as makeComputedDecorator, n as nativeDescDecorator, s as setClassicDecorator } from '../../../shared-chunks/decorator-9ikVwsjY.js';
11
11
  export { L as Libraries, a as libraries } from '../../../shared-chunks/libraries-DBql0hdn.js';
12
12
  export { g as getProperties } from '../../../shared-chunks/get_properties-Dg3xFpiS.js';
13
- export { s as setProperties } from '../../../shared-chunks/set_properties-Qxhw4qzw.js';
13
+ export { s as setProperties } from '../../../shared-chunks/set_properties-Cs3rVemD.js';
14
14
  export { A as ASYNC_OBSERVERS, S as SYNC_OBSERVERS, a as activateObserver, b as addObserver, f as flushAsyncObservers, r as removeObserver, c as revalidateObservers } from '../../../shared-chunks/observers-BmobpXAF.js';
15
- export { D as DEBUG_INJECTION_FUNCTIONS, i as inject } from '../../../shared-chunks/injected_property-Y-FadDej.js';
15
+ export { D as DEBUG_INJECTION_FUNCTIONS, i as inject } from '../../../shared-chunks/injected_property-DqQ0XV7k.js';
16
16
  export { m as markObjectAsDirty, o as objectAt, t as tagForObject, a as tagForProperty } from '../../../shared-chunks/chain-tags-B2J7DsxO.js';
17
- export { T as TrackedDescriptor, t as tracked } from '../../../shared-chunks/tracked-B9380JtC.js';
17
+ export { T as TrackedDescriptor, t as tracked } from '../../../shared-chunks/tracked-DvOpYI0o.js';
18
18
  export { cached } from '../../../@glimmer/tracking/index.js';
19
19
  export { e as createCache, g as getValue, i as isConst } from '../../../shared-chunks/cache-CofLhaS4.js';
20
20
  export { N as NAMESPACES, a as NAMESPACES_BY_ID, b as addNamespace, f as findNamespace, c as findNamespaces, i as isNamespaceSearchDisabled, p as processAllNamespaces, d as processNamespace, r as removeNamespace, e as setNamespaceSearchDisabled, s as setUnprocessedMixins } from '../../../shared-chunks/namespace_search-BfvzEQzN.js';
@@ -1,8 +1,8 @@
1
1
  import { meta } from '../../../meta/lib/meta.js';
2
2
  import Mixin from '../../../../object/mixin.js';
3
3
  import { g as get } from '../../../../../shared-chunks/property_get-DAKgbeJX.js';
4
- import { s as set } from '../../../../../shared-chunks/property_set-BaQJdVfS.js';
5
- import { d as defineProperty, c as computed } from '../../../../../shared-chunks/computed-DtIStxvq.js';
4
+ import { s as set } from '../../../../../shared-chunks/property_set-CkLe4ht8.js';
5
+ import { d as defineProperty, c as computed } from '../../../../../shared-chunks/computed-BNdMwGhH.js';
6
6
  import { t as tagForObject, a as tagForProperty } from '../../../../../shared-chunks/chain-tags-B2J7DsxO.js';
7
7
  import { s as setProxy } from '../../../../../shared-chunks/is_proxy-Bzg0d4m4.js';
8
8
  import { i as isObject } from '../../../../../shared-chunks/spec-BXl1reqK.js';
@@ -1,6 +1,6 @@
1
1
  import { context } from '../../../environment/index.js';
2
2
  import { g as get } from '../../../../../shared-chunks/property_get-DAKgbeJX.js';
3
- import { c as computed } from '../../../../../shared-chunks/computed-DtIStxvq.js';
3
+ import { c as computed } from '../../../../../shared-chunks/computed-BNdMwGhH.js';
4
4
  import Mixin from '../../../../object/mixin.js';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { g as get } from '../../../../../shared-chunks/property_get-DAKgbeJX.js';
2
- import { s as set } from '../../../../../shared-chunks/property_set-BaQJdVfS.js';
2
+ import { s as set } from '../../../../../shared-chunks/property_set-CkLe4ht8.js';
3
3
  import EmberObject from '../../../../object/index.js';
4
4
  import { getElementView } from './utils.js';
5
5
 
@@ -1,4 +1,4 @@
1
- import { i as inject } from '../../../../../shared-chunks/injected_property-Y-FadDej.js';
1
+ import { i as inject } from '../../../../../shared-chunks/injected_property-DqQ0XV7k.js';
2
2
  import ActionHandler from '../../../runtime/lib/mixins/action_handler.js';
3
3
  import Evented from '../../../../object/evented.js';
4
4
  import { FrameworkObject } from '../../../../object/-internals.js';
@@ -23,7 +23,7 @@ import BucketCache from '../routing/lib/cache.js';
23
23
  import ApplicationInstance from './instance.js';
24
24
  import Engine, { buildInitializerMethod } from '../engine/index.js';
25
25
  import { privatize } from '../-internals/container/index.js';
26
- import { s as setupApplicationRegistry } from '../../shared-chunks/setup-registry-Dfu8EyLU.js';
26
+ import { s as setupApplicationRegistry } from '../../shared-chunks/setup-registry-kOGgOucf.js';
27
27
  import RouterService from '../routing/router-service.js';
28
28
 
29
29
  /**
@@ -1,5 +1,5 @@
1
1
  import { g as get } from '../../shared-chunks/property_get-DAKgbeJX.js';
2
- import { s as set } from '../../shared-chunks/property_set-BaQJdVfS.js';
2
+ import { s as set } from '../../shared-chunks/property_set-CkLe4ht8.js';
3
3
  import { e as environment } from '../../shared-chunks/index-Cc8WmrB-.js';
4
4
  import EngineInstance from '../engine/instance.js';
5
5
  import '../-internals/container/index.js';
@@ -7,7 +7,7 @@ import '../../shared-chunks/guid-Cbq2sNV_.js';
7
7
  import '../../shared-chunks/reference-CG0yPgLy.js';
8
8
  import '../../shared-chunks/arguments-BzAkZVBa.js';
9
9
  import '../../shared-chunks/cache-CofLhaS4.js';
10
- import '../../shared-chunks/render-Dx7lr1hR.js';
10
+ import '../../shared-chunks/render-Bf7GviCY.js';
11
11
  import '../../shared-chunks/curly-a6DP7r87.js';
12
12
  import '../../shared-chunks/outlet--lIm3q7t.js';
13
13
  import '../../shared-chunks/env-DXxsTFkM.js';
@@ -16,7 +16,7 @@ import '../../shared-chunks/hash-gEXIsSO4.js';
16
16
  import '../../shared-chunks/get-Dago5uGl.js';
17
17
  import '../../shared-chunks/on-BZHAxzdq.js';
18
18
  import '../../shared-chunks/template-only-DKNcKM5b.js';
19
- import { a as renderSettled } from '../../shared-chunks/index-npr2B-vu.js';
19
+ import { a as renderSettled } from '../../shared-chunks/index-CvQQ6l11.js';
20
20
  import '../../shared-chunks/unique-id-o2pS74go.js';
21
21
  import '../runloop/index.js';
22
22
  import '../routing/router.js';
@@ -1,8 +1,8 @@
1
1
  import { o as objectAt } from '../../shared-chunks/chain-tags-B2J7DsxO.js';
2
- import { e as replaceInNativeArray, r as replace } from '../../shared-chunks/array-BzReKMeW.js';
3
- import { b as beginPropertyChanges, a as endPropertyChanges, c as computed } from '../../shared-chunks/computed-DtIStxvq.js';
2
+ import { e as replaceInNativeArray, r as replace } from '../../shared-chunks/array-CnXdmzOG.js';
3
+ import { b as beginPropertyChanges, a as endPropertyChanges, c as computed } from '../../shared-chunks/computed-BNdMwGhH.js';
4
4
  import { g as get } from '../../shared-chunks/property_get-DAKgbeJX.js';
5
- import { s as set } from '../../shared-chunks/property_set-BaQJdVfS.js';
5
+ import { s as set } from '../../shared-chunks/property_set-CkLe4ht8.js';
6
6
  import Mixin from '../object/mixin.js';
7
7
  import Enumerable from '../enumerable/index.js';
8
8
  import MutableEnumerable from '../enumerable/mutable.js';
@@ -1,7 +1,7 @@
1
1
  import { o as objectAt, a as tagForProperty } from '../../shared-chunks/chain-tags-B2J7DsxO.js';
2
- import { a as alias } from '../../shared-chunks/alias-Bod6qdNp.js';
3
- import { P as PROPERTY_DID_CHANGE } from '../../shared-chunks/computed-DtIStxvq.js';
4
- import { r as replace, a as arrayContentWillChange, b as arrayContentDidChange, c as addArrayObserver, d as removeArrayObserver } from '../../shared-chunks/array-BzReKMeW.js';
2
+ import { a as alias } from '../../shared-chunks/alias-CHHuE0LE.js';
3
+ import { P as PROPERTY_DID_CHANGE } from '../../shared-chunks/computed-BNdMwGhH.js';
4
+ import { r as replace, a as arrayContentWillChange, b as arrayContentDidChange, c as addArrayObserver, d as removeArrayObserver } from '../../shared-chunks/array-CnXdmzOG.js';
5
5
  import { g as get } from '../../shared-chunks/property_get-DAKgbeJX.js';
6
6
  import { i as isObject } from '../../shared-chunks/spec-BXl1reqK.js';
7
7
  import EmberObject from '../object/index.js';
@@ -1,7 +1,7 @@
1
1
  export { g as getComponentTemplate, s as setComponentTemplate } from '../../shared-chunks/template-Dc_cBOoX.js';
2
2
  import { n as nativeDescDecorator } from '../../shared-chunks/decorator-9ikVwsjY.js';
3
3
  import { g as get } from '../../shared-chunks/property_get-DAKgbeJX.js';
4
- import { P as PROPERTY_DID_CHANGE } from '../../shared-chunks/computed-DtIStxvq.js';
4
+ import { P as PROPERTY_DID_CHANGE } from '../../shared-chunks/computed-BNdMwGhH.js';
5
5
  import { getOwner } from '../-internals/owner/index.js';
6
6
  import TargetActionSupport from '../-internals/runtime/lib/mixins/target_action_support.js';
7
7
  import ActionSupport from '../-internals/views/lib/mixins/action_support.js';
@@ -16,7 +16,7 @@ import { r as createTag, D as DIRTY_TAG$1 } from '../../shared-chunks/cache-CofL
16
16
  import { I as IS_DISPATCHING_ATTRS, D as DIRTY_TAG, B as BOUNDS, g as getComponentCapturedArgs, b as CURLY_COMPONENT_MANAGER } from '../../shared-chunks/curly-a6DP7r87.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-DOmZ1x0E.js';
19
+ export { I as Input, T as Textarea } from '../../shared-chunks/textarea-DMmdvgk2.js';
20
20
  import { s as setComponentManager$1 } from '../../shared-chunks/api-B_poQGXS.js';
21
21
  export { c as capabilities } from '../../shared-chunks/api-B_poQGXS.js';
22
22
  import '../../shared-chunks/capabilities-BuVYh-vx.js';
@@ -1,8 +1,8 @@
1
1
  import { getOwner } from '../-internals/owner/index.js';
2
- import { c as computed } from '../../shared-chunks/computed-DtIStxvq.js';
2
+ import { c as computed } from '../../shared-chunks/computed-BNdMwGhH.js';
3
3
  import { g as get } from '../../shared-chunks/property_get-DAKgbeJX.js';
4
4
  import { FrameworkObject } from '../object/-internals.js';
5
- import { i as inject$1 } from '../../shared-chunks/injected_property-Y-FadDej.js';
5
+ import { i as inject$1 } from '../../shared-chunks/injected_property-DqQ0XV7k.js';
6
6
  import Mixin from '../object/mixin.js';
7
7
  import ActionHandler from '../-internals/runtime/lib/mixins/action_handler.js';
8
8
 
@@ -5,13 +5,13 @@ import { Registry } from '../-internals/container/index.js';
5
5
  import DAG from '../../dag-map/index.js';
6
6
  import ContainerDebugAdapter from '../debug/container-debug-adapter.js';
7
7
  import { g as get } from '../../shared-chunks/property_get-DAKgbeJX.js';
8
- import { s as set } from '../../shared-chunks/property_set-BaQJdVfS.js';
8
+ import { s as set } from '../../shared-chunks/property_set-CkLe4ht8.js';
9
9
  import EngineInstance from './instance.js';
10
10
  import '../../route-recognizer/index.js';
11
11
  import '../../shared-chunks/rsvp.es-DR7yS7qg.js';
12
12
  import '../../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
13
13
  import RoutingService from '../routing/lib/routing-service.js';
14
- import { b as setupEngineRegistry } from '../../shared-chunks/setup-registry-Dfu8EyLU.js';
14
+ import { b as setupEngineRegistry } from '../../shared-chunks/setup-registry-kOGgOucf.js';
15
15
  import RegistryProxyMixin from '../-internals/runtime/lib/mixins/registry_proxy.js';
16
16
  import { StrictResolver } from './lib/strict-resolver.js';
17
17
 
@@ -1,4 +1,4 @@
1
- export { C as default, e as expandProperties } from '../../shared-chunks/computed-DtIStxvq.js';
2
- export { a as alias } from '../../shared-chunks/alias-Bod6qdNp.js';
1
+ export { C as default, e as expandProperties } from '../../shared-chunks/computed-BNdMwGhH.js';
2
+ export { a as alias } from '../../shared-chunks/alias-CHHuE0LE.js';
3
3
  export { and, bool, deprecatingAlias, empty, equal, gt, gte, lt, lte, match, none, not, notEmpty, oneWay, or, readOnly, oneWay as reads } from './lib/computed/computed_macros.js';
4
4
  export { collect, filter, filterBy, intersect, map, mapBy, max, min, setDiff, sort, sum, union, uniq, uniqBy } from './lib/computed/reduce_computed_macros.js';