ember-source 7.2.0-beta.1 → 7.3.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 +10 -0
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +3 -3
- package/dist/dev/packages/@ember/-internals/routing/index.js +1 -1
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/comparable.js +5 -0
- package/dist/dev/packages/@ember/application/index.js +2 -2
- package/dist/dev/packages/@ember/application/instance.js +21 -1
- package/dist/dev/packages/@ember/component/helper.js +321 -1
- package/dist/dev/packages/@ember/component/index.js +1 -1
- package/dist/dev/packages/@ember/engine/index.js +2 -2
- package/dist/dev/packages/@ember/renderer/index.js +1 -1
- package/dist/dev/packages/@ember/routing/-internals.js +1 -1
- package/dist/dev/packages/@ember/routing/lib/routing-service.js +0 -1
- package/dist/dev/packages/@ember/routing/lib/utils.js +1 -1
- package/dist/dev/packages/@ember/routing/route.js +1 -1
- package/dist/dev/packages/@ember/routing/router-service.js +0 -1
- package/dist/dev/packages/@ember/routing/router.js +1 -1
- package/dist/dev/packages/@ember/utils/lib/compare.js +5 -2
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/router_js/index.js +2 -2
- package/dist/dev/packages/shared-chunks/{curly-Ei5G8jhk.js → curly-DGUCLOud.js} +4 -5
- package/dist/dev/packages/shared-chunks/curly-brand-B_F79Dep.js +12 -0
- package/dist/dev/packages/shared-chunks/helper-brand-C9_8vvOf.js +12 -0
- package/dist/dev/packages/shared-chunks/{index-B3pPx1fL.js → index-CCyXUNBa.js} +616 -1573
- package/dist/dev/packages/shared-chunks/outlet-CHFL7tun.js +135 -0
- package/dist/dev/packages/shared-chunks/setup-registry-BHdDJATP.js +951 -0
- package/dist/dev/packages/shared-chunks/{unrecognized-url-error-BJHjL30Q.js → unrecognized-url-error-B8loxkay.js} +1 -1
- package/dist/prod/packages/@ember/-internals/deprecations/index.js +10 -0
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +3 -3
- package/dist/prod/packages/@ember/-internals/routing/index.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/comparable.js +5 -0
- package/dist/prod/packages/@ember/application/index.js +2 -2
- package/dist/prod/packages/@ember/application/instance.js +17 -2
- package/dist/prod/packages/@ember/component/helper.js +305 -1
- package/dist/prod/packages/@ember/component/index.js +1 -1
- package/dist/prod/packages/@ember/engine/index.js +2 -2
- package/dist/prod/packages/@ember/renderer/index.js +1 -1
- package/dist/prod/packages/@ember/routing/lib/routing-service.js +0 -1
- package/dist/prod/packages/@ember/routing/lib/utils.js +1 -1
- package/dist/prod/packages/@ember/routing/route.js +1 -1
- package/dist/prod/packages/@ember/routing/router-service.js +0 -1
- package/dist/prod/packages/@ember/routing/router.js +1 -1
- package/dist/prod/packages/@ember/utils/lib/compare.js +5 -2
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/router_js/index.js +2 -2
- package/dist/prod/packages/shared-chunks/{curly-IY06zACp.js → curly-a6DP7r87.js} +4 -5
- package/dist/prod/packages/shared-chunks/curly-brand-B_F79Dep.js +12 -0
- package/dist/prod/packages/shared-chunks/helper-brand-C9_8vvOf.js +12 -0
- package/dist/prod/packages/shared-chunks/{index-CslMfEpb.js → index-npr2B-vu.js} +546 -1449
- package/dist/prod/packages/shared-chunks/outlet--lIm3q7t.js +132 -0
- package/dist/prod/packages/shared-chunks/setup-registry-Dfu8EyLU.js +886 -0
- package/dist/prod/packages/shared-chunks/{unrecognized-url-error-EgNrnFu_.js → unrecognized-url-error-jjQ-FqKB.js} +1 -1
- package/docs/data.json +279 -214
- package/package.json +6 -6
- package/types/stable/@ember/-internals/deprecations/index.d.ts +6 -0
- package/types/stable/@ember/-internals/glimmer/lib/base-renderer.d.ts +150 -0
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly-brand.d.ts +10 -0
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly.d.ts +3 -2
- package/types/stable/@ember/-internals/glimmer/lib/helper-brand.d.ts +10 -0
- package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +4 -6
- package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +7 -154
- package/types/stable/@ember/-internals/glimmer/lib/router-resolver.d.ts +17 -0
- package/types/stable/@ember/renderer/index.d.ts +2 -2
- package/types/stable/index.d.ts +590 -586
- package/dist/dev/packages/shared-chunks/helper-DIj85_-f.js +0 -326
- package/dist/dev/packages/shared-chunks/setup-registry-9DCmHTFF.js +0 -77
- package/dist/prod/packages/shared-chunks/helper-DkXiTBjc.js +0 -310
- package/dist/prod/packages/shared-chunks/setup-registry-U-6VaNQG.js +0 -74
|
@@ -362,7 +362,7 @@ class Transition {
|
|
|
362
362
|
@public
|
|
363
363
|
*/
|
|
364
364
|
finally(callback, label) {
|
|
365
|
-
// @ts-expect-error @types/rsvp doesn't have the correct
|
|
365
|
+
// @ts-expect-error @types/rsvp doesn't have the correct signature for RSVP.Promise.finally
|
|
366
366
|
return this.promise.finally(callback, label);
|
|
367
367
|
}
|
|
368
368
|
|
|
@@ -100,6 +100,16 @@ const DEPRECATIONS = {
|
|
|
100
100
|
},
|
|
101
101
|
until: '7.0.0',
|
|
102
102
|
url: 'https://deprecations.emberjs.com/id/importing-inject-from-ember-service'
|
|
103
|
+
}),
|
|
104
|
+
DEPRECATE_COMPARABLE_MIXIN: deprecation({
|
|
105
|
+
for: 'ember-source',
|
|
106
|
+
id: 'deprecate-comparable-mixin',
|
|
107
|
+
since: {
|
|
108
|
+
available: '7.2.0',
|
|
109
|
+
enabled: '7.2.0'
|
|
110
|
+
},
|
|
111
|
+
until: '7.5.0',
|
|
112
|
+
url: 'https://deprecations.emberjs.com/id/deprecate-comparable-mixin'
|
|
103
113
|
})
|
|
104
114
|
};
|
|
105
115
|
function deprecateUntil(message, deprecation) {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export { t as template, a as templateCacheCounters } from '../../../shared-chunks/index-Bf53M8eS.js';
|
|
2
|
-
export { R as RootTemplate, s as setupApplicationRegistry,
|
|
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
3
|
export { I as Input, T as Textarea } from '../../../shared-chunks/textarea-DOmZ1x0E.js';
|
|
4
4
|
export { LinkTo } from '../../routing/index.js';
|
|
5
5
|
export { default as Component, setComponentManager } from '../../component/index.js';
|
|
6
|
-
export {
|
|
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 { O as OutletView, R as Renderer, _ as _resetRenderers, r as renderComponent, a as renderSettled } from '../../../shared-chunks/index-CslMfEpb.js';
|
|
9
8
|
export { D as DOMChanges } from '../../../shared-chunks/render-Dx7lr1hR.js';
|
|
10
9
|
export { D as DOMTreeConstruction } from '../../../shared-chunks/api-CQexacBn.js';
|
|
11
10
|
export { i as isSerializationFirstNode } from '../../../shared-chunks/rehydrate-builder-Blt1x9MP.js';
|
|
12
11
|
export { NodeDOMTreeConstruction } from '../../../@glimmer/node/index.js';
|
|
13
12
|
export { e as element } from '../../../shared-chunks/element-DgHdPZ8u.js';
|
|
14
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';
|
|
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
|
|
@@ -2,7 +2,7 @@ import '../../../shared-chunks/property_get-DAKgbeJX.js';
|
|
|
2
2
|
import '../../engine/instance.js';
|
|
3
3
|
import '../../../route-recognizer/index.js';
|
|
4
4
|
import '../../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
5
|
-
import '../../../shared-chunks/unrecognized-url-error-
|
|
5
|
+
import '../../../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
|
|
6
6
|
import '../../routing/lib/routing-service.js';
|
|
7
7
|
export { default as generateController, generateControllerFactory } from '../../routing/lib/generate_controller.js';
|
|
8
8
|
export { default as RouterDSL } from '../../routing/lib/dsl.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Mixin from '../../../../object/mixin.js';
|
|
2
|
+
import { deprecateUntil, DEPRECATIONS } from '../../../deprecations/index.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
@module ember
|
|
@@ -31,6 +32,10 @@ const Comparable = Mixin.create({
|
|
|
31
32
|
@return {Number} the result of the comparison
|
|
32
33
|
@private
|
|
33
34
|
*/
|
|
35
|
+
init() {
|
|
36
|
+
this._super(...arguments);
|
|
37
|
+
deprecateUntil('The `Comparable` mixin is deprecated. Implement a `compare` method directly on your class instead.', DEPRECATIONS.DEPRECATE_COMPARABLE_MIXIN);
|
|
38
|
+
},
|
|
34
39
|
compare: null
|
|
35
40
|
});
|
|
36
41
|
|
|
@@ -17,13 +17,13 @@ import '../../shared-chunks/property_get-DAKgbeJX.js';
|
|
|
17
17
|
import '../engine/instance.js';
|
|
18
18
|
import '../../route-recognizer/index.js';
|
|
19
19
|
import { R as RSVP } from '../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
20
|
-
import '../../shared-chunks/unrecognized-url-error-
|
|
20
|
+
import '../../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
|
|
21
21
|
import '../routing/lib/routing-service.js';
|
|
22
22
|
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-
|
|
26
|
+
import { s as setupApplicationRegistry } from '../../shared-chunks/setup-registry-Dfu8EyLU.js';
|
|
27
27
|
import RouterService from '../routing/router-service.js';
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -2,10 +2,25 @@ import { g as get } from '../../shared-chunks/property_get-DAKgbeJX.js';
|
|
|
2
2
|
import { s as set } from '../../shared-chunks/property_set-BaQJdVfS.js';
|
|
3
3
|
import { e as environment } from '../../shared-chunks/index-Cc8WmrB-.js';
|
|
4
4
|
import EngineInstance from '../engine/instance.js';
|
|
5
|
-
import
|
|
5
|
+
import '../-internals/container/index.js';
|
|
6
|
+
import '../../shared-chunks/guid-Cbq2sNV_.js';
|
|
7
|
+
import '../../shared-chunks/reference-CG0yPgLy.js';
|
|
8
|
+
import '../../shared-chunks/arguments-BzAkZVBa.js';
|
|
9
|
+
import '../../shared-chunks/cache-CofLhaS4.js';
|
|
10
|
+
import '../../shared-chunks/render-Dx7lr1hR.js';
|
|
11
|
+
import '../../shared-chunks/curly-a6DP7r87.js';
|
|
12
|
+
import '../../shared-chunks/outlet--lIm3q7t.js';
|
|
13
|
+
import '../../shared-chunks/env-DXxsTFkM.js';
|
|
14
|
+
import '../../shared-chunks/capabilities-BuVYh-vx.js';
|
|
15
|
+
import '../../shared-chunks/hash-gEXIsSO4.js';
|
|
16
|
+
import '../../shared-chunks/get-Dago5uGl.js';
|
|
17
|
+
import '../../shared-chunks/on-BZHAxzdq.js';
|
|
18
|
+
import '../../shared-chunks/template-only-DKNcKM5b.js';
|
|
19
|
+
import { a as renderSettled } from '../../shared-chunks/index-npr2B-vu.js';
|
|
20
|
+
import '../../shared-chunks/unique-id-o2pS74go.js';
|
|
21
|
+
import '../runloop/index.js';
|
|
6
22
|
import '../routing/router.js';
|
|
7
23
|
import '../object/index.js';
|
|
8
|
-
import '../../shared-chunks/guid-Cbq2sNV_.js';
|
|
9
24
|
import { h as hasDOM } from '../../shared-chunks/has-dom-DdQORPzI.js';
|
|
10
25
|
|
|
11
26
|
/**
|
|
@@ -1 +1,305 @@
|
|
|
1
|
-
|
|
1
|
+
import { setOwner } from '../-internals/owner/index.js';
|
|
2
|
+
import { FrameworkObject } from '../object/-internals.js';
|
|
3
|
+
import { g as getDebugName } from '../../shared-chunks/get-debug-name-BDxIL2Y1.js';
|
|
4
|
+
import { join } from '../runloop/index.js';
|
|
5
|
+
import { i as helperCapabilities } from '../../shared-chunks/api-DlJKfm_f.js';
|
|
6
|
+
import { b as setHelperManager } from '../../shared-chunks/api-B_poQGXS.js';
|
|
7
|
+
import { r as createTag, D as DIRTY_TAG, c as consumeTag } from '../../shared-chunks/cache-CofLhaS4.js';
|
|
8
|
+
import { I as IS_CLASSIC_HELPER } from '../../shared-chunks/helper-brand-C9_8vvOf.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
@module @ember/component
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const RECOMPUTE_TAG = Symbol('RECOMPUTE_TAG');
|
|
15
|
+
|
|
16
|
+
// Signature type utilities
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
19
|
+
|
|
20
|
+
// Implements Ember's `Factory` interface and tags it for narrowing/checking.
|
|
21
|
+
|
|
22
|
+
// A zero-runtime-overhead private symbol to use in branding the component to
|
|
23
|
+
// preserve its type parameter.
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
Ember Helpers are functions that can compute values, and are used in templates.
|
|
27
|
+
For example, this code calls a helper named `format-currency`:
|
|
28
|
+
|
|
29
|
+
```app/templates/application.gjs
|
|
30
|
+
import Cost from '../components/cost';
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<Cost @cents={{230}} />
|
|
34
|
+
</template>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```app/components/cost.gjs
|
|
38
|
+
import formatCurrency from '../helpers/format-currency';
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div>{{formatCurrency @cents currency="$"}}</div>
|
|
42
|
+
</template>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Additionally a helper can be called as a nested helper.
|
|
46
|
+
In this example, we show the formatted currency value if the `showMoney`
|
|
47
|
+
named argument is truthy.
|
|
48
|
+
|
|
49
|
+
```gjs
|
|
50
|
+
import formatCurrency from '../helpers/format-currency';
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
{{if @showMoney (formatCurrency @cents currency="$")}}
|
|
54
|
+
</template>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Helpers defined using a class must provide a `compute` function. For example:
|
|
58
|
+
|
|
59
|
+
```app/helpers/format-currency.js
|
|
60
|
+
import Helper from '@ember/component/helper';
|
|
61
|
+
|
|
62
|
+
export default class extends Helper {
|
|
63
|
+
compute([cents], { currency }) {
|
|
64
|
+
return `${currency}${cents * 0.01}`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Each time the input to a helper changes, the `compute` function will be
|
|
70
|
+
called again.
|
|
71
|
+
|
|
72
|
+
As instances, these helpers also have access to the container and will accept
|
|
73
|
+
injected dependencies.
|
|
74
|
+
|
|
75
|
+
Additionally, class helpers can call `recompute` to force a new computation.
|
|
76
|
+
|
|
77
|
+
@class Helper
|
|
78
|
+
@extends CoreObject
|
|
79
|
+
@public
|
|
80
|
+
@since 1.13.0
|
|
81
|
+
*/
|
|
82
|
+
// ESLint doesn't understand declaration merging.
|
|
83
|
+
/* eslint-disable import/export */
|
|
84
|
+
|
|
85
|
+
class Helper extends FrameworkObject {
|
|
86
|
+
static isHelperFactory = true;
|
|
87
|
+
static [IS_CLASSIC_HELPER] = true;
|
|
88
|
+
|
|
89
|
+
// `packages/ember/index.js` was setting `Helper.helper`. This seems like
|
|
90
|
+
// a bad idea and probably not something we want. We've moved that definition
|
|
91
|
+
// here, but it should definitely be reviewed and probably removed.
|
|
92
|
+
/** @deprecated */
|
|
93
|
+
static helper = helper;
|
|
94
|
+
|
|
95
|
+
// SAFETY: this is initialized in `init`, rather than `constructor`. It is
|
|
96
|
+
// safe to `declare` like this *if and only if* nothing uses the constructor
|
|
97
|
+
// directly in this class, since nothing else can run before `init`.
|
|
98
|
+
|
|
99
|
+
// SAFETY: this has no runtime existence whatsoever; it is a "phantom type"
|
|
100
|
+
// here to preserve the type param.
|
|
101
|
+
|
|
102
|
+
init(properties) {
|
|
103
|
+
super.init(properties);
|
|
104
|
+
this[RECOMPUTE_TAG] = createTag();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
On a class-based helper, it may be useful to force a recomputation of that
|
|
109
|
+
helpers value. This is akin to `rerender` on a component.
|
|
110
|
+
In most cases, `recompute` is not needed because accessing tracked
|
|
111
|
+
properties in `compute` will automatically re-run the helper when
|
|
112
|
+
those properties change. Use `recompute` only when you need to
|
|
113
|
+
trigger a recomputation imperatively, for example in response to an
|
|
114
|
+
external event:
|
|
115
|
+
```app/helpers/current-time.js
|
|
116
|
+
import Helper from '@ember/component/helper';
|
|
117
|
+
export default class CurrentTimeHelper extends Helper {
|
|
118
|
+
interval = null;
|
|
119
|
+
compute() {
|
|
120
|
+
return new Date().toLocaleTimeString();
|
|
121
|
+
}
|
|
122
|
+
constructor() {
|
|
123
|
+
super(...arguments);
|
|
124
|
+
this.interval = setInterval(() => this.recompute(), 1000);
|
|
125
|
+
}
|
|
126
|
+
willDestroy() {
|
|
127
|
+
super.willDestroy();
|
|
128
|
+
clearInterval(this.interval);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
@method recompute
|
|
133
|
+
@public
|
|
134
|
+
@since 1.13.0
|
|
135
|
+
*/
|
|
136
|
+
recompute() {
|
|
137
|
+
join(() => DIRTY_TAG(this[RECOMPUTE_TAG]));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/* eslint-enable import/export */
|
|
141
|
+
|
|
142
|
+
class ClassicHelperManager {
|
|
143
|
+
capabilities = helperCapabilities('3.23', {
|
|
144
|
+
hasValue: true,
|
|
145
|
+
hasDestroyable: true
|
|
146
|
+
});
|
|
147
|
+
ownerInjection;
|
|
148
|
+
constructor(owner) {
|
|
149
|
+
let ownerInjection = {};
|
|
150
|
+
setOwner(ownerInjection, owner);
|
|
151
|
+
this.ownerInjection = ownerInjection;
|
|
152
|
+
}
|
|
153
|
+
createHelper(definition, args) {
|
|
154
|
+
let instance = isFactoryManager(definition) ? definition.create() : definition.create(this.ownerInjection);
|
|
155
|
+
return {
|
|
156
|
+
instance,
|
|
157
|
+
args
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
getDestroyable({
|
|
161
|
+
instance
|
|
162
|
+
}) {
|
|
163
|
+
return instance;
|
|
164
|
+
}
|
|
165
|
+
getValue({
|
|
166
|
+
instance,
|
|
167
|
+
args
|
|
168
|
+
}) {
|
|
169
|
+
let {
|
|
170
|
+
positional,
|
|
171
|
+
named
|
|
172
|
+
} = args;
|
|
173
|
+
let ret = instance.compute(positional, named);
|
|
174
|
+
consumeTag(instance[RECOMPUTE_TAG]);
|
|
175
|
+
return ret;
|
|
176
|
+
}
|
|
177
|
+
getDebugName(definition) {
|
|
178
|
+
return getDebugName((definition.class || definition)['prototype']);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function isFactoryManager(obj) {
|
|
182
|
+
return obj != null && 'class' in obj;
|
|
183
|
+
}
|
|
184
|
+
setHelperManager(owner => {
|
|
185
|
+
return new ClassicHelperManager(owner);
|
|
186
|
+
}, Helper);
|
|
187
|
+
|
|
188
|
+
///////////
|
|
189
|
+
|
|
190
|
+
class Wrapper {
|
|
191
|
+
isHelperFactory = true;
|
|
192
|
+
constructor(compute) {
|
|
193
|
+
this.compute = compute;
|
|
194
|
+
}
|
|
195
|
+
create() {
|
|
196
|
+
// needs new instance or will leak containers
|
|
197
|
+
return {
|
|
198
|
+
compute: this.compute
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
class SimpleClassicHelperManager {
|
|
203
|
+
capabilities = helperCapabilities('3.23', {
|
|
204
|
+
hasValue: true
|
|
205
|
+
});
|
|
206
|
+
createHelper(definition, args) {
|
|
207
|
+
return () => definition.compute.call(null, args.positional, args.named);
|
|
208
|
+
}
|
|
209
|
+
getValue(fn) {
|
|
210
|
+
return fn();
|
|
211
|
+
}
|
|
212
|
+
getDebugName(definition) {
|
|
213
|
+
return getDebugName(definition.compute);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const SIMPLE_CLASSIC_HELPER_MANAGER = new SimpleClassicHelperManager();
|
|
217
|
+
setHelperManager(() => SIMPLE_CLASSIC_HELPER_MANAGER, Wrapper.prototype);
|
|
218
|
+
|
|
219
|
+
/*
|
|
220
|
+
Function-based helpers need to present with a constructor signature so that
|
|
221
|
+
type parameters can be preserved when `helper()` is passed a generic function
|
|
222
|
+
(this is particularly key for checking helper invocations with Glint).
|
|
223
|
+
Accordingly, we define an abstract class and declaration merge it with the
|
|
224
|
+
interface; this inherently provides an `abstract` constructor. Since it is
|
|
225
|
+
`abstract`, it is not callable, which is important since end users should not
|
|
226
|
+
be able to do `let myHelper = helper(someFn); new myHelper()`.
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* The type of a function-based helper.
|
|
231
|
+
*
|
|
232
|
+
* @note This is *not* user-constructible: it is exported only so that the type
|
|
233
|
+
* returned by the `helper` function can be named (and indeed can be exported
|
|
234
|
+
* like `export default helper(...)` safely).
|
|
235
|
+
*/
|
|
236
|
+
// Making `FunctionBasedHelper` an alias this way allows callers to name it in
|
|
237
|
+
// terms meaningful to *them*, while preserving the type behavior described on
|
|
238
|
+
// the `abstract class FunctionBasedHelperInstance` below.
|
|
239
|
+
|
|
240
|
+
// This abstract class -- specifically, its `protected abstract __concrete__`
|
|
241
|
+
// member -- prevents subclasses from doing `class X extends helper(..)`, since
|
|
242
|
+
// that is an error at runtime. While it is rare that people would type that, it
|
|
243
|
+
// is not impossible and we use this to give them early signal via the types for
|
|
244
|
+
// a behavior which will break (and in a somewhat inscrutable way!) at runtime.
|
|
245
|
+
//
|
|
246
|
+
// This is needful because we lie about what this actually is for Glint's sake:
|
|
247
|
+
// a function-based helper returns a `Factory<SimpleHelper>`, which is designed
|
|
248
|
+
// to be "opaque" from a consumer's POV, i.e. not user-callable or constructible
|
|
249
|
+
// but only useable in a template (or via `invokeHelper()` which also treats it
|
|
250
|
+
// as a fully opaque `object` from a type POV). But Glint needs a `Helper<S>` to
|
|
251
|
+
// make it work the same way as class-based helpers. (Note that this does not
|
|
252
|
+
// hold for plain functions as helpers, which it can handle distinctly.) This
|
|
253
|
+
// signature thus makes it so that the item is usable *as* a `Helper` in Glint,
|
|
254
|
+
// but without letting end users treat it as a helper class instance.
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
In many cases it is not necessary to use the full `Helper` class.
|
|
258
|
+
The `helper` method create pure-function helpers without instances.
|
|
259
|
+
For example:
|
|
260
|
+
|
|
261
|
+
```app/helpers/format-currency.js
|
|
262
|
+
import { helper } from '@ember/component/helper';
|
|
263
|
+
|
|
264
|
+
export default helper(function([cents], {currency}) {
|
|
265
|
+
return `${currency}${cents * 0.01}`;
|
|
266
|
+
});
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
@static
|
|
270
|
+
@param {Function} helper The helper function
|
|
271
|
+
@method helper
|
|
272
|
+
@for @ember/component/helper
|
|
273
|
+
@public
|
|
274
|
+
@since 1.13.0
|
|
275
|
+
*/
|
|
276
|
+
// This overload allows users to write types directly on the callback passed to
|
|
277
|
+
// the `helper` function and infer the resulting type correctly.
|
|
278
|
+
|
|
279
|
+
// This overload allows users to provide a `Signature` type explicitly at the
|
|
280
|
+
// helper definition site, e.g. `helper<Sig>((pos, named) => {...})`. **Note:**
|
|
281
|
+
// this overload must appear second, since TS' inference engine will not
|
|
282
|
+
// correctly infer the type of `S` here from the types on the supplied callback.
|
|
283
|
+
|
|
284
|
+
function helper(helperFn) {
|
|
285
|
+
// SAFETY: this is completely lies, in two ways:
|
|
286
|
+
//
|
|
287
|
+
// 1. `Wrapper` is a `Factory<SimpleHelper<S>>`, but from the perspective of
|
|
288
|
+
// any external callers (i.e. Ember *users*), it is quite important that
|
|
289
|
+
// the `Factory` relationship be hidden, because it is not public API for
|
|
290
|
+
// an end user to call `.create()` on a helper created this way. Instead,
|
|
291
|
+
// we provide them an `abstract new` signature (which means it cannot be
|
|
292
|
+
// directly constructed by calling `new` on it) and which does not have the
|
|
293
|
+
// `.create()` signature on it anymore.
|
|
294
|
+
//
|
|
295
|
+
// 2. The produced type here ends up being a subtype of `Helper`, which is not
|
|
296
|
+
// strictly true. This is necessary for the sake of Glint, which provides
|
|
297
|
+
// its information by way of a "declaration merge" with `Helper<S>` in the
|
|
298
|
+
// case of items produced by `helper()`.
|
|
299
|
+
//
|
|
300
|
+
// Long-term, this entire construct can go away in favor of deprecating the
|
|
301
|
+
// `helper()` invocation in favor of using plain functions.
|
|
302
|
+
return new Wrapper(helperFn);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export { Helper as default, helper };
|
|
@@ -13,7 +13,7 @@ import { s as setInternalComponentManager } from '../../shared-chunks/api-DlJKfm
|
|
|
13
13
|
import { b as isUpdatableRef, u as updateRef } from '../../shared-chunks/reference-CG0yPgLy.js';
|
|
14
14
|
import { n as normalizeProperty } from '../../shared-chunks/props-fiqxqhAH.js';
|
|
15
15
|
import { r as createTag, D as DIRTY_TAG$1 } from '../../shared-chunks/cache-CofLhaS4.js';
|
|
16
|
-
import { I as IS_DISPATCHING_ATTRS, D as DIRTY_TAG, B as BOUNDS, g as getComponentCapturedArgs,
|
|
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
19
|
export { I as Input, T as Textarea } from '../../shared-chunks/textarea-DOmZ1x0E.js';
|
|
@@ -9,9 +9,9 @@ import { s as set } from '../../shared-chunks/property_set-BaQJdVfS.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
|
-
import '../../shared-chunks/unrecognized-url-error-
|
|
12
|
+
import '../../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
|
|
13
13
|
import RoutingService from '../routing/lib/routing-service.js';
|
|
14
|
-
import {
|
|
14
|
+
import { b as setupEngineRegistry } from '../../shared-chunks/setup-registry-Dfu8EyLU.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 +1 @@
|
|
|
1
|
-
export { r as renderComponent, a as renderSettled } from '../../shared-chunks/index-
|
|
1
|
+
export { r as renderComponent, a as renderSettled } from '../../shared-chunks/index-npr2B-vu.js';
|
|
@@ -5,7 +5,6 @@ import '../../../shared-chunks/observers-BmobpXAF.js';
|
|
|
5
5
|
import '../../../shared-chunks/property_get-DAKgbeJX.js';
|
|
6
6
|
import { readOnly } from '../../object/lib/computed/computed_macros.js';
|
|
7
7
|
import '../../object/core.js';
|
|
8
|
-
import '../../-internals/runtime/lib/mixins/comparable.js';
|
|
9
8
|
import '../../array/index.js';
|
|
10
9
|
import Service from '../../service/index.js';
|
|
11
10
|
import '../router.js';
|
|
@@ -3,7 +3,7 @@ import { getOwner } from '../../-internals/owner/index.js';
|
|
|
3
3
|
import '../../engine/instance.js';
|
|
4
4
|
import '../../../route-recognizer/index.js';
|
|
5
5
|
import '../../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
6
|
-
import { S as STATE_SYMBOL } from '../../../shared-chunks/unrecognized-url-error-
|
|
6
|
+
import { S as STATE_SYMBOL } from '../../../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
|
|
7
7
|
|
|
8
8
|
const ALL_PERIODS_REGEX = /\./g;
|
|
9
9
|
function extractRouteArgs(args) {
|
|
@@ -22,7 +22,7 @@ import { once } from '../runloop/index.js';
|
|
|
22
22
|
import { c as hasInternalComponentManager } from '../../shared-chunks/api-DlJKfm_f.js';
|
|
23
23
|
import '../../route-recognizer/index.js';
|
|
24
24
|
import '../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
25
|
-
import { S as STATE_SYMBOL, P as PARAMS_SYMBOL } from '../../shared-chunks/unrecognized-url-error-
|
|
25
|
+
import { S as STATE_SYMBOL, P as PARAMS_SYMBOL } from '../../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
|
|
26
26
|
import generateController from './lib/generate_controller.js';
|
|
27
27
|
import { prefixRouteNameArg, stashParamNames, calculateCacheKey, normalizeControllerQueryParams } from './lib/utils.js';
|
|
28
28
|
import { a as decorateMethodV2 } from '../../shared-chunks/runtime-CYyqkz5q-BOdRhmsS.js';
|
|
@@ -7,7 +7,6 @@ import '../../shared-chunks/observers-BmobpXAF.js';
|
|
|
7
7
|
import '../../shared-chunks/property_get-DAKgbeJX.js';
|
|
8
8
|
import { readOnly } from '../object/lib/computed/computed_macros.js';
|
|
9
9
|
import '../object/core.js';
|
|
10
|
-
import '../-internals/runtime/lib/mixins/comparable.js';
|
|
11
10
|
import '../array/index.js';
|
|
12
11
|
import Service from '../service/index.js';
|
|
13
12
|
import './router.js';
|
|
@@ -13,7 +13,7 @@ import Evented from '../object/evented.js';
|
|
|
13
13
|
import { run, once, scheduleOnce, cancel } from '../runloop/index.js';
|
|
14
14
|
import { getRenderState, getFullQueryParams, hasDefaultSerialize, defaultSerialize } from './route.js';
|
|
15
15
|
import Router from '../../router_js/index.js';
|
|
16
|
-
import { S as STATE_SYMBOL, l as logAbort } from '../../shared-chunks/unrecognized-url-error-
|
|
16
|
+
import { S as STATE_SYMBOL, l as logAbort } from '../../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
|
|
17
17
|
import '../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
18
18
|
import '../engine/instance.js';
|
|
19
19
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import typeOf from './type-of.js';
|
|
2
|
-
import Comparable from '../../-internals/runtime/lib/mixins/comparable.js';
|
|
3
2
|
|
|
4
3
|
const TYPE_ORDER = {
|
|
5
4
|
undefined: 0,
|
|
@@ -145,7 +144,11 @@ function compare(v, w) {
|
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
function isComparable(value) {
|
|
148
|
-
|
|
147
|
+
if (typeof value !== 'object' || value === null) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
let maybeComparable = value;
|
|
151
|
+
return typeof maybeComparable.constructor?.compare === 'function' || typeof maybeComparable.compare === 'function';
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
export { compare as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import RouteRecognizer from '../route-recognizer/index.js';
|
|
2
2
|
import { P as Promise$1 } from '../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
3
|
-
import { Q as QUERY_PARAMS_SYMBOL, m as merge, i as isTransition, a as isParam, t as throwIfAborted, P as PARAMS_SYMBOL, p as prepareResult, b as isPromise, f as forEach, c as promiseLabel, U as UnrecognizedURLError, T as Transition, S as STATE_SYMBOL, g as getChangelist, d as log, l as logAbort, e as isTransitionAborted, h as extractQueryParams } from '../shared-chunks/unrecognized-url-error-
|
|
3
|
+
import { Q as QUERY_PARAMS_SYMBOL, m as merge, i as isTransition, a as isParam, t as throwIfAborted, P as PARAMS_SYMBOL, p as prepareResult, b as isPromise, f as forEach, c as promiseLabel, U as UnrecognizedURLError, T as Transition, S as STATE_SYMBOL, g as getChangelist, d as log, l as logAbort, e as isTransitionAborted, h as extractQueryParams } from '../shared-chunks/unrecognized-url-error-jjQ-FqKB.js';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable no-prototype-builtins */
|
|
6
6
|
let ROUTE_INFOS = new WeakMap();
|
|
@@ -253,7 +253,7 @@ class InternalRouteInfo {
|
|
|
253
253
|
// Ignore the fulfilled value returned from afterModel.
|
|
254
254
|
// Return the value stashed in resolvedModels, which
|
|
255
255
|
// might have been swapped out in afterModel.
|
|
256
|
-
//
|
|
256
|
+
// SAFETY: We expect this to be of type T, though typing it as such is challenging.
|
|
257
257
|
return transition.resolvedModels[name];
|
|
258
258
|
});
|
|
259
259
|
}
|
|
@@ -10,6 +10,7 @@ import { g as get } from './property_get-DAKgbeJX.js';
|
|
|
10
10
|
import { dasherize } from '../@ember/-internals/string/index.js';
|
|
11
11
|
import { registerDestructor } from '../@glimmer/destroyable/index.js';
|
|
12
12
|
import { MUTABLE_CELL } from '../@ember/-internals/views/lib/compat/attrs.js';
|
|
13
|
+
import { C as CURLY_MANAGER_BRAND } from './curly-brand-B_F79Dep.js';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @deprecated
|
|
@@ -228,6 +229,7 @@ function applyAttributeBindings(attributeBindings, component, rootRef, operation
|
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
class CurlyComponentManager {
|
|
232
|
+
[CURLY_MANAGER_BRAND] = true;
|
|
231
233
|
templateFor(component) {
|
|
232
234
|
let {
|
|
233
235
|
layout,
|
|
@@ -537,9 +539,6 @@ const CURLY_CAPABILITIES = {
|
|
|
537
539
|
willDestroy: true,
|
|
538
540
|
hasSubOwner: false
|
|
539
541
|
};
|
|
540
|
-
const CURLY_COMPONENT_MANAGER = new CurlyComponentManager();
|
|
541
|
-
function isCurlyManager(manager) {
|
|
542
|
-
return manager === CURLY_COMPONENT_MANAGER;
|
|
543
|
-
}
|
|
542
|
+
const CURLY_COMPONENT_MANAGER = /*@__PURE__*/new CurlyComponentManager();
|
|
544
543
|
|
|
545
|
-
export { BOUNDS as B,
|
|
544
|
+
export { BOUNDS as B, CurlyComponentManager as C, DIRTY_TAG as D, IS_DISPATCHING_ATTRS as I, ComponentStateBucket as a, CURLY_COMPONENT_MANAGER as b, getComponentCapturedArgs as g, initialRenderInstrumentDetails as i, unwrapTemplate as u };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The brand for the curly component manager lives in its own module so that
|
|
3
|
+
* code which only needs to *detect* the curly manager (e.g. the resolver)
|
|
4
|
+
* does not have to import the manager itself (and with it the classic
|
|
5
|
+
* component machinery).
|
|
6
|
+
*/
|
|
7
|
+
const CURLY_MANAGER_BRAND = Symbol('CURLY_MANAGER_BRAND');
|
|
8
|
+
function isCurlyManager(manager) {
|
|
9
|
+
return manager[CURLY_MANAGER_BRAND] === true;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { CURLY_MANAGER_BRAND as C, isCurlyManager as i };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The brand for classic (class-based) helpers lives in its own module so that
|
|
3
|
+
* code which only needs to *detect* classic helpers (e.g. the resolver) does
|
|
4
|
+
* not have to import the classic `Helper` base class (and with it the classic
|
|
5
|
+
* object model: `EmberObject`, `Mixin`, meta, etc.).
|
|
6
|
+
*/
|
|
7
|
+
const IS_CLASSIC_HELPER = Symbol('IS_CLASSIC_HELPER');
|
|
8
|
+
function isClassicHelper(obj) {
|
|
9
|
+
return obj[IS_CLASSIC_HELPER] === true;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { IS_CLASSIC_HELPER as I, isClassicHelper as i };
|