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.
Files changed (244) hide show
  1. package/CHANGELOG.md +11 -2
  2. package/blueprints/helper/files/__root__/{__collection__ → helpers}/__name__.ts +0 -0
  3. package/blueprints/helper/index.js +0 -15
  4. package/blueprints/helper-test/index.js +0 -3
  5. package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  6. package/blueprints/helper-test/mocha-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  7. package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.ts +0 -0
  8. package/blueprints/helper-test/qunit-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  9. package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.ts +0 -0
  10. package/blueprints-js/helper/files/__root__/{__collection__ → helpers}/__name__.js +0 -0
  11. package/blueprints-js/helper-test/mocha-0.12-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  12. package/blueprints-js/helper-test/mocha-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  13. package/blueprints-js/helper-test/mocha-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  14. package/blueprints-js/helper-test/qunit-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  15. package/blueprints-js/helper-test/qunit-rfc-232-files/__root__/__testType__/{__collection__ → helpers}/__name__-test.js +0 -0
  16. package/build-metadata.json +3 -3
  17. package/dist/dependencies/router_js.js +1 -1
  18. package/dist/ember-template-compiler.js +675 -18
  19. package/dist/ember-template-compiler.map +1 -1
  20. package/dist/ember-testing.js +11 -11
  21. package/dist/ember-testing.map +1 -1
  22. package/dist/ember.debug.js +19576 -20510
  23. package/dist/ember.debug.map +1 -1
  24. package/dist/header/license.js +1 -1
  25. package/dist/packages/@ember/-internals/glimmer/index.js +4 -2
  26. package/dist/packages/@ember/-internals/metal/index.js +214 -1094
  27. package/dist/packages/@ember/-internals/routing/index.js +1 -17
  28. package/dist/packages/@ember/-internals/runtime/index.js +3 -16
  29. package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +2 -1
  30. package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -3
  31. package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +1 -1
  32. package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +1 -1
  33. package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +1 -8
  34. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +2 -1
  35. package/dist/packages/@ember/-internals/utils/index.js +3 -3
  36. package/dist/packages/@ember/-internals/views/lib/component_lookup.js +1 -1
  37. package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -1
  38. package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +2 -1
  39. package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +2 -1
  40. package/dist/packages/@ember/-internals/views/lib/mixins/view_state_support.js +1 -1
  41. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +2 -1
  42. package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +1 -1
  43. package/dist/packages/@ember/-internals/views/lib/views/core_view.js +3 -1
  44. package/dist/packages/@ember/application/index.js +876 -2
  45. package/dist/packages/@ember/application/instance.js +2 -2
  46. package/dist/packages/@ember/application/namespace.js +70 -1
  47. package/dist/packages/@ember/array/index.js +1503 -2
  48. package/dist/packages/@ember/array/mutable.js +1 -1
  49. package/dist/packages/@ember/array/proxy.js +307 -1
  50. package/dist/packages/@ember/canary-features/index.js +2 -2
  51. package/dist/packages/@ember/controller/index.js +260 -3
  52. package/dist/packages/@ember/debug/container-debug-adapter.js +99 -1
  53. package/dist/packages/@ember/debug/data-adapter.js +574 -1
  54. package/dist/packages/@ember/engine/index.js +5 -5
  55. package/dist/packages/@ember/engine/instance.js +4 -4
  56. package/dist/packages/@ember/enumerable/index.js +3 -1
  57. package/dist/packages/@ember/enumerable/mutable.js +4 -0
  58. package/dist/packages/@ember/{-internals/runtime/lib/system/object.js → object/-internals.js} +4 -17
  59. package/dist/packages/@ember/object/core.js +731 -1
  60. package/dist/packages/@ember/object/evented.js +93 -2
  61. package/dist/packages/@ember/object/index.js +76 -4
  62. package/dist/packages/@ember/object/internals.js +3 -2
  63. package/dist/packages/@ember/object/lib/computed/computed_macros.js +3 -1
  64. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +4 -3
  65. package/dist/packages/@ember/object/mixin.js +659 -1
  66. package/dist/packages/@ember/object/observable.js +341 -1
  67. package/dist/packages/@ember/object/promise-proxy-mixin.js +150 -1
  68. package/dist/packages/@ember/object/proxy.js +10 -1
  69. package/dist/packages/@ember/routing/-internals.js +7 -0
  70. package/dist/packages/@ember/routing/auto-location.js +249 -1
  71. package/dist/packages/@ember/routing/hash-location.js +169 -1
  72. package/dist/packages/@ember/routing/history-location.js +289 -1
  73. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/cache.js +0 -0
  74. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/controller_for.js +0 -0
  75. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/dsl.js +0 -0
  76. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/engines.js +0 -0
  77. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/generate_controller.js +0 -0
  78. package/dist/packages/@ember/{-internals/routing/lib/location/util.js → routing/lib/location-utils.js} +0 -0
  79. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/query_params.js +0 -0
  80. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/route-info.js +0 -0
  81. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/router_state.js +1 -1
  82. package/dist/packages/@ember/{-internals/routing/lib/services/routing.js → routing/lib/routing-service.js} +2 -2
  83. package/dist/packages/@ember/{-internals/routing/lib/system → routing/lib}/transition.js +0 -0
  84. package/dist/packages/@ember/{-internals/routing → routing}/lib/utils.js +0 -0
  85. package/dist/packages/@ember/routing/location.js +104 -1
  86. package/dist/packages/@ember/routing/none-location.js +123 -1
  87. package/dist/packages/@ember/routing/route.js +1700 -1
  88. package/dist/packages/@ember/routing/router-service.js +510 -1
  89. package/dist/packages/@ember/routing/router.js +1666 -1
  90. package/dist/packages/@ember/service/index.js +1 -1
  91. package/dist/packages/@ember/utils/index.js +7 -2
  92. package/dist/packages/@ember/{-internals/runtime → utils}/lib/compare.js +2 -2
  93. package/dist/packages/@ember/{-internals/runtime → utils}/lib/is-equal.js +0 -0
  94. package/dist/packages/@ember/utils/lib/is_blank.js +35 -0
  95. package/dist/packages/@ember/utils/lib/is_empty.js +68 -0
  96. package/dist/packages/@ember/utils/lib/is_none.js +27 -0
  97. package/dist/packages/@ember/utils/lib/is_present.js +38 -0
  98. package/dist/packages/@ember/{-internals/runtime → utils}/lib/type-of.js +2 -2
  99. package/dist/packages/ember/index.js +47 -28
  100. package/dist/packages/ember/version.js +1 -1
  101. package/dist/packages/ember-testing/lib/adapters/adapter.js +1 -1
  102. package/dist/packages/ember-testing/lib/helpers/current_path.js +2 -2
  103. package/dist/packages/ember-testing/lib/helpers/current_route_name.js +2 -2
  104. package/dist/packages/ember-testing/lib/helpers/current_url.js +1 -1
  105. package/docs/data.json +9428 -9189
  106. package/package.json +23 -8
  107. package/types/preview/@ember/-internals/resolver.d.ts +35 -0
  108. package/types/preview/@ember/application/-private/event-dispatcher.d.ts +18 -0
  109. package/types/preview/@ember/application/-private/registry.d.ts +15 -0
  110. package/types/preview/@ember/application/deprecations.d.ts +24 -0
  111. package/types/preview/@ember/application/index.d.ts +153 -0
  112. package/types/preview/@ember/application/instance.d.ts +9 -0
  113. package/types/preview/@ember/application/tsconfig.json +3 -0
  114. package/types/preview/@ember/application/types.d.ts +29 -0
  115. package/types/preview/@ember/array/-private/enumerable.d.ts +13 -0
  116. package/types/preview/@ember/array/-private/mutable-enumerable.d.ts +13 -0
  117. package/types/preview/@ember/array/-private/native-array.d.ts +23 -0
  118. package/types/preview/@ember/array/index.d.ts +243 -0
  119. package/types/preview/@ember/array/mutable.d.ts +94 -0
  120. package/types/preview/@ember/array/proxy.d.ts +29 -0
  121. package/types/preview/@ember/array/tsconfig.json +3 -0
  122. package/types/preview/@ember/component/-private/class-names-support.d.ts +27 -0
  123. package/types/preview/@ember/component/-private/core-view.d.ts +14 -0
  124. package/types/preview/@ember/component/-private/glimmer-interfaces.d.ts +45 -0
  125. package/types/preview/@ember/component/-private/signature-utils.d.ts +107 -0
  126. package/types/preview/@ember/component/-private/view-mixin.d.ts +59 -0
  127. package/types/preview/@ember/component/helper.d.ts +122 -0
  128. package/types/preview/@ember/component/index.d.ts +132 -0
  129. package/types/preview/@ember/component/template-only.d.ts +47 -0
  130. package/types/preview/@ember/component/tsconfig.json +3 -0
  131. package/types/preview/@ember/controller/index.d.ts +48 -0
  132. package/types/preview/@ember/controller/tsconfig.json +3 -0
  133. package/types/preview/@ember/debug/container-debug-adapter.d.ts +13 -0
  134. package/types/preview/@ember/debug/data-adapter.d.ts +64 -0
  135. package/types/preview/@ember/debug/index.d.ts +98 -0
  136. package/types/preview/@ember/debug/tsconfig.json +3 -0
  137. package/types/preview/@ember/destroyable/index.d.ts +23 -0
  138. package/types/preview/@ember/destroyable/tsconfig.json +3 -0
  139. package/types/preview/@ember/engine/-private/container-proxy-mixin.d.ts +17 -0
  140. package/types/preview/@ember/engine/-private/registry-proxy-mixin.d.ts +54 -0
  141. package/types/preview/@ember/engine/-private/types/initializer.d.ts +8 -0
  142. package/types/preview/@ember/engine/index.d.ts +45 -0
  143. package/types/preview/@ember/engine/instance.d.ts +24 -0
  144. package/types/preview/@ember/engine/tsconfig.json +3 -0
  145. package/types/preview/@ember/error/index.d.ts +6 -0
  146. package/types/preview/@ember/error/tsconfig.json +3 -0
  147. package/types/preview/@ember/helper/index.d.ts +49 -0
  148. package/types/preview/@ember/helper/tsconfig.json +3 -0
  149. package/types/preview/@ember/modifier/index.d.ts +33 -0
  150. package/types/preview/@ember/modifier/tsconfig.json +3 -0
  151. package/types/preview/@ember/object/-private/action-handler.d.ts +31 -0
  152. package/types/preview/@ember/object/-private/types.d.ts +63 -0
  153. package/types/preview/@ember/object/compat.d.ts +9 -0
  154. package/types/preview/@ember/object/computed.d.ts +263 -0
  155. package/types/preview/@ember/object/core.d.ts +89 -0
  156. package/types/preview/@ember/object/evented.d.ts +45 -0
  157. package/types/preview/@ember/object/events.d.ts +47 -0
  158. package/types/preview/@ember/object/index.d.ts +126 -0
  159. package/types/preview/@ember/object/internals.d.ts +17 -0
  160. package/types/preview/@ember/object/mixin.d.ts +19 -0
  161. package/types/preview/@ember/object/observable.d.ts +89 -0
  162. package/types/preview/@ember/object/observers.d.ts +34 -0
  163. package/types/preview/@ember/object/promise-proxy-mixin.d.ts +37 -0
  164. package/types/preview/@ember/object/proxy.d.ts +27 -0
  165. package/types/preview/@ember/object/tsconfig.json +3 -0
  166. package/types/preview/@ember/owner/index.d.ts +102 -0
  167. package/types/preview/@ember/owner/tsconfig.json +3 -0
  168. package/types/preview/@ember/polyfills/index.d.ts +23 -0
  169. package/types/preview/@ember/polyfills/tsconfig.json +3 -0
  170. package/types/preview/@ember/polyfills/types.d.ts +6 -0
  171. package/types/preview/@ember/routing/-private/router-dsl.d.ts +20 -0
  172. package/types/preview/@ember/routing/auto-location.d.ts +8 -0
  173. package/types/preview/@ember/routing/hash-location.d.ts +10 -0
  174. package/types/preview/@ember/routing/history-location.d.ts +9 -0
  175. package/types/preview/@ember/routing/index.d.ts +20 -0
  176. package/types/preview/@ember/routing/none-location.d.ts +11 -0
  177. package/types/preview/@ember/routing/route-info.d.ts +74 -0
  178. package/types/preview/@ember/routing/route.d.ts +533 -0
  179. package/types/preview/@ember/routing/router-service.d.ts +351 -0
  180. package/types/preview/@ember/routing/router.d.ts +49 -0
  181. package/types/preview/@ember/routing/transition.d.ts +126 -0
  182. package/types/preview/@ember/routing/tsconfig.json +3 -0
  183. package/types/preview/@ember/routing/types.d.ts +15 -0
  184. package/types/preview/@ember/runloop/-private/backburner.d.ts +43 -0
  185. package/types/preview/@ember/runloop/-private/types.d.ts +9 -0
  186. package/types/preview/@ember/runloop/index.d.ts +175 -0
  187. package/types/preview/@ember/runloop/tsconfig.json +3 -0
  188. package/types/preview/@ember/runloop/types.d.ts +5 -0
  189. package/types/preview/@ember/service/index.d.ts +25 -0
  190. package/types/preview/@ember/service/tsconfig.json +3 -0
  191. package/types/preview/@ember/string/index.d.ts +9 -0
  192. package/types/preview/@ember/string/tsconfig.json +3 -0
  193. package/types/preview/@ember/template/-private/handlebars.d.ts +7 -0
  194. package/types/preview/@ember/template/index.d.ts +5 -0
  195. package/types/preview/@ember/template/tsconfig.json +3 -0
  196. package/types/preview/@ember/test/adapter.d.ts +22 -0
  197. package/types/preview/@ember/test/index.d.ts +49 -0
  198. package/types/preview/@ember/test/tsconfig.json +3 -0
  199. package/types/preview/@ember/utils/-private/types.d.ts +39 -0
  200. package/types/preview/@ember/utils/index.d.ts +42 -0
  201. package/types/preview/@ember/utils/tsconfig.json +3 -0
  202. package/types/preview/ember/-private/type-utils.d.ts +54 -0
  203. package/types/preview/ember/index.d.ts +381 -0
  204. package/types/preview/ember/tsconfig.json +3 -0
  205. package/types/preview/index.d.ts +120 -0
  206. package/types/preview/tsconfig.json +6 -0
  207. package/blueprints/helper/mu-files/__root__/__collection__/__name__.js +0 -7
  208. package/blueprints-js/helper/mu-files/__root__/__collection__/__name__.js +0 -7
  209. package/dist/packages/@ember/-internals/extension-support/index.js +0 -2
  210. package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +0 -96
  211. package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +0 -576
  212. package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +0 -224
  213. package/dist/packages/@ember/-internals/routing/lib/location/api.js +0 -104
  214. package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +0 -250
  215. package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +0 -170
  216. package/dist/packages/@ember/-internals/routing/lib/location/history_location.js +0 -290
  217. package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +0 -124
  218. package/dist/packages/@ember/-internals/routing/lib/services/router.js +0 -506
  219. package/dist/packages/@ember/-internals/routing/lib/system/route.js +0 -1696
  220. package/dist/packages/@ember/-internals/routing/lib/system/router.js +0 -1662
  221. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +0 -1501
  222. package/dist/packages/@ember/-internals/runtime/lib/mixins/enumerable.js +0 -3
  223. package/dist/packages/@ember/-internals/runtime/lib/mixins/evented.js +0 -91
  224. package/dist/packages/@ember/-internals/runtime/lib/mixins/mutable_enumerable.js +0 -4
  225. package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +0 -339
  226. package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +0 -149
  227. package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +0 -305
  228. package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +0 -730
  229. package/dist/packages/@ember/-internals/runtime/lib/system/namespace.js +0 -69
  230. package/dist/packages/@ember/-internals/runtime/lib/system/object_proxy.js +0 -7
  231. package/dist/packages/@ember/application/lib/application.js +0 -870
  232. package/dist/packages/@ember/controller/lib/controller_mixin.js +0 -42
  233. package/dist/packages/@ember/runloop/type-tests.ts/begin-end.test.js +0 -5
  234. package/dist/packages/@ember/runloop/type-tests.ts/bind.test.js +0 -59
  235. package/dist/packages/@ember/runloop/type-tests.ts/cancel.test.js +0 -5
  236. package/dist/packages/@ember/runloop/type-tests.ts/debounce.test.js +0 -77
  237. package/dist/packages/@ember/runloop/type-tests.ts/join.test.js +0 -38
  238. package/dist/packages/@ember/runloop/type-tests.ts/later.test.js +0 -38
  239. package/dist/packages/@ember/runloop/type-tests.ts/next.test.js +0 -38
  240. package/dist/packages/@ember/runloop/type-tests.ts/once.test.js +0 -38
  241. package/dist/packages/@ember/runloop/type-tests.ts/run.test.js +0 -38
  242. package/dist/packages/@ember/runloop/type-tests.ts/schedule-once.test.js +0 -39
  243. package/dist/packages/@ember/runloop/type-tests.ts/schedule.test.js +0 -39
  244. package/dist/packages/@ember/runloop/type-tests.ts/throttle.test.js +0 -77
