ember-source 4.5.0-alpha.2 → 4.5.0-alpha.5
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/CHANGELOG.md +4 -0
- package/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/global-context.js +9 -1
- package/dist/dependencies/@glimmer/manager.js +276 -212
- package/dist/dependencies/@glimmer/runtime.js +2 -2
- package/dist/dependencies/@glimmer/util.js +1 -22
- package/dist/ember-template-compiler.js +35 -28
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +1202 -1429
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +2 -2
- package/dist/packages/@ember/-internals/glimmer/index.js +24 -19
- package/dist/packages/@ember/-internals/metal/index.js +19 -7
- package/dist/packages/@ember/-internals/routing/lib/location/api.js +3 -3
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +5 -1
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +7 -6
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +9 -6
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +6 -9
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +4 -2
- package/dist/packages/@ember/-internals/routing/lib/utils.js +15 -25
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +14 -15
- package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +32 -44
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +7 -22
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +34 -46
- package/dist/packages/@ember/-internals/runtime/lib/mixins/enumerable.js +2 -15
- package/dist/packages/@ember/-internals/runtime/lib/mixins/evented.js +13 -57
- package/dist/packages/@ember/-internals/runtime/lib/mixins/mutable_enumerable.js +2 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +64 -134
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +28 -86
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +59 -61
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +17 -24
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +59 -85
- package/dist/packages/@ember/-internals/runtime/lib/system/object.js +9 -2
- package/dist/packages/@ember/-internals/runtime/lib/system/object_proxy.js +3 -77
- package/dist/packages/@ember/-internals/utils/index.js +1 -1
- package/dist/packages/@ember/-internals/utils/types.js +1 -0
- package/dist/packages/@ember/-internals/views/lib/compat/attrs.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/component_lookup.js +2 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +3 -9
- package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +4 -6
- package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +13 -18
- package/dist/packages/@ember/-internals/views/lib/mixins/view_state_support.js +3 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +57 -58
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +142 -120
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +2 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +3 -1
- package/dist/packages/@ember/application/instance.js +1 -0
- package/dist/packages/@ember/application/lib/application.js +8 -1
- package/dist/packages/@ember/canary-features/index.js +4 -2
- package/dist/packages/@ember/engine/instance.js +1 -1
- package/dist/packages/@ember/engine/lib/engine-parent.js +1 -5
- package/dist/packages/@ember/renderer/index.js +28 -0
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +823 -709
- package/package.json +17 -17
package/dist/ember.debug.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
|
7
7
|
* @license Licensed under MIT license
|
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
|
9
|
-
* @version 4.5.0-alpha.
|
|
9
|
+
* @version 4.5.0-alpha.5
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -541,7 +541,7 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
var INIT_FACTORY = (
|
|
544
|
+
var INIT_FACTORY = Symbol('INIT_FACTORY');
|
|
545
545
|
_exports.INIT_FACTORY = INIT_FACTORY;
|
|
546
546
|
|
|
547
547
|
function getFactoryFor(obj) {
|
|
@@ -4185,7 +4185,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4185
4185
|
return props;
|
|
4186
4186
|
}
|
|
4187
4187
|
|
|
4188
|
-
var REF = (
|
|
4188
|
+
var REF = Symbol('REF');
|
|
4189
4189
|
|
|
4190
4190
|
class MutableCell {
|
|
4191
4191
|
constructor(ref, value) {
|
|
@@ -4215,9 +4215,9 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4215
4215
|
|
|
4216
4216
|
var ARGS = (0, _utils.enumerableSymbol)('ARGS');
|
|
4217
4217
|
var HAS_BLOCK = (0, _utils.enumerableSymbol)('HAS_BLOCK');
|
|
4218
|
-
var DIRTY_TAG = (
|
|
4219
|
-
var IS_DISPATCHING_ATTRS = (
|
|
4220
|
-
var BOUNDS = (
|
|
4218
|
+
var DIRTY_TAG = Symbol('DIRTY_TAG');
|
|
4219
|
+
var IS_DISPATCHING_ATTRS = Symbol('IS_DISPATCHING_ATTRS');
|
|
4220
|
+
var BOUNDS = Symbol('BOUNDS');
|
|
4221
4221
|
var EMBER_VIEW_REF = (0, _reference.createPrimitiveRef)('ember-view');
|
|
4222
4222
|
|
|
4223
4223
|
function aliasIdToElementId(args, props) {
|
|
@@ -4933,7 +4933,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4933
4933
|
|
|
4934
4934
|
var _a;
|
|
4935
4935
|
|
|
4936
|
-
var RECOMPUTE_TAG = (
|
|
4936
|
+
var RECOMPUTE_TAG = Symbol('RECOMPUTE_TAG');
|
|
4937
4937
|
var IS_CLASSIC_HELPER = Symbol('IS_CLASSIC_HELPER');
|
|
4938
4938
|
|
|
4939
4939
|
class Helper extends _runtime2.FrameworkObject {
|
|
@@ -5919,11 +5919,11 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
5919
5919
|
}
|
|
5920
5920
|
|
|
5921
5921
|
function hasForEach(value) {
|
|
5922
|
-
return typeof value['forEach'] === 'function';
|
|
5922
|
+
return value != null && typeof value['forEach'] === 'function';
|
|
5923
5923
|
}
|
|
5924
5924
|
|
|
5925
5925
|
function isNativeIterable(value) {
|
|
5926
|
-
return typeof value[Symbol.iterator] === 'function';
|
|
5926
|
+
return value != null && typeof value[Symbol.iterator] === 'function';
|
|
5927
5927
|
}
|
|
5928
5928
|
|
|
5929
5929
|
function isIndexable(value) {
|
|
@@ -5946,6 +5946,12 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
5946
5946
|
|
|
5947
5947
|
|
|
5948
5948
|
(0, _globalContext.default)({
|
|
5949
|
+
FEATURES: {
|
|
5950
|
+
DEFAULT_HELPER_MANAGER: Boolean(true
|
|
5951
|
+
/* EMBER_DEFAULT_HELPER_MANAGER */
|
|
5952
|
+
)
|
|
5953
|
+
},
|
|
5954
|
+
|
|
5949
5955
|
scheduleRevalidate() {
|
|
5950
5956
|
_runloop._backburner.ensureInstance();
|
|
5951
5957
|
},
|
|
@@ -7123,11 +7129,18 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7123
7129
|
'-outlet': outletHelper,
|
|
7124
7130
|
'-in-el-null': inElementNullCheckHelper
|
|
7125
7131
|
};
|
|
7132
|
+
var BUILTIN_HELPERS = Object.assign(Object.assign({}, BUILTIN_KEYWORD_HELPERS), {
|
|
7133
|
+
array: _runtime.array,
|
|
7134
|
+
concat: _runtime.concat,
|
|
7135
|
+
fn: _runtime.fn,
|
|
7136
|
+
get: _runtime.get,
|
|
7137
|
+
hash: _runtime.hash
|
|
7138
|
+
});
|
|
7126
7139
|
|
|
7127
7140
|
if (true
|
|
7128
7141
|
/* DEBUG */
|
|
7129
7142
|
) {
|
|
7130
|
-
|
|
7143
|
+
BUILTIN_HELPERS['-disallow-dynamic-resolution'] = disallowDynamicResolution;
|
|
7131
7144
|
} else {
|
|
7132
7145
|
// Bug: this may be a quirk of our test setup?
|
|
7133
7146
|
// In prod builds, this is a no-op helper and is unused in practice. We shouldn't need
|
|
@@ -7137,16 +7150,9 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7137
7150
|
// not really harm anything, since it's just a no-op pass-through helper and the bytes
|
|
7138
7151
|
// has to be included anyway. In the future, perhaps we can avoid the latter by using
|
|
7139
7152
|
// `import(...)`?
|
|
7140
|
-
|
|
7153
|
+
BUILTIN_HELPERS['-disallow-dynamic-resolution'] = disallowDynamicResolution;
|
|
7141
7154
|
}
|
|
7142
7155
|
|
|
7143
|
-
var BUILTIN_HELPERS = Object.assign(Object.assign({}, BUILTIN_KEYWORD_HELPERS), {
|
|
7144
|
-
array: _runtime.array,
|
|
7145
|
-
concat: _runtime.concat,
|
|
7146
|
-
fn: _runtime.fn,
|
|
7147
|
-
get: _runtime.get,
|
|
7148
|
-
hash: _runtime.hash
|
|
7149
|
-
});
|
|
7150
7156
|
{
|
|
7151
7157
|
BUILTIN_HELPERS['unique-id'] = uniqueId;
|
|
7152
7158
|
}
|
|
@@ -7738,7 +7744,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
7738
7744
|
|
|
7739
7745
|
getBounds(view) {
|
|
7740
7746
|
var bounds = view[BOUNDS];
|
|
7741
|
-
(true && !(
|
|
7747
|
+
(true && !(bounds) && (0, _debug.assert)('object passed to getBounds must have the BOUNDS symbol as a property', bounds));
|
|
7742
7748
|
var parentElement = bounds.parentElement();
|
|
7743
7749
|
var firstNode = bounds.firstNode();
|
|
7744
7750
|
var lastNode = bounds.lastNode();
|
|
@@ -9389,8 +9395,13 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
9389
9395
|
*/
|
|
9390
9396
|
|
|
9391
9397
|
|
|
9392
|
-
var PROPERTY_DID_CHANGE = (
|
|
9398
|
+
var PROPERTY_DID_CHANGE = Symbol('PROPERTY_DID_CHANGE');
|
|
9393
9399
|
_exports.PROPERTY_DID_CHANGE = PROPERTY_DID_CHANGE;
|
|
9400
|
+
|
|
9401
|
+
function hasPropertyDidChange(obj) {
|
|
9402
|
+
return obj != null && typeof obj === 'object' && typeof obj[PROPERTY_DID_CHANGE] === 'function';
|
|
9403
|
+
}
|
|
9404
|
+
|
|
9394
9405
|
var deferred = 0;
|
|
9395
9406
|
/**
|
|
9396
9407
|
This function is called just after an object property has changed.
|
|
@@ -9425,9 +9436,11 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
9425
9436
|
}
|
|
9426
9437
|
|
|
9427
9438
|
if (PROPERTY_DID_CHANGE in obj) {
|
|
9428
|
-
//
|
|
9439
|
+
// It's redundant to do this here, but we don't want to check above so we can avoid an extra function call in prod.
|
|
9440
|
+
(true && !(hasPropertyDidChange(obj)) && (0, _debug.assert)('property did change hook is invalid', hasPropertyDidChange(obj))); // we need to check the arguments length here; there's a check in Component's `PROPERTY_DID_CHANGE`
|
|
9429
9441
|
// that checks its arguments length, so we have to explicitly not call this with `value`
|
|
9430
9442
|
// if it is not passed to `notifyPropertyChange`
|
|
9443
|
+
|
|
9431
9444
|
if (arguments.length === 4) {
|
|
9432
9445
|
obj[PROPERTY_DID_CHANGE](keyName, value);
|
|
9433
9446
|
} else {
|
|
@@ -10356,8 +10369,9 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
10356
10369
|
// See GH#18147 / GH#19028 for details.
|
|
10357
10370
|
|
|
10358
10371
|
if ( // ensure that we only run this once, while the component is being instantiated
|
|
10359
|
-
meta$$1.isInitializing() && this._dependentKeys !== undefined && this._dependentKeys.length > 0 &&
|
|
10360
|
-
|
|
10372
|
+
meta$$1.isInitializing() && this._dependentKeys !== undefined && this._dependentKeys.length > 0 && typeof obj[PROPERTY_DID_CHANGE] === 'function' && obj.isComponent) {
|
|
10373
|
+
// It's redundant to do this here, but we don't want to check above so we can avoid an extra function call in prod.
|
|
10374
|
+
(true && !(hasPropertyDidChange(obj)) && (0, _debug.assert)('property did change hook is invalid', hasPropertyDidChange(obj)));
|
|
10361
10375
|
addObserver(obj, keyName, () => {
|
|
10362
10376
|
obj[PROPERTY_DID_CHANGE](keyName);
|
|
10363
10377
|
}, undefined, true);
|
|
@@ -11402,12 +11416,14 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
11402
11416
|
|
|
11403
11417
|
function getProperties(obj, keys) {
|
|
11404
11418
|
var ret = {};
|
|
11405
|
-
var propertyNames
|
|
11419
|
+
var propertyNames;
|
|
11406
11420
|
var i = 1;
|
|
11407
11421
|
|
|
11408
11422
|
if (arguments.length === 2 && Array.isArray(keys)) {
|
|
11409
11423
|
i = 0;
|
|
11410
11424
|
propertyNames = arguments[1];
|
|
11425
|
+
} else {
|
|
11426
|
+
propertyNames = Array.from(arguments);
|
|
11411
11427
|
}
|
|
11412
11428
|
|
|
11413
11429
|
for (; i < propertyNames.length; i++) {
|
|
@@ -11585,7 +11601,7 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
11585
11601
|
if (obj && (0, _utils.getName)(obj) === void 0) {
|
|
11586
11602
|
// Replace the class' `toString` with the dot-separated path
|
|
11587
11603
|
(0, _utils.setName)(obj, paths.join('.')); // Support nested namespaces
|
|
11588
|
-
} else if (obj && obj
|
|
11604
|
+
} else if (obj && isNamespace(obj)) {
|
|
11589
11605
|
// Skip aliased namespaces
|
|
11590
11606
|
if (seen.has(obj)) {
|
|
11591
11607
|
continue;
|
|
@@ -11600,6 +11616,10 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
11600
11616
|
paths.length = idx; // cut out last item
|
|
11601
11617
|
}
|
|
11602
11618
|
|
|
11619
|
+
function isNamespace(obj) {
|
|
11620
|
+
return obj != null && typeof obj === 'object' && obj.isNamespace;
|
|
11621
|
+
}
|
|
11622
|
+
|
|
11603
11623
|
function isUppercase(code) {
|
|
11604
11624
|
return code >= 65 && code <= 90 // A
|
|
11605
11625
|
; // Z
|
|
@@ -13232,10 +13252,10 @@ define("@ember/-internals/routing/lib/location/api", ["exports", "@ember/debug"]
|
|
|
13232
13252
|
@private
|
|
13233
13253
|
*/
|
|
13234
13254
|
create(options) {
|
|
13235
|
-
var implementation = options
|
|
13236
|
-
(true && !(
|
|
13255
|
+
var implementation = options === null || options === void 0 ? void 0 : options.implementation;
|
|
13256
|
+
(true && !(implementation) && (0, _debug.assert)("Location.create: you must specify a 'implementation' option", implementation));
|
|
13237
13257
|
var implementationClass = this.implementations[implementation];
|
|
13238
|
-
(true && !(
|
|
13258
|
+
(true && !(implementationClass) && (0, _debug.assert)(`Location.create: ${implementation} is not a valid implementation`, implementationClass));
|
|
13239
13259
|
(true && !(false) && (0, _debug.deprecate)("Calling `create` on Location class is deprecated. Instead, use `container.lookup('location:my-location')` to lookup the location you need.", false, {
|
|
13240
13260
|
id: 'deprecate-auto-location',
|
|
13241
13261
|
until: '5.0.0',
|
|
@@ -13383,7 +13403,10 @@ define("@ember/-internals/routing/lib/location/auto_location", ["exports", "@emb
|
|
|
13383
13403
|
var {
|
|
13384
13404
|
concreteImplementation
|
|
13385
13405
|
} = this;
|
|
13386
|
-
(true && !(concreteImplementation) && (0, _debug.assert)("AutoLocation's detect() method should be called before calling any other hooks.", concreteImplementation));
|
|
13406
|
+
(true && !(concreteImplementation) && (0, _debug.assert)("AutoLocation's detect() method should be called before calling any other hooks.", concreteImplementation)); // We need this cast because `Parameters` is deferred so that it is not
|
|
13407
|
+
// possible for TS to see it will always produce the right type. However,
|
|
13408
|
+
// since `AnyFn` has a rest type, it is allowed. See discussion on [this
|
|
13409
|
+
// issue](https://github.com/microsoft/TypeScript/issues/47615).
|
|
13387
13410
|
|
|
13388
13411
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13389
13412
|
args[_key] = arguments[_key];
|
|
@@ -14235,13 +14258,13 @@ define("@ember/-internals/routing/lib/location/util", ["exports"], function (_ex
|
|
|
14235
14258
|
location.replace(getOrigin(location) + path);
|
|
14236
14259
|
}
|
|
14237
14260
|
});
|
|
14238
|
-
define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-internals/owner", "@ember/-internals/runtime", "@ember
|
|
14261
|
+
define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-internals/owner", "@ember/-internals/runtime", "@ember/debug", "@ember/object/computed", "@ember/service", "@glimmer/validator", "@ember/-internals/routing/lib/system/router", "@ember/-internals/routing/lib/utils"], function (_exports, _owner, _runtime, _debug, _computed, _service, _validator, _router2, _utils) {
|
|
14239
14262
|
"use strict";
|
|
14240
14263
|
|
|
14241
14264
|
Object.defineProperty(_exports, "__esModule", {
|
|
14242
14265
|
value: true
|
|
14243
14266
|
});
|
|
14244
|
-
_exports.default = void 0;
|
|
14267
|
+
_exports.default = _exports.ROUTER = void 0;
|
|
14245
14268
|
|
|
14246
14269
|
var __decorate = void 0 && (void 0).__decorate || function (decorators, target, key, desc) {
|
|
14247
14270
|
var c = arguments.length,
|
|
@@ -14253,7 +14276,8 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14253
14276
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14254
14277
|
};
|
|
14255
14278
|
|
|
14256
|
-
var ROUTER = (
|
|
14279
|
+
var ROUTER = Symbol('ROUTER');
|
|
14280
|
+
_exports.ROUTER = ROUTER;
|
|
14257
14281
|
|
|
14258
14282
|
function cleanURL(url, rootURL) {
|
|
14259
14283
|
if (rootURL === '/') {
|
|
@@ -14273,14 +14297,16 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14273
14297
|
|
|
14274
14298
|
var owner = (0, _owner.getOwner)(this);
|
|
14275
14299
|
(true && !(owner) && (0, _debug.assert)('RouterService is unexpectedly missing an owner', owner));
|
|
14276
|
-
|
|
14277
|
-
|
|
14278
|
-
|
|
14300
|
+
|
|
14301
|
+
var _router = owner.lookup('router:main');
|
|
14302
|
+
|
|
14303
|
+
(true && !(_router instanceof _router2.default) && (0, _debug.assert)('ROUTER SERVICE BUG: Expected router to be an instance of EmberRouter', _router instanceof _router2.default));
|
|
14304
|
+
return this[ROUTER] = _router;
|
|
14279
14305
|
}
|
|
14280
14306
|
|
|
14281
14307
|
willDestroy() {
|
|
14282
14308
|
super.willDestroy();
|
|
14283
|
-
this[ROUTER] =
|
|
14309
|
+
this[ROUTER] = undefined;
|
|
14284
14310
|
}
|
|
14285
14311
|
/**
|
|
14286
14312
|
Transition the application into another route. The route may
|
|
@@ -14327,7 +14353,7 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14327
14353
|
args[_key] = arguments[_key];
|
|
14328
14354
|
}
|
|
14329
14355
|
|
|
14330
|
-
if ((0,
|
|
14356
|
+
if ((0, _utils.resemblesURL)(args[0])) {
|
|
14331
14357
|
// NOTE: this `args[0] as string` cast is safe and TS correctly infers it
|
|
14332
14358
|
// in 3.6+, so it can be removed when TS is upgraded.
|
|
14333
14359
|
return this._router._doURLTransition('transitionTo', args[0]);
|
|
@@ -14337,7 +14363,7 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14337
14363
|
routeName,
|
|
14338
14364
|
models,
|
|
14339
14365
|
queryParams
|
|
14340
|
-
} = (0,
|
|
14366
|
+
} = (0, _utils.extractRouteArgs)(args);
|
|
14341
14367
|
|
|
14342
14368
|
var transition = this._router._doTransition(routeName, models, queryParams, true);
|
|
14343
14369
|
|
|
@@ -14494,7 +14520,7 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14494
14520
|
routeName,
|
|
14495
14521
|
models,
|
|
14496
14522
|
queryParams
|
|
14497
|
-
} = (0,
|
|
14523
|
+
} = (0, _utils.extractRouteArgs)(args);
|
|
14498
14524
|
var routerMicrolib = this._router._routerMicrolib; // When using isActive() in a getter, we want to entagle with the auto-tracking system
|
|
14499
14525
|
// for example,
|
|
14500
14526
|
// in
|
|
@@ -14538,7 +14564,7 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14538
14564
|
/* fromRouterService */
|
|
14539
14565
|
);
|
|
14540
14566
|
|
|
14541
|
-
return (0,
|
|
14567
|
+
return (0, _utils.shallowEqual)(queryParams, currentQueryParams);
|
|
14542
14568
|
}
|
|
14543
14569
|
|
|
14544
14570
|
return true;
|
|
@@ -14754,7 +14780,7 @@ define("@ember/-internals/routing/lib/services/router", ["exports", "@ember/-int
|
|
|
14754
14780
|
|
|
14755
14781
|
__decorate([(0, _computed.readOnly)('_router.currentRoute')], RouterService.prototype, "currentRoute", void 0);
|
|
14756
14782
|
});
|
|
14757
|
-
define("@ember/-internals/routing/lib/services/routing", ["exports", "@ember/-internals/owner", "@ember
|
|
14783
|
+
define("@ember/-internals/routing/lib/services/routing", ["exports", "@ember/-internals/owner", "@ember/debug", "@ember/object/computed", "@ember/service", "@ember/-internals/routing/lib/system/router", "@ember/-internals/routing/lib/services/router"], function (_exports, _owner, _debug, _computed, _service, _router2, _router3) {
|
|
14758
14784
|
"use strict";
|
|
14759
14785
|
|
|
14760
14786
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -14765,7 +14791,7 @@ define("@ember/-internals/routing/lib/services/routing", ["exports", "@ember/-in
|
|
|
14765
14791
|
/**
|
|
14766
14792
|
@module ember
|
|
14767
14793
|
*/
|
|
14768
|
-
|
|
14794
|
+
|
|
14769
14795
|
/**
|
|
14770
14796
|
The Routing service is used by LinkTo, and provides facilities for
|
|
14771
14797
|
the component/view layer to interact with the router.
|
|
@@ -14776,10 +14802,9 @@ define("@ember/-internals/routing/lib/services/routing", ["exports", "@ember/-in
|
|
|
14776
14802
|
@private
|
|
14777
14803
|
@class RoutingService
|
|
14778
14804
|
*/
|
|
14779
|
-
|
|
14780
14805
|
class RoutingService extends _service.default {
|
|
14781
14806
|
get router() {
|
|
14782
|
-
var router = this[ROUTER];
|
|
14807
|
+
var router = this[_router3.ROUTER];
|
|
14783
14808
|
|
|
14784
14809
|
if (router !== undefined) {
|
|
14785
14810
|
return router;
|
|
@@ -14787,10 +14812,14 @@ define("@ember/-internals/routing/lib/services/routing", ["exports", "@ember/-in
|
|
|
14787
14812
|
|
|
14788
14813
|
var owner = (0, _owner.getOwner)(this);
|
|
14789
14814
|
(true && !(owner) && (0, _debug.assert)('RoutingService is unexpectedly missing an owner', owner));
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14815
|
+
|
|
14816
|
+
var _router = owner.lookup('router:main');
|
|
14817
|
+
|
|
14818
|
+
(true && !(_router instanceof _router2.default) && (0, _debug.assert)('ROUTING SERVICE BUG: Expected router to be an instance of EmberRouter', _router instanceof _router2.default));
|
|
14819
|
+
|
|
14820
|
+
_router.setupRouter();
|
|
14821
|
+
|
|
14822
|
+
return this[_router3.ROUTER] = _router;
|
|
14794
14823
|
}
|
|
14795
14824
|
|
|
14796
14825
|
hasRoute(routeName) {
|
|
@@ -15325,7 +15354,7 @@ define("@ember/-internals/routing/lib/system/route", ["exports", "@ember/-intern
|
|
|
15325
15354
|
|
|
15326
15355
|
var ROUTE_CONNECTIONS = new WeakMap();
|
|
15327
15356
|
_exports.ROUTE_CONNECTIONS = ROUTE_CONNECTIONS;
|
|
15328
|
-
var RENDER = (
|
|
15357
|
+
var RENDER = Symbol('render');
|
|
15329
15358
|
|
|
15330
15359
|
class Route extends _runtime.Object.extend(_runtime.ActionHandler, _runtime.Evented) {
|
|
15331
15360
|
constructor(owner) {
|
|
@@ -16452,7 +16481,7 @@ define("@ember/-internals/routing/lib/system/route", ["exports", "@ember/-intern
|
|
|
16452
16481
|
|
|
16453
16482
|
|
|
16454
16483
|
get _qp() {
|
|
16455
|
-
var combinedQueryParameterConfiguration;
|
|
16484
|
+
var combinedQueryParameterConfiguration = {};
|
|
16456
16485
|
var controllerName = this.controllerName || this.routeName;
|
|
16457
16486
|
var owner = (0, _owner.getOwner)(this);
|
|
16458
16487
|
(true && !(owner) && (0, _debug.assert)('Route is unexpectedly missing an owner', owner));
|
|
@@ -16493,6 +16522,7 @@ define("@ember/-internals/routing/lib/system/route", ["exports", "@ember/-intern
|
|
|
16493
16522
|
}
|
|
16494
16523
|
|
|
16495
16524
|
var desc = combinedQueryParameterConfiguration[propName];
|
|
16525
|
+
(true && !(desc) && (0, _debug.assert)(`[BUG] missing query parameter configuration for ${propName}`, desc));
|
|
16496
16526
|
var scope = desc.scope || 'model';
|
|
16497
16527
|
var parts = undefined;
|
|
16498
16528
|
|
|
@@ -16778,9 +16808,7 @@ define("@ember/-internals/routing/lib/system/route", ["exports", "@ember/-intern
|
|
|
16778
16808
|
continue;
|
|
16779
16809
|
}
|
|
16780
16810
|
|
|
16781
|
-
|
|
16782
|
-
Object.assign(newControllerParameterConfiguration, controllerQP[cqpName], routeQP[cqpName]);
|
|
16783
|
-
qps[cqpName] = newControllerParameterConfiguration; // allows us to skip this QP when we check route QPs.
|
|
16811
|
+
qps[cqpName] = Object.assign(Object.assign({}, controllerQP[cqpName]), routeQP[cqpName]); // allows us to skip this QP when we check route QPs.
|
|
16784
16812
|
|
|
16785
16813
|
keysAlreadyMergedOrSkippable[cqpName] = true;
|
|
16786
16814
|
} // loop over all route qps, skipping those that were merged in the first pass
|
|
@@ -16792,9 +16820,7 @@ define("@ember/-internals/routing/lib/system/route", ["exports", "@ember/-intern
|
|
|
16792
16820
|
continue;
|
|
16793
16821
|
}
|
|
16794
16822
|
|
|
16795
|
-
|
|
16796
|
-
Object.assign(newRouteParameterConfiguration, routeQP[rqpName], controllerQP[rqpName]);
|
|
16797
|
-
qps[rqpName] = newRouteParameterConfiguration;
|
|
16823
|
+
qps[rqpName] = Object.assign(Object.assign({}, routeQP[rqpName]), controllerQP[rqpName]);
|
|
16798
16824
|
}
|
|
16799
16825
|
|
|
16800
16826
|
return qps;
|
|
@@ -18542,7 +18568,7 @@ define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-inter
|
|
|
18542
18568
|
|
|
18543
18569
|
for (var i = routeInfos.length - 1; i >= 0; i--) {
|
|
18544
18570
|
routeInfo = routeInfos[i];
|
|
18545
|
-
(true && !(routeInfo) && (0, _debug.assert)('
|
|
18571
|
+
(true && !(routeInfo) && (0, _debug.assert)('[BUG] Missing routeInfo', routeInfo));
|
|
18546
18572
|
handler = routeInfo.route;
|
|
18547
18573
|
actionHandler = handler && handler.actions && handler.actions[name];
|
|
18548
18574
|
|
|
@@ -18552,6 +18578,8 @@ define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-inter
|
|
|
18552
18578
|
} else {
|
|
18553
18579
|
// Should only hit here if a non-bubbling error action is triggered on a route.
|
|
18554
18580
|
if (name === 'error') {
|
|
18581
|
+
(true && !(handler) && (0, _debug.assert)('[BUG] Missing handler', handler));
|
|
18582
|
+
|
|
18555
18583
|
handler._router._markErrorAsHandled(args[0]);
|
|
18556
18584
|
}
|
|
18557
18585
|
|
|
@@ -18563,7 +18591,7 @@ define("@ember/-internals/routing/lib/system/router", ["exports", "@ember/-inter
|
|
|
18563
18591
|
var defaultHandler = defaultActionHandlers[name];
|
|
18564
18592
|
|
|
18565
18593
|
if (defaultHandler) {
|
|
18566
|
-
defaultHandler.
|
|
18594
|
+
defaultHandler.call(this, routeInfos, ...args);
|
|
18567
18595
|
return;
|
|
18568
18596
|
}
|
|
18569
18597
|
|
|
@@ -19165,35 +19193,26 @@ define("@ember/-internals/routing/lib/utils", ["exports", "@ember/-internals/met
|
|
|
19165
19193
|
}
|
|
19166
19194
|
|
|
19167
19195
|
function accumulateQueryParamDescriptors(_desc, accum) {
|
|
19168
|
-
var desc = _desc
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
if (typeof desc === 'string') {
|
|
19172
|
-
tmp = {};
|
|
19173
|
-
tmp[desc] = {
|
|
19196
|
+
var desc = typeof _desc === 'string' ? {
|
|
19197
|
+
[_desc]: {
|
|
19174
19198
|
as: null
|
|
19175
|
-
}
|
|
19176
|
-
|
|
19177
|
-
}
|
|
19199
|
+
}
|
|
19200
|
+
} : _desc;
|
|
19178
19201
|
|
|
19179
19202
|
for (var key in desc) {
|
|
19180
19203
|
if (!Object.prototype.hasOwnProperty.call(desc, key)) {
|
|
19181
19204
|
return;
|
|
19182
19205
|
}
|
|
19183
19206
|
|
|
19184
|
-
var
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
};
|
|
19190
|
-
}
|
|
19191
|
-
|
|
19192
|
-
var val = accum[key] || {
|
|
19207
|
+
var _singleDesc = desc[key];
|
|
19208
|
+
var singleDesc = typeof _singleDesc === 'string' ? {
|
|
19209
|
+
as: _singleDesc
|
|
19210
|
+
} : _singleDesc;
|
|
19211
|
+
var partialVal = accum[key] || {
|
|
19193
19212
|
as: null,
|
|
19194
19213
|
scope: 'model'
|
|
19195
19214
|
};
|
|
19196
|
-
Object.assign(
|
|
19215
|
+
var val = Object.assign(Object.assign({}, partialVal), singleDesc);
|
|
19197
19216
|
accum[key] = val;
|
|
19198
19217
|
}
|
|
19199
19218
|
}
|
|
@@ -19235,13 +19254,12 @@ define("@ember/-internals/routing/lib/utils", ["exports", "@ember/-internals/met
|
|
|
19235
19254
|
}
|
|
19236
19255
|
|
|
19237
19256
|
function shallowEqual(a, b) {
|
|
19238
|
-
var k;
|
|
19239
19257
|
var aCount = 0;
|
|
19240
19258
|
var bCount = 0;
|
|
19241
19259
|
|
|
19242
|
-
for (
|
|
19243
|
-
if (Object.prototype.hasOwnProperty.call(a,
|
|
19244
|
-
if (a[
|
|
19260
|
+
for (var kA in a) {
|
|
19261
|
+
if (Object.prototype.hasOwnProperty.call(a, kA)) {
|
|
19262
|
+
if (a[kA] !== b[kA]) {
|
|
19245
19263
|
return false;
|
|
19246
19264
|
}
|
|
19247
19265
|
|
|
@@ -19249,8 +19267,8 @@ define("@ember/-internals/routing/lib/utils", ["exports", "@ember/-internals/met
|
|
|
19249
19267
|
}
|
|
19250
19268
|
}
|
|
19251
19269
|
|
|
19252
|
-
for (
|
|
19253
|
-
if (Object.prototype.hasOwnProperty.call(b,
|
|
19270
|
+
for (var kB in b) {
|
|
19271
|
+
if (Object.prototype.hasOwnProperty.call(b, kB)) {
|
|
19254
19272
|
bCount++;
|
|
19255
19273
|
}
|
|
19256
19274
|
}
|
|
@@ -19488,7 +19506,10 @@ define("@ember/-internals/runtime/lib/compare", ["exports", "@ember/-internals/r
|
|
|
19488
19506
|
instance: 7,
|
|
19489
19507
|
function: 8,
|
|
19490
19508
|
class: 9,
|
|
19491
|
-
date: 10
|
|
19509
|
+
date: 10,
|
|
19510
|
+
regexp: 11,
|
|
19511
|
+
filelist: 12,
|
|
19512
|
+
error: 13
|
|
19492
19513
|
}; //
|
|
19493
19514
|
// the spaceship operator
|
|
19494
19515
|
//
|
|
@@ -19794,12 +19815,16 @@ define("@ember/-internals/runtime/lib/mixins/-proxy", ["exports", "@ember/-inter
|
|
|
19794
19815
|
@module ember
|
|
19795
19816
|
*/
|
|
19796
19817
|
function contentFor(proxy) {
|
|
19797
|
-
var content = (0, _metal.get)(proxy, 'content');
|
|
19818
|
+
var content = (0, _metal.get)(proxy, 'content'); // SAFETY: Ideally we'd assert instead of casting, but @glimmer/validator doesn't give us
|
|
19819
|
+
// sufficient public types for this. Previously this code was .js and worked correctly so
|
|
19820
|
+
// hopefully this is sufficiently reliable.
|
|
19821
|
+
|
|
19798
19822
|
(0, _validator.updateTag)((0, _metal.tagForObject)(proxy), (0, _metal.tagForObject)(content));
|
|
19799
19823
|
return content;
|
|
19800
19824
|
}
|
|
19801
19825
|
|
|
19802
19826
|
function customTagForProxy(proxy, key, addMandatorySetter) {
|
|
19827
|
+
(true && !((0, _utils.isProxy)(proxy)) && (0, _debug.assert)('Expected a proxy', (0, _utils.isProxy)(proxy)));
|
|
19803
19828
|
var meta = (0, _validator.tagMetaFor)(proxy);
|
|
19804
19829
|
var tag = (0, _validator.tagFor)(proxy, key, meta);
|
|
19805
19830
|
|
|
@@ -19807,6 +19832,7 @@ define("@ember/-internals/runtime/lib/mixins/-proxy", ["exports", "@ember/-inter
|
|
|
19807
19832
|
/* DEBUG */
|
|
19808
19833
|
) {
|
|
19809
19834
|
// TODO: Replace this with something more first class for tracking tags in DEBUG
|
|
19835
|
+
// SAFETY: This is not an officially supported property but setting shouldn't cause issues.
|
|
19810
19836
|
tag._propertyKey = key;
|
|
19811
19837
|
}
|
|
19812
19838
|
|
|
@@ -19814,6 +19840,7 @@ define("@ember/-internals/runtime/lib/mixins/-proxy", ["exports", "@ember/-inter
|
|
|
19814
19840
|
if (true
|
|
19815
19841
|
/* DEBUG */
|
|
19816
19842
|
&& addMandatorySetter) {
|
|
19843
|
+
(true && !(_utils.setupMandatorySetter) && (0, _debug.assert)('[BUG] setupMandatorySetter should be set when debugging', setupMandatorySetter));
|
|
19817
19844
|
(0, _utils.setupMandatorySetter)(tag, proxy, key);
|
|
19818
19845
|
}
|
|
19819
19846
|
|
|
@@ -19829,20 +19856,11 @@ define("@ember/-internals/runtime/lib/mixins/-proxy", ["exports", "@ember/-inter
|
|
|
19829
19856
|
return (0, _validator.combine)(tags);
|
|
19830
19857
|
}
|
|
19831
19858
|
}
|
|
19832
|
-
/**
|
|
19833
|
-
`Ember.ProxyMixin` forwards all properties not defined by the proxy itself
|
|
19834
|
-
to a proxied `content` object. See ObjectProxy for more details.
|
|
19835
|
-
|
|
19836
|
-
@class ProxyMixin
|
|
19837
|
-
@namespace Ember
|
|
19838
|
-
@private
|
|
19839
|
-
*/
|
|
19840
|
-
|
|
19841
19859
|
|
|
19842
|
-
var
|
|
19860
|
+
var ProxyMixin = _metal.Mixin.create({
|
|
19843
19861
|
/**
|
|
19844
19862
|
The object whose properties will be forwarded.
|
|
19845
|
-
|
|
19863
|
+
@property content
|
|
19846
19864
|
@type {unknown}
|
|
19847
19865
|
@default null
|
|
19848
19866
|
@public
|
|
@@ -19886,12 +19904,14 @@ define("@ember/-internals/runtime/lib/mixins/-proxy", ["exports", "@ember/-inter
|
|
|
19886
19904
|
}
|
|
19887
19905
|
|
|
19888
19906
|
var content = contentFor(this);
|
|
19889
|
-
(true && !(content) && (0, _debug.assert)(`Cannot delegate set('${key}', ${value}) to the 'content' property of object proxy ${this}: its 'content' is undefined.`, content));
|
|
19907
|
+
(true && !(content) && (0, _debug.assert)(`Cannot delegate set('${key}', ${value}) to the 'content' property of object proxy ${this}: its 'content' is undefined.`, content)); // SAFETY: We don't actually guarantee that this is an object, so this isn't necessarily safe :(
|
|
19908
|
+
|
|
19890
19909
|
return (0, _metal.set)(content, key, value);
|
|
19891
19910
|
}
|
|
19892
19911
|
|
|
19893
19912
|
});
|
|
19894
19913
|
|
|
19914
|
+
var _default = ProxyMixin;
|
|
19895
19915
|
_exports.default = _default;
|
|
19896
19916
|
});
|
|
19897
19917
|
define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@ember/-internals/metal", "@ember/debug"], function (_exports, _metal, _debug) {
|
|
@@ -19905,34 +19925,22 @@ define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@embe
|
|
|
19905
19925
|
/**
|
|
19906
19926
|
@module ember
|
|
19907
19927
|
*/
|
|
19908
|
-
|
|
19909
|
-
/**
|
|
19910
|
-
`Ember.ActionHandler` is available on some familiar classes including
|
|
19911
|
-
`Route`, `Component`, and `Controller`.
|
|
19912
|
-
(Internally the mixin is used by `Ember.CoreView`, `Ember.ControllerMixin`,
|
|
19913
|
-
and `Route` and available to the above classes through
|
|
19914
|
-
inheritance.)
|
|
19915
|
-
|
|
19916
|
-
@class ActionHandler
|
|
19917
|
-
@namespace Ember
|
|
19918
|
-
@private
|
|
19919
|
-
*/
|
|
19920
19928
|
var ActionHandler = _metal.Mixin.create({
|
|
19921
19929
|
mergedProperties: ['actions'],
|
|
19922
19930
|
|
|
19923
19931
|
/**
|
|
19924
19932
|
The collection of functions, keyed by name, available on this
|
|
19925
19933
|
`ActionHandler` as action targets.
|
|
19926
|
-
|
|
19934
|
+
These functions will be invoked when a matching `{{action}}` is triggered
|
|
19927
19935
|
from within a template and the application's current route is this route.
|
|
19928
|
-
|
|
19936
|
+
Actions can also be invoked from other parts of your application
|
|
19929
19937
|
via `ActionHandler#send`.
|
|
19930
|
-
|
|
19938
|
+
The `actions` hash will inherit action handlers from
|
|
19931
19939
|
the `actions` hash defined on extended parent classes
|
|
19932
19940
|
or mixins rather than just replace the entire hash, e.g.:
|
|
19933
|
-
|
|
19941
|
+
```app/mixins/can-display-banner.js
|
|
19934
19942
|
import Mixin from '@ember/mixin';
|
|
19935
|
-
|
|
19943
|
+
export default Mixin.create({
|
|
19936
19944
|
actions: {
|
|
19937
19945
|
displayBanner(msg) {
|
|
19938
19946
|
// ...
|
|
@@ -19940,28 +19948,28 @@ define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@embe
|
|
|
19940
19948
|
}
|
|
19941
19949
|
});
|
|
19942
19950
|
```
|
|
19943
|
-
|
|
19951
|
+
```app/routes/welcome.js
|
|
19944
19952
|
import Route from '@ember/routing/route';
|
|
19945
19953
|
import CanDisplayBanner from '../mixins/can-display-banner';
|
|
19946
|
-
|
|
19954
|
+
export default Route.extend(CanDisplayBanner, {
|
|
19947
19955
|
actions: {
|
|
19948
19956
|
playMusic() {
|
|
19949
19957
|
// ...
|
|
19950
19958
|
}
|
|
19951
19959
|
}
|
|
19952
19960
|
});
|
|
19953
|
-
|
|
19961
|
+
// `WelcomeRoute`, when active, will be able to respond
|
|
19954
19962
|
// to both actions, since the actions hash is merged rather
|
|
19955
19963
|
// then replaced when extending mixins / parent classes.
|
|
19956
19964
|
this.send('displayBanner');
|
|
19957
19965
|
this.send('playMusic');
|
|
19958
19966
|
```
|
|
19959
|
-
|
|
19967
|
+
Within a Controller, Route or Component's action handler,
|
|
19960
19968
|
the value of the `this` context is the Controller, Route or
|
|
19961
19969
|
Component object:
|
|
19962
|
-
|
|
19970
|
+
```app/routes/song.js
|
|
19963
19971
|
import Route from '@ember/routing/route';
|
|
19964
|
-
|
|
19972
|
+
export default Route.extend({
|
|
19965
19973
|
actions: {
|
|
19966
19974
|
myAction() {
|
|
19967
19975
|
this.controllerFor("song");
|
|
@@ -19971,13 +19979,13 @@ define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@embe
|
|
|
19971
19979
|
}
|
|
19972
19980
|
});
|
|
19973
19981
|
```
|
|
19974
|
-
|
|
19982
|
+
It is also possible to call `this._super(...arguments)` from within an
|
|
19975
19983
|
action handler if it overrides a handler defined on a parent
|
|
19976
19984
|
class or mixin:
|
|
19977
|
-
|
|
19978
|
-
|
|
19985
|
+
Take for example the following routes:
|
|
19986
|
+
```app/mixins/debug-route.js
|
|
19979
19987
|
import Mixin from '@ember/mixin';
|
|
19980
|
-
|
|
19988
|
+
export default Mixin.create({
|
|
19981
19989
|
actions: {
|
|
19982
19990
|
debugRouteInformation() {
|
|
19983
19991
|
console.debug("It's a-me, console.debug!");
|
|
@@ -19985,54 +19993,54 @@ define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@embe
|
|
|
19985
19993
|
}
|
|
19986
19994
|
});
|
|
19987
19995
|
```
|
|
19988
|
-
|
|
19996
|
+
```app/routes/annoying-debug.js
|
|
19989
19997
|
import Route from '@ember/routing/route';
|
|
19990
19998
|
import DebugRoute from '../mixins/debug-route';
|
|
19991
|
-
|
|
19999
|
+
export default Route.extend(DebugRoute, {
|
|
19992
20000
|
actions: {
|
|
19993
20001
|
debugRouteInformation() {
|
|
19994
20002
|
// also call the debugRouteInformation of mixed in DebugRoute
|
|
19995
20003
|
this._super(...arguments);
|
|
19996
|
-
|
|
20004
|
+
// show additional annoyance
|
|
19997
20005
|
window.alert(...);
|
|
19998
20006
|
}
|
|
19999
20007
|
}
|
|
20000
20008
|
});
|
|
20001
20009
|
```
|
|
20002
|
-
|
|
20003
|
-
|
|
20010
|
+
## Bubbling
|
|
20011
|
+
By default, an action will stop bubbling once a handler defined
|
|
20004
20012
|
on the `actions` hash handles it. To continue bubbling the action,
|
|
20005
20013
|
you must return `true` from the handler:
|
|
20006
|
-
|
|
20014
|
+
```app/router.js
|
|
20007
20015
|
Router.map(function() {
|
|
20008
20016
|
this.route("album", function() {
|
|
20009
20017
|
this.route("song");
|
|
20010
20018
|
});
|
|
20011
20019
|
});
|
|
20012
20020
|
```
|
|
20013
|
-
|
|
20021
|
+
```app/routes/album.js
|
|
20014
20022
|
import Route from '@ember/routing/route';
|
|
20015
|
-
|
|
20023
|
+
export default Route.extend({
|
|
20016
20024
|
actions: {
|
|
20017
20025
|
startPlaying: function() {
|
|
20018
20026
|
}
|
|
20019
20027
|
}
|
|
20020
20028
|
});
|
|
20021
20029
|
```
|
|
20022
|
-
|
|
20030
|
+
```app/routes/album-song.js
|
|
20023
20031
|
import Route from '@ember/routing/route';
|
|
20024
|
-
|
|
20032
|
+
export default Route.extend({
|
|
20025
20033
|
actions: {
|
|
20026
20034
|
startPlaying() {
|
|
20027
20035
|
// ...
|
|
20028
|
-
|
|
20036
|
+
if (actionShouldAlsoBeTriggeredOnParentRoute) {
|
|
20029
20037
|
return true;
|
|
20030
20038
|
}
|
|
20031
20039
|
}
|
|
20032
20040
|
}
|
|
20033
20041
|
});
|
|
20034
20042
|
```
|
|
20035
|
-
|
|
20043
|
+
@property actions
|
|
20036
20044
|
@type Object
|
|
20037
20045
|
@default null
|
|
20038
20046
|
@public
|
|
@@ -20042,14 +20050,14 @@ define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@embe
|
|
|
20042
20050
|
Triggers a named action on the `ActionHandler`. Any parameters
|
|
20043
20051
|
supplied after the `actionName` string will be passed as arguments
|
|
20044
20052
|
to the action target function.
|
|
20045
|
-
|
|
20053
|
+
If the `ActionHandler` has its `target` property set, actions may
|
|
20046
20054
|
bubble to the `target`. Bubbling happens when an `actionName` can
|
|
20047
20055
|
not be found in the `ActionHandler`'s `actions` hash or if the
|
|
20048
20056
|
action target function returns `true`.
|
|
20049
|
-
|
|
20050
|
-
|
|
20057
|
+
Example
|
|
20058
|
+
```app/routes/welcome.js
|
|
20051
20059
|
import Route from '@ember/routing/route';
|
|
20052
|
-
|
|
20060
|
+
export default Route.extend({
|
|
20053
20061
|
actions: {
|
|
20054
20062
|
playTheme() {
|
|
20055
20063
|
this.send('playMusic', 'theme.mp3');
|
|
@@ -20060,7 +20068,7 @@ define("@ember/-internals/runtime/lib/mixins/action_handler", ["exports", "@embe
|
|
|
20060
20068
|
}
|
|
20061
20069
|
});
|
|
20062
20070
|
```
|
|
20063
|
-
|
|
20071
|
+
@method send
|
|
20064
20072
|
@param {String} actionName The action to trigger
|
|
20065
20073
|
@param {*} context a context to send with the action
|
|
20066
20074
|
@public
|
|
@@ -21323,7 +21331,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21323
21331
|
idx >= length, then append to the end of the array.
|
|
21324
21332
|
@param {Number} amt Number of elements that should be removed from
|
|
21325
21333
|
the array, starting at *idx*.
|
|
21326
|
-
@param {EmberArray} objects An array of zero or more objects that should be
|
|
21334
|
+
@param {EmberArray} [objects] An optional array of zero or more objects that should be
|
|
21327
21335
|
inserted into the array at *idx*
|
|
21328
21336
|
@public
|
|
21329
21337
|
*/
|
|
@@ -21752,31 +21760,16 @@ define("@ember/-internals/runtime/lib/mixins/comparable", ["exports", "@ember/-i
|
|
|
21752
21760
|
});
|
|
21753
21761
|
_exports.default = void 0;
|
|
21754
21762
|
|
|
21755
|
-
|
|
21756
|
-
@module ember
|
|
21757
|
-
*/
|
|
21758
|
-
|
|
21759
|
-
/**
|
|
21760
|
-
Implements some standard methods for comparing objects. Add this mixin to
|
|
21761
|
-
any class you create that can compare its instances.
|
|
21762
|
-
|
|
21763
|
-
You should implement the `compare()` method.
|
|
21764
|
-
|
|
21765
|
-
@class Comparable
|
|
21766
|
-
@namespace Ember
|
|
21767
|
-
@since Ember 0.9
|
|
21768
|
-
@private
|
|
21769
|
-
*/
|
|
21770
|
-
var _default = _metal.Mixin.create({
|
|
21763
|
+
var Comparable = _metal.Mixin.create({
|
|
21771
21764
|
/**
|
|
21772
21765
|
__Required.__ You must implement this method to apply this mixin.
|
|
21773
|
-
|
|
21766
|
+
Override to return the result of the comparison of the two parameters. The
|
|
21774
21767
|
compare method should return:
|
|
21775
|
-
|
|
21768
|
+
- `-1` if `a < b`
|
|
21776
21769
|
- `0` if `a == b`
|
|
21777
21770
|
- `1` if `a > b`
|
|
21778
|
-
|
|
21779
|
-
|
|
21771
|
+
Default implementation raises an exception.
|
|
21772
|
+
@method compare
|
|
21780
21773
|
@param a {Object} the first object to compare
|
|
21781
21774
|
@param b {Object} the second object to compare
|
|
21782
21775
|
@return {Number} the result of the comparison
|
|
@@ -21785,6 +21778,7 @@ define("@ember/-internals/runtime/lib/mixins/comparable", ["exports", "@ember/-i
|
|
|
21785
21778
|
compare: null
|
|
21786
21779
|
});
|
|
21787
21780
|
|
|
21781
|
+
var _default = Comparable;
|
|
21788
21782
|
_exports.default = _default;
|
|
21789
21783
|
});
|
|
21790
21784
|
define("@ember/-internals/runtime/lib/mixins/container_proxy", ["exports", "@ember/runloop", "@ember/-internals/metal"], function (_exports, _runloop, _metal) {
|
|
@@ -21795,21 +21789,10 @@ define("@ember/-internals/runtime/lib/mixins/container_proxy", ["exports", "@emb
|
|
|
21795
21789
|
});
|
|
21796
21790
|
_exports.default = void 0;
|
|
21797
21791
|
|
|
21798
|
-
|
|
21799
|
-
@module ember
|
|
21800
|
-
*/
|
|
21801
|
-
|
|
21802
|
-
/**
|
|
21803
|
-
ContainerProxyMixin is used to provide public access to specific
|
|
21804
|
-
container functionality.
|
|
21805
|
-
|
|
21806
|
-
@class ContainerProxyMixin
|
|
21807
|
-
@private
|
|
21808
|
-
*/
|
|
21809
|
-
var containerProxyMixin = {
|
|
21792
|
+
var ContainerProxyMixin = _metal.Mixin.create({
|
|
21810
21793
|
/**
|
|
21811
21794
|
The container stores state.
|
|
21812
|
-
|
|
21795
|
+
@private
|
|
21813
21796
|
@property {Ember.Container} __container__
|
|
21814
21797
|
*/
|
|
21815
21798
|
__container__: null,
|
|
@@ -21817,16 +21800,16 @@ define("@ember/-internals/runtime/lib/mixins/container_proxy", ["exports", "@emb
|
|
|
21817
21800
|
/**
|
|
21818
21801
|
Returns an object that can be used to provide an owner to a
|
|
21819
21802
|
manually created instance.
|
|
21820
|
-
|
|
21821
|
-
|
|
21803
|
+
Example:
|
|
21804
|
+
```
|
|
21822
21805
|
import { getOwner } from '@ember/application';
|
|
21823
|
-
|
|
21824
|
-
|
|
21806
|
+
let owner = getOwner(this);
|
|
21807
|
+
User.create(
|
|
21825
21808
|
owner.ownerInjection(),
|
|
21826
21809
|
{ username: 'rwjblue' }
|
|
21827
21810
|
)
|
|
21828
21811
|
```
|
|
21829
|
-
|
|
21812
|
+
@public
|
|
21830
21813
|
@method ownerInjection
|
|
21831
21814
|
@since 2.3.0
|
|
21832
21815
|
@return {Object}
|
|
@@ -21837,30 +21820,30 @@ define("@ember/-internals/runtime/lib/mixins/container_proxy", ["exports", "@emb
|
|
|
21837
21820
|
|
|
21838
21821
|
/**
|
|
21839
21822
|
Given a fullName return a corresponding instance.
|
|
21840
|
-
|
|
21823
|
+
The default behavior is for lookup to return a singleton instance.
|
|
21841
21824
|
The singleton is scoped to the container, allowing multiple containers
|
|
21842
21825
|
to all have their own locally scoped singletons.
|
|
21843
|
-
|
|
21826
|
+
```javascript
|
|
21844
21827
|
let registry = new Registry();
|
|
21845
21828
|
let container = registry.container();
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21829
|
+
registry.register('api:twitter', Twitter);
|
|
21830
|
+
let twitter = container.lookup('api:twitter');
|
|
21831
|
+
twitter instanceof Twitter; // => true
|
|
21832
|
+
// by default the container will return singletons
|
|
21850
21833
|
let twitter2 = container.lookup('api:twitter');
|
|
21851
21834
|
twitter2 instanceof Twitter; // => true
|
|
21852
|
-
|
|
21835
|
+
twitter === twitter2; //=> true
|
|
21853
21836
|
```
|
|
21854
|
-
|
|
21855
|
-
|
|
21837
|
+
If singletons are not wanted an optional flag can be provided at lookup.
|
|
21838
|
+
```javascript
|
|
21856
21839
|
let registry = new Registry();
|
|
21857
21840
|
let container = registry.container();
|
|
21858
|
-
|
|
21859
|
-
|
|
21841
|
+
registry.register('api:twitter', Twitter);
|
|
21842
|
+
let twitter = container.lookup('api:twitter', { singleton: false });
|
|
21860
21843
|
let twitter2 = container.lookup('api:twitter', { singleton: false });
|
|
21861
|
-
|
|
21844
|
+
twitter === twitter2; //=> false
|
|
21862
21845
|
```
|
|
21863
|
-
|
|
21846
|
+
@public
|
|
21864
21847
|
@method lookup
|
|
21865
21848
|
@param {String} fullName
|
|
21866
21849
|
@param {Object} options
|
|
@@ -21885,49 +21868,44 @@ define("@ember/-internals/runtime/lib/mixins/container_proxy", ["exports", "@emb
|
|
|
21885
21868
|
|
|
21886
21869
|
/**
|
|
21887
21870
|
Given a fullName return a factory manager.
|
|
21888
|
-
|
|
21871
|
+
This method returns a manager which can be used for introspection of the
|
|
21889
21872
|
factory's class or for the creation of factory instances with initial
|
|
21890
21873
|
properties. The manager is an object with the following properties:
|
|
21891
|
-
|
|
21874
|
+
* `class` - The registered or resolved class.
|
|
21892
21875
|
* `create` - A function that will create an instance of the class with
|
|
21893
21876
|
any dependencies injected.
|
|
21894
|
-
|
|
21895
|
-
|
|
21877
|
+
For example:
|
|
21878
|
+
```javascript
|
|
21896
21879
|
import { getOwner } from '@ember/application';
|
|
21897
|
-
|
|
21880
|
+
let owner = getOwner(otherInstance);
|
|
21898
21881
|
// the owner is commonly the `applicationInstance`, and can be accessed via
|
|
21899
21882
|
// an instance initializer.
|
|
21900
|
-
|
|
21901
|
-
|
|
21883
|
+
let factory = owner.factoryFor('service:bespoke');
|
|
21884
|
+
factory.class;
|
|
21902
21885
|
// The registered or resolved class. For example when used with an Ember-CLI
|
|
21903
21886
|
// app, this would be the default export from `app/services/bespoke.js`.
|
|
21904
|
-
|
|
21887
|
+
let instance = factory.create({
|
|
21905
21888
|
someProperty: 'an initial property value'
|
|
21906
21889
|
});
|
|
21907
21890
|
// Create an instance with any injections and the passed options as
|
|
21908
21891
|
// initial properties.
|
|
21909
21892
|
```
|
|
21910
|
-
|
|
21893
|
+
Any instances created via the factory's `.create()` method *must* be destroyed
|
|
21911
21894
|
manually by the caller of `.create()`. Typically, this is done during the creating
|
|
21912
21895
|
objects own `destroy` or `willDestroy` methods.
|
|
21913
|
-
|
|
21896
|
+
@public
|
|
21914
21897
|
@method factoryFor
|
|
21915
21898
|
@param {String} fullName
|
|
21916
21899
|
@param {Object} options
|
|
21917
21900
|
@return {FactoryManager}
|
|
21918
21901
|
*/
|
|
21919
|
-
factoryFor(fullName
|
|
21920
|
-
|
|
21921
|
-
options = {};
|
|
21922
|
-
}
|
|
21923
|
-
|
|
21924
|
-
return this.__container__.factoryFor(fullName, options);
|
|
21902
|
+
factoryFor(fullName) {
|
|
21903
|
+
return this.__container__.factoryFor(fullName);
|
|
21925
21904
|
}
|
|
21926
21905
|
|
|
21927
|
-
};
|
|
21928
|
-
|
|
21929
|
-
var _default = _metal.Mixin.create(containerProxyMixin);
|
|
21906
|
+
});
|
|
21930
21907
|
|
|
21908
|
+
var _default = ContainerProxyMixin;
|
|
21931
21909
|
_exports.default = _default;
|
|
21932
21910
|
});
|
|
21933
21911
|
define("@ember/-internals/runtime/lib/mixins/enumerable", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
@@ -21938,21 +21916,9 @@ define("@ember/-internals/runtime/lib/mixins/enumerable", ["exports", "@ember/-i
|
|
|
21938
21916
|
});
|
|
21939
21917
|
_exports.default = void 0;
|
|
21940
21918
|
|
|
21941
|
-
|
|
21942
|
-
@module @ember/enumerable
|
|
21943
|
-
@private
|
|
21944
|
-
*/
|
|
21945
|
-
|
|
21946
|
-
/**
|
|
21947
|
-
The methods in this mixin have been moved to [MutableArray](/ember/release/classes/MutableArray). This mixin has
|
|
21948
|
-
been intentionally preserved to avoid breaking Enumerable.detect checks
|
|
21949
|
-
until the community migrates away from them.
|
|
21950
|
-
|
|
21951
|
-
@class Enumerable
|
|
21952
|
-
@private
|
|
21953
|
-
*/
|
|
21954
|
-
var _default = _metal.Mixin.create();
|
|
21919
|
+
var Enumerable = _metal.Mixin.create();
|
|
21955
21920
|
|
|
21921
|
+
var _default = Enumerable;
|
|
21956
21922
|
_exports.default = _default;
|
|
21957
21923
|
});
|
|
21958
21924
|
define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
@@ -21963,63 +21929,19 @@ define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-inte
|
|
|
21963
21929
|
});
|
|
21964
21930
|
_exports.default = void 0;
|
|
21965
21931
|
|
|
21966
|
-
|
|
21967
|
-
@module @ember/object
|
|
21968
|
-
*/
|
|
21969
|
-
|
|
21970
|
-
/**
|
|
21971
|
-
This mixin allows for Ember objects to subscribe to and emit events.
|
|
21972
|
-
|
|
21973
|
-
```app/utils/person.js
|
|
21974
|
-
import EmberObject from '@ember/object';
|
|
21975
|
-
import Evented from '@ember/object/evented';
|
|
21976
|
-
|
|
21977
|
-
export default EmberObject.extend(Evented, {
|
|
21978
|
-
greet() {
|
|
21979
|
-
// ...
|
|
21980
|
-
this.trigger('greet');
|
|
21981
|
-
}
|
|
21982
|
-
});
|
|
21983
|
-
```
|
|
21984
|
-
|
|
21985
|
-
```javascript
|
|
21986
|
-
var person = Person.create();
|
|
21987
|
-
|
|
21988
|
-
person.on('greet', function() {
|
|
21989
|
-
console.log('Our person has greeted');
|
|
21990
|
-
});
|
|
21991
|
-
|
|
21992
|
-
person.greet();
|
|
21993
|
-
|
|
21994
|
-
// outputs: 'Our person has greeted'
|
|
21995
|
-
```
|
|
21996
|
-
|
|
21997
|
-
You can also chain multiple event subscriptions:
|
|
21998
|
-
|
|
21999
|
-
```javascript
|
|
22000
|
-
person.on('greet', function() {
|
|
22001
|
-
console.log('Our person has greeted');
|
|
22002
|
-
}).one('greet', function() {
|
|
22003
|
-
console.log('Offer one-time special');
|
|
22004
|
-
}).off('event', this, forgetThis);
|
|
22005
|
-
```
|
|
22006
|
-
|
|
22007
|
-
@class Evented
|
|
22008
|
-
@public
|
|
22009
|
-
*/
|
|
22010
|
-
var _default = _metal.Mixin.create({
|
|
21932
|
+
var Evented = _metal.Mixin.create({
|
|
22011
21933
|
/**
|
|
22012
21934
|
Subscribes to a named event with given function.
|
|
22013
|
-
|
|
21935
|
+
```javascript
|
|
22014
21936
|
person.on('didLoad', function() {
|
|
22015
21937
|
// fired once the person has loaded
|
|
22016
21938
|
});
|
|
22017
21939
|
```
|
|
22018
|
-
|
|
21940
|
+
An optional target can be passed in as the 2nd argument that will
|
|
22019
21941
|
be set as the "this" for the callback. This is a good way to give your
|
|
22020
21942
|
function access to the object triggering the event. When the target
|
|
22021
21943
|
parameter is used the callback method becomes the third argument.
|
|
22022
|
-
|
|
21944
|
+
@method on
|
|
22023
21945
|
@param {String} name The name of the event
|
|
22024
21946
|
@param {Object} [target] The "this" binding for the callback
|
|
22025
21947
|
@param {Function|String} method A function or the name of a function to be called on `target`
|
|
@@ -22035,10 +21957,10 @@ define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-inte
|
|
|
22035
21957
|
Subscribes a function to a named event and then cancels the subscription
|
|
22036
21958
|
after the first time the event is triggered. It is good to use ``one`` when
|
|
22037
21959
|
you only care about the first time an event has taken place.
|
|
22038
|
-
|
|
21960
|
+
This function takes an optional 2nd argument that will become the "this"
|
|
22039
21961
|
value for the callback. When the target parameter is used the callback method
|
|
22040
21962
|
becomes the third argument.
|
|
22041
|
-
|
|
21963
|
+
@method one
|
|
22042
21964
|
@param {String} name The name of the event
|
|
22043
21965
|
@param {Object} [target] The "this" binding for the callback
|
|
22044
21966
|
@param {Function|String} method A function or the name of a function to be called on `target`
|
|
@@ -22054,12 +21976,12 @@ define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-inte
|
|
|
22054
21976
|
Triggers a named event for the object. Any additional arguments
|
|
22055
21977
|
will be passed as parameters to the functions that are subscribed to the
|
|
22056
21978
|
event.
|
|
22057
|
-
|
|
21979
|
+
```javascript
|
|
22058
21980
|
person.on('didEat', function(food) {
|
|
22059
21981
|
console.log('person ate some ' + food);
|
|
22060
21982
|
});
|
|
22061
|
-
|
|
22062
|
-
|
|
21983
|
+
person.trigger('didEat', 'broccoli');
|
|
21984
|
+
// outputs: person ate some broccoli
|
|
22063
21985
|
```
|
|
22064
21986
|
@method trigger
|
|
22065
21987
|
@param {String} name The name of the event
|
|
@@ -22076,7 +21998,7 @@ define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-inte
|
|
|
22076
21998
|
|
|
22077
21999
|
/**
|
|
22078
22000
|
Cancels subscription for given name, target, and method.
|
|
22079
|
-
|
|
22001
|
+
@method off
|
|
22080
22002
|
@param {String} name The name of the event
|
|
22081
22003
|
@param {Object} target The target of the subscription
|
|
22082
22004
|
@param {Function|String} method The function or the name of a function of the subscription
|
|
@@ -22090,7 +22012,7 @@ define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-inte
|
|
|
22090
22012
|
|
|
22091
22013
|
/**
|
|
22092
22014
|
Checks to see if object has any subscriptions for named event.
|
|
22093
|
-
|
|
22015
|
+
@method has
|
|
22094
22016
|
@param {String} name The name of the event
|
|
22095
22017
|
@return {Boolean} does the object have a subscription for event
|
|
22096
22018
|
@public
|
|
@@ -22101,6 +22023,7 @@ define("@ember/-internals/runtime/lib/mixins/evented", ["exports", "@ember/-inte
|
|
|
22101
22023
|
|
|
22102
22024
|
});
|
|
22103
22025
|
|
|
22026
|
+
var _default = Evented;
|
|
22104
22027
|
_exports.default = _default;
|
|
22105
22028
|
});
|
|
22106
22029
|
define("@ember/-internals/runtime/lib/mixins/mutable_enumerable", ["exports", "@ember/-internals/runtime/lib/mixins/enumerable", "@ember/-internals/metal"], function (_exports, _enumerable, _metal) {
|
|
@@ -22111,22 +22034,9 @@ define("@ember/-internals/runtime/lib/mixins/mutable_enumerable", ["exports", "@
|
|
|
22111
22034
|
});
|
|
22112
22035
|
_exports.default = void 0;
|
|
22113
22036
|
|
|
22114
|
-
|
|
22115
|
-
@module ember
|
|
22116
|
-
*/
|
|
22117
|
-
|
|
22118
|
-
/**
|
|
22119
|
-
The methods in this mixin have been moved to MutableArray. This mixin has
|
|
22120
|
-
been intentionally preserved to avoid breaking MutableEnumerable.detect
|
|
22121
|
-
checks until the community migrates away from them.
|
|
22122
|
-
|
|
22123
|
-
@class MutableEnumerable
|
|
22124
|
-
@namespace Ember
|
|
22125
|
-
@uses Enumerable
|
|
22126
|
-
@private
|
|
22127
|
-
*/
|
|
22128
|
-
var _default = _metal.Mixin.create(_enumerable.default);
|
|
22037
|
+
var MutableEnumerable = _metal.Mixin.create(_enumerable.default);
|
|
22129
22038
|
|
|
22039
|
+
var _default = MutableEnumerable;
|
|
22130
22040
|
_exports.default = _default;
|
|
22131
22041
|
});
|
|
22132
22042
|
define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-internals/meta", "@ember/-internals/metal", "@ember/debug"], function (_exports, _meta, _metal, _debug) {
|
|
@@ -22140,105 +22050,34 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22140
22050
|
/**
|
|
22141
22051
|
@module @ember/object
|
|
22142
22052
|
*/
|
|
22143
|
-
|
|
22144
|
-
/**
|
|
22145
|
-
## Overview
|
|
22146
|
-
|
|
22147
|
-
This mixin provides properties and property observing functionality, core
|
|
22148
|
-
features of the Ember object model.
|
|
22149
|
-
|
|
22150
|
-
Properties and observers allow one object to observe changes to a
|
|
22151
|
-
property on another object. This is one of the fundamental ways that
|
|
22152
|
-
models, controllers and views communicate with each other in an Ember
|
|
22153
|
-
application.
|
|
22154
|
-
|
|
22155
|
-
Any object that has this mixin applied can be used in observer
|
|
22156
|
-
operations. That includes `EmberObject` and most objects you will
|
|
22157
|
-
interact with as you write your Ember application.
|
|
22158
|
-
|
|
22159
|
-
Note that you will not generally apply this mixin to classes yourself,
|
|
22160
|
-
but you will use the features provided by this module frequently, so it
|
|
22161
|
-
is important to understand how to use it.
|
|
22162
|
-
|
|
22163
|
-
## Using `get()` and `set()`
|
|
22164
|
-
|
|
22165
|
-
Because of Ember's support for bindings and observers, you will always
|
|
22166
|
-
access properties using the get method, and set properties using the
|
|
22167
|
-
set method. This allows the observing objects to be notified and
|
|
22168
|
-
computed properties to be handled properly.
|
|
22169
|
-
|
|
22170
|
-
More documentation about `get` and `set` are below.
|
|
22171
|
-
|
|
22172
|
-
## Observing Property Changes
|
|
22173
|
-
|
|
22174
|
-
You typically observe property changes simply by using the `observer`
|
|
22175
|
-
function in classes that you write.
|
|
22176
|
-
|
|
22177
|
-
For example:
|
|
22178
|
-
|
|
22179
|
-
```javascript
|
|
22180
|
-
import { observer } from '@ember/object';
|
|
22181
|
-
import EmberObject from '@ember/object';
|
|
22182
|
-
|
|
22183
|
-
EmberObject.extend({
|
|
22184
|
-
valueObserver: observer('value', function(sender, key, value, rev) {
|
|
22185
|
-
// Executes whenever the "value" property changes
|
|
22186
|
-
// See the addObserver method for more information about the callback arguments
|
|
22187
|
-
})
|
|
22188
|
-
});
|
|
22189
|
-
```
|
|
22190
|
-
|
|
22191
|
-
Although this is the most common way to add an observer, this capability
|
|
22192
|
-
is actually built into the `EmberObject` class on top of two methods
|
|
22193
|
-
defined in this mixin: `addObserver` and `removeObserver`. You can use
|
|
22194
|
-
these two methods to add and remove observers yourself if you need to
|
|
22195
|
-
do so at runtime.
|
|
22196
|
-
|
|
22197
|
-
To add an observer for a property, call:
|
|
22198
|
-
|
|
22199
|
-
```javascript
|
|
22200
|
-
object.addObserver('propertyKey', targetObject, targetAction)
|
|
22201
|
-
```
|
|
22202
|
-
|
|
22203
|
-
This will call the `targetAction` method on the `targetObject` whenever
|
|
22204
|
-
the value of the `propertyKey` changes.
|
|
22205
|
-
|
|
22206
|
-
Note that if `propertyKey` is a computed property, the observer will be
|
|
22207
|
-
called when any of the property dependencies are changed, even if the
|
|
22208
|
-
resulting value of the computed property is unchanged. This is necessary
|
|
22209
|
-
because computed properties are not computed until `get` is called.
|
|
22210
|
-
|
|
22211
|
-
@class Observable
|
|
22212
|
-
@public
|
|
22213
|
-
*/
|
|
22214
|
-
var _default = _metal.Mixin.create({
|
|
22053
|
+
var Observable = _metal.Mixin.create({
|
|
22215
22054
|
/**
|
|
22216
22055
|
Retrieves the value of a property from the object.
|
|
22217
|
-
|
|
22056
|
+
This method is usually similar to using `object[keyName]` or `object.keyName`,
|
|
22218
22057
|
however it supports both computed properties and the unknownProperty
|
|
22219
22058
|
handler.
|
|
22220
|
-
|
|
22059
|
+
Because `get` unifies the syntax for accessing all these kinds
|
|
22221
22060
|
of properties, it can make many refactorings easier, such as replacing a
|
|
22222
22061
|
simple property with a computed property, or vice versa.
|
|
22223
|
-
|
|
22224
|
-
|
|
22062
|
+
### Computed Properties
|
|
22063
|
+
Computed properties are methods defined with the `property` modifier
|
|
22225
22064
|
declared at the end, such as:
|
|
22226
|
-
|
|
22065
|
+
```javascript
|
|
22227
22066
|
import { computed } from '@ember/object';
|
|
22228
|
-
|
|
22067
|
+
fullName: computed('firstName', 'lastName', function() {
|
|
22229
22068
|
return this.get('firstName') + ' ' + this.get('lastName');
|
|
22230
22069
|
})
|
|
22231
22070
|
```
|
|
22232
|
-
|
|
22071
|
+
When you call `get` on a computed property, the function will be
|
|
22233
22072
|
called and the return value will be returned instead of the function
|
|
22234
22073
|
itself.
|
|
22235
|
-
|
|
22236
|
-
|
|
22074
|
+
### Unknown Properties
|
|
22075
|
+
Likewise, if you try to call `get` on a property whose value is
|
|
22237
22076
|
`undefined`, the `unknownProperty()` method will be called on the object.
|
|
22238
22077
|
If this method returns any value other than `undefined`, it will be returned
|
|
22239
22078
|
instead. This allows you to implement "virtual" properties that are
|
|
22240
22079
|
not defined upfront.
|
|
22241
|
-
|
|
22080
|
+
@method get
|
|
22242
22081
|
@param {String} keyName The property to retrieve
|
|
22243
22082
|
@return {Object} The property value or undefined.
|
|
22244
22083
|
@public
|
|
@@ -22250,16 +22089,16 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22250
22089
|
/**
|
|
22251
22090
|
To get the values of multiple properties at once, call `getProperties`
|
|
22252
22091
|
with a list of strings or an array:
|
|
22253
|
-
|
|
22092
|
+
```javascript
|
|
22254
22093
|
record.getProperties('firstName', 'lastName', 'zipCode');
|
|
22255
22094
|
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
|
|
22256
22095
|
```
|
|
22257
|
-
|
|
22258
|
-
|
|
22096
|
+
is equivalent to:
|
|
22097
|
+
```javascript
|
|
22259
22098
|
record.getProperties(['firstName', 'lastName', 'zipCode']);
|
|
22260
22099
|
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
|
|
22261
22100
|
```
|
|
22262
|
-
|
|
22101
|
+
@method getProperties
|
|
22263
22102
|
@param {String...|Array} list of keys to get
|
|
22264
22103
|
@return {Object}
|
|
22265
22104
|
@public
|
|
@@ -22269,39 +22108,39 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22269
22108
|
args[_key] = arguments[_key];
|
|
22270
22109
|
}
|
|
22271
22110
|
|
|
22272
|
-
return (0, _metal.getProperties)(...
|
|
22111
|
+
return (0, _metal.getProperties)(this, ...args);
|
|
22273
22112
|
},
|
|
22274
22113
|
|
|
22275
22114
|
/**
|
|
22276
22115
|
Sets the provided key or path to the value.
|
|
22277
|
-
|
|
22116
|
+
```javascript
|
|
22278
22117
|
record.set("key", value);
|
|
22279
22118
|
```
|
|
22280
|
-
|
|
22119
|
+
This method is generally very similar to calling `object["key"] = value` or
|
|
22281
22120
|
`object.key = value`, except that it provides support for computed
|
|
22282
22121
|
properties, the `setUnknownProperty()` method and property observers.
|
|
22283
|
-
|
|
22284
|
-
|
|
22122
|
+
### Computed Properties
|
|
22123
|
+
If you try to set a value on a key that has a computed property handler
|
|
22285
22124
|
defined (see the `get()` method for an example), then `set()` will call
|
|
22286
22125
|
that method, passing both the value and key instead of simply changing
|
|
22287
22126
|
the value itself. This is useful for those times when you need to
|
|
22288
22127
|
implement a property that is composed of one or more member
|
|
22289
22128
|
properties.
|
|
22290
|
-
|
|
22291
|
-
|
|
22129
|
+
### Unknown Properties
|
|
22130
|
+
If you try to set a value on a key that is undefined in the target
|
|
22292
22131
|
object, then the `setUnknownProperty()` handler will be called instead. This
|
|
22293
22132
|
gives you an opportunity to implement complex "virtual" properties that
|
|
22294
22133
|
are not predefined on the object. If `setUnknownProperty()` returns
|
|
22295
22134
|
undefined, then `set()` will simply set the value on the object.
|
|
22296
|
-
|
|
22297
|
-
|
|
22135
|
+
### Property Observers
|
|
22136
|
+
In addition to changing the property, `set()` will also register a property
|
|
22298
22137
|
change with the object. Unless you have placed this call inside of a
|
|
22299
22138
|
`beginPropertyChanges()` and `endPropertyChanges(),` any "local" observers
|
|
22300
22139
|
(i.e. observer methods declared on the same object), will be called
|
|
22301
22140
|
immediately. Any "remote" observers (i.e. observer methods declared on
|
|
22302
22141
|
another object) will be placed in a queue and called at a later time in a
|
|
22303
22142
|
coalesced manner.
|
|
22304
|
-
|
|
22143
|
+
@method set
|
|
22305
22144
|
@param {String} keyName The property to set
|
|
22306
22145
|
@param {Object} value The value to set or `null`.
|
|
22307
22146
|
@return {Object} The passed value
|
|
@@ -22315,10 +22154,10 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22315
22154
|
Sets a list of properties at once. These properties are set inside
|
|
22316
22155
|
a single `beginPropertyChanges` and `endPropertyChanges` batch, so
|
|
22317
22156
|
observers will be buffered.
|
|
22318
|
-
|
|
22157
|
+
```javascript
|
|
22319
22158
|
record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });
|
|
22320
22159
|
```
|
|
22321
|
-
|
|
22160
|
+
@method setProperties
|
|
22322
22161
|
@param {Object} hash the hash of keys and values to set
|
|
22323
22162
|
@return {Object} The passed in hash
|
|
22324
22163
|
@public
|
|
@@ -22329,14 +22168,14 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22329
22168
|
|
|
22330
22169
|
/**
|
|
22331
22170
|
Begins a grouping of property changes.
|
|
22332
|
-
|
|
22171
|
+
You can use this method to group property changes so that notifications
|
|
22333
22172
|
will not be sent until the changes are finished. If you plan to make a
|
|
22334
22173
|
large number of changes to an object at one time, you should call this
|
|
22335
22174
|
method at the beginning of the changes to begin deferring change
|
|
22336
22175
|
notifications. When you are done making changes, call
|
|
22337
22176
|
`endPropertyChanges()` to deliver the deferred change notifications and end
|
|
22338
22177
|
deferring.
|
|
22339
|
-
|
|
22178
|
+
@method beginPropertyChanges
|
|
22340
22179
|
@return {Observable}
|
|
22341
22180
|
@private
|
|
22342
22181
|
*/
|
|
@@ -22347,13 +22186,13 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22347
22186
|
|
|
22348
22187
|
/**
|
|
22349
22188
|
Ends a grouping of property changes.
|
|
22350
|
-
|
|
22189
|
+
You can use this method to group property changes so that notifications
|
|
22351
22190
|
will not be sent until the changes are finished. If you plan to make a
|
|
22352
22191
|
large number of changes to an object at one time, you should call
|
|
22353
22192
|
`beginPropertyChanges()` at the beginning of the changes to defer change
|
|
22354
22193
|
notifications. When you are done making changes, call this method to
|
|
22355
22194
|
deliver the deferred change notifications and end deferring.
|
|
22356
|
-
|
|
22195
|
+
@method endPropertyChanges
|
|
22357
22196
|
@return {Observable}
|
|
22358
22197
|
@private
|
|
22359
22198
|
*/
|
|
@@ -22364,11 +22203,11 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22364
22203
|
|
|
22365
22204
|
/**
|
|
22366
22205
|
Notify the observer system that a property has just changed.
|
|
22367
|
-
|
|
22206
|
+
Sometimes you need to change a value directly or indirectly without
|
|
22368
22207
|
actually calling `get()` or `set()` on it. In this case, you can use this
|
|
22369
22208
|
method instead. Calling this method will notify all observers that the
|
|
22370
22209
|
property has potentially changed value.
|
|
22371
|
-
|
|
22210
|
+
@method notifyPropertyChange
|
|
22372
22211
|
@param {String} keyName The property key to be notified about.
|
|
22373
22212
|
@return {Observable}
|
|
22374
22213
|
@public
|
|
@@ -22380,13 +22219,13 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22380
22219
|
|
|
22381
22220
|
/**
|
|
22382
22221
|
Adds an observer on a property.
|
|
22383
|
-
|
|
22384
|
-
|
|
22222
|
+
This is the core method used to register an observer for a property.
|
|
22223
|
+
Once you call this method, any time the key's value is set, your observer
|
|
22385
22224
|
will be notified. Note that the observers are triggered any time the
|
|
22386
22225
|
value is set, regardless of whether it has actually changed. Your
|
|
22387
22226
|
observer should be prepared to handle that.
|
|
22388
|
-
|
|
22389
|
-
|
|
22227
|
+
There are two common invocation patterns for `.addObserver()`:
|
|
22228
|
+
- Passing two arguments:
|
|
22390
22229
|
- the name of the property to observe (as a string)
|
|
22391
22230
|
- the function to invoke (an actual function)
|
|
22392
22231
|
- Passing three arguments:
|
|
@@ -22395,47 +22234,47 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22395
22234
|
function on)
|
|
22396
22235
|
- the name of the function to invoke on the target object
|
|
22397
22236
|
(as a string).
|
|
22398
|
-
|
|
22237
|
+
```app/components/my-component.js
|
|
22399
22238
|
import Component from '@ember/component';
|
|
22400
|
-
|
|
22239
|
+
export default Component.extend({
|
|
22401
22240
|
init() {
|
|
22402
22241
|
this._super(...arguments);
|
|
22403
|
-
|
|
22404
|
-
|
|
22242
|
+
// the following are equivalent:
|
|
22243
|
+
// using three arguments
|
|
22405
22244
|
this.addObserver('foo', this, 'fooDidChange');
|
|
22406
|
-
|
|
22245
|
+
// using two arguments
|
|
22407
22246
|
this.addObserver('foo', (...args) => {
|
|
22408
22247
|
this.fooDidChange(...args);
|
|
22409
22248
|
});
|
|
22410
22249
|
},
|
|
22411
|
-
|
|
22250
|
+
fooDidChange() {
|
|
22412
22251
|
// your custom logic code
|
|
22413
22252
|
}
|
|
22414
22253
|
});
|
|
22415
22254
|
```
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22255
|
+
### Observer Methods
|
|
22256
|
+
Observer methods have the following signature:
|
|
22257
|
+
```app/components/my-component.js
|
|
22419
22258
|
import Component from '@ember/component';
|
|
22420
|
-
|
|
22259
|
+
export default Component.extend({
|
|
22421
22260
|
init() {
|
|
22422
22261
|
this._super(...arguments);
|
|
22423
22262
|
this.addObserver('foo', this, 'fooDidChange');
|
|
22424
22263
|
},
|
|
22425
|
-
|
|
22264
|
+
fooDidChange(sender, key, value, rev) {
|
|
22426
22265
|
// your code
|
|
22427
22266
|
}
|
|
22428
22267
|
});
|
|
22429
22268
|
```
|
|
22430
|
-
|
|
22269
|
+
The `sender` is the object that changed. The `key` is the property that
|
|
22431
22270
|
changes. The `value` property is currently reserved and unused. The `rev`
|
|
22432
22271
|
is the last property revision of the object when it changed, which you can
|
|
22433
22272
|
use to detect if the key value has really changed or not.
|
|
22434
|
-
|
|
22273
|
+
Usually you will not need the value or revision parameters at
|
|
22435
22274
|
the end. In this case, it is common to write observer methods that take
|
|
22436
22275
|
only a sender and key value as parameters or, if you aren't interested in
|
|
22437
22276
|
any of these values, to write an observer that has no parameters at all.
|
|
22438
|
-
|
|
22277
|
+
@method addObserver
|
|
22439
22278
|
@param {String} key The key to observe
|
|
22440
22279
|
@param {Object} target The target object to invoke
|
|
22441
22280
|
@param {String|Function} method The method to invoke
|
|
@@ -22452,7 +22291,7 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22452
22291
|
Remove an observer you have previously registered on this object. Pass
|
|
22453
22292
|
the same key, target, and method you passed to `addObserver()` and your
|
|
22454
22293
|
target will no longer receive notifications.
|
|
22455
|
-
|
|
22294
|
+
@method removeObserver
|
|
22456
22295
|
@param {String} key The key to observe
|
|
22457
22296
|
@param {Object} target The target object to invoke
|
|
22458
22297
|
@param {String|Function} method The method to invoke
|
|
@@ -22470,7 +22309,7 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22470
22309
|
particular key. You can use this method to potentially defer performing
|
|
22471
22310
|
an expensive action until someone begins observing a particular property
|
|
22472
22311
|
on the object.
|
|
22473
|
-
|
|
22312
|
+
@method hasObserverFor
|
|
22474
22313
|
@param {String} key Key to check
|
|
22475
22314
|
@return {Boolean}
|
|
22476
22315
|
@private
|
|
@@ -22481,11 +22320,11 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22481
22320
|
|
|
22482
22321
|
/**
|
|
22483
22322
|
Set the value of a property to the current value plus some amount.
|
|
22484
|
-
|
|
22323
|
+
```javascript
|
|
22485
22324
|
person.incrementProperty('age');
|
|
22486
22325
|
team.incrementProperty('score', 2);
|
|
22487
22326
|
```
|
|
22488
|
-
|
|
22327
|
+
@method incrementProperty
|
|
22489
22328
|
@param {String} keyName The name of the property to increment
|
|
22490
22329
|
@param {Number} increment The amount to increment by. Defaults to 1
|
|
22491
22330
|
@return {Number} The new property value
|
|
@@ -22496,17 +22335,17 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22496
22335
|
increment = 1;
|
|
22497
22336
|
}
|
|
22498
22337
|
|
|
22499
|
-
(true && !(!isNaN(parseFloat(increment)) && isFinite(increment)) && (0, _debug.assert)('Must pass a numeric value to incrementProperty', !isNaN(parseFloat(increment)) && isFinite(increment)));
|
|
22338
|
+
(true && !(!isNaN(parseFloat(String(increment))) && isFinite(increment)) && (0, _debug.assert)('Must pass a numeric value to incrementProperty', !isNaN(parseFloat(String(increment))) && isFinite(increment)));
|
|
22500
22339
|
return (0, _metal.set)(this, keyName, (parseFloat((0, _metal.get)(this, keyName)) || 0) + increment);
|
|
22501
22340
|
},
|
|
22502
22341
|
|
|
22503
22342
|
/**
|
|
22504
22343
|
Set the value of a property to the current value minus some amount.
|
|
22505
|
-
|
|
22344
|
+
```javascript
|
|
22506
22345
|
player.decrementProperty('lives');
|
|
22507
22346
|
orc.decrementProperty('health', 5);
|
|
22508
22347
|
```
|
|
22509
|
-
|
|
22348
|
+
@method decrementProperty
|
|
22510
22349
|
@param {String} keyName The name of the property to decrement
|
|
22511
22350
|
@param {Number} decrement The amount to decrement by. Defaults to 1
|
|
22512
22351
|
@return {Number} The new property value
|
|
@@ -22517,17 +22356,17 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22517
22356
|
decrement = 1;
|
|
22518
22357
|
}
|
|
22519
22358
|
|
|
22520
|
-
(true && !(!isNaN(parseFloat(decrement)) && isFinite(decrement)) && (0, _debug.assert)('Must pass a numeric value to decrementProperty', !isNaN(parseFloat(decrement)) && isFinite(decrement)));
|
|
22359
|
+
(true && !((typeof decrement === 'number' || !isNaN(parseFloat(decrement))) && isFinite(decrement)) && (0, _debug.assert)('Must pass a numeric value to decrementProperty', (typeof decrement === 'number' || !isNaN(parseFloat(decrement))) && isFinite(decrement)));
|
|
22521
22360
|
return (0, _metal.set)(this, keyName, ((0, _metal.get)(this, keyName) || 0) - decrement);
|
|
22522
22361
|
},
|
|
22523
22362
|
|
|
22524
22363
|
/**
|
|
22525
22364
|
Set the value of a boolean property to the opposite of its
|
|
22526
22365
|
current value.
|
|
22527
|
-
|
|
22366
|
+
```javascript
|
|
22528
22367
|
starship.toggleProperty('warpDriveEngaged');
|
|
22529
22368
|
```
|
|
22530
|
-
|
|
22369
|
+
@method toggleProperty
|
|
22531
22370
|
@param {String} keyName The name of the property to toggle
|
|
22532
22371
|
@return {Boolean} The new property value
|
|
22533
22372
|
@public
|
|
@@ -22541,7 +22380,7 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22541
22380
|
This allows you to inspect the value of a computed property
|
|
22542
22381
|
without accidentally invoking it if it is intended to be
|
|
22543
22382
|
generated lazily.
|
|
22544
|
-
|
|
22383
|
+
@method cacheFor
|
|
22545
22384
|
@param {String} keyName
|
|
22546
22385
|
@return {Object} The cached value of the computed property, if any
|
|
22547
22386
|
@public
|
|
@@ -22556,6 +22395,7 @@ define("@ember/-internals/runtime/lib/mixins/observable", ["exports", "@ember/-i
|
|
|
22556
22395
|
|
|
22557
22396
|
});
|
|
22558
22397
|
|
|
22398
|
+
var _default = Observable;
|
|
22559
22399
|
_exports.default = _default;
|
|
22560
22400
|
});
|
|
22561
22401
|
define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember/-internals/metal", "@ember/error"], function (_exports, _metal, _error) {
|
|
@@ -22594,76 +22434,12 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22594
22434
|
throw reason;
|
|
22595
22435
|
}, 'Ember: PromiseProxy');
|
|
22596
22436
|
}
|
|
22597
|
-
/**
|
|
22598
|
-
A low level mixin making ObjectProxy promise-aware.
|
|
22599
|
-
|
|
22600
|
-
```javascript
|
|
22601
|
-
import { resolve } from 'rsvp';
|
|
22602
|
-
import $ from 'jquery';
|
|
22603
|
-
import ObjectProxy from '@ember/object/proxy';
|
|
22604
|
-
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
22605
|
-
|
|
22606
|
-
let ObjectPromiseProxy = ObjectProxy.extend(PromiseProxyMixin);
|
|
22607
|
-
|
|
22608
|
-
let proxy = ObjectPromiseProxy.create({
|
|
22609
|
-
promise: resolve($.getJSON('/some/remote/data.json'))
|
|
22610
|
-
});
|
|
22611
|
-
|
|
22612
|
-
proxy.then(function(json){
|
|
22613
|
-
// the json
|
|
22614
|
-
}, function(reason) {
|
|
22615
|
-
// the reason why you have no json
|
|
22616
|
-
});
|
|
22617
|
-
```
|
|
22618
|
-
|
|
22619
|
-
the proxy has bindable attributes which
|
|
22620
|
-
track the promises life cycle
|
|
22621
|
-
|
|
22622
|
-
```javascript
|
|
22623
|
-
proxy.get('isPending') //=> true
|
|
22624
|
-
proxy.get('isSettled') //=> false
|
|
22625
|
-
proxy.get('isRejected') //=> false
|
|
22626
|
-
proxy.get('isFulfilled') //=> false
|
|
22627
|
-
```
|
|
22628
|
-
|
|
22629
|
-
When the $.getJSON completes, and the promise is fulfilled
|
|
22630
|
-
with json, the life cycle attributes will update accordingly.
|
|
22631
|
-
Note that $.getJSON doesn't return an ECMA specified promise,
|
|
22632
|
-
it is useful to wrap this with an `RSVP.resolve` so that it behaves
|
|
22633
|
-
as a spec compliant promise.
|
|
22634
|
-
|
|
22635
|
-
```javascript
|
|
22636
|
-
proxy.get('isPending') //=> false
|
|
22637
|
-
proxy.get('isSettled') //=> true
|
|
22638
|
-
proxy.get('isRejected') //=> false
|
|
22639
|
-
proxy.get('isFulfilled') //=> true
|
|
22640
|
-
```
|
|
22641
|
-
|
|
22642
|
-
As the proxy is an ObjectProxy, and the json now its content,
|
|
22643
|
-
all the json properties will be available directly from the proxy.
|
|
22644
|
-
|
|
22645
|
-
```javascript
|
|
22646
|
-
// Assuming the following json:
|
|
22647
|
-
{
|
|
22648
|
-
firstName: 'Stefan',
|
|
22649
|
-
lastName: 'Penner'
|
|
22650
|
-
}
|
|
22651
|
-
|
|
22652
|
-
// both properties will accessible on the proxy
|
|
22653
|
-
proxy.get('firstName') //=> 'Stefan'
|
|
22654
|
-
proxy.get('lastName') //=> 'Penner'
|
|
22655
|
-
```
|
|
22656
|
-
|
|
22657
|
-
@class PromiseProxyMixin
|
|
22658
|
-
@public
|
|
22659
|
-
*/
|
|
22660
|
-
|
|
22661
22437
|
|
|
22662
|
-
var
|
|
22438
|
+
var PromiseProxyMixin = _metal.Mixin.create({
|
|
22663
22439
|
/**
|
|
22664
22440
|
If the proxied promise is rejected this will contain the reason
|
|
22665
22441
|
provided.
|
|
22666
|
-
|
|
22442
|
+
@property reason
|
|
22667
22443
|
@default null
|
|
22668
22444
|
@public
|
|
22669
22445
|
*/
|
|
@@ -22671,7 +22447,7 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22671
22447
|
|
|
22672
22448
|
/**
|
|
22673
22449
|
Once the proxied promise has settled this will become `false`.
|
|
22674
|
-
|
|
22450
|
+
@property isPending
|
|
22675
22451
|
@default true
|
|
22676
22452
|
@public
|
|
22677
22453
|
*/
|
|
@@ -22681,7 +22457,7 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22681
22457
|
|
|
22682
22458
|
/**
|
|
22683
22459
|
Once the proxied promise has settled this will become `true`.
|
|
22684
|
-
|
|
22460
|
+
@property isSettled
|
|
22685
22461
|
@default false
|
|
22686
22462
|
@public
|
|
22687
22463
|
*/
|
|
@@ -22691,7 +22467,7 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22691
22467
|
|
|
22692
22468
|
/**
|
|
22693
22469
|
Will become `true` if the proxied promise is rejected.
|
|
22694
|
-
|
|
22470
|
+
@property isRejected
|
|
22695
22471
|
@default false
|
|
22696
22472
|
@public
|
|
22697
22473
|
*/
|
|
@@ -22699,7 +22475,7 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22699
22475
|
|
|
22700
22476
|
/**
|
|
22701
22477
|
Will become `true` if the proxied promise is fulfilled.
|
|
22702
|
-
|
|
22478
|
+
@property isFulfilled
|
|
22703
22479
|
@default false
|
|
22704
22480
|
@public
|
|
22705
22481
|
*/
|
|
@@ -22707,17 +22483,17 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22707
22483
|
|
|
22708
22484
|
/**
|
|
22709
22485
|
The promise whose fulfillment value is being proxied by this object.
|
|
22710
|
-
|
|
22486
|
+
This property must be specified upon creation, and should not be
|
|
22711
22487
|
changed once created.
|
|
22712
|
-
|
|
22713
|
-
|
|
22488
|
+
Example:
|
|
22489
|
+
```javascript
|
|
22714
22490
|
import ObjectProxy from '@ember/object/proxy';
|
|
22715
22491
|
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
22716
|
-
|
|
22492
|
+
ObjectProxy.extend(PromiseProxyMixin).create({
|
|
22717
22493
|
promise: <thenable>
|
|
22718
22494
|
});
|
|
22719
22495
|
```
|
|
22720
|
-
|
|
22496
|
+
@property promise
|
|
22721
22497
|
@public
|
|
22722
22498
|
*/
|
|
22723
22499
|
promise: (0, _metal.computed)({
|
|
@@ -22725,7 +22501,7 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22725
22501
|
throw new _error.default("PromiseProxy's promise must be set");
|
|
22726
22502
|
},
|
|
22727
22503
|
|
|
22728
|
-
set(
|
|
22504
|
+
set(_key, promise) {
|
|
22729
22505
|
return tap(this, promise);
|
|
22730
22506
|
}
|
|
22731
22507
|
|
|
@@ -22733,8 +22509,8 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22733
22509
|
|
|
22734
22510
|
/**
|
|
22735
22511
|
An alias to the proxied promise's `then`.
|
|
22736
|
-
|
|
22737
|
-
|
|
22512
|
+
See RSVP.Promise.then.
|
|
22513
|
+
@method then
|
|
22738
22514
|
@param {Function} callback
|
|
22739
22515
|
@return {RSVP.Promise}
|
|
22740
22516
|
@public
|
|
@@ -22743,8 +22519,8 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22743
22519
|
|
|
22744
22520
|
/**
|
|
22745
22521
|
An alias to the proxied promise's `catch`.
|
|
22746
|
-
|
|
22747
|
-
|
|
22522
|
+
See RSVP.Promise.catch.
|
|
22523
|
+
@method catch
|
|
22748
22524
|
@param {Function} callback
|
|
22749
22525
|
@return {RSVP.Promise}
|
|
22750
22526
|
@since 1.3.0
|
|
@@ -22754,8 +22530,8 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22754
22530
|
|
|
22755
22531
|
/**
|
|
22756
22532
|
An alias to the proxied promise's `finally`.
|
|
22757
|
-
|
|
22758
|
-
|
|
22533
|
+
See RSVP.Promise.finally.
|
|
22534
|
+
@method finally
|
|
22759
22535
|
@param {Function} callback
|
|
22760
22536
|
@return {RSVP.Promise}
|
|
22761
22537
|
@since 1.3.0
|
|
@@ -22764,16 +22540,21 @@ define("@ember/-internals/runtime/lib/mixins/promise_proxy", ["exports", "@ember
|
|
|
22764
22540
|
finally: promiseAlias('finally')
|
|
22765
22541
|
});
|
|
22766
22542
|
|
|
22767
|
-
_exports.default = _default;
|
|
22768
|
-
|
|
22769
22543
|
function promiseAlias(name) {
|
|
22770
22544
|
return function () {
|
|
22771
|
-
var promise = (0, _metal.get)(this, 'promise');
|
|
22545
|
+
var promise = (0, _metal.get)(this, 'promise'); // We need this cast because `Parameters` is deferred so that it is not
|
|
22546
|
+
// possible for TS to see it will always produce the right type. However,
|
|
22547
|
+
// since `AnyFn` has a rest type, it is allowed. See discussion on [this
|
|
22548
|
+
// issue](https://github.com/microsoft/TypeScript/issues/47615).
|
|
22549
|
+
|
|
22772
22550
|
return promise[name](...arguments);
|
|
22773
22551
|
};
|
|
22774
22552
|
}
|
|
22553
|
+
|
|
22554
|
+
var _default = PromiseProxyMixin;
|
|
22555
|
+
_exports.default = _default;
|
|
22775
22556
|
});
|
|
22776
|
-
define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@ember/
|
|
22557
|
+
define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@ember/-internals/metal", "@ember/debug"], function (_exports, _metal, _debug) {
|
|
22777
22558
|
"use strict";
|
|
22778
22559
|
|
|
22779
22560
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -22784,20 +22565,12 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22784
22565
|
/**
|
|
22785
22566
|
@module ember
|
|
22786
22567
|
*/
|
|
22787
|
-
|
|
22788
|
-
/**
|
|
22789
|
-
RegistryProxyMixin is used to provide public access to specific
|
|
22790
|
-
registry functionality.
|
|
22791
|
-
|
|
22792
|
-
@class RegistryProxyMixin
|
|
22793
|
-
@private
|
|
22794
|
-
*/
|
|
22795
|
-
var _default = _metal.Mixin.create({
|
|
22568
|
+
var RegistryProxyMixin = _metal.Mixin.create({
|
|
22796
22569
|
__registry__: null,
|
|
22797
22570
|
|
|
22798
22571
|
/**
|
|
22799
22572
|
Given a fullName return the corresponding factory.
|
|
22800
|
-
|
|
22573
|
+
@public
|
|
22801
22574
|
@method resolveRegistration
|
|
22802
22575
|
@param {String} fullName
|
|
22803
22576
|
@return {Function} fullName's factory
|
|
@@ -22811,48 +22584,48 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22811
22584
|
Registers a factory that can be used for dependency injection (with
|
|
22812
22585
|
`inject`) or for service lookup. Each factory is registered with
|
|
22813
22586
|
a full name including two parts: `type:name`.
|
|
22814
|
-
|
|
22815
|
-
|
|
22587
|
+
A simple example:
|
|
22588
|
+
```javascript
|
|
22816
22589
|
import Application from '@ember/application';
|
|
22817
22590
|
import EmberObject from '@ember/object';
|
|
22818
|
-
|
|
22819
|
-
|
|
22591
|
+
let App = Application.create();
|
|
22592
|
+
App.Orange = EmberObject.extend();
|
|
22820
22593
|
App.register('fruit:favorite', App.Orange);
|
|
22821
22594
|
```
|
|
22822
|
-
|
|
22595
|
+
Ember will resolve factories from the `App` namespace automatically.
|
|
22823
22596
|
For example `App.CarsController` will be discovered and returned if
|
|
22824
22597
|
an application requests `controller:cars`.
|
|
22825
|
-
|
|
22826
|
-
|
|
22598
|
+
An example of registering a controller with a non-standard name:
|
|
22599
|
+
```javascript
|
|
22827
22600
|
import Application from '@ember/application';
|
|
22828
22601
|
import Controller from '@ember/controller';
|
|
22829
|
-
|
|
22602
|
+
let App = Application.create();
|
|
22830
22603
|
let Session = Controller.extend();
|
|
22831
|
-
|
|
22832
|
-
|
|
22604
|
+
App.register('controller:session', Session);
|
|
22605
|
+
// The Session controller can now be treated like a normal controller,
|
|
22833
22606
|
// despite its non-standard name.
|
|
22834
22607
|
App.ApplicationController = Controller.extend({
|
|
22835
22608
|
needs: ['session']
|
|
22836
22609
|
});
|
|
22837
22610
|
```
|
|
22838
|
-
|
|
22611
|
+
Registered factories are **instantiated** by having `create`
|
|
22839
22612
|
called on them. Additionally they are **singletons**, each time
|
|
22840
22613
|
they are looked up they return the same instance.
|
|
22841
|
-
|
|
22842
|
-
|
|
22614
|
+
Some examples modifying that default behavior:
|
|
22615
|
+
```javascript
|
|
22843
22616
|
import Application from '@ember/application';
|
|
22844
22617
|
import EmberObject from '@ember/object';
|
|
22845
|
-
|
|
22846
|
-
|
|
22618
|
+
let App = Application.create();
|
|
22619
|
+
App.Person = EmberObject.extend();
|
|
22847
22620
|
App.Orange = EmberObject.extend();
|
|
22848
22621
|
App.Email = EmberObject.extend();
|
|
22849
22622
|
App.session = EmberObject.create();
|
|
22850
|
-
|
|
22623
|
+
App.register('model:user', App.Person, { singleton: false });
|
|
22851
22624
|
App.register('fruit:favorite', App.Orange);
|
|
22852
22625
|
App.register('communication:main', App.Email, { singleton: false });
|
|
22853
22626
|
App.register('session', App.session, { instantiate: false });
|
|
22854
22627
|
```
|
|
22855
|
-
|
|
22628
|
+
@method register
|
|
22856
22629
|
@param fullName {String} type:name (e.g., 'model:user')
|
|
22857
22630
|
@param factory {any} (e.g., App.Person)
|
|
22858
22631
|
@param options {Object} (optional) disable instantiation or singleton usage
|
|
@@ -22862,17 +22635,17 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22862
22635
|
|
|
22863
22636
|
/**
|
|
22864
22637
|
Unregister a factory.
|
|
22865
|
-
|
|
22638
|
+
```javascript
|
|
22866
22639
|
import Application from '@ember/application';
|
|
22867
22640
|
import EmberObject from '@ember/object';
|
|
22868
|
-
|
|
22641
|
+
let App = Application.create();
|
|
22869
22642
|
let User = EmberObject.extend();
|
|
22870
22643
|
App.register('model:user', User);
|
|
22871
|
-
|
|
22872
|
-
|
|
22644
|
+
App.resolveRegistration('model:user').create() instanceof User //=> true
|
|
22645
|
+
App.unregister('model:user')
|
|
22873
22646
|
App.resolveRegistration('model:user') === undefined //=> true
|
|
22874
22647
|
```
|
|
22875
|
-
|
|
22648
|
+
@public
|
|
22876
22649
|
@method unregister
|
|
22877
22650
|
@param {String} fullName
|
|
22878
22651
|
*/
|
|
@@ -22880,7 +22653,7 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22880
22653
|
|
|
22881
22654
|
/**
|
|
22882
22655
|
Check if a factory is registered.
|
|
22883
|
-
|
|
22656
|
+
@public
|
|
22884
22657
|
@method hasRegistration
|
|
22885
22658
|
@param {String} fullName
|
|
22886
22659
|
@return {Boolean}
|
|
@@ -22889,7 +22662,7 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22889
22662
|
|
|
22890
22663
|
/**
|
|
22891
22664
|
Return a specific registered option for a particular factory.
|
|
22892
|
-
|
|
22665
|
+
@public
|
|
22893
22666
|
@method registeredOption
|
|
22894
22667
|
@param {String} fullName
|
|
22895
22668
|
@param {String} optionName
|
|
@@ -22899,7 +22672,7 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22899
22672
|
|
|
22900
22673
|
/**
|
|
22901
22674
|
Register options for a particular factory.
|
|
22902
|
-
|
|
22675
|
+
@public
|
|
22903
22676
|
@method registerOptions
|
|
22904
22677
|
@param {String} fullName
|
|
22905
22678
|
@param {Object} options
|
|
@@ -22908,7 +22681,7 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22908
22681
|
|
|
22909
22682
|
/**
|
|
22910
22683
|
Return registered options for a particular factory.
|
|
22911
|
-
|
|
22684
|
+
@public
|
|
22912
22685
|
@method registeredOptions
|
|
22913
22686
|
@param {String} fullName
|
|
22914
22687
|
@return {Object} options
|
|
@@ -22917,22 +22690,22 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22917
22690
|
|
|
22918
22691
|
/**
|
|
22919
22692
|
Allow registering options for all factories of a type.
|
|
22920
|
-
|
|
22693
|
+
```javascript
|
|
22921
22694
|
import Application from '@ember/application';
|
|
22922
|
-
|
|
22695
|
+
let App = Application.create();
|
|
22923
22696
|
let appInstance = App.buildInstance();
|
|
22924
|
-
|
|
22697
|
+
// if all of type `connection` must not be singletons
|
|
22925
22698
|
appInstance.registerOptionsForType('connection', { singleton: false });
|
|
22926
|
-
|
|
22699
|
+
appInstance.register('connection:twitter', TwitterConnection);
|
|
22927
22700
|
appInstance.register('connection:facebook', FacebookConnection);
|
|
22928
|
-
|
|
22701
|
+
let twitter = appInstance.lookup('connection:twitter');
|
|
22929
22702
|
let twitter2 = appInstance.lookup('connection:twitter');
|
|
22930
|
-
|
|
22931
|
-
|
|
22703
|
+
twitter === twitter2; // => false
|
|
22704
|
+
let facebook = appInstance.lookup('connection:facebook');
|
|
22932
22705
|
let facebook2 = appInstance.lookup('connection:facebook');
|
|
22933
|
-
|
|
22706
|
+
facebook === facebook2; // => false
|
|
22934
22707
|
```
|
|
22935
|
-
|
|
22708
|
+
@public
|
|
22936
22709
|
@method registerOptionsForType
|
|
22937
22710
|
@param {String} type
|
|
22938
22711
|
@param {Object} options
|
|
@@ -22941,7 +22714,7 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22941
22714
|
|
|
22942
22715
|
/**
|
|
22943
22716
|
Return the registered options for all factories of a type.
|
|
22944
|
-
|
|
22717
|
+
@public
|
|
22945
22718
|
@method registeredOptionsForType
|
|
22946
22719
|
@param {String} type
|
|
22947
22720
|
@return {Object} options
|
|
@@ -22951,37 +22724,37 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22951
22724
|
/**
|
|
22952
22725
|
Define a dependency injection onto a specific factory or all factories
|
|
22953
22726
|
of a type.
|
|
22954
|
-
|
|
22727
|
+
When Ember instantiates a controller, view, or other framework component
|
|
22955
22728
|
it can attach a dependency to that component. This is often used to
|
|
22956
22729
|
provide services to a set of framework components.
|
|
22957
|
-
|
|
22958
|
-
|
|
22730
|
+
An example of providing a session object to all controllers:
|
|
22731
|
+
```javascript
|
|
22959
22732
|
import { alias } from '@ember/object/computed';
|
|
22960
22733
|
import Application from '@ember/application';
|
|
22961
22734
|
import Controller from '@ember/controller';
|
|
22962
22735
|
import EmberObject from '@ember/object';
|
|
22963
|
-
|
|
22736
|
+
let App = Application.create();
|
|
22964
22737
|
let Session = EmberObject.extend({ isAuthenticated: false });
|
|
22965
|
-
|
|
22738
|
+
// A factory must be registered before it can be injected
|
|
22966
22739
|
App.register('session:main', Session);
|
|
22967
|
-
|
|
22740
|
+
// Inject 'session:main' onto all factories of the type 'controller'
|
|
22968
22741
|
// with the name 'session'
|
|
22969
22742
|
App.inject('controller', 'session', 'session:main');
|
|
22970
|
-
|
|
22743
|
+
App.IndexController = Controller.extend({
|
|
22971
22744
|
isLoggedIn: alias('session.isAuthenticated')
|
|
22972
22745
|
});
|
|
22973
22746
|
```
|
|
22974
|
-
|
|
22975
|
-
|
|
22747
|
+
Injections can also be performed on specific factories.
|
|
22748
|
+
```javascript
|
|
22976
22749
|
App.inject(<full_name or type>, <property name>, <full_name>)
|
|
22977
22750
|
App.inject('route', 'source', 'source:main')
|
|
22978
22751
|
App.inject('route:application', 'email', 'model:email')
|
|
22979
22752
|
```
|
|
22980
|
-
|
|
22753
|
+
It is important to note that injections can only be performed on
|
|
22981
22754
|
classes that are instantiated by Ember itself. Instantiating a class
|
|
22982
22755
|
directly (via `create` or `new`) bypasses the dependency injection
|
|
22983
22756
|
system.
|
|
22984
|
-
|
|
22757
|
+
@public
|
|
22985
22758
|
@method inject
|
|
22986
22759
|
@param factoryNameOrType {String}
|
|
22987
22760
|
@param property {String}
|
|
@@ -22991,13 +22764,18 @@ define("@ember/-internals/runtime/lib/mixins/registry_proxy", ["exports", "@embe
|
|
|
22991
22764
|
inject: registryAlias('injection')
|
|
22992
22765
|
});
|
|
22993
22766
|
|
|
22994
|
-
_exports.default = _default;
|
|
22995
|
-
|
|
22996
22767
|
function registryAlias(name) {
|
|
22997
22768
|
return function () {
|
|
22769
|
+
// We need this cast because `Parameters` is deferred so that it is not
|
|
22770
|
+
// possible for TS to see it will always produce the right type. However,
|
|
22771
|
+
// since `AnyFn` has a rest type, it is allowed. See discussion on [this
|
|
22772
|
+
// issue](https://github.com/microsoft/TypeScript/issues/47615).
|
|
22998
22773
|
return this.__registry__[name](...arguments);
|
|
22999
22774
|
};
|
|
23000
22775
|
}
|
|
22776
|
+
|
|
22777
|
+
var _default = RegistryProxyMixin;
|
|
22778
|
+
_exports.default = _default;
|
|
23001
22779
|
});
|
|
23002
22780
|
define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports", "@ember/-internals/environment", "@ember/-internals/metal", "@ember/debug"], function (_exports, _environment, _metal, _debug) {
|
|
23003
22781
|
"use strict";
|
|
@@ -23010,19 +22788,6 @@ define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports",
|
|
|
23010
22788
|
/**
|
|
23011
22789
|
@module ember
|
|
23012
22790
|
*/
|
|
23013
|
-
|
|
23014
|
-
/**
|
|
23015
|
-
`Ember.TargetActionSupport` is a mixin that can be included in a class
|
|
23016
|
-
to add a `triggerAction` method with semantics similar to the Handlebars
|
|
23017
|
-
`{{action}}` helper. In normal Ember usage, the `{{action}}` helper is
|
|
23018
|
-
usually the best choice. This mixin is most often useful when you are
|
|
23019
|
-
doing more complex event handling in Components.
|
|
23020
|
-
|
|
23021
|
-
@class TargetActionSupport
|
|
23022
|
-
@namespace Ember
|
|
23023
|
-
@extends Mixin
|
|
23024
|
-
@private
|
|
23025
|
-
*/
|
|
23026
22791
|
var TargetActionSupport = _metal.Mixin.create({
|
|
23027
22792
|
target: null,
|
|
23028
22793
|
action: null,
|
|
@@ -23046,9 +22811,9 @@ define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports",
|
|
|
23046
22811
|
/**
|
|
23047
22812
|
Send an `action` with an `actionContext` to a `target`. The action, actionContext
|
|
23048
22813
|
and target will be retrieved from properties of the object. For example:
|
|
23049
|
-
|
|
22814
|
+
```javascript
|
|
23050
22815
|
import { alias } from '@ember/object/computed';
|
|
23051
|
-
|
|
22816
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
23052
22817
|
target: alias('controller'),
|
|
23053
22818
|
action: 'save',
|
|
23054
22819
|
actionContext: alias('context'),
|
|
@@ -23058,9 +22823,9 @@ define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports",
|
|
|
23058
22823
|
}
|
|
23059
22824
|
});
|
|
23060
22825
|
```
|
|
23061
|
-
|
|
22826
|
+
The `target`, `action`, and `actionContext` can be provided as properties of
|
|
23062
22827
|
an optional object argument to `triggerAction` as well.
|
|
23063
|
-
|
|
22828
|
+
```javascript
|
|
23064
22829
|
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
23065
22830
|
click() {
|
|
23066
22831
|
this.triggerAction({
|
|
@@ -23072,12 +22837,12 @@ define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports",
|
|
|
23072
22837
|
}
|
|
23073
22838
|
});
|
|
23074
22839
|
```
|
|
23075
|
-
|
|
22840
|
+
The `actionContext` defaults to the object you are mixing `TargetActionSupport` into.
|
|
23076
22841
|
But `target` and `action` must be specified either as properties or with the argument
|
|
23077
22842
|
to `triggerAction`, or a combination:
|
|
23078
|
-
|
|
22843
|
+
```javascript
|
|
23079
22844
|
import { alias } from '@ember/object/computed';
|
|
23080
|
-
|
|
22845
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
23081
22846
|
target: alias('controller'),
|
|
23082
22847
|
click() {
|
|
23083
22848
|
this.triggerAction({
|
|
@@ -23087,7 +22852,7 @@ define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports",
|
|
|
23087
22852
|
}
|
|
23088
22853
|
});
|
|
23089
22854
|
```
|
|
23090
|
-
|
|
22855
|
+
@method triggerAction
|
|
23091
22856
|
@param opts {Object} (optional, with the optional keys action, target and/or actionContext)
|
|
23092
22857
|
@return {Boolean} true if the action was sent successfully and did not return false
|
|
23093
22858
|
@private
|
|
@@ -23109,14 +22874,16 @@ define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports",
|
|
|
23109
22874
|
actionContext = (0, _metal.get)(this, 'actionContextObject') || this;
|
|
23110
22875
|
}
|
|
23111
22876
|
|
|
22877
|
+
var context = Array.isArray(actionContext) ? actionContext : [actionContext];
|
|
22878
|
+
|
|
23112
22879
|
if (target && action) {
|
|
23113
22880
|
var ret;
|
|
23114
22881
|
|
|
23115
|
-
if (target
|
|
23116
|
-
ret = target.send(...
|
|
22882
|
+
if (isSendable(target)) {
|
|
22883
|
+
ret = target.send(action, ...context);
|
|
23117
22884
|
} else {
|
|
23118
22885
|
(true && !(typeof target[action] === 'function') && (0, _debug.assert)(`The action '${action}' did not exist on ${target}`, typeof target[action] === 'function'));
|
|
23119
|
-
ret = target[action](...
|
|
22886
|
+
ret = target[action](...context);
|
|
23120
22887
|
}
|
|
23121
22888
|
|
|
23122
22889
|
if (ret !== false) {
|
|
@@ -23129,6 +22896,10 @@ define("@ember/-internals/runtime/lib/mixins/target_action_support", ["exports",
|
|
|
23129
22896
|
|
|
23130
22897
|
});
|
|
23131
22898
|
|
|
22899
|
+
function isSendable(obj) {
|
|
22900
|
+
return obj != null && typeof obj === 'object' && typeof obj.send === 'function';
|
|
22901
|
+
}
|
|
22902
|
+
|
|
23132
22903
|
function getTarget(instance) {
|
|
23133
22904
|
var target = (0, _metal.get)(instance, 'target');
|
|
23134
22905
|
|
|
@@ -23173,12 +22944,18 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23173
22944
|
/**
|
|
23174
22945
|
@module @ember/array
|
|
23175
22946
|
*/
|
|
22947
|
+
function isMutable(obj) {
|
|
22948
|
+
return Array.isArray(obj) || typeof obj.replace === 'function';
|
|
22949
|
+
}
|
|
22950
|
+
|
|
23176
22951
|
var ARRAY_OBSERVER_MAPPING = {
|
|
23177
22952
|
willChange: '_arrangedContentArrayWillChange',
|
|
23178
22953
|
didChange: '_arrangedContentArrayDidChange'
|
|
23179
22954
|
};
|
|
23180
22955
|
|
|
23181
22956
|
function customTagForArrayProxy(proxy, key) {
|
|
22957
|
+
(true && !(proxy instanceof ArrayProxy) && (0, _debug.assert)('[BUG] Expected a proxy', proxy instanceof ArrayProxy));
|
|
22958
|
+
|
|
23182
22959
|
if (key === '[]') {
|
|
23183
22960
|
proxy._revalidate();
|
|
23184
22961
|
|
|
@@ -23191,90 +22968,53 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23191
22968
|
|
|
23192
22969
|
return (0, _validator.tagFor)(proxy, key);
|
|
23193
22970
|
}
|
|
23194
|
-
/**
|
|
23195
|
-
An ArrayProxy wraps any other object that implements `Array` and/or
|
|
23196
|
-
`MutableArray,` forwarding all requests. This makes it very useful for
|
|
23197
|
-
a number of binding use cases or other cases where being able to swap
|
|
23198
|
-
out the underlying array is useful.
|
|
23199
|
-
|
|
23200
|
-
A simple example of usage:
|
|
23201
|
-
|
|
23202
|
-
```javascript
|
|
23203
|
-
import { A } from '@ember/array';
|
|
23204
|
-
import ArrayProxy from '@ember/array/proxy';
|
|
23205
|
-
|
|
23206
|
-
let pets = ['dog', 'cat', 'fish'];
|
|
23207
|
-
let ap = ArrayProxy.create({ content: A(pets) });
|
|
23208
|
-
|
|
23209
|
-
ap.get('firstObject'); // 'dog'
|
|
23210
|
-
ap.set('content', ['amoeba', 'paramecium']);
|
|
23211
|
-
ap.get('firstObject'); // 'amoeba'
|
|
23212
|
-
```
|
|
23213
|
-
|
|
23214
|
-
This class can also be useful as a layer to transform the contents of
|
|
23215
|
-
an array, as they are accessed. This can be done by overriding
|
|
23216
|
-
`objectAtContent`:
|
|
23217
|
-
|
|
23218
|
-
```javascript
|
|
23219
|
-
import { A } from '@ember/array';
|
|
23220
|
-
import ArrayProxy from '@ember/array/proxy';
|
|
23221
|
-
|
|
23222
|
-
let pets = ['dog', 'cat', 'fish'];
|
|
23223
|
-
let ap = ArrayProxy.create({
|
|
23224
|
-
content: A(pets),
|
|
23225
|
-
objectAtContent: function(idx) {
|
|
23226
|
-
return this.get('content').objectAt(idx).toUpperCase();
|
|
23227
|
-
}
|
|
23228
|
-
});
|
|
23229
|
-
|
|
23230
|
-
ap.get('firstObject'); // . 'DOG'
|
|
23231
|
-
```
|
|
23232
|
-
|
|
23233
|
-
When overriding this class, it is important to place the call to
|
|
23234
|
-
`_super` *after* setting `content` so the internal observers have
|
|
23235
|
-
a chance to fire properly:
|
|
23236
|
-
|
|
23237
|
-
```javascript
|
|
23238
|
-
import { A } from '@ember/array';
|
|
23239
|
-
import ArrayProxy from '@ember/array/proxy';
|
|
23240
|
-
|
|
23241
|
-
export default ArrayProxy.extend({
|
|
23242
|
-
init() {
|
|
23243
|
-
this.set('content', A(['dog', 'cat', 'fish']));
|
|
23244
|
-
this._super(...arguments);
|
|
23245
|
-
}
|
|
23246
|
-
});
|
|
23247
|
-
```
|
|
23248
|
-
|
|
23249
|
-
@class ArrayProxy
|
|
23250
|
-
@extends EmberObject
|
|
23251
|
-
@uses MutableArray
|
|
23252
|
-
@public
|
|
23253
|
-
*/
|
|
23254
|
-
|
|
23255
22971
|
|
|
23256
22972
|
class ArrayProxy extends _object.default {
|
|
23257
|
-
|
|
23258
|
-
super
|
|
22973
|
+
constructor() {
|
|
22974
|
+
super(...arguments);
|
|
23259
22975
|
/*
|
|
23260
22976
|
`this._objectsDirtyIndex` determines which indexes in the `this._objects`
|
|
23261
22977
|
cache are dirty.
|
|
23262
|
-
|
|
22978
|
+
If `this._objectsDirtyIndex === -1` then no indexes are dirty.
|
|
23263
22979
|
Otherwise, an index `i` is dirty if `i >= this._objectsDirtyIndex`.
|
|
23264
|
-
|
|
22980
|
+
Calling `objectAt` with a dirty index will cause the `this._objects`
|
|
23265
22981
|
cache to be recomputed.
|
|
23266
22982
|
*/
|
|
23267
22983
|
|
|
22984
|
+
/** @internal */
|
|
22985
|
+
|
|
23268
22986
|
this._objectsDirtyIndex = 0;
|
|
22987
|
+
/** @internal */
|
|
22988
|
+
|
|
23269
22989
|
this._objects = null;
|
|
22990
|
+
/** @internal */
|
|
22991
|
+
|
|
23270
22992
|
this._lengthDirty = true;
|
|
22993
|
+
/** @internal */
|
|
22994
|
+
|
|
23271
22995
|
this._length = 0;
|
|
22996
|
+
/** @internal */
|
|
22997
|
+
|
|
23272
22998
|
this._arrangedContent = null;
|
|
22999
|
+
/** @internal */
|
|
23000
|
+
|
|
23273
23001
|
this._arrangedContentIsUpdating = false;
|
|
23002
|
+
/** @internal */
|
|
23003
|
+
|
|
23274
23004
|
this._arrangedContentTag = null;
|
|
23005
|
+
/** @internal */
|
|
23006
|
+
|
|
23275
23007
|
this._arrangedContentRevision = null;
|
|
23008
|
+
/** @internal */
|
|
23009
|
+
|
|
23276
23010
|
this._lengthTag = null;
|
|
23011
|
+
/** @internal */
|
|
23012
|
+
|
|
23277
23013
|
this._arrTag = null;
|
|
23014
|
+
}
|
|
23015
|
+
|
|
23016
|
+
init(props) {
|
|
23017
|
+
super.init(props);
|
|
23278
23018
|
(0, _manager.setCustomTagFor)(this, customTagForArrayProxy);
|
|
23279
23019
|
}
|
|
23280
23020
|
|
|
@@ -23285,20 +23025,12 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23285
23025
|
willDestroy() {
|
|
23286
23026
|
this._removeArrangedContentArrayObserver();
|
|
23287
23027
|
}
|
|
23288
|
-
/**
|
|
23289
|
-
The content array. Must be an object that implements `Array` and/or
|
|
23290
|
-
`MutableArray.`
|
|
23291
|
-
@property content
|
|
23292
|
-
@type EmberArray
|
|
23293
|
-
@public
|
|
23294
|
-
*/
|
|
23295
|
-
|
|
23296
23028
|
/**
|
|
23297
23029
|
Should actually retrieve the object at the specified index from the
|
|
23298
23030
|
content. You can override this method in subclasses to transform the
|
|
23299
23031
|
content item to something new.
|
|
23300
|
-
|
|
23301
|
-
|
|
23032
|
+
This method will only be called if content is non-`null`.
|
|
23033
|
+
@method objectAtContent
|
|
23302
23034
|
@param {Number} idx The index to retrieve.
|
|
23303
23035
|
@return {Object} the value or undefined if none found
|
|
23304
23036
|
@public
|
|
@@ -23306,7 +23038,9 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23306
23038
|
|
|
23307
23039
|
|
|
23308
23040
|
objectAtContent(idx) {
|
|
23309
|
-
|
|
23041
|
+
var arrangedContent = (0, _metal.get)(this, 'arrangedContent');
|
|
23042
|
+
(true && !(arrangedContent) && (0, _debug.assert)('[BUG] Called objectAtContent without content', arrangedContent));
|
|
23043
|
+
return (0, _metal.objectAt)(arrangedContent, idx);
|
|
23310
23044
|
} // See additional docs for `replace` from `MutableArray`:
|
|
23311
23045
|
// https://api.emberjs.com/ember/release/classes/MutableArray/methods/replace?anchor=replace
|
|
23312
23046
|
|
|
@@ -23319,19 +23053,21 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23319
23053
|
Should actually replace the specified objects on the content array.
|
|
23320
23054
|
You can override this method in subclasses to transform the content item
|
|
23321
23055
|
into something new.
|
|
23322
|
-
|
|
23323
|
-
|
|
23056
|
+
This method will only be called if content is non-`null`.
|
|
23057
|
+
@method replaceContent
|
|
23324
23058
|
@param {Number} idx The starting index
|
|
23325
23059
|
@param {Number} amt The number of items to remove from the content.
|
|
23326
|
-
@param {EmberArray} objects Optional array of objects to insert
|
|
23327
|
-
objects.
|
|
23060
|
+
@param {EmberArray} objects Optional array of objects to insert.
|
|
23328
23061
|
@return {void}
|
|
23329
23062
|
@public
|
|
23330
23063
|
*/
|
|
23331
23064
|
|
|
23332
23065
|
|
|
23333
23066
|
replaceContent(idx, amt, objects) {
|
|
23334
|
-
(0, _metal.get)(this, 'content')
|
|
23067
|
+
var content = (0, _metal.get)(this, 'content');
|
|
23068
|
+
(true && !(content) && (0, _debug.assert)('[BUG] Called objectAtContent without content', content));
|
|
23069
|
+
(true && !(isMutable(content)) && (0, _debug.assert)('Mutating a non-mutable array is not allowed', isMutable(content)));
|
|
23070
|
+
content.replace(idx, amt, objects);
|
|
23335
23071
|
} // Overriding objectAt is not supported.
|
|
23336
23072
|
|
|
23337
23073
|
|
|
@@ -23349,6 +23085,9 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23349
23085
|
var length = this._objects.length = (0, _metal.get)(arrangedContent, 'length');
|
|
23350
23086
|
|
|
23351
23087
|
for (var i = this._objectsDirtyIndex; i < length; i++) {
|
|
23088
|
+
// SAFETY: This is expected to only ever return an instance of T. In other words, there should
|
|
23089
|
+
// be no gaps in the array. Unfortunately, we can't actually assert for it since T could include
|
|
23090
|
+
// any types, including null or undefined.
|
|
23352
23091
|
this._objects[i] = this.objectAtContent(i);
|
|
23353
23092
|
}
|
|
23354
23093
|
} else {
|
|
@@ -23371,6 +23110,7 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23371
23110
|
this._lengthDirty = false;
|
|
23372
23111
|
}
|
|
23373
23112
|
|
|
23113
|
+
(true && !(this._lengthTag) && (0, _debug.assert)('[BUG] _lengthTag is not set', this._lengthTag));
|
|
23374
23114
|
(0, _validator.consumeTag)(this._lengthTag);
|
|
23375
23115
|
return this._length;
|
|
23376
23116
|
}
|
|
@@ -23390,6 +23130,7 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23390
23130
|
var content = (0, _metal.get)(this, 'content');
|
|
23391
23131
|
|
|
23392
23132
|
if (content) {
|
|
23133
|
+
(true && !(isMutable(content)) && (0, _debug.assert)('Mutating a non-mutable array is not allowed', isMutable(content)));
|
|
23393
23134
|
(0, _metal.replace)(content, value, removedCount, added);
|
|
23394
23135
|
|
|
23395
23136
|
this._invalidate();
|
|
@@ -23413,6 +23154,7 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23413
23154
|
|
|
23414
23155
|
_addArrangedContentArrayObserver(arrangedContent) {
|
|
23415
23156
|
if (arrangedContent && !arrangedContent.isDestroyed) {
|
|
23157
|
+
// @ts-expect-error This check is still good for ensuring correctness
|
|
23416
23158
|
(true && !(arrangedContent !== this) && (0, _debug.assert)("Can't set ArrayProxy's content to itself", arrangedContent !== this));
|
|
23417
23159
|
(true && !((0, _array.isArray)(arrangedContent) || arrangedContent.isDestroyed) && (0, _debug.assert)(`ArrayProxy expects an Array or ArrayProxy, but you passed ${typeof arrangedContent}`, (0, _array.isArray)(arrangedContent) || arrangedContent.isDestroyed));
|
|
23418
23160
|
(0, _metal.addArrayObserver)(arrangedContent, this, ARRAY_OBSERVER_MAPPING);
|
|
@@ -23428,7 +23170,7 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23428
23170
|
|
|
23429
23171
|
_arrangedContentArrayWillChange() {}
|
|
23430
23172
|
|
|
23431
|
-
_arrangedContentArrayDidChange(
|
|
23173
|
+
_arrangedContentArrayDidChange(_proxy, idx, removedCnt, addedCnt) {
|
|
23432
23174
|
(0, _metal.arrayContentWillChange)(this, idx, removedCnt, addedCnt);
|
|
23433
23175
|
var dirtyIndex = idx;
|
|
23434
23176
|
|
|
@@ -23482,17 +23224,18 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23482
23224
|
|
|
23483
23225
|
}
|
|
23484
23226
|
|
|
23485
|
-
_exports.default = ArrayProxy;
|
|
23486
23227
|
ArrayProxy.reopen(_array.MutableArray, {
|
|
23487
23228
|
/**
|
|
23488
23229
|
The array that the proxy pretends to be. In the default `ArrayProxy`
|
|
23489
23230
|
implementation, this and `content` are the same. Subclasses of `ArrayProxy`
|
|
23490
23231
|
can override this property to provide things like sorting and filtering.
|
|
23491
|
-
|
|
23232
|
+
@property arrangedContent
|
|
23492
23233
|
@public
|
|
23493
23234
|
*/
|
|
23494
23235
|
arrangedContent: (0, _metal.alias)('content')
|
|
23495
23236
|
});
|
|
23237
|
+
var _default = ArrayProxy;
|
|
23238
|
+
_exports.default = _default;
|
|
23496
23239
|
});
|
|
23497
23240
|
define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-internals/container", "@ember/-internals/owner", "@ember/-internals/utils", "@ember/-internals/meta", "@ember/-internals/metal", "@ember/-internals/runtime/lib/mixins/action_handler", "@ember/debug", "@glimmer/util", "@glimmer/destroyable", "@glimmer/owner"], function (_exports, _container, _owner, _utils, _meta2, _metal, _action_handler, _debug, _util, _destroyable, _owner2) {
|
|
23498
23241
|
"use strict";
|
|
@@ -24352,6 +24095,8 @@ define("@ember/-internals/runtime/lib/system/object", ["exports", "@ember/-inter
|
|
|
24352
24095
|
/**
|
|
24353
24096
|
@module @ember/object
|
|
24354
24097
|
*/
|
|
24098
|
+
var _a;
|
|
24099
|
+
|
|
24355
24100
|
class EmberObject extends _core_object.default.extend(_observable.default) {
|
|
24356
24101
|
get _debugContainerKey() {
|
|
24357
24102
|
var factory = (0, _container.getFactoryFor)(this);
|
|
@@ -24368,15 +24113,20 @@ define("@ember/-internals/runtime/lib/system/object", ["exports", "@ember/-inter
|
|
|
24368
24113
|
if (true
|
|
24369
24114
|
/* DEBUG */
|
|
24370
24115
|
) {
|
|
24371
|
-
var INIT_WAS_CALLED = (
|
|
24116
|
+
var INIT_WAS_CALLED = Symbol('INIT_WAS_CALLED');
|
|
24372
24117
|
var ASSERT_INIT_WAS_CALLED = (0, _utils.symbol)('ASSERT_INIT_WAS_CALLED');
|
|
24373
24118
|
_exports.FrameworkObject = FrameworkObject = class DebugFrameworkObject extends EmberObject {
|
|
24119
|
+
constructor() {
|
|
24120
|
+
super(...arguments);
|
|
24121
|
+
this[_a] = false;
|
|
24122
|
+
}
|
|
24123
|
+
|
|
24374
24124
|
init(properties) {
|
|
24375
24125
|
super.init(properties);
|
|
24376
24126
|
this[INIT_WAS_CALLED] = true;
|
|
24377
24127
|
}
|
|
24378
24128
|
|
|
24379
|
-
[ASSERT_INIT_WAS_CALLED]() {
|
|
24129
|
+
[(_a = INIT_WAS_CALLED, ASSERT_INIT_WAS_CALLED)]() {
|
|
24380
24130
|
(true && !(this[INIT_WAS_CALLED]) && (0, _debug.assert)(`You must call \`super.init(...arguments);\` or \`this._super(...arguments)\` when overriding \`init\` on a framework object. Please update ${this} to call \`super.init(...arguments);\` from \`init\` when using native classes or \`this._super(...arguments)\` when using \`EmberObject.extend()\`.`, this[INIT_WAS_CALLED]));
|
|
24381
24131
|
}
|
|
24382
24132
|
|
|
@@ -24392,86 +24142,11 @@ define("@ember/-internals/runtime/lib/system/object_proxy", ["exports", "@ember/
|
|
|
24392
24142
|
});
|
|
24393
24143
|
_exports.default = void 0;
|
|
24394
24144
|
|
|
24395
|
-
/**
|
|
24396
|
-
`ObjectProxy` forwards all properties not defined by the proxy itself
|
|
24397
|
-
to a proxied `content` object.
|
|
24398
|
-
|
|
24399
|
-
```javascript
|
|
24400
|
-
import EmberObject from '@ember/object';
|
|
24401
|
-
import ObjectProxy from '@ember/object/proxy';
|
|
24402
|
-
|
|
24403
|
-
let exampleObject = EmberObject.create({
|
|
24404
|
-
name: 'Foo'
|
|
24405
|
-
});
|
|
24406
|
-
|
|
24407
|
-
let exampleProxy = ObjectProxy.create({
|
|
24408
|
-
content: exampleObject
|
|
24409
|
-
});
|
|
24410
|
-
|
|
24411
|
-
// Access and change existing properties
|
|
24412
|
-
exampleProxy.get('name'); // 'Foo'
|
|
24413
|
-
exampleProxy.set('name', 'Bar');
|
|
24414
|
-
exampleObject.get('name'); // 'Bar'
|
|
24415
|
-
|
|
24416
|
-
// Create new 'description' property on `exampleObject`
|
|
24417
|
-
exampleProxy.set('description', 'Foo is a whizboo baz');
|
|
24418
|
-
exampleObject.get('description'); // 'Foo is a whizboo baz'
|
|
24419
|
-
```
|
|
24420
|
-
|
|
24421
|
-
While `content` is unset, setting a property to be delegated will throw an
|
|
24422
|
-
Error.
|
|
24423
|
-
|
|
24424
|
-
```javascript
|
|
24425
|
-
import ObjectProxy from '@ember/object/proxy';
|
|
24426
|
-
|
|
24427
|
-
let exampleProxy = ObjectProxy.create({
|
|
24428
|
-
content: null,
|
|
24429
|
-
flag: null
|
|
24430
|
-
});
|
|
24431
|
-
exampleProxy.set('flag', true);
|
|
24432
|
-
exampleProxy.get('flag'); // true
|
|
24433
|
-
exampleProxy.get('foo'); // undefined
|
|
24434
|
-
exampleProxy.set('foo', 'data'); // throws Error
|
|
24435
|
-
```
|
|
24436
|
-
|
|
24437
|
-
Delegated properties can be bound to and will change when content is updated.
|
|
24438
|
-
|
|
24439
|
-
Computed properties on the proxy itself can depend on delegated properties.
|
|
24440
|
-
|
|
24441
|
-
```javascript
|
|
24442
|
-
import { computed } from '@ember/object';
|
|
24443
|
-
import ObjectProxy from '@ember/object/proxy';
|
|
24444
|
-
|
|
24445
|
-
ProxyWithComputedProperty = ObjectProxy.extend({
|
|
24446
|
-
fullName: computed('firstName', 'lastName', function() {
|
|
24447
|
-
var firstName = this.get('firstName'),
|
|
24448
|
-
lastName = this.get('lastName');
|
|
24449
|
-
if (firstName && lastName) {
|
|
24450
|
-
return firstName + ' ' + lastName;
|
|
24451
|
-
}
|
|
24452
|
-
return firstName || lastName;
|
|
24453
|
-
})
|
|
24454
|
-
});
|
|
24455
|
-
|
|
24456
|
-
let exampleProxy = ProxyWithComputedProperty.create();
|
|
24457
|
-
|
|
24458
|
-
exampleProxy.get('fullName'); // undefined
|
|
24459
|
-
exampleProxy.set('content', {
|
|
24460
|
-
firstName: 'Tom', lastName: 'Dale'
|
|
24461
|
-
}); // triggers property change for fullName on proxy
|
|
24462
|
-
|
|
24463
|
-
exampleProxy.get('fullName'); // 'Tom Dale'
|
|
24464
|
-
```
|
|
24465
|
-
|
|
24466
|
-
@class ObjectProxy
|
|
24467
|
-
@extends EmberObject
|
|
24468
|
-
@uses Ember.ProxyMixin
|
|
24469
|
-
@public
|
|
24470
|
-
*/
|
|
24471
24145
|
class ObjectProxy extends _object.default {}
|
|
24472
24146
|
|
|
24473
|
-
_exports.default = ObjectProxy;
|
|
24474
24147
|
ObjectProxy.PrototypeMixin.reopen(_proxy.default);
|
|
24148
|
+
var _default = ObjectProxy;
|
|
24149
|
+
_exports.default = _default;
|
|
24475
24150
|
});
|
|
24476
24151
|
define("@ember/-internals/runtime/lib/type-of", ["exports", "@ember/-internals/runtime/lib/system/core_object"], function (_exports, _core_object) {
|
|
24477
24152
|
"use strict";
|
|
@@ -25157,7 +24832,7 @@ define("@ember/-internals/utils/index", ["exports", "@glimmer/util", "@ember/deb
|
|
|
25157
24832
|
var key = keys[i];
|
|
25158
24833
|
(true && !(key) && (0, _debug.assert)('has key', key)); // Looping over array
|
|
25159
24834
|
|
|
25160
|
-
s += `${inspectKey(key)}: ${inspectValue(obj[key], depth, seen)}`;
|
|
24835
|
+
s += `${inspectKey(String(key))}: ${inspectValue(obj[key], depth, seen)}`;
|
|
25161
24836
|
}
|
|
25162
24837
|
|
|
25163
24838
|
s += ' }';
|
|
@@ -25489,6 +25164,13 @@ define("@ember/-internals/utils/index", ["exports", "@glimmer/util", "@ember/deb
|
|
|
25489
25164
|
*/
|
|
25490
25165
|
|
|
25491
25166
|
});
|
|
25167
|
+
define("@ember/-internals/utils/types", ["exports"], function (_exports) {
|
|
25168
|
+
"use strict";
|
|
25169
|
+
|
|
25170
|
+
Object.defineProperty(_exports, "__esModule", {
|
|
25171
|
+
value: true
|
|
25172
|
+
});
|
|
25173
|
+
});
|
|
25492
25174
|
define("@ember/-internals/views/index", ["exports", "@ember/-internals/views/lib/system/utils", "@ember/-internals/views/lib/system/event_dispatcher", "@ember/-internals/views/lib/component_lookup", "@ember/-internals/views/lib/views/core_view", "@ember/-internals/views/lib/mixins/class_names_support", "@ember/-internals/views/lib/mixins/child_views_support", "@ember/-internals/views/lib/mixins/view_state_support", "@ember/-internals/views/lib/mixins/view_support", "@ember/-internals/views/lib/mixins/action_support", "@ember/-internals/views/lib/compat/attrs", "@ember/-internals/views/lib/system/action_manager"], function (_exports, _utils, _event_dispatcher, _component_lookup, _core_view, _class_names_support, _child_views_support, _view_state_support, _view_support, _action_support, _attrs, _action_manager) {
|
|
25493
25175
|
"use strict";
|
|
25494
25176
|
|
|
@@ -25646,14 +25328,14 @@ define("@ember/-internals/views/index", ["exports", "@ember/-internals/views/lib
|
|
|
25646
25328
|
}
|
|
25647
25329
|
});
|
|
25648
25330
|
});
|
|
25649
|
-
define("@ember/-internals/views/lib/compat/attrs", ["exports"
|
|
25331
|
+
define("@ember/-internals/views/lib/compat/attrs", ["exports"], function (_exports) {
|
|
25650
25332
|
"use strict";
|
|
25651
25333
|
|
|
25652
25334
|
Object.defineProperty(_exports, "__esModule", {
|
|
25653
25335
|
value: true
|
|
25654
25336
|
});
|
|
25655
25337
|
_exports.MUTABLE_CELL = void 0;
|
|
25656
|
-
var MUTABLE_CELL = (
|
|
25338
|
+
var MUTABLE_CELL = Symbol('MUTABLE_CELL');
|
|
25657
25339
|
_exports.MUTABLE_CELL = MUTABLE_CELL;
|
|
25658
25340
|
});
|
|
25659
25341
|
define("@ember/-internals/views/lib/compat/fallback-view-registry", ["exports", "@ember/-internals/utils"], function (_exports, _utils) {
|
|
@@ -25677,9 +25359,9 @@ define("@ember/-internals/views/lib/component_lookup", ["exports", "@ember/-inte
|
|
|
25677
25359
|
_exports.default = void 0;
|
|
25678
25360
|
|
|
25679
25361
|
var _default = _runtime.Object.extend({
|
|
25680
|
-
componentFor(name, owner
|
|
25362
|
+
componentFor(name, owner) {
|
|
25681
25363
|
var fullName = `component:${name}`;
|
|
25682
|
-
return owner.factoryFor(fullName
|
|
25364
|
+
return owner.factoryFor(fullName);
|
|
25683
25365
|
},
|
|
25684
25366
|
|
|
25685
25367
|
layoutFor(name, owner, options) {
|
|
@@ -25702,7 +25384,7 @@ define("@ember/-internals/views/lib/mixins/action_support", ["exports", "@ember/
|
|
|
25702
25384
|
/**
|
|
25703
25385
|
@module ember
|
|
25704
25386
|
*/
|
|
25705
|
-
var
|
|
25387
|
+
var ActionSupport = _metal.Mixin.create({
|
|
25706
25388
|
send(actionName) {
|
|
25707
25389
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
25708
25390
|
args[_key - 1] = arguments[_key];
|
|
@@ -25729,15 +25411,9 @@ define("@ember/-internals/views/lib/mixins/action_support", ["exports", "@ember/
|
|
|
25729
25411
|
}
|
|
25730
25412
|
}
|
|
25731
25413
|
|
|
25732
|
-
};
|
|
25733
|
-
/**
|
|
25734
|
-
@class ActionSupport
|
|
25735
|
-
@namespace Ember
|
|
25736
|
-
@private
|
|
25737
|
-
*/
|
|
25738
|
-
|
|
25739
|
-
var _default = _metal.Mixin.create(mixinObj);
|
|
25414
|
+
});
|
|
25740
25415
|
|
|
25416
|
+
var _default = ActionSupport;
|
|
25741
25417
|
_exports.default = _default;
|
|
25742
25418
|
});
|
|
25743
25419
|
define("@ember/-internals/views/lib/mixins/child_views_support", ["exports", "@ember/-internals/metal", "@ember/-internals/views/lib/system/utils"], function (_exports, _metal, _utils) {
|
|
@@ -25748,13 +25424,10 @@ define("@ember/-internals/views/lib/mixins/child_views_support", ["exports", "@e
|
|
|
25748
25424
|
});
|
|
25749
25425
|
_exports.default = void 0;
|
|
25750
25426
|
|
|
25751
|
-
|
|
25752
|
-
@module ember
|
|
25753
|
-
*/
|
|
25754
|
-
var _default = _metal.Mixin.create({
|
|
25427
|
+
var ChildViewsSupport = _metal.Mixin.create({
|
|
25755
25428
|
/**
|
|
25756
25429
|
Array of child views. You should never edit this array directly.
|
|
25757
|
-
|
|
25430
|
+
@property childViews
|
|
25758
25431
|
@type Array
|
|
25759
25432
|
@default []
|
|
25760
25433
|
@private
|
|
@@ -25775,6 +25448,7 @@ define("@ember/-internals/views/lib/mixins/child_views_support", ["exports", "@e
|
|
|
25775
25448
|
|
|
25776
25449
|
});
|
|
25777
25450
|
|
|
25451
|
+
var _default = ChildViewsSupport;
|
|
25778
25452
|
_exports.default = _default;
|
|
25779
25453
|
});
|
|
25780
25454
|
define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@ember/-internals/metal", "@ember/debug"], function (_exports, _metal, _debug) {
|
|
@@ -25789,13 +25463,8 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25789
25463
|
@module ember
|
|
25790
25464
|
*/
|
|
25791
25465
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
25792
|
-
/**
|
|
25793
|
-
@class ClassNamesSupport
|
|
25794
|
-
@namespace Ember
|
|
25795
|
-
@private
|
|
25796
|
-
*/
|
|
25797
25466
|
|
|
25798
|
-
var
|
|
25467
|
+
var ClassNamesSupport = _metal.Mixin.create({
|
|
25799
25468
|
concatenatedProperties: ['classNames', 'classNameBindings'],
|
|
25800
25469
|
|
|
25801
25470
|
init() {
|
|
@@ -25809,7 +25478,7 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25809
25478
|
Standard CSS class names to apply to the view's outer element. This
|
|
25810
25479
|
property automatically inherits any class names defined by the view's
|
|
25811
25480
|
superclasses as well.
|
|
25812
|
-
|
|
25481
|
+
@property classNames
|
|
25813
25482
|
@type Array
|
|
25814
25483
|
@default ['ember-view']
|
|
25815
25484
|
@public
|
|
@@ -25820,7 +25489,7 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25820
25489
|
A list of properties of the view to apply as class names. If the property
|
|
25821
25490
|
is a string value, the value of that string will be applied as a class
|
|
25822
25491
|
name.
|
|
25823
|
-
|
|
25492
|
+
```javascript
|
|
25824
25493
|
// Applies the 'high' class to the view element
|
|
25825
25494
|
import Component from '@ember/component';
|
|
25826
25495
|
Component.extend({
|
|
@@ -25828,9 +25497,9 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25828
25497
|
priority: 'high'
|
|
25829
25498
|
});
|
|
25830
25499
|
```
|
|
25831
|
-
|
|
25500
|
+
If the value of the property is a Boolean, the name of that property is
|
|
25832
25501
|
added as a dasherized class name.
|
|
25833
|
-
|
|
25502
|
+
```javascript
|
|
25834
25503
|
// Applies the 'is-urgent' class to the view element
|
|
25835
25504
|
import Component from '@ember/component';
|
|
25836
25505
|
Component.extend({
|
|
@@ -25838,9 +25507,9 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25838
25507
|
isUrgent: true
|
|
25839
25508
|
});
|
|
25840
25509
|
```
|
|
25841
|
-
|
|
25510
|
+
If you would prefer to use a custom value instead of the dasherized
|
|
25842
25511
|
property name, you can pass a binding like this:
|
|
25843
|
-
|
|
25512
|
+
```javascript
|
|
25844
25513
|
// Applies the 'urgent' class to the view element
|
|
25845
25514
|
import Component from '@ember/component';
|
|
25846
25515
|
Component.extend({
|
|
@@ -25848,9 +25517,9 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25848
25517
|
isUrgent: true
|
|
25849
25518
|
});
|
|
25850
25519
|
```
|
|
25851
|
-
|
|
25520
|
+
If you would like to specify a class that should only be added when the
|
|
25852
25521
|
property is false, you can declare a binding like this:
|
|
25853
|
-
|
|
25522
|
+
```javascript
|
|
25854
25523
|
// Applies the 'disabled' class to the view element
|
|
25855
25524
|
import Component from '@ember/component';
|
|
25856
25525
|
Component.extend({
|
|
@@ -25858,8 +25527,8 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25858
25527
|
isEnabled: false
|
|
25859
25528
|
});
|
|
25860
25529
|
```
|
|
25861
|
-
|
|
25862
|
-
|
|
25530
|
+
This list of properties is inherited from the component's superclasses as well.
|
|
25531
|
+
@property classNameBindings
|
|
25863
25532
|
@type Array
|
|
25864
25533
|
@default []
|
|
25865
25534
|
@public
|
|
@@ -25867,6 +25536,7 @@ define("@ember/-internals/views/lib/mixins/class_names_support", ["exports", "@e
|
|
|
25867
25536
|
classNameBindings: EMPTY_ARRAY
|
|
25868
25537
|
});
|
|
25869
25538
|
|
|
25539
|
+
var _default = ClassNamesSupport;
|
|
25870
25540
|
_exports.default = _default;
|
|
25871
25541
|
});
|
|
25872
25542
|
define("@ember/-internals/views/lib/mixins/view_state_support", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
@@ -25880,7 +25550,7 @@ define("@ember/-internals/views/lib/mixins/view_state_support", ["exports", "@em
|
|
|
25880
25550
|
/**
|
|
25881
25551
|
@module ember
|
|
25882
25552
|
*/
|
|
25883
|
-
var
|
|
25553
|
+
var ViewStateSupport = _metal.Mixin.create({
|
|
25884
25554
|
_transitionTo(state) {
|
|
25885
25555
|
var priorState = this._currentState;
|
|
25886
25556
|
var currentState = this._currentState = this._states[state];
|
|
@@ -25897,6 +25567,7 @@ define("@ember/-internals/views/lib/mixins/view_state_support", ["exports", "@em
|
|
|
25897
25567
|
|
|
25898
25568
|
});
|
|
25899
25569
|
|
|
25570
|
+
var _default = ViewStateSupport;
|
|
25900
25571
|
_exports.default = _default;
|
|
25901
25572
|
});
|
|
25902
25573
|
define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-internals/utils", "@ember/-internals/metal", "@ember/debug", "@ember/-internals/browser-environment", "@ember/-internals/views/lib/system/utils"], function (_exports, _utils, _metal, _debug, _browserEnvironment, _utils2) {
|
|
@@ -25911,43 +25582,43 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
25911
25582
|
return this;
|
|
25912
25583
|
}
|
|
25913
25584
|
|
|
25914
|
-
var
|
|
25585
|
+
var ViewMixin = _metal.Mixin.create({
|
|
25915
25586
|
/**
|
|
25916
25587
|
A list of properties of the view to apply as attributes. If the property
|
|
25917
25588
|
is a string value, the value of that string will be applied as the value
|
|
25918
25589
|
for an attribute of the property's name.
|
|
25919
|
-
|
|
25920
|
-
|
|
25590
|
+
The following example creates a tag like `<div priority="high" />`.
|
|
25591
|
+
```app/components/my-component.js
|
|
25921
25592
|
import Component from '@ember/component';
|
|
25922
|
-
|
|
25593
|
+
export default Component.extend({
|
|
25923
25594
|
attributeBindings: ['priority'],
|
|
25924
25595
|
priority: 'high'
|
|
25925
25596
|
});
|
|
25926
25597
|
```
|
|
25927
|
-
|
|
25598
|
+
If the value of the property is a Boolean, the attribute is treated as
|
|
25928
25599
|
an HTML Boolean attribute. It will be present if the property is `true`
|
|
25929
25600
|
and omitted if the property is `false`.
|
|
25930
|
-
|
|
25931
|
-
|
|
25601
|
+
The following example creates markup like `<div visible />`.
|
|
25602
|
+
```app/components/my-component.js
|
|
25932
25603
|
import Component from '@ember/component';
|
|
25933
|
-
|
|
25604
|
+
export default Component.extend({
|
|
25934
25605
|
attributeBindings: ['visible'],
|
|
25935
25606
|
visible: true
|
|
25936
25607
|
});
|
|
25937
25608
|
```
|
|
25938
|
-
|
|
25609
|
+
If you would prefer to use a custom value instead of the property name,
|
|
25939
25610
|
you can create the same markup as the last example with a binding like
|
|
25940
25611
|
this:
|
|
25941
|
-
|
|
25612
|
+
```app/components/my-component.js
|
|
25942
25613
|
import Component from '@ember/component';
|
|
25943
|
-
|
|
25614
|
+
export default Component.extend({
|
|
25944
25615
|
attributeBindings: ['isVisible:visible'],
|
|
25945
25616
|
isVisible: true
|
|
25946
25617
|
});
|
|
25947
25618
|
```
|
|
25948
|
-
|
|
25619
|
+
This list of attributes is inherited from the component's superclasses,
|
|
25949
25620
|
as well.
|
|
25950
|
-
|
|
25621
|
+
@property attributeBindings
|
|
25951
25622
|
@type Array
|
|
25952
25623
|
@default []
|
|
25953
25624
|
@public
|
|
@@ -25961,7 +25632,7 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
25961
25632
|
/**
|
|
25962
25633
|
Return the nearest ancestor that is an instance of the provided
|
|
25963
25634
|
class or mixin.
|
|
25964
|
-
|
|
25635
|
+
@method nearestOfType
|
|
25965
25636
|
@param {Class,Mixin} klass Subclass of Ember.View (or Ember.View itself),
|
|
25966
25637
|
or an instance of Mixin.
|
|
25967
25638
|
@return Ember.View
|
|
@@ -25979,11 +25650,13 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
25979
25650
|
|
|
25980
25651
|
view = view.parentView;
|
|
25981
25652
|
}
|
|
25653
|
+
|
|
25654
|
+
return;
|
|
25982
25655
|
},
|
|
25983
25656
|
|
|
25984
25657
|
/**
|
|
25985
25658
|
Return the nearest ancestor that has a given property.
|
|
25986
|
-
|
|
25659
|
+
@method nearestWithProperty
|
|
25987
25660
|
@param {String} property A property name
|
|
25988
25661
|
@return Ember.View
|
|
25989
25662
|
@deprecated use `yield` and contextual components for composition instead.
|
|
@@ -26006,13 +25679,13 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26006
25679
|
view is already in the DOM or not. If the view is in the DOM, the
|
|
26007
25680
|
rendering process will be deferred to give bindings a chance
|
|
26008
25681
|
to synchronize.
|
|
26009
|
-
|
|
25682
|
+
If children were added during the rendering process using `appendChild`,
|
|
26010
25683
|
`rerender` will remove them, because they will be added again
|
|
26011
25684
|
if needed by the next `render`.
|
|
26012
|
-
|
|
25685
|
+
In general, if the display of your view changes, you should modify
|
|
26013
25686
|
the DOM element directly instead of manually calling `rerender`, which can
|
|
26014
25687
|
be slow.
|
|
26015
|
-
|
|
25688
|
+
@method rerender
|
|
26016
25689
|
@public
|
|
26017
25690
|
*/
|
|
26018
25691
|
rerender() {
|
|
@@ -26025,7 +25698,7 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26025
25698
|
|
|
26026
25699
|
/**
|
|
26027
25700
|
Returns the current DOM element for the view.
|
|
26028
|
-
|
|
25701
|
+
@property element
|
|
26029
25702
|
@type DOMElement
|
|
26030
25703
|
@public
|
|
26031
25704
|
*/
|
|
@@ -26041,14 +25714,14 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26041
25714
|
|
|
26042
25715
|
/**
|
|
26043
25716
|
Appends the view's element to the specified parent element.
|
|
26044
|
-
|
|
25717
|
+
Note that this method just schedules the view to be appended; the DOM
|
|
26045
25718
|
element will not be appended to the given element until all bindings have
|
|
26046
25719
|
finished synchronizing.
|
|
26047
|
-
|
|
25720
|
+
This is not typically a function that you will need to call directly when
|
|
26048
25721
|
building your application. If you do need to use `appendTo`, be sure that
|
|
26049
25722
|
the target element you are providing is associated with an `Application`
|
|
26050
25723
|
and does not have an ancestor element that is associated with an Ember view.
|
|
26051
|
-
|
|
25724
|
+
@method appendTo
|
|
26052
25725
|
@param {String|DOMElement} A selector, element, HTML string
|
|
26053
25726
|
@return {Ember.View} receiver
|
|
26054
25727
|
@private
|
|
@@ -26057,14 +25730,15 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26057
25730
|
var target;
|
|
26058
25731
|
|
|
26059
25732
|
if (_browserEnvironment.hasDOM) {
|
|
25733
|
+
(true && !(typeof selector === 'string' || selector instanceof Element) && (0, _debug.assert)(`Expected a selector or instance of Element`, typeof selector === 'string' || selector instanceof Element));
|
|
26060
25734
|
target = typeof selector === 'string' ? document.querySelector(selector) : selector;
|
|
26061
25735
|
(true && !(target) && (0, _debug.assert)(`You tried to append to (${selector}) but that isn't in the DOM`, target));
|
|
26062
25736
|
(true && !(!(0, _utils2.matches)(target, '.ember-view')) && (0, _debug.assert)('You cannot append to an existing Ember.View.', !(0, _utils2.matches)(target, '.ember-view')));
|
|
26063
25737
|
(true && !((() => {
|
|
26064
25738
|
var node = target.parentNode;
|
|
26065
25739
|
|
|
26066
|
-
while (node) {
|
|
26067
|
-
if (
|
|
25740
|
+
while (node instanceof Element) {
|
|
25741
|
+
if ((0, _utils2.matches)(node, '.ember-view')) {
|
|
26068
25742
|
return false;
|
|
26069
25743
|
}
|
|
26070
25744
|
|
|
@@ -26075,8 +25749,8 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26075
25749
|
})()) && (0, _debug.assert)('You cannot append to an existing Ember.View.', (() => {
|
|
26076
25750
|
var node = target.parentNode;
|
|
26077
25751
|
|
|
26078
|
-
while (node) {
|
|
26079
|
-
if (
|
|
25752
|
+
while (node instanceof Element) {
|
|
25753
|
+
if ((0, _utils2.matches)(node, '.ember-view')) {
|
|
26080
25754
|
return false;
|
|
26081
25755
|
}
|
|
26082
25756
|
|
|
@@ -26088,8 +25762,10 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26088
25762
|
} else {
|
|
26089
25763
|
target = selector;
|
|
26090
25764
|
(true && !(typeof target !== 'string') && (0, _debug.assert)(`You tried to append to a selector string (${selector}) in an environment without a DOM`, typeof target !== 'string'));
|
|
26091
|
-
(true && !(typeof
|
|
26092
|
-
}
|
|
25765
|
+
(true && !(typeof target.appendChild === 'function') && (0, _debug.assert)(`You tried to append to a non-Element (${selector}) in an environment without a DOM`, typeof target.appendChild === 'function'));
|
|
25766
|
+
} // SAFETY: SimpleElement is supposed to be a subset of Element so this _should_ be safe.
|
|
25767
|
+
// However, the types are more specific in some places which necessitates the `as`.
|
|
25768
|
+
|
|
26093
25769
|
|
|
26094
25770
|
this.renderer.appendTo(this, target);
|
|
26095
25771
|
return this;
|
|
@@ -26099,13 +25775,13 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26099
25775
|
Appends the view's element to the document body. If the view does
|
|
26100
25776
|
not have an HTML representation yet
|
|
26101
25777
|
the element will be generated automatically.
|
|
26102
|
-
|
|
25778
|
+
If your application uses the `rootElement` property, you must append
|
|
26103
25779
|
the view within that element. Rendering views outside of the `rootElement`
|
|
26104
25780
|
is not supported.
|
|
26105
|
-
|
|
25781
|
+
Note that this method just schedules the view to be appended; the DOM
|
|
26106
25782
|
element will not be appended to the document body until all bindings have
|
|
26107
25783
|
finished synchronizing.
|
|
26108
|
-
|
|
25784
|
+
@method append
|
|
26109
25785
|
@return {Ember.View} receiver
|
|
26110
25786
|
@private
|
|
26111
25787
|
*/
|
|
@@ -26116,17 +25792,17 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26116
25792
|
/**
|
|
26117
25793
|
The HTML `id` of the view's element in the DOM. You can provide this
|
|
26118
25794
|
value yourself but it must be unique (just as in HTML):
|
|
26119
|
-
|
|
25795
|
+
```handlebars
|
|
26120
25796
|
{{my-component elementId="a-really-cool-id"}}
|
|
26121
25797
|
```
|
|
26122
|
-
|
|
26123
|
-
|
|
25798
|
+
If not manually set a default value will be provided by the framework.
|
|
25799
|
+
Once rendered an element's `elementId` is considered immutable and you
|
|
26124
25800
|
should never change it. If you need to compute a dynamic value for the
|
|
26125
25801
|
`elementId`, you should do this when the component or element is being
|
|
26126
25802
|
instantiated:
|
|
26127
|
-
|
|
25803
|
+
```app/components/my-component.js
|
|
26128
25804
|
import Component from '@ember/component';
|
|
26129
|
-
|
|
25805
|
+
export default Component.extend({
|
|
26130
25806
|
init() {
|
|
26131
25807
|
this._super(...arguments);
|
|
26132
25808
|
let index = this.get('index');
|
|
@@ -26134,7 +25810,7 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26134
25810
|
}
|
|
26135
25811
|
});
|
|
26136
25812
|
```
|
|
26137
|
-
|
|
25813
|
+
@property elementId
|
|
26138
25814
|
@type String
|
|
26139
25815
|
@public
|
|
26140
25816
|
*/
|
|
@@ -26142,7 +25818,7 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26142
25818
|
|
|
26143
25819
|
/**
|
|
26144
25820
|
Called when a view is going to insert an element into the DOM.
|
|
26145
|
-
|
|
25821
|
+
@event willInsertElement
|
|
26146
25822
|
@public
|
|
26147
25823
|
*/
|
|
26148
25824
|
willInsertElement: K,
|
|
@@ -26151,9 +25827,9 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26151
25827
|
Called when the element of the view has been inserted into the DOM.
|
|
26152
25828
|
Override this function to do any set up that requires an element
|
|
26153
25829
|
in the document body.
|
|
26154
|
-
|
|
25830
|
+
When a view has children, didInsertElement will be called on the
|
|
26155
25831
|
child view(s) first and on itself afterwards.
|
|
26156
|
-
|
|
25832
|
+
@event didInsertElement
|
|
26157
25833
|
@public
|
|
26158
25834
|
*/
|
|
26159
25835
|
didInsertElement: K,
|
|
@@ -26162,7 +25838,7 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26162
25838
|
Called when the view is about to rerender, but before anything has
|
|
26163
25839
|
been torn down. This is a good opportunity to tear down any manual
|
|
26164
25840
|
observers you have installed based on the DOM state
|
|
26165
|
-
|
|
25841
|
+
@event willClearRender
|
|
26166
25842
|
@public
|
|
26167
25843
|
*/
|
|
26168
25844
|
willClearRender: K,
|
|
@@ -26172,7 +25848,7 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26172
25848
|
child views). This will remove the view from any parent node, then make
|
|
26173
25849
|
sure that the DOM element managed by the view can be released by the
|
|
26174
25850
|
memory manager.
|
|
26175
|
-
|
|
25851
|
+
@method destroy
|
|
26176
25852
|
@private
|
|
26177
25853
|
*/
|
|
26178
25854
|
destroy() {
|
|
@@ -26185,23 +25861,23 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26185
25861
|
Called when the element of the view is going to be destroyed. Override
|
|
26186
25862
|
this function to do any teardown that requires an element, like removing
|
|
26187
25863
|
event listeners.
|
|
26188
|
-
|
|
25864
|
+
Please note: any property changes made during this event will have no
|
|
26189
25865
|
effect on object observers.
|
|
26190
|
-
|
|
25866
|
+
@event willDestroyElement
|
|
26191
25867
|
@public
|
|
26192
25868
|
*/
|
|
26193
25869
|
willDestroyElement: K,
|
|
26194
25870
|
|
|
26195
25871
|
/**
|
|
26196
25872
|
Called after the element of the view is destroyed.
|
|
26197
|
-
|
|
25873
|
+
@event willDestroyElement
|
|
26198
25874
|
@public
|
|
26199
25875
|
*/
|
|
26200
25876
|
didDestroyElement: K,
|
|
26201
25877
|
|
|
26202
25878
|
/**
|
|
26203
25879
|
Called when the parentView property has changed.
|
|
26204
|
-
|
|
25880
|
+
@event parentViewDidChange
|
|
26205
25881
|
@private
|
|
26206
25882
|
*/
|
|
26207
25883
|
parentViewDidChange: K,
|
|
@@ -26213,13 +25889,13 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26213
25889
|
Tag name for the view's outer element. The tag name is only used when an
|
|
26214
25890
|
element is first created. If you change the `tagName` for an element, you
|
|
26215
25891
|
must destroy and recreate the view element.
|
|
26216
|
-
|
|
26217
|
-
|
|
25892
|
+
By default, the render buffer will use a `<div>` tag for views.
|
|
25893
|
+
If the tagName is `''`, the view will be tagless, with no outer element.
|
|
26218
25894
|
Component properties that depend on the presence of an outer element, such
|
|
26219
25895
|
as `classNameBindings` and `attributeBindings`, do not work with tagless
|
|
26220
25896
|
components. Tagless components cannot implement methods to handle events,
|
|
26221
25897
|
and their `element` property has a `null` value.
|
|
26222
|
-
|
|
25898
|
+
@property tagName
|
|
26223
25899
|
@type String
|
|
26224
25900
|
@default null
|
|
26225
25901
|
@public
|
|
@@ -26234,10 +25910,10 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26234
25910
|
|
|
26235
25911
|
/**
|
|
26236
25912
|
Setup a view, but do not finish waking it up.
|
|
26237
|
-
|
|
25913
|
+
* configure `childViews`
|
|
26238
25914
|
* register the view with the global views hash, which is used for event
|
|
26239
25915
|
dispatch
|
|
26240
|
-
|
|
25916
|
+
@method init
|
|
26241
25917
|
@private
|
|
26242
25918
|
*/
|
|
26243
25919
|
init() {
|
|
@@ -26259,7 +25935,7 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26259
25935
|
|
|
26260
25936
|
/**
|
|
26261
25937
|
Handle events from `EventDispatcher`
|
|
26262
|
-
|
|
25938
|
+
@method handleEvent
|
|
26263
25939
|
@param eventName {String}
|
|
26264
25940
|
@param evt {Event}
|
|
26265
25941
|
@private
|
|
@@ -26268,15 +25944,9 @@ define("@ember/-internals/views/lib/mixins/view_support", ["exports", "@ember/-i
|
|
|
26268
25944
|
return this._currentState.handleEvent(this, eventName, evt);
|
|
26269
25945
|
}
|
|
26270
25946
|
|
|
26271
|
-
};
|
|
26272
|
-
/**
|
|
26273
|
-
@class ViewMixin
|
|
26274
|
-
@namespace Ember
|
|
26275
|
-
@private
|
|
26276
|
-
*/
|
|
26277
|
-
|
|
26278
|
-
var _default = _metal.Mixin.create(mixin);
|
|
25947
|
+
});
|
|
26279
25948
|
|
|
25949
|
+
var _default = ViewMixin;
|
|
26280
25950
|
_exports.default = _default;
|
|
26281
25951
|
});
|
|
26282
25952
|
define("@ember/-internals/views/lib/system/action_manager", ["exports"], function (_exports) {
|
|
@@ -26327,146 +25997,149 @@ define("@ember/-internals/views/lib/system/event_dispatcher", ["exports", "@embe
|
|
|
26327
25997
|
@extends Ember.Object
|
|
26328
25998
|
*/
|
|
26329
25999
|
|
|
26330
|
-
|
|
26331
|
-
|
|
26332
|
-
|
|
26333
|
-
|
|
26334
|
-
|
|
26335
|
-
|
|
26336
|
-
|
|
26337
|
-
|
|
26338
|
-
|
|
26339
|
-
|
|
26340
|
-
|
|
26341
|
-
|
|
26342
|
-
|
|
26343
|
-
|
|
26344
|
-
|
|
26345
|
-
|
|
26346
|
-
|
|
26347
|
-
|
|
26348
|
-
|
|
26349
|
-
|
|
26350
|
-
|
|
26351
|
-
|
|
26352
|
-
|
|
26353
|
-
|
|
26354
|
-
|
|
26355
|
-
|
|
26356
|
-
|
|
26357
|
-
|
|
26358
|
-
|
|
26359
|
-
|
|
26360
|
-
touchmove: 'touchMove',
|
|
26361
|
-
touchend: 'touchEnd',
|
|
26362
|
-
touchcancel: 'touchCancel',
|
|
26363
|
-
keydown: 'keyDown',
|
|
26364
|
-
keyup: 'keyUp',
|
|
26365
|
-
keypress: 'keyPress',
|
|
26366
|
-
mousedown: 'mouseDown',
|
|
26367
|
-
mouseup: 'mouseUp',
|
|
26368
|
-
contextmenu: 'contextMenu',
|
|
26369
|
-
click: 'click',
|
|
26370
|
-
dblclick: 'doubleClick',
|
|
26371
|
-
focusin: 'focusIn',
|
|
26372
|
-
focusout: 'focusOut',
|
|
26373
|
-
submit: 'submit',
|
|
26374
|
-
input: 'input',
|
|
26375
|
-
change: 'change',
|
|
26376
|
-
dragstart: 'dragStart',
|
|
26377
|
-
drag: 'drag',
|
|
26378
|
-
dragenter: 'dragEnter',
|
|
26379
|
-
dragleave: 'dragLeave',
|
|
26380
|
-
dragover: 'dragOver',
|
|
26381
|
-
drop: 'drop',
|
|
26382
|
-
dragend: 'dragEnd'
|
|
26383
|
-
},
|
|
26384
|
-
|
|
26385
|
-
/**
|
|
26386
|
-
The root DOM element to which event listeners should be attached. Event
|
|
26387
|
-
listeners will be attached to the document unless this is overridden.
|
|
26388
|
-
Can be specified as a DOMElement or a selector string.
|
|
26389
|
-
The default body is a string since this may be evaluated before document.body
|
|
26390
|
-
exists in the DOM.
|
|
26391
|
-
@private
|
|
26392
|
-
@property rootElement
|
|
26393
|
-
@type DOMElement
|
|
26394
|
-
@default 'body'
|
|
26395
|
-
*/
|
|
26396
|
-
rootElement: 'body',
|
|
26000
|
+
class EventDispatcher extends _runtime.Object {
|
|
26001
|
+
constructor() {
|
|
26002
|
+
super(...arguments);
|
|
26003
|
+
/**
|
|
26004
|
+
The set of events names (and associated handler function names) to be setup
|
|
26005
|
+
and dispatched by the `EventDispatcher`. Modifications to this list can be done
|
|
26006
|
+
at setup time, generally via the `Application.customEvents` hash.
|
|
26007
|
+
To add new events to be listened to:
|
|
26008
|
+
```javascript
|
|
26009
|
+
import Application from '@ember/application';
|
|
26010
|
+
let App = Application.create({
|
|
26011
|
+
customEvents: {
|
|
26012
|
+
paste: 'paste'
|
|
26013
|
+
}
|
|
26014
|
+
});
|
|
26015
|
+
```
|
|
26016
|
+
To prevent default events from being listened to:
|
|
26017
|
+
```javascript
|
|
26018
|
+
import Application from '@ember/application';
|
|
26019
|
+
let App = Application.create({
|
|
26020
|
+
customEvents: {
|
|
26021
|
+
mouseenter: null,
|
|
26022
|
+
mouseleave: null
|
|
26023
|
+
}
|
|
26024
|
+
});
|
|
26025
|
+
```
|
|
26026
|
+
@property events
|
|
26027
|
+
@type Object
|
|
26028
|
+
@private
|
|
26029
|
+
*/
|
|
26397
26030
|
|
|
26398
|
-
|
|
26399
|
-
|
|
26031
|
+
this.events = {
|
|
26032
|
+
touchstart: 'touchStart',
|
|
26033
|
+
touchmove: 'touchMove',
|
|
26034
|
+
touchend: 'touchEnd',
|
|
26035
|
+
touchcancel: 'touchCancel',
|
|
26036
|
+
keydown: 'keyDown',
|
|
26037
|
+
keyup: 'keyUp',
|
|
26038
|
+
keypress: 'keyPress',
|
|
26039
|
+
mousedown: 'mouseDown',
|
|
26040
|
+
mouseup: 'mouseUp',
|
|
26041
|
+
contextmenu: 'contextMenu',
|
|
26042
|
+
click: 'click',
|
|
26043
|
+
dblclick: 'doubleClick',
|
|
26044
|
+
focusin: 'focusIn',
|
|
26045
|
+
focusout: 'focusOut',
|
|
26046
|
+
submit: 'submit',
|
|
26047
|
+
input: 'input',
|
|
26048
|
+
change: 'change',
|
|
26049
|
+
dragstart: 'dragStart',
|
|
26050
|
+
drag: 'drag',
|
|
26051
|
+
dragenter: 'dragEnter',
|
|
26052
|
+
dragleave: 'dragLeave',
|
|
26053
|
+
dragover: 'dragOver',
|
|
26054
|
+
drop: 'drop',
|
|
26055
|
+
dragend: 'dragEnd'
|
|
26056
|
+
};
|
|
26057
|
+
/**
|
|
26058
|
+
The root DOM element to which event listeners should be attached. Event
|
|
26059
|
+
listeners will be attached to the document unless this is overridden.
|
|
26060
|
+
Can be specified as a DOMElement or a selector string.
|
|
26061
|
+
The default body is a string since this may be evaluated before document.body
|
|
26062
|
+
exists in the DOM.
|
|
26063
|
+
@private
|
|
26064
|
+
@property rootElement
|
|
26065
|
+
@type DOMElement
|
|
26066
|
+
@default 'body'
|
|
26067
|
+
*/
|
|
26400
26068
|
|
|
26069
|
+
this.rootElement = 'body';
|
|
26401
26070
|
this._eventHandlers = Object.create(null);
|
|
26402
26071
|
this._didSetup = false;
|
|
26403
26072
|
this.finalEventNameMapping = null;
|
|
26404
26073
|
this._sanitizedRootElement = null;
|
|
26405
26074
|
this.lazyEvents = new Map();
|
|
26406
|
-
|
|
26407
|
-
|
|
26075
|
+
this._reverseEventNameMapping = null;
|
|
26076
|
+
}
|
|
26408
26077
|
/**
|
|
26409
26078
|
Sets up event listeners for standard browser events.
|
|
26410
|
-
|
|
26079
|
+
This will be called after the browser sends a `DOMContentReady` event. By
|
|
26411
26080
|
default, it will set up all of the listeners on the document body. If you
|
|
26412
26081
|
would like to register the listeners on a different element, set the event
|
|
26413
26082
|
dispatcher's `root` property.
|
|
26414
|
-
|
|
26083
|
+
@private
|
|
26415
26084
|
@method setup
|
|
26416
26085
|
@param addedEvents {Object}
|
|
26417
26086
|
*/
|
|
26087
|
+
|
|
26088
|
+
|
|
26418
26089
|
setup(addedEvents, _rootElement) {
|
|
26090
|
+
var _a;
|
|
26091
|
+
|
|
26419
26092
|
(true && !((() => {
|
|
26420
26093
|
var owner = (0, _owner.getOwner)(this);
|
|
26094
|
+
(true && !(owner) && (0, _debug.assert)('[BUG] Missing owner', owner)); // SAFETY: This is not guaranteed to be safe, but this is what we expect to be returned.
|
|
26095
|
+
|
|
26421
26096
|
var environment = owner.lookup('-environment:main');
|
|
26422
26097
|
return environment.isInteractive;
|
|
26423
26098
|
})()) && (0, _debug.assert)('EventDispatcher should never be setup in fastboot mode. Please report this as an Ember bug.', (() => {
|
|
26424
26099
|
var owner = (0, _owner.getOwner)(this);
|
|
26100
|
+
(true && !(owner) && (0, _debug.assert)('[BUG] Missing owner', owner));
|
|
26425
26101
|
var environment = owner.lookup('-environment:main');
|
|
26426
26102
|
return environment.isInteractive;
|
|
26427
26103
|
})()));
|
|
26428
|
-
var events = this.finalEventNameMapping = Object.assign({}, (0, _metal.get)(this, 'events'), addedEvents);
|
|
26429
|
-
this._reverseEventNameMapping = Object.keys(events).reduce((result, key) =>
|
|
26430
|
-
|
|
26431
|
-
|
|
26104
|
+
var events = this.finalEventNameMapping = Object.assign(Object.assign({}, (0, _metal.get)(this, 'events')), addedEvents);
|
|
26105
|
+
this._reverseEventNameMapping = Object.keys(events).reduce((result, key) => {
|
|
26106
|
+
var eventName = events[key];
|
|
26107
|
+
return eventName ? Object.assign(Object.assign({}, result), {
|
|
26108
|
+
[eventName]: key
|
|
26109
|
+
}) : result;
|
|
26110
|
+
}, {});
|
|
26432
26111
|
var lazyEvents = this.lazyEvents;
|
|
26433
26112
|
|
|
26434
26113
|
if (_rootElement !== undefined && _rootElement !== null) {
|
|
26435
26114
|
(0, _metal.set)(this, 'rootElement', _rootElement);
|
|
26436
26115
|
}
|
|
26437
26116
|
|
|
26438
|
-
var
|
|
26439
|
-
var rootElement;
|
|
26440
|
-
|
|
26441
|
-
|
|
26442
|
-
rootElement = rootElementSelector;
|
|
26443
|
-
} else {
|
|
26444
|
-
rootElement = document.querySelector(rootElementSelector);
|
|
26445
|
-
}
|
|
26446
|
-
|
|
26447
|
-
(true && !(!rootElement.classList.contains(ROOT_ELEMENT_CLASS)) && (0, _debug.assert)(`You cannot use the same root element (${(0, _metal.get)(this, 'rootElement') || rootElement.tagName}) multiple times in an Ember.Application`, !rootElement.classList.contains(ROOT_ELEMENT_CLASS)));
|
|
26117
|
+
var specifiedRootElement = (0, _metal.get)(this, 'rootElement');
|
|
26118
|
+
var rootElement = typeof specifiedRootElement !== 'string' ? specifiedRootElement : document.querySelector(specifiedRootElement);
|
|
26119
|
+
(true && !(rootElement) && (0, _debug.assert)(`Could not find rootElement (${specifiedRootElement})`, rootElement));
|
|
26120
|
+
(true && !(!rootElement.classList.contains(ROOT_ELEMENT_CLASS)) && (0, _debug.assert)(`You cannot use the same root element (${specifiedRootElement}) multiple times in an Ember.Application`, !rootElement.classList.contains(ROOT_ELEMENT_CLASS)));
|
|
26448
26121
|
(true && !((() => {
|
|
26449
26122
|
var target = rootElement.parentNode;
|
|
26450
26123
|
|
|
26451
|
-
|
|
26124
|
+
while (target instanceof Element) {
|
|
26452
26125
|
if (target.classList.contains(ROOT_ELEMENT_CLASS)) {
|
|
26453
26126
|
return false;
|
|
26454
26127
|
}
|
|
26455
26128
|
|
|
26456
26129
|
target = target.parentNode;
|
|
26457
|
-
}
|
|
26130
|
+
}
|
|
26458
26131
|
|
|
26459
26132
|
return true;
|
|
26460
26133
|
})()) && (0, _debug.assert)('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', (() => {
|
|
26461
26134
|
var target = rootElement.parentNode;
|
|
26462
26135
|
|
|
26463
|
-
|
|
26136
|
+
while (target instanceof Element) {
|
|
26464
26137
|
if (target.classList.contains(ROOT_ELEMENT_CLASS)) {
|
|
26465
26138
|
return false;
|
|
26466
26139
|
}
|
|
26467
26140
|
|
|
26468
26141
|
target = target.parentNode;
|
|
26469
|
-
}
|
|
26142
|
+
}
|
|
26470
26143
|
|
|
26471
26144
|
return true;
|
|
26472
26145
|
})()));
|
|
@@ -26478,55 +26151,72 @@ define("@ember/-internals/views/lib/system/event_dispatcher", ["exports", "@embe
|
|
|
26478
26151
|
|
|
26479
26152
|
for (var event in events) {
|
|
26480
26153
|
if (Object.prototype.hasOwnProperty.call(events, event)) {
|
|
26481
|
-
lazyEvents.set(event, events[event]);
|
|
26154
|
+
lazyEvents.set(event, (_a = events[event]) !== null && _a !== void 0 ? _a : null);
|
|
26482
26155
|
}
|
|
26483
26156
|
}
|
|
26484
26157
|
|
|
26485
26158
|
this._didSetup = true;
|
|
26486
|
-
}
|
|
26487
|
-
|
|
26159
|
+
}
|
|
26488
26160
|
/**
|
|
26489
26161
|
Setup event listeners for the given browser event name
|
|
26490
|
-
|
|
26162
|
+
@private
|
|
26491
26163
|
@method setupHandlerForBrowserEvent
|
|
26492
26164
|
@param event the name of the event in the browser
|
|
26493
26165
|
*/
|
|
26166
|
+
|
|
26167
|
+
|
|
26494
26168
|
setupHandlerForBrowserEvent(event) {
|
|
26495
|
-
|
|
26496
|
-
},
|
|
26169
|
+
var _a;
|
|
26497
26170
|
|
|
26171
|
+
(true && !(this.finalEventNameMapping) && (0, _debug.assert)('[BUG] Expected finalEventNameMapping to be set', this.finalEventNameMapping));
|
|
26172
|
+
(true && !(this._sanitizedRootElement) && (0, _debug.assert)('[BUG] Expected _santizedRootElement to be set', this._sanitizedRootElement));
|
|
26173
|
+
this.setupHandler(this._sanitizedRootElement, event, (_a = this.finalEventNameMapping[event]) !== null && _a !== void 0 ? _a : null);
|
|
26174
|
+
}
|
|
26498
26175
|
/**
|
|
26499
26176
|
Setup event listeners for the given Ember event name (camel case)
|
|
26500
|
-
|
|
26177
|
+
@private
|
|
26501
26178
|
@method setupHandlerForEmberEvent
|
|
26502
26179
|
@param eventName
|
|
26503
26180
|
*/
|
|
26181
|
+
|
|
26182
|
+
|
|
26504
26183
|
setupHandlerForEmberEvent(eventName) {
|
|
26505
|
-
|
|
26506
|
-
},
|
|
26184
|
+
var _a;
|
|
26507
26185
|
|
|
26186
|
+
(true && !(this._sanitizedRootElement) && (0, _debug.assert)('[BUG] Expected _sanitizedRootElement to be set', this._sanitizedRootElement));
|
|
26187
|
+
var event = (_a = this._reverseEventNameMapping) === null || _a === void 0 ? void 0 : _a[eventName];
|
|
26188
|
+
|
|
26189
|
+
if (event) {
|
|
26190
|
+
this.setupHandler(this._sanitizedRootElement, event, eventName);
|
|
26191
|
+
}
|
|
26192
|
+
}
|
|
26508
26193
|
/**
|
|
26509
26194
|
Registers an event listener on the rootElement. If the given event is
|
|
26510
26195
|
triggered, the provided event handler will be triggered on the target view.
|
|
26511
|
-
|
|
26196
|
+
If the target view does not implement the event handler, or if the handler
|
|
26512
26197
|
returns `false`, the parent view will be called. The event will continue to
|
|
26513
26198
|
bubble to each successive parent view until it reaches the top.
|
|
26514
|
-
|
|
26199
|
+
@private
|
|
26515
26200
|
@method setupHandler
|
|
26516
26201
|
@param {Element} rootElement
|
|
26517
26202
|
@param {String} event the name of the event in the browser
|
|
26518
26203
|
@param {String} eventName the name of the method to call on the view
|
|
26519
26204
|
*/
|
|
26205
|
+
|
|
26206
|
+
|
|
26520
26207
|
setupHandler(rootElement, event, eventName) {
|
|
26521
26208
|
if (eventName === null || !this.lazyEvents.has(event)) {
|
|
26522
26209
|
return; // nothing to do
|
|
26523
26210
|
}
|
|
26524
26211
|
|
|
26525
26212
|
var viewHandler = (target, event) => {
|
|
26213
|
+
// SAFETY: SimpleElement is supposed to be a subset of Element so this _should_ be safe.
|
|
26214
|
+
// However, the types are more specific in some places which necessitates the `as`.
|
|
26526
26215
|
var view = (0, _views.getElementView)(target);
|
|
26527
26216
|
var result = true;
|
|
26528
26217
|
|
|
26529
26218
|
if (view) {
|
|
26219
|
+
// SAFETY: As currently written, this is not safe. Though it seems to always be true.
|
|
26530
26220
|
result = view.handleEvent(eventName, event);
|
|
26531
26221
|
}
|
|
26532
26222
|
|
|
@@ -26535,41 +26225,48 @@ define("@ember/-internals/views/lib/system/event_dispatcher", ["exports", "@embe
|
|
|
26535
26225
|
|
|
26536
26226
|
var actionHandler = (target, event) => {
|
|
26537
26227
|
var actionId = target.getAttribute('data-ember-action');
|
|
26538
|
-
var actions
|
|
26228
|
+
var actions; // In Glimmer2 this attribute is set to an empty string and an additional
|
|
26539
26229
|
// attribute it set for each action on a given element. In this case, the
|
|
26540
26230
|
// attributes need to be read so that a proper set of action handlers can
|
|
26541
26231
|
// be coalesced.
|
|
26542
26232
|
|
|
26543
26233
|
if (actionId === '') {
|
|
26544
|
-
var attributes = target.attributes;
|
|
26545
|
-
var attributeCount = attributes.length;
|
|
26546
26234
|
actions = [];
|
|
26547
26235
|
|
|
26548
|
-
for (var
|
|
26549
|
-
var attr = attributes.item(i);
|
|
26236
|
+
for (var attr of target.attributes) {
|
|
26550
26237
|
var attrName = attr.name;
|
|
26551
26238
|
|
|
26552
26239
|
if (attrName.indexOf('data-ember-action-') === 0) {
|
|
26553
|
-
|
|
26240
|
+
var action = _action_manager.default.registeredActions[attr.value];
|
|
26241
|
+
(true && !(action) && (0, _debug.assert)('[BUG] Missing action', action));
|
|
26242
|
+
actions.push(action);
|
|
26554
26243
|
}
|
|
26555
26244
|
}
|
|
26245
|
+
} else if (actionId) {
|
|
26246
|
+
// FIXME: This branch is never called in tests. Improve tests or remove
|
|
26247
|
+
var actionState = _action_manager.default.registeredActions[actionId];
|
|
26248
|
+
|
|
26249
|
+
if (actionState) {
|
|
26250
|
+
actions = [actionState];
|
|
26251
|
+
}
|
|
26556
26252
|
} // We have to check for actions here since in some cases, jQuery will trigger
|
|
26557
26253
|
// an event on `removeChild` (i.e. focusout) after we've already torn down the
|
|
26558
26254
|
// action handlers for the view.
|
|
26559
26255
|
|
|
26560
26256
|
|
|
26561
26257
|
if (!actions) {
|
|
26258
|
+
// FIXME: This branch is never called in tests. Improve tests or remove
|
|
26562
26259
|
return;
|
|
26563
26260
|
}
|
|
26564
26261
|
|
|
26565
26262
|
var result = true;
|
|
26566
26263
|
|
|
26567
26264
|
for (var index = 0; index < actions.length; index++) {
|
|
26568
|
-
var
|
|
26265
|
+
var _action = actions[index];
|
|
26569
26266
|
|
|
26570
|
-
if (
|
|
26267
|
+
if (_action && _action.eventName === eventName) {
|
|
26571
26268
|
// return false if any of the action handlers returns false
|
|
26572
|
-
result =
|
|
26269
|
+
result = _action.handler(event) && result;
|
|
26573
26270
|
}
|
|
26574
26271
|
}
|
|
26575
26272
|
|
|
@@ -26578,8 +26275,11 @@ define("@ember/-internals/views/lib/system/event_dispatcher", ["exports", "@embe
|
|
|
26578
26275
|
|
|
26579
26276
|
var handleEvent = this._eventHandlers[event] = event => {
|
|
26580
26277
|
var target = event.target;
|
|
26278
|
+
(true && !(target instanceof Element) && (0, _debug.assert)(`[BUG] Received event without an Element target: ${event.type}, ${target}`, target instanceof Element));
|
|
26581
26279
|
|
|
26582
26280
|
do {
|
|
26281
|
+
// SAFETY: SimpleElement is supposed to be a subset of Element so this _should_ be safe.
|
|
26282
|
+
// However, the types are more specific in some places which necessitates the `as`.
|
|
26583
26283
|
if ((0, _views.getElementView)(target)) {
|
|
26584
26284
|
if (viewHandler(target, event) === false) {
|
|
26585
26285
|
event.preventDefault();
|
|
@@ -26595,26 +26295,19 @@ define("@ember/-internals/views/lib/system/event_dispatcher", ["exports", "@embe
|
|
|
26595
26295
|
}
|
|
26596
26296
|
|
|
26597
26297
|
target = target.parentNode;
|
|
26598
|
-
} while (target
|
|
26298
|
+
} while (target instanceof Element);
|
|
26599
26299
|
};
|
|
26600
26300
|
|
|
26601
26301
|
rootElement.addEventListener(event, handleEvent);
|
|
26602
26302
|
this.lazyEvents.delete(event);
|
|
26603
|
-
}
|
|
26303
|
+
}
|
|
26604
26304
|
|
|
26605
26305
|
destroy() {
|
|
26606
26306
|
if (this._didSetup === false) {
|
|
26607
26307
|
return;
|
|
26608
26308
|
}
|
|
26609
26309
|
|
|
26610
|
-
var
|
|
26611
|
-
var rootElement;
|
|
26612
|
-
|
|
26613
|
-
if (rootElementSelector.nodeType) {
|
|
26614
|
-
rootElement = rootElementSelector;
|
|
26615
|
-
} else {
|
|
26616
|
-
rootElement = document.querySelector(rootElementSelector);
|
|
26617
|
-
}
|
|
26310
|
+
var rootElement = this._sanitizedRootElement;
|
|
26618
26311
|
|
|
26619
26312
|
if (!rootElement) {
|
|
26620
26313
|
return;
|
|
@@ -26626,15 +26319,15 @@ define("@ember/-internals/views/lib/system/event_dispatcher", ["exports", "@embe
|
|
|
26626
26319
|
|
|
26627
26320
|
rootElement.classList.remove(ROOT_ELEMENT_CLASS);
|
|
26628
26321
|
return this._super(...arguments);
|
|
26629
|
-
}
|
|
26322
|
+
}
|
|
26630
26323
|
|
|
26631
26324
|
toString() {
|
|
26632
26325
|
return '(EventDispatcher)';
|
|
26633
26326
|
}
|
|
26634
26327
|
|
|
26635
|
-
}
|
|
26328
|
+
}
|
|
26636
26329
|
|
|
26637
|
-
_exports.default =
|
|
26330
|
+
_exports.default = EventDispatcher;
|
|
26638
26331
|
});
|
|
26639
26332
|
define("@ember/-internals/views/lib/system/utils", ["exports", "@ember/-internals/owner", "@ember/-internals/utils", "@ember/debug"], function (_exports, _owner, _utils, _debug) {
|
|
26640
26333
|
"use strict";
|
|
@@ -26867,7 +26560,7 @@ define("@ember/-internals/views/lib/system/utils", ["exports", "@ember/-internal
|
|
|
26867
26560
|
*/
|
|
26868
26561
|
|
|
26869
26562
|
|
|
26870
|
-
var elMatches = typeof Element !== 'undefined' ? Element.prototype.matches
|
|
26563
|
+
var elMatches = typeof Element !== 'undefined' ? Element.prototype.matches : undefined;
|
|
26871
26564
|
_exports.elMatches = elMatches;
|
|
26872
26565
|
|
|
26873
26566
|
function matches(el, selector) {
|
|
@@ -27045,7 +26738,7 @@ define("@ember/-internals/views/lib/views/states/destroying", ["exports", "@embe
|
|
|
27045
26738
|
value: true
|
|
27046
26739
|
});
|
|
27047
26740
|
_exports.default = void 0;
|
|
27048
|
-
var destroying = Object.assign({}, _default3.default, {
|
|
26741
|
+
var destroying = Object.assign(Object.assign({}, _default3.default), {
|
|
27049
26742
|
appendChild() {
|
|
27050
26743
|
throw new _error.default("You can't call appendChild on a view being destroyed");
|
|
27051
26744
|
},
|
|
@@ -27067,9 +26760,9 @@ define("@ember/-internals/views/lib/views/states/has_element", ["exports", "@emb
|
|
|
27067
26760
|
value: true
|
|
27068
26761
|
});
|
|
27069
26762
|
_exports.default = void 0;
|
|
27070
|
-
var hasElement = Object.assign({}, _default3.default, {
|
|
26763
|
+
var hasElement = Object.assign(Object.assign({}, _default3.default), {
|
|
27071
26764
|
rerender(view) {
|
|
27072
|
-
view.renderer.rerender(
|
|
26765
|
+
view.renderer.rerender();
|
|
27073
26766
|
},
|
|
27074
26767
|
|
|
27075
26768
|
destroy(view) {
|
|
@@ -27098,14 +26791,14 @@ define("@ember/-internals/views/lib/views/states/has_element", ["exports", "@emb
|
|
|
27098
26791
|
|
|
27099
26792
|
_exports.default = _default2;
|
|
27100
26793
|
});
|
|
27101
|
-
define("@ember/-internals/views/lib/views/states/in_dom", ["exports", "@ember/-internals/utils", "@ember/error", "@ember/-internals/views/lib/views/states/has_element"], function (_exports, _utils, _error, _has_element) {
|
|
26794
|
+
define("@ember/-internals/views/lib/views/states/in_dom", ["exports", "@ember/-internals/utils", "@ember/debug", "@ember/error", "@ember/-internals/views/lib/views/states/has_element"], function (_exports, _utils, _debug, _error, _has_element) {
|
|
27102
26795
|
"use strict";
|
|
27103
26796
|
|
|
27104
26797
|
Object.defineProperty(_exports, "__esModule", {
|
|
27105
26798
|
value: true
|
|
27106
26799
|
});
|
|
27107
26800
|
_exports.default = void 0;
|
|
27108
|
-
var inDOM = Object.assign({}, _has_element.default, {
|
|
26801
|
+
var inDOM = Object.assign(Object.assign({}, _has_element.default), {
|
|
27109
26802
|
enter(view) {
|
|
27110
26803
|
// Register the view for event handling. This hash is used by
|
|
27111
26804
|
// Ember.EventDispatcher to dispatch incoming events.
|
|
@@ -27115,6 +26808,7 @@ define("@ember/-internals/views/lib/views/states/in_dom", ["exports", "@ember/-i
|
|
|
27115
26808
|
/* DEBUG */
|
|
27116
26809
|
) {
|
|
27117
26810
|
var elementId = view.elementId;
|
|
26811
|
+
(true && !(_utils.teardownMandatorySetter) && (0, _debug.assert)('[BUG] Expected teardownMandatorySetter to be set in DEBUG mode', teardownMandatorySetter));
|
|
27118
26812
|
(0, _utils.teardownMandatorySetter)(view, 'elementId');
|
|
27119
26813
|
Object.defineProperty(view, 'elementId', {
|
|
27120
26814
|
configurable: true,
|
|
@@ -27383,6 +27077,7 @@ define("@ember/application/instance", ["exports", "@ember/-internals/metal", "@e
|
|
|
27383
27077
|
var applicationCustomEvents = (0, _metal.get)(this.application, 'customEvents');
|
|
27384
27078
|
var instanceCustomEvents = (0, _metal.get)(this, 'customEvents');
|
|
27385
27079
|
var customEvents = Object.assign({}, applicationCustomEvents, instanceCustomEvents);
|
|
27080
|
+
(true && !(this.rootElement === null || typeof this.rootElement === 'string' || this.rootElement instanceof Element) && (0, _debug.assert)('[BUG] Tried to set up dispatcher with an invalid root element', this.rootElement === null || typeof this.rootElement === 'string' || this.rootElement instanceof Element));
|
|
27386
27081
|
dispatcher.setup(customEvents, this.rootElement);
|
|
27387
27082
|
return dispatcher;
|
|
27388
27083
|
}
|
|
@@ -27915,11 +27610,20 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
27915
27610
|
|
|
27916
27611
|
|
|
27917
27612
|
waitForDOMReady() {
|
|
27918
|
-
var document = this._document;
|
|
27613
|
+
var document = this._document; // SAFETY: Casting as Document should be safe since we're just reading a property.
|
|
27614
|
+
// If it's not actually a Document then it will evaluate false which is fine for our
|
|
27615
|
+
// purposes.
|
|
27919
27616
|
|
|
27920
27617
|
if (document === null || document.readyState !== 'loading') {
|
|
27921
27618
|
(0, _runloop.schedule)('actions', this, this.domReady);
|
|
27922
27619
|
} else {
|
|
27620
|
+
// Ideally we'd just check `document instanceof Document` but currently some tests pass a fake document.
|
|
27621
|
+
(true && !(function (d) {
|
|
27622
|
+
return typeof d.removeEventListener === 'function';
|
|
27623
|
+
}(document)) && (0, _debug.assert)('[BUG] Called waitForDOMReady with an invalid document', function (d) {
|
|
27624
|
+
return typeof d.removeEventListener === 'function';
|
|
27625
|
+
}(document)));
|
|
27626
|
+
|
|
27923
27627
|
var callback = () => {
|
|
27924
27628
|
document.removeEventListener('DOMContentLoaded', callback);
|
|
27925
27629
|
(0, _runloop.run)(this, this.domReady);
|
|
@@ -28606,7 +28310,7 @@ define("@ember/canary-features/index", ["exports", "@ember/-internals/environmen
|
|
|
28606
28310
|
Object.defineProperty(_exports, "__esModule", {
|
|
28607
28311
|
value: true
|
|
28608
28312
|
});
|
|
28609
|
-
_exports.FEATURES = _exports.EMBER_UNIQUE_ID_HELPER = _exports.EMBER_LIBRARIES_ISREGISTERED = _exports.EMBER_IMPROVED_INSTRUMENTATION = _exports.DEFAULT_FEATURES = void 0;
|
|
28313
|
+
_exports.FEATURES = _exports.EMBER_UNIQUE_ID_HELPER = _exports.EMBER_LIBRARIES_ISREGISTERED = _exports.EMBER_IMPROVED_INSTRUMENTATION = _exports.EMBER_DEFAULT_HELPER_MANAGER = _exports.DEFAULT_FEATURES = void 0;
|
|
28610
28314
|
_exports.isEnabled = isEnabled;
|
|
28611
28315
|
|
|
28612
28316
|
/**
|
|
@@ -28622,7 +28326,8 @@ define("@ember/canary-features/index", ["exports", "@ember/-internals/environmen
|
|
|
28622
28326
|
var DEFAULT_FEATURES = {
|
|
28623
28327
|
EMBER_LIBRARIES_ISREGISTERED: null,
|
|
28624
28328
|
EMBER_IMPROVED_INSTRUMENTATION: null,
|
|
28625
|
-
EMBER_UNIQUE_ID_HELPER: true
|
|
28329
|
+
EMBER_UNIQUE_ID_HELPER: true,
|
|
28330
|
+
EMBER_DEFAULT_HELPER_MANAGER: true
|
|
28626
28331
|
};
|
|
28627
28332
|
/**
|
|
28628
28333
|
The hash of enabled Canary features. Add to this, any canary features
|
|
@@ -28680,6 +28385,8 @@ define("@ember/canary-features/index", ["exports", "@ember/-internals/environmen
|
|
|
28680
28385
|
_exports.EMBER_IMPROVED_INSTRUMENTATION = EMBER_IMPROVED_INSTRUMENTATION;
|
|
28681
28386
|
var EMBER_UNIQUE_ID_HELPER = featureValue(FEATURES.EMBER_UNIQUE_ID_HELPER);
|
|
28682
28387
|
_exports.EMBER_UNIQUE_ID_HELPER = EMBER_UNIQUE_ID_HELPER;
|
|
28388
|
+
var EMBER_DEFAULT_HELPER_MANAGER = featureValue(FEATURES.EMBER_DEFAULT_HELPER_MANAGER);
|
|
28389
|
+
_exports.EMBER_DEFAULT_HELPER_MANAGER = EMBER_DEFAULT_HELPER_MANAGER;
|
|
28683
28390
|
});
|
|
28684
28391
|
define("@ember/component/helper", ["exports", "@ember/-internals/glimmer"], function (_exports, _glimmer) {
|
|
28685
28392
|
"use strict";
|
|
@@ -30573,19 +30280,16 @@ define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@embe
|
|
|
30573
30280
|
var _default = EngineInstance;
|
|
30574
30281
|
_exports.default = _default;
|
|
30575
30282
|
});
|
|
30576
|
-
define("@ember/engine/lib/engine-parent", ["exports"
|
|
30283
|
+
define("@ember/engine/lib/engine-parent", ["exports"], function (_exports) {
|
|
30577
30284
|
"use strict";
|
|
30578
30285
|
|
|
30579
30286
|
Object.defineProperty(_exports, "__esModule", {
|
|
30580
30287
|
value: true
|
|
30581
30288
|
});
|
|
30289
|
+
_exports.ENGINE_PARENT = void 0;
|
|
30582
30290
|
_exports.getEngineParent = getEngineParent;
|
|
30583
30291
|
_exports.setEngineParent = setEngineParent;
|
|
30584
|
-
|
|
30585
|
-
/**
|
|
30586
|
-
@module @ember/engine
|
|
30587
|
-
*/
|
|
30588
|
-
var ENGINE_PARENT = (0, _utils.symbol)('ENGINE_PARENT');
|
|
30292
|
+
var ENGINE_PARENT = Symbol('ENGINE_PARENT');
|
|
30589
30293
|
/**
|
|
30590
30294
|
`getEngineParent` retrieves an engine instance's parent instance.
|
|
30591
30295
|
|
|
@@ -30597,6 +30301,8 @@ define("@ember/engine/lib/engine-parent", ["exports", "@ember/-internals/utils"]
|
|
|
30597
30301
|
@private
|
|
30598
30302
|
*/
|
|
30599
30303
|
|
|
30304
|
+
_exports.ENGINE_PARENT = ENGINE_PARENT;
|
|
30305
|
+
|
|
30600
30306
|
function getEngineParent(engine) {
|
|
30601
30307
|
return engine[ENGINE_PARENT];
|
|
30602
30308
|
}
|
|
@@ -33670,6 +33376,19 @@ define("@ember/polyfills/lib/assign", ["exports", "@ember/debug"], function (_ex
|
|
|
33670
33376
|
return Object.assign(target, ...rest);
|
|
33671
33377
|
}
|
|
33672
33378
|
});
|
|
33379
|
+
define("@ember/renderer/index", ["exports", "@ember/-internals/glimmer"], function (_exports, _glimmer) {
|
|
33380
|
+
"use strict";
|
|
33381
|
+
|
|
33382
|
+
Object.defineProperty(_exports, "__esModule", {
|
|
33383
|
+
value: true
|
|
33384
|
+
});
|
|
33385
|
+
Object.defineProperty(_exports, "renderSettled", {
|
|
33386
|
+
enumerable: true,
|
|
33387
|
+
get: function () {
|
|
33388
|
+
return _glimmer.renderSettled;
|
|
33389
|
+
}
|
|
33390
|
+
});
|
|
33391
|
+
});
|
|
33673
33392
|
define("@ember/routing/auto-location", ["exports", "@ember/-internals/routing"], function (_exports, _routing) {
|
|
33674
33393
|
"use strict";
|
|
33675
33394
|
|
|
@@ -35417,7 +35136,7 @@ define("@glimmer/global-context", ["exports"], function (_exports) {
|
|
|
35417
35136
|
Object.defineProperty(_exports, "__esModule", {
|
|
35418
35137
|
value: true
|
|
35419
35138
|
});
|
|
35420
|
-
_exports.warnIfStyleNotTrusted = _exports.toIterator = _exports.toBool = _exports.testOverrideGlobalContext = _exports.setProp = _exports.setPath = _exports.scheduleRevalidate = _exports.scheduleDestroyed = _exports.scheduleDestroy = _exports.getProp = _exports.getPath = _exports.deprecate = _exports.default = _exports.assertGlobalContextWasSet = _exports.assert = void 0;
|
|
35139
|
+
_exports.warnIfStyleNotTrusted = _exports.toIterator = _exports.toBool = _exports.testOverrideGlobalContext = _exports.setProp = _exports.setPath = _exports.scheduleRevalidate = _exports.scheduleDestroyed = _exports.scheduleDestroy = _exports.getProp = _exports.getPath = _exports.deprecate = _exports.default = _exports.assertGlobalContextWasSet = _exports.assert = _exports.FEATURE_DEFAULT_HELPER_MANAGER = void 0;
|
|
35421
35140
|
|
|
35422
35141
|
/**
|
|
35423
35142
|
* This package contains global context functions for Glimmer. These functions
|
|
@@ -35433,12 +35152,16 @@ define("@glimmer/global-context", ["exports"], function (_exports) {
|
|
|
35433
35152
|
* - Never change over time
|
|
35434
35153
|
*
|
|
35435
35154
|
*/
|
|
35155
|
+
var FEATURE_DEFAULT_HELPER_MANAGER = true; //////////
|
|
35436
35156
|
|
|
35437
35157
|
/**
|
|
35438
35158
|
* Schedules a VM revalidation.
|
|
35439
35159
|
*
|
|
35440
35160
|
* Note: this has a default value so that tags can warm themselves when first loaded.
|
|
35441
35161
|
*/
|
|
35162
|
+
|
|
35163
|
+
_exports.FEATURE_DEFAULT_HELPER_MANAGER = FEATURE_DEFAULT_HELPER_MANAGER;
|
|
35164
|
+
|
|
35442
35165
|
var scheduleRevalidate = () => {};
|
|
35443
35166
|
/**
|
|
35444
35167
|
* Schedules a destructor to run
|
|
@@ -35540,6 +35263,8 @@ define("@glimmer/global-context", ["exports"], function (_exports) {
|
|
|
35540
35263
|
var globalContextWasSet = false;
|
|
35541
35264
|
|
|
35542
35265
|
function setGlobalContext(context) {
|
|
35266
|
+
var _a;
|
|
35267
|
+
|
|
35543
35268
|
if (true
|
|
35544
35269
|
/* DEBUG */
|
|
35545
35270
|
) {
|
|
@@ -35562,6 +35287,10 @@ define("@glimmer/global-context", ["exports"], function (_exports) {
|
|
|
35562
35287
|
_exports.warnIfStyleNotTrusted = warnIfStyleNotTrusted = context.warnIfStyleNotTrusted;
|
|
35563
35288
|
_exports.assert = assert = context.assert;
|
|
35564
35289
|
_exports.deprecate = deprecate = context.deprecate;
|
|
35290
|
+
|
|
35291
|
+
if (typeof ((_a = context.FEATURES) === null || _a === void 0 ? void 0 : _a.DEFAULT_HELPER_MANAGER) === 'boolean') {
|
|
35292
|
+
_exports.FEATURE_DEFAULT_HELPER_MANAGER = FEATURE_DEFAULT_HELPER_MANAGER = context.FEATURES.DEFAULT_HELPER_MANAGER;
|
|
35293
|
+
}
|
|
35565
35294
|
}
|
|
35566
35295
|
|
|
35567
35296
|
var assertGlobalContextWasSet;
|
|
@@ -35713,7 +35442,7 @@ define("@glimmer/low-level", ["exports"], function (_exports) {
|
|
|
35713
35442
|
|
|
35714
35443
|
_exports.Stack = Stack;
|
|
35715
35444
|
});
|
|
35716
|
-
define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@glimmer/validator", "@glimmer/destroyable"], function (_exports, _util, _reference, _validator, _destroyable) {
|
|
35445
|
+
define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@glimmer/validator", "@glimmer/destroyable", "@glimmer/global-context"], function (_exports, _util, _reference, _validator, _destroyable, _globalContext) {
|
|
35717
35446
|
"use strict";
|
|
35718
35447
|
|
|
35719
35448
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -35744,137 +35473,6 @@ define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
35744
35473
|
_exports.setInternalHelperManager = setInternalHelperManager;
|
|
35745
35474
|
_exports.setInternalModifierManager = setInternalModifierManager;
|
|
35746
35475
|
_exports.setModifierManager = setModifierManager;
|
|
35747
|
-
var COMPONENT_MANAGERS = new WeakMap();
|
|
35748
|
-
var MODIFIER_MANAGERS = new WeakMap();
|
|
35749
|
-
var HELPER_MANAGERS = new WeakMap(); ///////////
|
|
35750
|
-
|
|
35751
|
-
var getPrototypeOf = Object.getPrototypeOf;
|
|
35752
|
-
|
|
35753
|
-
function setManager(map, manager, obj) {
|
|
35754
|
-
if (true
|
|
35755
|
-
/* DEBUG */
|
|
35756
|
-
&& (typeof obj !== 'object' || obj === null) && typeof obj !== 'function') {
|
|
35757
|
-
throw new Error(`Attempted to set a manager on a non-object value. Managers can only be associated with objects or functions. Value was ${(0, _util.debugToString)(obj)}`);
|
|
35758
|
-
}
|
|
35759
|
-
|
|
35760
|
-
if (true
|
|
35761
|
-
/* DEBUG */
|
|
35762
|
-
&& map.has(obj)) {
|
|
35763
|
-
throw new Error(`Attempted to set the same type of manager multiple times on a value. You can only associate one manager of each type with a given value. Value was ${(0, _util.debugToString)(obj)}`);
|
|
35764
|
-
}
|
|
35765
|
-
|
|
35766
|
-
map.set(obj, manager);
|
|
35767
|
-
return obj;
|
|
35768
|
-
}
|
|
35769
|
-
|
|
35770
|
-
function getManager(map, obj) {
|
|
35771
|
-
var pointer = obj;
|
|
35772
|
-
|
|
35773
|
-
while (pointer !== undefined && pointer !== null) {
|
|
35774
|
-
var manager = map.get(pointer);
|
|
35775
|
-
|
|
35776
|
-
if (manager !== undefined) {
|
|
35777
|
-
return manager;
|
|
35778
|
-
}
|
|
35779
|
-
|
|
35780
|
-
pointer = getPrototypeOf(pointer);
|
|
35781
|
-
}
|
|
35782
|
-
|
|
35783
|
-
return undefined;
|
|
35784
|
-
} ///////////
|
|
35785
|
-
|
|
35786
|
-
|
|
35787
|
-
function setInternalModifierManager(manager, definition) {
|
|
35788
|
-
return setManager(MODIFIER_MANAGERS, manager, definition);
|
|
35789
|
-
}
|
|
35790
|
-
|
|
35791
|
-
function getInternalModifierManager(definition, isOptional) {
|
|
35792
|
-
if (true
|
|
35793
|
-
/* DEBUG */
|
|
35794
|
-
&& typeof definition !== 'function' && (typeof definition !== 'object' || definition === null)) {
|
|
35795
|
-
throw new Error(`Attempted to use a value as a modifier, but it was not an object or function. Modifier definitions must be objects or functions with an associated modifier manager. The value was: ${definition}`);
|
|
35796
|
-
}
|
|
35797
|
-
|
|
35798
|
-
var manager = getManager(MODIFIER_MANAGERS, definition);
|
|
35799
|
-
|
|
35800
|
-
if (manager === undefined) {
|
|
35801
|
-
if (isOptional === true) {
|
|
35802
|
-
return null;
|
|
35803
|
-
} else if (true
|
|
35804
|
-
/* DEBUG */
|
|
35805
|
-
) {
|
|
35806
|
-
throw new Error(`Attempted to load a modifier, but there wasn't a modifier manager associated with the definition. The definition was: ${(0, _util.debugToString)(definition)}`);
|
|
35807
|
-
}
|
|
35808
|
-
}
|
|
35809
|
-
|
|
35810
|
-
return manager;
|
|
35811
|
-
}
|
|
35812
|
-
|
|
35813
|
-
function setInternalHelperManager(manager, definition) {
|
|
35814
|
-
return setManager(HELPER_MANAGERS, manager, definition);
|
|
35815
|
-
}
|
|
35816
|
-
|
|
35817
|
-
function getInternalHelperManager(definition, isOptional) {
|
|
35818
|
-
if (true
|
|
35819
|
-
/* DEBUG */
|
|
35820
|
-
&& typeof definition !== 'function' && (typeof definition !== 'object' || definition === null)) {
|
|
35821
|
-
throw new Error(`Attempted to use a value as a helper, but it was not an object or function. Helper definitions must be objects or functions with an associated helper manager. The value was: ${definition}`);
|
|
35822
|
-
}
|
|
35823
|
-
|
|
35824
|
-
var manager = getManager(HELPER_MANAGERS, definition);
|
|
35825
|
-
|
|
35826
|
-
if (manager === undefined) {
|
|
35827
|
-
if (isOptional === true) {
|
|
35828
|
-
return null;
|
|
35829
|
-
} else if (true
|
|
35830
|
-
/* DEBUG */
|
|
35831
|
-
) {
|
|
35832
|
-
throw new Error(`Attempted to load a helper, but there wasn't a helper manager associated with the definition. The definition was: ${(0, _util.debugToString)(definition)}`);
|
|
35833
|
-
}
|
|
35834
|
-
}
|
|
35835
|
-
|
|
35836
|
-
return manager;
|
|
35837
|
-
}
|
|
35838
|
-
|
|
35839
|
-
function setInternalComponentManager(factory, obj) {
|
|
35840
|
-
return setManager(COMPONENT_MANAGERS, factory, obj);
|
|
35841
|
-
}
|
|
35842
|
-
|
|
35843
|
-
function getInternalComponentManager(definition, isOptional) {
|
|
35844
|
-
if (true
|
|
35845
|
-
/* DEBUG */
|
|
35846
|
-
&& typeof definition !== 'function' && (typeof definition !== 'object' || definition === null)) {
|
|
35847
|
-
throw new Error(`Attempted to use a value as a component, but it was not an object or function. Component definitions must be objects or functions with an associated component manager. The value was: ${definition}`);
|
|
35848
|
-
}
|
|
35849
|
-
|
|
35850
|
-
var manager = getManager(COMPONENT_MANAGERS, definition);
|
|
35851
|
-
|
|
35852
|
-
if (manager === undefined) {
|
|
35853
|
-
if (isOptional === true) {
|
|
35854
|
-
return null;
|
|
35855
|
-
} else if (true
|
|
35856
|
-
/* DEBUG */
|
|
35857
|
-
) {
|
|
35858
|
-
throw new Error(`Attempted to load a component, but there wasn't a component manager associated with the definition. The definition was: ${(0, _util.debugToString)(definition)}`);
|
|
35859
|
-
}
|
|
35860
|
-
}
|
|
35861
|
-
|
|
35862
|
-
return manager;
|
|
35863
|
-
} ///////////
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
function hasInternalComponentManager(definition) {
|
|
35867
|
-
return getManager(COMPONENT_MANAGERS, definition) !== undefined;
|
|
35868
|
-
}
|
|
35869
|
-
|
|
35870
|
-
function hasInternalHelperManager(definition) {
|
|
35871
|
-
return getManager(HELPER_MANAGERS, definition) !== undefined;
|
|
35872
|
-
}
|
|
35873
|
-
|
|
35874
|
-
function hasInternalModifierManager(definition) {
|
|
35875
|
-
return getManager(MODIFIER_MANAGERS, definition) !== undefined;
|
|
35876
|
-
}
|
|
35877
|
-
|
|
35878
35476
|
var FROM_CAPABILITIES = true
|
|
35879
35477
|
/* DEBUG */
|
|
35880
35478
|
? new _util._WeakSet() : undefined;
|
|
@@ -36069,7 +35667,7 @@ define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
36069
35667
|
/* DEBUG */
|
|
36070
35668
|
) {
|
|
36071
35669
|
var setHandler = function (_target, prop) {
|
|
36072
|
-
throw new Error(`You attempted to set ${String(prop)} on the arguments of a component, helper, or modifier. Arguments are immutable and cannot be updated directly
|
|
35670
|
+
throw new Error(`You attempted to set ${String(prop)} on the arguments of a component, helper, or modifier. Arguments are immutable and cannot be updated directly; they always represent the values that are passed down. If you want to set default values, you should use a getter and local tracked state instead.`);
|
|
36073
35671
|
};
|
|
36074
35672
|
|
|
36075
35673
|
var forInDebugHandler = () => {
|
|
@@ -36145,94 +35743,55 @@ define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
36145
35743
|
};
|
|
36146
35744
|
}
|
|
36147
35745
|
|
|
36148
|
-
|
|
36149
|
-
dynamicLayout: false,
|
|
36150
|
-
dynamicTag: false,
|
|
36151
|
-
prepareArgs: false,
|
|
36152
|
-
createArgs: true,
|
|
36153
|
-
attributeHook: false,
|
|
36154
|
-
elementHook: false,
|
|
36155
|
-
createCaller: false,
|
|
36156
|
-
dynamicScope: true,
|
|
36157
|
-
updateHook: true,
|
|
36158
|
-
createInstance: true,
|
|
36159
|
-
wrapped: false,
|
|
36160
|
-
willDestroy: false,
|
|
36161
|
-
hasSubOwner: false
|
|
36162
|
-
};
|
|
36163
|
-
|
|
36164
|
-
function componentCapabilities(managerAPI, options) {
|
|
35746
|
+
function helperCapabilities(managerAPI, options) {
|
|
36165
35747
|
if (options === void 0) {
|
|
36166
35748
|
options = {};
|
|
36167
35749
|
}
|
|
36168
35750
|
|
|
36169
35751
|
if (true
|
|
36170
35752
|
/* DEBUG */
|
|
36171
|
-
&& managerAPI !== '3.
|
|
36172
|
-
throw new Error('Invalid
|
|
35753
|
+
&& managerAPI !== '3.23') {
|
|
35754
|
+
throw new Error('Invalid helper manager compatibility specified');
|
|
35755
|
+
}
|
|
35756
|
+
|
|
35757
|
+
if (true
|
|
35758
|
+
/* DEBUG */
|
|
35759
|
+
&& (!(options.hasValue || options.hasScheduledEffect) || options.hasValue && options.hasScheduledEffect)) {
|
|
35760
|
+
throw new Error('You must pass either the `hasValue` OR the `hasScheduledEffect` capability when defining a helper manager. Passing neither, or both, is not permitted.');
|
|
35761
|
+
}
|
|
35762
|
+
|
|
35763
|
+
if (true
|
|
35764
|
+
/* DEBUG */
|
|
35765
|
+
&& options.hasScheduledEffect) {
|
|
35766
|
+
throw new Error('The `hasScheduledEffect` capability has not yet been implemented for helper managers. Please pass `hasValue` instead');
|
|
36173
35767
|
}
|
|
36174
35768
|
|
|
36175
|
-
var updateHook = Boolean(options.updateHook);
|
|
36176
35769
|
return buildCapabilities({
|
|
36177
|
-
|
|
36178
|
-
|
|
36179
|
-
|
|
35770
|
+
hasValue: Boolean(options.hasValue),
|
|
35771
|
+
hasDestroyable: Boolean(options.hasDestroyable),
|
|
35772
|
+
hasScheduledEffect: Boolean(options.hasScheduledEffect)
|
|
36180
35773
|
});
|
|
36181
|
-
}
|
|
36182
|
-
|
|
36183
|
-
function hasAsyncLifeCycleCallbacks(delegate) {
|
|
36184
|
-
return delegate.capabilities.asyncLifeCycleCallbacks;
|
|
36185
|
-
}
|
|
35774
|
+
} ////////////
|
|
36186
35775
|
|
|
36187
|
-
function hasUpdateHook(delegate) {
|
|
36188
|
-
return delegate.capabilities.updateHook;
|
|
36189
|
-
}
|
|
36190
35776
|
|
|
36191
|
-
function
|
|
36192
|
-
return
|
|
35777
|
+
function hasValue(manager) {
|
|
35778
|
+
return manager.capabilities.hasValue;
|
|
36193
35779
|
}
|
|
36194
35780
|
|
|
36195
|
-
function
|
|
36196
|
-
return
|
|
36197
|
-
}
|
|
36198
|
-
/**
|
|
36199
|
-
The CustomComponentManager allows addons to provide custom component
|
|
36200
|
-
implementations that integrate seamlessly into Ember. This is accomplished
|
|
36201
|
-
through a delegate, registered with the custom component manager, which
|
|
36202
|
-
implements a set of hooks that determine component behavior.
|
|
36203
|
-
|
|
36204
|
-
To create a custom component manager, instantiate a new CustomComponentManager
|
|
36205
|
-
class and pass the delegate as the first argument:
|
|
36206
|
-
|
|
36207
|
-
```js
|
|
36208
|
-
let manager = new CustomComponentManager({
|
|
36209
|
-
// ...delegate implementation...
|
|
36210
|
-
});
|
|
36211
|
-
```
|
|
36212
|
-
|
|
36213
|
-
## Delegate Hooks
|
|
36214
|
-
|
|
36215
|
-
Throughout the lifecycle of a component, the component manager will invoke
|
|
36216
|
-
delegate hooks that are responsible for surfacing those lifecycle changes to
|
|
36217
|
-
the end developer.
|
|
36218
|
-
|
|
36219
|
-
* `create()` - invoked when a new instance of a component should be created
|
|
36220
|
-
* `update()` - invoked when the arguments passed to a component change
|
|
36221
|
-
* `getContext()` - returns the object that should be
|
|
36222
|
-
*/
|
|
35781
|
+
function hasDestroyable(manager) {
|
|
35782
|
+
return manager.capabilities.hasDestroyable;
|
|
35783
|
+
} ////////////
|
|
36223
35784
|
|
|
36224
35785
|
|
|
36225
|
-
class
|
|
35786
|
+
class CustomHelperManager {
|
|
36226
35787
|
constructor(factory) {
|
|
36227
35788
|
this.factory = factory;
|
|
36228
|
-
this.
|
|
35789
|
+
this.helperManagerDelegates = new WeakMap();
|
|
35790
|
+
this.undefinedDelegate = null;
|
|
36229
35791
|
}
|
|
36230
35792
|
|
|
36231
|
-
|
|
36232
|
-
var
|
|
36233
|
-
componentManagerDelegates
|
|
36234
|
-
} = this;
|
|
36235
|
-
var delegate = componentManagerDelegates.get(owner);
|
|
35793
|
+
getDelegateForOwner(owner) {
|
|
35794
|
+
var delegate = this.helperManagerDelegates.get(owner);
|
|
36236
35795
|
|
|
36237
35796
|
if (delegate === undefined) {
|
|
36238
35797
|
var {
|
|
@@ -36244,153 +35803,343 @@ define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
36244
35803
|
/* DEBUG */
|
|
36245
35804
|
&& !FROM_CAPABILITIES.has(delegate.capabilities)) {
|
|
36246
35805
|
// TODO: This error message should make sense in both Ember and Glimmer https://github.com/glimmerjs/glimmer-vm/issues/1200
|
|
36247
|
-
throw new Error(`Custom
|
|
35806
|
+
throw new Error(`Custom helper managers must have a \`capabilities\` property that is the result of calling the \`capabilities('3.23')\` (imported via \`import { capabilities } from '@ember/helper';\`). Received: \`${JSON.stringify(delegate.capabilities)}\` for: \`${delegate}\``);
|
|
36248
35807
|
}
|
|
36249
35808
|
|
|
36250
|
-
|
|
35809
|
+
this.helperManagerDelegates.set(owner, delegate);
|
|
36251
35810
|
}
|
|
36252
35811
|
|
|
36253
35812
|
return delegate;
|
|
36254
35813
|
}
|
|
36255
35814
|
|
|
36256
|
-
|
|
36257
|
-
|
|
36258
|
-
|
|
36259
|
-
|
|
36260
|
-
|
|
35815
|
+
getDelegateFor(owner) {
|
|
35816
|
+
if (owner === undefined) {
|
|
35817
|
+
var {
|
|
35818
|
+
undefinedDelegate
|
|
35819
|
+
} = this;
|
|
35820
|
+
|
|
35821
|
+
if (undefinedDelegate === null) {
|
|
35822
|
+
var {
|
|
35823
|
+
factory
|
|
35824
|
+
} = this;
|
|
35825
|
+
this.undefinedDelegate = undefinedDelegate = factory(undefined);
|
|
35826
|
+
}
|
|
35827
|
+
|
|
35828
|
+
return undefinedDelegate;
|
|
35829
|
+
} else {
|
|
35830
|
+
return this.getDelegateForOwner(owner);
|
|
35831
|
+
}
|
|
36261
35832
|
}
|
|
36262
35833
|
|
|
36263
|
-
|
|
36264
|
-
return
|
|
35834
|
+
getHelper(definition) {
|
|
35835
|
+
return (capturedArgs, owner) => {
|
|
35836
|
+
var _a, _b;
|
|
35837
|
+
|
|
35838
|
+
var manager = this.getDelegateFor(owner);
|
|
35839
|
+
var args = argsProxyFor(capturedArgs, 'helper');
|
|
35840
|
+
var bucket = manager.createHelper(definition, args);
|
|
35841
|
+
|
|
35842
|
+
if (hasValue(manager)) {
|
|
35843
|
+
var cache = (0, _reference.createComputeRef)(() => manager.getValue(bucket), null, true
|
|
35844
|
+
/* DEBUG */
|
|
35845
|
+
&& manager.getDebugName && manager.getDebugName(definition));
|
|
35846
|
+
|
|
35847
|
+
if (hasDestroyable(manager)) {
|
|
35848
|
+
(0, _destroyable.associateDestroyableChild)(cache, manager.getDestroyable(bucket));
|
|
35849
|
+
}
|
|
35850
|
+
|
|
35851
|
+
return cache;
|
|
35852
|
+
} else if (hasDestroyable(manager)) {
|
|
35853
|
+
var ref = (0, _reference.createConstRef)(undefined, true
|
|
35854
|
+
/* DEBUG */
|
|
35855
|
+
&& ((_b = (_a = manager.getDebugName) === null || _a === void 0 ? void 0 : _a.call(manager, definition)) !== null && _b !== void 0 ? _b : 'unknown helper'));
|
|
35856
|
+
(0, _destroyable.associateDestroyableChild)(ref, manager.getDestroyable(bucket));
|
|
35857
|
+
return ref;
|
|
35858
|
+
} else {
|
|
35859
|
+
return _reference.UNDEFINED_REFERENCE;
|
|
35860
|
+
}
|
|
35861
|
+
};
|
|
36265
35862
|
}
|
|
36266
35863
|
|
|
36267
|
-
|
|
36268
|
-
var {
|
|
36269
|
-
delegate
|
|
36270
|
-
} = bucket;
|
|
35864
|
+
}
|
|
36271
35865
|
|
|
36272
|
-
|
|
36273
|
-
|
|
36274
|
-
|
|
36275
|
-
|
|
36276
|
-
|
|
36277
|
-
|
|
36278
|
-
|
|
35866
|
+
_exports.CustomHelperManager = CustomHelperManager;
|
|
35867
|
+
|
|
35868
|
+
class FunctionHelperManager {
|
|
35869
|
+
constructor() {
|
|
35870
|
+
this.capabilities = buildCapabilities({
|
|
35871
|
+
hasValue: true,
|
|
35872
|
+
hasDestroyable: false,
|
|
35873
|
+
hasScheduledEffect: false
|
|
35874
|
+
});
|
|
36279
35875
|
}
|
|
36280
35876
|
|
|
36281
|
-
|
|
35877
|
+
createHelper(fn, args) {
|
|
35878
|
+
return {
|
|
35879
|
+
fn,
|
|
35880
|
+
args
|
|
35881
|
+
};
|
|
35882
|
+
}
|
|
35883
|
+
|
|
35884
|
+
getValue(_ref) {
|
|
36282
35885
|
var {
|
|
36283
|
-
|
|
36284
|
-
|
|
35886
|
+
fn,
|
|
35887
|
+
args
|
|
36285
35888
|
} = _ref;
|
|
36286
35889
|
|
|
36287
|
-
if (
|
|
36288
|
-
|
|
35890
|
+
if (Object.keys(args.named).length > 0) {
|
|
35891
|
+
var argsForFn = [...args.positional, args.named];
|
|
35892
|
+
return fn(...argsForFn);
|
|
36289
35893
|
}
|
|
35894
|
+
|
|
35895
|
+
return fn(...args.positional);
|
|
36290
35896
|
}
|
|
36291
35897
|
|
|
36292
|
-
|
|
36293
|
-
|
|
36294
|
-
|
|
36295
|
-
|
|
36296
|
-
} = _ref2;
|
|
35898
|
+
getDebugName(fn) {
|
|
35899
|
+
if (fn.name) {
|
|
35900
|
+
return `(helper function ${fn.name})`;
|
|
35901
|
+
}
|
|
36297
35902
|
|
|
36298
|
-
|
|
36299
|
-
|
|
35903
|
+
return '(anonymous helper function)';
|
|
35904
|
+
}
|
|
35905
|
+
|
|
35906
|
+
}
|
|
35907
|
+
|
|
35908
|
+
var COMPONENT_MANAGERS = new WeakMap();
|
|
35909
|
+
var MODIFIER_MANAGERS = new WeakMap();
|
|
35910
|
+
var HELPER_MANAGERS = new WeakMap(); ///////////
|
|
35911
|
+
|
|
35912
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
35913
|
+
|
|
35914
|
+
function setManager(map, manager, obj) {
|
|
35915
|
+
if (true
|
|
35916
|
+
/* DEBUG */
|
|
35917
|
+
&& (typeof obj !== 'object' || obj === null) && typeof obj !== 'function') {
|
|
35918
|
+
throw new Error(`Attempted to set a manager on a non-object value. Managers can only be associated with objects or functions. Value was ${(0, _util.debugToString)(obj)}`);
|
|
35919
|
+
}
|
|
35920
|
+
|
|
35921
|
+
if (true
|
|
35922
|
+
/* DEBUG */
|
|
35923
|
+
&& map.has(obj)) {
|
|
35924
|
+
throw new Error(`Attempted to set the same type of manager multiple times on a value. You can only associate one manager of each type with a given value. Value was ${(0, _util.debugToString)(obj)}`);
|
|
35925
|
+
}
|
|
35926
|
+
|
|
35927
|
+
map.set(obj, manager);
|
|
35928
|
+
return obj;
|
|
35929
|
+
}
|
|
35930
|
+
|
|
35931
|
+
function getManager(map, obj) {
|
|
35932
|
+
var pointer = obj;
|
|
35933
|
+
|
|
35934
|
+
while (pointer !== undefined && pointer !== null) {
|
|
35935
|
+
var manager = map.get(pointer);
|
|
35936
|
+
|
|
35937
|
+
if (manager !== undefined) {
|
|
35938
|
+
return manager;
|
|
36300
35939
|
}
|
|
35940
|
+
|
|
35941
|
+
pointer = getPrototypeOf(pointer);
|
|
36301
35942
|
}
|
|
36302
35943
|
|
|
36303
|
-
|
|
35944
|
+
return undefined;
|
|
35945
|
+
} ///////////
|
|
36304
35946
|
|
|
36305
|
-
didUpdateLayout() {}
|
|
36306
35947
|
|
|
36307
|
-
|
|
36308
|
-
|
|
36309
|
-
|
|
36310
|
-
|
|
36311
|
-
|
|
36312
|
-
|
|
35948
|
+
function setInternalModifierManager(manager, definition) {
|
|
35949
|
+
return setManager(MODIFIER_MANAGERS, manager, definition);
|
|
35950
|
+
}
|
|
35951
|
+
|
|
35952
|
+
function getInternalModifierManager(definition, isOptional) {
|
|
35953
|
+
if (true
|
|
35954
|
+
/* DEBUG */
|
|
35955
|
+
&& typeof definition !== 'function' && (typeof definition !== 'object' || definition === null)) {
|
|
35956
|
+
throw new Error(`Attempted to use a value as a modifier, but it was not an object or function. Modifier definitions must be objects or functions with an associated modifier manager. The value was: ${definition}`);
|
|
36313
35957
|
}
|
|
36314
35958
|
|
|
36315
|
-
|
|
36316
|
-
var {
|
|
36317
|
-
delegate
|
|
36318
|
-
} = bucket;
|
|
35959
|
+
var manager = getManager(MODIFIER_MANAGERS, definition);
|
|
36319
35960
|
|
|
36320
|
-
|
|
36321
|
-
|
|
36322
|
-
|
|
36323
|
-
|
|
36324
|
-
|
|
36325
|
-
|
|
35961
|
+
if (manager === undefined) {
|
|
35962
|
+
if (isOptional === true) {
|
|
35963
|
+
return null;
|
|
35964
|
+
} else if (true
|
|
35965
|
+
/* DEBUG */
|
|
35966
|
+
) {
|
|
35967
|
+
throw new Error(`Attempted to load a modifier, but there wasn't a modifier manager associated with the definition. The definition was: ${(0, _util.debugToString)(definition)}`);
|
|
36326
35968
|
}
|
|
35969
|
+
}
|
|
35970
|
+
|
|
35971
|
+
return manager;
|
|
35972
|
+
}
|
|
35973
|
+
|
|
35974
|
+
function setInternalHelperManager(manager, definition) {
|
|
35975
|
+
return setManager(HELPER_MANAGERS, manager, definition);
|
|
35976
|
+
}
|
|
36327
35977
|
|
|
35978
|
+
var DEFAULT_MANAGER = new CustomHelperManager(() => new FunctionHelperManager());
|
|
35979
|
+
|
|
35980
|
+
function getInternalHelperManager(definition, isOptional) {
|
|
35981
|
+
if (true
|
|
35982
|
+
/* DEBUG */
|
|
35983
|
+
&& typeof definition !== 'function' && (typeof definition !== 'object' || definition === null)) {
|
|
35984
|
+
throw new Error(`Attempted to use a value as a helper, but it was not an object or function. Helper definitions must be objects or functions with an associated helper manager. The value was: ${definition}`);
|
|
35985
|
+
}
|
|
35986
|
+
|
|
35987
|
+
var manager = getManager(HELPER_MANAGERS, definition);
|
|
35988
|
+
|
|
35989
|
+
if (_globalContext.FEATURE_DEFAULT_HELPER_MANAGER) {
|
|
35990
|
+
// Functions are special-cased because functions are defined
|
|
35991
|
+
// as the "default" helper, per: https://github.com/emberjs/rfcs/pull/756
|
|
35992
|
+
if (manager === undefined && typeof definition === 'function') {
|
|
35993
|
+
manager = DEFAULT_MANAGER;
|
|
35994
|
+
}
|
|
35995
|
+
}
|
|
35996
|
+
|
|
35997
|
+
if (manager) {
|
|
35998
|
+
return manager;
|
|
35999
|
+
} else if (isOptional === true) {
|
|
36328
36000
|
return null;
|
|
36001
|
+
} else if (true
|
|
36002
|
+
/* DEBUG */
|
|
36003
|
+
) {
|
|
36004
|
+
throw new Error(`Attempted to load a helper, but there wasn't a helper manager associated with the definition. The definition was: ${(0, _util.debugToString)(definition)}`);
|
|
36329
36005
|
}
|
|
36330
36006
|
|
|
36331
|
-
|
|
36332
|
-
|
|
36007
|
+
return null;
|
|
36008
|
+
}
|
|
36009
|
+
|
|
36010
|
+
function setInternalComponentManager(factory, obj) {
|
|
36011
|
+
return setManager(COMPONENT_MANAGERS, factory, obj);
|
|
36012
|
+
}
|
|
36013
|
+
|
|
36014
|
+
function getInternalComponentManager(definition, isOptional) {
|
|
36015
|
+
if (true
|
|
36016
|
+
/* DEBUG */
|
|
36017
|
+
&& typeof definition !== 'function' && (typeof definition !== 'object' || definition === null)) {
|
|
36018
|
+
throw new Error(`Attempted to use a value as a component, but it was not an object or function. Component definitions must be objects or functions with an associated component manager. The value was: ${definition}`);
|
|
36333
36019
|
}
|
|
36334
36020
|
|
|
36021
|
+
var manager = getManager(COMPONENT_MANAGERS, definition);
|
|
36022
|
+
|
|
36023
|
+
if (manager === undefined) {
|
|
36024
|
+
if (isOptional === true) {
|
|
36025
|
+
return null;
|
|
36026
|
+
} else if (true
|
|
36027
|
+
/* DEBUG */
|
|
36028
|
+
) {
|
|
36029
|
+
throw new Error(`Attempted to load a component, but there wasn't a component manager associated with the definition. The definition was: ${(0, _util.debugToString)(definition)}`);
|
|
36030
|
+
}
|
|
36031
|
+
}
|
|
36032
|
+
|
|
36033
|
+
return manager;
|
|
36034
|
+
} ///////////
|
|
36035
|
+
|
|
36036
|
+
|
|
36037
|
+
function hasInternalComponentManager(definition) {
|
|
36038
|
+
return hasDefaultComponentManager(definition) || getManager(COMPONENT_MANAGERS, definition) !== undefined;
|
|
36335
36039
|
}
|
|
36336
|
-
/**
|
|
36337
|
-
* Stores internal state about a component instance after it's been created.
|
|
36338
|
-
*/
|
|
36339
36040
|
|
|
36041
|
+
function hasInternalHelperManager(definition) {
|
|
36042
|
+
return hasDefaultHelperManager(definition) || getManager(HELPER_MANAGERS, definition) !== undefined;
|
|
36043
|
+
}
|
|
36340
36044
|
|
|
36341
|
-
|
|
36045
|
+
function hasInternalModifierManager(definition) {
|
|
36046
|
+
return hasDefaultModifierManager(definition) || getManager(MODIFIER_MANAGERS, definition) !== undefined;
|
|
36047
|
+
}
|
|
36342
36048
|
|
|
36343
|
-
|
|
36344
|
-
|
|
36345
|
-
|
|
36346
|
-
|
|
36347
|
-
|
|
36049
|
+
function hasDefaultComponentManager(_definition) {
|
|
36050
|
+
return false;
|
|
36051
|
+
}
|
|
36052
|
+
|
|
36053
|
+
function hasDefaultHelperManager(definition) {
|
|
36054
|
+
if (_globalContext.FEATURE_DEFAULT_HELPER_MANAGER) {
|
|
36055
|
+
return typeof definition === 'function';
|
|
36348
36056
|
}
|
|
36349
36057
|
|
|
36058
|
+
return false;
|
|
36350
36059
|
}
|
|
36351
36060
|
|
|
36352
|
-
function
|
|
36353
|
-
|
|
36354
|
-
|
|
36061
|
+
function hasDefaultModifierManager(_definition) {
|
|
36062
|
+
return false;
|
|
36063
|
+
}
|
|
36064
|
+
|
|
36065
|
+
var CAPABILITIES = {
|
|
36066
|
+
dynamicLayout: false,
|
|
36067
|
+
dynamicTag: false,
|
|
36068
|
+
prepareArgs: false,
|
|
36069
|
+
createArgs: true,
|
|
36070
|
+
attributeHook: false,
|
|
36071
|
+
elementHook: false,
|
|
36072
|
+
createCaller: false,
|
|
36073
|
+
dynamicScope: true,
|
|
36074
|
+
updateHook: true,
|
|
36075
|
+
createInstance: true,
|
|
36076
|
+
wrapped: false,
|
|
36077
|
+
willDestroy: false,
|
|
36078
|
+
hasSubOwner: false
|
|
36079
|
+
};
|
|
36080
|
+
|
|
36081
|
+
function componentCapabilities(managerAPI, options) {
|
|
36082
|
+
if (options === void 0) {
|
|
36083
|
+
options = {};
|
|
36355
36084
|
}
|
|
36356
36085
|
|
|
36357
36086
|
if (true
|
|
36358
36087
|
/* DEBUG */
|
|
36359
|
-
&& managerAPI !== '3.
|
|
36360
|
-
throw new Error('Invalid
|
|
36088
|
+
&& managerAPI !== '3.13') {
|
|
36089
|
+
throw new Error('Invalid component manager compatibility specified');
|
|
36361
36090
|
}
|
|
36362
36091
|
|
|
36092
|
+
var updateHook = Boolean(options.updateHook);
|
|
36363
36093
|
return buildCapabilities({
|
|
36364
|
-
|
|
36094
|
+
asyncLifeCycleCallbacks: Boolean(options.asyncLifecycleCallbacks),
|
|
36095
|
+
destructor: Boolean(options.destructor),
|
|
36096
|
+
updateHook
|
|
36365
36097
|
});
|
|
36366
36098
|
}
|
|
36099
|
+
|
|
36100
|
+
function hasAsyncLifeCycleCallbacks(delegate) {
|
|
36101
|
+
return delegate.capabilities.asyncLifeCycleCallbacks;
|
|
36102
|
+
}
|
|
36103
|
+
|
|
36104
|
+
function hasUpdateHook(delegate) {
|
|
36105
|
+
return delegate.capabilities.updateHook;
|
|
36106
|
+
}
|
|
36107
|
+
|
|
36108
|
+
function hasAsyncUpdateHook(delegate) {
|
|
36109
|
+
return hasAsyncLifeCycleCallbacks(delegate) && hasUpdateHook(delegate);
|
|
36110
|
+
}
|
|
36111
|
+
|
|
36112
|
+
function hasDestructors(delegate) {
|
|
36113
|
+
return delegate.capabilities.destructor;
|
|
36114
|
+
}
|
|
36367
36115
|
/**
|
|
36368
|
-
The
|
|
36116
|
+
The CustomComponentManager allows addons to provide custom component
|
|
36369
36117
|
implementations that integrate seamlessly into Ember. This is accomplished
|
|
36370
|
-
through a delegate, registered with the custom
|
|
36371
|
-
implements a set of hooks that determine
|
|
36372
|
-
|
|
36118
|
+
through a delegate, registered with the custom component manager, which
|
|
36119
|
+
implements a set of hooks that determine component behavior.
|
|
36120
|
+
|
|
36121
|
+
To create a custom component manager, instantiate a new CustomComponentManager
|
|
36373
36122
|
class and pass the delegate as the first argument:
|
|
36374
36123
|
|
|
36375
36124
|
```js
|
|
36376
|
-
let manager = new
|
|
36125
|
+
let manager = new CustomComponentManager({
|
|
36377
36126
|
// ...delegate implementation...
|
|
36378
36127
|
});
|
|
36379
36128
|
```
|
|
36380
36129
|
|
|
36381
36130
|
## Delegate Hooks
|
|
36382
36131
|
|
|
36383
|
-
Throughout the lifecycle of a
|
|
36132
|
+
Throughout the lifecycle of a component, the component manager will invoke
|
|
36384
36133
|
delegate hooks that are responsible for surfacing those lifecycle changes to
|
|
36385
36134
|
the end developer.
|
|
36386
|
-
|
|
36387
|
-
* `
|
|
36388
|
-
* `
|
|
36389
|
-
* `
|
|
36135
|
+
|
|
36136
|
+
* `create()` - invoked when a new instance of a component should be created
|
|
36137
|
+
* `update()` - invoked when the arguments passed to a component change
|
|
36138
|
+
* `getContext()` - returns the object that should be
|
|
36390
36139
|
*/
|
|
36391
36140
|
|
|
36392
36141
|
|
|
36393
|
-
class
|
|
36142
|
+
class CustomComponentManager {
|
|
36394
36143
|
constructor(factory) {
|
|
36395
36144
|
this.factory = factory;
|
|
36396
36145
|
this.componentManagerDelegates = new WeakMap();
|
|
@@ -36412,7 +36161,7 @@ define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
36412
36161
|
/* DEBUG */
|
|
36413
36162
|
&& !FROM_CAPABILITIES.has(delegate.capabilities)) {
|
|
36414
36163
|
// TODO: This error message should make sense in both Ember and Glimmer https://github.com/glimmerjs/glimmer-vm/issues/1200
|
|
36415
|
-
throw new Error(`Custom
|
|
36164
|
+
throw new Error(`Custom component managers must have a \`capabilities\` property that is the result of calling the \`capabilities('3.13')\` (imported via \`import { capabilities } from '@ember/component';\`). Received: \`${JSON.stringify(delegate.capabilities)}\` for: \`${delegate}\``);
|
|
36416
36165
|
}
|
|
36417
36166
|
|
|
36418
36167
|
componentManagerDelegates.set(owner, delegate);
|
|
@@ -36421,136 +36170,154 @@ define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
36421
36170
|
return delegate;
|
|
36422
36171
|
}
|
|
36423
36172
|
|
|
36424
|
-
create(owner,
|
|
36173
|
+
create(owner, definition, vmArgs) {
|
|
36425
36174
|
var delegate = this.getDelegateFor(owner);
|
|
36426
|
-
var args = argsProxyFor(
|
|
36427
|
-
var
|
|
36428
|
-
|
|
36429
|
-
|
|
36430
|
-
state = {
|
|
36431
|
-
tag,
|
|
36432
|
-
element,
|
|
36433
|
-
delegate,
|
|
36434
|
-
args,
|
|
36435
|
-
modifier: instance
|
|
36436
|
-
};
|
|
36437
|
-
|
|
36438
|
-
if (true
|
|
36439
|
-
/* DEBUG */
|
|
36440
|
-
) {
|
|
36441
|
-
state.debugName = typeof definition === 'function' ? definition.name : definition.toString();
|
|
36442
|
-
}
|
|
36175
|
+
var args = argsProxyFor(vmArgs.capture(), 'component');
|
|
36176
|
+
var component = delegate.createComponent(definition, args);
|
|
36177
|
+
return new CustomComponentState(component, delegate, args);
|
|
36178
|
+
}
|
|
36443
36179
|
|
|
36444
|
-
|
|
36445
|
-
return
|
|
36180
|
+
getDebugName(definition) {
|
|
36181
|
+
return typeof definition === 'function' ? definition.name : definition.toString();
|
|
36446
36182
|
}
|
|
36447
36183
|
|
|
36448
|
-
|
|
36184
|
+
update(bucket) {
|
|
36449
36185
|
var {
|
|
36450
|
-
|
|
36451
|
-
} =
|
|
36452
|
-
|
|
36186
|
+
delegate
|
|
36187
|
+
} = bucket;
|
|
36188
|
+
|
|
36189
|
+
if (hasUpdateHook(delegate)) {
|
|
36190
|
+
var {
|
|
36191
|
+
component,
|
|
36192
|
+
args
|
|
36193
|
+
} = bucket;
|
|
36194
|
+
delegate.updateComponent(component, args);
|
|
36195
|
+
}
|
|
36453
36196
|
}
|
|
36454
36197
|
|
|
36455
|
-
|
|
36198
|
+
didCreate(_ref2) {
|
|
36456
36199
|
var {
|
|
36457
|
-
|
|
36458
|
-
|
|
36459
|
-
|
|
36200
|
+
component,
|
|
36201
|
+
delegate
|
|
36202
|
+
} = _ref2;
|
|
36203
|
+
|
|
36204
|
+
if (hasAsyncLifeCycleCallbacks(delegate)) {
|
|
36205
|
+
delegate.didCreateComponent(component);
|
|
36206
|
+
}
|
|
36460
36207
|
}
|
|
36461
36208
|
|
|
36462
|
-
|
|
36209
|
+
didUpdate(_ref3) {
|
|
36463
36210
|
var {
|
|
36464
|
-
|
|
36465
|
-
args,
|
|
36466
|
-
modifier,
|
|
36211
|
+
component,
|
|
36467
36212
|
delegate
|
|
36468
|
-
} =
|
|
36469
|
-
var {
|
|
36470
|
-
capabilities
|
|
36471
|
-
} = delegate;
|
|
36213
|
+
} = _ref3;
|
|
36472
36214
|
|
|
36473
|
-
if (
|
|
36474
|
-
|
|
36475
|
-
} else {
|
|
36476
|
-
delegate.installModifier(modifier, element, args);
|
|
36215
|
+
if (hasAsyncUpdateHook(delegate)) {
|
|
36216
|
+
delegate.didUpdateComponent(component);
|
|
36477
36217
|
}
|
|
36478
36218
|
}
|
|
36479
36219
|
|
|
36480
|
-
|
|
36220
|
+
didRenderLayout() {}
|
|
36221
|
+
|
|
36222
|
+
didUpdateLayout() {}
|
|
36223
|
+
|
|
36224
|
+
getSelf(_ref4) {
|
|
36481
36225
|
var {
|
|
36482
|
-
|
|
36483
|
-
modifier,
|
|
36226
|
+
component,
|
|
36484
36227
|
delegate
|
|
36485
|
-
} =
|
|
36228
|
+
} = _ref4;
|
|
36229
|
+
return (0, _reference.createConstRef)(delegate.getContext(component), 'this');
|
|
36230
|
+
}
|
|
36231
|
+
|
|
36232
|
+
getDestroyable(bucket) {
|
|
36486
36233
|
var {
|
|
36487
|
-
|
|
36488
|
-
} =
|
|
36234
|
+
delegate
|
|
36235
|
+
} = bucket;
|
|
36489
36236
|
|
|
36490
|
-
if (
|
|
36491
|
-
|
|
36492
|
-
|
|
36493
|
-
|
|
36237
|
+
if (hasDestructors(delegate)) {
|
|
36238
|
+
var {
|
|
36239
|
+
component
|
|
36240
|
+
} = bucket;
|
|
36241
|
+
(0, _destroyable.registerDestructor)(bucket, () => delegate.destroyComponent(component));
|
|
36242
|
+
return bucket;
|
|
36494
36243
|
}
|
|
36244
|
+
|
|
36245
|
+
return null;
|
|
36495
36246
|
}
|
|
36496
36247
|
|
|
36497
|
-
|
|
36498
|
-
return
|
|
36248
|
+
getCapabilities() {
|
|
36249
|
+
return CAPABILITIES;
|
|
36499
36250
|
}
|
|
36500
36251
|
|
|
36501
36252
|
}
|
|
36253
|
+
/**
|
|
36254
|
+
* Stores internal state about a component instance after it's been created.
|
|
36255
|
+
*/
|
|
36502
36256
|
|
|
36503
|
-
_exports.CustomModifierManager = CustomModifierManager;
|
|
36504
36257
|
|
|
36505
|
-
|
|
36506
|
-
if (options === void 0) {
|
|
36507
|
-
options = {};
|
|
36508
|
-
}
|
|
36258
|
+
_exports.CustomComponentManager = CustomComponentManager;
|
|
36509
36259
|
|
|
36510
|
-
|
|
36511
|
-
|
|
36512
|
-
|
|
36513
|
-
|
|
36260
|
+
class CustomComponentState {
|
|
36261
|
+
constructor(component, delegate, args) {
|
|
36262
|
+
this.component = component;
|
|
36263
|
+
this.delegate = delegate;
|
|
36264
|
+
this.args = args;
|
|
36514
36265
|
}
|
|
36515
36266
|
|
|
36516
|
-
|
|
36517
|
-
|
|
36518
|
-
|
|
36519
|
-
|
|
36267
|
+
}
|
|
36268
|
+
|
|
36269
|
+
function modifierCapabilities(managerAPI, optionalFeatures) {
|
|
36270
|
+
if (optionalFeatures === void 0) {
|
|
36271
|
+
optionalFeatures = {};
|
|
36520
36272
|
}
|
|
36521
36273
|
|
|
36522
36274
|
if (true
|
|
36523
36275
|
/* DEBUG */
|
|
36524
|
-
&&
|
|
36525
|
-
throw new Error('
|
|
36276
|
+
&& managerAPI !== '3.22') {
|
|
36277
|
+
throw new Error('Invalid modifier manager compatibility specified');
|
|
36526
36278
|
}
|
|
36527
36279
|
|
|
36528
36280
|
return buildCapabilities({
|
|
36529
|
-
|
|
36530
|
-
hasDestroyable: Boolean(options.hasDestroyable),
|
|
36531
|
-
hasScheduledEffect: Boolean(options.hasScheduledEffect)
|
|
36281
|
+
disableAutoTracking: Boolean(optionalFeatures.disableAutoTracking)
|
|
36532
36282
|
});
|
|
36533
|
-
} ////////////
|
|
36534
|
-
|
|
36535
|
-
|
|
36536
|
-
function hasValue(manager) {
|
|
36537
|
-
return manager.capabilities.hasValue;
|
|
36538
36283
|
}
|
|
36539
|
-
|
|
36540
|
-
|
|
36541
|
-
|
|
36542
|
-
|
|
36284
|
+
/**
|
|
36285
|
+
The CustomModifierManager allows addons to provide custom modifier
|
|
36286
|
+
implementations that integrate seamlessly into Ember. This is accomplished
|
|
36287
|
+
through a delegate, registered with the custom modifier manager, which
|
|
36288
|
+
implements a set of hooks that determine modifier behavior.
|
|
36289
|
+
To create a custom modifier manager, instantiate a new CustomModifierManager
|
|
36290
|
+
class and pass the delegate as the first argument:
|
|
36291
|
+
|
|
36292
|
+
```js
|
|
36293
|
+
let manager = new CustomModifierManager({
|
|
36294
|
+
// ...delegate implementation...
|
|
36295
|
+
});
|
|
36296
|
+
```
|
|
36297
|
+
|
|
36298
|
+
## Delegate Hooks
|
|
36299
|
+
|
|
36300
|
+
Throughout the lifecycle of a modifier, the modifier manager will invoke
|
|
36301
|
+
delegate hooks that are responsible for surfacing those lifecycle changes to
|
|
36302
|
+
the end developer.
|
|
36303
|
+
* `createModifier()` - invoked when a new instance of a modifier should be created
|
|
36304
|
+
* `installModifier()` - invoked when the modifier is installed on the element
|
|
36305
|
+
* `updateModifier()` - invoked when the arguments passed to a modifier change
|
|
36306
|
+
* `destroyModifier()` - invoked when the modifier is about to be destroyed
|
|
36307
|
+
*/
|
|
36543
36308
|
|
|
36544
36309
|
|
|
36545
|
-
class
|
|
36310
|
+
class CustomModifierManager {
|
|
36546
36311
|
constructor(factory) {
|
|
36547
36312
|
this.factory = factory;
|
|
36548
|
-
this.
|
|
36549
|
-
this.undefinedDelegate = null;
|
|
36313
|
+
this.componentManagerDelegates = new WeakMap();
|
|
36550
36314
|
}
|
|
36551
36315
|
|
|
36552
|
-
|
|
36553
|
-
var
|
|
36316
|
+
getDelegateFor(owner) {
|
|
36317
|
+
var {
|
|
36318
|
+
componentManagerDelegates
|
|
36319
|
+
} = this;
|
|
36320
|
+
var delegate = componentManagerDelegates.get(owner);
|
|
36554
36321
|
|
|
36555
36322
|
if (delegate === undefined) {
|
|
36556
36323
|
var {
|
|
@@ -36562,67 +36329,95 @@ define("@glimmer/manager", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
36562
36329
|
/* DEBUG */
|
|
36563
36330
|
&& !FROM_CAPABILITIES.has(delegate.capabilities)) {
|
|
36564
36331
|
// TODO: This error message should make sense in both Ember and Glimmer https://github.com/glimmerjs/glimmer-vm/issues/1200
|
|
36565
|
-
throw new Error(`Custom
|
|
36332
|
+
throw new Error(`Custom modifier managers must have a \`capabilities\` property that is the result of calling the \`capabilities('3.22')\` (imported via \`import { capabilities } from '@ember/modifier';\`). Received: \`${JSON.stringify(delegate.capabilities)}\` for: \`${delegate}\``);
|
|
36566
36333
|
}
|
|
36567
36334
|
|
|
36568
|
-
|
|
36335
|
+
componentManagerDelegates.set(owner, delegate);
|
|
36569
36336
|
}
|
|
36570
36337
|
|
|
36571
36338
|
return delegate;
|
|
36572
36339
|
}
|
|
36573
36340
|
|
|
36574
|
-
|
|
36575
|
-
|
|
36576
|
-
|
|
36577
|
-
|
|
36578
|
-
|
|
36579
|
-
|
|
36580
|
-
|
|
36581
|
-
|
|
36582
|
-
|
|
36583
|
-
|
|
36584
|
-
|
|
36585
|
-
|
|
36341
|
+
create(owner, element, definition, capturedArgs) {
|
|
36342
|
+
var delegate = this.getDelegateFor(owner);
|
|
36343
|
+
var args = argsProxyFor(capturedArgs, 'modifier');
|
|
36344
|
+
var instance = delegate.createModifier(definition, args);
|
|
36345
|
+
var tag = (0, _validator.createUpdatableTag)();
|
|
36346
|
+
var state;
|
|
36347
|
+
state = {
|
|
36348
|
+
tag,
|
|
36349
|
+
element,
|
|
36350
|
+
delegate,
|
|
36351
|
+
args,
|
|
36352
|
+
modifier: instance
|
|
36353
|
+
};
|
|
36586
36354
|
|
|
36587
|
-
|
|
36588
|
-
|
|
36589
|
-
|
|
36355
|
+
if (true
|
|
36356
|
+
/* DEBUG */
|
|
36357
|
+
) {
|
|
36358
|
+
state.debugName = typeof definition === 'function' ? definition.name : definition.toString();
|
|
36590
36359
|
}
|
|
36360
|
+
|
|
36361
|
+
(0, _destroyable.registerDestructor)(state, () => delegate.destroyModifier(instance, args));
|
|
36362
|
+
return state;
|
|
36591
36363
|
}
|
|
36592
36364
|
|
|
36593
|
-
|
|
36594
|
-
|
|
36595
|
-
|
|
36365
|
+
getDebugName(_ref5) {
|
|
36366
|
+
var {
|
|
36367
|
+
debugName
|
|
36368
|
+
} = _ref5;
|
|
36369
|
+
return debugName;
|
|
36370
|
+
}
|
|
36596
36371
|
|
|
36597
|
-
|
|
36598
|
-
|
|
36599
|
-
|
|
36372
|
+
getTag(_ref6) {
|
|
36373
|
+
var {
|
|
36374
|
+
tag
|
|
36375
|
+
} = _ref6;
|
|
36376
|
+
return tag;
|
|
36377
|
+
}
|
|
36600
36378
|
|
|
36601
|
-
|
|
36602
|
-
|
|
36603
|
-
|
|
36604
|
-
|
|
36379
|
+
install(_ref7) {
|
|
36380
|
+
var {
|
|
36381
|
+
element,
|
|
36382
|
+
args,
|
|
36383
|
+
modifier,
|
|
36384
|
+
delegate
|
|
36385
|
+
} = _ref7;
|
|
36386
|
+
var {
|
|
36387
|
+
capabilities
|
|
36388
|
+
} = delegate;
|
|
36605
36389
|
|
|
36606
|
-
|
|
36607
|
-
|
|
36608
|
-
|
|
36390
|
+
if (capabilities.disableAutoTracking === true) {
|
|
36391
|
+
(0, _validator.untrack)(() => delegate.installModifier(modifier, element, args));
|
|
36392
|
+
} else {
|
|
36393
|
+
delegate.installModifier(modifier, element, args);
|
|
36394
|
+
}
|
|
36395
|
+
}
|
|
36609
36396
|
|
|
36610
|
-
|
|
36611
|
-
|
|
36612
|
-
|
|
36613
|
-
|
|
36614
|
-
|
|
36615
|
-
|
|
36616
|
-
|
|
36617
|
-
|
|
36618
|
-
|
|
36619
|
-
|
|
36620
|
-
|
|
36397
|
+
update(_ref8) {
|
|
36398
|
+
var {
|
|
36399
|
+
args,
|
|
36400
|
+
modifier,
|
|
36401
|
+
delegate
|
|
36402
|
+
} = _ref8;
|
|
36403
|
+
var {
|
|
36404
|
+
capabilities
|
|
36405
|
+
} = delegate;
|
|
36406
|
+
|
|
36407
|
+
if (capabilities.disableAutoTracking === true) {
|
|
36408
|
+
(0, _validator.untrack)(() => delegate.updateModifier(modifier, args));
|
|
36409
|
+
} else {
|
|
36410
|
+
delegate.updateModifier(modifier, args);
|
|
36411
|
+
}
|
|
36412
|
+
}
|
|
36413
|
+
|
|
36414
|
+
getDestroyable(state) {
|
|
36415
|
+
return state;
|
|
36621
36416
|
}
|
|
36622
36417
|
|
|
36623
36418
|
}
|
|
36624
36419
|
|
|
36625
|
-
_exports.
|
|
36420
|
+
_exports.CustomModifierManager = CustomModifierManager;
|
|
36626
36421
|
|
|
36627
36422
|
function setComponentManager(factory, obj) {
|
|
36628
36423
|
return setInternalComponentManager(new CustomComponentManager(factory), obj);
|
|
@@ -48148,7 +47943,7 @@ define("@glimmer/runtime", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
48148
47943
|
|
|
48149
47944
|
function assertCallbackIsFn(callbackRef) {
|
|
48150
47945
|
if (!(callbackRef && ((0, _reference.isInvokableRef)(callbackRef) || typeof (0, _reference.valueForRef)(callbackRef) === 'function'))) {
|
|
48151
|
-
throw new Error(`You must pass a function as the \`fn\`
|
|
47946
|
+
throw new Error(`You must pass a function as the \`fn\` helper's first argument, you passed ${callbackRef ? (0, _reference.valueForRef)(callbackRef) : callbackRef}. While rendering:\n\n${callbackRef === null || callbackRef === void 0 ? void 0 : callbackRef.debugLabel}`);
|
|
48152
47947
|
}
|
|
48153
47948
|
}
|
|
48154
47949
|
|
|
@@ -48527,7 +48322,7 @@ define("@glimmer/runtime", ["exports", "@glimmer/util", "@glimmer/reference", "@
|
|
|
48527
48322
|
var value = (0, _reference.valueForRef)(userProvidedCallbackReference);
|
|
48528
48323
|
|
|
48529
48324
|
if (typeof value !== 'function') {
|
|
48530
|
-
throw new Error(`You must pass a function as the second argument to the \`on\` modifier
|
|
48325
|
+
throw new Error(`You must pass a function as the second argument to the \`on\` modifier; you passed ${value === null ? 'null' : typeof value}. While rendering:\n\n${userProvidedCallbackReference.debugLabel}`);
|
|
48531
48326
|
}
|
|
48532
48327
|
}
|
|
48533
48328
|
|
|
@@ -49008,29 +48803,7 @@ define("@glimmer/util", ["exports"], function (_exports) {
|
|
|
49008
48803
|
return node.nodeValue === SERIALIZATION_FIRST_NODE_STRING;
|
|
49009
48804
|
}
|
|
49010
48805
|
|
|
49011
|
-
var
|
|
49012
|
-
|
|
49013
|
-
var {
|
|
49014
|
-
keys: objKeys
|
|
49015
|
-
} = Object;
|
|
49016
|
-
|
|
49017
|
-
function assignFn(obj) {
|
|
49018
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
49019
|
-
var assignment = arguments[i];
|
|
49020
|
-
if (assignment === null || typeof assignment !== 'object') continue;
|
|
49021
|
-
|
|
49022
|
-
var _keys = objKeys(assignment);
|
|
49023
|
-
|
|
49024
|
-
for (var j = 0; j < _keys.length; j++) {
|
|
49025
|
-
var key = _keys[j];
|
|
49026
|
-
obj[key] = assignment[key];
|
|
49027
|
-
}
|
|
49028
|
-
}
|
|
49029
|
-
|
|
49030
|
-
return obj;
|
|
49031
|
-
}
|
|
49032
|
-
|
|
49033
|
-
var assign = (_a = Object.assign) !== null && _a !== void 0 ? _a : assignFn;
|
|
48806
|
+
var assign = Object.assign;
|
|
49034
48807
|
_exports.assign = assign;
|
|
49035
48808
|
|
|
49036
48809
|
function fillNulls(count) {
|
|
@@ -54632,7 +54405,7 @@ define("ember/version", ["exports"], function (_exports) {
|
|
|
54632
54405
|
value: true
|
|
54633
54406
|
});
|
|
54634
54407
|
_exports.default = void 0;
|
|
54635
|
-
var _default = "4.5.0-alpha.
|
|
54408
|
+
var _default = "4.5.0-alpha.5";
|
|
54636
54409
|
_exports.default = _default;
|
|
54637
54410
|
});
|
|
54638
54411
|
define("route-recognizer", ["exports"], function (_exports) {
|