ember-source 5.11.0 → 5.11.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/ember-template-compiler.js +48 -42
- package/dist/ember-testing.js +1 -1
- package/dist/ember.debug.js +23102 -23100
- package/dist/ember.prod.js +31562 -31563
- package/dist/packages/@ember/-internals/container/index.js +1 -1
- package/dist/packages/@ember/-internals/deprecations/index.js +2 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +2 -1
- package/dist/packages/@ember/-internals/meta/lib/meta.js +4 -3
- package/dist/packages/@ember/-internals/metal/index.js +9 -8
- package/dist/packages/@ember/-internals/routing/index.js +6 -5
- package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +3 -2
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +6 -5
- package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -3
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +2 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +4 -3
- package/dist/packages/@ember/-internals/string/index.js +1 -1
- package/dist/packages/@ember/-internals/utils/index.js +4 -4
- package/dist/packages/@ember/-internals/views/index.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/compat/fallback-view-registry.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/component_lookup.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +5 -3
- package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +3 -3
- package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +4 -3
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -3
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +6 -12
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +3 -2
- package/dist/packages/@ember/-internals/views/lib/views/core_view.js +76 -8
- package/dist/packages/@ember/-internals/views/lib/views/states.js +4 -3
- package/dist/packages/@ember/application/index.js +16 -7
- package/dist/packages/@ember/application/instance.js +13 -9
- package/dist/packages/@ember/application/namespace.js +7 -6
- package/dist/packages/@ember/array/index.js +617 -11
- package/dist/packages/@ember/array/make.js +1 -0
- package/dist/packages/@ember/array/mutable.js +1 -1
- package/dist/packages/@ember/array/proxy.js +8 -5
- package/dist/packages/@ember/component/helper.js +4 -4
- package/dist/packages/@ember/component/index.js +4 -4
- package/dist/packages/@ember/controller/index.js +6 -6
- package/dist/packages/@ember/debug/container-debug-adapter.js +5 -4
- package/dist/packages/@ember/debug/data-adapter.js +7 -4
- package/dist/packages/@ember/debug/index.js +213 -4
- package/dist/packages/@ember/debug/lib/assert.js +47 -0
- package/dist/packages/@ember/debug/lib/deprecate.js +194 -4
- package/dist/packages/@ember/debug/lib/inspect.js +120 -2
- package/dist/packages/@ember/debug/lib/warn.js +94 -3
- package/dist/packages/@ember/engine/index.js +440 -17
- package/dist/packages/@ember/engine/instance.js +175 -11
- package/dist/packages/@ember/engine/parent.js +1 -0
- package/dist/packages/@ember/helper/index.js +4 -4
- package/dist/packages/@ember/instrumentation/index.js +2 -1
- package/dist/packages/@ember/modifier/index.js +13 -5
- package/dist/packages/@ember/modifier/on.js +15 -0
- package/dist/packages/@ember/object/-internals.js +6 -5
- package/dist/packages/@ember/object/compat.js +4 -3
- package/dist/packages/@ember/object/computed.js +4 -4
- package/dist/packages/@ember/object/core.js +861 -14
- package/dist/packages/@ember/object/evented.js +4 -4
- package/dist/packages/@ember/object/events.js +3 -3
- package/dist/packages/@ember/object/index.js +260 -9
- package/dist/packages/@ember/object/internals.js +1 -1
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +8 -6
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +8 -4
- package/dist/packages/@ember/object/mixin.js +6 -5
- package/dist/packages/@ember/object/observable.js +103 -9
- package/dist/packages/@ember/object/observers.js +3 -3
- package/dist/packages/@ember/object/promise-proxy-mixin.js +5 -5
- package/dist/packages/@ember/renderer/index.js +4 -4
- package/dist/packages/@ember/routing/-internals.js +3 -1
- package/dist/packages/@ember/routing/hash-location.js +2 -2
- package/dist/packages/@ember/routing/history-location.js +3 -2
- package/dist/packages/@ember/routing/index.js +4 -4
- package/dist/packages/@ember/routing/lib/dsl.js +2 -1
- package/dist/packages/@ember/routing/lib/generate_controller.js +4 -3
- package/dist/packages/@ember/routing/lib/router_state.js +26 -1
- package/dist/packages/@ember/routing/lib/routing-service.js +107 -9
- package/dist/packages/@ember/routing/lib/utils.js +238 -7
- package/dist/packages/@ember/routing/none-location.js +3 -2
- package/dist/packages/@ember/routing/route.js +1618 -22
- package/dist/packages/@ember/routing/router-service.js +638 -12
- package/dist/packages/@ember/routing/router.js +1449 -14
- package/dist/packages/@ember/runloop/index.js +760 -6
- package/dist/packages/@ember/service/index.js +3 -3
- package/dist/packages/@ember/template/index.js +4 -4
- package/dist/packages/@ember/utils/index.js +2 -1
- package/dist/packages/@ember/utils/lib/compare.js +159 -4
- package/dist/packages/@ember/utils/lib/is_empty.js +4 -4
- package/dist/packages/@ember/utils/lib/type-of.js +110 -1
- package/dist/packages/@glimmer/tracking/index.js +3 -3
- package/dist/packages/@glimmer/tracking/primitives/cache.js +3 -3
- package/dist/packages/ember/barrel.js +28 -13
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/adapter.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/qunit.js +2 -1
- package/dist/packages/ember-testing/lib/ext/application.js +2 -1
- package/dist/packages/ember-testing/lib/ext/rsvp.js +1 -1
- package/dist/packages/ember-testing/lib/helpers/and_then.js +2 -1
- package/dist/packages/ember-testing/lib/helpers/current_path.js +8 -6
- package/dist/packages/ember-testing/lib/helpers/current_route_name.js +8 -6
- package/dist/packages/ember-testing/lib/helpers/current_url.js +6 -5
- package/dist/packages/ember-testing/lib/helpers/pause_test.js +2 -1
- package/dist/packages/ember-testing/lib/helpers/visit.js +4 -3
- package/dist/packages/ember-testing/lib/helpers/wait.js +4 -3
- package/dist/packages/ember-testing/lib/initializers.js +15 -8
- package/dist/packages/ember-testing/lib/setup_for_testing.js +1 -1
- package/dist/packages/ember-testing/lib/test/run.js +1 -1
- package/dist/packages/router_js/index.js +2 -1
- package/dist/packages/shared-chunks/{alias-By_2yu5c.js → alias-Dri0koi2.js} +5 -3
- package/dist/packages/shared-chunks/array-3xbmc_4J.js +119 -0
- package/dist/packages/shared-chunks/{cache-gDE3bkXq.js → cache-BESCGvbE.js} +667 -1529
- package/dist/packages/shared-chunks/{core_view-Cxne2_wu.js → chunk-3SQBS3Y5-Cj4eryg1.js} +1 -88
- package/dist/packages/shared-chunks/{index-BXPoca1S.js → index-Llq6dmgX.js} +40 -4660
- package/dist/packages/shared-chunks/{is_proxy-Dmis-70B.js → is_proxy-DjvCKvd5.js} +1 -1
- package/dist/packages/shared-chunks/{mandatory-setter-1UQhiJOb.js → mandatory-setter-BiXq-dpN.js} +2 -1
- package/dist/packages/shared-chunks/{name-z9D9Yibn.js → name-Dx2bGFVv.js} +1 -1
- package/dist/packages/shared-chunks/{namespace_search-CBgHTkDh.js → namespace_search-btMaPM-_.js} +2 -2
- package/dist/packages/shared-chunks/{property_set-CW4q-uo4.js → property_set-BapAkp3X.js} +5 -4
- package/dist/packages/shared-chunks/{registry-DzfcDwii.js → registry-B8WARvkP.js} +3 -2
- package/dist/packages/shared-chunks/{router-B-Q1aYBn.js → router-DrLZsJeE.js} +2 -482
- package/dist/packages/shared-chunks/{set_properties-DvalyQdu.js → set_properties-BScfxzvI.js} +2 -2
- package/dist/packages/shared-chunks/setup-registry-du4pSGZi.js +48 -0
- package/dist/packages/shared-chunks/{to-string-D8i3mjEU.js → to-string-B1BmwUkt.js} +1 -1
- package/dist/packages/shared-chunks/unrecognized-url-error-zpz-JEoG.js +484 -0
- package/docs/data.json +152 -142
- package/package.json +2 -2
- package/types/stable/@ember/-internals/metal/lib/array.d.ts +1 -2
- package/types/stable/@ember/-internals/metal/lib/object-at.d.ts +4 -0
- package/types/stable/@ember/-internals/metal/lib/observer.d.ts +2 -1
- package/types/stable/@ember/array/index.d.ts +1 -1
- package/types/stable/@ember/array/make.d.ts +3 -0
- package/types/stable/@ember/debug/index.d.ts +3 -7
- package/types/stable/@ember/debug/lib/assert.d.ts +8 -0
- package/types/stable/@ember/engine/index.d.ts +1 -1
- package/types/stable/@ember/engine/instance.d.ts +2 -2
- package/types/stable/@ember/engine/parent.d.ts +3 -0
- package/types/stable/@ember/modifier/index.d.ts +1 -3
- package/types/stable/@ember/modifier/on.d.ts +5 -0
- package/types/stable/@ember/routing/lib/routing-service.d.ts +1 -1
- package/types/stable/@ember/routing/route.d.ts +2 -3
- package/types/stable/@ember/routing/router-service.d.ts +1 -1
- package/types/stable/@ember/routing/router.d.ts +4 -4
- package/types/stable/ember/barrel.d.ts +1 -1
- package/types/stable/ember/index.d.ts +1 -1
- package/types/stable/index.d.ts +5 -0
- package/dist/packages/shared-chunks/index-DTxy4Zgx.js +0 -641
- package/dist/packages/shared-chunks/index-PYiGj1jp.js +0 -2071
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import '../-internals/meta/lib/meta.js';
|
|
2
|
-
import '../../shared-chunks/mandatory-setter-
|
|
2
|
+
import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
3
3
|
import '@embroider/macros';
|
|
4
|
-
import '
|
|
4
|
+
import '../debug/index.js';
|
|
5
5
|
import '../../@glimmer/destroyable/index.js';
|
|
6
6
|
import '../../@glimmer/validator/index.js';
|
|
7
|
-
import { z as addListener, I as sendEvent, A as removeListener, J as hasListeners } from '../../shared-chunks/cache-gDE3bkXq.js';
|
|
8
|
-
export { K as on } from '../../shared-chunks/cache-gDE3bkXq.js';
|
|
9
7
|
import '../../@glimmer/manager/index.js';
|
|
8
|
+
import { G as addListener, k as sendEvent, H as removeListener, x as hasListeners } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
9
|
+
export { N as on } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
10
10
|
import '../../shared-chunks/env-BJLX2Arx.js';
|
|
11
11
|
import Mixin from './mixin.js';
|
|
12
12
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../-internals/meta/lib/meta.js';
|
|
2
|
-
import '../../shared-chunks/mandatory-setter-
|
|
2
|
+
import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
3
3
|
import '@embroider/macros';
|
|
4
|
-
import '
|
|
4
|
+
import '../debug/index.js';
|
|
5
5
|
import '../../@glimmer/destroyable/index.js';
|
|
6
6
|
import '../../@glimmer/validator/index.js';
|
|
7
|
-
export { z as addListener, A as removeListener, I as sendEvent } from '../../shared-chunks/cache-gDE3bkXq.js';
|
|
8
7
|
import '../../@glimmer/manager/index.js';
|
|
8
|
+
export { G as addListener, H as removeListener, k as sendEvent } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
9
9
|
import '../../shared-chunks/env-BJLX2Arx.js';
|
|
@@ -1,13 +1,264 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import '../../shared-chunks/env-BJLX2Arx.js';
|
|
3
|
-
|
|
1
|
+
import '../debug/index.js';
|
|
2
|
+
import { E as ENV } from '../../shared-chunks/env-BJLX2Arx.js';
|
|
3
|
+
import { s as setClassicDecorator, i as isElementDescriptor, e as expandProperties } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
4
|
+
export { c as computed, d as defineProperty, g as get, n as notifyPropertyChange } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
4
5
|
import '../-internals/meta/lib/meta.js';
|
|
5
6
|
import '../../@glimmer/validator/index.js';
|
|
6
|
-
import '../../shared-chunks/mandatory-setter-
|
|
7
|
-
import '@embroider/macros';
|
|
7
|
+
import { s as setObservers } from '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
8
|
+
import { isDevelopingApp } from '@embroider/macros';
|
|
8
9
|
import '../../@glimmer/destroyable/index.js';
|
|
9
10
|
import '../../@glimmer/manager/index.js';
|
|
10
|
-
export { s as set, t as trySet } from '../../shared-chunks/property_set-
|
|
11
|
-
export { g as getProperties, s as setProperties } from '../../shared-chunks/set_properties-
|
|
12
|
-
import '../../shared-chunks/registry-
|
|
13
|
-
|
|
11
|
+
export { s as set, t as trySet } from '../../shared-chunks/property_set-BapAkp3X.js';
|
|
12
|
+
export { g as getProperties, s as setProperties } from '../../shared-chunks/set_properties-BScfxzvI.js';
|
|
13
|
+
import { g as getFactoryFor } from '../../shared-chunks/registry-B8WARvkP.js';
|
|
14
|
+
import CoreObject from './core.js';
|
|
15
|
+
import Observable from './observable.js';
|
|
16
|
+
import { assert } from '../debug/lib/assert.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
@module @ember/object
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
`EmberObject` is the main base class for all Ember objects. It is a subclass
|
|
24
|
+
of `CoreObject` with the `Observable` mixin applied. For details,
|
|
25
|
+
see the documentation for each of these.
|
|
26
|
+
|
|
27
|
+
@class EmberObject
|
|
28
|
+
@extends CoreObject
|
|
29
|
+
@uses Observable
|
|
30
|
+
@public
|
|
31
|
+
*/
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
33
|
+
|
|
34
|
+
class EmberObject extends CoreObject.extend(Observable) {
|
|
35
|
+
get _debugContainerKey() {
|
|
36
|
+
let factory = getFactoryFor(this);
|
|
37
|
+
return factory !== undefined && factory.fullName;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
Decorator that turns the target function into an Action which can be accessed
|
|
43
|
+
directly by reference.
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import Component from '@ember/component';
|
|
47
|
+
import { action, set } from '@ember/object';
|
|
48
|
+
|
|
49
|
+
export default class Tooltip extends Component {
|
|
50
|
+
@action
|
|
51
|
+
toggleShowing() {
|
|
52
|
+
set(this, 'isShowing', !this.isShowing);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
```hbs
|
|
57
|
+
<!-- template.hbs -->
|
|
58
|
+
<button {{action this.toggleShowing}}>Show tooltip</button>
|
|
59
|
+
|
|
60
|
+
{{#if isShowing}}
|
|
61
|
+
<div class="tooltip">
|
|
62
|
+
I'm a tooltip!
|
|
63
|
+
</div>
|
|
64
|
+
{{/if}}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Decorated actions also interop with the string style template actions:
|
|
68
|
+
|
|
69
|
+
```hbs
|
|
70
|
+
<!-- template.hbs -->
|
|
71
|
+
<button {{action "toggleShowing"}}>Show tooltip</button>
|
|
72
|
+
|
|
73
|
+
{{#if isShowing}}
|
|
74
|
+
<div class="tooltip">
|
|
75
|
+
I'm a tooltip!
|
|
76
|
+
</div>
|
|
77
|
+
{{/if}}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
It also binds the function directly to the instance, so it can be used in any
|
|
81
|
+
context and will correctly refer to the class it came from:
|
|
82
|
+
|
|
83
|
+
```hbs
|
|
84
|
+
<!-- template.hbs -->
|
|
85
|
+
<button
|
|
86
|
+
{{did-insert this.toggleShowing}}
|
|
87
|
+
{{on "click" this.toggleShowing}}
|
|
88
|
+
>
|
|
89
|
+
Show tooltip
|
|
90
|
+
</button>
|
|
91
|
+
|
|
92
|
+
{{#if isShowing}}
|
|
93
|
+
<div class="tooltip">
|
|
94
|
+
I'm a tooltip!
|
|
95
|
+
</div>
|
|
96
|
+
{{/if}}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
This can also be used in JavaScript code directly:
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
import Component from '@ember/component';
|
|
103
|
+
import { action, set } from '@ember/object';
|
|
104
|
+
|
|
105
|
+
export default class Tooltip extends Component {
|
|
106
|
+
constructor() {
|
|
107
|
+
super(...arguments);
|
|
108
|
+
|
|
109
|
+
// this.toggleShowing is still bound correctly when added to
|
|
110
|
+
// the event listener
|
|
111
|
+
document.addEventListener('click', this.toggleShowing);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@action
|
|
115
|
+
toggleShowing() {
|
|
116
|
+
set(this, 'isShowing', !this.isShowing);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This is considered best practice, since it means that methods will be bound
|
|
122
|
+
correctly no matter where they are used. By contrast, the `{{action}}` helper
|
|
123
|
+
and modifier can also be used to bind context, but it will be required for
|
|
124
|
+
every usage of the method:
|
|
125
|
+
|
|
126
|
+
```hbs
|
|
127
|
+
<!-- template.hbs -->
|
|
128
|
+
<button
|
|
129
|
+
{{did-insert (action this.toggleShowing)}}
|
|
130
|
+
{{on "click" (action this.toggleShowing)}}
|
|
131
|
+
>
|
|
132
|
+
Show tooltip
|
|
133
|
+
</button>
|
|
134
|
+
|
|
135
|
+
{{#if isShowing}}
|
|
136
|
+
<div class="tooltip">
|
|
137
|
+
I'm a tooltip!
|
|
138
|
+
</div>
|
|
139
|
+
{{/if}}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
They also do not have equivalents in JavaScript directly, so they cannot be
|
|
143
|
+
used for other situations where binding would be useful.
|
|
144
|
+
|
|
145
|
+
@public
|
|
146
|
+
@method action
|
|
147
|
+
@for @ember/object
|
|
148
|
+
@static
|
|
149
|
+
@param {Function|undefined} callback The function to turn into an action,
|
|
150
|
+
when used in classic classes
|
|
151
|
+
@return {PropertyDecorator} property decorator instance
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
const BINDINGS_MAP = new WeakMap();
|
|
155
|
+
function hasProto(obj) {
|
|
156
|
+
return obj != null && obj.constructor !== undefined && typeof obj.constructor.proto === 'function';
|
|
157
|
+
}
|
|
158
|
+
function setupAction(target, key, actionFn) {
|
|
159
|
+
if (hasProto(target)) {
|
|
160
|
+
target.constructor.proto();
|
|
161
|
+
}
|
|
162
|
+
if (!Object.prototype.hasOwnProperty.call(target, 'actions')) {
|
|
163
|
+
let parentActions = target.actions;
|
|
164
|
+
// we need to assign because of the way mixins copy actions down when inheriting
|
|
165
|
+
target.actions = parentActions ? Object.assign({}, parentActions) : {};
|
|
166
|
+
}
|
|
167
|
+
(isDevelopingApp() && !(target.actions != null) && assert("[BUG] Somehow the target doesn't have actions!", target.actions != null));
|
|
168
|
+
target.actions[key] = actionFn;
|
|
169
|
+
return {
|
|
170
|
+
get() {
|
|
171
|
+
let bindings = BINDINGS_MAP.get(this);
|
|
172
|
+
if (bindings === undefined) {
|
|
173
|
+
bindings = new Map();
|
|
174
|
+
BINDINGS_MAP.set(this, bindings);
|
|
175
|
+
}
|
|
176
|
+
let fn = bindings.get(actionFn);
|
|
177
|
+
if (fn === undefined) {
|
|
178
|
+
fn = actionFn.bind(this);
|
|
179
|
+
bindings.set(actionFn, fn);
|
|
180
|
+
}
|
|
181
|
+
return fn;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function action(...args) {
|
|
186
|
+
let actionFn;
|
|
187
|
+
if (!isElementDescriptor(args)) {
|
|
188
|
+
actionFn = args[0];
|
|
189
|
+
let decorator = function (target, key, _desc, _meta, isClassicDecorator) {
|
|
190
|
+
(isDevelopingApp() && !(isClassicDecorator) && assert('The @action decorator may only be passed a method when used in classic classes. You should decorate methods directly in native classes', isClassicDecorator));
|
|
191
|
+
(isDevelopingApp() && !(typeof actionFn === 'function') && assert('The action() decorator must be passed a method when used in classic classes', typeof actionFn === 'function'));
|
|
192
|
+
return setupAction(target, key, actionFn);
|
|
193
|
+
};
|
|
194
|
+
setClassicDecorator(decorator);
|
|
195
|
+
return decorator;
|
|
196
|
+
}
|
|
197
|
+
let [target, key, desc] = args;
|
|
198
|
+
actionFn = desc?.value;
|
|
199
|
+
(isDevelopingApp() && !(typeof actionFn === 'function') && assert('The @action decorator must be applied to methods when used in native classes', typeof actionFn === 'function')); // SAFETY: TS types are weird with decorators. This should work.
|
|
200
|
+
return setupAction(target, key, actionFn);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// SAFETY: TS types are weird with decorators. This should work.
|
|
204
|
+
setClassicDecorator(action);
|
|
205
|
+
|
|
206
|
+
// ..........................................................
|
|
207
|
+
// OBSERVER HELPER
|
|
208
|
+
//
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
Specify a method that observes property changes.
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
import EmberObject from '@ember/object';
|
|
215
|
+
import { observer } from '@ember/object';
|
|
216
|
+
|
|
217
|
+
export default EmberObject.extend({
|
|
218
|
+
valueObserver: observer('value', function() {
|
|
219
|
+
// Executes whenever the "value" property changes
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Also available as `Function.prototype.observes` if prototype extensions are
|
|
225
|
+
enabled.
|
|
226
|
+
|
|
227
|
+
@method observer
|
|
228
|
+
@for @ember/object
|
|
229
|
+
@param {String} propertyNames*
|
|
230
|
+
@param {Function} func
|
|
231
|
+
@return func
|
|
232
|
+
@public
|
|
233
|
+
@static
|
|
234
|
+
*/
|
|
235
|
+
function observer(...args) {
|
|
236
|
+
let funcOrDef = args.pop();
|
|
237
|
+
(isDevelopingApp() && !(typeof funcOrDef === 'function' || typeof funcOrDef === 'object' && funcOrDef !== null) && assert('observer must be provided a function or an observer definition', typeof funcOrDef === 'function' || typeof funcOrDef === 'object' && funcOrDef !== null));
|
|
238
|
+
let func;
|
|
239
|
+
let dependentKeys;
|
|
240
|
+
let sync;
|
|
241
|
+
if (typeof funcOrDef === 'function') {
|
|
242
|
+
func = funcOrDef;
|
|
243
|
+
dependentKeys = args;
|
|
244
|
+
sync = !ENV._DEFAULT_ASYNC_OBSERVERS;
|
|
245
|
+
} else {
|
|
246
|
+
func = funcOrDef.fn;
|
|
247
|
+
dependentKeys = funcOrDef.dependentKeys;
|
|
248
|
+
sync = funcOrDef.sync;
|
|
249
|
+
}
|
|
250
|
+
(isDevelopingApp() && !(typeof func === 'function') && assert('observer called without a function', typeof func === 'function'));
|
|
251
|
+
(isDevelopingApp() && !(Array.isArray(dependentKeys) && dependentKeys.length > 0 && dependentKeys.every(p => typeof p === 'string' && Boolean(p.length))) && assert('observer called without valid path', Array.isArray(dependentKeys) && dependentKeys.length > 0 && dependentKeys.every(p => typeof p === 'string' && Boolean(p.length))));
|
|
252
|
+
(isDevelopingApp() && !(typeof sync === 'boolean') && assert('observer called without sync', typeof sync === 'boolean'));
|
|
253
|
+
let paths = [];
|
|
254
|
+
for (let dependentKey of dependentKeys) {
|
|
255
|
+
expandProperties(dependentKey, path => paths.push(path));
|
|
256
|
+
}
|
|
257
|
+
setObservers(func, {
|
|
258
|
+
paths,
|
|
259
|
+
sync
|
|
260
|
+
});
|
|
261
|
+
return func;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export { action, EmberObject as default, observer };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { i as isElementDescriptor, c as computed, g as get, e as expandProperties } from '../../../../shared-chunks/cache-
|
|
1
|
+
import { i as isElementDescriptor, c as computed, g as get, e as expandProperties } from '../../../../shared-chunks/cache-BESCGvbE.js';
|
|
2
2
|
import '../../../-internals/meta/lib/meta.js';
|
|
3
|
-
import { a as alias } from '../../../../shared-chunks/alias-
|
|
4
|
-
import {
|
|
5
|
-
import { s as set } from '../../../../shared-chunks/property_set-
|
|
3
|
+
import { a as alias } from '../../../../shared-chunks/alias-Dri0koi2.js';
|
|
4
|
+
import { deprecate } from '../../../debug/index.js';
|
|
5
|
+
import { s as set } from '../../../../shared-chunks/property_set-BapAkp3X.js';
|
|
6
6
|
import { isDevelopingApp } from '@embroider/macros';
|
|
7
|
-
import '../../../../shared-chunks/mandatory-setter-
|
|
7
|
+
import '../../../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
8
8
|
import '../../../../@glimmer/destroyable/index.js';
|
|
9
9
|
import '../../../../@glimmer/manager/index.js';
|
|
10
10
|
import '../../../../@glimmer/validator/index.js';
|
|
11
11
|
import '../../../../shared-chunks/env-BJLX2Arx.js';
|
|
12
|
-
import '
|
|
12
|
+
import '../../index.js';
|
|
13
13
|
import isNone from '../../../utils/lib/is_none.js';
|
|
14
14
|
import isEmpty from '../../../utils/lib/is_empty.js';
|
|
15
|
+
import '../../core.js';
|
|
15
16
|
import '../../../-internals/runtime/lib/mixins/registry_proxy.js';
|
|
16
17
|
import '../../../-internals/runtime/lib/mixins/container_proxy.js';
|
|
17
18
|
import '../../../-internals/runtime/lib/mixins/comparable.js';
|
|
@@ -20,6 +21,7 @@ import '../../../-internals/runtime/lib/mixins/-proxy.js';
|
|
|
20
21
|
import '../../../enumerable/mutable.js';
|
|
21
22
|
import '../../../-internals/runtime/lib/mixins/target_action_support.js';
|
|
22
23
|
import '../../../-internals/runtime/lib/ext/rsvp.js';
|
|
24
|
+
import { assert } from '../../../debug/lib/assert.js';
|
|
23
25
|
|
|
24
26
|
function expandPropertiesToArray(predicateName, properties) {
|
|
25
27
|
let expandedProperties = [];
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { i as isElementDescriptor, g as get, c as computed,
|
|
1
|
+
import '../../../debug/index.js';
|
|
2
|
+
import { i as isElementDescriptor, g as get, c as computed, R as autoComputed } from '../../../../shared-chunks/cache-BESCGvbE.js';
|
|
3
3
|
import '../../../-internals/meta/lib/meta.js';
|
|
4
4
|
import '../../../../@glimmer/validator/index.js';
|
|
5
|
-
import '../../../../shared-chunks/mandatory-setter-
|
|
5
|
+
import '../../../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
6
6
|
import { isDevelopingApp } from '@embroider/macros';
|
|
7
7
|
import '../../../../@glimmer/destroyable/index.js';
|
|
8
8
|
import '../../../../@glimmer/manager/index.js';
|
|
9
9
|
import '../../../../shared-chunks/env-BJLX2Arx.js';
|
|
10
|
-
import
|
|
10
|
+
import '../../index.js';
|
|
11
|
+
import '../../core.js';
|
|
12
|
+
import compare from '../../../utils/lib/compare.js';
|
|
13
|
+
import EmberArray, { uniqBy as uniqBy$1, A } from '../../../array/index.js';
|
|
14
|
+
import { assert } from '../../../debug/lib/assert.js';
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
@module @ember/object
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { I as INIT_FACTORY } from '../../shared-chunks/registry-
|
|
1
|
+
import { I as INIT_FACTORY } from '../../shared-chunks/registry-B8WARvkP.js';
|
|
2
2
|
import { meta, peekMeta } from '../-internals/meta/lib/meta.js';
|
|
3
|
-
import { R as ROOT, g as guidFor, o as observerListenerMetaFor, w as wrap } from '../../shared-chunks/mandatory-setter-
|
|
3
|
+
import { R as ROOT, g as guidFor, o as observerListenerMetaFor, w as wrap } from '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
4
4
|
import { isDevelopingApp } from '@embroider/macros';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
5
|
+
import '../debug/index.js';
|
|
6
|
+
import { y as defineValue, z as defineDecorator, A as revalidateObservers, B as nativeDescDecorator, f as isClassicDecorator, E as descriptorForDecorator, C as ComputedProperty, F as makeComputedDecorator, v as addObserver, w as removeObserver, G as addListener, H as removeListener } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
7
7
|
import '../../@glimmer/validator/index.js';
|
|
8
8
|
import '../../@glimmer/destroyable/index.js';
|
|
9
9
|
import '../../@glimmer/manager/index.js';
|
|
10
|
-
import { s as setUnprocessedMixins } from '../../shared-chunks/namespace_search-
|
|
10
|
+
import { s as setUnprocessedMixins } from '../../shared-chunks/namespace_search-btMaPM-_.js';
|
|
11
|
+
import { assert } from '../debug/lib/assert.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
@module @ember/object/mixin
|
|
@@ -1,13 +1,107 @@
|
|
|
1
|
-
import '../-internals/meta/lib/meta.js';
|
|
2
|
-
import '../../shared-chunks/mandatory-setter-
|
|
3
|
-
import '@embroider/macros';
|
|
4
|
-
import '
|
|
1
|
+
import { peekMeta } from '../-internals/meta/lib/meta.js';
|
|
2
|
+
import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
3
|
+
import { isDevelopingApp } from '@embroider/macros';
|
|
4
|
+
import '../debug/index.js';
|
|
5
5
|
import '../../@glimmer/destroyable/index.js';
|
|
6
6
|
import '../../@glimmer/validator/index.js';
|
|
7
|
-
import '../../shared-chunks/cache-gDE3bkXq.js';
|
|
8
7
|
import '../../@glimmer/manager/index.js';
|
|
9
|
-
import '../../shared-chunks/
|
|
10
|
-
import '../../shared-chunks/
|
|
8
|
+
import { g as get, l as endPropertyChanges, n as notifyPropertyChange, v as addObserver, w as removeObserver, x as hasListeners, m as beginPropertyChanges } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
9
|
+
import { s as set } from '../../shared-chunks/property_set-BapAkp3X.js';
|
|
10
|
+
import { g as getProperties, s as setProperties } from '../../shared-chunks/set_properties-BScfxzvI.js';
|
|
11
11
|
import '../../shared-chunks/env-BJLX2Arx.js';
|
|
12
|
-
|
|
13
|
-
import '
|
|
12
|
+
import Mixin from './mixin.js';
|
|
13
|
+
import { assert } from '../debug/lib/assert.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
@module @ember/object/observable
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const Observable = Mixin.create({
|
|
20
|
+
get(keyName) {
|
|
21
|
+
return get(this, keyName);
|
|
22
|
+
},
|
|
23
|
+
getProperties(...args) {
|
|
24
|
+
return getProperties(this, ...args);
|
|
25
|
+
},
|
|
26
|
+
set(keyName, value) {
|
|
27
|
+
return set(this, keyName, value);
|
|
28
|
+
},
|
|
29
|
+
setProperties(hash) {
|
|
30
|
+
return setProperties(this, hash);
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
Begins a grouping of property changes.
|
|
34
|
+
You can use this method to group property changes so that notifications
|
|
35
|
+
will not be sent until the changes are finished. If you plan to make a
|
|
36
|
+
large number of changes to an object at one time, you should call this
|
|
37
|
+
method at the beginning of the changes to begin deferring change
|
|
38
|
+
notifications. When you are done making changes, call
|
|
39
|
+
`endPropertyChanges()` to deliver the deferred change notifications and end
|
|
40
|
+
deferring.
|
|
41
|
+
@method beginPropertyChanges
|
|
42
|
+
@return {Observable}
|
|
43
|
+
@private
|
|
44
|
+
*/
|
|
45
|
+
beginPropertyChanges() {
|
|
46
|
+
beginPropertyChanges();
|
|
47
|
+
return this;
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
Ends a grouping of property changes.
|
|
51
|
+
You can use this method to group property changes so that notifications
|
|
52
|
+
will not be sent until the changes are finished. If you plan to make a
|
|
53
|
+
large number of changes to an object at one time, you should call
|
|
54
|
+
`beginPropertyChanges()` at the beginning of the changes to defer change
|
|
55
|
+
notifications. When you are done making changes, call this method to
|
|
56
|
+
deliver the deferred change notifications and end deferring.
|
|
57
|
+
@method endPropertyChanges
|
|
58
|
+
@return {Observable}
|
|
59
|
+
@private
|
|
60
|
+
*/
|
|
61
|
+
endPropertyChanges() {
|
|
62
|
+
endPropertyChanges();
|
|
63
|
+
return this;
|
|
64
|
+
},
|
|
65
|
+
notifyPropertyChange(keyName) {
|
|
66
|
+
notifyPropertyChange(this, keyName);
|
|
67
|
+
return this;
|
|
68
|
+
},
|
|
69
|
+
addObserver(key, target, method, sync) {
|
|
70
|
+
addObserver(this, key, target, method, sync);
|
|
71
|
+
return this;
|
|
72
|
+
},
|
|
73
|
+
removeObserver(key, target, method, sync) {
|
|
74
|
+
removeObserver(this, key, target, method, sync);
|
|
75
|
+
return this;
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
Returns `true` if the object currently has observers registered for a
|
|
79
|
+
particular key. You can use this method to potentially defer performing
|
|
80
|
+
an expensive action until someone begins observing a particular property
|
|
81
|
+
on the object.
|
|
82
|
+
@method hasObserverFor
|
|
83
|
+
@param {String} key Key to check
|
|
84
|
+
@return {Boolean}
|
|
85
|
+
@private
|
|
86
|
+
*/
|
|
87
|
+
hasObserverFor(key) {
|
|
88
|
+
return hasListeners(this, `${key}:change`);
|
|
89
|
+
},
|
|
90
|
+
incrementProperty(keyName, increment = 1) {
|
|
91
|
+
(isDevelopingApp() && !(!isNaN(parseFloat(String(increment))) && isFinite(increment)) && assert('Must pass a numeric value to incrementProperty', !isNaN(parseFloat(String(increment))) && isFinite(increment)));
|
|
92
|
+
return set(this, keyName, (parseFloat(get(this, keyName)) || 0) + increment);
|
|
93
|
+
},
|
|
94
|
+
decrementProperty(keyName, decrement = 1) {
|
|
95
|
+
(isDevelopingApp() && !((typeof decrement === 'number' || !isNaN(parseFloat(decrement))) && isFinite(decrement)) && assert('Must pass a numeric value to decrementProperty', (typeof decrement === 'number' || !isNaN(parseFloat(decrement))) && isFinite(decrement)));
|
|
96
|
+
return set(this, keyName, (get(this, keyName) || 0) - decrement);
|
|
97
|
+
},
|
|
98
|
+
toggleProperty(keyName) {
|
|
99
|
+
return set(this, keyName, !get(this, keyName));
|
|
100
|
+
},
|
|
101
|
+
cacheFor(keyName) {
|
|
102
|
+
let meta = peekMeta(this);
|
|
103
|
+
return meta !== null ? meta.valueFor(keyName) : undefined;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export { Observable as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../-internals/meta/lib/meta.js';
|
|
2
|
-
import '../../shared-chunks/mandatory-setter-
|
|
2
|
+
import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
3
3
|
import '@embroider/macros';
|
|
4
|
-
import '
|
|
4
|
+
import '../debug/index.js';
|
|
5
5
|
import '../../@glimmer/destroyable/index.js';
|
|
6
6
|
import '../../@glimmer/validator/index.js';
|
|
7
|
-
export { x as addObserver, y as removeObserver } from '../../shared-chunks/cache-gDE3bkXq.js';
|
|
8
7
|
import '../../@glimmer/manager/index.js';
|
|
8
|
+
export { v as addObserver, w as removeObserver } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
9
9
|
import '../../shared-chunks/env-BJLX2Arx.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import './index.js';
|
|
2
2
|
import Mixin from './mixin.js';
|
|
3
|
-
import { c as computed, g as get } from '../../shared-chunks/cache-
|
|
3
|
+
import { c as computed, g as get } from '../../shared-chunks/cache-BESCGvbE.js';
|
|
4
4
|
import '../-internals/meta/lib/meta.js';
|
|
5
|
-
import '
|
|
5
|
+
import '../debug/index.js';
|
|
6
6
|
import '../../@glimmer/validator/index.js';
|
|
7
|
-
import '../../shared-chunks/mandatory-setter-
|
|
7
|
+
import '../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
8
8
|
import '@embroider/macros';
|
|
9
9
|
import '../../@glimmer/destroyable/index.js';
|
|
10
10
|
import '../../@glimmer/manager/index.js';
|
|
11
|
-
import { s as setProperties } from '../../shared-chunks/set_properties-
|
|
11
|
+
import { s as setProperties } from '../../shared-chunks/set_properties-BScfxzvI.js';
|
|
12
12
|
import '../../shared-chunks/env-BJLX2Arx.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../../@glimmer/opcode-compiler/index.js';
|
|
2
|
-
export { r as renderSettled } from '../../shared-chunks/index-
|
|
3
|
-
import '../../shared-chunks/registry-
|
|
4
|
-
import '
|
|
2
|
+
export { r as renderSettled } from '../../shared-chunks/index-Llq6dmgX.js';
|
|
3
|
+
import '../../shared-chunks/registry-B8WARvkP.js';
|
|
4
|
+
import '../debug/index.js';
|
|
5
5
|
import '../../@glimmer/runtime/index.js';
|
|
6
|
-
import '
|
|
6
|
+
import '../runloop/index.js';
|
|
7
7
|
import '../../@glimmer/reference/index.js';
|
|
8
8
|
import '../../@glimmer/validator/index.js';
|
|
9
9
|
import '@embroider/macros';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { default as RouterState } from './lib/router_state.js';
|
|
2
|
+
export { default as RoutingService } from './lib/routing-service.js';
|
|
3
|
+
export { prefixRouteNameArg } from './lib/utils.js';
|
|
2
4
|
export { default as generateController, generateControllerFactory } from './lib/generate_controller.js';
|
|
3
5
|
export { default as BucketCache } from './lib/cache.js';
|
|
4
6
|
export { default as DSL } from './lib/dsl.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import EmberObject from '../object/index.js';
|
|
2
|
+
import { bind } from '../runloop/index.js';
|
|
3
3
|
import { getHash } from './lib/location-utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import EmberObject from '../object/index.js';
|
|
2
|
+
import '../debug/index.js';
|
|
3
3
|
import { getHash } from './lib/location-utils.js';
|
|
4
4
|
import { isDevelopingApp } from '@embroider/macros';
|
|
5
|
+
import { assert } from '../debug/lib/assert.js';
|
|
5
6
|
|
|
6
7
|
let popstateFired = false;
|
|
7
8
|
function _uuid() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../../@glimmer/opcode-compiler/index.js';
|
|
2
|
-
export { L as LinkTo } from '../../shared-chunks/index-
|
|
3
|
-
import '../../shared-chunks/registry-
|
|
4
|
-
import '
|
|
2
|
+
export { L as LinkTo } from '../../shared-chunks/index-Llq6dmgX.js';
|
|
3
|
+
import '../../shared-chunks/registry-B8WARvkP.js';
|
|
4
|
+
import '../debug/index.js';
|
|
5
5
|
import '../../@glimmer/runtime/index.js';
|
|
6
|
-
import '
|
|
6
|
+
import '../runloop/index.js';
|
|
7
7
|
import '../../@glimmer/reference/index.js';
|
|
8
8
|
import '../../@glimmer/validator/index.js';
|
|
9
9
|
import '@embroider/macros';
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import '../../-internals/meta/lib/meta.js';
|
|
2
|
-
import '../../../shared-chunks/mandatory-setter-
|
|
2
|
+
import '../../../shared-chunks/mandatory-setter-BiXq-dpN.js';
|
|
3
3
|
import { isDevelopingApp } from '@embroider/macros';
|
|
4
|
-
import {
|
|
4
|
+
import { info } from '../../debug/index.js';
|
|
5
5
|
import '../../../@glimmer/destroyable/index.js';
|
|
6
6
|
import '../../../@glimmer/validator/index.js';
|
|
7
|
-
import { g as get } from '../../../shared-chunks/cache-gDE3bkXq.js';
|
|
8
7
|
import '../../../@glimmer/manager/index.js';
|
|
8
|
+
import { g as get } from '../../../shared-chunks/cache-BESCGvbE.js';
|
|
9
9
|
import '../../../shared-chunks/env-BJLX2Arx.js';
|
|
10
10
|
import Controller from '../../controller/index.js';
|
|
11
|
+
import { assert } from '../../debug/lib/assert.js';
|
|
11
12
|
|
|
12
13
|
function generateControllerFactory(owner, controllerName) {
|
|
13
14
|
let factoryManager = owner.factoryFor('controller:basic');
|