@@ -0,0 +1,63 @@
1
+ declare module '@ember/object/-private/types' {
2
+ import type Mixin from '@ember/object/mixin';
3
+
4
+ /**
5
+ * Map type `T` to a plain object hash with the identity mapping.
6
+ *
7
+ * Discards any additional object identity like the ability to `new()` up the class.
8
+ * The `new()` capability is added back later by merging `EmberClassConstructor<T>`
9
+ *
10
+ * Implementation is carefully chosen for the reasons described in
11
+ * https://github.com/typed-ember/ember-typings/pull/29
12
+ */
13
+ export type Objectify<T> = Readonly<T>;
14
+
15
+ export type ExtractPropertyNamesOfType<T, S> = {
16
+ [K in keyof T]: T[K] extends S ? K : never;
17
+ }[keyof T];
18
+
19
+ export type Fix<T> = { [K in keyof T]: T[K] };
20
+
21
+ /**
22
+ * Used to infer the type of ember classes of type `T`.
23
+ *
24
+ * Generally you would use `EmberClass.create()` instead of `new EmberClass()`.
25
+ *
26
+ * The single-arg constructor is required by the typescript compiler.
27
+ * The multi-arg constructor is included for better ergonomics.
28
+ *
29
+ * Implementation is carefully chosen for the reasons described in
30
+ * https://github.com/typed-ember/ember-typings/pull/29
31
+ */
32
+ export type EmberClassConstructor<T> = (new (properties?: object) => T) &
33
+ (new (...args: any[]) => T);
34
+
35
+ /**
36
+ * Check that any arguments to `create()` match the type's properties.
37
+ *
38
+ * Accept any additional properties and add merge them into the instance.
39
+ */
40
+ export type EmberInstanceArguments<T> = Partial<T> & {
41
+ [key: string]: unknown;
42
+ };
43
+
44
+ /**
45
+ * Accept any additional properties and add merge them into the prototype.
46
+ */
47
+ export interface EmberClassArguments {
48
+ [key: string]: unknown;
49
+ }
50
+
51
+ /**
52
+ * Ember.Object.extend(...) accepts any number of mixins or literals.
53
+ */
54
+ export type MixinOrLiteral<T> = Mixin | T;
55
+
56
+ export type ObserverMethod<Target, Sender> =
57
+ | keyof Target
58
+ | ((this: Target, sender: Sender, key: string, value: any, rev: number) => void);
59
+
60
+ // This type looks weird, but is correct: from a list of "bottom" to "top", in
61
+ // type theory terms.
62
+ export type AnyFunction = (...args: never[]) => unknown;
63
+ }
@@ -0,0 +1,9 @@
1
+ declare module '@ember/object/compat' {
2
+ /**
3
+ * `@dependentKeyCompat` is a decorator that can be used on native getters that
4
+ * use tracked properties. It exposes the getter to Ember's classic computed
5
+ * property and observer systems, so they can watch it for changes. It can be
6
+ * used in both native and classic classes.
7
+ */
8
+ export const dependentKeyCompat: PropertyDecorator;
9
+ }
@@ -0,0 +1,263 @@
1
+ declare module '@ember/object/computed' {
2
+ /**
3
+ * A computed property transforms an objects function into a property.
4
+ * By default the function backing the computed property will only be called once and the result
5
+ * will be cached. You can specify various properties that your computed property is dependent on.
6
+ * This will force the cached result to be recomputed if the dependencies are modified.
7
+ */
8
+ export default class ComputedProperty {
9
+ /**
10
+ * Call on a computed property to set it into read-only mode. When in this
11
+ * mode the computed property will throw an error when set.
12
+ */
13
+ readOnly(): this;
14
+ /**
15
+ * In some cases, you may want to annotate computed properties with additional
16
+ * metadata about how they function or what values they operate on. For example,
17
+ * computed property functions may close over variables that are then no longer
18
+ * available for introspection.
19
+ */
20
+ meta(meta: Record<string, unknown>): this;
21
+ meta(): Record<string, unknown>;
22
+ }
23
+
24
+ // Computed property definitions also act as property decorators, including those
25
+ // returned from "macros" in third-party code.
26
+ export type BasicComputedProperty = ComputedProperty & PropertyDecorator;
27
+
28
+ /**
29
+ * Creates a new property that is an alias for another property
30
+ * on an object. Calls to `get` or `set` this property behave as
31
+ * though they were called on the original property.
32
+ */
33
+ export function alias(dependentKey: string): BasicComputedProperty;
34
+ /**
35
+ * A computed property that performs a logical `and` on the
36
+ * original values for the provided dependent properties.
37
+ */
38
+ export function and(...dependentKeys: string[]): BasicComputedProperty;
39
+ /**
40
+ * A computed property that converts the provided dependent property
41
+ * into a boolean value.
42
+ */
43
+ export function bool(dependentKey: string): BasicComputedProperty;
44
+
45
+ /**
46
+ * A computed property that returns the array of values
47
+ * for the provided dependent properties.
48
+ */
49
+ export function collect(...dependentKeys: string[]): BasicComputedProperty;
50
+
51
+ /**
52
+ * Creates a new property that is an alias for another property
53
+ * on an object. Calls to `get` or `set` this property behave as
54
+ * though they were called on the original property, but also
55
+ * print a deprecation warning.
56
+ */
57
+ export function deprecatingAlias(
58
+ dependentKey: string,
59
+ options: { id: string; until: string }
60
+ ): BasicComputedProperty;
61
+
62
+ /**
63
+ * A computed property that returns true if the value of the dependent
64
+ * property is null, an empty string, empty array, or empty function.
65
+ */
66
+ export function empty(dependentKey: string): BasicComputedProperty;
67
+ /**
68
+ * A computed property that returns true if the provided dependent property
69
+ * is equal to the given value.
70
+ */
71
+ export function equal(dependentKey: string, value: unknown): BasicComputedProperty;
72
+ /**
73
+ * Expands `pattern`, invoking `callback` for each expansion.
74
+ */
75
+ export function expandProperties(pattern: string, callback: (expanded: string) => void): void;
76
+
77
+ /**
78
+ * Filters the array by the callback.
79
+ */
80
+ export function filter(
81
+ dependentKey: string,
82
+ callback: (value: unknown, index: number, array: unknown[]) => boolean
83
+ ): BasicComputedProperty;
84
+
85
+ /**
86
+ * Filters the array by the callback and an array of additional dependent keys.
87
+ */
88
+ export function filter(
89
+ dependentKey: string,
90
+ additionalDependentKeys: string[],
91
+ callback: (value: unknown, index: number, array: unknown[]) => boolean
92
+ ): BasicComputedProperty;
93
+
94
+ /**
95
+ * Filters the array by the property and value
96
+ */
97
+ export function filterBy(
98
+ dependentKey: string,
99
+ propertyKey: string,
100
+ value?: unknown
101
+ ): BasicComputedProperty;
102
+
103
+ /**
104
+ * A computed property that returns true if the provided dependent property
105
+ * is greater than the provided value.
106
+ */
107
+ export function gt(dependentKey: string, value: number): BasicComputedProperty;
108
+ /**
109
+ * A computed property that returns true if the provided dependent property
110
+ * is greater than or equal to the provided value.
111
+ */
112
+ export function gte(dependentKey: string, value: number): BasicComputedProperty;
113
+
114
+ /**
115
+ * A computed property which returns a new array with all the elements
116
+ * two or more dependent arrays have in common.
117
+ */
118
+ export function intersect(...propertyKeys: string[]): BasicComputedProperty;
119
+
120
+ /**
121
+ * A computed property that returns true if the provided dependent property
122
+ * is less than the provided value.
123
+ */
124
+ export function lt(dependentKey: string, value: number): BasicComputedProperty;
125
+ /**
126
+ * A computed property that returns true if the provided dependent property
127
+ * is less than or equal to the provided value.
128
+ */
129
+ export function lte(dependentKey: string, value: number): BasicComputedProperty;
130
+
131
+ /**
132
+ * Returns an array mapped via the callback
133
+ */
134
+ export function map(
135
+ dependentKey: string,
136
+ callback: (value: unknown, index: number, array: unknown[]) => unknown
137
+ ): BasicComputedProperty;
138
+
139
+ /**
140
+ * Returns an array mapped to the specified key.
141
+ */
142
+ export function mapBy(dependentKey: string, propertyKey: string): BasicComputedProperty;
143
+
144
+ /**
145
+ * A computed property which matches the original value for the
146
+ * dependent property against a given RegExp, returning `true`
147
+ * if the value matches the RegExp and `false` if it does not.
148
+ */
149
+ export function match(dependentKey: string, regexp: RegExp): BasicComputedProperty;
150
+
151
+ /**
152
+ * A computed property that calculates the maximum value in the
153
+ * dependent array. This will return `-Infinity` when the dependent
154
+ * array is empty.
155
+ */
156
+ export function max(dependentKey: string): BasicComputedProperty;
157
+
158
+ /**
159
+ * A computed property that calculates the minimum value in the
160
+ * dependent array. This will return `Infinity` when the dependent
161
+ * array is empty.
162
+ */
163
+ export function min(dependentKey: string): BasicComputedProperty;
164
+
165
+ /**
166
+ * A computed property that returns true if the value of the dependent
167
+ * property is null or undefined. This avoids errors from JSLint complaining
168
+ * about use of ==, which can be technically confusing.
169
+ */
170
+ export function none(dependentKey: string): BasicComputedProperty;
171
+ /**
172
+ * A computed property that returns the inverse boolean value
173
+ * of the original value for the dependent property.
174
+ */
175
+ export function not(dependentKey: string): BasicComputedProperty;
176
+ /**
177
+ * A computed property that returns true if the value of the dependent
178
+ * property is NOT null, an empty string, empty array, or empty function.
179
+ */
180
+ export function notEmpty(dependentKey: string): BasicComputedProperty;
181
+ /**
182
+ * Where `computed.alias` aliases `get` and `set`, and allows for bidirectional
183
+ * data flow, `computed.oneWay` only provides an aliased `get`. The `set` will
184
+ * not mutate the upstream property, rather causes the current property to
185
+ * become the value set. This causes the downstream property to permanently
186
+ * diverge from the upstream property.
187
+ */
188
+ export function oneWay(dependentKey: string): BasicComputedProperty;
189
+ /**
190
+ * A computed property which performs a logical `or` on the
191
+ * original values for the provided dependent properties.
192
+ */
193
+ export function or(...dependentKeys: string[]): BasicComputedProperty;
194
+ /**
195
+ * Where `computed.oneWay` provides oneWay bindings, `computed.readOnly` provides
196
+ * a readOnly one way binding. Very often when using `computed.oneWay` one does
197
+ * not also want changes to propagate back up, as they will replace the value.
198
+ */
199
+ export function readOnly(dependentKey: string): BasicComputedProperty;
200
+ /**
201
+ * This is a more semantically meaningful alias of `computed.oneWay`,
202
+ * whose name is somewhat ambiguous as to which direction the data flows.
203
+ */
204
+ export function reads(dependentKey: string): BasicComputedProperty;
205
+
206
+ /**
207
+ * A computed property which returns a new array with all the
208
+ * properties from the first dependent array that are not in the second
209
+ * dependent array.
210
+ */
211
+ export function setDiff(setAProperty: string, setBProperty: string): BasicComputedProperty;
212
+
213
+ /**
214
+ * A computed property which returns a new array with all the properties from
215
+ * the first dependent array sorted based on a property or sort function.
216
+ *
217
+ * If used with an array of sort properties, it must receive exactly two
218
+ * arguments: the key of the array to sort, and the key of the array of sort
219
+ * properties. Alternatively the key of the array to sort, and a the sort
220
+ * function may be used.
221
+ */
222
+ export function sort<T>(
223
+ itemsKey: string,
224
+ sortDefinition: string | ((itemA: T, itemB: T) => number)
225
+ ): BasicComputedProperty;
226
+
227
+ /**
228
+ * A computed property which returns a new array with all the properties from
229
+ * the first dependent array sorted based on a property or sort function.
230
+ *
231
+ * It may receive three arguments: the key of the array to sort, an array of
232
+ * dependent keys for the computed property, and the sort function.
233
+ */
234
+ export function sort<T>(
235
+ itemsKey: string,
236
+ dependentKeys: string[],
237
+ sortDefinition: string | ((itemA: T, itemB: T) => number)
238
+ ): BasicComputedProperty;
239
+
240
+ /**
241
+ * A computed property that returns the sum of the values
242
+ * in the dependent array.
243
+ */
244
+ export function sum(dependentKey: string): BasicComputedProperty;
245
+
246
+ /**
247
+ * A computed property which returns a new array with all the unique
248
+ * elements from one or more dependent arrays.
249
+ */
250
+ export function uniq(propertyKey: string): BasicComputedProperty;
251
+
252
+ /**
253
+ * A computed property which returns a new array with all the unique
254
+ * elements from one or more dependent arrays.
255
+ */
256
+ export function union(...propertyKeys: string[]): BasicComputedProperty;
257
+
258
+ /**
259
+ * A computed property which returns a new array with all the unique
260
+ * elements from an array, with uniqueness determined by specific key.
261
+ */
262
+ export function uniqBy(dependentKey: string, propertyKey: string): BasicComputedProperty;
263
+ }
@@ -0,0 +1,89 @@
1
+ declare module '@ember/object/core' {
2
+ import type { EmberClassConstructor, Objectify } from '@ember/object/-private/types';
3
+ import type Mixin from '@ember/object/mixin';
4
+
5
+ export default class CoreObject {
6
+ /**
7
+ * As of Ember 3.1, CoreObject constructor takes initial object properties as an argument.
8
+ * See: https://github.com/emberjs/ember.js/commit/4709935854d4c29b0d2c054614d53fa2c55309b1
9
+ */
10
+ constructor(properties?: object);
11
+
12
+ _super(...args: any[]): any;
13
+
14
+ /**
15
+ * An overridable method called when objects are instantiated. By default,
16
+ * does nothing unless it is overridden during class definition.
17
+ */
18
+ init(): void;
19
+
20
+ /**
21
+ * Defines the properties that will be concatenated from the superclass (instead of overridden).
22
+ * @default null
23
+ */
24
+ concatenatedProperties: string[] | null;
25
+
26
+ /**
27
+ * Destroyed object property flag. If this property is true the observers and bindings were
28
+ * already removed by the effect of calling the destroy() method.
29
+ * @default false
30
+ */
31
+ isDestroyed: boolean;
32
+ /**
33
+ * Destruction scheduled flag. The destroy() method has been called. The object stays intact
34
+ * until the end of the run loop at which point the isDestroyed flag is set.
35
+ * @default false
36
+ */
37
+ isDestroying: boolean;
38
+
39
+ /**
40
+ * Destroys an object by setting the `isDestroyed` flag and removing its
41
+ * metadata, which effectively destroys observers and bindings.
42
+ * If you try to set a property on a destroyed object, an exception will be
43
+ * raised.
44
+ * Note that destruction is scheduled for the end of the run loop and does not
45
+ * happen immediately. It will set an isDestroying flag immediately.
46
+ * @return receiver
47
+ */
48
+ destroy(): CoreObject;
49
+
50
+ /**
51
+ * Override to implement teardown.
52
+ */
53
+ willDestroy(): void;
54
+
55
+ /**
56
+ * Returns a string representation which attempts to provide more information than Javascript's toString
57
+ * typically does, in a generic way for all Ember objects (e.g., "<App.Person:ember1024>").
58
+ * @return string representation
59
+ */
60
+ toString(): string;
61
+
62
+ static create<Class extends typeof CoreObject>(
63
+ this: Class,
64
+ ...initialValues: Array<Mixin | MembersOf<Class>>
65
+ ): InstanceType<Class>;
66
+
67
+ static extend<Statics, Instance>(
68
+ this: Statics & EmberClassConstructor<Instance>,
69
+ ...mixins: Array<Mixin | Record<string, unknown>>
70
+ ): Objectify<Statics> & EmberClassConstructor<Instance>;
71
+
72
+ static reopen<Statics, Instance>(
73
+ this: Statics & EmberClassConstructor<Instance>,
74
+ ...mixins: Array<Mixin | Record<string, unknown>>
75
+ ): Objectify<Statics> & EmberClassConstructor<Instance>;
76
+
77
+ static reopenClass<Statics>(
78
+ this: Statics,
79
+ ...extraStatics: Array<Mixin | Record<string, unknown>>
80
+ ): Statics;
81
+
82
+ static isClass: boolean;
83
+ static isMethod: boolean;
84
+ }
85
+
86
+ type MembersOf<Class extends typeof CoreObject> = {
87
+ [Key in keyof InstanceType<Class>]?: InstanceType<Class>[Key];
88
+ };
89
+ }
@@ -0,0 +1,45 @@
1
+ declare module '@ember/object/evented' {
2
+ import Mixin from '@ember/object/mixin';
3
+ import { AnyFn, EmberMethod } from 'ember/-private/type-utils';
4
+
5
+ /**
6
+ * This mixin allows for Ember objects to subscribe to and emit events.
7
+ */
8
+ interface Evented {
9
+ /**
10
+ * Subscribes to a named event with given function.
11
+ */
12
+ on<T>(name: string, target: T, method: EmberMethod<T>): this;
13
+ on(name: string, method: EmberMethod<this>): this;
14
+ /**
15
+ * Subscribes a function to a named event and then cancels the subscription
16
+ * after the first time the event is triggered. It is good to use ``one`` when
17
+ * you only care about the first time an event has taken place.
18
+ */
19
+ one<T>(name: string, target: T, method: EmberMethod<T>): this;
20
+ one(name: string, method: EmberMethod<this>): this;
21
+ /**
22
+ * Triggers a named event for the object. Any additional arguments
23
+ * will be passed as parameters to the functions that are subscribed to the
24
+ * event.
25
+ */
26
+ trigger(name: string, ...args: unknown[]): unknown;
27
+ /**
28
+ * Cancels subscription for given name, target, and method.
29
+ */
30
+ off<T>(name: string, target: T, method: EmberMethod<T>): this;
31
+ off(name: string, method: EmberMethod<this>): this;
32
+ /**
33
+ * Checks to see if object has any subscriptions for named event.
34
+ */
35
+ has(name: string): boolean;
36
+ }
37
+ const Evented: Mixin;
38
+ export default Evented;
39
+
40
+ /**
41
+ * Define a property as a function that should be executed when
42
+ * a specified event or events are triggered.
43
+ */
44
+ export function on<F extends AnyFn>(...args: [...eventNames: string[], func: F]): F;
45
+ }
@@ -0,0 +1,47 @@
1
+ declare module '@ember/object/events' {
2
+ import { AnyFunction } from '@ember/object/-private/types';
3
+
4
+ /**
5
+ * Add an event listener
6
+ */
7
+ export function addListener<Context>(
8
+ obj: Context,
9
+ eventName: string,
10
+ target: unknown,
11
+ method: keyof Context | AnyFunction,
12
+ once?: boolean
13
+ ): void;
14
+ export function addListener<Context>(
15
+ obj: Context,
16
+ eventName: string,
17
+ method: keyof Context | AnyFunction,
18
+ once?: boolean
19
+ ): void;
20
+
21
+ /**
22
+ * Remove an event listener
23
+ */
24
+ export function removeListener<Context>(
25
+ obj: Context,
26
+ eventName: string,
27
+ target: unknown,
28
+ method: keyof Context | AnyFunction
29
+ ): void;
30
+ export function removeListener<Context>(
31
+ obj: Context,
32
+ eventName: string,
33
+ method: keyof Context | AnyFunction
34
+ ): void;
35
+
36
+ /**
37
+ * Send an event. The execution of suspended listeners
38
+ * is skipped, and once listeners are removed. A listener without
39
+ * a target is executed on the passed object. If an array of actions
40
+ * is not passed, the actions stored on the passed object are invoked.
41
+ *
42
+ * @param eventName
43
+ * @param params Optional parameters for each listener.
44
+ * @returns if the event was delivered to one or more actions
45
+ */
46
+ export function sendEvent(obj: unknown, eventName: string, params?: unknown[]): boolean;
47
+ }
@@ -0,0 +1,126 @@
1
+ declare module '@ember/object' {
2
+ import CoreObject from '@ember/object/core';
3
+ import type Observable from '@ember/object/observable';
4
+ import type ComputedProperty from '@ember/object/computed';
5
+ import type { BasicComputedProperty } from '@ember/object/computed';
6
+ import type { AnyFunction } from '@ember/object/-private/types';
7
+
8
+ /**
9
+ * `Ember.Object` is the main base class for all Ember objects. It is a subclass
10
+ * of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
11
+ * see the documentation for each of these.
12
+ */
13
+ export default class EmberObject extends CoreObject {}
14
+ export default interface EmberObject extends Observable {}
15
+
16
+ /**
17
+ * This helper returns a new property descriptor that wraps the passed computed
18
+ * property function. You can use this helper to define properties with native
19
+ * decorator syntax, mixins, or via `defineProperty()`.
20
+ *
21
+ * @param dependentKeys Optional dependent keys that trigger this computed
22
+ * property.
23
+ */
24
+ export function computed(...dependentKeys: string[]): ComputedProperty & MethodDecorator;
25
+
26
+ export function computed(
27
+ ...args: [...dependentKeys: string[], callback: AnyFunction]
28
+ ): BasicComputedProperty;
29
+
30
+ /**
31
+ * Specify a method that observes property changes.
32
+ */
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ export function observer<Fn extends (target: any, key: string) => void>(
35
+ ...args: [...propertyNames: string[], func: Fn]
36
+ ): Fn;
37
+
38
+ /**
39
+ * Gets the value of a property on an object. If the property is computed,
40
+ * the function will be invoked. If the property is not defined but the
41
+ * object implements the `unknownProperty` method then that will be invoked.
42
+ */
43
+ export function get<T, K extends keyof T>(obj: T, key: K): T[K];
44
+ export function get(obj: unknown, key: string): unknown;
45
+
46
+ /**
47
+ * Sets the value of a property on an object, respecting computed properties
48
+ * and notifying observers and other listeners of the change. If the
49
+ * property is not defined but the object implements the `setUnknownProperty`
50
+ * method then that will be invoked as well.
51
+ */
52
+ export function set<T, K extends keyof T, V extends T[K]>(obj: T, key: K, value: V): V;
53
+
54
+ /**
55
+ * To get multiple properties at once, call `getProperties` with an object
56
+ * followed by a list of strings or an array.
57
+ */
58
+ export function getProperties<T, K extends keyof T>(obj: T, list: K[]): Pick<T, K>;
59
+ export function getProperties<T, K extends keyof T>(obj: T, ...list: K[]): Pick<T, K>;
60
+
61
+ /**
62
+ * Set a list of properties on an object. These properties are set inside
63
+ * a single `beginPropertyChanges` and `endPropertyChanges` batch, so
64
+ * observers will be buffered.
65
+ */
66
+ export function setProperties<T, K extends keyof T>(obj: T, hash: Pick<T, K>): Pick<T, K>;
67
+
68
+ /**
69
+ * Error-tolerant form of `Ember.set`. Will not blow up if any part of the
70
+ * chain is `undefined`, `null`, or destroyed.
71
+ */
72
+ export function trySet(root: object, path: string, value: unknown): unknown;
73
+
74
+ /**
75
+ * NOTE: This is a low-level method used by other parts of the API. You almost
76
+ * never want to call this method directly. Instead you should use mixin() to
77
+ * define new properties.
78
+ *
79
+ * @param obj the object to define this property on. This may be a prototype.
80
+ * @param keyName the name of the property
81
+ * @param desc an instance of `Descriptor` (typically a computed property) or an
82
+ * ES5 descriptor. You must provide this or `data` but not both.
83
+ * @param meta Normally this method takes only three parameters. However if you
84
+ * pass an instance of Descriptor as the third param then you can pass an
85
+ * optional value as the fourth parameter. This is often more efficient than
86
+ * creating new descriptor hashes for each property.
87
+ */
88
+ export function defineProperty(
89
+ obj: object,
90
+ keyName: string,
91
+ desc: PropertyDescriptor | ComputedProperty,
92
+ meta?: unknown
93
+ ): void;
94
+
95
+ /**
96
+ * NOTE: This is a low-level method used by other parts of the API. You almost
97
+ * never want to call this method directly. Instead you should use mixin() to
98
+ * define new properties.
99
+ *
100
+ * @param obj the object to define this property on. This may be a prototype.
101
+ * @param keyName the name of the property
102
+ * @param desc an instance of `Descriptor` (typically a computed property) or an
103
+ * ES5 descriptor. You must provide this or `data` but not both.
104
+ * @param data something other than a descriptor, that will become the explicit
105
+ * value of this property.
106
+ */
107
+ export function defineProperty(
108
+ obj: object,
109
+ keyName: string,
110
+ desc: undefined,
111
+ data: unknown
112
+ ): void;
113
+
114
+ export function notifyPropertyChange(obj: object, keyName: string): void;
115
+
116
+ export const action: MethodDecorator;
117
+ }
118
+
119
+ declare module '@ember/utils/-private/types' {
120
+ import EmberObject from '@ember/object';
121
+
122
+ interface TypeLookup {
123
+ class: typeof EmberObject;
124
+ instance: EmberObject;
125
+ }
126
+ }
@@ -0,0 +1,17 @@
1
+ declare module '@ember/object/internals' {
2
+ /**
3
+ * Returns the cached value for a property, if one exists.
4
+ * This can be useful for peeking at the value of a computed
5
+ * property that is generated lazily, without accidentally causing
6
+ * it to be created.
7
+ */
8
+ export function cacheFor<T, K extends keyof T>(obj: T, key: K): T[K] | undefined;
9
+
10
+ /**
11
+ * Returns a unique id for the object. If the object does not yet have a guid,
12
+ * one will be assigned to it. You can call this on any object,
13
+ * `Ember.Object`-based or not, but be aware that it will add a `_guid`
14
+ * property.
15
+ */
16
+ export function guidFor(obj: unknown): string;
17
+ }
@@ -0,0 +1,19 @@
1
+ declare module '@ember/object/mixin' {
2
+ const __ember_mixin__: unique symbol;
3
+
4
+ /**
5
+ * The `Ember.Mixin` class allows you to create mixins, whose properties can be
6
+ * added to other classes.
7
+ */
8
+ export default class Mixin {
9
+ /**
10
+ * Mixin needs to have *something* on its prototype, otherwise it's treated
11
+ * like an empty interface. It cannot be private, sadly. We can use this to
12
+ * carry around the types of the mixin so they don't get lost, though, so
13
+ * that's... something?
14
+ */
15
+ [__ember_mixin__]: never;
16
+
17
+ static create(...args: Array<Record<string, unknown> | Mixin>): Mixin;
18
+ }
19
+ }