This commit is contained in:
Aaron Holderman
2018-09-25 10:45:15 -06:00
141 changed files with 6440 additions and 4808 deletions
+3
View File
@@ -493,6 +493,7 @@ declare namespace Chart {
fontSize?: number;
fontStyle?: string;
labelOffset?: number;
lineHeight?: number;
max?: any;
maxRotation?: number;
maxTicksLimit?: number;
@@ -503,6 +504,8 @@ declare namespace Chart {
reverse?: boolean;
showLabelBackdrop?: boolean;
source?: 'auto' | 'data' | 'labels';
suggestedMax?: number;
suggestedMin?: number;
}
interface AngleLineOptions {
+3
View File
@@ -0,0 +1,3 @@
import DS from 'ember-data';
export default DS.Adapter;
export { AdapterRegistry } from 'ember-data';
+13
View File
@@ -0,0 +1,13 @@
import DS from 'ember-data';
export const AdapterError: typeof DS.AdapterError;
export const InvalidError: typeof DS.InvalidError;
export const UnauthorizedError: typeof DS.UnauthorizedError;
export const ForbiddenError: typeof DS.ForbiddenError;
export const NotFoundError: typeof DS.NotFoundError;
export const ConflictError: typeof DS.ConflictError;
export const ServerError: typeof DS.ServerError;
export const TimeoutError: typeof DS.TimeoutError;
export const AbortError: typeof DS.AbortError;
export const errorsHashToArray: typeof DS.errorsHashToArray;
export const errorsArrayToHash: typeof DS.errorsArrayToHash;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.JSONAPIAdapter;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.RESTAdapter;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.attr;
+2185 -2196
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
import DS from 'ember-data';
export default DS.Model;
export { ModelRegistry } from 'ember-data';
+3
View File
@@ -0,0 +1,3 @@
import DS from 'ember-data';
export const hasMany: typeof DS.hasMany;
export const belongsTo: typeof DS.belongsTo;
+3
View File
@@ -0,0 +1,3 @@
import DS from 'ember-data';
export default DS.Serializer;
export { SerializerRegistry } from 'ember-data';
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.EmbeddedRecordsMixin;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.JSONAPISerializer;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.JSONSerializer;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.RESTSerializer;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.Store;
+3 -1
View File
@@ -1,5 +1,6 @@
import Ember from 'ember';
import DS from 'ember-data';
import Controller from '@ember/controller';
class MyModel extends DS.Model {}
@@ -15,9 +16,10 @@ Ember.Route.extend({
}
});
Ember.Controller.extend({
Controller.extend({
actions: {
create(): any {
this.queryParams;
return this.store.createRecord('my-model');
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ const MyRoute = Ember.Route.extend({
});
// Store is injectable via `inject` and resolves to `DS.Store`.
const SomeComponent = Ember.Component.extend({
const SomeComponent = Ember.Object.extend({
store: Ember.inject.service('store'),
lookUpUsers() {
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.Transform;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.BooleanTransform;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.DateTransform;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.NumberTransform;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.StringTransform;
+2
View File
@@ -0,0 +1,2 @@
import DS from 'ember-data';
export default DS.Transform;
+27
View File
@@ -16,6 +16,14 @@
"paths": {
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/service": ["ember__service"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/controller": ["ember__controller"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},
@@ -26,6 +34,25 @@
},
"files": [
"index.d.ts",
"adapters/errors.d.ts",
"adapters/json-api.d.ts",
"adapters/rest.d.ts",
"serializers/embedded-records-mixin.d.ts",
"serializers/json-api.d.ts",
"serializers/json.d.ts",
"serializers/rest.d.ts",
"transforms/boolean.d.ts",
"transforms/date.d.ts",
"transforms/number.d.ts",
"transforms/string.d.ts",
"transforms/transform.d.ts",
"adapter.d.ts",
"attr.d.ts",
"model.d.ts",
"relationships.d.ts",
"serializer.d.ts",
"store.d.ts",
"transform.d.ts",
"test/lib/assert.ts",
"test/model.ts",
"test/module-api.ts",
+1
View File
@@ -14,6 +14,7 @@
"../"
],
"paths": {
"@ember/service": ["ember__service"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},
+2
View File
@@ -15,6 +15,8 @@
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},
+3 -1
View File
@@ -15,7 +15,9 @@
],
"paths": {
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
"@ember/object/*": ["ember__object/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"]
},
"types": [],
"noEmit": true,
+6
View File
@@ -14,6 +14,12 @@
"../"
],
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},
+1 -1
View File
@@ -1,5 +1,5 @@
import EmberResolver from 'ember-resolver';
import { Ember } from 'ember';
import Ember from 'ember';
const MyResolver = EmberResolver.extend({
pluralizedTypes: {
+2
View File
@@ -15,6 +15,8 @@
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},
+2
View File
@@ -16,6 +16,8 @@
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"]
},
+102 -1665
View File
File diff suppressed because it is too large Load Diff
+277
View File
@@ -0,0 +1,277 @@
import Ember from 'ember';
// $
Ember.$; // $ExpectType JQueryStatic
// A
Ember.A(); // $ExpectType NativeArray<{}>
Ember.A([1, 2]); // $ExpectType NativeArray<number>
// addListener
Ember.addListener({ a: 'foo' }, 'a', {}, () => {});
Ember.addListener({ a: 'foo' }, 'a', null, () => {});
// addObserver
Ember.addObserver({ a: 'foo' }, 'a', null, () => {});
Ember.addObserver({ a: 'foo' }, 'a', {}, () => {});
// aliasMethod
Ember.aliasMethod('init');
// assert
Ember.assert('2+2 should always be 4', 2 + 2 === 4);
// assign
const o1 = Ember.assign({ a: 1 }, { b: 2 });
o1.a; // $ExpectType number
o1.b; // $ExpectType number
o1.c; // $ExpectError
// Ember.bind // $ExpectError
// cacheFor
Ember.cacheFor({ a: 123 }, 'a'); // $ExpectType number | undefined
Ember.cacheFor({ a: 123 }, 'x'); // $ExpectError
// compare
Ember.compare('31', '114'); // $ExpectType number
// copy
Ember.copy({ a: 12 }, true).a; // $ExpectType number
Ember.copy({ a: 12 }); // $ExpectType any
Ember.copy({ a: 12 }).a; // $ExpectType any
Ember.copy({ a: 12 }).b; // $ExpectType any
// debug
Ember.debug('some info for developers');
// deprecate
Ember.deprecate("you shouldn't use this anymore", 3 === 3, {
id: 'no-longer-allowed',
until: '99.0.0'
});
// get
Ember.get({ z: 23 }, 'z'); // $ExpectType number
Ember.get({ z: 23 }, 'zz'); // $ExpectError
// getEngineParent
Ember.getEngineParent(new Ember.EngineInstance()); // $ExpectType EngineInstance
// getOwner
Ember.getOwner(new Ember.Component());
// getProperties
Ember.getProperties({ z: 23 }, 'z').z; // $ExpectType number
Ember.getProperties({ z: 23 }, 'z', 'z').z; // $ExpectType number
Ember.getProperties({ z: 23 }, 'z', 'a').z; // $ExpectError
Ember.getProperties({ z: 23 }, ['z', 'z']).z; // $ExpectType number
Ember.getProperties({ z: 23 }, ['z', 'a']).z; // $ExpectError
// getWithDefault
Ember.getWithDefault({ z: 23 }, 'z', 43); // $ExpectType number
Ember.getWithDefault({ a: undefined as number | undefined, z: 23 }, 'a', 99); // $ExpectType number | undefined
// guidFor
Ember.guidFor({}); // $ExpectType string
Ember.guidFor(''); // $ExpectType string
// isArray
Ember.isArray(''); // $ExpectType boolean
Ember.isArray([]); // $ExpectType boolean
// isBlank
Ember.isBlank(''); // $ExpectType boolean
Ember.isBlank([]); // $ExpectType boolean
// isEmpty
Ember.isEmpty(''); // $ExpectType boolean
Ember.isEmpty([]); // $ExpectType boolean
// isEqual
Ember.isEqual('', 'foo'); // $ExpectType boolean
Ember.isEqual([], ''); // $ExpectType boolean
// isNone
Ember.isNone(''); // $ExpectType boolean
Ember.isNone([]); // $ExpectType boolean
// isPresent
Ember.isPresent(''); // $ExpectType boolean
Ember.isPresent([]); // $ExpectType boolean
// merge
Ember.merge({ a: 12 }, { b: 34 }).a; // $ExpectType number
// observer
const o2 = Ember.Object.extend({
name: 'foo',
age: 3,
nameWatcher: Ember.observer('name', () => {}),
nameWatcher2: Ember.observer('name', 'fullName', () => {})
});
// on
const o3 = Ember.Object.extend({
name: 'foo',
nameWatcher: Ember.on('init', () => {}),
nameWatcher2: Ember.on('destroy', () => {})
});
// removeListener
Ember.addListener(o2, 'create', () => {});
Ember.addListener({}, 'create', () => {}); // $ExpectError
// removeObserver
Ember.removeObserver(o2, 'create', () => {});
Ember.removeObserver({}, 'create', () => {}); // $ExpectError
// runInDebug
Ember.runInDebug(() => {});
// sendEvent
Ember.sendEvent(o2, 'clicked', [1, 2]); // $ExpectType boolean
// set
Ember.set(o2.create(), 'name', 'bar'); // $ExpectType string
Ember.set(o2.create(), 'age', 4); // $ExpectType number
Ember.set(o2.create(), 'nam', 'bar'); // $ExpectError
// setOwner
Ember.setOwner(o2.create(), {});
// setProperties
Ember.setProperties(o2.create(), { name: 'bar' }).name; // $ExpectType string
// tryInvoke
Ember.tryInvoke(o2, 'init');
Ember.tryInvoke(o2, 'init', [441]);
// trySet
Ember.trySet(o2, 'nam', ''); // $ExpectType any
// typeOf
Ember.typeOf(''); // $ExpectType "string"
Ember.typeOf(Ember.A()); // $ExpectType "array"
// warn
Ember.warn('be caseful!');
// VERSION
Ember.VERSION; // $ExpectType string
// onerror
Ember.onerror = (err: Error) => console.error(err);
Ember.onerror = (num: number, err: Error) => console.error(err); // $ExpectError
// Classes
// TODO ContainerProxyMixin
// Ember
// Ember.Application
new Ember.Application(); // $ExpectType Application
Ember.Application.create(); // $ExpectType Application
// Ember.ApplicationInstance
new Ember.ApplicationInstance(); // $ExpectType ApplicationInstance
Ember.ApplicationInstance.create(); // $ExpectType ApplicationInstance
// TODO: Ember.ApplicationInstance.BootOptions
// Ember.Array
const a1: Ember.Array<string> = [];
const a2: Ember.Array<string> = {}; // $ExpectError
// Ember.ArrayProxy
new Ember.ArrayProxy<number>([3, 3, 2]); // $ExpectType ArrayProxy<number>
// Ember.Checkbox
const cb = new Ember.Checkbox(); // $ExpectType Checkbox
cb.tagName; // $ExpectType string
// Ember.Component
const C1 = Ember.Component.extend({ classNames: ['foo'] });
class C2 extends Ember.Component {
classNames = ['foo'];
}
const c1 = new C1();
const c2 = new C2();
C1.create();
C2.create();
c1.didInsertElement();
c2.didInsertElement();
// Ember.ComputedProperty
const cp: Ember.ComputedProperty<string, string> = Ember.computed('foo', {
get(): string {
return '';
},
set(_key: string, newVal: string): string {
return '';
}
});
// Ember.ContainerDebugAdapter
const cda = new Ember.ContainerDebugAdapter(); // $ExpectType ContainerDebugAdapter
// Ember.Controller
const con = new Ember.Controller(); // $ExpectType Controller
// Ember.CoreObject
const co = new Ember.CoreObject(); // $ExpectType CoreObject
// Ember.DataAdapter
const da = new Ember.DataAdapter(); // $ExpectType DataAdapter
// Ember.Debug
Ember.Debug.registerDeprecationHandler(() => {});
Ember.Debug.registerWarnHandler(() => {});
// Ember.DefaultResolver
const dr = new Ember.DefaultResolver();
dr.resolve('route:index');
dr.resolve(); // $ExpectError
// Ember.Engine
const e1 = new Ember.Engine();
e1.register('data:foo', {}, { instantiate: false });
// Ember.EngineInstance
const ei1 = new Ember.EngineInstance();
ei1.lookup('data:foo');
// Ember.Error
new Ember.Error('Halp!');
// Ember.Evented
const oe1 = Ember.Object.extend(Ember.Evented).create();
oe1.trigger('foo');
oe1.on('bar', () => {});
oe1.on('bar', { foo() {}}, () => {});
// Ember.HashLocation
const hl = new Ember.HashLocation(); // $ExpectType HashLocation
// Ember.Helper
const h1 = Ember.Helper.extend({
compute() {
this.recompute();
return '';
}
});
// Ember.HistoryLocation
const hil = new Ember.HistoryLocation(); // $ExpectType HistoryLocation
// Ember.LinkComponent
Ember.LinkComponent.create(); // $ExpectType LinkComponent
// Ember.Mixin
Ember.Object.extend(Ember.Mixin.create({ foo: 'bar' }), {
baz() {
this.foo; // $ExpectType string
}
});
// Ember.MutableArray
const ma1: Ember.MutableArray<string> = [
'money',
'in',
'the',
'bananna',
'stand'
];
ma1.addObject('!'); // $ExpectType string
ma1.filterBy(''); // $ExpectType NativeArray<string>
// Ember.MutableEnumerable
// tslint:disable-next-line:prefer-const
let me1: Ember.MutableEnumerable<[string]> = null as any;
me1.compact(); // $ExpectType NativeArray<[string]>
// Ember.Namespace
const myNs = Ember.Namespace.extend({});
// Ember.NativeArray
const na: Ember.NativeArray<number> = Ember.A([2, 3, 4]);
na; // $ExpectType NativeArray<number>
na.clear(); // $ExpectType NativeArray<number>
// Ember.NoneLocation
new Ember.NoneLocation(); // $ExpectType NoneLocation
// Ember.Object
new Ember.Object();
// Ember.ObjectProxy
new Ember.ObjectProxy(); // $ExpectType ObjectProxy
// Ember.Observable
Ember.Object.extend(Ember.Observable, {});
// Ember.PromiseProxyMixin
Ember.Object.extend(Ember.PromiseProxyMixin, {
foo() {
this.reason; // $ExpectType any
this.isPending; // $ExpectType boolean
}
});
// Ember.Route
new Ember.Route();
// Ember.Router
new Ember.Router();
// Ember.Service
new Ember.Service();
// Ember.Test
Ember.Test;
// Ember.Test.Adapter
new Ember.Test.Adapter();
// Ember.Test.QUnitAdapter
new Ember.Test.QUnitAdapter();
// Ember.TextArea
new Ember.TextArea();
// Ember.TextField
new Ember.TextField();
// Ember.Helper
// helper
Ember.Helper.helper(([a, b]: [number, number]) => a + b);
// Ember.String
Ember.String;
// htmlSafe
Ember.String.htmlSafe('foo'); // $ExpectType SafeString
// isHTMLSafe
Ember.String.isHTMLSafe('foo'); // $ExpectType boolean
// Ember.Test
Ember.Test.checkWaiters(); // $ExpectType boolean
// checkWaiters
+1 -2
View File
@@ -1,6 +1,5 @@
import { assertType } from "./lib/assert";
import Ember from "ember";
import EmberError from "@ember/error";
assertType<typeof Ember.Error>(EmberError);
assertType<typeof Ember.Error>(Ember.Error);
+34 -35
View File
@@ -1,12 +1,11 @@
import Ember from 'ember';
import RSVP from 'rsvp';
import { run } from '@ember/runloop';
import { assertType } from "./lib/assert";
assertType<string[]>(Ember.run.queues);
function testRun() {
const r = run(() => {
const r = Ember.run(() => {
// code to be executed within a RunLoop
return 123;
});
@@ -14,7 +13,7 @@ function testRun() {
function destroyApp(application: Ember.Application) {
Ember.run(application, 'destroy');
run(application, function() {
Ember.run(application, function() {
this.destroy();
});
}
@@ -38,48 +37,48 @@ function testBind() {
function testCancel() {
const myContext = {};
const runNext = run.next(myContext, () => {
const runNext = Ember.run.next(myContext, () => {
// will not be executed
});
run.cancel(runNext);
Ember.run.cancel(runNext);
const runLater = run.later(myContext, () => {
const runLater = Ember.run.later(myContext, () => {
// will not be executed
}, 500);
run.cancel(runLater);
Ember.run.cancel(runLater);
const runScheduleOnce = run.scheduleOnce('afterRender', myContext, () => {
const runScheduleOnce = Ember.run.scheduleOnce('afterRender', myContext, () => {
// will not be executed
});
run.cancel(runScheduleOnce);
Ember.run.cancel(runScheduleOnce);
const runOnce = run.once(myContext, () => {
const runOnce = Ember.run.once(myContext, () => {
// will not be executed
});
run.cancel(runOnce);
Ember.run.cancel(runOnce);
const throttle = run.throttle(myContext, () => {
const throttle = Ember.run.throttle(myContext, () => {
// will not be executed
}, 1, false);
run.cancel(throttle);
Ember.run.cancel(throttle);
const debounce = run.debounce(myContext, () => {
const debounce = Ember.run.debounce(myContext, () => {
// will not be executed
}, 1);
run.cancel(debounce);
Ember.run.cancel(debounce);
const debounceImmediate = run.debounce(myContext, () => {
const debounceImmediate = Ember.run.debounce(myContext, () => {
// will be executed since we passed in true (immediate)
}, 100, true);
// the 100ms delay until this method can be called again will be canceled
run.cancel(debounceImmediate);
Ember.run.cancel(debounceImmediate);
}
function testDebounce() {
@@ -88,9 +87,9 @@ function testDebounce() {
const myContext = { name: 'debounce' };
run.debounce(runIt, 150);
run.debounce(myContext, runIt, 150);
run.debounce(myContext, runIt, 150, true);
Ember.run.debounce(runIt, 150);
Ember.run.debounce(myContext, runIt, 150);
Ember.run.debounce(myContext, runIt, 150, true);
Ember.Component.extend({
searchValue: 'test',
@@ -106,19 +105,19 @@ function testDebounce() {
}
function testBegin() {
run.begin();
Ember.run.begin();
// code to be executed within a RunLoop
run.end();
Ember.run.end();
}
function testJoin() {
run.join(() => {
Ember.run.join(() => {
// creates a new run-loop
});
run(() => {
Ember.run(() => {
// creates a new run-loop
run.join(() => {
Ember.run.join(() => {
// joins with the existing run-loop, and queues for invocation on
// the existing run-loops action queue.
});
@@ -133,14 +132,14 @@ function testJoin() {
function testLater() {
const myContext = {};
run.later(myContext, () => {
Ember.run.later(myContext, () => {
// code here will execute within a RunLoop in about 500ms with this == myContext
}, 500);
}
function testNext() {
const myContext = {};
run.next(myContext, () => {
Ember.run.next(myContext, () => {
// code to be executed in the next run loop,
// which will be scheduled after the current one
});
@@ -160,12 +159,12 @@ function testOnce() {
function testSchedule() {
Ember.Component.extend({
init() {
run.schedule('sync', this, () => {
Ember.run.schedule('sync', this, () => {
// this will be executed in the first RunLoop queue, when bindings are synced
console.log('scheduled on sync queue');
});
run.schedule('actions', this, () => {
Ember.run.schedule('actions', this, () => {
// this will be executed in the 'actions' queue, after bindings have synced.
console.log('scheduled on actions queue');
});
@@ -183,12 +182,12 @@ function testScheduleOnce() {
}
const myContext = {};
run(() => {
run.scheduleOnce('afterRender', myContext, sayHi);
run.scheduleOnce('afterRender', myContext, sayHi);
Ember.run(() => {
Ember.run.scheduleOnce('afterRender', myContext, sayHi);
Ember.run.scheduleOnce('afterRender', myContext, sayHi);
// sayHi will only be executed once, in the afterRender queue of the RunLoop
});
run.scheduleOnce('actions', myContext, () => {
Ember.run.scheduleOnce('actions', myContext, () => {
console.log('Closure');
});
}
@@ -199,6 +198,6 @@ function testThrottle() {
const myContext = { name: 'throttle' };
run.throttle(runIt, 150);
run.throttle(myContext, runIt, 150);
Ember.run.throttle(runIt, 150);
Ember.run.throttle(myContext, runIt, 150);
}
+14
View File
@@ -18,14 +18,27 @@
"@ember/string": ["ember__string"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/service": ["ember__service"],
"@ember/utils": ["ember__utils"],
"@ember/utils/*": ["ember__utils/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/debug": ["ember__debug"],
"@ember/debug/*": ["ember__debug/*"],
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/controller": ["ember__controller"],
"@ember/polyfills": ["ember__polyfills"]
},
"types": [],
@@ -54,6 +67,7 @@
"test/debug.ts",
"test/detect-instance.ts",
"test/detect.ts",
"test/ember-module-tests.ts",
"test/ember-tests.ts",
"test/engine-instance.ts",
"test/engine.ts",
+21
View File
@@ -0,0 +1,21 @@
import Resolver from "@ember/engine/-private/resolver";
import Application from "@ember/application";
/**
* The DefaultResolver defines the default lookup rules to resolve
* container lookups before consulting the container for registered
* items:
*/
export default class DefaultResolver extends Resolver {
/**
* This method is called via the container's resolver method.
* It parses the provided `fullName` and then looks up and
* returns the appropriate template or class.
*/
resolve(fullName: string): {};
/**
* This will be set to the Application instance when it is
* created.
*/
namespace: Application;
}
+16
View File
@@ -0,0 +1,16 @@
import { EventDispatcherEvents } from "@ember/application/types";
/**
* `Ember.EventDispatcher` handles delegating browser events to their
* corresponding `Ember.Views.` For example, when you click on a view,
* `Ember.EventDispatcher` ensures that that view's `mouseDown` method gets
* called.
*/
export default class EventDispatcher extends Object {
/**
* The set of events names (and associated handler function names) to be setup
* and dispatched by the `EventDispatcher`. Modifications to this list can be done
* at setup time, generally via the `Ember.Application.customEvents` hash.
*/
events: EventDispatcherEvents;
}
+13
View File
@@ -0,0 +1,13 @@
import { EmberClassConstructor } from "@ember/object/-private/types";
/**
* A registry used to store factory and option information keyed
* by type.
*/
export default class Registry {
register(
fullName: string,
factory: EmberClassConstructor<any>,
options?: { singleton?: boolean }
): void;
}
+34 -3
View File
@@ -1,4 +1,35 @@
import Ember from 'ember';
/**
* Display a deprecation warning with the provided message and a stack trace
* (Chrome and Firefox only).
*/
export function deprecate(
message: string,
test: boolean,
options: { id: string; until: string }
): any;
export const deprecate: typeof Ember.deprecate;
export const deprecateFunc: typeof Ember.deprecateFunc;
/**
* @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options
*/
export function deprecate(
message: string,
test: boolean,
options?: { id?: string; until?: string }
): any;
/**
* @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options
*/
export function deprecateFunc<Func extends ((...args: any[]) => any)>(
message: string,
func: Func
): Func;
/**
* Alias an old, deprecated method with its new counterpart.
*/
export function deprecateFunc<Func extends ((...args: any[]) => any)>(
message: string,
options: { id: string; until: string },
func: Func
): Func;
+1 -3
View File
@@ -1,3 +1 @@
import Ember from 'ember';
export default class GlobalsResolver extends Ember.DefaultResolver { }
export { default } from '@ember/application/-private/default-resolver';
+129 -6
View File
@@ -4,10 +4,133 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import Ember from 'ember';
import Engine from '@ember/engine';
import ApplicationInstance from '@ember/application/instance';
import EventDispatcher from '@ember/application/-private/event-dispatcher';
import { EventDispatcherEvents } from '@ember/application/types';
import DefaultResolver from '@ember/application/-private/default-resolver';
import { Router } from '@ember/routing';
import Registry from '@ember/application/-private/registry';
export default class Application extends Ember.Application { }
export const getOwner: typeof Ember.getOwner;
export const onLoad: typeof Ember.onLoad;
export const runLoadHooks: typeof Ember.runLoadHooks;
export const setOwner: typeof Ember.setOwner;
/**
* An instance of Ember.Application is the starting point for every Ember application. It helps to
* instantiate, initialize and coordinate the many objects that make up your app.
*/
export default class Application extends Engine {
/**
* Call advanceReadiness after any asynchronous setup logic has completed.
* Each call to deferReadiness must be matched by a call to advanceReadiness
* or the application will never become ready and routing will not begin.
*/
advanceReadiness(): void;
/**
* Use this to defer readiness until some condition is true.
*
* This allows you to perform asynchronous setup logic and defer
* booting your application until the setup has finished.
*
* However, if the setup requires a loading UI, it might be better
* to use the router for this purpose.
*/
deferReadiness(): void;
/**
* defines an injection or typeInjection
*/
inject(factoryNameOrType: string, property: string, injectionName: string): void;
/**
* This injects the test helpers into the window's scope. If a function of the
* same name has already been defined it will be cached (so that it can be reset
* if the helper is removed with `unregisterHelper` or `removeTestHelpers`).
* Any callbacks registered with `onInjectHelpers` will be called once the
* helpers have been injected.
*/
injectTestHelpers(): void;
/**
* registers a factory for later injection
* @param fullName type:name (e.g., 'model:user')
* @param factory (e.g., App.Person)
*/
register(fullName: string, factory: any): void;
/**
* This removes all helpers that have been registered, and resets and functions
* that were overridden by the helpers.
*/
removeTestHelpers(): void;
/**
* Reset the application. This is typically used only in tests.
*/
reset(): void;
/**
* This hook defers the readiness of the application, so that you can start
* the app when your tests are ready to run. It also sets the router's
* location to 'none', so that the window's location will not be modified
* (preventing both accidental leaking of state between tests and interference
* with your testing framework).
*/
setupForTesting(): void;
/**
* The DOM events for which the event dispatcher should listen.
*/
customEvents: EventDispatcherEvents;
/**
* The Ember.EventDispatcher responsible for delegating events to this application's views.
*/
eventDispatcher: EventDispatcher;
/**
* Set this to provide an alternate class to Ember.DefaultResolver
*/
resolver: DefaultResolver;
/**
* The root DOM element of the Application. This can be specified as an
* element or a jQuery-compatible selector string.
*
* This is the element that will be passed to the Application's, eventDispatcher,
* which sets up the listeners for event delegation. Every view in your application
* should be a child of the element you specify here.
*/
rootElement: HTMLElement | string;
/**
* Called when the Application has become ready.
* The call will be delayed until the DOM has become ready.
*/
ready: (...args: any[]) => any;
/**
* Application's router.
*/
Router: Router;
registry: Registry;
/**
* Initialize the application and return a promise that resolves with the `Application`
* object when the boot process is complete.
*/
boot(): Promise<Application>;
/**
* Create an ApplicationInstance for this Application.
*/
buildInstance(options?: object): ApplicationInstance;
}
/**
* Framework objects in an Ember application (components, services, routes, etc.)
* are created via a factory and dependency injection system. Each of these
* objects is the responsibility of an "owner", which handled its
* instantiation and manages its lifetime.
*/
export function getOwner(object: any): any;
/**
* `setOwner` forces a new owner on a given object instance. This is primarily
* useful in some testing cases.
*/
export function setOwner(object: any, owner: any): void;
/**
* Detects when a specific package of Ember (e.g. 'Ember.Application')
* has fully loaded and is available for extension.
*/
export function onLoad(name: string, callback: (...args: any[]) => any): any;
/**
* Called when an Ember.js package (e.g Ember.Application) has finished
* loading. Triggers any callbacks registered for this event.
*/
export function runLoadHooks(name: string, object?: {}): any;
+6 -2
View File
@@ -1,3 +1,7 @@
import Ember from 'ember';
import EngineInstance from "@ember/engine/instance";
export default class ApplicationInstance extends Ember.ApplicationInstance { }
/**
* The `ApplicationInstance` encapsulates all of the stateful aspects of a
* running `Application`.
*/
export default class ApplicationInstance extends EngineInstance {}
+2 -2
View File
@@ -1,3 +1,3 @@
import Ember from 'ember';
import EmberObject from '@ember/object';
export default class Resolver extends Ember.Resolver { }
export default class Resolver extends EmberObject {}
+6
View File
@@ -19,6 +19,8 @@
"@ember/object/*": ["ember__object/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"]
},
@@ -32,6 +34,10 @@
"index.d.ts",
"instance.d.ts",
"resolver.d.ts",
"types.d.ts",
"-private/default-resolver.d.ts",
"-private/event-dispatcher.d.ts",
"-private/registry.d.ts",
"test/application.ts",
"test/deprecations.ts",
"test/resolver.ts",
+30
View File
@@ -0,0 +1,30 @@
export interface EventDispatcherEvents {
touchstart?: string | null;
touchmove?: string | null;
touchend?: string | null;
touchcancel?: string | null;
keydown?: string | null;
keyup?: string | null;
keypress?: string | null;
mousedown?: string | null;
mouseup?: string | null;
contextmenu?: string | null;
click?: string | null;
dblclick?: string | null;
mousemove?: string | null;
focusin?: string | null;
focusout?: string | null;
mouseenter?: string | null;
mouseleave?: string | null;
submit?: string | null;
input?: string | null;
change?: string | null;
dragstart?: string | null;
drag?: string | null;
dragenter?: string | null;
dragleave?: string | null;
dragover?: string | null;
drop?: string | null;
dragend?: string | null;
[event: string]: string | null | undefined;
}
+8
View File
@@ -0,0 +1,8 @@
import Mixin from "@ember/object/mixin";
interface ActionSupport {
sendAction(action: string, ...params: any[]): void;
}
declare const ActionSupport: Mixin<ActionSupport>;
export default ActionSupport;
@@ -0,0 +1,25 @@
import Mixin from "@ember/object/mixin";
interface ClassNamesSupport {
/**
* A list of properties of the view to apply as class names. If the property is a string value,
* the value of that string will be applied as a class name.
*
* If the value of the property is a Boolean, the name of that property is added as a dasherized
* class name.
*
* If you would prefer to use a custom value instead of the dasherized property name, you can
* pass a binding like this: `classNameBindings: ['isUrgent:urgent']`
*
* This list of properties is inherited from the component's superclasses as well.
*/
classNameBindings: string[];
/**
* Standard CSS class names to apply to the view's outer element. This
* property automatically inherits any class names defined by the view's
* superclasses as well.
*/
classNames: string[];
}
declare const ClassNamesSupport: Mixin<ClassNamesSupport>;
export default ClassNamesSupport;
+11
View File
@@ -0,0 +1,11 @@
import EmberObject from "@ember/object";
import Evented from "@ember/object/evented";
import ActionHandler from "@ember/object/-private/action-handler";
/**
* Ember.CoreView is an abstract class that exists to give view-like behavior to both Ember's main
* view class Ember.Component and other classes that don't need the full functionality of Ember.Component.
*
* Unless you have specific needs for CoreView, you will use Ember.Component in your applications.
*/
export default class CoreView extends EmberObject.extend(Evented, ActionHandler) {}
@@ -0,0 +1,18 @@
import EmberObject from "@ember/object";
// tslint:disable-next-line:strict-export-declare-modifiers
interface TriggerActionOptions {
action?: string;
target?: EmberObject;
actionContext?: EmberObject;
}
/**
* Ember.TargetActionSupport is a mixin that can be included in a class to add a triggerAction method
* with semantics similar to the Handlebars {{action}} helper. In normal Ember usage, the {{action}}
* helper is usually the best choice. This mixin is most often useful when you are doing more
* complex event handling in Components.
*/
export default interface TargetActionSupport {
triggerAction(opts: TriggerActionOptions): boolean;
}
+30
View File
@@ -0,0 +1,30 @@
import TargetActionSupport from "@ember/component/-private/target-action-support";
import Mixin from "@ember/object/mixin";
/**
* `TextSupport` is a shared mixin used by both `Ember.TextField` and
* `Ember.TextArea`. `TextSupport` adds a number of methods that allow you to
* specify a controller action to invoke when a certain event is fired on your
* text field or textarea. The specifed controller action would get the current
* value of the field passed in as the only argument unless the value of
* the field is empty. In that case, the instance of the field itself is passed
* in as the only argument.
*/
interface TextSupport extends TargetActionSupport {
// tslint:disable-next-line:ban-types
cancel(event: Function): void;
// tslint:disable-next-line:ban-types
focusIn(event: Function): void;
// tslint:disable-next-line:ban-types
focusOut(event: Function): void;
// tslint:disable-next-line:ban-types
insertNewLine(event: Function): void;
// tslint:disable-next-line:ban-types
keyPress(event: Function): void;
action: string;
bubbles: boolean;
onEvent: string;
}
declare const TextSupport: Mixin<TextSupport>;
export default TextSupport;
+63
View File
@@ -0,0 +1,63 @@
import Mixin from "@ember/object/mixin";
interface ViewMixin {
/**
* A list of properties of the view to apply as attributes. If the property
* is a string value, the value of that string will be applied as the value
* for an attribute of the property's name.
*/
attributeBindings: string[];
/**
* Returns the current DOM element for the view.
*/
element: Element;
/**
* Returns a jQuery object for this view's element. If you pass in a selector
* string, this method will return a jQuery object, using the current element
* as its buffer.
*/
$: JQueryStatic;
/**
* The HTML `id` of the view's element in the DOM. You can provide this
* value yourself but it must be unique (just as in HTML):
*/
elementId: string;
/**
* Tag name for the view's outer element. The tag name is only used when an
* element is first created. If you change the `tagName` for an element, you
* must destroy and recreate the view element.
*/
tagName: string;
/**
* Renders the view again. This will work regardless of whether the
* view is already in the DOM or not. If the view is in the DOM, the
* rendering process will be deferred to give bindings a chance
* to synchronize.
*/
rerender(): void;
/**
* Called when a view is going to insert an element into the DOM.
*/
willInsertElement(): void;
/**
* Called when the element of the view has been inserted into the DOM.
* Override this function to do any set up that requires an element
* in the document body.
*/
didInsertElement(): void;
/**
* Called when the view is about to rerender, but before anything has
* been torn down. This is a good opportunity to tear down any manual
* observers you have installed based on the DOM state
*/
willClearRender(): void;
/**
* Called when the element of the view is going to be destroyed. Override
* this function to do any teardown that requires an element, like removing
* event listeners.
*/
willDestroyElement(): void;
}
declare const ViewMixin: Mixin<ViewMixin>;
export default ViewMixin;
+6 -1
View File
@@ -1,3 +1,8 @@
import Ember from 'ember';
import Component from '@ember/component';
export default class Checkbox extends Ember.Checkbox { }
/**
* The internal class used to create text inputs when the {{input}} helper is used
* with type of checkbox. See Handlebars.helpers.input for usage details.
*/
export default class Checkbox extends Component {}
+23 -2
View File
@@ -1,6 +1,27 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
/**
* Ember Helpers are functions that can compute values, and are used in templates.
* For example, this code calls a helper named `format-currency`:
*/
export default class Helper extends EmberObject {
/**
* In many cases, the ceremony of a full `Ember.Helper` class is not required.
* The `helper` method create pure-function helpers without instances. For
* example:
*/
static helper(helper: (params: any[], hash?: object) => any): Helper;
/**
* Override this function when writing a class-based helper.
*/
compute(params: any[], hash: object): any;
/**
* On a class-based helper, it may be useful to force a recomputation of that
* helpers value. This is akin to `rerender` on a component.
*/
recompute(): any;
}
export default class Helper extends Ember.Helper { }
/**
* In many cases, the ceremony of a full `Helper` class is not required.
* The `helper` method create pure-function helpers without instances. For
+88 -2
View File
@@ -4,6 +4,92 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import Ember from 'ember';
/// <reference types="jquery" />
export default class Component extends Ember.Component { }
import CoreView from "@ember/component/-private/core-view";
import ClassNamesSupport from "@ember/component/-private/class-names-support";
import ViewMixin from "@ember/component/-private/view-mixin";
import ActionSupport from "@ember/component/-private/action-support";
// tslint:disable-next-line:strict-export-declare-modifiers
interface TemplateFactory {
__htmlbars_inline_precompile_template_factory: any;
}
/**
* A view that is completely isolated. Property access in its templates go to the view object
* and actions are targeted at the view object. There is no access to the surrounding context or
* outer controller; all contextual information is passed in.
*/
export default class Component extends CoreView.extend(
ViewMixin,
ActionSupport,
ClassNamesSupport
) {
// methods
readDOMAttr(name: string): string;
// properties
/**
* The WAI-ARIA role of the control represented by this view. For example, a button may have a
* role of type 'button', or a pane may have a role of type 'alertdialog'. This property is
* used by assistive software to help visually challenged users navigate rich web applications.
*/
ariaRole: string;
/**
* The HTML id of the component's element in the DOM. You can provide this value yourself but
* it must be unique (just as in HTML):
*
* If not manually set a default value will be provided by the framework. Once rendered an
* element's elementId is considered immutable and you should never change it. If you need
* to compute a dynamic value for the elementId, you should do this when the component or
* element is being instantiated:
*/
elementId: string;
/**
* If false, the view will appear hidden in DOM.
*/
isVisible: boolean;
/**
* A component may contain a layout. A layout is a regular template but supersedes the template
* property during rendering. It is the responsibility of the layout template to retrieve the
* template property from the component (or alternatively, call Handlebars.helpers.yield,
* {{yield}}) to render it in the correct location. This is useful for a component that has a
* shared wrapper, but which delegates the rendering of the contents of the wrapper to the
* template property on a subclass.
*/
layout: TemplateFactory | string;
/**
* Enables components to take a list of parameters as arguments.
*/
static positionalParams: string[] | string;
// events
/**
* Called when the attributes passed into the component have been updated. Called both during the
* initial render of a container and during a rerender. Can be used in place of an observer; code
* placed here will be executed every time any attribute updates.
*/
didReceiveAttrs(): void;
/**
* Called after a component has been rendered, both on initial render and in subsequent rerenders.
*/
didRender(): void;
/**
* Called when the component has updated and rerendered itself. Called only during a rerender,
* not during an initial render.
*/
didUpdate(): void;
/**
* Called when the attributes passed into the component have been changed. Called only during a
* rerender, not during an initial render.
*/
didUpdateAttrs(): void;
/**
* Called before a component has been rendered, both on initial render and in subsequent rerenders.
*/
willRender(): void;
/**
* Called when the component is about to update and rerender itself. Called only during a rerender,
* not during an initial render.
*/
willUpdate(): void;
}
+7 -2
View File
@@ -1,3 +1,8 @@
import Ember from 'ember';
import TextSupport from "@ember/component/-private/text-support";
import Component from "@ember/component";
export default class TextArea extends Ember.TextArea { }
/**
* The internal class used to create textarea element when the `{{textarea}}`
* helper is used.
*/
export default class TextArea extends Component.extend(TextSupport) {}
+33 -3
View File
@@ -1,3 +1,33 @@
import Ember from 'ember';
export default class TextField extends Ember.TextField { }
import Component from "@ember/component";
import TextSupport from '@ember/component/-private/text-support';
/**
* The internal class used to create text inputs when the `{{input}}`
* helper is used with `type` of `text`.
*/
export default class TextField extends Component.extend(TextSupport) {
/**
* The `value` attribute of the input element. As the user inputs text, this
* property is updated live.
*/
value: string;
/**
* The `type` attribute of the input element.
*/
type: string;
/**
* The `size` of the text field in characters.
*/
size: string;
/**
* The `pattern` attribute of input element.
*/
pattern: string;
/**
* The `min` attribute of input element used with `type="number"` or `type="range"`.
*/
min: string;
/**
* The `max` attribute of input element used with `type="number"` or `type="range"`.
*/
max: string;
}
+8
View File
@@ -17,6 +17,8 @@
"paths": {
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/controller": ["ember__controller"],
"@ember/controller/*": ["ember__controller/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"]
},
@@ -30,6 +32,12 @@
"text-area.d.ts",
"text-field.d.ts",
"helper.d.ts",
"-private/core-view.d.ts",
"-private/class-names-support.d.ts",
"-private/view-mixin.d.ts",
"-private/action-support.d.ts",
"-private/target-action-support.d.ts",
"-private/text-support.d.ts",
"test/lib/assert.ts",
"test/component.ts",
"test/helper.ts"
+29 -3
View File
@@ -4,10 +4,36 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import Ember from 'ember';
import ActionHandler from '@ember/object/-private/action-handler';
import Mixin from '@ember/object/mixin';
import EmberObject from '@ember/object';
import ComputedProperty from '@ember/object/computed';
export default class Controller extends Ember.Controller { }
export const inject: typeof Ember.inject.controller;
// tslint:disable-next-line strict-export-declare-modifiers
type QueryParamTypes = 'boolean' | 'number' | 'array' | 'string';
// tslint:disable-next-line strict-export-declare-modifiers
type QueryParamScopeTypes = 'controller' | 'model';
/**
* Additional methods for the Controller.
*/
export interface ControllerMixin extends ActionHandler {
replaceRoute(name: string, ...args: any[]): void;
transitionToRoute(name: string, ...args: any[]): void;
model: any;
queryParams: string | string[] | Array<{ [key: string]: {
type?: QueryParamTypes,
scope?: QueryParamScopeTypes,
as?: string
}}>;
target: object;
}
export const ControllerMixin: Mixin<ControllerMixin>;
// tslint:disable-next-line:no-empty-interface
export default class Controller extends EmberObject.extend(ControllerMixin) {}
export function inject<K extends keyof Registry>(
name: K
): ComputedProperty<Registry[K]>;
// A type registry for Ember `Controller`s. Meant to be declaration-merged
// so string lookups resolve to the correct type.
+2 -3
View File
@@ -1,6 +1,7 @@
import ContainerDebugAdapter from "@ember/debug/container-debug-adapter";
import EmberObject from "@ember/object";
// tslint:disable-next-line:strict-export-declare-modifiers
declare namespace DataAdapter {
interface Column {
name: string;
@@ -25,7 +26,7 @@ declare namespace DataAdapter {
* The `DataAdapter` helps a data persistence library
* interface with tools that debug Ember such as Chrome and Firefox.
*/
declare class DataAdapter extends EmberObject {
export default class DataAdapter extends EmberObject {
/**
* The container-debug-adapter which is used
* to list all models.
@@ -60,5 +61,3 @@ declare class DataAdapter extends EmberObject {
recordsRemoved: (idx: number, count: number) => void
): () => void;
}
export default DataAdapter;
+4 -4
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import Ember from 'ember';
declare const Error: typeof Ember.Error;
export default Error;
/**
* A subclass of the JavaScript Error object for use in Ember.
*/
export default ErrorConstructor;
+28
View File
@@ -0,0 +1,28 @@
import Mixin from "@ember/object/mixin";
interface ActionsHash {
[index: string]: (...params: any[]) => any;
}
/**
* Ember.ActionHandler is available on some familiar classes including Ember.Route,
* Ember.Component, and Ember.Controller. (Internally the mixin is used by Ember.CoreView,
* Ember.ControllerMixin, and Ember.Route and available to the above classes through inheritance.)
*/
interface ActionHandler {
/**
* Triggers a named action on the ActionHandler. Any parameters supplied after the actionName
* string will be passed as arguments to the action target function.
*
* If the ActionHandler has its target property set, actions may bubble to the target.
* Bubbling happens when an actionName can not be found in the ActionHandler's actions
* hash or if the action target function returns true.
*/
send(actionName: string, ...args: any[]): void;
/**
* The collection of functions, keyed by name, available on this ActionHandler as action targets.
*/
actions: ActionsHash;
}
declare const ActionHandler: Mixin<ActionHandler>;
export default ActionHandler;
+1
View File
@@ -14,6 +14,7 @@ export function cacheFor<T, K extends keyof T>(
* Creates a shallow copy of the passed object. A deep copy of the object is
* returned if the optional `deep` argument is `true`.
*/
export function copy<T>(obj: T, deep: true): T;
export function copy(obj: any, deep?: boolean): any;
/**
* Returns a unique id for the object. If the object does not yet have a guid,
+1
View File
@@ -36,6 +36,7 @@
"proxy.d.ts",
"-private/types.d.ts",
"-private/copyable.d.ts",
"-private/action-handler.d.ts",
"test/lib/assert.ts",
"test/access-modifier.ts",
"test/core.ts",
+18
View File
@@ -0,0 +1,18 @@
export default class RouterDSL {
constructor(name: string, options: object);
route(name: string, callback: (this: RouterDSL) => void): void;
route(
name: string,
options?: { path?: string; resetNamespace?: boolean },
callback?: (this: RouterDSL) => void
): void;
mount(
name: string,
options?: {
as?: string,
path?: string,
resetNamespace?: boolean,
engineInfo?: any
}
): void;
}
+13
View File
@@ -0,0 +1,13 @@
export default interface Transition {
/**
* Aborts the Transition. Note you can also implicitly abort a transition
* by initiating another transition while a previous one is underway.
*/
abort(): Transition;
/**
* Retries a previously-aborted transition (making sure to abort the
* transition if it's still active). Returns a new transition that
* represents the new attempt to transition.
*/
retry(): Transition;
}
+5 -2
View File
@@ -1,3 +1,6 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class AutoLocation extends Ember.AutoLocation { }
/**
* AutoLocation will select the best location option based off browser support with the priority order: history, hash, none.
*/
export default class AutoLocation extends EmberObject {}
+7 -2
View File
@@ -1,3 +1,8 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class HashLocation extends Ember.HashLocation { }
/**
* `Ember.HashLocation` implements the location API using the browser's
* hash. At present, it relies on a `hashchange` event existing in the
* browser.
*/
export default class HashLocation extends EmberObject {}
+6 -2
View File
@@ -1,3 +1,7 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class HistoryLocation extends Ember.HistoryLocation { }
/**
* Ember.HistoryLocation implements the location API using the browser's
* history.pushState API.
*/
export default class HistoryLocation extends EmberObject {}
+6
View File
@@ -6,3 +6,9 @@
export { default as Route } from '@ember/routing/route';
export { default as Router } from '@ember/routing/router';
import RouterService from '@ember/routing/router-service';
// tslint:disable-next-line:strict-export-declare-modifiers
interface Registry {
'router': RouterService;
}
+38 -2
View File
@@ -1,3 +1,39 @@
import Ember from 'ember';
import Component from "@ember/component";
export default class LinkComponent extends Ember.LinkComponent { }
/**
* `Ember.LinkComponent` renders an element whose `click` event triggers a
* transition of the application's instance of `Ember.Router` to
* a supplied route by name.
*/
export default class LinkComponent extends Component {
/**
* Used to determine when this `LinkComponent` is active.
*/
currentWhen: any;
/**
* Sets the `title` attribute of the `LinkComponent`'s HTML element.
*/
title: string | null;
/**
* Sets the `rel` attribute of the `LinkComponent`'s HTML element.
*/
rel: string | null;
/**
* Sets the `tabindex` attribute of the `LinkComponent`'s HTML element.
*/
tabindex: string | null;
/**
* Sets the `target` attribute of the `LinkComponent`'s HTML element.
*/
target: string | null;
/**
* The CSS class to apply to `LinkComponent`'s element when its `active`
* property is `true`.
*/
activeClass: string;
/**
* Determines whether the `LinkComponent` will trigger routing via
* the `replaceWith` routing strategy.
*/
replace: boolean;
}
+12 -3
View File
@@ -1,4 +1,13 @@
import Ember from 'ember';
export const Location: typeof Ember.Location;
/**
* Ember.Location returns an instance of the correct implementation of
* the `location` API.
*/
declare const Location: {
/**
* This is deprecated in favor of using the container to lookup the location
* implementation as desired.
* @deprecated Use the container to lookup the location implementation that you need.
*/
create(options?: {}): any;
};
export default Location;
+8 -2
View File
@@ -1,3 +1,9 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
export default class NoneLocation extends Ember.NoneLocation { }
/**
* Ember.NoneLocation does not interact with the browser. It is useful for
* testing, or when you need to manage state with your Router, but temporarily
* don't want it to muck with the URL (for example when you embed your
* application in a larger page).
*/
export default class NoneLocation extends EmberObject {}
+285 -2
View File
@@ -1,3 +1,286 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
import ActionHandler from "@ember/object/-private/action-handler";
import Transition from "@ember/routing/-private/transition";
import Evented from "@ember/object/evented";
import { RenderOptions, RouteQueryParam } from "@ember/routing/types";
import Controller, { Registry as ControllerRegistry } from '@ember/controller';
export default class Route extends Ember.Route { }
/**
* The `Ember.Route` class is used to define individual routes. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
export default class Route extends EmberObject.extend(ActionHandler, Evented) {
// methods
/**
* This hook is called after this route's model has resolved.
* It follows identical async/promise semantics to `beforeModel`
* but is provided the route's resolved model in addition to
* the `transition`, and is therefore suited to performing
* logic that can only take place after the model has already
* resolved.
*/
afterModel(resolvedModel: any, transition: Transition): any;
/**
* This hook is the first of the route entry validation hooks
* called when an attempt is made to transition into a route
* or one of its children. It is called before `model` and
* `afterModel`, and is appropriate for cases when:
* 1) A decision can be made to redirect elsewhere without
* needing to resolve the model first.
* 2) Any async operations need to occur first before the
* model is attempted to be resolved.
* This hook is provided the current `transition` attempt
* as a parameter, which can be used to `.abort()` the transition,
* save it for a later `.retry()`, or retrieve values set
* on it from a previous hook. You can also just call
* `this.transitionTo` to another route to implicitly
* abort the `transition`.
* You can return a promise from this hook to pause the
* transition until the promise resolves (or rejects). This could
* be useful, for instance, for retrieving async code from
* the server that is required to enter a route.
*/
beforeModel(transition: Transition): any;
/**
* Returns the controller for a particular route or name.
* The controller instance must already have been created, either through entering the
* associated route or using `generateController`.
*/
controllerFor<K extends keyof ControllerRegistry>(name: K): ControllerRegistry[K];
/**
* Disconnects a view that has been rendered into an outlet.
*/
disconnectOutlet(options: string | { outlet?: string; parentView?: string }): void;
/**
* A hook you can implement to convert the URL into the model for
* this route.
*/
model(params: {}, transition: Transition): any;
/**
* Returns the model of a parent (or any ancestor) route
* in a route hierarchy. During a transition, all routes
* must resolve a model object, and if a route
* needs access to a parent route's model in order to
* resolve a model (or just reuse the model from a parent),
* it can call `this.modelFor(theNameOfParentRoute)` to
* retrieve it.
*/
modelFor(name: string): {};
/**
* Retrieves parameters, for current route using the state.params
* variable and getQueryParamsFor, using the supplied routeName.
*/
paramsFor(name: string): {};
/**
* Refresh the model on this route and any child routes, firing the
* `beforeModel`, `model`, and `afterModel` hooks in a similar fashion
* to how routes are entered when transitioning in from other route.
* The current route params (e.g. `article_id`) will be passed in
* to the respective model hooks, and if a different model is returned,
* `setupController` and associated route hooks will re-fire as well.
* An example usage of this method is re-querying the server for the
* latest information using the same parameters as when the route
* was first entered.
* Note that this will cause `model` hooks to fire even on routes
* that were provided a model object when the route was initially
* entered.
*/
redirect(): Transition;
/**
* Refresh the model on this route and any child routes, firing the
* `beforeModel`, `model`, and `afterModel` hooks in a similar fashion
* to how routes are entered when transitioning in from other route.
* The current route params (e.g. `article_id`) will be passed in
* to the respective model hooks, and if a different model is returned,
* `setupController` and associated route hooks will re-fire as well.
* An example usage of this method is re-querying the server for the
* latest information using the same parameters as when the route
* was first entered.
* Note that this will cause `model` hooks to fire even on routes
* that were provided a model object when the route was initially
* entered.
*/
refresh(): Transition;
/**
* `render` is used to render a template into a region of another template
* (indicated by an `{{outlet}}`). `render` is used both during the entry
* phase of routing (via the `renderTemplate` hook) and later in response to
* user interaction.
*/
render(name: string, options?: RenderOptions): void;
/**
* A hook you can use to render the template for the current route.
* This method is called with the controller for the current route and the
* model supplied by the `model` hook. By default, it renders the route's
* template, configured with the controller for the route.
* This method can be overridden to set up and render additional or
* alternative templates.
*/
renderTemplate(controller: Controller, model: {}): void;
/**
* Transition into another route while replacing the current URL, if possible.
* This will replace the current history entry instead of adding a new one.
* Beside that, it is identical to `transitionTo` in all other respects. See
* 'transitionTo' for additional information regarding multiple models.
*/
replaceWith(name: string, ...args: any[]): Transition;
/**
* A hook you can use to reset controller values either when the model
* changes or the route is exiting.
*/
resetController(controller: Controller, isExiting: boolean, transition: any): void;
/**
* Sends an action to the router, which will delegate it to the currently active
* route hierarchy per the bubbling rules explained under actions.
*/
send(name: string, ...args: any[]): void;
/**
* A hook you can implement to convert the route's model into parameters
* for the URL.
*
* The default `serialize` method will insert the model's `id` into the
* route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'.
* If the route has multiple dynamic segments or does not contain '_id', `serialize`
* will return `Ember.getProperties(model, params)`
* This method is called when `transitionTo` is called with a context
* in order to populate the URL.
*/
serialize(model: {}, params: string[]): string | object;
/**
* A hook you can use to setup the controller for the current route.
* This method is called with the controller for the current route and the
* model supplied by the `model` hook.
* By default, the `setupController` hook sets the `model` property of
* the controller to the `model`.
* If you implement the `setupController` hook in your Route, it will
* prevent this default behavior. If you want to preserve that behavior
* when implementing your `setupController` function, make sure to call
* `_super`
*/
setupController(controller: Controller, model: {}): void;
/**
* Transition the application into another route. The route may
* be either a single route or route path
*/
transitionTo(name: string, ...object: any[]): Transition;
/**
* The name of the view to use by default when rendering this routes template.
* When rendering a template, the route will, by default, determine the
* template and view to use from the name of the route itself. If you need to
* define a specific view, set this property.
* This is useful when multiple routes would benefit from using the same view
* because it doesn't require a custom `renderTemplate` method.
*/
transitionTo(name: string, ...object: any[]): Transition;
// https://emberjs.com/api/ember/3.2/classes/Route/methods/intermediateTransitionTo?anchor=intermediateTransitionTo
/**
* Perform a synchronous transition into another route without attempting to resolve promises,
* update the URL, or abort any currently active asynchronous transitions
* (i.e. regular transitions caused by transitionTo or URL changes).
*
* @param name the name of the route or a URL
* @param object the model(s) or identifier(s) to be used while
* transitioning to the route.
* @returns the Transition object associated with this attempted transition
*/
intermediateTransitionTo(name: string, ...object: any[]): Transition;
// properties
/**
* The controller associated with this route.
*/
controller: Controller;
/**
* The name of the controller to associate with this route.
* By default, Ember will lookup a route's controller that matches the name
* of the route (i.e. `App.PostController` for `App.PostRoute`). However,
* if you would like to define a specific controller to use, you can do so
* using this property.
* This is useful in many ways, as the controller specified will be:
* * p assed to the `setupController` method.
* * used as the controller for the view being rendered by the route.
* * returned from a call to `controllerFor` for the route.
*/
controllerName: string;
/**
* Configuration hash for this route's queryParams.
*/
queryParams: { [key: string]: RouteQueryParam };
/**
* The name of the route, dot-delimited
*/
routeName: string;
/**
* The name of the template to use by default when rendering this routes
* template.
* This is similar with `viewName`, but is useful when you just want a custom
* template without a view.
*/
templateName: string;
// events
/**
* This hook is executed when the router enters the route. It is not executed
* when the model for the route changes.
*/
activate(): void;
/**
* This hook is executed when the router completely exits this route. It is
* not executed when the model for the route changes.
*/
deactivate(): void;
/**
* The didTransition action is fired after a transition has successfully been
* completed. This occurs after the normal model hooks (beforeModel, model,
* afterModel, setupController) have resolved. The didTransition action has
* no arguments, however, it can be useful for tracking page views or resetting
* state on the controller.
*/
didTransition(): void;
/**
* When attempting to transition into a route, any of the hooks may return a promise
* that rejects, at which point an error action will be fired on the partially-entered
* routes, allowing for per-route error handling logic, or shared error handling logic
* defined on a parent route.
*/
error(error: any, transition: Transition): void;
/**
* The loading action is fired on the route when a route's model hook returns a
* promise that is not already resolved. The current Transition object is the first
* parameter and the route that triggered the loading event is the second parameter.
*/
loading(transition: Transition, route: Route): void;
/**
* The willTransition action is fired at the beginning of any attempted transition
* with a Transition object as the sole argument. This action can be used for aborting,
* redirecting, or decorating the transition from the currently active routes.
*/
willTransition(transition: Transition): void;
}
+214 -2
View File
@@ -1,3 +1,215 @@
import { RouterService } from 'ember';
import Transition from '@ember/routing/-private/transition';
import Service from '@ember/service';
export default class extends RouterService { }
// tslint:disable-next-line:strict-export-declare-modifiers
type RouteModel = object | string | number;
// https://emberjs.com/api/ember/2.18/classes/RouterService
/**
* The Router service is the public API that provides component/view layer access to the router.
*/
export default class RouterService extends Service {
//
/**
* Name of the current route.
* This property represent the logical name of the route,
* which is comma separated.
* For the following router:
* ```app/router.js
* Router.map(function() {
* this.route('about');
* this.route('blog', function () {
* this.route('post', { path: ':post_id' });
* });
* });
* ```
* It will return:
* * `index` when you visit `/`
* * `about` when you visit `/about`
* * `blog.index` when you visit `/blog`
* * `blog.post` when you visit `/blog/some-post-id`
*/
readonly currentRouteName: string;
//
/**
* Current URL for the application.
* This property represent the URL path for this route.
* For the following router:
* ```app/router.js
* Router.map(function() {
* this.route('about');
* this.route('blog', function () {
* this.route('post', { path: ':post_id' });
* });
* });
* ```
* It will return:
* * `/` when you visit `/`
* * `/about` when you visit `/about`
* * `/blog` when you visit `/blog`
* * `/blog/some-post-id` when you visit `/blog/some-post-id`
*/
readonly currentURL: string;
//
/**
* Determines whether a route is active.
*
* @param routeName the name of the route
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route
* @param options optional hash with a queryParams property containing a
* mapping of query parameters
*/
isActive(routeName: string, options?: { queryParams: object }): boolean;
isActive(
routeName: string,
models: RouteModel,
options?: { queryParams: object }
): boolean;
isActive(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): boolean;
isActive(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): boolean;
isActive(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): boolean;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=replaceWith
/**
* Transition into another route while replacing the current URL, if
* possible. The route may be either a single route or route path.
*
* @param routeNameOrUrl the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property
* containing a mapping of query parameters
* @returns the Transition object associated with this attempted transition
*/
replaceWith(
routeNameOrUrl: string,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
models: RouteModel,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): Transition;
replaceWith(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): Transition;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=transitionTo
/**
* Transition the application into another route. The route may be
* either a single route or route path
*
* @param routeNameOrUrl the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property
* containing a mapping of query parameters
* @returns the Transition object associated with this attempted transition
*/
transitionTo(
routeNameOrUrl: string,
options?: { queryParam: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
models: RouteModel,
options?: { queryParams: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): Transition;
transitionTo(
routeNameOrUrl: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): Transition;
// https://emberjs.com/api/ember/2.18/classes/RouterService/methods/isActive?anchor=urlFor
/**
* Generate a URL based on the supplied route name.
*
* @param routeName the name of the route or a URL
* @param models the model(s) or identifier(s) to be used while
* transitioning to the route.
* @param options optional hash with a queryParams property containing
* a mapping of query parameters
* @returns the string representing the generated URL
*/
urlFor(routeName: string, options?: { queryParams: object }): string;
urlFor(
routeName: string,
models: RouteModel,
options?: { queryParams: object }
): string;
urlFor(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
options?: { queryParams: object }
): string;
urlFor(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
options?: { queryParams: object }
): string;
urlFor(
routeName: string,
modelsA: RouteModel,
modelsB: RouteModel,
modelsC: RouteModel,
modelsD: RouteModel,
options?: { queryParams: object }
): string;
}
+50 -2
View File
@@ -1,3 +1,51 @@
import Ember from 'ember';
import EmberObject from "@ember/object";
import Evented from "@ember/object/evented";
import RouterDSL from "@ember/routing/-private/router-dsl";
import Transition from "@ember/routing/-private/transition";
import RouterService from "@ember/routing/router-service";
export default class EmberRouter extends Ember.Router { }
/**
* The `Ember.Router` class manages the application state and URLs. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
export default class Router extends EmberObject.extend(Evented) {
/**
* The `Router.map` function allows you to define mappings from URLs to routes
* in your application. These mappings are defined within the
* supplied callback function using `this.route`.
*/
static map(callback: (this: RouterDSL) => void): void;
/**
* The `location` property determines the type of URL's that your
* application will use.
*/
location: string;
/**
* Represents the URL of the root of the application, often '/'. This prefix is
* assumed on all routes defined on this router.
*/
rootURL: string;
/**
* Handles updating the paths and notifying any listeners of the URL
* change.
*/
didTransition(): any;
/**
* Handles notifying any listeners of an impending URL
* change.
*/
willTransition(): any;
/**
* Transition the application into another route. The route may
* be either a single route or route path:
*/
transitionTo(name: string, options?: {}): Transition;
transitionTo(name: string, ...models: any[]): Transition;
transitionTo(name: string, options: {}): Transition;
}
declare module '@ember/service' {
interface Registry {
'router': RouterService;
}
}
+6 -6
View File
@@ -1,21 +1,21 @@
import Route from '@ember/routing/route';
import Array from '@ember/array';
import Ember from 'ember'; // currently needed for Transition
import EmberObject from '@ember/object';
import Controller from '@ember/controller';
import Transition from '@ember/routing/-private/transition';
class Post extends EmberObject {}
interface Posts extends Array<Post> {}
Route.extend({
beforeModel(transition: Ember.Transition) {
beforeModel(transition: Transition) {
this.transitionTo('someOtherRoute');
},
});
Route.extend({
afterModel(posts: Posts, transition: Ember.Transition) {
afterModel(posts: Posts, transition: Transition) {
if (posts.length === 1) {
this.transitionTo('post.show', posts.firstObject);
}
@@ -39,7 +39,7 @@ Route.extend({
},
});
Ember.Route.extend({
Route.extend({
model() {
return this.modelFor('post');
},
@@ -61,7 +61,7 @@ Route.extend({
});
Route.extend({
renderTemplate(controller: Ember.Controller, model: {}) {
renderTemplate(controller: Controller, model: {}) {
this.render('posts', {
view: 'someView', // the template to render, referenced by name
into: 'application', // the template to render into, referenced by name
@@ -73,7 +73,7 @@ Route.extend({
});
Route.extend({
resetController(controller: Ember.Controller, isExiting: boolean, transition: boolean) {
resetController(controller: Controller, isExiting: boolean, transition: boolean) {
if (isExiting) {
// controller.set('page', 1);
}
+15 -13
View File
@@ -1,7 +1,9 @@
import Ember from 'ember';
import { assertType } from './lib/assert';
import Router from '@ember/routing/router';
import Service, { inject as service } from '@ember/service';
import EmberObject, { get } from '@ember/object';
const AppRouter = Ember.Router.extend({
const AppRouter = Router.extend({
});
AppRouter.map(function() {
@@ -24,31 +26,31 @@ AppRouter.map(function() {
this.mount('my-engine', { as: 'some-other-engine', path: '/some-other-engine'});
});
const RouterServiceConsumer = Ember.Service.extend({
router: Ember.inject.service('router'),
const RouterServiceConsumer = Service.extend({
router: service('router'),
currentRouteName() {
const x: string = Ember.get(this, 'router').currentRouteName;
const x: string = get(this, 'router').currentRouteName;
},
currentURL() {
const x: string = Ember.get(this, 'router').currentURL;
const x: string = get(this, 'router').currentURL;
},
transitionWithoutModel() {
Ember.get(this, 'router')
get(this, 'router')
.transitionTo('some-route');
},
transitionWithModel() {
const model = Ember.Object.create();
Ember.get(this, 'router')
const model = EmberObject.create();
get(this, 'router')
.transitionTo('some.other.route', model);
},
transitionWithMultiModel() {
const model = Ember.Object.create();
Ember.get(this, 'router')
const model = EmberObject.create();
get(this, 'router')
.transitionTo('some.other.route', model, model);
},
transitionWithModelAndOptions() {
const model = Ember.Object.create();
Ember.get(this, 'router')
const model = EmberObject.create();
get(this, 'router')
.transitionTo('index', model, { queryParams: { search: 'ember' }});
}
});
+9
View File
@@ -15,10 +15,16 @@
"../"
],
"paths": {
"@ember/service": ["ember__service"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/array": ["ember__array"],
"@ember/array/*": ["ember__array/*"],
"@ember/service": ["ember__service"],
"@ember/service/*": ["ember__service/*"],
"@ember/component": ["ember__component"],
"@ember/component/*": ["ember__component/*"],
"@ember/controller": ["ember__controller"],
"@ember/routing": ["ember__routing"],
"@ember/routing/*": ["ember__routing/*"]
},
@@ -37,6 +43,9 @@
"route.d.ts",
"router-service.d.ts",
"router.d.ts",
"types.d.ts",
"-private/router-dsl.d.ts",
"-private/transition.d.ts",
"test/lib/assert.ts",
"test/route.ts",
"test/router.ts"
+13
View File
@@ -0,0 +1,13 @@
export interface RenderOptions {
into?: string;
controller?: string;
model?: any;
outlet?: string;
view?: string;
}
export interface RouteQueryParam {
refreshModel?: boolean;
replace?: boolean;
as?: string;
}
+8
View File
@@ -0,0 +1,8 @@
export type RunMethod<Target, Ret = any> = ((this: Target, ...args: any[]) => Ret) | keyof Target;
export type EmberRunQueues =
| 'sync'
| 'actions'
| 'routerTransitions'
| 'render'
| 'afterRender'
| 'destroy';
+16 -19
View File
@@ -1,9 +1,8 @@
import Ember from 'ember';
import RSVP from 'rsvp';
import { run } from '@ember/runloop';
import EmberObject from '@ember/object';
Ember.run.queues; // $ExpectType EmberRunQueues[]
const queues: string[] = Ember.run.queues;
run.queues; // $ExpectType EmberRunQueues[]
const queues: string[] = run.queues;
function testRun() {
run(() => { // $ExpectType number
@@ -11,8 +10,8 @@ function testRun() {
return 123;
});
function destroyApp(application: Ember.Application) {
Ember.run(application, 'destroy');
function destroyApp(application: EmberObject) {
run(application, 'destroy');
run(application, function() {
this.destroy();
});
@@ -20,9 +19,9 @@ function testRun() {
}
function testBind() {
Ember.Component.extend({
EmberObject.extend({
init() {
const bound = Ember.run.bind(this, this.setupEditor);
const bound = run.bind(this, this.setupEditor);
bound();
},
@@ -91,14 +90,14 @@ function testDebounce() {
run.debounce(myContext, runIt, 150);
run.debounce(myContext, runIt, 150, true);
Ember.Component.extend({
EmberObject.extend({
searchValue: 'test',
fetchResults(value: string) {},
actions: {
handleTyping() {
// the fetchResults function is passed into the component from its parent
Ember.run.debounce(this, this.get('fetchResults'), this.get('searchValue'), 250);
run.debounce(this, this.get('fetchResults'), this.get('searchValue'), 250);
}
}
});
@@ -123,11 +122,9 @@ function testJoin() {
});
});
new RSVP.Promise((resolve) => {
Ember.run.later(() => {
resolve({ msg: 'Hold Your Horses' });
}, 3000);
});
run.later(() => {
console.log({ msg: 'Hold Your Horses' });
}, 3000);
}
function testLater() {
@@ -146,9 +143,9 @@ function testNext() {
}
function testOnce() {
Ember.Component.extend({
EmberObject.extend({
init() {
Ember.run.once(this, 'processFullName');
run.once(this, 'processFullName');
},
processFullName() {
@@ -157,7 +154,7 @@ function testOnce() {
}
function testSchedule() {
Ember.Component.extend({
EmberObject.extend({
init() {
run.schedule('sync', this, () => {
// this will be executed in the first RunLoop queue, when bindings are synced
@@ -171,7 +168,7 @@ function testSchedule() {
}
});
Ember.run.schedule('actions', () => {
run.schedule('actions', () => {
// Do more things
});
}
+322 -14
View File
@@ -4,18 +4,326 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import Ember from 'ember';
import { RunMethod, EmberRunQueues } from "@ember/runloop/-private/types";
import { EmberRunTimer } from "@ember/runloop/types";
export const begin: typeof Ember.run.begin;
export const bind: typeof Ember.run.bind;
export const cancel: typeof Ember.run.cancel;
export const debounce: typeof Ember.run.debounce;
export const end: typeof Ember.run.end;
export const join: typeof Ember.run.join;
export const later: typeof Ember.run.later;
export const next: typeof Ember.run.next;
export const once: typeof Ember.run.once;
export const run: typeof Ember.run;
export const schedule: typeof Ember.run.schedule;
export const scheduleOnce: typeof Ember.run.scheduleOnce;
export const throttle: typeof Ember.run.throttle;
// tslint:disable-next-line:strict-export-declare-modifiers
export const run: {
/**
* Runs the passed target and method inside of a RunLoop, ensuring any
* deferred actions including bindings and views updates are flushed at the
* end.
*/
<Ret>(method: (...args: any[]) => Ret): Ret;
<Target, Ret>(target: Target, method: RunMethod<Target, Ret>): Ret;
/**
* If no run-loop is present, it creates a new one. If a run loop is
* present it will queue itself to run on the existing run-loops action
* queue.
*/
join<Ret>(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined;
join<Target, Ret>(
target: Target,
method: RunMethod<Target, Ret>,
...args: any[]
): Ret | undefined;
/**
* Allows you to specify which context to call the specified function in while
* adding the execution of that function to the Ember run loop. This ability
* makes this method a great way to asynchronously integrate third-party libraries
* into your Ember application.
*/
bind<Target, Ret>(
target: Target,
method: RunMethod<Target, Ret>,
...args: any[]
): (...args: any[]) => Ret;
/**
* Begins a new RunLoop. Any deferred actions invoked after the begin will
* be buffered until you invoke a matching call to `run.end()`. This is
* a lower-level way to use a RunLoop instead of using `run()`.
*/
begin(): void;
/**
* Ends a RunLoop. This must be called sometime after you call
* `run.begin()` to flush any deferred actions. This is a lower-level way
* to use a RunLoop instead of using `run()`.
*/
end(): void;
/**
* Adds the passed target/method and any optional arguments to the named
* queue to be executed at the end of the RunLoop. If you have not already
* started a RunLoop when calling this method one will be started for you
* automatically.
*/
schedule<Target>(
queue: EmberRunQueues,
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
schedule(
queue: EmberRunQueues,
method: (args: any[]) => any,
...args: any[]
): EmberRunTimer;
/**
* Invokes the passed target/method and optional arguments after a specified
* period of time. The last parameter of this method must always be a number
* of milliseconds.
*/
later(method: (...args: any[]) => any, wait: number): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
wait: number
): EmberRunTimer;
/**
* Schedule a function to run one time during the current RunLoop. This is equivalent
* to calling `scheduleOnce` with the "actions" queue.
*/
once<Target>(
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Schedules a function to run one time in a given queue of the current RunLoop.
* Calling this method with the same queue/target/method combination will have
* no effect (past the initial call).
*/
scheduleOnce<Target>(
queue: EmberRunQueues,
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Schedules an item to run from within a separate run loop, after
* control has been returned to the system. This is equivalent to calling
* `run.later` with a wait time of 1ms.
*/
next<Target>(
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Cancels a scheduled item. Must be a value returned by `run.later()`,
* `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or
* `run.throttle()`.
*/
cancel(timer: EmberRunTimer): boolean;
/**
* Delay calling the target method until the debounce period has elapsed
* with no additional debounce calls. If `debounce` is called again before
* the specified time has elapsed, the timer is reset and the entire period
* must pass again before the target method is called.
*/
debounce(
method: (...args: any[]) => any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
/**
* Ensure that the target method is never called more frequently than
* the specified spacing period. The target method is called immediately.
*/
throttle(
method: (...args: any[]) => any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
queues: EmberRunQueues[];
};
export const begin: typeof run.begin;
export const bind: typeof run.bind;
export const cancel: typeof run.cancel;
export const debounce: typeof run.debounce;
export const end: typeof run.end;
export const join: typeof run.join;
export const later: typeof run.later;
export const next: typeof run.next;
export const once: typeof run.once;
export const schedule: typeof run.schedule;
export const scheduleOnce: typeof run.scheduleOnce;
export const throttle: typeof run.throttle;
+4 -3
View File
@@ -17,9 +17,8 @@
"paths": {
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/runloop": ["ember__runloop"]
"@ember/runloop": ["ember__runloop"],
"@ember/runloop/*": ["ember__runloop/*"]
},
"types": [],
"noEmit": true,
@@ -27,6 +26,8 @@
},
"files": [
"index.d.ts",
"types.d.ts",
"-private/types.d.ts",
"ember__runloop-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
export interface EmberRunTimer {
__ember_run_timer_brand__: boolean;
}
+11 -3
View File
@@ -4,10 +4,18 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import Ember from 'ember';
import EmberObject from '@ember/object';
import ComputedProperty from '@ember/object/computed';
export default class Service extends Ember.Service { }
export const inject: typeof Ember.inject.service;
export default class Service extends EmberObject {}
/**
* Creates a property that lazily looks up a service in the container. There
* are no restrictions as to what objects a service can be injected into.
*/
export function inject(): ComputedProperty<Service>;
export function inject<K extends keyof Registry>(
name: K
): ComputedProperty<Registry[K]>;
// A type registry for Ember `Service`s. Meant to be declaration-merged so
// string lookups resolve to the correct type.
+1
View File
@@ -7,6 +7,7 @@
// TypeScript Version: 2.8
/// <reference types="ember" />
/// <reference types="ember__error" />
declare module '@ember/test-helpers' {
// DOM Interaction Helpers
+3
View File
@@ -19,6 +19,9 @@
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/error": ["ember__error"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/object": ["ember__object"],
"@ember/object/*": ["ember__object/*"],
"@ember/test-helpers": ["ember__test-helpers"]
+20 -2
View File
@@ -1,2 +1,20 @@
import Ember from 'ember';
export default class TestAdapter extends Ember.Test.Adapter { }
/**
* The primary purpose of this class is to create hooks that can be implemented
* by an adapter for various test frameworks.
*/
export default class Adapter {
/**
* This callback will be called whenever an async operation is about to start.
*/
asyncStart(): any;
/**
* This callback will be called whenever an async operation has completed.
*/
asyncEnd(): any;
/**
* Override this method with your testing framework's false assertion.
* This function is called whenever an exception occurs causing the testing
* promise to fail.
*/
exception(error: string): any;
}
+47 -6
View File
@@ -4,9 +4,50 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import Ember from 'ember';
export const registerAsyncHelper: typeof Ember.Test.registerAsyncHelper;
export const registerHelper: typeof Ember.Test.registerHelper;
export const registerWaiter: typeof Ember.Test.registerWaiter;
export const unregisterHelper: typeof Ember.Test.unregisterHelper;
export const unregisterWaiter: typeof Ember.Test.unregisterWaiter;
import Application from '@ember/application';
/**
* `registerHelper` is used to register a test helper that will be injected
* when `App.injectTestHelpers` is called.
*/
export function registerHelper(
name: string,
helperMethod: (app: Application, ...args: any[]) => any,
options?: object
): any;
/**
* `registerAsyncHelper` is used to register an async test helper that will be injected
* when `App.injectTestHelpers` is called.
*/
export function registerAsyncHelper(
name: string,
helperMethod: (app: Application, ...args: any[]) => any
): void;
/**
* Remove a previously added helper method.
*/
export function unregisterHelper(name: string): void;
/**
* This allows ember-testing to play nicely with other asynchronous
* events, such as an application that is waiting for a CSS3
* transition or an IndexDB transaction. The waiter runs periodically
* after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
* until the returning result is truthy. After the waiters finish, the next async helper
* is executed and the process repeats.
*/
export function registerWaiter(callback: () => boolean): any;
export function registerWaiter<Context>(
context: Context,
callback: (this: Context) => boolean
): any;
/**
* `unregisterWaiter` is used to unregister a callback that was
* registered with `registerWaiter`.
*/
export function unregisterWaiter(callback: () => boolean): any;
export function unregisterWaiter<Context>(
context: Context,
callback: (this: Context) => boolean
): any;
+4
View File
@@ -15,6 +15,10 @@
"../"
],
"paths": {
"@ember/engine": ["ember__engine"],
"@ember/engine/*": ["ember__engine/*"],
"@ember/application": ["ember__application"],
"@ember/application/*": ["ember__application/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"]
},
+21 -1
View File
@@ -40,7 +40,8 @@ import {
Location,
Updates,
MediaLibrary,
Haptic
Haptic,
Constants
} from 'expo';
const reverseGeocode: Promise<Location.GeocodeData[]> = Location.reverseGeocodeAsync({
@@ -874,3 +875,22 @@ Haptic.notification(Haptic.NotificationType.Error);
Haptic.selection();
// #endregion
// #region Constants
async () => {
const appOwnerShip = Constants.appOwnership;
const expoVersion = Constants.expoVersion;
const installationId = Constants.installationId;
const deviceId = Constants.deviceId;
const deviceName = Constants.deviceName;
const deviceYearClass = Constants.deviceYearClass;
const isDevice = Constants.isDevice;
const platform = Constants.platform;
const sessionId = Constants.sessionId;
const statusBarHeight = Constants.statusBarHeight;
const systemFonts = Constants.systemFonts;
const manifest = Constants.manifest;
const linkingUri = Constants.linkingUri;
const userAgent: string = await Constants.getWebViewUserAgentAsync();
};
// #endregion
+3
View File
@@ -877,6 +877,7 @@ export class Camera extends Component<CameraProps> {
export namespace Constants {
const appOwnership: 'expo' | 'standalone' | 'guest';
const expoVersion: string;
const installationId: string;
const deviceId: string;
const deviceName: string;
const deviceYearClass: number;
@@ -991,6 +992,8 @@ export namespace Constants {
}
const manifest: Manifest;
const linkingUri: string;
function getWebViewUserAgentAsync(): Promise<string>;
}
/**
@@ -6,8 +6,6 @@ browser.runtime.getManifest(); // $ExpectType WebExtensionManifest
browser.test; // $ExpectError
browser.manifest; // $ExpectError
browser._manifest; // $ExpectError
browser._manifest.WebExtensionLangpackManifest; // $ExpectError
browser._manifest.NativeManifest; // $ExpectError
// browser.runtime
const port = browser.runtime.connect();
+1365 -388
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -292,7 +292,7 @@ declare namespace Ffmpeg {
saveToFile(output: string): FfmpegCommand;
save(output: string): FfmpegCommand;
writeToStream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable;
pipe(stream: stream.Writable, options?: { end?: boolean }): stream.Writable;
pipe(stream?: stream.Writable, options?: { end?: boolean }): stream.Writable|stream.PassThrough;
stream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable;
takeScreenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand;
thumbnail(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand;
+2 -2
View File
@@ -70,7 +70,7 @@ outVec2 = vec2.negate(outVec2, vec2A);
outVec2 = vec2.inverse(outVec2, vec2A);
outVec2 = vec2.normalize(outVec2, vec2A);
outVal = vec2.dot(vec2A, vec2B);
outVec2 = vec2.cross(outVec3, vec2A, vec2B);
outVec3 = vec2.cross(outVec3, vec2A, vec2B);
outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
outVec2 = vec2.random(outVec2);
outVec2 = vec2.random(outVec2, 5.0);
@@ -435,7 +435,7 @@ outVec2 = _vec2.negate(outVec2, vec2A);
outVec2 = _vec2.inverse(outVec2, vec2A);
outVec2 = _vec2.normalize(outVec2, vec2A);
outVal = _vec2.dot(vec2A, vec2B);
outVec2 = _vec2.cross(outVec3, vec2A, vec2B);
outVec3 = _vec2.cross(outVec3, vec2A, vec2B);
outVec2 = _vec2.lerp(outVec2, vec2A, vec2B, 0.5);
outVec2 = _vec2.random(outVec2);
outVec2 = _vec2.random(outVec2, 5.0);
+1 -1
View File
@@ -344,7 +344,7 @@ declare module 'gl-matrix' {
* @param b the second operand
* @returns out
*/
public static cross(out: vec3, a: vec2 | number[], b: vec2 | number[]): vec2;
public static cross(out: vec3, a: vec2 | number[], b: vec2 | number[]): vec3;
/**
* Performs a linear interpolation between two vec2's
+1 -1
View File
@@ -59,7 +59,7 @@ export class GraphQLError extends Error {
/**
* The original error thrown from a field resolver during execution.
*/
readonly originalError: Maybe<Error> & { readonly extensions: any };
readonly originalError: Maybe<Error>;
/**
* Extension fields to add to the formatted error.
+9 -1
View File
@@ -58,13 +58,21 @@ function contentSecurityPolicyTest() {
disableAndroid: false
};
function reportUriCb(req: express.Request, res: express.Response) { return '/some-uri'; }
function reportOnlyCb(req: express.Request, res: express.Response) { return false; }
app.use(helmet.contentSecurityPolicy());
app.use(helmet.contentSecurityPolicy({}));
app.use(helmet.contentSecurityPolicy(config));
app.use(helmet.contentSecurityPolicy({
directives: {
defaultSrc: ["'self'"]
defaultSrc: ["'self'"],
reportUri: reportUriCb,
'report-uri': reportUriCb,
reportTo: reportUriCb,
'report-to': reportUriCb
},
reportOnly: reportOnlyCb,
loose: false,
setAllHeaders: true
}));

Some files were not shown because too many files have changed in this diff Show More