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
package/build-metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "7.
|
|
2
|
+
"version": "7.3.0-alpha.1",
|
|
3
3
|
"buildType": "tag",
|
|
4
|
-
"SHA": "
|
|
5
|
-
"assetPath": "/tag/shas/
|
|
4
|
+
"SHA": "3676088754ae85cc2d3d349cb1a9e05e24b97161",
|
|
5
|
+
"assetPath": "/tag/shas/3676088754ae85cc2d3d349cb1a9e05e24b97161.tgz"
|
|
6
6
|
}
|
|
@@ -102,6 +102,16 @@ const DEPRECATIONS = {
|
|
|
102
102
|
},
|
|
103
103
|
until: '7.0.0',
|
|
104
104
|
url: 'https://deprecations.emberjs.com/id/importing-inject-from-ember-service'
|
|
105
|
+
}),
|
|
106
|
+
DEPRECATE_COMPARABLE_MIXIN: deprecation({
|
|
107
|
+
for: 'ember-source',
|
|
108
|
+
id: 'deprecate-comparable-mixin',
|
|
109
|
+
since: {
|
|
110
|
+
available: '7.2.0',
|
|
111
|
+
enabled: '7.2.0'
|
|
112
|
+
},
|
|
113
|
+
until: '7.5.0',
|
|
114
|
+
url: 'https://deprecations.emberjs.com/id/deprecate-comparable-mixin'
|
|
105
115
|
})
|
|
106
116
|
};
|
|
107
117
|
function deprecateUntil(message, deprecation) {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export { t as template, a as templateCacheCounters } from '../../../shared-chunks/index-DaFzpTIE.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-BHdDJATP.js';
|
|
3
3
|
export { I as Input, T as Textarea } from '../../../shared-chunks/textarea-C4lYkaHj.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-B3pPx1fL.js';
|
|
9
8
|
export { D as DOMChanges } from '../../../shared-chunks/render-87_sKZ_k.js';
|
|
10
9
|
export { D as DOMTreeConstruction } from '../../../shared-chunks/api-C0PAtEgQ.js';
|
|
11
10
|
import '../../../@glimmer/destroyable/index.js';
|
|
@@ -13,6 +12,7 @@ export { i as isSerializationFirstNode } from '../../../shared-chunks/rehydrate-
|
|
|
13
12
|
export { NodeDOMTreeConstruction } from '../../../@glimmer/node/index.js';
|
|
14
13
|
export { e as element } from '../../../shared-chunks/element-BYLB-q7a.js';
|
|
15
14
|
export { u as uniqueId } from '../../../shared-chunks/unique-id-DQOhouG1.js';
|
|
15
|
+
export { _ as _resetRenderers, r as renderComponent, a as renderSettled } from '../../../shared-chunks/index-CCyXUNBa.js';
|
|
16
16
|
export { c as componentCapabilities, m as modifierCapabilities } from '../../../shared-chunks/api-BlZDPg1n.js';
|
|
17
17
|
|
|
18
18
|
// STATE within a module is frowned upon, this exists
|
|
@@ -3,7 +3,7 @@ import '../../debug/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 '../../../shared-chunks/unrecognized-url-error-
|
|
6
|
+
import '../../../shared-chunks/unrecognized-url-error-B8loxkay.js';
|
|
7
7
|
import '../../routing/lib/routing-service.js';
|
|
8
8
|
export { default as generateController, generateControllerFactory } from '../../routing/lib/generate_controller.js';
|
|
9
9
|
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-CRP7MFz_.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-B8loxkay.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-BHdDJATP.js';
|
|
27
27
|
import RouterService from '../routing/router-service.js';
|
|
28
28
|
import { assert } from '../debug/lib/assert.js';
|
|
29
29
|
|
|
@@ -2,8 +2,28 @@ import { g as get } from '../../shared-chunks/property_get-CRP7MFz_.js';
|
|
|
2
2
|
import { s as set } from '../../shared-chunks/property_set-qCUylPEK.js';
|
|
3
3
|
import { h as hasDOM, e as environment } from '../../shared-chunks/index-BGP1rw3B.js';
|
|
4
4
|
import EngineInstance from '../engine/instance.js';
|
|
5
|
-
import
|
|
5
|
+
import '../-internals/container/index.js';
|
|
6
|
+
import '../../shared-chunks/guid-Cbq2sNV_.js';
|
|
6
7
|
import '../debug/index.js';
|
|
8
|
+
import '../../@glimmer/destroyable/index.js';
|
|
9
|
+
import '../../shared-chunks/reference-BqOLhKFy.js';
|
|
10
|
+
import '../../shared-chunks/api-C0PAtEgQ.js';
|
|
11
|
+
import '../../shared-chunks/arguments-CDkbOqTS.js';
|
|
12
|
+
import '../../shared-chunks/cache-DGDPVCpC.js';
|
|
13
|
+
import '../../shared-chunks/render-87_sKZ_k.js';
|
|
14
|
+
import '../../@glimmer/global-context/index.js';
|
|
15
|
+
import '../../shared-chunks/curly-DGUCLOud.js';
|
|
16
|
+
import '../../shared-chunks/outlet-CHFL7tun.js';
|
|
17
|
+
import '../../shared-chunks/container-BzzHmCNj.js';
|
|
18
|
+
import '../../shared-chunks/env-g-kaAFLN.js';
|
|
19
|
+
import '../../shared-chunks/capabilities-CajW4QjE.js';
|
|
20
|
+
import '../../shared-chunks/hash-6NDs_5_f.js';
|
|
21
|
+
import '../../shared-chunks/get-6I3sjd-I.js';
|
|
22
|
+
import '../../shared-chunks/on-DlF0Wy7P.js';
|
|
23
|
+
import '../../shared-chunks/template-only-Cu639ICT.js';
|
|
24
|
+
import { a as renderSettled } from '../../shared-chunks/index-CCyXUNBa.js';
|
|
25
|
+
import '../../shared-chunks/unique-id-DQOhouG1.js';
|
|
26
|
+
import '../runloop/index.js';
|
|
7
27
|
import EmberRouter from '../routing/router.js';
|
|
8
28
|
import EventDispatcher from '../-internals/views/lib/system/event_dispatcher.js';
|
|
9
29
|
import { assert } from '../debug/lib/assert.js';
|
|
@@ -1 +1,321 @@
|
|
|
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-CSniHBsn.js';
|
|
4
|
+
import '../debug/index.js';
|
|
5
|
+
import { join } from '../runloop/index.js';
|
|
6
|
+
import { i as helperCapabilities } from '../../shared-chunks/api-DuLOZMO_.js';
|
|
7
|
+
import { b as setHelperManager } from '../../shared-chunks/api-BlZDPg1n.js';
|
|
8
|
+
import { r as createTag, D as DIRTY_TAG, c as consumeTag } from '../../shared-chunks/cache-DGDPVCpC.js';
|
|
9
|
+
import { I as IS_CLASSIC_HELPER } from '../../shared-chunks/helper-brand-C9_8vvOf.js';
|
|
10
|
+
import { assert } from '../debug/lib/assert.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
@module @ember/component
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const RECOMPUTE_TAG = Symbol('RECOMPUTE_TAG');
|
|
17
|
+
|
|
18
|
+
// Signature type utilities
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
21
|
+
|
|
22
|
+
// Implements Ember's `Factory` interface and tags it for narrowing/checking.
|
|
23
|
+
|
|
24
|
+
// A zero-runtime-overhead private symbol to use in branding the component to
|
|
25
|
+
// preserve its type parameter.
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
Ember Helpers are functions that can compute values, and are used in templates.
|
|
29
|
+
For example, this code calls a helper named `format-currency`:
|
|
30
|
+
|
|
31
|
+
```app/templates/application.gjs
|
|
32
|
+
import Cost from '../components/cost';
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<Cost @cents={{230}} />
|
|
36
|
+
</template>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```app/components/cost.gjs
|
|
40
|
+
import formatCurrency from '../helpers/format-currency';
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div>{{formatCurrency @cents currency="$"}}</div>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Additionally a helper can be called as a nested helper.
|
|
48
|
+
In this example, we show the formatted currency value if the `showMoney`
|
|
49
|
+
named argument is truthy.
|
|
50
|
+
|
|
51
|
+
```gjs
|
|
52
|
+
import formatCurrency from '../helpers/format-currency';
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
{{if @showMoney (formatCurrency @cents currency="$")}}
|
|
56
|
+
</template>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Helpers defined using a class must provide a `compute` function. For example:
|
|
60
|
+
|
|
61
|
+
```app/helpers/format-currency.js
|
|
62
|
+
import Helper from '@ember/component/helper';
|
|
63
|
+
|
|
64
|
+
export default class extends Helper {
|
|
65
|
+
compute([cents], { currency }) {
|
|
66
|
+
return `${currency}${cents * 0.01}`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Each time the input to a helper changes, the `compute` function will be
|
|
72
|
+
called again.
|
|
73
|
+
|
|
74
|
+
As instances, these helpers also have access to the container and will accept
|
|
75
|
+
injected dependencies.
|
|
76
|
+
|
|
77
|
+
Additionally, class helpers can call `recompute` to force a new computation.
|
|
78
|
+
|
|
79
|
+
@class Helper
|
|
80
|
+
@extends CoreObject
|
|
81
|
+
@public
|
|
82
|
+
@since 1.13.0
|
|
83
|
+
*/
|
|
84
|
+
// ESLint doesn't understand declaration merging.
|
|
85
|
+
/* eslint-disable import/export */
|
|
86
|
+
|
|
87
|
+
class Helper extends FrameworkObject {
|
|
88
|
+
static isHelperFactory = true;
|
|
89
|
+
static [IS_CLASSIC_HELPER] = true;
|
|
90
|
+
|
|
91
|
+
// `packages/ember/index.js` was setting `Helper.helper`. This seems like
|
|
92
|
+
// a bad idea and probably not something we want. We've moved that definition
|
|
93
|
+
// here, but it should definitely be reviewed and probably removed.
|
|
94
|
+
/** @deprecated */
|
|
95
|
+
static helper = helper;
|
|
96
|
+
|
|
97
|
+
// SAFETY: this is initialized in `init`, rather than `constructor`. It is
|
|
98
|
+
// safe to `declare` like this *if and only if* nothing uses the constructor
|
|
99
|
+
// directly in this class, since nothing else can run before `init`.
|
|
100
|
+
|
|
101
|
+
// SAFETY: this has no runtime existence whatsoever; it is a "phantom type"
|
|
102
|
+
// here to preserve the type param.
|
|
103
|
+
|
|
104
|
+
init(properties) {
|
|
105
|
+
super.init(properties);
|
|
106
|
+
this[RECOMPUTE_TAG] = createTag();
|
|
107
|
+
(!(this.compute) && assert('expected compute to be defined', this.compute));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
On a class-based helper, it may be useful to force a recomputation of that
|
|
112
|
+
helpers value. This is akin to `rerender` on a component.
|
|
113
|
+
In most cases, `recompute` is not needed because accessing tracked
|
|
114
|
+
properties in `compute` will automatically re-run the helper when
|
|
115
|
+
those properties change. Use `recompute` only when you need to
|
|
116
|
+
trigger a recomputation imperatively, for example in response to an
|
|
117
|
+
external event:
|
|
118
|
+
```app/helpers/current-time.js
|
|
119
|
+
import Helper from '@ember/component/helper';
|
|
120
|
+
export default class CurrentTimeHelper extends Helper {
|
|
121
|
+
interval = null;
|
|
122
|
+
compute() {
|
|
123
|
+
return new Date().toLocaleTimeString();
|
|
124
|
+
}
|
|
125
|
+
constructor() {
|
|
126
|
+
super(...arguments);
|
|
127
|
+
this.interval = setInterval(() => this.recompute(), 1000);
|
|
128
|
+
}
|
|
129
|
+
willDestroy() {
|
|
130
|
+
super.willDestroy();
|
|
131
|
+
clearInterval(this.interval);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
@method recompute
|
|
136
|
+
@public
|
|
137
|
+
@since 1.13.0
|
|
138
|
+
*/
|
|
139
|
+
recompute() {
|
|
140
|
+
join(() => DIRTY_TAG(this[RECOMPUTE_TAG]));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/* eslint-enable import/export */
|
|
144
|
+
|
|
145
|
+
class ClassicHelperManager {
|
|
146
|
+
capabilities = helperCapabilities('3.23', {
|
|
147
|
+
hasValue: true,
|
|
148
|
+
hasDestroyable: true
|
|
149
|
+
});
|
|
150
|
+
ownerInjection;
|
|
151
|
+
constructor(owner) {
|
|
152
|
+
let ownerInjection = {};
|
|
153
|
+
setOwner(ownerInjection, owner);
|
|
154
|
+
this.ownerInjection = ownerInjection;
|
|
155
|
+
}
|
|
156
|
+
createHelper(definition, args) {
|
|
157
|
+
let instance = isFactoryManager(definition) ? definition.create() : definition.create(this.ownerInjection);
|
|
158
|
+
(!(function (instance) {
|
|
159
|
+
if (instance !== null && typeof instance === 'object') {
|
|
160
|
+
let cast = instance;
|
|
161
|
+
return typeof cast.compute === 'function' && typeof cast.destroy === 'function';
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
}(instance)) && assert('expected HelperInstance', function (instance) {
|
|
165
|
+
if (instance !== null && typeof instance === 'object') {
|
|
166
|
+
let cast = instance;
|
|
167
|
+
return typeof cast.compute === 'function' && typeof cast.destroy === 'function';
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
}(instance)));
|
|
171
|
+
return {
|
|
172
|
+
instance,
|
|
173
|
+
args
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
getDestroyable({
|
|
177
|
+
instance
|
|
178
|
+
}) {
|
|
179
|
+
return instance;
|
|
180
|
+
}
|
|
181
|
+
getValue({
|
|
182
|
+
instance,
|
|
183
|
+
args
|
|
184
|
+
}) {
|
|
185
|
+
let {
|
|
186
|
+
positional,
|
|
187
|
+
named
|
|
188
|
+
} = args;
|
|
189
|
+
let ret = instance.compute(positional, named);
|
|
190
|
+
consumeTag(instance[RECOMPUTE_TAG]);
|
|
191
|
+
return ret;
|
|
192
|
+
}
|
|
193
|
+
getDebugName(definition) {
|
|
194
|
+
return getDebugName((definition.class || definition)['prototype']);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function isFactoryManager(obj) {
|
|
198
|
+
return obj != null && 'class' in obj;
|
|
199
|
+
}
|
|
200
|
+
setHelperManager(owner => {
|
|
201
|
+
return new ClassicHelperManager(owner);
|
|
202
|
+
}, Helper);
|
|
203
|
+
|
|
204
|
+
///////////
|
|
205
|
+
|
|
206
|
+
class Wrapper {
|
|
207
|
+
isHelperFactory = true;
|
|
208
|
+
constructor(compute) {
|
|
209
|
+
this.compute = compute;
|
|
210
|
+
}
|
|
211
|
+
create() {
|
|
212
|
+
// needs new instance or will leak containers
|
|
213
|
+
return {
|
|
214
|
+
compute: this.compute
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
class SimpleClassicHelperManager {
|
|
219
|
+
capabilities = helperCapabilities('3.23', {
|
|
220
|
+
hasValue: true
|
|
221
|
+
});
|
|
222
|
+
createHelper(definition, args) {
|
|
223
|
+
return () => definition.compute.call(null, args.positional, args.named);
|
|
224
|
+
}
|
|
225
|
+
getValue(fn) {
|
|
226
|
+
return fn();
|
|
227
|
+
}
|
|
228
|
+
getDebugName(definition) {
|
|
229
|
+
return getDebugName(definition.compute);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const SIMPLE_CLASSIC_HELPER_MANAGER = new SimpleClassicHelperManager();
|
|
233
|
+
setHelperManager(() => SIMPLE_CLASSIC_HELPER_MANAGER, Wrapper.prototype);
|
|
234
|
+
|
|
235
|
+
/*
|
|
236
|
+
Function-based helpers need to present with a constructor signature so that
|
|
237
|
+
type parameters can be preserved when `helper()` is passed a generic function
|
|
238
|
+
(this is particularly key for checking helper invocations with Glint).
|
|
239
|
+
Accordingly, we define an abstract class and declaration merge it with the
|
|
240
|
+
interface; this inherently provides an `abstract` constructor. Since it is
|
|
241
|
+
`abstract`, it is not callable, which is important since end users should not
|
|
242
|
+
be able to do `let myHelper = helper(someFn); new myHelper()`.
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* The type of a function-based helper.
|
|
247
|
+
*
|
|
248
|
+
* @note This is *not* user-constructible: it is exported only so that the type
|
|
249
|
+
* returned by the `helper` function can be named (and indeed can be exported
|
|
250
|
+
* like `export default helper(...)` safely).
|
|
251
|
+
*/
|
|
252
|
+
// Making `FunctionBasedHelper` an alias this way allows callers to name it in
|
|
253
|
+
// terms meaningful to *them*, while preserving the type behavior described on
|
|
254
|
+
// the `abstract class FunctionBasedHelperInstance` below.
|
|
255
|
+
|
|
256
|
+
// This abstract class -- specifically, its `protected abstract __concrete__`
|
|
257
|
+
// member -- prevents subclasses from doing `class X extends helper(..)`, since
|
|
258
|
+
// that is an error at runtime. While it is rare that people would type that, it
|
|
259
|
+
// is not impossible and we use this to give them early signal via the types for
|
|
260
|
+
// a behavior which will break (and in a somewhat inscrutable way!) at runtime.
|
|
261
|
+
//
|
|
262
|
+
// This is needful because we lie about what this actually is for Glint's sake:
|
|
263
|
+
// a function-based helper returns a `Factory<SimpleHelper>`, which is designed
|
|
264
|
+
// to be "opaque" from a consumer's POV, i.e. not user-callable or constructible
|
|
265
|
+
// but only useable in a template (or via `invokeHelper()` which also treats it
|
|
266
|
+
// as a fully opaque `object` from a type POV). But Glint needs a `Helper<S>` to
|
|
267
|
+
// make it work the same way as class-based helpers. (Note that this does not
|
|
268
|
+
// hold for plain functions as helpers, which it can handle distinctly.) This
|
|
269
|
+
// signature thus makes it so that the item is usable *as* a `Helper` in Glint,
|
|
270
|
+
// but without letting end users treat it as a helper class instance.
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
In many cases it is not necessary to use the full `Helper` class.
|
|
274
|
+
The `helper` method create pure-function helpers without instances.
|
|
275
|
+
For example:
|
|
276
|
+
|
|
277
|
+
```app/helpers/format-currency.js
|
|
278
|
+
import { helper } from '@ember/component/helper';
|
|
279
|
+
|
|
280
|
+
export default helper(function([cents], {currency}) {
|
|
281
|
+
return `${currency}${cents * 0.01}`;
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
@static
|
|
286
|
+
@param {Function} helper The helper function
|
|
287
|
+
@method helper
|
|
288
|
+
@for @ember/component/helper
|
|
289
|
+
@public
|
|
290
|
+
@since 1.13.0
|
|
291
|
+
*/
|
|
292
|
+
// This overload allows users to write types directly on the callback passed to
|
|
293
|
+
// the `helper` function and infer the resulting type correctly.
|
|
294
|
+
|
|
295
|
+
// This overload allows users to provide a `Signature` type explicitly at the
|
|
296
|
+
// helper definition site, e.g. `helper<Sig>((pos, named) => {...})`. **Note:**
|
|
297
|
+
// this overload must appear second, since TS' inference engine will not
|
|
298
|
+
// correctly infer the type of `S` here from the types on the supplied callback.
|
|
299
|
+
|
|
300
|
+
function helper(helperFn) {
|
|
301
|
+
// SAFETY: this is completely lies, in two ways:
|
|
302
|
+
//
|
|
303
|
+
// 1. `Wrapper` is a `Factory<SimpleHelper<S>>`, but from the perspective of
|
|
304
|
+
// any external callers (i.e. Ember *users*), it is quite important that
|
|
305
|
+
// the `Factory` relationship be hidden, because it is not public API for
|
|
306
|
+
// an end user to call `.create()` on a helper created this way. Instead,
|
|
307
|
+
// we provide them an `abstract new` signature (which means it cannot be
|
|
308
|
+
// directly constructed by calling `new` on it) and which does not have the
|
|
309
|
+
// `.create()` signature on it anymore.
|
|
310
|
+
//
|
|
311
|
+
// 2. The produced type here ends up being a subtype of `Helper`, which is not
|
|
312
|
+
// strictly true. This is necessary for the sake of Glint, which provides
|
|
313
|
+
// its information by way of a "declaration merge" with `Helper<S>` in the
|
|
314
|
+
// case of items produced by `helper()`.
|
|
315
|
+
//
|
|
316
|
+
// Long-term, this entire construct can go away in favor of deprecating the
|
|
317
|
+
// `helper()` invocation in favor of using plain functions.
|
|
318
|
+
return new Wrapper(helperFn);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { Helper as default, helper };
|
|
@@ -14,7 +14,7 @@ import { s as setInternalComponentManager } from '../../shared-chunks/api-DuLOZM
|
|
|
14
14
|
import { d as isUpdatableRef, u as updateRef } from '../../shared-chunks/reference-BqOLhKFy.js';
|
|
15
15
|
import { n as normalizeProperty } from '../../shared-chunks/props-fiqxqhAH.js';
|
|
16
16
|
import { r as createTag, D as DIRTY_TAG$1 } from '../../shared-chunks/cache-DGDPVCpC.js';
|
|
17
|
-
import { I as IS_DISPATCHING_ATTRS, D as DIRTY_TAG, B as BOUNDS, g as getComponentCapturedArgs,
|
|
17
|
+
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-DGUCLOud.js';
|
|
18
18
|
import { h as hasDOM } from '../../shared-chunks/index-BGP1rw3B.js';
|
|
19
19
|
import { a as decorateMethodV2 } from '../../shared-chunks/runtime-CYyqkz5q-BOdRhmsS.js';
|
|
20
20
|
import { assert } from '../debug/lib/assert.js';
|
|
@@ -11,9 +11,9 @@ import { s as set } from '../../shared-chunks/property_set-qCUylPEK.js';
|
|
|
11
11
|
import EngineInstance from './instance.js';
|
|
12
12
|
import '../../route-recognizer/index.js';
|
|
13
13
|
import '../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
14
|
-
import '../../shared-chunks/unrecognized-url-error-
|
|
14
|
+
import '../../shared-chunks/unrecognized-url-error-B8loxkay.js';
|
|
15
15
|
import RoutingService from '../routing/lib/routing-service.js';
|
|
16
|
-
import {
|
|
16
|
+
import { b as setupEngineRegistry } from '../../shared-chunks/setup-registry-BHdDJATP.js';
|
|
17
17
|
import RegistryProxyMixin from '../-internals/runtime/lib/mixins/registry_proxy.js';
|
|
18
18
|
import { StrictResolver } from './lib/strict-resolver.js';
|
|
19
19
|
import { assert } from '../debug/lib/assert.js';
|
|
@@ -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-CCyXUNBa.js';
|
|
@@ -10,4 +10,4 @@ import '../debug/index.js';
|
|
|
10
10
|
import '../engine/instance.js';
|
|
11
11
|
import '../../route-recognizer/index.js';
|
|
12
12
|
import '../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
13
|
-
import '../../shared-chunks/unrecognized-url-error-
|
|
13
|
+
import '../../shared-chunks/unrecognized-url-error-B8loxkay.js';
|
|
@@ -11,7 +11,6 @@ import '../../../shared-chunks/observers-DMlX2nCi.js';
|
|
|
11
11
|
import '../../../shared-chunks/property_get-CRP7MFz_.js';
|
|
12
12
|
import { readOnly } from '../../object/lib/computed/computed_macros.js';
|
|
13
13
|
import '../../object/core.js';
|
|
14
|
-
import '../../-internals/runtime/lib/mixins/comparable.js';
|
|
15
14
|
import '../../array/index.js';
|
|
16
15
|
import Service from '../../service/index.js';
|
|
17
16
|
import EmberRouter from '../router.js';
|
|
@@ -4,7 +4,7 @@ import '../../debug/index.js';
|
|
|
4
4
|
import EngineInstance from '../../engine/instance.js';
|
|
5
5
|
import '../../../route-recognizer/index.js';
|
|
6
6
|
import '../../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
7
|
-
import { S as STATE_SYMBOL } from '../../../shared-chunks/unrecognized-url-error-
|
|
7
|
+
import { S as STATE_SYMBOL } from '../../../shared-chunks/unrecognized-url-error-B8loxkay.js';
|
|
8
8
|
import { assert } from '../../debug/lib/assert.js';
|
|
9
9
|
|
|
10
10
|
const ALL_PERIODS_REGEX = /\./g;
|
|
@@ -23,7 +23,7 @@ import { once } from '../runloop/index.js';
|
|
|
23
23
|
import { c as hasInternalComponentManager } from '../../shared-chunks/api-DuLOZMO_.js';
|
|
24
24
|
import '../../route-recognizer/index.js';
|
|
25
25
|
import '../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
26
|
-
import { S as STATE_SYMBOL, P as PARAMS_SYMBOL } from '../../shared-chunks/unrecognized-url-error-
|
|
26
|
+
import { S as STATE_SYMBOL, P as PARAMS_SYMBOL } from '../../shared-chunks/unrecognized-url-error-B8loxkay.js';
|
|
27
27
|
import generateController from './lib/generate_controller.js';
|
|
28
28
|
import { prefixRouteNameArg, stashParamNames, calculateCacheKey, normalizeControllerQueryParams } from './lib/utils.js';
|
|
29
29
|
import { a as decorateMethodV2 } from '../../shared-chunks/runtime-CYyqkz5q-BOdRhmsS.js';
|
|
@@ -13,7 +13,6 @@ import '../../shared-chunks/observers-DMlX2nCi.js';
|
|
|
13
13
|
import '../../shared-chunks/property_get-CRP7MFz_.js';
|
|
14
14
|
import { readOnly } from '../object/lib/computed/computed_macros.js';
|
|
15
15
|
import '../object/core.js';
|
|
16
|
-
import '../-internals/runtime/lib/mixins/comparable.js';
|
|
17
16
|
import '../array/index.js';
|
|
18
17
|
import Service from '../service/index.js';
|
|
19
18
|
import EmberRouter from './router.js';
|
|
@@ -15,7 +15,7 @@ import { info } from '../debug/index.js';
|
|
|
15
15
|
import { run, once, scheduleOnce, cancel } from '../runloop/index.js';
|
|
16
16
|
import { getRenderState, getFullQueryParams, hasDefaultSerialize, defaultSerialize } from './route.js';
|
|
17
17
|
import Router from '../../router_js/index.js';
|
|
18
|
-
import { S as STATE_SYMBOL, l as logAbort } from '../../shared-chunks/unrecognized-url-error-
|
|
18
|
+
import { S as STATE_SYMBOL, l as logAbort } from '../../shared-chunks/unrecognized-url-error-B8loxkay.js';
|
|
19
19
|
import '../../shared-chunks/rsvp.es-DR7yS7qg.js';
|
|
20
20
|
import EngineInstance from '../engine/instance.js';
|
|
21
21
|
import { assert } from '../debug/lib/assert.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import typeOf from './type-of.js';
|
|
2
|
-
import Comparable from '../../-internals/runtime/lib/mixins/comparable.js';
|
|
3
2
|
import '../../debug/index.js';
|
|
4
3
|
import { assert } from '../../debug/lib/assert.js';
|
|
5
4
|
|
|
@@ -152,7 +151,11 @@ function compare(v, w) {
|
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
153
|
function isComparable(value) {
|
|
155
|
-
|
|
154
|
+
if (typeof value !== 'object' || value === null) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
let maybeComparable = value;
|
|
158
|
+
return typeof maybeComparable.constructor?.compare === 'function' || typeof maybeComparable.compare === 'function';
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
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-B8loxkay.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
|
}
|
|
@@ -12,6 +12,7 @@ import { dasherize } from '../@ember/-internals/string/index.js';
|
|
|
12
12
|
import { assert } from '../@ember/debug/lib/assert.js';
|
|
13
13
|
import { registerDestructor } from '../@glimmer/destroyable/index.js';
|
|
14
14
|
import { MUTABLE_CELL } from '../@ember/-internals/views/lib/compat/attrs.js';
|
|
15
|
+
import { C as CURLY_MANAGER_BRAND } from './curly-brand-B_F79Dep.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* @deprecated
|
|
@@ -241,6 +242,7 @@ function applyAttributeBindings(attributeBindings, component, rootRef, operation
|
|
|
241
242
|
const EMPTY_POSITIONAL_ARGS = [];
|
|
242
243
|
debugFreeze(EMPTY_POSITIONAL_ARGS);
|
|
243
244
|
class CurlyComponentManager {
|
|
245
|
+
[CURLY_MANAGER_BRAND] = true;
|
|
244
246
|
templateFor(component) {
|
|
245
247
|
let {
|
|
246
248
|
layout,
|
|
@@ -609,9 +611,6 @@ const CURLY_CAPABILITIES = {
|
|
|
609
611
|
willDestroy: true,
|
|
610
612
|
hasSubOwner: false
|
|
611
613
|
};
|
|
612
|
-
const CURLY_COMPONENT_MANAGER = new CurlyComponentManager();
|
|
613
|
-
function isCurlyManager(manager) {
|
|
614
|
-
return manager === CURLY_COMPONENT_MANAGER;
|
|
615
|
-
}
|
|
614
|
+
const CURLY_COMPONENT_MANAGER = /*@__PURE__*/new CurlyComponentManager();
|
|
616
615
|
|
|
617
|
-
export { BOUNDS as B,
|
|
616
|
+
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, processComponentInitializationAssertions as p, 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 };
|