ember-source 4.8.0-alpha.5 → 4.8.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -2
- package/blueprints/helper/files/__root__/{__collection__ → helpers}/__name__.ts +0 -0
- package/blueprints/helper/index.js +0 -15
- package/blueprints/helper-test/index.js +0 -3
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/blueprints/helper-test/mocha-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.ts +0 -0
- package/blueprints/helper-test/qunit-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.ts +0 -0
- package/blueprints-js/helper/files/__root__/{__collection__ → helpers}/__name__.js +0 -0
- package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/blueprints-js/helper-test/mocha-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/blueprints-js/helper-test/qunit-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
- package/build-metadata.json +3 -3
- package/dist/dependencies/router_js.js +1 -1
- package/dist/ember-template-compiler.js +675 -18
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +11 -11
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +19576 -20510
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +4 -2
- package/dist/packages/@ember/-internals/metal/index.js +214 -1094
- package/dist/packages/@ember/-internals/routing/index.js +1 -17
- package/dist/packages/@ember/-internals/runtime/index.js +3 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +2 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -3
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +1 -8
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +2 -1
- package/dist/packages/@ember/-internals/utils/index.js +3 -3
- package/dist/packages/@ember/-internals/views/lib/component_lookup.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +2 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +2 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/view_state_support.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +2 -1
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/views/core_view.js +3 -1
- package/dist/packages/@ember/application/index.js +876 -2
- package/dist/packages/@ember/application/instance.js +2 -2
- package/dist/packages/@ember/application/namespace.js +70 -1
- package/dist/packages/@ember/array/index.js +1503 -2
- package/dist/packages/@ember/array/mutable.js +1 -1
- package/dist/packages/@ember/array/proxy.js +307 -1
- package/dist/packages/@ember/canary-features/index.js +2 -2
- package/dist/packages/@ember/controller/index.js +260 -3
- package/dist/packages/@ember/debug/container-debug-adapter.js +99 -1
- package/dist/packages/@ember/debug/data-adapter.js +574 -1
- package/dist/packages/@ember/engine/index.js +5 -5
- package/dist/packages/@ember/engine/instance.js +4 -4
- package/dist/packages/@ember/enumerable/index.js +3 -1
- package/dist/packages/@ember/enumerable/mutable.js +4 -0
- package/dist/packages/@ember/{-internals/runtime/lib/system/object.js → object/-internals.js} +4 -17
- package/dist/packages/@ember/object/core.js +731 -1
- package/dist/packages/@ember/object/evented.js +93 -2
- package/dist/packages/@ember/object/index.js +76 -4
- package/dist/packages/@ember/object/internals.js +3 -2
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +3 -1
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +4 -3
- package/dist/packages/@ember/object/mixin.js +659 -1
- package/dist/packages/@ember/object/observable.js +341 -1
- package/dist/packages/@ember/object/promise-proxy-mixin.js +150 -1
- package/dist/packages/@ember/object/proxy.js +10 -1
- package/dist/packages/@ember/routing/-internals.js +7 -0
- package/dist/packages/@ember/routing/auto-location.js +249 -1
- package/dist/packages/@ember/routing/hash-location.js +169 -1
- package/dist/packages/@ember/routing/history-location.js +289 -1
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/cache.js +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/controller_for.js +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/dsl.js +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/engines.js +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/generate_controller.js +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/location/util.js → routing/lib/location-utils.js} +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/query_params.js +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/route-info.js +0 -0
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/router_state.js +1 -1
- package/dist/packages/@ember/{-internals/routing/lib/services/routing.js → routing/lib/routing-service.js} +2 -2
- package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/transition.js +0 -0
- package/dist/packages/@ember/{-internals/routing → routing}/lib/utils.js +0 -0
- package/dist/packages/@ember/routing/location.js +104 -1
- package/dist/packages/@ember/routing/none-location.js +123 -1
- package/dist/packages/@ember/routing/route.js +1700 -1
- package/dist/packages/@ember/routing/router-service.js +510 -1
- package/dist/packages/@ember/routing/router.js +1666 -1
- package/dist/packages/@ember/service/index.js +1 -1
- package/dist/packages/@ember/utils/index.js +7 -2
- package/dist/packages/@ember/{-internals/runtime → utils}/lib/compare.js +2 -2
- package/dist/packages/@ember/{-internals/runtime → utils}/lib/is-equal.js +0 -0
- package/dist/packages/@ember/utils/lib/is_blank.js +35 -0
- package/dist/packages/@ember/utils/lib/is_empty.js +68 -0
- package/dist/packages/@ember/utils/lib/is_none.js +27 -0
- package/dist/packages/@ember/utils/lib/is_present.js +38 -0
- package/dist/packages/@ember/{-internals/runtime → utils}/lib/type-of.js +2 -2
- package/dist/packages/ember/index.js +47 -28
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/adapter.js +1 -1
- package/dist/packages/ember-testing/lib/helpers/current_path.js +2 -2
- package/dist/packages/ember-testing/lib/helpers/current_route_name.js +2 -2
- package/dist/packages/ember-testing/lib/helpers/current_url.js +1 -1
- package/docs/data.json +9428 -9189
- package/package.json +23 -8
- package/types/preview/@ember/-internals/resolver.d.ts +35 -0
- package/types/preview/@ember/application/-private/event-dispatcher.d.ts +18 -0
- package/types/preview/@ember/application/-private/registry.d.ts +15 -0
- package/types/preview/@ember/application/deprecations.d.ts +24 -0
- package/types/preview/@ember/application/index.d.ts +153 -0
- package/types/preview/@ember/application/instance.d.ts +9 -0
- package/types/preview/@ember/application/tsconfig.json +3 -0
- package/types/preview/@ember/application/types.d.ts +29 -0
- package/types/preview/@ember/array/-private/enumerable.d.ts +13 -0
- package/types/preview/@ember/array/-private/mutable-enumerable.d.ts +13 -0
- package/types/preview/@ember/array/-private/native-array.d.ts +23 -0
- package/types/preview/@ember/array/index.d.ts +243 -0
- package/types/preview/@ember/array/mutable.d.ts +94 -0
- package/types/preview/@ember/array/proxy.d.ts +29 -0
- package/types/preview/@ember/array/tsconfig.json +3 -0
- package/types/preview/@ember/component/-private/class-names-support.d.ts +27 -0
- package/types/preview/@ember/component/-private/core-view.d.ts +14 -0
- package/types/preview/@ember/component/-private/glimmer-interfaces.d.ts +45 -0
- package/types/preview/@ember/component/-private/signature-utils.d.ts +107 -0
- package/types/preview/@ember/component/-private/view-mixin.d.ts +59 -0
- package/types/preview/@ember/component/helper.d.ts +122 -0
- package/types/preview/@ember/component/index.d.ts +132 -0
- package/types/preview/@ember/component/template-only.d.ts +47 -0
- package/types/preview/@ember/component/tsconfig.json +3 -0
- package/types/preview/@ember/controller/index.d.ts +48 -0
- package/types/preview/@ember/controller/tsconfig.json +3 -0
- package/types/preview/@ember/debug/container-debug-adapter.d.ts +13 -0
- package/types/preview/@ember/debug/data-adapter.d.ts +64 -0
- package/types/preview/@ember/debug/index.d.ts +98 -0
- package/types/preview/@ember/debug/tsconfig.json +3 -0
- package/types/preview/@ember/destroyable/index.d.ts +23 -0
- package/types/preview/@ember/destroyable/tsconfig.json +3 -0
- package/types/preview/@ember/engine/-private/container-proxy-mixin.d.ts +17 -0
- package/types/preview/@ember/engine/-private/registry-proxy-mixin.d.ts +54 -0
- package/types/preview/@ember/engine/-private/types/initializer.d.ts +8 -0
- package/types/preview/@ember/engine/index.d.ts +45 -0
- package/types/preview/@ember/engine/instance.d.ts +24 -0
- package/types/preview/@ember/engine/tsconfig.json +3 -0
- package/types/preview/@ember/error/index.d.ts +6 -0
- package/types/preview/@ember/error/tsconfig.json +3 -0
- package/types/preview/@ember/helper/index.d.ts +49 -0
- package/types/preview/@ember/helper/tsconfig.json +3 -0
- package/types/preview/@ember/modifier/index.d.ts +33 -0
- package/types/preview/@ember/modifier/tsconfig.json +3 -0
- package/types/preview/@ember/object/-private/action-handler.d.ts +31 -0
- package/types/preview/@ember/object/-private/types.d.ts +63 -0
- package/types/preview/@ember/object/compat.d.ts +9 -0
- package/types/preview/@ember/object/computed.d.ts +263 -0
- package/types/preview/@ember/object/core.d.ts +89 -0
- package/types/preview/@ember/object/evented.d.ts +45 -0
- package/types/preview/@ember/object/events.d.ts +47 -0
- package/types/preview/@ember/object/index.d.ts +126 -0
- package/types/preview/@ember/object/internals.d.ts +17 -0
- package/types/preview/@ember/object/mixin.d.ts +19 -0
- package/types/preview/@ember/object/observable.d.ts +89 -0
- package/types/preview/@ember/object/observers.d.ts +34 -0
- package/types/preview/@ember/object/promise-proxy-mixin.d.ts +37 -0
- package/types/preview/@ember/object/proxy.d.ts +27 -0
- package/types/preview/@ember/object/tsconfig.json +3 -0
- package/types/preview/@ember/owner/index.d.ts +102 -0
- package/types/preview/@ember/owner/tsconfig.json +3 -0
- package/types/preview/@ember/polyfills/index.d.ts +23 -0
- package/types/preview/@ember/polyfills/tsconfig.json +3 -0
- package/types/preview/@ember/polyfills/types.d.ts +6 -0
- package/types/preview/@ember/routing/-private/router-dsl.d.ts +20 -0
- package/types/preview/@ember/routing/auto-location.d.ts +8 -0
- package/types/preview/@ember/routing/hash-location.d.ts +10 -0
- package/types/preview/@ember/routing/history-location.d.ts +9 -0
- package/types/preview/@ember/routing/index.d.ts +20 -0
- package/types/preview/@ember/routing/none-location.d.ts +11 -0
- package/types/preview/@ember/routing/route-info.d.ts +74 -0
- package/types/preview/@ember/routing/route.d.ts +533 -0
- package/types/preview/@ember/routing/router-service.d.ts +351 -0
- package/types/preview/@ember/routing/router.d.ts +49 -0
- package/types/preview/@ember/routing/transition.d.ts +126 -0
- package/types/preview/@ember/routing/tsconfig.json +3 -0
- package/types/preview/@ember/routing/types.d.ts +15 -0
- package/types/preview/@ember/runloop/-private/backburner.d.ts +43 -0
- package/types/preview/@ember/runloop/-private/types.d.ts +9 -0
- package/types/preview/@ember/runloop/index.d.ts +175 -0
- package/types/preview/@ember/runloop/tsconfig.json +3 -0
- package/types/preview/@ember/runloop/types.d.ts +5 -0
- package/types/preview/@ember/service/index.d.ts +25 -0
- package/types/preview/@ember/service/tsconfig.json +3 -0
- package/types/preview/@ember/string/index.d.ts +9 -0
- package/types/preview/@ember/string/tsconfig.json +3 -0
- package/types/preview/@ember/template/-private/handlebars.d.ts +7 -0
- package/types/preview/@ember/template/index.d.ts +5 -0
- package/types/preview/@ember/template/tsconfig.json +3 -0
- package/types/preview/@ember/test/adapter.d.ts +22 -0
- package/types/preview/@ember/test/index.d.ts +49 -0
- package/types/preview/@ember/test/tsconfig.json +3 -0
- package/types/preview/@ember/utils/-private/types.d.ts +39 -0
- package/types/preview/@ember/utils/index.d.ts +42 -0
- package/types/preview/@ember/utils/tsconfig.json +3 -0
- package/types/preview/ember/-private/type-utils.d.ts +54 -0
- package/types/preview/ember/index.d.ts +381 -0
- package/types/preview/ember/tsconfig.json +3 -0
- package/types/preview/index.d.ts +120 -0
- package/types/preview/tsconfig.json +6 -0
- package/blueprints/helper/mu-files/__root__/__collection__/__name__.js +0 -7
- package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +0 -7
- package/dist/packages/@ember/-internals/extension-support/index.js +0 -2
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +0 -96
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +0 -576
- package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +0 -224
- package/dist/packages/@ember/-internals/routing/lib/location/api.js +0 -104
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +0 -250
- package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +0 -170
- package/dist/packages/@ember/-internals/routing/lib/location/history_location.js +0 -290
- package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +0 -124
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +0 -506
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +0 -1696
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -1662
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +0 -1501
- package/dist/packages/@ember/-internals/runtime/lib/mixins/enumerable.js +0 -3
- package/dist/packages/@ember/-internals/runtime/lib/mixins/evented.js +0 -91
- package/dist/packages/@ember/-internals/runtime/lib/mixins/mutable_enumerable.js +0 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +0 -339
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +0 -149
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +0 -305
- package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +0 -730
- package/dist/packages/@ember/-internals/runtime/lib/system/namespace.js +0 -69
- package/dist/packages/@ember/-internals/runtime/lib/system/object_proxy.js +0 -7
- package/dist/packages/@ember/application/lib/application.js +0 -870
- package/dist/packages/@ember/controller/lib/controller_mixin.js +0 -42
- package/dist/packages/@ember/runloop/type-tests.ts/begin-end.test.js +0 -5
- package/dist/packages/@ember/runloop/type-tests.ts/bind.test.js +0 -59
- package/dist/packages/@ember/runloop/type-tests.ts/cancel.test.js +0 -5
- package/dist/packages/@ember/runloop/type-tests.ts/debounce.test.js +0 -77
- package/dist/packages/@ember/runloop/type-tests.ts/join.test.js +0 -38
- package/dist/packages/@ember/runloop/type-tests.ts/later.test.js +0 -38
- package/dist/packages/@ember/runloop/type-tests.ts/next.test.js +0 -38
- package/dist/packages/@ember/runloop/type-tests.ts/once.test.js +0 -38
- package/dist/packages/@ember/runloop/type-tests.ts/run.test.js +0 -38
- package/dist/packages/@ember/runloop/type-tests.ts/schedule-once.test.js +0 -39
- package/dist/packages/@ember/runloop/type-tests.ts/schedule.test.js +0 -39
- package/dist/packages/@ember/runloop/type-tests.ts/throttle.test.js +0 -77
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
declare module '@ember/array/mutable' {
|
|
2
|
+
import Mixin from '@ember/object/mixin';
|
|
3
|
+
import MutableEnumerable from '@ember/array/-private/mutable-enumerable';
|
|
4
|
+
import EmberArray from '@ember/array';
|
|
5
|
+
|
|
6
|
+
type AnyArray<T> = EmberArray<T> | Array<T>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This mixin defines the API for modifying array-like objects. These methods
|
|
10
|
+
* can be applied only to a collection that keeps its items in an ordered set.
|
|
11
|
+
* It builds upon the Array mixin and adds methods to modify the array.
|
|
12
|
+
* One concrete implementations of this class include ArrayProxy.
|
|
13
|
+
*/
|
|
14
|
+
interface MutableArray<T> extends EmberArray<T>, MutableEnumerable {
|
|
15
|
+
/**
|
|
16
|
+
* __Required.__ You must implement this method to apply this mixin.
|
|
17
|
+
*/
|
|
18
|
+
replace(idx: number, amt: number, objects: T[]): this;
|
|
19
|
+
/**
|
|
20
|
+
* Remove all elements from the array. This is useful if you
|
|
21
|
+
* want to reuse an existing array without having to recreate it.
|
|
22
|
+
*/
|
|
23
|
+
clear(): this;
|
|
24
|
+
/**
|
|
25
|
+
* This will use the primitive `replace()` method to insert an object at the
|
|
26
|
+
* specified index.
|
|
27
|
+
*/
|
|
28
|
+
insertAt(idx: number, object: T): this;
|
|
29
|
+
/**
|
|
30
|
+
* Remove an object at the specified index using the `replace()` primitive
|
|
31
|
+
* method. You can pass either a single index, or a start and a length.
|
|
32
|
+
*/
|
|
33
|
+
removeAt(start: number, len?: number): this;
|
|
34
|
+
/**
|
|
35
|
+
* Push the object onto the end of the array. Works just like `push()` but it
|
|
36
|
+
* is KVO-compliant.
|
|
37
|
+
*/
|
|
38
|
+
pushObject(obj: T): T;
|
|
39
|
+
/**
|
|
40
|
+
* Add the objects in the passed numerable to the end of the array. Defers
|
|
41
|
+
* notifying observers of the change until all objects are added.
|
|
42
|
+
*/
|
|
43
|
+
pushObjects(objects: AnyArray<T>): this;
|
|
44
|
+
/**
|
|
45
|
+
* Pop object from array or nil if none are left. Works just like `pop()` but
|
|
46
|
+
* it is KVO-compliant.
|
|
47
|
+
*/
|
|
48
|
+
popObject(): T;
|
|
49
|
+
/**
|
|
50
|
+
* Shift an object from start of array or nil if none are left. Works just
|
|
51
|
+
* like `shift()` but it is KVO-compliant.
|
|
52
|
+
*/
|
|
53
|
+
shiftObject(): T;
|
|
54
|
+
/**
|
|
55
|
+
* Unshift an object to start of array. Works just like `unshift()` but it is
|
|
56
|
+
* KVO-compliant.
|
|
57
|
+
*/
|
|
58
|
+
unshiftObject(obj: T): T;
|
|
59
|
+
/**
|
|
60
|
+
* Adds the named objects to the beginning of the array. Defers notifying
|
|
61
|
+
* observers until all objects have been added.
|
|
62
|
+
*/
|
|
63
|
+
unshiftObjects(objects: AnyArray<T>): this;
|
|
64
|
+
/**
|
|
65
|
+
* Reverse objects in the array. Works just like `reverse()` but it is
|
|
66
|
+
* KVO-compliant.
|
|
67
|
+
*/
|
|
68
|
+
reverseObjects(): this;
|
|
69
|
+
/**
|
|
70
|
+
* Replace all the receiver's content with content of the argument.
|
|
71
|
+
* If argument is an empty array receiver will be cleared.
|
|
72
|
+
*/
|
|
73
|
+
setObjects(objects: AnyArray<T>): this;
|
|
74
|
+
/**
|
|
75
|
+
* __Required.__ You must implement this method to apply this mixin.
|
|
76
|
+
*/
|
|
77
|
+
removeObject(object: T): T;
|
|
78
|
+
/**
|
|
79
|
+
* Removes each object in the passed array from the receiver.
|
|
80
|
+
*/
|
|
81
|
+
removeObjects(objects: AnyArray<T>): this;
|
|
82
|
+
/**
|
|
83
|
+
* __Required.__ You must implement this method to apply this mixin.
|
|
84
|
+
*/
|
|
85
|
+
addObject(object: T): T;
|
|
86
|
+
/**
|
|
87
|
+
* Adds each object in the passed enumerable to the receiver.
|
|
88
|
+
*/
|
|
89
|
+
addObjects(objects: AnyArray<T>): this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const MutableArray: Mixin;
|
|
93
|
+
export default MutableArray;
|
|
94
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module '@ember/array/proxy' {
|
|
2
|
+
import Array from '@ember/array';
|
|
3
|
+
import type MutableArray from '@ember/array/mutable';
|
|
4
|
+
import EmberObject from '@ember/object';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An ArrayProxy wraps any other object that is a native or Ember `Array`
|
|
8
|
+
* (checked with [`Ember.isArray`](https://api.emberjs.com/ember/release/functions/@ember%2Farray/isArray)),
|
|
9
|
+
* forwarding all requests. This makes it very useful for a number of
|
|
10
|
+
* binding use cases or other cases where being able to swap out the
|
|
11
|
+
* underlying array is useful.
|
|
12
|
+
*
|
|
13
|
+
* NOTE: Attempting to mutate the underlying content of an object that
|
|
14
|
+
* is not a `MutableArray` (e.g. a native Javascript Array) may not
|
|
15
|
+
* behave as expected. [`Ember.A`](https://api.emberjs.com/ember/release/functions/@ember%2Farray/A)
|
|
16
|
+
* may be used in this case.
|
|
17
|
+
*/
|
|
18
|
+
export default interface ArrayProxy<T> extends MutableArray<T> {}
|
|
19
|
+
export default class ArrayProxy<T> extends EmberObject {
|
|
20
|
+
content: T[] | Array<T>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Should actually retrieve the object at the specified index from the
|
|
24
|
+
* content. You can override this method in subclasses to transform the
|
|
25
|
+
* content item to something new.
|
|
26
|
+
*/
|
|
27
|
+
objectAtContent(idx: number): T | undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare module '@ember/component/-private/class-names-support' {
|
|
2
|
+
import Mixin from '@ember/object/mixin';
|
|
3
|
+
|
|
4
|
+
interface ClassNamesSupport {
|
|
5
|
+
/**
|
|
6
|
+
* A list of properties of the view to apply as class names. If the property is a string value,
|
|
7
|
+
* the value of that string will be applied as a class name.
|
|
8
|
+
*
|
|
9
|
+
* If the value of the property is a Boolean, the name of that property is added as a dasherized
|
|
10
|
+
* class name.
|
|
11
|
+
*
|
|
12
|
+
* If you would prefer to use a custom value instead of the dasherized property name, you can
|
|
13
|
+
* pass a binding like this: `classNameBindings: ['isUrgent:urgent']`
|
|
14
|
+
*
|
|
15
|
+
* This list of properties is inherited from the component's superclasses as well.
|
|
16
|
+
*/
|
|
17
|
+
classNameBindings: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Standard CSS class names to apply to the view's outer element. This
|
|
20
|
+
* property automatically inherits any class names defined by the view's
|
|
21
|
+
* superclasses as well.
|
|
22
|
+
*/
|
|
23
|
+
classNames: string[];
|
|
24
|
+
}
|
|
25
|
+
const ClassNamesSupport: Mixin;
|
|
26
|
+
export default ClassNamesSupport;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare module '@ember/component/-private/core-view' {
|
|
2
|
+
import EmberObject from '@ember/object';
|
|
3
|
+
import type Evented from '@ember/object/evented';
|
|
4
|
+
import type ActionHandler from '@ember/object/-private/action-handler';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Ember.CoreView is an abstract class that exists to give view-like behavior to both Ember's main
|
|
8
|
+
* view class Ember.Component and other classes that don't need the full functionality of Ember.Component.
|
|
9
|
+
*
|
|
10
|
+
* Unless you have specific needs for CoreView, you will use Ember.Component in your applications.
|
|
11
|
+
*/
|
|
12
|
+
export default class CoreView extends EmberObject {}
|
|
13
|
+
export default interface CoreView extends Evented, ActionHandler {}
|
|
14
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
declare module '@ember/component/-private/glimmer-interfaces' {
|
|
2
|
+
// NOTE: this is a bare-minimum subset of the definitions of the types in
|
|
3
|
+
// `@glimmer/interfaces`, supplied to make the public types in this package
|
|
4
|
+
// accurate.
|
|
5
|
+
|
|
6
|
+
// This is only present to "brand" the type, and it brands it in a way that
|
|
7
|
+
// matches [the implementation][1], which *also* uses it as a type-only brand.
|
|
8
|
+
//
|
|
9
|
+
// [1]: https://github.com/glimmerjs/glimmer-vm/blob/d6d776cf3797dafa923bcdad47e1897231ef6539/packages/%40glimmer/interfaces/lib/managers/capabilities.d.ts#L1
|
|
10
|
+
const CAPABILITIES: unique symbol;
|
|
11
|
+
|
|
12
|
+
export interface Capabilities {
|
|
13
|
+
[CAPABILITIES]: true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Arguments {
|
|
17
|
+
positional: readonly unknown[];
|
|
18
|
+
named: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ComponentCapabilitiesVersions {
|
|
22
|
+
'3.4': {
|
|
23
|
+
asyncLifecycleCallbacks?: boolean;
|
|
24
|
+
destructor?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
'3.13': {
|
|
28
|
+
asyncLifecycleCallbacks?: boolean;
|
|
29
|
+
destructor?: boolean;
|
|
30
|
+
updateHook?: boolean;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ComponentCapabilities extends Capabilities {
|
|
35
|
+
asyncLifeCycleCallbacks: boolean;
|
|
36
|
+
destructor: boolean;
|
|
37
|
+
updateHook: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ComponentManager<ComponentStateBucket> {
|
|
41
|
+
capabilities: ComponentCapabilities;
|
|
42
|
+
createComponent(factory: object, args: Arguments): ComponentStateBucket;
|
|
43
|
+
getContext(instance: ComponentStateBucket): unknown;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
declare module '@ember/component/-private/signature-utils' {
|
|
2
|
+
/**
|
|
3
|
+
* @module Type utilities for signatures
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Type-only "symbol" to use with `EmptyObject` below, so that it is *not*
|
|
7
|
+
// equivalent to an empty interface.
|
|
8
|
+
const Empty: unique symbol;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This provides us a way to have a "fallback" which represents an empty object,
|
|
12
|
+
* without the downsides of how TS treats `{}`. Specifically: this will
|
|
13
|
+
* correctly leverage "excess property checking" so that, given a component
|
|
14
|
+
* which has no named args, if someone invokes it with any named args, they will
|
|
15
|
+
* get a type error.
|
|
16
|
+
*
|
|
17
|
+
* @internal This is exported so declaration emit works (if it were not emitted,
|
|
18
|
+
* declarations which fall back to it would not work). It is *not* intended for
|
|
19
|
+
* public usage, and the specific mechanics it uses may change at any time.
|
|
20
|
+
* The location of this export *is* part of the public API, because moving it
|
|
21
|
+
* will break existing declarations, but is not legal for end users to import
|
|
22
|
+
* themselves, so ***DO NOT RELY ON IT***.
|
|
23
|
+
*/
|
|
24
|
+
export interface EmptyObject {
|
|
25
|
+
[Empty]?: true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type DefaultPositional = unknown[];
|
|
29
|
+
type DefaultNamed = EmptyObject;
|
|
30
|
+
|
|
31
|
+
type GetOrElse<Obj, K, Fallback> = K extends keyof Obj ? Obj[K] : Fallback;
|
|
32
|
+
|
|
33
|
+
/** Given a signature `S`, get back the `Args` type. */
|
|
34
|
+
type ArgsFor<S> = 'Args' extends keyof S
|
|
35
|
+
? {
|
|
36
|
+
Named: GetOrElse<S['Args'], 'Named', DefaultNamed>;
|
|
37
|
+
Positional: GetOrElse<S['Args'], 'Positional', []>;
|
|
38
|
+
}
|
|
39
|
+
: { Named: DefaultNamed; Positional: [] };
|
|
40
|
+
|
|
41
|
+
interface LegacyArgsFor<T> {
|
|
42
|
+
Named: GetOrElse<T, 'NamedArgs', DefaultNamed>;
|
|
43
|
+
Positional: GetOrElse<T, 'PositionalArgs', DefaultPositional>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// This type allows us to present a slightly-less-obtuse error message
|
|
47
|
+
// when attempting to resolve the signature of a helper that doesn't have
|
|
48
|
+
// one declared from within a tool like Glint.
|
|
49
|
+
const BadType: unique symbol;
|
|
50
|
+
/** @internal This is *only* exported to use in tests! */
|
|
51
|
+
export interface BadType<Message> {
|
|
52
|
+
[BadType]: Message;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface MissingSignatureArgs {
|
|
56
|
+
Named: BadType<'This helper is missing a signature'>;
|
|
57
|
+
Positional: unknown[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Given any allowed shorthand form of a signature, desugars it to its full
|
|
62
|
+
* expanded type.
|
|
63
|
+
*
|
|
64
|
+
* @internal This is only exported so we can avoid duplicating it in
|
|
65
|
+
* [Glint](https://github.com/typed-ember/glint) or other such tooling. It is
|
|
66
|
+
* *not* intended for public usage, and the specific mechanics it uses may
|
|
67
|
+
* change at any time. Although the signature produced by is part of Glimmer's
|
|
68
|
+
* public API the existence and mechanics of this specific symbol are *not*,
|
|
69
|
+
* so ***DO NOT RELY ON IT***.
|
|
70
|
+
*/
|
|
71
|
+
// This is similar but not identical to the `ExpandSignature` type used in the
|
|
72
|
+
// Glimmer Component API: it uses the same basic mechanics, but does not have
|
|
73
|
+
// an identical signature because we had not yet normalized the `Signature` when
|
|
74
|
+
// we designed the first pass of this. In the future, we will be able to make
|
|
75
|
+
// all `ExpandSignature` types fully general to work with *any* invokable. But
|
|
76
|
+
// "future" here probably means Ember v5. :sobbing:
|
|
77
|
+
// prettier-ignore
|
|
78
|
+
export interface ExpandSignature<T> {
|
|
79
|
+
Args:
|
|
80
|
+
// Is this the default (i.e. unspecified) signature?
|
|
81
|
+
// Then return our special "missing signature" type
|
|
82
|
+
unknown extends T ? MissingSignatureArgs :
|
|
83
|
+
// Is this a `Signature`? Then use `Signature` args
|
|
84
|
+
keyof T extends 'Args' | 'Return' ? ArgsFor<T> :
|
|
85
|
+
// Otherwise fall back to classic `Args`.
|
|
86
|
+
LegacyArgsFor<T>;
|
|
87
|
+
Return: 'Return' extends keyof T ? T['Return'] : unknown;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// The `unknown extends S` checks on both of these are here to preserve backward
|
|
91
|
+
// compatibility with the existing non-`Signature` definition. When migrating
|
|
92
|
+
// into Ember or otherwise making a breaking change, we can drop the "default"
|
|
93
|
+
// in favor of just using `ExpandSignature`.
|
|
94
|
+
// prettier-ignore
|
|
95
|
+
export type NamedArgs<S> =
|
|
96
|
+
unknown extends S
|
|
97
|
+
? Record<string, unknown>
|
|
98
|
+
: ExpandSignature<S>['Args']['Named'];
|
|
99
|
+
|
|
100
|
+
// prettier-ignore
|
|
101
|
+
export type PositionalArgs<S> =
|
|
102
|
+
unknown extends S
|
|
103
|
+
? unknown[]
|
|
104
|
+
: ExpandSignature<S>['Args']['Positional'];
|
|
105
|
+
|
|
106
|
+
export type Return<S> = GetOrElse<S, 'Return', unknown>;
|
|
107
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare module '@ember/component/-private/view-mixin' {
|
|
2
|
+
import Mixin from '@ember/object/mixin';
|
|
3
|
+
|
|
4
|
+
interface ViewMixin {
|
|
5
|
+
/**
|
|
6
|
+
* A list of properties of the view to apply as attributes. If the property
|
|
7
|
+
* is a string value, the value of that string will be applied as the value
|
|
8
|
+
* for an attribute of the property's name.
|
|
9
|
+
*/
|
|
10
|
+
attributeBindings: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current DOM element for the view.
|
|
13
|
+
*/
|
|
14
|
+
element: Element;
|
|
15
|
+
/**
|
|
16
|
+
* The HTML `id` of the view's element in the DOM. You can provide this
|
|
17
|
+
* value yourself but it must be unique (just as in HTML):
|
|
18
|
+
*/
|
|
19
|
+
elementId: string;
|
|
20
|
+
/**
|
|
21
|
+
* Tag name for the view's outer element. The tag name is only used when an
|
|
22
|
+
* element is first created. If you change the `tagName` for an element, you
|
|
23
|
+
* must destroy and recreate the view element.
|
|
24
|
+
*/
|
|
25
|
+
tagName: string;
|
|
26
|
+
/**
|
|
27
|
+
* Renders the view again. This will work regardless of whether the
|
|
28
|
+
* view is already in the DOM or not. If the view is in the DOM, the
|
|
29
|
+
* rendering process will be deferred to give bindings a chance
|
|
30
|
+
* to synchronize.
|
|
31
|
+
*/
|
|
32
|
+
rerender(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Called when a view is going to insert an element into the DOM.
|
|
35
|
+
*/
|
|
36
|
+
willInsertElement(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Called when the element of the view has been inserted into the DOM.
|
|
39
|
+
* Override this function to do any set up that requires an element
|
|
40
|
+
* in the document body.
|
|
41
|
+
*/
|
|
42
|
+
didInsertElement(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Called when the view is about to rerender, but before anything has
|
|
45
|
+
* been torn down. This is a good opportunity to tear down any manual
|
|
46
|
+
* observers you have installed based on the DOM state
|
|
47
|
+
*/
|
|
48
|
+
willClearRender(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Called when the element of the view is going to be destroyed. Override
|
|
51
|
+
* this function to do any teardown that requires an element, like removing
|
|
52
|
+
* event listeners.
|
|
53
|
+
*/
|
|
54
|
+
willDestroyElement(): void;
|
|
55
|
+
}
|
|
56
|
+
const ViewMixin: Mixin;
|
|
57
|
+
|
|
58
|
+
export default ViewMixin;
|
|
59
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
declare module '@ember/component/helper' {
|
|
2
|
+
import EmberObject from '@ember/object';
|
|
3
|
+
import { Opaque } from 'ember/-private/type-utils';
|
|
4
|
+
import {
|
|
5
|
+
DefaultNamed,
|
|
6
|
+
DefaultPositional,
|
|
7
|
+
EmptyObject,
|
|
8
|
+
ExpandSignature,
|
|
9
|
+
NamedArgs,
|
|
10
|
+
PositionalArgs,
|
|
11
|
+
Return,
|
|
12
|
+
} from '@ember/component/-private/signature-utils';
|
|
13
|
+
|
|
14
|
+
// Immediately re-export these.
|
|
15
|
+
export { EmptyObject, ExpandSignature };
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The public shape of a helper.
|
|
19
|
+
* @deprecated Do not use this directly. Instead, write a `Signature` with the
|
|
20
|
+
* "normal" signature shape: `Args: { Named: { ... }, Positional: [...] }`.
|
|
21
|
+
*/
|
|
22
|
+
export interface HelperSignature {
|
|
23
|
+
NamedArgs?: DefaultNamed;
|
|
24
|
+
PositionalArgs?: DefaultPositional;
|
|
25
|
+
Return?: unknown;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Ember Helpers are functions that can compute values, and are used in templates.
|
|
30
|
+
* For example, this code calls a helper named `format-currency`:
|
|
31
|
+
*/
|
|
32
|
+
export default class Helper<S = unknown> extends EmberObject {
|
|
33
|
+
/**
|
|
34
|
+
* In many cases, the ceremony of a full `Ember.Helper` class is not required.
|
|
35
|
+
* The `helper` method create pure-function helpers without instances. For
|
|
36
|
+
* example:
|
|
37
|
+
*/
|
|
38
|
+
static helper<P extends DefaultPositional, N = EmptyObject, R = unknown>(
|
|
39
|
+
helper: (positional: P, named: N) => R
|
|
40
|
+
): Helper<{ Args: { Positional: P; Named: N }; Return: R }>;
|
|
41
|
+
/**
|
|
42
|
+
* Override this function when writing a class-based helper.
|
|
43
|
+
*/
|
|
44
|
+
compute(positional: PositionalArgs<S>, named: NamedArgs<S>): Return<S>;
|
|
45
|
+
/**
|
|
46
|
+
* On a class-based helper, it may be useful to force a recomputation of that
|
|
47
|
+
* helpers value. This is akin to `rerender` on a component.
|
|
48
|
+
*/
|
|
49
|
+
recompute(): void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// The generic here is for a *signature*: a way to hang information for tools
|
|
53
|
+
// like Glint which can provide type checking for component templates using
|
|
54
|
+
// information supplied via this generic. While it may appear useless on this
|
|
55
|
+
// class definition and extension, it is used by external tools and should not
|
|
56
|
+
// be removed.
|
|
57
|
+
export default interface Helper<S> extends Opaque<S> {}
|
|
58
|
+
|
|
59
|
+
// This type exists to provide a non-user-constructible, non-subclassable
|
|
60
|
+
// type representing the conceptual "instance type" of a function helper.
|
|
61
|
+
// The abstract field of type `never` presents subclassing in userspace of
|
|
62
|
+
// the value returned from `helper()`. By extending `Helper<S>`, any
|
|
63
|
+
// augmentations of the `Helper` type performed by tools like Glint will
|
|
64
|
+
// also apply to function-based helpers as well.
|
|
65
|
+
export abstract class FunctionBasedHelperInstance<S> extends Helper<S> {
|
|
66
|
+
protected abstract __concrete__: never;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The type of a function-based helper.
|
|
71
|
+
*
|
|
72
|
+
* @note This is *not* user-constructible: it is exported only so that the type
|
|
73
|
+
* returned by the `helper` function can be named (and indeed can be exported
|
|
74
|
+
* like `export default helper(...)` safely).
|
|
75
|
+
*/
|
|
76
|
+
// Making `FunctionBasedHelper` a bare constructor type allows for type
|
|
77
|
+
// parameters to be preserved when `helper()` is passed a generic function.
|
|
78
|
+
// By making it `abstract` and impossible to subclass (see above), we prevent
|
|
79
|
+
// users from attempting to instantiate a return value from `helper()`.
|
|
80
|
+
export type FunctionBasedHelper<S> = abstract new () => FunctionBasedHelperInstance<S>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* In many cases, the ceremony of a full `Helper` class is not required.
|
|
84
|
+
* The `helper` method create pure-function helpers without instances. For
|
|
85
|
+
* example:
|
|
86
|
+
* ```app/helpers/format-currency.js
|
|
87
|
+
* import { helper } from '@ember/component/helper';
|
|
88
|
+
* export default helper(function(params, hash) {
|
|
89
|
+
* let cents = params[0];
|
|
90
|
+
* let currency = hash.currency;
|
|
91
|
+
* return `${currency}${cents * 0.01}`;
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
// This overload allows users to write types directly on the callback passed to
|
|
96
|
+
// the `helper` function and infer the resulting type correctly.
|
|
97
|
+
export function helper<P extends DefaultPositional, N = EmptyObject, R = unknown>(
|
|
98
|
+
helperFn: (positional: P, named: N) => R
|
|
99
|
+
): FunctionBasedHelper<{
|
|
100
|
+
Args: {
|
|
101
|
+
Positional: P;
|
|
102
|
+
Named: N;
|
|
103
|
+
};
|
|
104
|
+
Return: R;
|
|
105
|
+
}>;
|
|
106
|
+
|
|
107
|
+
// This overload allows users to provide a `Signature` type explicitly at the
|
|
108
|
+
// helper definition site, e.g. `helper<Sig>((pos, named) => {...})`. **Note:**
|
|
109
|
+
// this overload must appear second, since TS' inference engine will not
|
|
110
|
+
// correctly infer the type of `S` here from the types on the supplied callback.
|
|
111
|
+
export function helper<S>(
|
|
112
|
+
helperFn: (positional: PositionalArgs<S>, named: NamedArgs<S>) => Return<S>
|
|
113
|
+
): FunctionBasedHelper<{
|
|
114
|
+
Args: {
|
|
115
|
+
Positional: PositionalArgs<S>;
|
|
116
|
+
Named: NamedArgs<S>;
|
|
117
|
+
};
|
|
118
|
+
Return: Return<S>;
|
|
119
|
+
}>;
|
|
120
|
+
|
|
121
|
+
export {};
|
|
122
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
declare module '@ember/component' {
|
|
2
|
+
import CoreView from '@ember/component/-private/core-view';
|
|
3
|
+
import ClassNamesSupport from '@ember/component/-private/class-names-support';
|
|
4
|
+
import ViewMixin from '@ember/component/-private/view-mixin';
|
|
5
|
+
import { ComponentManager, Capabilities } from '@ember/component/-private/glimmer-interfaces';
|
|
6
|
+
import { Opaque } from 'ember/-private/type-utils';
|
|
7
|
+
|
|
8
|
+
// Re-export these types so people can use them!
|
|
9
|
+
export { ComponentManager, Capabilities };
|
|
10
|
+
|
|
11
|
+
interface TemplateFactory {
|
|
12
|
+
__htmlbars_inline_precompile_template_factory: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// The generic here is for a *signature: a way to hang information for tools
|
|
16
|
+
// like Glint which can provide typey checking for component templates using
|
|
17
|
+
// information supplied via this generic. While it may appear useless on this
|
|
18
|
+
// class definition and extension, it is used by external tools and should not
|
|
19
|
+
// be removed.
|
|
20
|
+
export default interface Component<S = unknown> extends ViewMixin, ClassNamesSupport, Opaque<S> {}
|
|
21
|
+
export default class Component<S = unknown> extends CoreView {
|
|
22
|
+
// methods
|
|
23
|
+
readDOMAttr(name: string): string;
|
|
24
|
+
// properties
|
|
25
|
+
/**
|
|
26
|
+
* The WAI-ARIA role of the control represented by this view. For example, a button may have a
|
|
27
|
+
* role of type 'button', or a pane may have a role of type 'alertdialog'. This property is
|
|
28
|
+
* used by assistive software to help visually challenged users navigate rich web applications.
|
|
29
|
+
*/
|
|
30
|
+
ariaRole: string;
|
|
31
|
+
/**
|
|
32
|
+
* The HTML id of the component's element in the DOM. You can provide this value yourself but
|
|
33
|
+
* it must be unique (just as in HTML):
|
|
34
|
+
*
|
|
35
|
+
* If not manually set a default value will be provided by the framework. Once rendered an
|
|
36
|
+
* element's elementId is considered immutable and you should never change it. If you need
|
|
37
|
+
* to compute a dynamic value for the elementId, you should do this when the component or
|
|
38
|
+
* element is being instantiated:
|
|
39
|
+
*/
|
|
40
|
+
elementId: string;
|
|
41
|
+
/**
|
|
42
|
+
* A component may contain a layout. A layout is a regular template but supersedes the template
|
|
43
|
+
* property during rendering. It is the responsibility of the layout template to retrieve the
|
|
44
|
+
* template property from the component (or alternatively, call Handlebars.helpers.yield,
|
|
45
|
+
* {{yield}}) to render it in the correct location. This is useful for a component that has a
|
|
46
|
+
* shared wrapper, but which delegates the rendering of the contents of the wrapper to the
|
|
47
|
+
* template property on a subclass.
|
|
48
|
+
*/
|
|
49
|
+
layout: TemplateFactory | string;
|
|
50
|
+
/**
|
|
51
|
+
* Enables components to take a list of parameters as arguments.
|
|
52
|
+
*/
|
|
53
|
+
static positionalParams: string[] | string;
|
|
54
|
+
// events
|
|
55
|
+
/**
|
|
56
|
+
* Called when the attributes passed into the component have been updated. Called both during the
|
|
57
|
+
* initial render of a container and during a rerender. Can be used in place of an observer; code
|
|
58
|
+
* placed here will be executed every time any attribute updates.
|
|
59
|
+
*/
|
|
60
|
+
didReceiveAttrs(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Called after a component has been rendered, both on initial render and in subsequent rerenders.
|
|
63
|
+
*/
|
|
64
|
+
didRender(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Called when the component has updated and rerendered itself. Called only during a rerender,
|
|
67
|
+
* not during an initial render.
|
|
68
|
+
*/
|
|
69
|
+
didUpdate(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Called when the attributes passed into the component have been changed. Called only during a
|
|
72
|
+
* rerender, not during an initial render.
|
|
73
|
+
*/
|
|
74
|
+
didUpdateAttrs(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Called before a component has been rendered, both on initial render and in subsequent rerenders.
|
|
77
|
+
*/
|
|
78
|
+
willRender(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Called when the component is about to update and rerender itself. Called only during a rerender,
|
|
81
|
+
* not during an initial render.
|
|
82
|
+
*/
|
|
83
|
+
willUpdate(): void;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* `reopen()` was deprecated and removed from `Component`. It is given an
|
|
87
|
+
* illegitimate type in these types so that you cannot call it or use it!
|
|
88
|
+
* Unfortunately, it cannot actually be *removed* from this type, because TS
|
|
89
|
+
* rightly complains that `Component` is no longer a valid subtype of the
|
|
90
|
+
* `EmberObject` base class, and will not let you use it.
|
|
91
|
+
*/
|
|
92
|
+
static reopen(): never;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Associate a class with a component manager (an object that is responsible for
|
|
97
|
+
* coordinating the lifecycle events that occurs when invoking, rendering and
|
|
98
|
+
* re-rendering a component).
|
|
99
|
+
*
|
|
100
|
+
* @param managerFactory a function to create the owner for an object
|
|
101
|
+
* @param object the object to associate with the componetn manager
|
|
102
|
+
* @return the same object passed in, now associated with the manager
|
|
103
|
+
*/
|
|
104
|
+
export function setComponentManager<T>(
|
|
105
|
+
managerFactory: (owner: unknown) => ComponentManager<unknown>,
|
|
106
|
+
object: T
|
|
107
|
+
): T;
|
|
108
|
+
|
|
109
|
+
// In normal TypeScript, these built-in components are essentially opaque tokens
|
|
110
|
+
// that just need to be importable. Declaring them with unique interfaces
|
|
111
|
+
// like this, however, gives tools like Glint (that DO have a richer
|
|
112
|
+
// notion of what they are) a place to install more detailed type information.
|
|
113
|
+
export interface Input extends Opaque<'component:input'> {}
|
|
114
|
+
export interface Textarea extends Opaque<'component:textarea'> {}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The `Input` component lets you create an HTML `<input>` element.
|
|
118
|
+
*
|
|
119
|
+
* @see https://api.emberjs.com/ember/4.1/classes/Ember.Templates.components/methods/Input?anchor=Input
|
|
120
|
+
*/
|
|
121
|
+
export const Input: Input;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The `Textarea` component inserts a new instance of `<textarea>` tag into the template.
|
|
125
|
+
*
|
|
126
|
+
* @see https://api.emberjs.com/ember/4.1/classes/Ember.Templates.components/methods/Textarea?anchor=Textarea
|
|
127
|
+
*/
|
|
128
|
+
export const Textarea: Textarea;
|
|
129
|
+
|
|
130
|
+
// Do not export anything but what we *explicitly* say to export.
|
|
131
|
+
export {};
|
|
132
|
+
}
|