test: add public api golden files

Includes a few style fixes on "* as foo" imports.
This commit is contained in:
Jason Choi 2016-06-22 14:56:10 -07:00 committed by Igor Minar
parent 249a6bdd98
commit 22d8f73bc9
25 changed files with 3658 additions and 67 deletions

View File

@ -43,7 +43,9 @@ const entrypoints = [
'dist/packages-dist/platform-server/index.d.ts',
'dist/packages-dist/platform-server/testing.d.ts',
'dist/packages-dist/http/index.d.ts',
'dist/packages-dist/http/testing.d.ts'
'dist/packages-dist/http/testing.d.ts',
'dist/packages-dist/forms/index.d.ts',
'dist/packages-dist/router/index.d.ts'
];
const publicApiDir = 'tools/public_api_guard';
const publicApiArgs = [

View File

@ -12,7 +12,7 @@ import {StringMapWrapper} from '../facade/collection';
import {isArray, isPresent} from '../facade/lang';
import {AsyncValidatorFn, ValidatorFn} from './directives/validators';
import * as modelModule from './model';
import {AbstractControl, Control, ControlArray, ControlGroup} from './model';
@ -67,22 +67,21 @@ export class FormBuilder {
*
* See the {@link ControlGroup} constructor for more details.
*/
group(controlsConfig: {[key: string]: any}, extra: {[key: string]: any} = null):
modelModule.ControlGroup {
group(controlsConfig: {[key: string]: any}, extra: {[key: string]: any} = null): ControlGroup {
var controls = this._reduceControls(controlsConfig);
var optionals = <{[key: string]: boolean}>(
isPresent(extra) ? StringMapWrapper.get(extra, 'optionals') : null);
var validator: ValidatorFn = isPresent(extra) ? StringMapWrapper.get(extra, 'validator') : null;
var asyncValidator: AsyncValidatorFn =
isPresent(extra) ? StringMapWrapper.get(extra, 'asyncValidator') : null;
return new modelModule.ControlGroup(controls, optionals, validator, asyncValidator);
return new ControlGroup(controls, optionals, validator, asyncValidator);
}
/**
* Construct a new {@link Control} with the given `value`,`validator`, and `asyncValidator`.
*/
control(value: Object, validator: ValidatorFn = null, asyncValidator: AsyncValidatorFn = null):
modelModule.Control {
return new modelModule.Control(value, validator, asyncValidator);
Control {
return new Control(value, validator, asyncValidator);
}
/**
@ -91,15 +90,14 @@ export class FormBuilder {
*/
array(
controlsConfig: any[], validator: ValidatorFn = null,
asyncValidator: AsyncValidatorFn = null): modelModule.ControlArray {
asyncValidator: AsyncValidatorFn = null): ControlArray {
var controls = controlsConfig.map(c => this._createControl(c));
return new modelModule.ControlArray(controls, validator, asyncValidator);
return new ControlArray(controls, validator, asyncValidator);
}
/** @internal */
_reduceControls(controlsConfig: {[k: string]: any}):
{[key: string]: modelModule.AbstractControl} {
var controls: {[key: string]: modelModule.AbstractControl} = {};
_reduceControls(controlsConfig: {[k: string]: any}): {[key: string]: AbstractControl} {
var controls: {[key: string]: AbstractControl} = {};
StringMapWrapper.forEach(controlsConfig, (controlConfig: any, controlName: string) => {
controls[controlName] = this._createControl(controlConfig);
});
@ -107,10 +105,9 @@ export class FormBuilder {
}
/** @internal */
_createControl(controlConfig: any): modelModule.AbstractControl {
if (controlConfig instanceof modelModule.Control ||
controlConfig instanceof modelModule.ControlGroup ||
controlConfig instanceof modelModule.ControlArray) {
_createControl(controlConfig: any): AbstractControl {
if (controlConfig instanceof Control || controlConfig instanceof ControlGroup ||
controlConfig instanceof ControlArray) {
return controlConfig;
} else if (isArray(controlConfig)) {

View File

@ -12,7 +12,7 @@ import {StringMapWrapper} from '../facade/collection';
import {isBlank, isPresent, isPromise, isString} from '../facade/lang';
import {PromiseWrapper} from '../facade/promise';
import {AsyncValidatorFn, ValidatorFn} from './directives/validators';
import * as modelModule from './model';
import {AbstractControl} from './model';
/**
* Providers for validators to be used for {@link Control}s in a form.
@ -57,7 +57,7 @@ export class Validators {
/**
* Validator that requires controls to have a non-empty value.
*/
static required(control: modelModule.AbstractControl): {[key: string]: boolean} {
static required(control: AbstractControl): {[key: string]: boolean} {
return isBlank(control.value) || (isString(control.value) && control.value == '') ?
{'required': true} :
null;
@ -67,7 +67,7 @@ export class Validators {
* Validator that requires controls to have a value of a minimum length.
*/
static minLength(minLength: number): ValidatorFn {
return (control: modelModule.AbstractControl): {[key: string]: any} => {
return (control: AbstractControl): {[key: string]: any} => {
if (isPresent(Validators.required(control))) return null;
var v: string = control.value;
return v.length < minLength ?
@ -80,7 +80,7 @@ export class Validators {
* Validator that requires controls to have a value of a maximum length.
*/
static maxLength(maxLength: number): ValidatorFn {
return (control: modelModule.AbstractControl): {[key: string]: any} => {
return (control: AbstractControl): {[key: string]: any} => {
if (isPresent(Validators.required(control))) return null;
var v: string = control.value;
return v.length > maxLength ?
@ -93,7 +93,7 @@ export class Validators {
* Validator that requires a control to match a regex to its value.
*/
static pattern(pattern: string): ValidatorFn {
return (control: modelModule.AbstractControl): {[key: string]: any} => {
return (control: AbstractControl): {[key: string]: any} => {
if (isPresent(Validators.required(control))) return null;
let regex = new RegExp(`^${pattern}$`);
let v: string = control.value;
@ -105,7 +105,7 @@ export class Validators {
/**
* No-op validator.
*/
static nullValidator(c: modelModule.AbstractControl): {[key: string]: boolean} { return null; }
static nullValidator(c: AbstractControl): {[key: string]: boolean} { return null; }
/**
* Compose multiple validators into a single function that returns the union
@ -116,7 +116,7 @@ export class Validators {
var presentValidators = validators.filter(isPresent);
if (presentValidators.length == 0) return null;
return function(control: modelModule.AbstractControl) {
return function(control: AbstractControl) {
return _mergeErrors(_executeValidators(control, presentValidators));
};
}
@ -126,7 +126,7 @@ export class Validators {
var presentValidators = validators.filter(isPresent);
if (presentValidators.length == 0) return null;
return function(control: modelModule.AbstractControl) {
return function(control: AbstractControl) {
let promises = _executeAsyncValidators(control, presentValidators).map(_convertToPromise);
return PromiseWrapper.all(promises).then(_mergeErrors);
};
@ -137,13 +137,11 @@ function _convertToPromise(obj: any): Promise<any> {
return isPromise(obj) ? obj : ObservableWrapper.toPromise(obj);
}
function _executeValidators(
control: modelModule.AbstractControl, validators: ValidatorFn[]): any[] {
function _executeValidators(control: AbstractControl, validators: ValidatorFn[]): any[] {
return validators.map(v => v(control));
}
function _executeAsyncValidators(
control: modelModule.AbstractControl, validators: AsyncValidatorFn[]): any[] {
function _executeAsyncValidators(control: AbstractControl, validators: AsyncValidatorFn[]): any[] {
return validators.map(v => v(control));
}

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import * as impl from './wtf_impl';
import {WtfScopeFn, createScope, detectWTF, endTimeRange, leave, startTimeRange} from './wtf_impl';
export {WtfScopeFn} from './wtf_impl';
@ -16,7 +16,7 @@ export {WtfScopeFn} from './wtf_impl';
/**
* True if WTF is enabled.
*/
export var wtfEnabled = impl.detectWTF();
export var wtfEnabled = detectWTF();
function noopScope(arg0?: any, arg1?: any): any {
return null;
@ -52,8 +52,8 @@ function noopScope(arg0?: any, arg1?: any): any {
*
* @experimental
*/
export var wtfCreateScope: (signature: string, flags?: any) => impl.WtfScopeFn =
wtfEnabled ? impl.createScope : (signature: string, flags?: any) => noopScope;
export var wtfCreateScope: (signature: string, flags?: any) => WtfScopeFn =
wtfEnabled ? createScope : (signature: string, flags?: any) => noopScope;
/**
* Used to mark end of Scope.
@ -65,7 +65,7 @@ export var wtfCreateScope: (signature: string, flags?: any) => impl.WtfScopeFn =
* @experimental
*/
export var wtfLeave: <T>(scope: any, returnValue?: T) => T =
wtfEnabled ? impl.leave : (s: any, r?: any) => r;
wtfEnabled ? leave : (s: any, r?: any) => r;
/**
* Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
@ -81,7 +81,7 @@ export var wtfLeave: <T>(scope: any, returnValue?: T) => T =
* @experimental
*/
export var wtfStartTimeRange: (rangeType: string, action: string) => any =
wtfEnabled ? impl.startTimeRange : (rangeType: string, action: string) => null;
wtfEnabled ? startTimeRange : (rangeType: string, action: string) => null;
/**
* Ends a async time range operation.
@ -89,5 +89,4 @@ export var wtfStartTimeRange: (rangeType: string, action: string) => any =
* enabled.
* @experimental
*/
export var wtfEndTimeRange: (range: any) => void =
wtfEnabled ? impl.endTimeRange : (r: any) => null;
export var wtfEndTimeRange: (range: any) => void = wtfEnabled ? endTimeRange : (r: any) => null;

View File

@ -11,7 +11,7 @@ import {Injectable} from '@angular/core';
import {AsyncValidatorFn, ValidatorFn} from './directives/validators';
import {StringMapWrapper} from './facade/collection';
import {isArray, isPresent} from './facade/lang';
import * as modelModule from './model';
import {AbstractControl, FormArray, FormControl, FormGroup} from './model';
@ -63,23 +63,22 @@ export class FormBuilder {
*
* See the {@link FormGroup} constructor for more details.
*/
group(controlsConfig: {[key: string]: any}, extra: {[key: string]: any} = null):
modelModule.FormGroup {
group(controlsConfig: {[key: string]: any}, extra: {[key: string]: any} = null): FormGroup {
var controls = this._reduceControls(controlsConfig);
var optionals = <{[key: string]: boolean}>(
isPresent(extra) ? StringMapWrapper.get(extra, 'optionals') : null);
var validator: ValidatorFn = isPresent(extra) ? StringMapWrapper.get(extra, 'validator') : null;
var asyncValidator: AsyncValidatorFn =
isPresent(extra) ? StringMapWrapper.get(extra, 'asyncValidator') : null;
return new modelModule.FormGroup(controls, optionals, validator, asyncValidator);
return new FormGroup(controls, optionals, validator, asyncValidator);
}
/**
* Construct a new {@link FormControl} with the given `value`,`validator`, and `asyncValidator`.
*/
control(
value: Object, validator: ValidatorFn|ValidatorFn[] = null,
asyncValidator: AsyncValidatorFn|AsyncValidatorFn[] = null): modelModule.FormControl {
return new modelModule.FormControl(value, validator, asyncValidator);
asyncValidator: AsyncValidatorFn|AsyncValidatorFn[] = null): FormControl {
return new FormControl(value, validator, asyncValidator);
}
/**
@ -88,15 +87,14 @@ export class FormBuilder {
*/
array(
controlsConfig: any[], validator: ValidatorFn = null,
asyncValidator: AsyncValidatorFn = null): modelModule.FormArray {
asyncValidator: AsyncValidatorFn = null): FormArray {
var controls = controlsConfig.map(c => this._createControl(c));
return new modelModule.FormArray(controls, validator, asyncValidator);
return new FormArray(controls, validator, asyncValidator);
}
/** @internal */
_reduceControls(controlsConfig: {[k: string]: any}):
{[key: string]: modelModule.AbstractControl} {
var controls: {[key: string]: modelModule.AbstractControl} = {};
_reduceControls(controlsConfig: {[k: string]: any}): {[key: string]: AbstractControl} {
var controls: {[key: string]: AbstractControl} = {};
StringMapWrapper.forEach(controlsConfig, (controlConfig: any, controlName: string) => {
controls[controlName] = this._createControl(controlConfig);
});
@ -104,10 +102,9 @@ export class FormBuilder {
}
/** @internal */
_createControl(controlConfig: any): modelModule.AbstractControl {
if (controlConfig instanceof modelModule.FormControl ||
controlConfig instanceof modelModule.FormGroup ||
controlConfig instanceof modelModule.FormArray) {
_createControl(controlConfig: any): AbstractControl {
if (controlConfig instanceof FormControl || controlConfig instanceof FormGroup ||
controlConfig instanceof FormArray) {
return controlConfig;
} else if (isArray(controlConfig)) {

View File

@ -12,7 +12,7 @@ import {ObservableWrapper} from './facade/async';
import {StringMapWrapper} from './facade/collection';
import {isBlank, isPresent, isPromise, isString} from './facade/lang';
import {PromiseWrapper} from './facade/promise';
import * as modelModule from './model';
import {AbstractControl} from './model';
/**
* Providers for validators to be used for {@link FormControl}s in a form.
@ -57,7 +57,7 @@ export class Validators {
/**
* Validator that requires controls to have a non-empty value.
*/
static required(control: modelModule.AbstractControl): {[key: string]: boolean} {
static required(control: AbstractControl): {[key: string]: boolean} {
return isBlank(control.value) || (isString(control.value) && control.value == '') ?
{'required': true} :
null;
@ -67,7 +67,7 @@ export class Validators {
* Validator that requires controls to have a value of a minimum length.
*/
static minLength(minLength: number): ValidatorFn {
return (control: modelModule.AbstractControl): {[key: string]: any} => {
return (control: AbstractControl): {[key: string]: any} => {
if (isPresent(Validators.required(control))) return null;
var v: string = control.value;
return v.length < minLength ?
@ -80,7 +80,7 @@ export class Validators {
* Validator that requires controls to have a value of a maximum length.
*/
static maxLength(maxLength: number): ValidatorFn {
return (control: modelModule.AbstractControl): {[key: string]: any} => {
return (control: AbstractControl): {[key: string]: any} => {
if (isPresent(Validators.required(control))) return null;
var v: string = control.value;
return v.length > maxLength ?
@ -93,7 +93,7 @@ export class Validators {
* Validator that requires a control to match a regex to its value.
*/
static pattern(pattern: string): ValidatorFn {
return (control: modelModule.AbstractControl): {[key: string]: any} => {
return (control: AbstractControl): {[key: string]: any} => {
if (isPresent(Validators.required(control))) return null;
let regex = new RegExp(`^${pattern}$`);
let v: string = control.value;
@ -105,7 +105,7 @@ export class Validators {
/**
* No-op validator.
*/
static nullValidator(c: modelModule.AbstractControl): {[key: string]: boolean} { return null; }
static nullValidator(c: AbstractControl): {[key: string]: boolean} { return null; }
/**
* Compose multiple validators into a single function that returns the union
@ -116,7 +116,7 @@ export class Validators {
var presentValidators = validators.filter(isPresent);
if (presentValidators.length == 0) return null;
return function(control: modelModule.AbstractControl) {
return function(control: AbstractControl) {
return _mergeErrors(_executeValidators(control, presentValidators));
};
}
@ -126,7 +126,7 @@ export class Validators {
var presentValidators = validators.filter(isPresent);
if (presentValidators.length == 0) return null;
return function(control: modelModule.AbstractControl) {
return function(control: AbstractControl) {
let promises = _executeAsyncValidators(control, presentValidators).map(_convertToPromise);
return PromiseWrapper.all(promises).then(_mergeErrors);
};
@ -137,13 +137,11 @@ function _convertToPromise(obj: any): Promise<any> {
return isPromise(obj) ? obj : ObservableWrapper.toPromise(obj);
}
function _executeValidators(
control: modelModule.AbstractControl, validators: ValidatorFn[]): any[] {
function _executeValidators(control: AbstractControl, validators: ValidatorFn[]): any[] {
return validators.map(v => v(control));
}
function _executeAsyncValidators(
control: modelModule.AbstractControl, validators: AsyncValidatorFn[]): any[] {
function _executeAsyncValidators(control: AbstractControl, validators: AsyncValidatorFn[]): any[] {
return validators.map(v => v(control));
}

View File

@ -9,7 +9,7 @@
import {PlatformLocation} from '@angular/common';
import {BrowserPlatformLocation} from '@angular/platform-browser';
import * as common from './common_router_providers';
import {ExtraOptions, provideRouter as provideRouter_} from './common_router_providers';
import {RouterConfig} from './config';
@ -31,9 +31,8 @@ import {RouterConfig} from './config';
* bootstrap(AppCmp, [provideRouter(router)]);
* ```
*/
export function provideRouter(config: RouterConfig, opts: common.ExtraOptions = {}): any[] {
export function provideRouter(config: RouterConfig, opts: ExtraOptions = {}): any[] {
return [
{provide: PlatformLocation, useClass: BrowserPlatformLocation},
...common.provideRouter(config, opts)
{provide: PlatformLocation, useClass: BrowserPlatformLocation}, ...provideRouter_(config, opts)
];
}

531
tools/public_api_guard/common/index.d.ts vendored Normal file
View File

@ -0,0 +1,531 @@
export declare abstract class AbstractControl {
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
constructor(validator: ValidatorFn, asyncValidator: AsyncValidatorFn);
value: any;
status: string;
valid: boolean;
errors: {
[key: string]: any;
};
pristine: boolean;
dirty: boolean;
touched: boolean;
untouched: boolean;
valueChanges: Observable<any>;
statusChanges: Observable<any>;
pending: boolean;
markAsTouched(): void;
markAsDirty({onlySelf}?: {
onlySelf?: boolean;
}): void;
markAsPending({onlySelf}?: {
onlySelf?: boolean;
}): void;
setParent(parent: ControlGroup | ControlArray): void;
updateValueAndValidity({onlySelf, emitEvent}?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
setErrors(errors: {
[key: string]: any;
}, {emitEvent}?: {
emitEvent?: boolean;
}): void;
find(path: Array<string | number> | string): AbstractControl;
getError(errorCode: string, path?: string[]): any;
hasError(errorCode: string, path?: string[]): boolean;
root: AbstractControl;
}
export declare abstract class AbstractControlDirective {
control: AbstractControl;
value: any;
valid: boolean;
errors: {
[key: string]: any;
};
pristine: boolean;
dirty: boolean;
touched: boolean;
untouched: boolean;
path: string[];
}
export declare const APP_BASE_HREF: OpaqueToken;
export declare class AsyncPipe implements OnDestroy {
constructor(_ref: ChangeDetectorRef);
ngOnDestroy(): void;
transform(obj: Observable<any> | Promise<any> | EventEmitter<any>): any;
}
export declare class CheckboxControlValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
constructor(_renderer: Renderer, _elementRef: ElementRef);
writeValue(value: any): void;
registerOnChange(fn: (_: any) => {}): void;
registerOnTouched(fn: () => {}): void;
}
export declare const COMMON_DIRECTIVES: Type[][];
export declare const COMMON_PIPES: (typeof AsyncPipe | typeof SlicePipe | typeof ReplacePipe | typeof I18nPluralPipe | typeof I18nSelectPipe)[];
export declare class Control extends AbstractControl {
constructor(value?: any, validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
updateValue(value: any, {onlySelf, emitEvent, emitModelToViewChange}?: {
onlySelf?: boolean;
emitEvent?: boolean;
emitModelToViewChange?: boolean;
}): void;
registerOnChange(fn: Function): void;
}
export declare class ControlArray extends AbstractControl {
controls: AbstractControl[];
constructor(controls: AbstractControl[], validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
at(index: number): AbstractControl;
push(control: AbstractControl): void;
insert(index: number, control: AbstractControl): void;
removeAt(index: number): void;
length: number;
}
export declare class ControlContainer extends AbstractControlDirective {
name: string;
formDirective: Form;
path: string[];
}
export declare class ControlGroup extends AbstractControl {
controls: {
[key: string]: AbstractControl;
};
constructor(controls: {
[key: string]: AbstractControl;
}, optionals?: {
[key: string]: boolean;
}, validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
registerControl(name: string, control: AbstractControl): void;
addControl(name: string, control: AbstractControl): void;
removeControl(name: string): void;
include(controlName: string): void;
exclude(controlName: string): void;
contains(controlName: string): boolean;
}
export interface ControlValueAccessor {
writeValue(obj: any): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
}
export declare const CORE_DIRECTIVES: Type[];
export declare class CurrencyPipe implements PipeTransform {
transform(value: any, currencyCode?: string, symbolDisplay?: boolean, digits?: string): string;
}
export declare class DatePipe implements PipeTransform {
transform(value: any, pattern?: string): string;
}
export declare class DecimalPipe implements PipeTransform {
transform(value: any, digits?: string): string;
}
export declare class DefaultValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
constructor(_renderer: Renderer, _elementRef: ElementRef);
writeValue(value: any): void;
registerOnChange(fn: (_: any) => void): void;
registerOnTouched(fn: () => void): void;
}
export interface Form {
addControl(dir: NgControl): void;
removeControl(dir: NgControl): void;
getControl(dir: NgControl): Control;
addControlGroup(dir: NgControlGroup): void;
removeControlGroup(dir: NgControlGroup): void;
getControlGroup(dir: NgControlGroup): ControlGroup;
updateModel(dir: NgControl, value: any): void;
}
export declare const FORM_DIRECTIVES: Type[];
export declare const FORM_PROVIDERS: Type[];
export declare class FormBuilder {
group(controlsConfig: {
[key: string]: any;
}, extra?: {
[key: string]: any;
}): ControlGroup;
control(value: Object, validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn): Control;
array(controlsConfig: any[], validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn): ControlArray;
}
export declare class HashLocationStrategy extends LocationStrategy {
constructor(_platformLocation: PlatformLocation, _baseHref?: string);
onPopState(fn: UrlChangeListener): void;
getBaseHref(): string;
path(): string;
prepareExternalUrl(internal: string): string;
pushState(state: any, title: string, path: string, queryParams: string): void;
replaceState(state: any, title: string, path: string, queryParams: string): void;
forward(): void;
back(): void;
}
export declare class I18nPluralPipe implements PipeTransform {
constructor(_localization: NgLocalization);
transform(value: number, pluralMap: {
[count: string]: string;
}): string;
}
export declare class I18nSelectPipe implements PipeTransform {
transform(value: string, mapping: {
[key: string]: string;
}): string;
}
export declare class JsonPipe implements PipeTransform {
transform(value: any): string;
}
export declare class Location {
constructor(platformStrategy: LocationStrategy);
path(): string;
isCurrentPathEqualTo(path: string, query?: string): boolean;
normalize(url: string): string;
prepareExternalUrl(url: string): string;
go(path: string, query?: string): void;
replaceState(path: string, query?: string): void;
forward(): void;
back(): void;
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): Object;
static normalizeQueryParams(params: string): string;
static joinWithSlash(start: string, end: string): string;
static stripTrailingSlash(url: string): string;
}
export declare abstract class LocationStrategy {
abstract path(): string;
abstract prepareExternalUrl(internal: string): string;
abstract pushState(state: any, title: string, url: string, queryParams: string): void;
abstract replaceState(state: any, title: string, url: string, queryParams: string): void;
abstract forward(): void;
abstract back(): void;
abstract onPopState(fn: UrlChangeListener): void;
abstract getBaseHref(): string;
}
export declare class LowerCasePipe implements PipeTransform {
transform(value: string): string;
}
export declare class MaxLengthValidator implements Validator {
constructor(maxLength: string);
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare class MinLengthValidator implements Validator {
constructor(minLength: string);
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare const NG_ASYNC_VALIDATORS: OpaqueToken;
export declare const NG_VALIDATORS: OpaqueToken;
export declare const NG_VALUE_ACCESSOR: OpaqueToken;
export declare class NgClass implements DoCheck, OnDestroy {
constructor(_iterableDiffers: IterableDiffers, _keyValueDiffers: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer);
initialClasses: string;
rawClass: string | string[] | Set<string> | {
[key: string]: any;
};
ngDoCheck(): void;
ngOnDestroy(): void;
}
export declare abstract class NgControl extends AbstractControlDirective {
name: string;
valueAccessor: ControlValueAccessor;
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
abstract viewToModelUpdate(newValue: any): void;
}
export declare class NgControlGroup extends ControlContainer implements OnInit, OnDestroy {
constructor(parent: ControlContainer, _validators: any[], _asyncValidators: any[]);
ngOnInit(): void;
ngOnDestroy(): void;
control: ControlGroup;
path: string[];
formDirective: Form;
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
}
export declare class NgControlName extends NgControl implements OnChanges, OnDestroy {
model: any;
viewModel: any;
constructor(_parent: ControlContainer, _validators: any[], _asyncValidators: any[], valueAccessors: ControlValueAccessor[]);
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
viewToModelUpdate(newValue: any): void;
path: string[];
formDirective: any;
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
control: Control;
}
export declare class NgControlStatus {
constructor(cd: NgControl);
ngClassUntouched: boolean;
ngClassTouched: boolean;
ngClassPristine: boolean;
ngClassDirty: boolean;
ngClassValid: boolean;
ngClassInvalid: boolean;
}
export declare class NgFor implements DoCheck {
constructor(_viewContainer: ViewContainerRef, _templateRef: TemplateRef<NgForRow>, _iterableDiffers: IterableDiffers, _cdr: ChangeDetectorRef);
ngForOf: any;
ngForTemplate: TemplateRef<NgForRow>;
ngForTrackBy: TrackByFn;
ngDoCheck(): void;
}
export declare class NgForm extends ControlContainer implements Form {
form: ControlGroup;
ngSubmit: EventEmitter<{}>;
constructor(validators: any[], asyncValidators: any[]);
submitted: boolean;
formDirective: Form;
control: ControlGroup;
path: string[];
controls: {
[key: string]: AbstractControl;
};
addControl(dir: NgControl): void;
getControl(dir: NgControl): Control;
removeControl(dir: NgControl): void;
addControlGroup(dir: NgControlGroup): void;
removeControlGroup(dir: NgControlGroup): void;
getControlGroup(dir: NgControlGroup): ControlGroup;
updateModel(dir: NgControl, value: any): void;
onSubmit(): boolean;
}
export declare class NgFormControl extends NgControl implements OnChanges {
form: Control;
update: EventEmitter<{}>;
model: any;
viewModel: any;
constructor(_validators: any[], _asyncValidators: any[], valueAccessors: ControlValueAccessor[]);
ngOnChanges(changes: SimpleChanges): void;
path: string[];
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
control: Control;
viewToModelUpdate(newValue: any): void;
}
export declare class NgFormModel extends ControlContainer implements Form, OnChanges {
form: ControlGroup;
directives: NgControl[];
ngSubmit: EventEmitter<{}>;
constructor(_validators: any[], _asyncValidators: any[]);
ngOnChanges(changes: SimpleChanges): void;
submitted: boolean;
formDirective: Form;
control: ControlGroup;
path: string[];
addControl(dir: NgControl): void;
getControl(dir: NgControl): Control;
removeControl(dir: NgControl): void;
addControlGroup(dir: NgControlGroup): void;
removeControlGroup(dir: NgControlGroup): void;
getControlGroup(dir: NgControlGroup): ControlGroup;
updateModel(dir: NgControl, value: any): void;
onSubmit(): boolean;
}
export declare class NgIf {
constructor(_viewContainer: ViewContainerRef, _templateRef: TemplateRef<Object>);
ngIf: any;
}
export declare abstract class NgLocalization {
abstract getPluralCategory(value: any): string;
}
export declare class NgModel extends NgControl implements OnChanges {
update: EventEmitter<{}>;
model: any;
viewModel: any;
constructor(_validators: any[], _asyncValidators: any[], valueAccessors: ControlValueAccessor[]);
ngOnChanges(changes: SimpleChanges): void;
control: Control;
path: string[];
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
viewToModelUpdate(newValue: any): void;
}
export declare class NgPlural implements AfterContentInit {
cases: QueryList<NgPluralCase>;
constructor(_localization: NgLocalization);
ngPlural: number;
ngAfterContentInit(): void;
}
export declare class NgPluralCase {
value: string;
constructor(value: string, template: TemplateRef<Object>, viewContainer: ViewContainerRef);
}
export declare class NgSelectOption implements OnDestroy {
id: string;
constructor(_element: ElementRef, _renderer: Renderer, _select: SelectControlValueAccessor);
ngValue: any;
value: any;
ngOnDestroy(): void;
}
export declare class NgStyle implements DoCheck {
constructor(_differs: KeyValueDiffers, _ngEl: ElementRef, _renderer: Renderer);
rawStyle: {
[key: string]: string;
};
ngDoCheck(): void;
}
export declare class NgSwitch {
ngSwitch: any;
}
export declare class NgSwitchCase {
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, ngSwitch: NgSwitch);
ngSwitchCase: any;
ngSwitchWhen: any;
}
export declare class NgSwitchDefault {
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef<Object>, sswitch: NgSwitch);
}
export declare class NgTemplateOutlet {
constructor(_viewContainerRef: ViewContainerRef);
ngOutletContext: Object;
ngTemplateOutlet: TemplateRef<Object>;
}
export declare class PathLocationStrategy extends LocationStrategy {
constructor(_platformLocation: PlatformLocation, href?: string);
onPopState(fn: UrlChangeListener): void;
getBaseHref(): string;
prepareExternalUrl(internal: string): string;
path(): string;
pushState(state: any, title: string, url: string, queryParams: string): void;
replaceState(state: any, title: string, url: string, queryParams: string): void;
forward(): void;
back(): void;
}
export declare class PatternValidator implements Validator {
constructor(pattern: string);
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare class PercentPipe implements PipeTransform {
transform(value: any, digits?: string): string;
}
export declare abstract class PlatformLocation {
abstract getBaseHrefFromDOM(): string;
abstract onPopState(fn: UrlChangeListener): void;
abstract onHashChange(fn: UrlChangeListener): void;
pathname: string;
search: string;
hash: string;
abstract replaceState(state: any, title: string, url: string): void;
abstract pushState(state: any, title: string, url: string): void;
abstract forward(): void;
abstract back(): void;
}
export declare class RadioButtonState {
checked: boolean;
value: string;
constructor(checked: boolean, value: string);
}
export declare class ReplacePipe implements PipeTransform {
transform(value: any, pattern: string | RegExp, replacement: Function | string): any;
}
export declare class RequiredValidator {
}
export declare class SelectControlValueAccessor implements ControlValueAccessor {
value: any;
onChange: (_: any) => void;
onTouched: () => void;
constructor(_renderer: Renderer, _elementRef: ElementRef);
writeValue(value: any): void;
registerOnChange(fn: (value: any) => any): void;
registerOnTouched(fn: () => any): void;
}
export declare class SlicePipe implements PipeTransform {
transform(value: any, start: number, end?: number): any;
}
export declare class UpperCasePipe implements PipeTransform {
transform(value: string): string;
}
export interface UrlChangeEvent {
type: string;
}
export interface UrlChangeListener {
(e: UrlChangeEvent): any;
}
export interface Validator {
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare class Validators {
static required(control: AbstractControl): {
[key: string]: boolean;
};
static minLength(minLength: number): ValidatorFn;
static maxLength(maxLength: number): ValidatorFn;
static pattern(pattern: string): ValidatorFn;
static nullValidator(c: AbstractControl): {
[key: string]: boolean;
};
static compose(validators: ValidatorFn[]): ValidatorFn;
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn;
}

View File

@ -0,0 +1,33 @@
export declare class MockLocationStrategy extends LocationStrategy {
internalBaseHref: string;
internalPath: string;
internalTitle: string;
urlChanges: string[];
constructor();
simulatePopState(url: string): void;
path(): string;
prepareExternalUrl(internal: string): string;
pushState(ctx: any, title: string, path: string, query: string): void;
replaceState(ctx: any, title: string, path: string, query: string): void;
onPopState(fn: (value: any) => void): void;
getBaseHref(): string;
back(): void;
forward(): void;
}
export declare class SpyLocation implements Location {
urlChanges: string[];
setInitialPath(url: string): void;
setBaseHref(url: string): void;
path(): string;
isCurrentPathEqualTo(path: string, query?: string): boolean;
simulateUrlPop(pathname: string): void;
simulateHashChange(pathname: string): void;
prepareExternalUrl(url: string): string;
go(path: string, query?: string): void;
replaceState(path: string, query?: string): void;
forward(): void;
back(): void;
subscribe(onNext: (value: any) => void, onThrow?: (error: any) => void, onReturn?: () => void): Object;
normalize(url: string): string;
}

View File

@ -0,0 +1,582 @@
export declare class AttrAst implements TemplateAst {
name: string;
value: string;
sourceSpan: ParseSourceSpan;
constructor(name: string, value: string, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class BoundDirectivePropertyAst implements TemplateAst {
directiveName: string;
templateName: string;
value: AST;
sourceSpan: ParseSourceSpan;
constructor(directiveName: string, templateName: string, value: AST, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class BoundElementPropertyAst implements TemplateAst {
name: string;
type: PropertyBindingType;
securityContext: SecurityContext;
value: AST;
unit: string;
sourceSpan: ParseSourceSpan;
constructor(name: string, type: PropertyBindingType, securityContext: SecurityContext, value: AST, unit: string, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class BoundEventAst implements TemplateAst {
name: string;
target: string;
handler: AST;
sourceSpan: ParseSourceSpan;
constructor(name: string, target: string, handler: AST, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
fullName: string;
}
export declare class BoundTextAst implements TemplateAst {
value: AST;
ngContentIndex: number;
sourceSpan: ParseSourceSpan;
constructor(value: AST, ngContentIndex: number, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class CompileDiDependencyMetadata {
isAttribute: boolean;
isSelf: boolean;
isHost: boolean;
isSkipSelf: boolean;
isOptional: boolean;
isValue: boolean;
query: CompileQueryMetadata;
viewQuery: CompileQueryMetadata;
token: CompileTokenMetadata;
value: any;
constructor({isAttribute, isSelf, isHost, isSkipSelf, isOptional, isValue, query, viewQuery, token, value}?: {
isAttribute?: boolean;
isSelf?: boolean;
isHost?: boolean;
isSkipSelf?: boolean;
isOptional?: boolean;
isValue?: boolean;
query?: CompileQueryMetadata;
viewQuery?: CompileQueryMetadata;
token?: CompileTokenMetadata;
value?: any;
});
static fromJson(data: {
[key: string]: any;
}): CompileDiDependencyMetadata;
toJson(): {
[key: string]: any;
};
}
export declare class CompileDirectiveMetadata implements CompileMetadataWithType {
static create({type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host, lifecycleHooks, providers, viewProviders, queries, viewQueries, precompile, template}?: {
type?: CompileTypeMetadata;
isComponent?: boolean;
selector?: string;
exportAs?: string;
changeDetection?: ChangeDetectionStrategy;
inputs?: string[];
outputs?: string[];
host?: {
[key: string]: string;
};
lifecycleHooks?: LifecycleHooks[];
providers?: Array<CompileProviderMetadata | CompileTypeMetadata | CompileIdentifierMetadata | any[]>;
viewProviders?: Array<CompileProviderMetadata | CompileTypeMetadata | CompileIdentifierMetadata | any[]>;
queries?: CompileQueryMetadata[];
viewQueries?: CompileQueryMetadata[];
precompile?: CompileTypeMetadata[];
template?: CompileTemplateMetadata;
}): CompileDirectiveMetadata;
type: CompileTypeMetadata;
isComponent: boolean;
selector: string;
exportAs: string;
changeDetection: ChangeDetectionStrategy;
inputs: {
[key: string]: string;
};
outputs: {
[key: string]: string;
};
hostListeners: {
[key: string]: string;
};
hostProperties: {
[key: string]: string;
};
hostAttributes: {
[key: string]: string;
};
lifecycleHooks: LifecycleHooks[];
providers: CompileProviderMetadata[];
viewProviders: CompileProviderMetadata[];
queries: CompileQueryMetadata[];
viewQueries: CompileQueryMetadata[];
precompile: CompileTypeMetadata[];
template: CompileTemplateMetadata;
constructor({type, isComponent, selector, exportAs, changeDetection, inputs, outputs, hostListeners, hostProperties, hostAttributes, lifecycleHooks, providers, viewProviders, queries, viewQueries, precompile, template}?: {
type?: CompileTypeMetadata;
isComponent?: boolean;
selector?: string;
exportAs?: string;
changeDetection?: ChangeDetectionStrategy;
inputs?: {
[key: string]: string;
};
outputs?: {
[key: string]: string;
};
hostListeners?: {
[key: string]: string;
};
hostProperties?: {
[key: string]: string;
};
hostAttributes?: {
[key: string]: string;
};
lifecycleHooks?: LifecycleHooks[];
providers?: Array<CompileProviderMetadata | CompileTypeMetadata | CompileIdentifierMetadata | any[]>;
viewProviders?: Array<CompileProviderMetadata | CompileTypeMetadata | CompileIdentifierMetadata | any[]>;
queries?: CompileQueryMetadata[];
viewQueries?: CompileQueryMetadata[];
precompile?: CompileTypeMetadata[];
template?: CompileTemplateMetadata;
});
identifier: CompileIdentifierMetadata;
static fromJson(data: {
[key: string]: any;
}): CompileDirectiveMetadata;
toJson(): {
[key: string]: any;
};
}
export declare class CompileFactoryMetadata implements CompileIdentifierMetadata, CompileMetadataWithIdentifier {
runtime: Function;
name: string;
prefix: string;
moduleUrl: string;
value: any;
diDeps: CompileDiDependencyMetadata[];
constructor({runtime, name, moduleUrl, prefix, diDeps, value}: {
runtime?: Function;
name?: string;
prefix?: string;
moduleUrl?: string;
value?: boolean;
diDeps?: CompileDiDependencyMetadata[];
});
identifier: CompileIdentifierMetadata;
static fromJson(data: {
[key: string]: any;
}): CompileFactoryMetadata;
toJson(): {
[key: string]: any;
};
}
export declare class CompileIdentifierMetadata implements CompileMetadataWithIdentifier {
runtime: any;
name: string;
prefix: string;
moduleUrl: string;
value: any;
constructor({runtime, name, moduleUrl, prefix, value}?: {
runtime?: any;
name?: string;
moduleUrl?: string;
prefix?: string;
value?: any;
});
static fromJson(data: {
[key: string]: any;
}): CompileIdentifierMetadata;
toJson(): {
[key: string]: any;
};
identifier: CompileIdentifierMetadata;
}
export declare abstract class CompileMetadataWithIdentifier {
abstract toJson(): {
[key: string]: any;
};
identifier: CompileIdentifierMetadata;
}
export declare abstract class CompileMetadataWithType extends CompileMetadataWithIdentifier {
abstract toJson(): {
[key: string]: any;
};
type: CompileTypeMetadata;
identifier: CompileIdentifierMetadata;
}
export declare class CompilePipeMetadata implements CompileMetadataWithType {
type: CompileTypeMetadata;
name: string;
pure: boolean;
lifecycleHooks: LifecycleHooks[];
constructor({type, name, pure, lifecycleHooks}?: {
type?: CompileTypeMetadata;
name?: string;
pure?: boolean;
lifecycleHooks?: LifecycleHooks[];
});
identifier: CompileIdentifierMetadata;
static fromJson(data: {
[key: string]: any;
}): CompilePipeMetadata;
toJson(): {
[key: string]: any;
};
}
export declare class CompileProviderMetadata {
token: CompileTokenMetadata;
useClass: CompileTypeMetadata;
useValue: any;
useExisting: CompileTokenMetadata;
useFactory: CompileFactoryMetadata;
deps: CompileDiDependencyMetadata[];
multi: boolean;
constructor({token, useClass, useValue, useExisting, useFactory, deps, multi}: {
token?: CompileTokenMetadata;
useClass?: CompileTypeMetadata;
useValue?: any;
useExisting?: CompileTokenMetadata;
useFactory?: CompileFactoryMetadata;
deps?: CompileDiDependencyMetadata[];
multi?: boolean;
});
static fromJson(data: {
[key: string]: any;
}): CompileProviderMetadata;
toJson(): {
[key: string]: any;
};
}
export declare class CompileQueryMetadata {
selectors: Array<CompileTokenMetadata>;
descendants: boolean;
first: boolean;
propertyName: string;
read: CompileTokenMetadata;
constructor({selectors, descendants, first, propertyName, read}?: {
selectors?: Array<CompileTokenMetadata>;
descendants?: boolean;
first?: boolean;
propertyName?: string;
read?: CompileTokenMetadata;
});
static fromJson(data: {
[key: string]: any;
}): CompileQueryMetadata;
toJson(): {
[key: string]: any;
};
}
export declare const COMPILER_PROVIDERS: Array<any | Type | {
[k: string]: any;
} | any[]>;
export declare class CompilerConfig {
renderTypes: RenderTypes;
defaultEncapsulation: ViewEncapsulation;
useJit: boolean;
platformDirectives: any[];
platformPipes: any[];
constructor({renderTypes, defaultEncapsulation, genDebugInfo, logBindingUpdate, useJit, platformDirectives, platformPipes}?: {
renderTypes?: RenderTypes;
defaultEncapsulation?: ViewEncapsulation;
genDebugInfo?: boolean;
logBindingUpdate?: boolean;
useJit?: boolean;
platformDirectives?: any[];
platformPipes?: any[];
});
genDebugInfo: boolean;
logBindingUpdate: boolean;
}
export declare class CompileTemplateMetadata {
encapsulation: ViewEncapsulation;
template: string;
templateUrl: string;
styles: string[];
styleUrls: string[];
animations: CompileAnimationEntryMetadata[];
ngContentSelectors: string[];
interpolation: [string, string];
constructor({encapsulation, template, templateUrl, styles, styleUrls, animations, ngContentSelectors, interpolation}?: {
encapsulation?: ViewEncapsulation;
template?: string;
templateUrl?: string;
styles?: string[];
styleUrls?: string[];
ngContentSelectors?: string[];
animations?: CompileAnimationEntryMetadata[];
interpolation?: [string, string];
});
static fromJson(data: {
[key: string]: any;
}): CompileTemplateMetadata;
toJson(): {
[key: string]: any;
};
}
export declare class CompileTokenMetadata implements CompileMetadataWithIdentifier {
value: any;
identifier: CompileIdentifierMetadata;
identifierIsInstance: boolean;
constructor({value, identifier, identifierIsInstance}: {
value?: any;
identifier?: CompileIdentifierMetadata;
identifierIsInstance?: boolean;
});
static fromJson(data: {
[key: string]: any;
}): CompileTokenMetadata;
toJson(): {
[key: string]: any;
};
runtimeCacheKey: any;
assetCacheKey: any;
equalsTo(token2: CompileTokenMetadata): boolean;
name: string;
}
export declare class CompileTypeMetadata implements CompileIdentifierMetadata, CompileMetadataWithType {
runtime: Type;
name: string;
prefix: string;
moduleUrl: string;
isHost: boolean;
value: any;
diDeps: CompileDiDependencyMetadata[];
constructor({runtime, name, moduleUrl, prefix, isHost, value, diDeps}?: {
runtime?: Type;
name?: string;
moduleUrl?: string;
prefix?: string;
isHost?: boolean;
value?: any;
diDeps?: CompileDiDependencyMetadata[];
});
static fromJson(data: {
[key: string]: any;
}): CompileTypeMetadata;
identifier: CompileIdentifierMetadata;
type: CompileTypeMetadata;
toJson(): {
[key: string]: any;
};
}
export declare function createOfflineCompileUrlResolver(): UrlResolver;
export declare var DEFAULT_PACKAGE_URL_PROVIDER: {
provide: any;
useValue: string;
};
export declare class DirectiveAst implements TemplateAst {
directive: CompileDirectiveMetadata;
inputs: BoundDirectivePropertyAst[];
hostProperties: BoundElementPropertyAst[];
hostEvents: BoundEventAst[];
sourceSpan: ParseSourceSpan;
constructor(directive: CompileDirectiveMetadata, inputs: BoundDirectivePropertyAst[], hostProperties: BoundElementPropertyAst[], hostEvents: BoundEventAst[], sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class DirectiveResolver {
constructor(_reflector?: ReflectorReader);
resolve(type: Type): DirectiveMetadata;
}
export declare class ElementAst implements TemplateAst {
name: string;
attrs: AttrAst[];
inputs: BoundElementPropertyAst[];
outputs: BoundEventAst[];
references: ReferenceAst[];
directives: DirectiveAst[];
providers: ProviderAst[];
hasViewContainer: boolean;
children: TemplateAst[];
ngContentIndex: number;
sourceSpan: ParseSourceSpan;
constructor(name: string, attrs: AttrAst[], inputs: BoundElementPropertyAst[], outputs: BoundEventAst[], references: ReferenceAst[], directives: DirectiveAst[], providers: ProviderAst[], hasViewContainer: boolean, children: TemplateAst[], ngContentIndex: number, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare abstract class ElementSchemaRegistry {
abstract hasProperty(tagName: string, propName: string): boolean;
abstract securityContext(tagName: string, propName: string): any;
abstract getMappedPropName(propName: string): string;
}
export declare class EmbeddedTemplateAst implements TemplateAst {
attrs: AttrAst[];
outputs: BoundEventAst[];
references: ReferenceAst[];
variables: VariableAst[];
directives: DirectiveAst[];
providers: ProviderAst[];
hasViewContainer: boolean;
children: TemplateAst[];
ngContentIndex: number;
sourceSpan: ParseSourceSpan;
constructor(attrs: AttrAst[], outputs: BoundEventAst[], references: ReferenceAst[], variables: VariableAst[], directives: DirectiveAst[], providers: ProviderAst[], hasViewContainer: boolean, children: TemplateAst[], ngContentIndex: number, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class NgContentAst implements TemplateAst {
index: number;
ngContentIndex: number;
sourceSpan: ParseSourceSpan;
constructor(index: number, ngContentIndex: number, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class NormalizedComponentWithViewDirectives {
component: CompileDirectiveMetadata;
directives: CompileDirectiveMetadata[];
pipes: CompilePipeMetadata[];
constructor(component: CompileDirectiveMetadata, directives: CompileDirectiveMetadata[], pipes: CompilePipeMetadata[]);
}
export declare class OfflineCompiler {
constructor(_directiveNormalizer: DirectiveNormalizer, _templateParser: TemplateParser, _styleCompiler: StyleCompiler, _viewCompiler: ViewCompiler, _outputEmitter: OutputEmitter, _xhr: XHR);
normalizeDirectiveMetadata(directive: CompileDirectiveMetadata): Promise<CompileDirectiveMetadata>;
compileTemplates(components: NormalizedComponentWithViewDirectives[]): SourceModule;
loadAndCompileStylesheet(stylesheetUrl: string, shim: boolean, suffix: string): Promise<StyleSheetSourceWithImports>;
}
export declare class PipeResolver {
constructor(_reflector?: ReflectorReader);
resolve(type: Type): PipeMetadata;
}
export declare enum PropertyBindingType {
Property = 0,
Attribute = 1,
Class = 2,
Style = 3,
Animation = 4,
}
export declare class ProviderAst implements TemplateAst {
token: CompileTokenMetadata;
multiProvider: boolean;
eager: boolean;
providers: CompileProviderMetadata[];
providerType: ProviderAstType;
sourceSpan: ParseSourceSpan;
constructor(token: CompileTokenMetadata, multiProvider: boolean, eager: boolean, providers: CompileProviderMetadata[], providerType: ProviderAstType, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare enum ProviderAstType {
PublicService = 0,
PrivateService = 1,
Component = 2,
Directive = 3,
Builtin = 4,
}
export declare class ReferenceAst implements TemplateAst {
name: string;
value: CompileTokenMetadata;
sourceSpan: ParseSourceSpan;
constructor(name: string, value: CompileTokenMetadata, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare abstract class RenderTypes {
renderer: CompileIdentifierMetadata;
renderText: CompileIdentifierMetadata;
renderElement: CompileIdentifierMetadata;
renderComment: CompileIdentifierMetadata;
renderNode: CompileIdentifierMetadata;
renderEvent: CompileIdentifierMetadata;
}
export declare class RuntimeCompiler implements ComponentResolver {
constructor(_metadataResolver: CompileMetadataResolver, _templateNormalizer: DirectiveNormalizer, _templateParser: TemplateParser, _styleCompiler: StyleCompiler, _viewCompiler: ViewCompiler, _xhr: XHR, _genConfig: CompilerConfig);
resolveComponent(component: Type | string): Promise<ComponentFactory<any>>;
clearCache(): void;
}
export declare class SourceModule {
moduleUrl: string;
source: string;
constructor(moduleUrl: string, source: string);
}
export declare const TEMPLATE_TRANSFORMS: any;
export interface TemplateAst {
sourceSpan: ParseSourceSpan;
visit(visitor: TemplateAstVisitor, context: any): any;
}
export interface TemplateAstVisitor {
visitNgContent(ast: NgContentAst, context: any): any;
visitEmbeddedTemplate(ast: EmbeddedTemplateAst, context: any): any;
visitElement(ast: ElementAst, context: any): any;
visitReference(ast: ReferenceAst, context: any): any;
visitVariable(ast: VariableAst, context: any): any;
visitEvent(ast: BoundEventAst, context: any): any;
visitElementProperty(ast: BoundElementPropertyAst, context: any): any;
visitAttr(ast: AttrAst, context: any): any;
visitBoundText(ast: BoundTextAst, context: any): any;
visitText(ast: TextAst, context: any): any;
visitDirective(ast: DirectiveAst, context: any): any;
visitDirectiveProperty(ast: BoundDirectivePropertyAst, context: any): any;
}
export declare function templateVisitAll(visitor: TemplateAstVisitor, asts: TemplateAst[], context?: any): any[];
export declare class TextAst implements TemplateAst {
value: string;
ngContentIndex: number;
sourceSpan: ParseSourceSpan;
constructor(value: string, ngContentIndex: number, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class UrlResolver {
constructor(_packagePrefix?: string);
resolve(baseUrl: string, url: string): string;
}
export declare class VariableAst implements TemplateAst {
name: string;
value: string;
sourceSpan: ParseSourceSpan;
constructor(name: string, value: string, sourceSpan: ParseSourceSpan);
visit(visitor: TemplateAstVisitor, context: any): any;
}
export declare class ViewResolver {
constructor(_reflector?: ReflectorReader);
resolve(component: Type): ViewMetadata;
}
export declare class XHR {
get(url: string): Promise<string>;
}

View File

@ -0,0 +1,79 @@
export declare class ComponentFixture<T> {
debugElement: DebugElement;
componentInstance: any;
nativeElement: any;
elementRef: ElementRef;
componentRef: ComponentRef<T>;
changeDetectorRef: ChangeDetectorRef;
ngZone: NgZone;
constructor(componentRef: ComponentRef<T>, ngZone: NgZone, autoDetect: boolean);
detectChanges(checkNoChanges?: boolean): void;
checkNoChanges(): void;
autoDetectChanges(autoDetect?: boolean): void;
isStable(): boolean;
whenStable(): Promise<any>;
destroy(): void;
}
export declare var ComponentFixtureAutoDetect: OpaqueToken;
export declare var ComponentFixtureNoNgZone: OpaqueToken;
export declare class MockDirectiveResolver extends DirectiveResolver {
resolve(type: Type): DirectiveMetadata;
setProvidersOverride(type: Type, providers: any[]): void;
setViewProvidersOverride(type: Type, viewProviders: any[]): void;
}
export declare class MockSchemaRegistry implements ElementSchemaRegistry {
existingProperties: {
[key: string]: boolean;
};
attrPropMapping: {
[key: string]: string;
};
constructor(existingProperties: {
[key: string]: boolean;
}, attrPropMapping: {
[key: string]: string;
});
hasProperty(tagName: string, property: string): boolean;
securityContext(tagName: string, property: string): SecurityContext;
getMappedPropName(attrName: string): string;
}
export declare class MockViewResolver extends ViewResolver {
constructor();
setView(component: Type, view: ViewMetadata): void;
setInlineTemplate(component: Type, template: string): void;
setAnimations(component: Type, animations: AnimationEntryMetadata[]): void;
overrideViewDirective(component: Type, from: Type, to: Type): void;
resolve(component: Type): ViewMetadata;
}
export declare class MockXHR extends XHR {
get(url: string): Promise<string>;
expect(url: string, response: string): void;
when(url: string, response: string): void;
flush(): void;
verifyNoOutstandingExpectations(): void;
}
export declare class TestComponentBuilder {
constructor(_injector: Injector);
overrideTemplate(componentType: Type, template: string): TestComponentBuilder;
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]): TestComponentBuilder;
overrideView(componentType: Type, view: ViewMetadata): TestComponentBuilder;
overrideDirective(componentType: Type, from: Type, to: Type): TestComponentBuilder;
overrideProviders(type: Type, providers: any[]): TestComponentBuilder;
overrideBindings(type: Type, providers: any[]): TestComponentBuilder;
overrideViewProviders(type: Type, providers: any[]): TestComponentBuilder;
overrideViewBindings(type: Type, providers: any[]): TestComponentBuilder;
createAsync(rootComponentType: Type): Promise<ComponentFixture<any>>;
createFakeAsync(rootComponentType: Type): ComponentFixture<any>;
createSync<C>(componentFactory: ComponentFactory<C>): ComponentFixture<C>;
}
export declare class TestComponentRenderer {
insertRootElement(rootElementId: string): void;
}

1266
tools/public_api_guard/core/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
export declare var afterEach: Function;
export declare function async(fn: Function): Function;
export declare function beforeEach(fn: Function): void;
export declare function beforeEachProviders(fn: () => Array<any>): void;
export declare function clearPendingTimers(): void;
export declare var ddescribe: Function;
export declare var describe: Function;
export declare function discardPeriodicTasks(): void;
export declare var expect: Function;
export declare function fakeAsync(fn: Function): Function;
export declare var fdescribe: Function;
export declare function fit(name: string, fn: Function, timeOut?: number): void;
export declare function flushMicrotasks(): void;
export declare function getTestInjector(): TestInjector;
export declare function getTypeOf(instance: any): any;
export declare function iit(name: string, fn: Function, timeOut?: number): void;
export declare function inject(tokens: any[], fn: Function): Function;
export declare function injectAsync(tokens: any[], fn: Function): Function;
export declare class InjectSetupWrapper {
constructor(_providers: () => any);
inject(tokens: any[], fn: Function): Function;
injectAsync(tokens: any[], fn: Function): Function;
}
export declare function instantiateType(type: Function, params?: any[]): any;
export declare function it(name: string, fn: Function, timeOut?: number): void;
export declare class Log {
logItems: any[];
constructor();
add(value: any): void;
fn(value: any): (a1?: any, a2?: any, a3?: any, a4?: any, a5?: any) => void;
clear(): void;
result(): string;
}
export declare class MockApplicationRef extends ApplicationRef {
registerBootstrapListener(listener: (ref: ComponentRef<any>) => void): void;
registerDisposeListener(dispose: () => void): void;
bootstrap<C>(componentFactory: ComponentFactory<C>): ComponentRef<C>;
injector: Injector;
zone: NgZone;
run(callback: Function): any;
waitForAsyncInitializers(): Promise<any>;
dispose(): void;
tick(): void;
componentTypes: Type[];
}
export declare class MockNgZone extends NgZone {
constructor();
onStable: EventEmitter<any>;
run(fn: Function): any;
runOutsideAngular(fn: Function): any;
simulateZoneExit(): void;
}
export declare function resetBaseTestProviders(): void;
export declare function setBaseTestProviders(platformProviders: Array<Type | Provider | any[]>, applicationProviders: Array<Type | Provider | any[]>): void;
export declare class TestInjector {
reset(): void;
platformProviders: Array<Type | Provider | any[] | any>;
applicationProviders: Array<Type | Provider | any[] | any>;
addProviders(providers: Array<Type | Provider | any[] | any>): void;
createInjector(): ReflectiveInjector;
get(token: any): any;
execute(tokens: any[], fn: Function): any;
}
export declare function tick(millis?: number): void;
export declare function withProviders(providers: () => any): InjectSetupWrapper;
export declare var xdescribe: Function;
export declare function xit(name: string, fn: Function, timeOut?: number): void;

340
tools/public_api_guard/forms/index.d.ts vendored Normal file
View File

@ -0,0 +1,340 @@
export declare abstract class AbstractControl {
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
constructor(validator: ValidatorFn, asyncValidator: AsyncValidatorFn);
value: any;
status: string;
valid: boolean;
errors: {
[key: string]: any;
};
pristine: boolean;
dirty: boolean;
touched: boolean;
untouched: boolean;
valueChanges: Observable<any>;
statusChanges: Observable<any>;
pending: boolean;
setAsyncValidators(newValidator: AsyncValidatorFn | AsyncValidatorFn[]): void;
clearAsyncValidators(): void;
setValidators(newValidator: ValidatorFn | ValidatorFn[]): void;
clearValidators(): void;
markAsTouched(): void;
markAsDirty({onlySelf}?: {
onlySelf?: boolean;
}): void;
markAsPending({onlySelf}?: {
onlySelf?: boolean;
}): void;
setParent(parent: FormGroup | FormArray): void;
updateValueAndValidity({onlySelf, emitEvent}?: {
onlySelf?: boolean;
emitEvent?: boolean;
}): void;
setErrors(errors: {
[key: string]: any;
}, {emitEvent}?: {
emitEvent?: boolean;
}): void;
find(path: Array<string | number> | string): AbstractControl;
getError(errorCode: string, path?: string[]): any;
hasError(errorCode: string, path?: string[]): boolean;
root: AbstractControl;
}
export declare abstract class AbstractControlDirective {
control: AbstractControl;
value: any;
valid: boolean;
errors: {
[key: string]: any;
};
pristine: boolean;
dirty: boolean;
touched: boolean;
untouched: boolean;
path: string[];
}
export declare class CheckboxControlValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
constructor(_renderer: Renderer, _elementRef: ElementRef);
writeValue(value: any): void;
registerOnChange(fn: (_: any) => {}): void;
registerOnTouched(fn: () => {}): void;
}
export declare class ControlContainer extends AbstractControlDirective {
name: string;
formDirective: Form;
path: string[];
}
export interface ControlValueAccessor {
writeValue(obj: any): void;
registerOnChange(fn: any): void;
registerOnTouched(fn: any): void;
}
export declare class DefaultValueAccessor implements ControlValueAccessor {
onChange: (_: any) => void;
onTouched: () => void;
constructor(_renderer: Renderer, _elementRef: ElementRef);
writeValue(value: any): void;
registerOnChange(fn: (_: any) => void): void;
registerOnTouched(fn: () => void): void;
}
export declare function disableDeprecatedForms(): any[];
export interface Form {
addControl(dir: NgControl): void;
removeControl(dir: NgControl): void;
getControl(dir: NgControl): FormControl;
addFormGroup(dir: AbstractFormGroupDirective): void;
removeFormGroup(dir: AbstractFormGroupDirective): void;
getFormGroup(dir: AbstractFormGroupDirective): FormGroup;
updateModel(dir: NgControl, value: any): void;
}
export declare const FORM_DIRECTIVES: Type[];
export declare const FORM_PROVIDERS: Type[];
export declare class FormArray extends AbstractControl {
controls: AbstractControl[];
constructor(controls: AbstractControl[], validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
at(index: number): AbstractControl;
push(control: AbstractControl): void;
insert(index: number, control: AbstractControl): void;
removeAt(index: number): void;
length: number;
}
export declare class FormBuilder {
group(controlsConfig: {
[key: string]: any;
}, extra?: {
[key: string]: any;
}): FormGroup;
control(value: Object, validator?: ValidatorFn | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]): FormControl;
array(controlsConfig: any[], validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn): FormArray;
}
export declare class FormControl extends AbstractControl {
constructor(value?: any, validator?: ValidatorFn | ValidatorFn[], asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[]);
updateValue(value: any, {onlySelf, emitEvent, emitModelToViewChange}?: {
onlySelf?: boolean;
emitEvent?: boolean;
emitModelToViewChange?: boolean;
}): void;
registerOnChange(fn: Function): void;
}
export declare class FormControlDirective extends NgControl implements OnChanges {
viewModel: any;
form: FormControl;
model: any;
update: EventEmitter<{}>;
constructor(_validators: any[], _asyncValidators: any[], valueAccessors: ControlValueAccessor[]);
ngOnChanges(changes: SimpleChanges): void;
path: string[];
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
control: FormControl;
viewToModelUpdate(newValue: any): void;
}
export declare class FormControlName extends NgControl implements OnChanges, OnDestroy {
name: string;
model: any;
update: EventEmitter<{}>;
constructor(_parent: ControlContainer, _validators: any[], _asyncValidators: any[], valueAccessors: ControlValueAccessor[]);
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
viewToModelUpdate(newValue: any): void;
path: string[];
formDirective: any;
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
control: FormControl;
}
export declare class FormGroup extends AbstractControl {
controls: {
[key: string]: AbstractControl;
};
constructor(controls: {
[key: string]: AbstractControl;
}, optionals?: {
[key: string]: boolean;
}, validator?: ValidatorFn, asyncValidator?: AsyncValidatorFn);
registerControl(name: string, control: AbstractControl): AbstractControl;
addControl(name: string, control: AbstractControl): void;
removeControl(name: string): void;
include(controlName: string): void;
exclude(controlName: string): void;
contains(controlName: string): boolean;
}
export declare class FormGroupDirective extends ControlContainer implements Form, OnChanges {
directives: NgControl[];
form: FormGroup;
ngSubmit: EventEmitter<{}>;
constructor(_validators: any[], _asyncValidators: any[]);
ngOnChanges(changes: SimpleChanges): void;
submitted: boolean;
formDirective: Form;
control: FormGroup;
path: string[];
addControl(dir: NgControl): void;
getControl(dir: NgControl): FormControl;
removeControl(dir: NgControl): void;
addFormGroup(dir: FormGroupName): void;
removeFormGroup(dir: FormGroupName): void;
getFormGroup(dir: FormGroupName): FormGroup;
updateModel(dir: NgControl, value: any): void;
onSubmit(): boolean;
}
export declare class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy {
name: string;
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
}
export declare class MaxLengthValidator implements Validator {
constructor(maxLength: string);
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare class MinLengthValidator implements Validator {
constructor(minLength: string);
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare const NG_ASYNC_VALIDATORS: OpaqueToken;
export declare const NG_VALIDATORS: OpaqueToken;
export declare const NG_VALUE_ACCESSOR: OpaqueToken;
export declare abstract class NgControl extends AbstractControlDirective {
name: string;
valueAccessor: ControlValueAccessor;
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
abstract viewToModelUpdate(newValue: any): void;
}
export declare class NgControlStatus {
constructor(cd: NgControl);
ngClassUntouched: boolean;
ngClassTouched: boolean;
ngClassPristine: boolean;
ngClassDirty: boolean;
ngClassValid: boolean;
ngClassInvalid: boolean;
}
export declare class NgForm extends ControlContainer implements Form {
form: FormGroup;
ngSubmit: EventEmitter<{}>;
constructor(validators: any[], asyncValidators: any[]);
submitted: boolean;
formDirective: Form;
control: FormGroup;
path: string[];
controls: {
[key: string]: AbstractControl;
};
addControl(dir: NgModel): void;
getControl(dir: NgModel): FormControl;
removeControl(dir: NgModel): void;
addFormGroup(dir: NgModelGroup): void;
removeFormGroup(dir: NgModelGroup): void;
getFormGroup(dir: NgModelGroup): FormGroup;
updateModel(dir: NgControl, value: any): void;
onSubmit(): boolean;
}
export declare class NgModel extends NgControl implements OnChanges, OnDestroy {
viewModel: any;
model: any;
name: string;
options: {
name?: string;
standalone?: boolean;
};
update: EventEmitter<{}>;
constructor(_parent: ControlContainer, _validators: any[], _asyncValidators: any[], valueAccessors: ControlValueAccessor[]);
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
control: FormControl;
path: string[];
formDirective: any;
validator: ValidatorFn;
asyncValidator: AsyncValidatorFn;
viewToModelUpdate(newValue: any): void;
}
export declare class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy {
name: string;
constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]);
}
export declare class NgSelectOption implements OnDestroy {
id: string;
constructor(_element: ElementRef, _renderer: Renderer, _select: SelectControlValueAccessor);
ngValue: any;
value: any;
ngOnDestroy(): void;
}
export declare class PatternValidator implements Validator {
constructor(pattern: string);
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare function provideForms(): any[];
export declare const REACTIVE_FORM_DIRECTIVES: Type[];
export declare class RequiredValidator {
}
export declare class SelectControlValueAccessor implements ControlValueAccessor {
value: any;
onChange: (_: any) => void;
onTouched: () => void;
constructor(_renderer: Renderer, _elementRef: ElementRef);
writeValue(value: any): void;
registerOnChange(fn: (value: any) => any): void;
registerOnTouched(fn: () => any): void;
}
export interface Validator {
validate(c: AbstractControl): {
[key: string]: any;
};
}
export declare class Validators {
static required(control: AbstractControl): {
[key: string]: boolean;
};
static minLength(minLength: number): ValidatorFn;
static maxLength(maxLength: number): ValidatorFn;
static pattern(pattern: string): ValidatorFn;
static nullValidator(c: AbstractControl): {
[key: string]: boolean;
};
static compose(validators: ValidatorFn[]): ValidatorFn;
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn;
}

215
tools/public_api_guard/http/index.d.ts vendored Normal file
View File

@ -0,0 +1,215 @@
export declare class BaseRequestOptions extends RequestOptions {
constructor();
}
export declare class BaseResponseOptions extends ResponseOptions {
constructor();
}
export declare class BrowserXhr {
constructor();
build(): any;
}
export declare abstract class Connection {
readyState: ReadyState;
request: Request;
response: any;
}
export declare abstract class ConnectionBackend {
abstract createConnection(request: any): Connection;
}
export declare class CookieXSRFStrategy implements XSRFStrategy {
constructor(_cookieName?: string, _headerName?: string);
configureRequest(req: Request): void;
}
export declare class Headers {
constructor(headers?: Headers | {
[key: string]: any;
});
static fromResponseHeaderString(headersString: string): Headers;
append(name: string, value: string): void;
delete(name: string): void;
forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void): void;
get(header: string): string;
has(header: string): boolean;
keys(): string[];
set(header: string, value: string | string[]): void;
values(): string[][];
toJSON(): {
[key: string]: any;
};
getAll(header: string): string[];
entries(): void;
}
export declare class Http {
protected _backend: ConnectionBackend;
protected _defaultOptions: RequestOptions;
constructor(_backend: ConnectionBackend, _defaultOptions: RequestOptions);
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>;
get(url: string, options?: RequestOptionsArgs): Observable<Response>;
post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
put(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
delete(url: string, options?: RequestOptionsArgs): Observable<Response>;
patch(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
head(url: string, options?: RequestOptionsArgs): Observable<Response>;
}
export declare const HTTP_BINDINGS: any[];
export declare const HTTP_PROVIDERS: any[];
export declare function httpFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions): Http;
export declare const JSON_BINDINGS: any[];
export declare class Jsonp extends Http {
constructor(backend: ConnectionBackend, defaultOptions: RequestOptions);
request(url: string | Request, options?: RequestOptionsArgs): Observable<Response>;
}
export declare const JSONP_PROVIDERS: any[];
export declare abstract class JSONPBackend extends ConnectionBackend {
}
export declare abstract class JSONPConnection implements Connection {
readyState: ReadyState;
request: Request;
response: Observable<Response>;
abstract finished(data?: any): void;
}
export declare enum ReadyState {
Unsent = 0,
Open = 1,
HeadersReceived = 2,
Loading = 3,
Done = 4,
Cancelled = 5,
}
export declare class Request {
method: RequestMethod;
headers: Headers;
url: string;
withCredentials: boolean;
constructor(requestOptions: RequestArgs);
text(): string;
json(): string;
arrayBuffer(): ArrayBuffer;
blob(): Blob;
detectContentType(): ContentType;
getBody(): any;
}
export declare enum RequestMethod {
Get = 0,
Post = 1,
Put = 2,
Delete = 3,
Options = 4,
Head = 5,
Patch = 6,
}
export declare class RequestOptions {
method: RequestMethod | string;
headers: Headers;
body: any;
url: string;
search: URLSearchParams;
withCredentials: boolean;
constructor({method, headers, body, url, search, withCredentials}?: RequestOptionsArgs);
merge(options?: RequestOptionsArgs): RequestOptions;
}
export interface RequestOptionsArgs {
url?: string;
method?: string | RequestMethod;
search?: string | URLSearchParams;
headers?: Headers;
body?: any;
withCredentials?: boolean;
}
export declare class Response {
type: ResponseType;
ok: boolean;
url: string;
status: number;
statusText: string;
bytesLoaded: number;
totalBytes: number;
headers: Headers;
constructor(responseOptions: ResponseOptions);
blob(): any;
json(): any;
text(): string;
arrayBuffer(): any;
toString(): string;
}
export declare class ResponseOptions {
body: string | Object;
status: number;
headers: Headers;
url: string;
constructor({body, status, headers, statusText, type, url}?: ResponseOptionsArgs);
merge(options?: ResponseOptionsArgs): ResponseOptions;
}
export declare type ResponseOptionsArgs = {
body?: string | Object | FormData;
status?: number;
statusText?: string;
headers?: Headers;
type?: ResponseType;
url?: string;
};
export declare enum ResponseType {
Basic = 0,
Cors = 1,
Default = 2,
Error = 3,
Opaque = 4,
}
export declare class URLSearchParams {
rawParams: string;
paramsMap: Map<string, string[]>;
constructor(rawParams?: string);
clone(): URLSearchParams;
has(param: string): boolean;
get(param: string): string;
getAll(param: string): string[];
set(param: string, val: string): void;
setAll(searchParams: URLSearchParams): void;
append(param: string, val: string): void;
appendAll(searchParams: URLSearchParams): void;
replaceAll(searchParams: URLSearchParams): void;
toString(): string;
delete(param: string): void;
}
export declare class XHRBackend implements ConnectionBackend {
constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy);
createConnection(request: Request): XHRConnection;
}
export declare class XHRConnection implements Connection {
request: Request;
response: Observable<Response>;
readyState: ReadyState;
constructor(req: Request, browserXHR: BrowserXhr, baseResponseOptions?: ResponseOptions);
setDetectedContentType(req: any, _xhr: any): void;
}
export declare abstract class XSRFStrategy {
abstract configureRequest(req: Request): void;
}

View File

@ -0,0 +1,19 @@
export declare class MockBackend implements ConnectionBackend {
connections: any;
connectionsArray: MockConnection[];
pendingConnections: any;
constructor();
verifyNoPendingRequests(): void;
resolveAllConnections(): void;
createConnection(req: Request): MockConnection;
}
export declare class MockConnection implements Connection {
readyState: ReadyState;
request: Request;
response: ReplaySubject<Response>;
constructor(req: Request);
mockRespond(res: Response): void;
mockDownload(res: Response): void;
mockError(err?: Error): void;
}

View File

@ -0,0 +1,9 @@
export declare function bootstrap(appComponentType: Type, customProviders?: Array<any>): Promise<ComponentRef<any>>;
export declare function bootstrapWorkerApp(appComponentType: Type, customProviders?: Array<any>): Promise<ComponentRef<any>>;
export declare function bootstrapWorkerUi(workerScriptUri: string, customProviders?: Array<any>): Promise<ApplicationRef>;
export declare const BROWSER_APP_COMPILER_PROVIDERS: Array<any>;
export declare const CACHED_TEMPLATE_PROVIDER: Array<any>;

View File

@ -0,0 +1,3 @@
export declare const TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS: Array<any>;
export declare const TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS: Array<any>;

View File

@ -0,0 +1,201 @@
export declare const BROWSER_APP_PROVIDERS: Array<any>;
export declare const BROWSER_PLATFORM_PROVIDERS: Array<any>;
export declare const BROWSER_PROVIDERS: any[];
export declare const BROWSER_SANITIZATION_PROVIDERS: Array<any>;
export declare function browserPlatform(): PlatformRef;
export declare class BrowserPlatformLocation extends PlatformLocation {
constructor();
getBaseHrefFromDOM(): string;
onPopState(fn: UrlChangeListener): void;
onHashChange(fn: UrlChangeListener): void;
pathname: string;
search: string;
hash: string;
pushState(state: any, title: string, url: string): void;
replaceState(state: any, title: string, url: string): void;
forward(): void;
back(): void;
}
export declare class By {
static all(): Predicate<DebugElement>;
static css(selector: string): Predicate<DebugElement>;
static directive(type: Type): Predicate<DebugElement>;
}
export declare abstract class ClientMessageBroker {
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
}
export declare abstract class ClientMessageBrokerFactory {
abstract createMessageBroker(channel: string, runInZone?: boolean): ClientMessageBroker;
}
export declare function disableDebugTools(): void;
export declare const DOCUMENT: OpaqueToken;
export declare class DomEventsPlugin extends EventManagerPlugin {
supports(eventName: string): boolean;
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
addGlobalEventListener(target: string, eventName: string, handler: Function): Function;
}
export declare abstract class DomSanitizationService implements SanitizationService {
abstract sanitize(context: SecurityContext, value: any): string;
abstract bypassSecurityTrustHtml(value: string): SafeHtml;
abstract bypassSecurityTrustStyle(value: string): SafeStyle;
abstract bypassSecurityTrustScript(value: string): SafeScript;
abstract bypassSecurityTrustUrl(value: string): SafeUrl;
abstract bypassSecurityTrustResourceUrl(value: string): SafeResourceUrl;
}
export declare const ELEMENT_PROBE_PROVIDERS: any[];
export declare function enableDebugTools<T>(ref: ComponentRef<T>): ComponentRef<T>;
export declare const EVENT_MANAGER_PLUGINS: OpaqueToken;
export declare class EventManager {
constructor(plugins: EventManagerPlugin[], _zone: NgZone);
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
addGlobalEventListener(target: string, eventName: string, handler: Function): Function;
getZone(): NgZone;
}
export declare class FnArg {
value: any;
type: Type;
constructor(value: any, type: Type);
}
export declare const HAMMER_GESTURE_CONFIG: OpaqueToken;
export declare class HammerGestureConfig {
events: string[];
overrides: {
[key: string]: Object;
};
buildHammer(element: HTMLElement): HammerInstance;
}
export declare class KeyEventsPlugin extends EventManagerPlugin {
constructor();
supports(eventName: string): boolean;
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
static parseEventName(eventName: string): {
[key: string]: string;
};
static getEventFullKey(event: KeyboardEvent): string;
static eventCallback(element: HTMLElement, fullKey: any, handler: Function, zone: NgZone): Function;
}
export declare abstract class MessageBus implements MessageBusSource, MessageBusSink {
abstract initChannel(channel: string, runInZone?: boolean): void;
abstract attachToZone(zone: NgZone): void;
abstract from(channel: string): EventEmitter<any>;
abstract to(channel: string): EventEmitter<any>;
}
export interface MessageBusSink {
initChannel(channel: string, runInZone: boolean): void;
attachToZone(zone: NgZone): void;
to(channel: string): EventEmitter<any>;
}
export interface MessageBusSource {
initChannel(channel: string, runInZone: boolean): void;
attachToZone(zone: NgZone): void;
from(channel: string): EventEmitter<any>;
}
export declare const PRIMITIVE: Type;
export declare class ReceivedMessage {
method: string;
args: any[];
id: string;
type: string;
constructor(data: {
[key: string]: any;
});
}
export interface SafeHtml extends SafeValue {
}
export interface SafeResourceUrl extends SafeValue {
}
export interface SafeScript extends SafeValue {
}
export interface SafeStyle extends SafeValue {
}
export interface SafeUrl extends SafeValue {
}
export declare var SecurityContext: typeof t.SecurityContext;
export declare abstract class ServiceMessageBroker {
abstract registerMethod(methodName: string, signature: Type[], method: Function, returnType?: Type): void;
}
export declare abstract class ServiceMessageBrokerFactory {
abstract createMessageBroker(channel: string, runInZone?: boolean): ServiceMessageBroker;
}
export declare class Title {
getTitle(): string;
setTitle(newTitle: string): void;
}
export declare class UiArguments {
method: string;
args: FnArg[];
constructor(method: string, args?: FnArg[]);
}
export declare class WebWorkerInstance {
worker: Worker;
bus: MessageBus;
}
export declare const WORKER_APP_APPLICATION_PROVIDERS: Array<any>;
export declare const WORKER_APP_LOCATION_PROVIDERS: ({
provide: typeof PlatformLocation;
useClass: typeof WebWorkerPlatformLocation;
} | {
provide: any;
useFactory: (platformLocation: WebWorkerPlatformLocation, zone: NgZone) => () => Promise<boolean>;
multi: boolean;
deps: (typeof PlatformLocation | typeof NgZone)[];
})[];
export declare const WORKER_APP_PLATFORM_PROVIDERS: Array<any>;
export declare const WORKER_SCRIPT: OpaqueToken;
export declare const WORKER_UI_APPLICATION_PROVIDERS: Array<any>;
export declare const WORKER_UI_LOCATION_PROVIDERS: (typeof MessageBasedPlatformLocation | typeof BrowserPlatformLocation | {
provide: any;
useFactory: (injector: Injector) => () => void;
multi: boolean;
deps: typeof Injector[];
})[];
export declare const WORKER_UI_PLATFORM_PROVIDERS: Array<any>;
export declare const WORKER_UI_STARTABLE_MESSAGING_SERVICE: OpaqueToken;
export declare function workerAppPlatform(): PlatformRef;
export declare function workerUiPlatform(): PlatformRef;

View File

@ -0,0 +1,40 @@
export declare var browserDetection: BrowserDetection;
export declare class BrowserDetection {
static setup(): void;
constructor(ua: string);
isFirefox: boolean;
isAndroid: boolean;
isEdge: boolean;
isIE: boolean;
isWebkit: boolean;
isIOS7: boolean;
isSlow: boolean;
supportsIntlApi: boolean;
isChromeDesktop: boolean;
}
export declare function dispatchEvent(element: any, eventType: any): void;
export declare function el(html: string): HTMLElement;
export declare var expect: (actual: any) => NgMatchers;
export interface NgMatchers extends jasmine.Matchers {
toBePromise(): boolean;
toBeAnInstanceOf(expected: any): boolean;
toHaveText(expected: any): boolean;
toHaveCssClass(expected: any): boolean;
toHaveCssStyle(expected: any): boolean;
toImplement(expected: any): boolean;
toContainError(expected: any): boolean;
not: NgMatchers;
}
export declare function normalizeCSS(css: string): string;
export declare function stringifyElement(el: any): string;
export declare const TEST_BROWSER_APPLICATION_PROVIDERS: Array<any>;
export declare const TEST_BROWSER_PLATFORM_PROVIDERS: Array<any>;

View File

@ -0,0 +1,7 @@
export declare var $: cssSelectorHelper;
export declare var browser: protractor.IBrowser;
export declare function clickAll(buttonSelectors: any): void;
export declare function verifyNoBrowserErrors(): void;

View File

@ -0,0 +1,5 @@
export declare const SERVER_PLATFORM_PROVIDERS: Array<any>;
export declare function serverBootstrap(appComponentType: Type, providers: Array<any>): Promise<ComponentRef<any>>;
export declare function serverPlatform(): PlatformRef;

View File

@ -0,0 +1,3 @@
export declare const TEST_SERVER_APPLICATION_PROVIDERS: Array<any>;
export declare const TEST_SERVER_PLATFORM_PROVIDERS: Array<any>;

152
tools/public_api_guard/router/index.d.ts vendored Normal file
View File

@ -0,0 +1,152 @@
export declare class ActivatedRoute {
url: Observable<UrlPathWithParams[]>;
params: Observable<Params>;
outlet: string;
component: Type | string;
snapshot: ActivatedRouteSnapshot;
toString(): string;
}
export declare class ActivatedRouteSnapshot {
url: UrlPathWithParams[];
params: Params;
outlet: string;
component: Type | string;
toString(): string;
}
export interface CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean;
}
export interface CanDeactivate<T> {
canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean;
}
export declare class DefaultUrlSerializer implements UrlSerializer {
parse(url: string): UrlTree;
serialize(tree: UrlTree): string;
}
export declare type Event = NavigationStart | NavigationEnd | NavigationCancel | NavigationError;
export interface ExtraOptions {
enableTracing?: boolean;
}
export declare class NavigationCancel {
id: number;
url: string;
constructor(id: number, url: string);
toString(): string;
}
export declare class NavigationEnd {
id: number;
url: string;
urlAfterRedirects: string;
constructor(id: number, url: string, urlAfterRedirects: string);
toString(): string;
}
export declare class NavigationError {
id: number;
url: string;
error: any;
constructor(id: number, url: string, error: any);
toString(): string;
}
export declare class NavigationStart {
id: number;
url: string;
constructor(id: number, url: string);
toString(): string;
}
export declare type Params = {
[key: string]: any;
};
export declare const PRIMARY_OUTLET: string;
export declare function provideRouter(config: RouterConfig, opts?: ExtraOptions): any[];
export interface Route {
path?: string;
terminal?: boolean;
component?: Type | string;
outlet?: string;
canActivate?: any[];
canDeactivate?: any[];
redirectTo?: string;
children?: Route[];
}
export declare class Router {
routerState: RouterState;
url: string;
events: Observable<Event>;
resetConfig(config: RouterConfig): void;
createUrlTree(commands: any[], {relativeTo, queryParams, fragment}?: NavigationExtras): UrlTree;
navigateByUrl(url: string | UrlTree): Promise<boolean>;
navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>;
serializeUrl(url: UrlTree): string;
parseUrl(url: string): UrlTree;
}
export declare const ROUTER_DIRECTIVES: (typeof RouterOutlet | typeof RouterLink | typeof RouterLinkActive)[];
export declare type RouterConfig = Route[];
export declare class RouterOutletMap {
registerOutlet(name: string, outlet: RouterOutlet): void;
}
export declare class RouterState extends Tree<ActivatedRoute> {
queryParams: Observable<Params>;
fragment: Observable<string>;
snapshot: RouterStateSnapshot;
toString(): string;
}
export declare class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> {
url: string;
queryParams: Params;
fragment: string;
toString(): string;
}
export declare class RoutesRecognized {
id: number;
url: string;
urlAfterRedirects: string;
state: RouterStateSnapshot;
constructor(id: number, url: string, urlAfterRedirects: string, state: RouterStateSnapshot);
toString(): string;
}
export declare class UrlPathWithParams {
path: string;
parameters: {
[key: string]: string;
};
constructor(path: string, parameters: {
[key: string]: string;
});
toString(): string;
}
export declare abstract class UrlSerializer {
abstract parse(url: string): UrlTree;
abstract serialize(tree: UrlTree): string;
}
export declare class UrlTree {
root: UrlSegment;
queryParams: {
[key: string]: string;
};
fragment: string;
toString(): string;
}

View File

@ -0,0 +1,19 @@
export declare class UpgradeAdapter {
downgradeNg2Component(type: Type): Function;
upgradeNg1Component(name: string): Type;
bootstrap(element: Element, modules?: any[], config?: angular.IAngularBootstrapConfig): UpgradeAdapterRef;
addProvider(provider: Type | Provider | any[] | any): void;
upgradeNg1Provider(name: string, options?: {
asToken: any;
}): void;
downgradeNg2Provider(token: any): Function;
}
export declare class UpgradeAdapterRef {
ng1RootScope: angular.IRootScopeService;
ng1Injector: angular.IInjectorService;
ng2ApplicationRef: ApplicationRef;
ng2Injector: Injector;
ready(fn: (upgradeAdapterRef?: UpgradeAdapterRef) => void): void;
dispose(): void;
}