UNPKG

17.2 kBTypeScriptView Raw
1declare module 'ember/barrel' {
2 /**
3 @module ember
4 */
5 import * as utils from '@ember/-internals/utils';
6 import {
7 Registry as InternalRegistry,
8 Container as InternalContainer,
9 } from '@ember/-internals/container';
10 import * as instrumentation from '@ember/instrumentation';
11 import * as metal from '@ember/-internals/metal';
12 import { isEnabled } from '@ember/canary-features';
13 import * as EmberDebug from '@ember/debug';
14 import Backburner from 'backburner.js';
15 import EmberController, {
16 inject as injectController,
17 ControllerMixin as EmberControllerMixin,
18 } from '@ember/controller';
19 import EmberService from '@ember/service';
20 import EmberObject, { action, observer as emberObserver } from '@ember/object';
21 import { dependentKeyCompat } from '@ember/object/compat';
22 import EmberComputedProperty from '@ember/object/computed';
23 import {
24 RSVP as _RSVP,
25 Comparable as InternalComparable,
26 ActionHandler as InternalActionHandler,
27 } from '@ember/-internals/runtime';
28 import {
29 componentCapabilities,
30 modifierCapabilities,
31 setComponentManager,
32 escapeExpression,
33 template,
34 isSerializationFirstNode,
35 type TemplatesRegistry,
36 } from '@ember/-internals/glimmer';
37 import * as views from '@ember/-internals/views';
38 import EmberContainerDebugAdapter from '@ember/debug/container-debug-adapter';
39 import EmberDataAdapter from '@ember/debug/data-adapter';
40 import { run as emberRun } from '@ember/runloop';
41 import EmberArray, {
42 NativeArray as EmberNativeArray,
43 isArray as emberIsArray,
44 makeArray as emberMakeArray,
45 } from '@ember/array';
46 import EmberMutableArray from '@ember/array/mutable';
47 import EmberArrayProxy from '@ember/array/proxy';
48 import EmberApplication, {
49 onLoad as applicationOnLoad,
50 runLoadHooks as applicationRunLoadHooks,
51 } from '@ember/application';
52 import EmberApplicationInstance from '@ember/application/instance';
53 import EmberNamespace from '@ember/application/namespace';
54 import EmberComponent, { Input as EmberInput } from '@ember/component';
55 import EmberHelper from '@ember/component/helper';
56 import EmberEngine from '@ember/engine';
57 import EmberEngineInstance from '@ember/engine/instance';
58 import EmberEnumerable from '@ember/enumerable';
59 import EmberMutableEnumerable from '@ember/enumerable/mutable';
60 import EmberCoreObject from '@ember/object/core';
61 import EmberEvented from '@ember/object/evented';
62 import EmberMixin, { mixin as emberMixin } from '@ember/object/mixin';
63 import EmberObservable from '@ember/object/observable';
64 import EmberObjectProxy from '@ember/object/proxy';
65 import EmberPromiseProxyMixin from '@ember/object/promise-proxy-mixin';
66 import EmberHashLocation from '@ember/routing/hash-location';
67 import EmberHistoryLocation from '@ember/routing/history-location';
68 import EmberNoneLocation from '@ember/routing/none-location';
69 import EmberRoute from '@ember/routing/route';
70 import EmberRouter from '@ember/routing/router';
71 import {
72 controllerFor as emberControllerFor,
73 generateController as emberGenerateController,
74 generateControllerFactory as emberGenerateControllerFactory,
75 DSL as EmberRouterDSL,
76 } from '@ember/routing/-internals';
77 import {
78 isNone as emberIsNone,
79 isBlank as emberIsBlank,
80 isEmpty as emberIsEmpty,
81 isPresent as emberIsPresent,
82 isEqual as emberIsEqual,
83 typeOf as emberTypeOf,
84 compare as emberCompare,
85 } from '@ember/utils';
86 import * as glimmerRuntime from '@glimmer/runtime';
87 import {
88 helperCapabilities,
89 setModifierManager,
90 setComponentTemplate,
91 getComponentTemplate,
92 setHelperManager,
93 } from '@glimmer/manager';
94 import {
95 associateDestroyableChild,
96 registerDestructor,
97 unregisterDestructor,
98 } from '@ember/destroyable';
99 import type { precompile, compile } from 'ember-template-compiler';
100 import { _impl as EmberTestingImpl } from '@ember/test';
101 namespace Ember {
102 const isNamespace = true;
103 function toString(): string;
104 const Container: typeof InternalContainer;
105 type Container = InternalContainer;
106 const Registry: typeof InternalRegistry;
107 type Registry = InternalRegistry;
108 const _setComponentManager: typeof setComponentManager;
109 const _componentManagerCapabilities: typeof componentCapabilities;
110 const _modifierManagerCapabilities: typeof modifierCapabilities;
111 const meta: {
112 (obj: object): import('@ember/-internals/meta').Meta;
113 _counters?: import('@ember/-internals/meta').MetaCounters | undefined;
114 };
115 const _createCache: typeof metal.createCache;
116 const _cacheGetValue: typeof metal.getValue;
117 const _cacheIsConst: typeof metal.isConst;
118 const _descriptor: typeof metal.nativeDescDecorator;
119 const _getPath: typeof metal._getPath;
120 const _setClassicDecorator: typeof metal.setClassicDecorator;
121 const _tracked: typeof metal.tracked;
122 const beginPropertyChanges: typeof metal.beginPropertyChanges;
123 const changeProperties: typeof metal.changeProperties;
124 const endPropertyChanges: typeof metal.endPropertyChanges;
125 const hasListeners: typeof metal.hasListeners;
126 const libraries: metal.Libraries;
127 const _ContainerProxyMixin: EmberMixin;
128 const _ProxyMixin: EmberMixin;
129 const _RegistryProxyMixin: EmberMixin;
130 const ActionHandler: EmberMixin;
131 type ActionHandler = InternalActionHandler;
132 const Comparable: EmberMixin;
133 type Comparable = InternalComparable;
134 const ComponentLookup: Readonly<typeof EmberObject> &
135 (new (owner?: import('@ember/owner').default | undefined) => EmberObject) & {
136 componentFor(
137 name: string,
138 owner: import('@ember/-internals/owner').InternalOwner
139 ): import('@ember/owner').FactoryManager<object> | undefined;
140 layoutFor(
141 name: string,
142 owner: import('@ember/-internals/owner').InternalOwner,
143 options: import('@ember/owner').RegisterOptions
144 ): unknown;
145 };
146 const EventDispatcher: typeof views.EventDispatcher;
147 const _Cache: typeof utils.Cache;
148 const GUID_KEY: `__ember${number}`;
149 const canInvoke: typeof utils.canInvoke;
150 const generateGuid: typeof utils.generateGuid;
151 const guidFor: typeof utils.guidFor;
152 const uuid: typeof utils.uuid;
153 const wrap: typeof utils.wrap;
154 const getOwner: (object: object) => import('@ember/owner').default | undefined;
155 const onLoad: typeof applicationOnLoad;
156 const runLoadHooks: typeof applicationRunLoadHooks;
157 const setOwner: typeof import('@ember/owner').setOwner;
158 const Application: typeof EmberApplication;
159 type Application = EmberApplication;
160 const ApplicationInstance: typeof EmberApplicationInstance;
161 type ApplicationInstance = EmberApplicationInstance;
162 const Namespace: typeof EmberNamespace;
163 type Namespace = EmberNamespace;
164 const A: <T>(arr?: T[] | undefined) => EmberNativeArray<T>;
165 const Array: EmberMixin;
166 type Array<T> = EmberArray<T>;
167 const NativeArray: EmberMixin;
168 type NativeArray<T> = EmberNativeArray<T>;
169 const isArray: typeof emberIsArray;
170 const makeArray: typeof emberMakeArray;
171 const MutableArray: EmberMixin;
172 type MutableArray<T> = EmberMutableArray<T>;
173 const ArrayProxy: typeof EmberArrayProxy;
174 type ArrayProxy<T> = EmberArrayProxy<T>;
175 const FEATURES: {
176 isEnabled: typeof isEnabled;
177 };
178 const _Input: EmberInput;
179 const Component: typeof EmberComponent;
180 type Component<S = unknown> = EmberComponent<S>;
181 const Helper: typeof EmberHelper;
182 type Helper<S = unknown> = EmberHelper<S>;
183 const Controller: typeof EmberController;
184 type Controller<T = unknown> = EmberController<T>;
185 const ControllerMixin: EmberMixin;
186 type ControllerMixin<T> = EmberControllerMixin<T>;
187 const _captureRenderTree: typeof EmberDebug.captureRenderTree;
188 const assert: import('@ember/debug/lib/assert').AssertFunc;
189 const warn: import('@ember/debug/lib/warn').WarnFunc;
190 const debug: EmberDebug.DebugFunc;
191 const deprecate: typeof EmberDebug.deprecate;
192 const deprecateFunc: EmberDebug.DeprecateFuncFunc;
193 const runInDebug: EmberDebug.RunInDebugFunc;
194 const inspect: typeof EmberDebug.inspect;
195 const Debug: {
196 registerDeprecationHandler: (
197 handler: import('@ember/debug/lib/handlers').HandlerCallback<EmberDebug.DeprecationOptions>
198 ) => void;
199 registerWarnHandler: import('@ember/debug/lib/warn').RegisterHandlerFunc;
200 isComputed: typeof metal.isComputed;
201 };
202 const ContainerDebugAdapter: typeof EmberContainerDebugAdapter;
203 type ContainerDebugAdapter = EmberContainerDebugAdapter;
204 const DataAdapter: typeof EmberDataAdapter;
205 type DataAdapter<T> = EmberDataAdapter<T>;
206 const _assertDestroyablesDestroyed: (() => void) | undefined;
207 const _associateDestroyableChild: typeof associateDestroyableChild;
208 const _enableDestroyableTracking: (() => void) | undefined;
209 const _isDestroying: typeof glimmerRuntime.isDestroying;
210 const _isDestroyed: typeof glimmerRuntime.isDestroyed;
211 const _registerDestructor: typeof registerDestructor;
212 const _unregisterDestructor: typeof unregisterDestructor;
213 const destroy: typeof glimmerRuntime.destroy;
214 const Engine: typeof EmberEngine;
215 type Engine = EmberEngine;
216 const EngineInstance: typeof EmberEngineInstance;
217 type EngineInstance = EmberEngineInstance;
218 const Enumerable: EmberMixin;
219 type Enumerable = EmberEnumerable;
220 const MutableEnumerable: EmberMixin;
221 type MutableEnumerable = EmberMutableEnumerable;
222 /** @private */
223 const instrument: typeof instrumentation.instrument;
224 /** @private */
225 const subscribe: typeof instrumentation.subscribe;
226 /** @private */
227 const Instrumentation: {
228 instrument: typeof instrumentation.instrument;
229 subscribe: typeof instrumentation.subscribe;
230 unsubscribe: typeof instrumentation.unsubscribe;
231 reset: typeof instrumentation.reset;
232 };
233 const Object: typeof EmberObject;
234 type Object = EmberObject;
235 const _action: typeof action;
236 const computed: typeof metal.computed;
237 const defineProperty: typeof metal.defineProperty;
238 const get: typeof metal.get;
239 const getProperties: typeof metal.getProperties;
240 const notifyPropertyChange: typeof metal.notifyPropertyChange;
241 const observer: typeof emberObserver;
242 const set: typeof metal.set;
243 const trySet: typeof metal.trySet;
244 const setProperties: typeof metal.setProperties;
245 const cacheFor: typeof metal.getCachedValueFor;
246 const _dependentKeyCompat: typeof dependentKeyCompat;
247 const ComputedProperty: typeof metal.ComputedProperty;
248 type ComputedProperty = EmberComputedProperty;
249 const expandProperties: typeof metal.expandProperties;
250 const CoreObject: typeof EmberCoreObject;
251 type CoreObject = EmberCoreObject;
252 const Evented: EmberMixin;
253 type Evented = EmberEvented;
254 const on: typeof metal.on;
255 const addListener: typeof metal.addListener;
256 const removeListener: typeof metal.removeListener;
257 const sendEvent: typeof metal.sendEvent;
258 const Mixin: typeof EmberMixin;
259 type Mixin = EmberMixin;
260 const mixin: typeof emberMixin;
261 const Observable: EmberMixin;
262 type Observable = EmberObservable;
263 const addObserver: typeof metal.addObserver;
264 const removeObserver: typeof metal.removeObserver;
265 const PromiseProxyMixin: EmberMixin;
266 type PromiseProxyMixin<T> = EmberPromiseProxyMixin<T>;
267 const ObjectProxy: typeof EmberObjectProxy;
268 type ObjectProxy = EmberObjectProxy;
269 const RouterDSL: typeof EmberRouterDSL;
270 type RouterDSL = EmberRouterDSL;
271 const controllerFor: typeof emberControllerFor;
272 const generateController: typeof emberGenerateController;
273 const generateControllerFactory: typeof emberGenerateControllerFactory;
274 const HashLocation: typeof EmberHashLocation;
275 type HashLocation = EmberHashLocation;
276 const HistoryLocation: typeof EmberHistoryLocation;
277 type HistoryLocation = EmberHistoryLocation;
278 const NoneLocation: typeof EmberNoneLocation;
279 type NoneLocation = EmberNoneLocation;
280 const Route: typeof EmberRoute;
281 type Route = EmberRoute;
282 const Router: typeof EmberRouter;
283 type Router = EmberRouter;
284 const run: typeof emberRun;
285 const Service: typeof EmberService;
286 type Service = EmberService;
287 const compare: typeof emberCompare;
288 const isBlank: typeof emberIsBlank;
289 const isEmpty: typeof emberIsEmpty;
290 const isEqual: typeof emberIsEqual;
291 const isNone: typeof emberIsNone;
292 const isPresent: typeof emberIsPresent;
293 const typeOf: typeof emberTypeOf;
294 /**
295 The semantic version
296
297 @property VERSION
298 @type String
299 @public
300 */
301 const VERSION: string;
302 const ViewUtils: {
303 getChildViews: typeof views.getChildViews;
304 getElementView: typeof views.getElementView;
305 getRootViews: typeof views.getRootViews;
306 getViewBounds: typeof views.getViewBounds;
307 getViewBoundingClientRect: typeof views.getViewBoundingClientRect;
308 getViewClientRects: typeof views.getViewClientRects;
309 getViewElement: typeof views.getViewElement;
310 isSimpleClick: typeof views.isSimpleClick;
311 isSerializationFirstNode: typeof isSerializationFirstNode;
312 };
313 const _getComponentTemplate: typeof getComponentTemplate;
314 const _helperManagerCapabilities: typeof helperCapabilities;
315 const _setComponentTemplate: typeof setComponentTemplate;
316 const _setHelperManager: typeof setHelperManager;
317 const _setModifierManager: typeof setModifierManager;
318 const _templateOnlyComponent: typeof glimmerRuntime.templateOnlyComponent;
319 const _invokeHelper: typeof glimmerRuntime.invokeHelper;
320 const _hash: object;
321 const _array: object;
322 const _concat: object;
323 const _get: object;
324 const _on: {};
325 const _fn: object;
326 const _Backburner: typeof Backburner;
327 type _Backburner = Backburner;
328 /**
329 Namespace for injection helper methods.
330
331 @class inject
332 @namespace Ember
333 @static
334 @public
335 */
336 function inject(): void;
337 namespace inject {
338 var controller: typeof injectController;
339 var service: typeof import('@ember/service').service;
340 }
341 const __loader: {
342 readonly require: any;
343 readonly define: any;
344 readonly registry: any;
345 };
346 const ENV: Readonly<object>;
347 let lookup: Record<string, unknown>;
348 /**
349 A function may be assigned to `Ember.onerror` to be called when Ember
350 internals encounter an error. This is useful for specialized error handling
351 and reporting code.
352
353 ```javascript
354
355 Ember.onerror = function(error) {
356 const payload = {
357 stack: error.stack,
358 otherInformation: 'whatever app state you want to provide'
359 };
360
361 fetch('/report-error', {
362 method: 'POST',
363 body: JSON.stringify(payload)
364 });
365 };
366 ```
367
368 Internally, `Ember.onerror` is used as Backburner's error handler.
369
370 @event onerror
371 @for Ember
372 @param {Error} error the error object
373 @public
374 */
375 let onerror: ((error: Error) => unknown) | undefined;
376 let testing: boolean;
377 /**
378 Whether searching on the global for new Namespace instances is enabled.
379
380 This is only exported here as to not break any addons. Given the new
381 visit API, you will have issues if you treat this as a indicator of
382 booted.
383
384 Internally this is only exposing a flag in Namespace.
385
386 @property BOOTED
387 @for Ember
388 @type Boolean
389 @private
390 */
391 let BOOTED: boolean;
392 /**
393 Global hash of shared templates. This will automatically be populated
394 by the build tools so that you can store your Handlebars templates in
395 separate files that get loaded into JavaScript at buildtime.
396
397 @property TEMPLATES
398 @for Ember
399 @type Object
400 @private
401 */
402 let TEMPLATES: TemplatesRegistry;
403 let HTMLBars: EmberHTMLBars;
404 let Handlebars: EmberHandlebars;
405 let Test:
406 | (NonNullable<typeof EmberTestingImpl>['Test'] & {
407 Adapter: NonNullable<typeof EmberTestingImpl>['Adapter'];
408 QUnitAdapter: NonNullable<typeof EmberTestingImpl>['QUnitAdapter'];
409 })
410 | undefined;
411 let setupForTesting: NonNullable<typeof EmberTestingImpl>['setupForTesting'] | undefined;
412 }
413 namespace Ember {
414 export import RSVP = _RSVP;
415 }
416 interface EmberHandlebars {
417 template: typeof template;
418 Utils: {
419 escapeExpression: typeof escapeExpression;
420 };
421 compile?: typeof compile;
422 precompile?: typeof precompile;
423 }
424 interface EmberHTMLBars {
425 template: typeof template;
426 compile?: typeof compile;
427 precompile?: typeof precompile;
428 }
429 let EmberHandlebars: EmberHandlebars;
430 let EmberHTMLBars: EmberHTMLBars;
431 export default Ember;
432}
433
\No newline at end of file