chore(typings): mark underscore methods @internal.
This allows TypeScript to produce an API surface which matches the Dart semantics. I found these with: gulp build.js.dev && find dist/js/dev/es5/angular2/src -name "*.d.ts" -exec grep -H -n '^ *_' {} \; Closes #4638
This commit is contained in:
parent
95f984615b
commit
867c08ac84
|
@ -204,6 +204,7 @@ export abstract class PlatformRef {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PlatformRef_ extends PlatformRef {
|
export class PlatformRef_ extends PlatformRef {
|
||||||
|
/** @internal */
|
||||||
_applications: ApplicationRef[] = [];
|
_applications: ApplicationRef[] = [];
|
||||||
|
|
||||||
constructor(private _injector: Injector, private _dispose: () => void) { super(); }
|
constructor(private _injector: Injector, private _dispose: () => void) { super(); }
|
||||||
|
@ -256,6 +257,7 @@ export class PlatformRef_ extends PlatformRef {
|
||||||
this._dispose();
|
this._dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_applicationDisposed(app: ApplicationRef): void { ListWrapper.remove(this._applications, app); }
|
_applicationDisposed(app: ApplicationRef): void { ListWrapper.remove(this._applications, app); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||||
|
|
||||||
afterViewLifecycleCallbacksInternal(): void {}
|
afterViewLifecycleCallbacksInternal(): void {}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_detectChangesInLightDomChildren(throwOnChange: boolean): void {
|
_detectChangesInLightDomChildren(throwOnChange: boolean): void {
|
||||||
var c = this.lightDomChildren;
|
var c = this.lightDomChildren;
|
||||||
for (var i = 0; i < c.length; ++i) {
|
for (var i = 0; i < c.length; ++i) {
|
||||||
|
@ -185,6 +186,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_detectChangesInShadowDomChildren(throwOnChange: boolean): void {
|
_detectChangesInShadowDomChildren(throwOnChange: boolean): void {
|
||||||
var c = this.shadowDomChildren;
|
var c = this.shadowDomChildren;
|
||||||
for (var i = 0; i < c.length; ++i) {
|
for (var i = 0; i < c.length; ++i) {
|
||||||
|
|
|
@ -109,17 +109,20 @@ export class ChangeDetectorJITGenerator {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genPropertyBindingTargets(): string {
|
_genPropertyBindingTargets(): string {
|
||||||
var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets,
|
var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets,
|
||||||
this.genConfig.genDebugInfo);
|
this.genConfig.genDebugInfo);
|
||||||
return `${this.typeName}.gen_propertyBindingTargets = ${targets};`;
|
return `${this.typeName}.gen_propertyBindingTargets = ${targets};`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genDirectiveIndices(): string {
|
_genDirectiveIndices(): string {
|
||||||
var indices = this._logic.genDirectiveIndices(this.directiveRecords);
|
var indices = this._logic.genDirectiveIndices(this.directiveRecords);
|
||||||
return `${this.typeName}.gen_directiveIndices = ${indices};`;
|
return `${this.typeName}.gen_directiveIndices = ${indices};`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_maybeGenHandleEventInternal(): string {
|
_maybeGenHandleEventInternal(): string {
|
||||||
if (this.eventBindings.length > 0) {
|
if (this.eventBindings.length > 0) {
|
||||||
var handlers = this.eventBindings.map(eb => this._genEventBinding(eb)).join("\n");
|
var handlers = this.eventBindings.map(eb => this._genEventBinding(eb)).join("\n");
|
||||||
|
@ -136,6 +139,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genEventBinding(eb: EventBinding): string {
|
_genEventBinding(eb: EventBinding): string {
|
||||||
var recs = eb.records.map(r => this._genEventBindingEval(eb, r)).join("\n");
|
var recs = eb.records.map(r => this._genEventBindingEval(eb, r)).join("\n");
|
||||||
return `
|
return `
|
||||||
|
@ -144,6 +148,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genEventBindingEval(eb: EventBinding, r: ProtoRecord): string {
|
_genEventBindingEval(eb: EventBinding, r: ProtoRecord): string {
|
||||||
if (r.lastInBinding) {
|
if (r.lastInBinding) {
|
||||||
var evalRecord = this._logic.genEventBindingEvalValue(eb, r);
|
var evalRecord = this._logic.genEventBindingEvalValue(eb, r);
|
||||||
|
@ -155,6 +160,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genMarkPathToRootAsCheckOnce(r: ProtoRecord): string {
|
_genMarkPathToRootAsCheckOnce(r: ProtoRecord): string {
|
||||||
var br = r.bindingRecord;
|
var br = r.bindingRecord;
|
||||||
if (br.isDefaultChangeDetection()) {
|
if (br.isDefaultChangeDetection()) {
|
||||||
|
@ -164,11 +170,13 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genUpdatePreventDefault(eb: EventBinding, r: ProtoRecord): string {
|
_genUpdatePreventDefault(eb: EventBinding, r: ProtoRecord): string {
|
||||||
var local = this._names.getEventLocalName(eb, r.selfIndex);
|
var local = this._names.getEventLocalName(eb, r.selfIndex);
|
||||||
return `if (${local} === false) { ${this._names.getPreventDefaultAccesor()} = true};`;
|
return `if (${local} === false) { ${this._names.getPreventDefaultAccesor()} = true};`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_maybeGenDehydrateDirectives(): string {
|
_maybeGenDehydrateDirectives(): string {
|
||||||
var destroyPipesCode = this._names.genPipeOnDestroy();
|
var destroyPipesCode = this._names.genPipeOnDestroy();
|
||||||
if (destroyPipesCode) {
|
if (destroyPipesCode) {
|
||||||
|
@ -182,6 +190,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_maybeGenHydrateDirectives(): string {
|
_maybeGenHydrateDirectives(): string {
|
||||||
var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords);
|
var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords);
|
||||||
var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords);
|
var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords);
|
||||||
|
@ -192,6 +201,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_maybeGenAfterContentLifecycleCallbacks(): string {
|
_maybeGenAfterContentLifecycleCallbacks(): string {
|
||||||
var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords);
|
var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords);
|
||||||
if (notifications.length > 0) {
|
if (notifications.length > 0) {
|
||||||
|
@ -206,6 +216,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_maybeGenAfterViewLifecycleCallbacks(): string {
|
_maybeGenAfterViewLifecycleCallbacks(): string {
|
||||||
var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords);
|
var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords);
|
||||||
if (notifications.length > 0) {
|
if (notifications.length > 0) {
|
||||||
|
@ -220,6 +231,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genRecord(r: ProtoRecord): string {
|
_genRecord(r: ProtoRecord): string {
|
||||||
var rec;
|
var rec;
|
||||||
if (r.isLifeCycleRecord()) {
|
if (r.isLifeCycleRecord()) {
|
||||||
|
@ -236,6 +248,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genDirectiveLifecycle(r: ProtoRecord): string {
|
_genDirectiveLifecycle(r: ProtoRecord): string {
|
||||||
if (r.name === "DoCheck") {
|
if (r.name === "DoCheck") {
|
||||||
return this._genOnCheck(r);
|
return this._genOnCheck(r);
|
||||||
|
@ -248,6 +261,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genPipeCheck(r: ProtoRecord): string {
|
_genPipeCheck(r: ProtoRecord): string {
|
||||||
var context = this._names.getLocalName(r.contextIndex);
|
var context = this._names.getLocalName(r.contextIndex);
|
||||||
var argString = r.args.map((arg) => this._names.getLocalName(arg)).join(", ");
|
var argString = r.args.map((arg) => this._names.getLocalName(arg)).join(", ");
|
||||||
|
@ -288,6 +302,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genReferenceCheck(r: ProtoRecord): string {
|
_genReferenceCheck(r: ProtoRecord): string {
|
||||||
var oldValue = this._names.getFieldName(r.selfIndex);
|
var oldValue = this._names.getFieldName(r.selfIndex);
|
||||||
var newValue = this._names.getLocalName(r.selfIndex);
|
var newValue = this._names.getLocalName(r.selfIndex);
|
||||||
|
@ -318,10 +333,12 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genChangeMarker(r: ProtoRecord): string {
|
_genChangeMarker(r: ProtoRecord): string {
|
||||||
return r.argumentToPureFunction ? `${this._names.getChangeName(r.selfIndex)} = true` : ``;
|
return r.argumentToPureFunction ? `${this._names.getChangeName(r.selfIndex)} = true` : ``;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genUpdateDirectiveOrElement(r: ProtoRecord): string {
|
_genUpdateDirectiveOrElement(r: ProtoRecord): string {
|
||||||
if (!r.lastInBinding) return "";
|
if (!r.lastInBinding) return "";
|
||||||
|
|
||||||
|
@ -348,6 +365,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genThrowOnChangeCheck(oldValue: string, newValue: string): string {
|
_genThrowOnChangeCheck(oldValue: string, newValue: string): string {
|
||||||
if (this.genConfig.genCheckNoChanges) {
|
if (this.genConfig.genCheckNoChanges) {
|
||||||
return `
|
return `
|
||||||
|
@ -360,6 +378,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genCheckNoChanges(): string {
|
_genCheckNoChanges(): string {
|
||||||
if (this.genConfig.genCheckNoChanges) {
|
if (this.genConfig.genCheckNoChanges) {
|
||||||
return `${this.typeName}.prototype.checkNoChanges = function() { this.runDetectChanges(true); }`;
|
return `${this.typeName}.prototype.checkNoChanges = function() { this.runDetectChanges(true); }`;
|
||||||
|
@ -368,6 +387,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genAddToChanges(r: ProtoRecord): string {
|
_genAddToChanges(r: ProtoRecord): string {
|
||||||
var newValue = this._names.getLocalName(r.selfIndex);
|
var newValue = this._names.getLocalName(r.selfIndex);
|
||||||
var oldValue = this._names.getFieldName(r.selfIndex);
|
var oldValue = this._names.getFieldName(r.selfIndex);
|
||||||
|
@ -375,6 +395,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
return `${CHANGES_LOCAL} = this.addChange(${CHANGES_LOCAL}, ${oldValue}, ${newValue});`;
|
return `${CHANGES_LOCAL} = this.addChange(${CHANGES_LOCAL}, ${oldValue}, ${newValue});`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_maybeFirstInBinding(r: ProtoRecord): string {
|
_maybeFirstInBinding(r: ProtoRecord): string {
|
||||||
var prev = ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1);
|
var prev = ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1);
|
||||||
var firstInBindng = isBlank(prev) || prev.bindingRecord !== r.bindingRecord;
|
var firstInBindng = isBlank(prev) || prev.bindingRecord !== r.bindingRecord;
|
||||||
|
@ -383,6 +404,7 @@ export class ChangeDetectorJITGenerator {
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_maybeGenLastInDirective(r: ProtoRecord): string {
|
_maybeGenLastInDirective(r: ProtoRecord): string {
|
||||||
if (!r.lastInDirective) return "";
|
if (!r.lastInDirective) return "";
|
||||||
return `
|
return `
|
||||||
|
@ -392,21 +414,25 @@ export class ChangeDetectorJITGenerator {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genOnCheck(r: ProtoRecord): string {
|
_genOnCheck(r: ProtoRecord): string {
|
||||||
var br = r.bindingRecord;
|
var br = r.bindingRecord;
|
||||||
return `if (!throwOnChange) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.doCheck();`;
|
return `if (!throwOnChange) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.doCheck();`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genOnInit(r: ProtoRecord): string {
|
_genOnInit(r: ProtoRecord): string {
|
||||||
var br = r.bindingRecord;
|
var br = r.bindingRecord;
|
||||||
return `if (!throwOnChange && !${this._names.getAlreadyCheckedName()}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onInit();`;
|
return `if (!throwOnChange && !${this._names.getAlreadyCheckedName()}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onInit();`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genOnChange(r: ProtoRecord): string {
|
_genOnChange(r: ProtoRecord): string {
|
||||||
var br = r.bindingRecord;
|
var br = r.bindingRecord;
|
||||||
return `if (!throwOnChange && ${CHANGES_LOCAL}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onChanges(${CHANGES_LOCAL});`;
|
return `if (!throwOnChange && ${CHANGES_LOCAL}) ${this._names.getDirectiveName(br.directiveRecord.directiveIndex)}.onChanges(${CHANGES_LOCAL});`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genNotifyOnPushDetectors(r: ProtoRecord): string {
|
_genNotifyOnPushDetectors(r: ProtoRecord): string {
|
||||||
var br = r.bindingRecord;
|
var br = r.bindingRecord;
|
||||||
if (!r.lastInDirective || br.isDefaultChangeDetection()) return "";
|
if (!r.lastInDirective || br.isDefaultChangeDetection()) return "";
|
||||||
|
|
|
@ -111,6 +111,7 @@ export class CodegenLogicUtil {
|
||||||
return `${getLocalName(protoRec.selfIndex)} = ${rhs};`;
|
return `${getLocalName(protoRec.selfIndex)} = ${rhs};`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_observe(exp: string, rec: ProtoRecord): string {
|
_observe(exp: string, rec: ProtoRecord): string {
|
||||||
// This is an experimental feature. Works only in Dart.
|
// This is an experimental feature. Works only in Dart.
|
||||||
if (this._changeDetection === ChangeDetectionStrategy.OnPushObserve) {
|
if (this._changeDetection === ChangeDetectionStrategy.OnPushObserve) {
|
||||||
|
@ -138,6 +139,7 @@ export class CodegenLogicUtil {
|
||||||
return `[${bs.join(", ")}]`;
|
return `[${bs.join(", ")}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_genInterpolation(protoRec: ProtoRecord): string {
|
_genInterpolation(protoRec: ProtoRecord): string {
|
||||||
var iVals = [];
|
var iVals = [];
|
||||||
for (var i = 0; i < protoRec.args.length; ++i) {
|
for (var i = 0; i < protoRec.args.length; ++i) {
|
||||||
|
|
|
@ -40,8 +40,10 @@ export class CodegenNameUtil {
|
||||||
/**
|
/**
|
||||||
* Record names sanitized for use as fields.
|
* Record names sanitized for use as fields.
|
||||||
* See [sanitizeName] for details.
|
* See [sanitizeName] for details.
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
_sanitizedNames: string[];
|
_sanitizedNames: string[];
|
||||||
|
/** @internal */
|
||||||
_sanitizedEventNames = new Map<EventBinding, string[]>();
|
_sanitizedEventNames = new Map<EventBinding, string[]>();
|
||||||
|
|
||||||
constructor(private _records: ProtoRecord[], private _eventBindings: EventBinding[],
|
constructor(private _records: ProtoRecord[], private _eventBindings: EventBinding[],
|
||||||
|
@ -62,6 +64,7 @@ export class CodegenNameUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addFieldPrefix(name: string): string { return `${_FIELD_PREFIX}${name}`; }
|
_addFieldPrefix(name: string): string { return `${_FIELD_PREFIX}${name}`; }
|
||||||
|
|
||||||
getDispatcherName(): string { return this._addFieldPrefix(_DISPATCHER_ACCESSOR); }
|
getDispatcherName(): string { return this._addFieldPrefix(_DISPATCHER_ACCESSOR); }
|
||||||
|
|
|
@ -151,6 +151,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
* currentKey, and clear all of the queues (additions, moves, removals).
|
* currentKey, and clear all of the queues (additions, moves, removals).
|
||||||
* Set the previousIndexes of moved and added items to their currentIndexes
|
* Set the previousIndexes of moved and added items to their currentIndexes
|
||||||
* Reset the list of additions, moves and removals
|
* Reset the list of additions, moves and removals
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
_reset() {
|
_reset() {
|
||||||
if (this.isDirty) {
|
if (this.isDirty) {
|
||||||
|
@ -185,6 +187,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
* item.
|
* item.
|
||||||
* - `item` is the current item in the collection
|
* - `item` is the current item in the collection
|
||||||
* - `index` is the position of the item in the collection
|
* - `index` is the position of the item in the collection
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
_mismatch(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
_mismatch(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
||||||
// The previous record after which we will append the current one.
|
// The previous record after which we will append the current one.
|
||||||
|
@ -241,6 +245,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
|
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
|
||||||
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
|
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
|
||||||
* at the end.
|
* at the end.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
_verifyReinsertion(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
_verifyReinsertion(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
||||||
var reinsertRecord: CollectionChangeRecord =
|
var reinsertRecord: CollectionChangeRecord =
|
||||||
|
@ -258,6 +264,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
* Get rid of any excess {@link CollectionChangeRecord}s from the previous collection
|
* Get rid of any excess {@link CollectionChangeRecord}s from the previous collection
|
||||||
*
|
*
|
||||||
* - `record` The first excess {@link CollectionChangeRecord}.
|
* - `record` The first excess {@link CollectionChangeRecord}.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
_truncate(record: CollectionChangeRecord) {
|
_truncate(record: CollectionChangeRecord) {
|
||||||
// Anything after that needs to be removed;
|
// Anything after that needs to be removed;
|
||||||
|
@ -284,6 +292,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
_reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||||
index: number): CollectionChangeRecord {
|
index: number): CollectionChangeRecord {
|
||||||
if (this._unlinkedRecords !== null) {
|
if (this._unlinkedRecords !== null) {
|
||||||
|
@ -308,6 +317,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
_moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||||
index: number): CollectionChangeRecord {
|
index: number): CollectionChangeRecord {
|
||||||
this._unlink(record);
|
this._unlink(record);
|
||||||
|
@ -316,6 +326,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
_addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||||
index: number): CollectionChangeRecord {
|
index: number): CollectionChangeRecord {
|
||||||
this._insertAfter(record, prevRecord, index);
|
this._insertAfter(record, prevRecord, index);
|
||||||
|
@ -333,6 +344,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
_insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||||
index: number): CollectionChangeRecord {
|
index: number): CollectionChangeRecord {
|
||||||
// todo(vicb)
|
// todo(vicb)
|
||||||
|
@ -366,10 +378,12 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_remove(record: CollectionChangeRecord): CollectionChangeRecord {
|
_remove(record: CollectionChangeRecord): CollectionChangeRecord {
|
||||||
return this._addToRemovals(this._unlink(record));
|
return this._addToRemovals(this._unlink(record));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_unlink(record: CollectionChangeRecord): CollectionChangeRecord {
|
_unlink(record: CollectionChangeRecord): CollectionChangeRecord {
|
||||||
if (this._linkedRecords !== null) {
|
if (this._linkedRecords !== null) {
|
||||||
this._linkedRecords.remove(record);
|
this._linkedRecords.remove(record);
|
||||||
|
@ -396,6 +410,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addToMoves(record: CollectionChangeRecord, toIndex: number): CollectionChangeRecord {
|
_addToMoves(record: CollectionChangeRecord, toIndex: number): CollectionChangeRecord {
|
||||||
// todo(vicb)
|
// todo(vicb)
|
||||||
// assert(record._nextMoved === null);
|
// assert(record._nextMoved === null);
|
||||||
|
@ -417,6 +432,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addToRemovals(record: CollectionChangeRecord): CollectionChangeRecord {
|
_addToRemovals(record: CollectionChangeRecord): CollectionChangeRecord {
|
||||||
if (this._unlinkedRecords === null) {
|
if (this._unlinkedRecords === null) {
|
||||||
this._unlinkedRecords = new _DuplicateMap();
|
this._unlinkedRecords = new _DuplicateMap();
|
||||||
|
@ -477,14 +493,23 @@ export class CollectionChangeRecord {
|
||||||
currentIndex: number = null;
|
currentIndex: number = null;
|
||||||
previousIndex: number = null;
|
previousIndex: number = null;
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_nextPrevious: CollectionChangeRecord = null;
|
_nextPrevious: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_prev: CollectionChangeRecord = null;
|
_prev: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_next: CollectionChangeRecord = null;
|
_next: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_prevDup: CollectionChangeRecord = null;
|
_prevDup: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_nextDup: CollectionChangeRecord = null;
|
_nextDup: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_prevRemoved: CollectionChangeRecord = null;
|
_prevRemoved: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_nextRemoved: CollectionChangeRecord = null;
|
_nextRemoved: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_nextAdded: CollectionChangeRecord = null;
|
_nextAdded: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_nextMoved: CollectionChangeRecord = null;
|
_nextMoved: CollectionChangeRecord = null;
|
||||||
|
|
||||||
constructor(public item: any) {}
|
constructor(public item: any) {}
|
||||||
|
@ -499,7 +524,9 @@ export class CollectionChangeRecord {
|
||||||
|
|
||||||
// A linked list of CollectionChangeRecords with the same CollectionChangeRecord.item
|
// A linked list of CollectionChangeRecords with the same CollectionChangeRecord.item
|
||||||
class _DuplicateItemRecordList {
|
class _DuplicateItemRecordList {
|
||||||
|
/** @internal */
|
||||||
_head: CollectionChangeRecord = null;
|
_head: CollectionChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_tail: CollectionChangeRecord = null;
|
_tail: CollectionChangeRecord = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,6 +129,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
return this.isDirty;
|
return this.isDirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_reset() {
|
_reset() {
|
||||||
if (this.isDirty) {
|
if (this.isDirty) {
|
||||||
var record: KVChangeRecord;
|
var record: KVChangeRecord;
|
||||||
|
@ -176,6 +177,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_truncate(lastRecord: KVChangeRecord, record: KVChangeRecord) {
|
_truncate(lastRecord: KVChangeRecord, record: KVChangeRecord) {
|
||||||
while (record !== null) {
|
while (record !== null) {
|
||||||
if (lastRecord === null) {
|
if (lastRecord === null) {
|
||||||
|
@ -201,11 +203,13 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_isInRemovals(record: KVChangeRecord) {
|
_isInRemovals(record: KVChangeRecord) {
|
||||||
return record === this._removalsHead || record._nextRemoved !== null ||
|
return record === this._removalsHead || record._nextRemoved !== null ||
|
||||||
record._prevRemoved !== null;
|
record._prevRemoved !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addToRemovals(record: KVChangeRecord) {
|
_addToRemovals(record: KVChangeRecord) {
|
||||||
// todo(vicb) assert
|
// todo(vicb) assert
|
||||||
// assert(record._next == null);
|
// assert(record._next == null);
|
||||||
|
@ -222,6 +226,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_removeFromSeq(prev: KVChangeRecord, record: KVChangeRecord) {
|
_removeFromSeq(prev: KVChangeRecord, record: KVChangeRecord) {
|
||||||
var next = record._next;
|
var next = record._next;
|
||||||
if (prev === null) {
|
if (prev === null) {
|
||||||
|
@ -236,6 +241,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
//})());
|
//})());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_removeFromRemovals(record: KVChangeRecord) {
|
_removeFromRemovals(record: KVChangeRecord) {
|
||||||
// todo(vicb) assert
|
// todo(vicb) assert
|
||||||
// assert(record._next == null);
|
// assert(record._next == null);
|
||||||
|
@ -257,6 +263,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
record._prevRemoved = record._nextRemoved = null;
|
record._prevRemoved = record._nextRemoved = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addToAdditions(record: KVChangeRecord) {
|
_addToAdditions(record: KVChangeRecord) {
|
||||||
// todo(vicb): assert
|
// todo(vicb): assert
|
||||||
// assert(record._next == null);
|
// assert(record._next == null);
|
||||||
|
@ -272,6 +279,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addToChanges(record: KVChangeRecord) {
|
_addToChanges(record: KVChangeRecord) {
|
||||||
// todo(vicb) assert
|
// todo(vicb) assert
|
||||||
// assert(record._nextAdded == null);
|
// assert(record._nextAdded == null);
|
||||||
|
@ -315,6 +323,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
|
||||||
"removals: " + removals.join(', ') + "\n";
|
"removals: " + removals.join(', ') + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_forEach(obj, fn: Function) {
|
_forEach(obj, fn: Function) {
|
||||||
if (obj instanceof Map) {
|
if (obj instanceof Map) {
|
||||||
(<Map<any, any>>obj).forEach(<any>fn);
|
(<Map<any, any>>obj).forEach(<any>fn);
|
||||||
|
@ -329,11 +338,17 @@ export class KVChangeRecord {
|
||||||
previousValue: any = null;
|
previousValue: any = null;
|
||||||
currentValue: any = null;
|
currentValue: any = null;
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_nextPrevious: KVChangeRecord = null;
|
_nextPrevious: KVChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_next: KVChangeRecord = null;
|
_next: KVChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_nextAdded: KVChangeRecord = null;
|
_nextAdded: KVChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_nextRemoved: KVChangeRecord = null;
|
_nextRemoved: KVChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_prevRemoved: KVChangeRecord = null;
|
_prevRemoved: KVChangeRecord = null;
|
||||||
|
/** @internal */
|
||||||
_nextChanged: KVChangeRecord = null;
|
_nextChanged: KVChangeRecord = null;
|
||||||
|
|
||||||
constructor(public key: any) {}
|
constructor(public key: any) {}
|
||||||
|
|
|
@ -49,6 +49,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
return preventDefault;
|
return preventDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_processEventBinding(eb: EventBinding, locals: Locals): any {
|
_processEventBinding(eb: EventBinding, locals: Locals): any {
|
||||||
var values = ListWrapper.createFixedSize(eb.records.length);
|
var values = ListWrapper.createFixedSize(eb.records.length);
|
||||||
values[0] = this.values[0];
|
values[0] = this.values[0];
|
||||||
|
@ -67,6 +68,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
throw new BaseException("Cannot be reached");
|
throw new BaseException("Cannot be reached");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_markPathAsCheckOnce(proto: ProtoRecord): void {
|
_markPathAsCheckOnce(proto: ProtoRecord): void {
|
||||||
if (!proto.bindingRecord.isDefaultChangeDetection()) {
|
if (!proto.bindingRecord.isDefaultChangeDetection()) {
|
||||||
var dir = proto.bindingRecord.directiveRecord;
|
var dir = proto.bindingRecord.directiveRecord;
|
||||||
|
@ -74,6 +76,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_matchingEventBindings(eventName: string, elIndex: number): EventBinding[] {
|
_matchingEventBindings(eventName: string, elIndex: number): EventBinding[] {
|
||||||
return ListWrapper.filter(this._eventBindings,
|
return ListWrapper.filter(this._eventBindings,
|
||||||
eb => eb.eventName == eventName && eb.elIndex === elIndex);
|
eb => eb.eventName == eventName && eb.elIndex === elIndex);
|
||||||
|
@ -103,6 +106,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized);
|
ListWrapper.fill(this.prevContexts, ChangeDetectionUtil.uninitialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_destroyPipes() {
|
_destroyPipes() {
|
||||||
for (var i = 0; i < this.localPipes.length; ++i) {
|
for (var i = 0; i < this.localPipes.length; ++i) {
|
||||||
if (isPresent(this.localPipes[i])) {
|
if (isPresent(this.localPipes[i])) {
|
||||||
|
@ -156,6 +160,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_firstInBinding(r: ProtoRecord): boolean {
|
_firstInBinding(r: ProtoRecord): boolean {
|
||||||
var prev = ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1);
|
var prev = ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1);
|
||||||
return isBlank(prev) || prev.bindingRecord !== r.bindingRecord;
|
return isBlank(prev) || prev.bindingRecord !== r.bindingRecord;
|
||||||
|
@ -188,6 +193,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_updateDirectiveOrElement(change, bindingRecord) {
|
_updateDirectiveOrElement(change, bindingRecord) {
|
||||||
if (isBlank(bindingRecord.directiveRecord)) {
|
if (isBlank(bindingRecord.directiveRecord)) {
|
||||||
super.notifyDispatcher(change.currentValue);
|
super.notifyDispatcher(change.currentValue);
|
||||||
|
@ -201,6 +207,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_addChange(bindingRecord: BindingRecord, change, changes) {
|
_addChange(bindingRecord: BindingRecord, change, changes) {
|
||||||
if (bindingRecord.callOnChanges()) {
|
if (bindingRecord.callOnChanges()) {
|
||||||
return super.addChange(changes, change.previousValue, change.currentValue);
|
return super.addChange(changes, change.previousValue, change.currentValue);
|
||||||
|
@ -209,10 +216,13 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getDirectiveFor(directiveIndex) { return this.directives.getDirectiveFor(directiveIndex); }
|
_getDirectiveFor(directiveIndex) { return this.directives.getDirectiveFor(directiveIndex); }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getDetectorFor(directiveIndex) { return this.directives.getDetectorFor(directiveIndex); }
|
_getDetectorFor(directiveIndex) { return this.directives.getDetectorFor(directiveIndex); }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_check(proto: ProtoRecord, throwOnChange: boolean, values: any[], locals: Locals): SimpleChange {
|
_check(proto: ProtoRecord, throwOnChange: boolean, values: any[], locals: Locals): SimpleChange {
|
||||||
if (proto.isPipeRecord()) {
|
if (proto.isPipeRecord()) {
|
||||||
return this._pipeCheck(proto, throwOnChange, values);
|
return this._pipeCheck(proto, throwOnChange, values);
|
||||||
|
@ -221,6 +231,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_referenceCheck(proto: ProtoRecord, throwOnChange: boolean, values: any[], locals: Locals) {
|
_referenceCheck(proto: ProtoRecord, throwOnChange: boolean, values: any[], locals: Locals) {
|
||||||
if (this._pureFuncAndArgsDidNotChange(proto)) {
|
if (this._pureFuncAndArgsDidNotChange(proto)) {
|
||||||
this._setChanged(proto, false);
|
this._setChanged(proto, false);
|
||||||
|
@ -259,6 +270,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_calculateCurrValue(proto: ProtoRecord, values: any[], locals: Locals) {
|
_calculateCurrValue(proto: ProtoRecord, values: any[], locals: Locals) {
|
||||||
switch (proto.mode) {
|
switch (proto.mode) {
|
||||||
case RecordType.Self:
|
case RecordType.Self:
|
||||||
|
@ -326,6 +338,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_pipeCheck(proto: ProtoRecord, throwOnChange: boolean, values: any[]) {
|
_pipeCheck(proto: ProtoRecord, throwOnChange: boolean, values: any[]) {
|
||||||
var context = this._readContext(proto, values);
|
var context = this._readContext(proto, values);
|
||||||
var selectedPipe = this._pipeFor(proto, context);
|
var selectedPipe = this._pipeFor(proto, context);
|
||||||
|
@ -364,6 +377,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_pipeFor(proto: ProtoRecord, context) {
|
_pipeFor(proto: ProtoRecord, context) {
|
||||||
var storedPipe = this._readPipe(proto);
|
var storedPipe = this._readPipe(proto);
|
||||||
if (isPresent(storedPipe)) return storedPipe;
|
if (isPresent(storedPipe)) return storedPipe;
|
||||||
|
@ -373,6 +387,7 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
return pipe;
|
return pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_readContext(proto: ProtoRecord, values: any[]) {
|
_readContext(proto: ProtoRecord, values: any[]) {
|
||||||
if (proto.contextIndex == -1) {
|
if (proto.contextIndex == -1) {
|
||||||
return this._getDirectiveFor(proto.directiveIndex);
|
return this._getDirectiveFor(proto.directiveIndex);
|
||||||
|
@ -383,22 +398,29 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
return values[proto.contextIndex];
|
return values[proto.contextIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_readSelf(proto: ProtoRecord, values: any[]) { return values[proto.selfIndex]; }
|
_readSelf(proto: ProtoRecord, values: any[]) { return values[proto.selfIndex]; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_writeSelf(proto: ProtoRecord, value, values: any[]) { values[proto.selfIndex] = value; }
|
_writeSelf(proto: ProtoRecord, value, values: any[]) { values[proto.selfIndex] = value; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_readPipe(proto: ProtoRecord) { return this.localPipes[proto.selfIndex]; }
|
_readPipe(proto: ProtoRecord) { return this.localPipes[proto.selfIndex]; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_writePipe(proto: ProtoRecord, value) { this.localPipes[proto.selfIndex] = value; }
|
_writePipe(proto: ProtoRecord, value) { this.localPipes[proto.selfIndex] = value; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_setChanged(proto: ProtoRecord, value: boolean) {
|
_setChanged(proto: ProtoRecord, value: boolean) {
|
||||||
if (proto.argumentToPureFunction) this.changes[proto.selfIndex] = value;
|
if (proto.argumentToPureFunction) this.changes[proto.selfIndex] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_pureFuncAndArgsDidNotChange(proto: ProtoRecord): boolean {
|
_pureFuncAndArgsDidNotChange(proto: ProtoRecord): boolean {
|
||||||
return proto.isPureFunction() && !this._argsChanged(proto);
|
return proto.isPureFunction() && !this._argsChanged(proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_argsChanged(proto: ProtoRecord): boolean {
|
_argsChanged(proto: ProtoRecord): boolean {
|
||||||
var args = proto.args;
|
var args = proto.args;
|
||||||
for (var i = 0; i < args.length; ++i) {
|
for (var i = 0; i < args.length; ++i) {
|
||||||
|
@ -409,10 +431,12 @@ export class DynamicChangeDetector extends AbstractChangeDetector<any> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_argsOrContextChanged(proto: ProtoRecord): boolean {
|
_argsOrContextChanged(proto: ProtoRecord): boolean {
|
||||||
return this._argsChanged(proto) || this.changes[proto.contextIndex];
|
return this._argsChanged(proto) || this.changes[proto.contextIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_readArgs(proto: ProtoRecord, values: any[]) {
|
_readArgs(proto: ProtoRecord, values: any[]) {
|
||||||
var res = ListWrapper.createFixedSize(proto.args.length);
|
var res = ListWrapper.createFixedSize(proto.args.length);
|
||||||
var args = proto.args;
|
var args = proto.args;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {ProtoChangeDetector, ChangeDetector, ChangeDetectorDefinition} from './i
|
||||||
import {ChangeDetectorJITGenerator} from './change_detection_jit_generator';
|
import {ChangeDetectorJITGenerator} from './change_detection_jit_generator';
|
||||||
|
|
||||||
export class JitProtoChangeDetector implements ProtoChangeDetector {
|
export class JitProtoChangeDetector implements ProtoChangeDetector {
|
||||||
|
/** @internal */
|
||||||
_factory: Function;
|
_factory: Function;
|
||||||
|
|
||||||
constructor(private definition: ChangeDetectorDefinition) {
|
constructor(private definition: ChangeDetectorDefinition) {
|
||||||
|
@ -15,6 +16,7 @@ export class JitProtoChangeDetector implements ProtoChangeDetector {
|
||||||
|
|
||||||
instantiate(dispatcher: any): ChangeDetector { return this._factory(dispatcher); }
|
instantiate(dispatcher: any): ChangeDetector { return this._factory(dispatcher); }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createFactory(definition: ChangeDetectorDefinition) {
|
_createFactory(definition: ChangeDetectorDefinition) {
|
||||||
return new ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate();
|
return new ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,11 @@ class ParseException extends BaseException {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Parser {
|
export class Parser {
|
||||||
|
/** @internal */
|
||||||
_reflector: Reflector;
|
_reflector: Reflector;
|
||||||
|
|
||||||
constructor(public _lexer: Lexer, providedReflector: Reflector = null) {
|
constructor(/** @internal */
|
||||||
|
public _lexer: Lexer, providedReflector: Reflector = null) {
|
||||||
this._reflector = isPresent(providedReflector) ? providedReflector : reflector;
|
this._reflector = isPresent(providedReflector) ? providedReflector : reflector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,13 @@ import {coalesce} from './coalesce';
|
||||||
import {ProtoRecord, RecordType} from './proto_record';
|
import {ProtoRecord, RecordType} from './proto_record';
|
||||||
|
|
||||||
export class DynamicProtoChangeDetector implements ProtoChangeDetector {
|
export class DynamicProtoChangeDetector implements ProtoChangeDetector {
|
||||||
|
/** @internal */
|
||||||
_propertyBindingRecords: ProtoRecord[];
|
_propertyBindingRecords: ProtoRecord[];
|
||||||
|
/** @internal */
|
||||||
_propertyBindingTargets: BindingTarget[];
|
_propertyBindingTargets: BindingTarget[];
|
||||||
|
/** @internal */
|
||||||
_eventBindingRecords: EventBinding[];
|
_eventBindingRecords: EventBinding[];
|
||||||
|
/** @internal */
|
||||||
_directiveIndices: DirectiveIndex[];
|
_directiveIndices: DirectiveIndex[];
|
||||||
|
|
||||||
constructor(private _definition: ChangeDetectorDefinition) {
|
constructor(private _definition: ChangeDetectorDefinition) {
|
||||||
|
@ -96,6 +100,7 @@ export class ProtoRecordBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_setArgumentToPureFunction(startIndex: number): void {
|
_setArgumentToPureFunction(startIndex: number): void {
|
||||||
for (var i = startIndex; i < this.records.length; ++i) {
|
for (var i = startIndex; i < this.records.length; ++i) {
|
||||||
var rec = this.records[i];
|
var rec = this.records[i];
|
||||||
|
@ -111,6 +116,7 @@ export class ProtoRecordBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_appendRecords(b: BindingRecord, variableNames: string[], bindingIndex: number) {
|
_appendRecords(b: BindingRecord, variableNames: string[], bindingIndex: number) {
|
||||||
if (b.isDirectiveLifecycle()) {
|
if (b.isDirectiveLifecycle()) {
|
||||||
this.records.push(new ProtoRecord(RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [],
|
this.records.push(new ProtoRecord(RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [],
|
||||||
|
|
|
@ -312,6 +312,7 @@ export class SelectorMatcher {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_matchTerminal(map: Map<string, SelectorContext[]>, name, cssSelector: CssSelector,
|
_matchTerminal(map: Map<string, SelectorContext[]>, name, cssSelector: CssSelector,
|
||||||
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
|
@ -335,6 +336,7 @@ export class SelectorMatcher {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_matchPartial(map: Map<string, SelectorMatcher>, name, cssSelector: CssSelector,
|
_matchPartial(map: Map<string, SelectorMatcher>, name, cssSelector: CssSelector,
|
||||||
matchedCallback /*: (c: CssSelector, a: any) => void*/): boolean {
|
matchedCallback /*: (c: CssSelector, a: any) => void*/): boolean {
|
||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
|
|
|
@ -162,6 +162,7 @@ export class ShadowCss {
|
||||||
return this._scopeCssText(cssText, selector, hostSelector);
|
return this._scopeCssText(cssText, selector, hostSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_insertDirectives(cssText: string): string {
|
_insertDirectives(cssText: string): string {
|
||||||
cssText = this._insertPolyfillDirectivesInCssText(cssText);
|
cssText = this._insertPolyfillDirectivesInCssText(cssText);
|
||||||
return this._insertPolyfillRulesInCssText(cssText);
|
return this._insertPolyfillRulesInCssText(cssText);
|
||||||
|
@ -181,6 +182,7 @@ export class ShadowCss {
|
||||||
* scopeName menu-item {
|
* scopeName menu-item {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
/** @internal */
|
||||||
_insertPolyfillDirectivesInCssText(cssText: string): string {
|
_insertPolyfillDirectivesInCssText(cssText: string): string {
|
||||||
// Difference with webcomponents.js: does not handle comments
|
// Difference with webcomponents.js: does not handle comments
|
||||||
return StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe,
|
return StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe,
|
||||||
|
@ -202,6 +204,7 @@ export class ShadowCss {
|
||||||
* scopeName menu-item {...}
|
* scopeName menu-item {...}
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
/** @internal */
|
||||||
_insertPolyfillRulesInCssText(cssText: string): string {
|
_insertPolyfillRulesInCssText(cssText: string): string {
|
||||||
// Difference with webcomponents.js: does not handle comments
|
// Difference with webcomponents.js: does not handle comments
|
||||||
return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) {
|
return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) {
|
||||||
|
@ -220,6 +223,7 @@ export class ShadowCss {
|
||||||
*
|
*
|
||||||
* scopeName .foo { ... }
|
* scopeName .foo { ... }
|
||||||
*/
|
*/
|
||||||
|
/** @internal */
|
||||||
_scopeCssText(cssText: string, scopeSelector: string, hostSelector: string): string {
|
_scopeCssText(cssText: string, scopeSelector: string, hostSelector: string): string {
|
||||||
var unscoped = this._extractUnscopedRulesFromCssText(cssText);
|
var unscoped = this._extractUnscopedRulesFromCssText(cssText);
|
||||||
cssText = this._insertPolyfillHostInCssText(cssText);
|
cssText = this._insertPolyfillHostInCssText(cssText);
|
||||||
|
@ -249,6 +253,7 @@ export class ShadowCss {
|
||||||
* menu-item {...}
|
* menu-item {...}
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
/** @internal */
|
||||||
_extractUnscopedRulesFromCssText(cssText: string): string {
|
_extractUnscopedRulesFromCssText(cssText: string): string {
|
||||||
// Difference with webcomponents.js: does not handle comments
|
// Difference with webcomponents.js: does not handle comments
|
||||||
var r = '', m;
|
var r = '', m;
|
||||||
|
@ -269,6 +274,7 @@ export class ShadowCss {
|
||||||
*
|
*
|
||||||
* scopeName.foo > .bar
|
* scopeName.foo > .bar
|
||||||
*/
|
*/
|
||||||
|
/** @internal */
|
||||||
_convertColonHost(cssText: string): string {
|
_convertColonHost(cssText: string): string {
|
||||||
return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer);
|
return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer);
|
||||||
}
|
}
|
||||||
|
@ -288,11 +294,13 @@ export class ShadowCss {
|
||||||
*
|
*
|
||||||
* scopeName.foo .bar { ... }
|
* scopeName.foo .bar { ... }
|
||||||
*/
|
*/
|
||||||
|
/** @internal */
|
||||||
_convertColonHostContext(cssText: string): string {
|
_convertColonHostContext(cssText: string): string {
|
||||||
return this._convertColonRule(cssText, _cssColonHostContextRe,
|
return this._convertColonRule(cssText, _cssColonHostContextRe,
|
||||||
this._colonHostContextPartReplacer);
|
this._colonHostContextPartReplacer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_convertColonRule(cssText: string, regExp: RegExp, partReplacer: Function): string {
|
_convertColonRule(cssText: string, regExp: RegExp, partReplacer: Function): string {
|
||||||
// p1 = :host, p2 = contents of (), p3 rest of rule
|
// p1 = :host, p2 = contents of (), p3 rest of rule
|
||||||
return StringWrapper.replaceAllMapped(cssText, regExp, function(m) {
|
return StringWrapper.replaceAllMapped(cssText, regExp, function(m) {
|
||||||
|
@ -311,6 +319,7 @@ export class ShadowCss {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_colonHostContextPartReplacer(host: string, part: string, suffix: string): string {
|
_colonHostContextPartReplacer(host: string, part: string, suffix: string): string {
|
||||||
if (StringWrapper.contains(part, _polyfillHost)) {
|
if (StringWrapper.contains(part, _polyfillHost)) {
|
||||||
return this._colonHostPartReplacer(host, part, suffix);
|
return this._colonHostPartReplacer(host, part, suffix);
|
||||||
|
@ -319,6 +328,7 @@ export class ShadowCss {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_colonHostPartReplacer(host: string, part: string, suffix: string): string {
|
_colonHostPartReplacer(host: string, part: string, suffix: string): string {
|
||||||
return host + StringWrapper.replace(part, _polyfillHost, '') + suffix;
|
return host + StringWrapper.replace(part, _polyfillHost, '') + suffix;
|
||||||
}
|
}
|
||||||
|
@ -327,6 +337,7 @@ export class ShadowCss {
|
||||||
* Convert combinators like ::shadow and pseudo-elements like ::content
|
* Convert combinators like ::shadow and pseudo-elements like ::content
|
||||||
* by replacing with space.
|
* by replacing with space.
|
||||||
*/
|
*/
|
||||||
|
/** @internal */
|
||||||
_convertShadowDOMSelectors(cssText: string): string {
|
_convertShadowDOMSelectors(cssText: string): string {
|
||||||
for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) {
|
for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) {
|
||||||
cssText = StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' ');
|
cssText = StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' ');
|
||||||
|
@ -335,6 +346,7 @@ export class ShadowCss {
|
||||||
}
|
}
|
||||||
|
|
||||||
// change a selector like 'div' to 'name div'
|
// change a selector like 'div' to 'name div'
|
||||||
|
/** @internal */
|
||||||
_scopeRules(cssRules, scopeSelector: string, hostSelector: string): string {
|
_scopeRules(cssRules, scopeSelector: string, hostSelector: string): string {
|
||||||
var cssText = '';
|
var cssText = '';
|
||||||
if (isPresent(cssRules)) {
|
if (isPresent(cssRules)) {
|
||||||
|
@ -370,6 +382,7 @@ export class ShadowCss {
|
||||||
return cssText;
|
return cssText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_ieSafeCssTextFromKeyFrameRule(rule): string {
|
_ieSafeCssTextFromKeyFrameRule(rule): string {
|
||||||
var cssText = '@keyframes ' + rule.name + ' {';
|
var cssText = '@keyframes ' + rule.name + ' {';
|
||||||
for (var i = 0; i < rule.cssRules.length; i++) {
|
for (var i = 0; i < rule.cssRules.length; i++) {
|
||||||
|
@ -380,6 +393,7 @@ export class ShadowCss {
|
||||||
return cssText;
|
return cssText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_scopeSelector(selector: string, scopeSelector: string, hostSelector: string,
|
_scopeSelector(selector: string, scopeSelector: string, hostSelector: string,
|
||||||
strict: boolean): string {
|
strict: boolean): string {
|
||||||
var r = [], parts = selector.split(',');
|
var r = [], parts = selector.split(',');
|
||||||
|
@ -396,11 +410,13 @@ export class ShadowCss {
|
||||||
return r.join(', ');
|
return r.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_selectorNeedsScoping(selector: string, scopeSelector: string): boolean {
|
_selectorNeedsScoping(selector: string, scopeSelector: string): boolean {
|
||||||
var re = this._makeScopeMatcher(scopeSelector);
|
var re = this._makeScopeMatcher(scopeSelector);
|
||||||
return !isPresent(RegExpWrapper.firstMatch(re, selector));
|
return !isPresent(RegExpWrapper.firstMatch(re, selector));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_makeScopeMatcher(scopeSelector: string): RegExp {
|
_makeScopeMatcher(scopeSelector: string): RegExp {
|
||||||
var lre = /\[/g;
|
var lre = /\[/g;
|
||||||
var rre = /\]/g;
|
var rre = /\]/g;
|
||||||
|
@ -409,12 +425,14 @@ export class ShadowCss {
|
||||||
return RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
|
return RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_applySelectorScope(selector: string, scopeSelector: string, hostSelector: string): string {
|
_applySelectorScope(selector: string, scopeSelector: string, hostSelector: string): string {
|
||||||
// Difference from webcomponentsjs: scopeSelector could not be an array
|
// Difference from webcomponentsjs: scopeSelector could not be an array
|
||||||
return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
|
return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scope via name and [is=name]
|
// scope via name and [is=name]
|
||||||
|
/** @internal */
|
||||||
_applySimpleSelectorScope(selector: string, scopeSelector: string, hostSelector: string): string {
|
_applySimpleSelectorScope(selector: string, scopeSelector: string, hostSelector: string): string {
|
||||||
if (isPresent(RegExpWrapper.firstMatch(_polyfillHostRe, selector))) {
|
if (isPresent(RegExpWrapper.firstMatch(_polyfillHostRe, selector))) {
|
||||||
var replaceBy = this.strictStyling ? `[${hostSelector}]` : scopeSelector;
|
var replaceBy = this.strictStyling ? `[${hostSelector}]` : scopeSelector;
|
||||||
|
@ -427,6 +445,7 @@ export class ShadowCss {
|
||||||
|
|
||||||
// return a selector with [name] suffix on each simple selector
|
// return a selector with [name] suffix on each simple selector
|
||||||
// e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name]
|
// e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name]
|
||||||
|
/** @internal */
|
||||||
_applyStrictSelectorScope(selector: string, scopeSelector: string): string {
|
_applyStrictSelectorScope(selector: string, scopeSelector: string): string {
|
||||||
var isRe = /\[is=([^\]]*)\]/g;
|
var isRe = /\[is=([^\]]*)\]/g;
|
||||||
scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (m) => m[1]);
|
scopeSelector = StringWrapper.replaceAllMapped(scopeSelector, isRe, (m) => m[1]);
|
||||||
|
@ -452,12 +471,14 @@ export class ShadowCss {
|
||||||
return scoped;
|
return scoped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_insertPolyfillHostInCssText(selector: string): string {
|
_insertPolyfillHostInCssText(selector: string): string {
|
||||||
selector = StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext);
|
selector = StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext);
|
||||||
selector = StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost);
|
selector = StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost);
|
||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_propertiesFromRule(rule): string {
|
_propertiesFromRule(rule): string {
|
||||||
var cssText = rule.style.cssText;
|
var cssText = rule.style.cssText;
|
||||||
// TODO(sorvell): Safari cssom incorrectly removes quotes from the content
|
// TODO(sorvell): Safari cssom incorrectly removes quotes from the content
|
||||||
|
|
|
@ -77,6 +77,7 @@ export abstract class DebugElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DebugElement_ extends DebugElement {
|
export class DebugElement_ extends DebugElement {
|
||||||
|
/** @internal */
|
||||||
_elementInjector: ElementInjector;
|
_elementInjector: ElementInjector;
|
||||||
|
|
||||||
constructor(private _parentView: AppView, private _boundElementIndex: number) {
|
constructor(private _parentView: AppView, private _boundElementIndex: number) {
|
||||||
|
@ -134,6 +135,7 @@ export class DebugElement_ extends DebugElement {
|
||||||
|
|
||||||
getLocal(name: string): any { return this._parentView.locals.get(name); }
|
getLocal(name: string): any { return this._parentView.locals.get(name); }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getChildElements(view: AppView, parentBoundElementIndex: number): DebugElement[] {
|
_getChildElements(view: AppView, parentBoundElementIndex: number): DebugElement[] {
|
||||||
var els = [];
|
var els = [];
|
||||||
var parentElementBinder = null;
|
var parentElementBinder = null;
|
||||||
|
|
|
@ -183,6 +183,7 @@ export class Binding {
|
||||||
*/
|
*/
|
||||||
dependencies: Object[];
|
dependencies: Object[];
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_multi: boolean;
|
_multi: boolean;
|
||||||
|
|
||||||
constructor(token, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
constructor(token, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||||
|
|
|
@ -196,6 +196,7 @@ export class ProtoInjectorDynamicStrategy implements ProtoInjectorStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ProtoInjector {
|
export class ProtoInjector {
|
||||||
|
/** @internal */
|
||||||
_strategy: ProtoInjectorStrategy;
|
_strategy: ProtoInjectorStrategy;
|
||||||
numberOfBindings: number;
|
numberOfBindings: number;
|
||||||
|
|
||||||
|
@ -522,16 +523,24 @@ export class Injector {
|
||||||
return new Injector(proto, null, null);
|
return new Injector(proto, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_strategy: InjectorStrategy;
|
_strategy: InjectorStrategy;
|
||||||
|
/** @internal */
|
||||||
_isHost: boolean = false;
|
_isHost: boolean = false;
|
||||||
|
/** @internal */
|
||||||
_constructionCounter: number = 0;
|
_constructionCounter: number = 0;
|
||||||
|
/** @internal */
|
||||||
|
public _proto: any /* ProtoInjector */;
|
||||||
|
/** @internal */
|
||||||
|
public _parent: Injector;
|
||||||
/**
|
/**
|
||||||
* Private
|
* Private
|
||||||
*/
|
*/
|
||||||
constructor(public _proto: any /* ProtoInjector */, public _parent: Injector = null,
|
constructor(_proto: any /* ProtoInjector */, _parent: Injector = null,
|
||||||
private _depProvider: any /* DependencyProvider */ = null,
|
private _depProvider: any /* DependencyProvider */ = null,
|
||||||
private _debugContext: Function = null) {
|
private _debugContext: Function = null) {
|
||||||
|
this._proto = _proto;
|
||||||
|
this._parent = _parent;
|
||||||
this._strategy = _proto._strategy.createInjectorStrategy(this);
|
this._strategy = _proto._strategy.createInjectorStrategy(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,6 +748,7 @@ export class Injector {
|
||||||
return this._instantiateBinding(binding, Visibility.PublicAndPrivate);
|
return this._instantiateBinding(binding, Visibility.PublicAndPrivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_new(binding: ResolvedBinding, visibility: Visibility): any {
|
_new(binding: ResolvedBinding, visibility: Visibility): any {
|
||||||
if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) {
|
if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) {
|
||||||
throw new CyclicDependencyError(this, binding.key);
|
throw new CyclicDependencyError(this, binding.key);
|
||||||
|
@ -899,6 +909,7 @@ export class Injector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_throwOrNull(key: Key, optional: boolean): any {
|
_throwOrNull(key: Key, optional: boolean): any {
|
||||||
if (optional) {
|
if (optional) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -907,11 +918,13 @@ export class Injector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getByKeySelf(key: Key, optional: boolean, bindingVisibility: Visibility): any {
|
_getByKeySelf(key: Key, optional: boolean, bindingVisibility: Visibility): any {
|
||||||
var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility);
|
var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility);
|
||||||
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, optional);
|
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, optional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getByKeyHost(key: Key, optional: boolean, bindingVisibility: Visibility,
|
_getByKeyHost(key: Key, optional: boolean, bindingVisibility: Visibility,
|
||||||
lowerBoundVisibility: Object): any {
|
lowerBoundVisibility: Object): any {
|
||||||
var inj = this;
|
var inj = this;
|
||||||
|
@ -938,11 +951,13 @@ export class Injector {
|
||||||
return this._throwOrNull(key, optional);
|
return this._throwOrNull(key, optional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getPrivateDependency(key: Key, optional: boolean, inj: Injector): any {
|
_getPrivateDependency(key: Key, optional: boolean, inj: Injector): any {
|
||||||
var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private);
|
var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private);
|
||||||
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, optional);
|
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, optional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getByKeyDefault(key: Key, optional: boolean, bindingVisibility: Visibility,
|
_getByKeyDefault(key: Key, optional: boolean, bindingVisibility: Visibility,
|
||||||
lowerBoundVisibility: Object): any {
|
lowerBoundVisibility: Object): any {
|
||||||
var inj = this;
|
var inj = this;
|
||||||
|
|
|
@ -41,6 +41,7 @@ import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
|
||||||
*/
|
*/
|
||||||
@Directive({selector: '[ng-for][ng-for-of]', inputs: ['ngForOf', 'ngForTemplate']})
|
@Directive({selector: '[ng-for][ng-for-of]', inputs: ['ngForOf', 'ngForTemplate']})
|
||||||
export class NgFor implements DoCheck {
|
export class NgFor implements DoCheck {
|
||||||
|
/** @internal */
|
||||||
_ngForOf: any;
|
_ngForOf: any;
|
||||||
private _differ: IterableDiffer;
|
private _differ: IterableDiffer;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,9 @@ import {isPresent, isBlank, print} from 'angular2/src/core/facade/lang';
|
||||||
*/
|
*/
|
||||||
@Directive({selector: '[ng-style]', inputs: ['rawStyle: ng-style']})
|
@Directive({selector: '[ng-style]', inputs: ['rawStyle: ng-style']})
|
||||||
export class NgStyle implements DoCheck {
|
export class NgStyle implements DoCheck {
|
||||||
|
/** @internal */
|
||||||
_rawStyle;
|
_rawStyle;
|
||||||
|
/** @internal */
|
||||||
_differ: KeyValueDiffer;
|
_differ: KeyValueDiffer;
|
||||||
|
|
||||||
constructor(private _differs: KeyValueDiffers, private _ngEl: ElementRef,
|
constructor(private _differs: KeyValueDiffers, private _ngEl: ElementRef,
|
||||||
|
|
|
@ -62,6 +62,7 @@ export class NgSwitch {
|
||||||
this._switchValue = value;
|
this._switchValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_onWhenValueChanged(oldWhen, newWhen, view: SwitchView): void {
|
_onWhenValueChanged(oldWhen, newWhen, view: SwitchView): void {
|
||||||
this._deregisterView(oldWhen, view);
|
this._deregisterView(oldWhen, view);
|
||||||
this._registerView(newWhen, view);
|
this._registerView(newWhen, view);
|
||||||
|
@ -85,6 +86,7 @@ export class NgSwitch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_emptyAllActiveViews(): void {
|
_emptyAllActiveViews(): void {
|
||||||
var activeContainers = this._activeViews;
|
var activeContainers = this._activeViews;
|
||||||
for (var i = 0; i < activeContainers.length; i++) {
|
for (var i = 0; i < activeContainers.length; i++) {
|
||||||
|
@ -93,6 +95,7 @@ export class NgSwitch {
|
||||||
this._activeViews = [];
|
this._activeViews = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_activateViews(views: SwitchView[]): void {
|
_activateViews(views: SwitchView[]): void {
|
||||||
// TODO(vicb): assert(this._activeViews.length === 0);
|
// TODO(vicb): assert(this._activeViews.length === 0);
|
||||||
if (isPresent(views)) {
|
if (isPresent(views)) {
|
||||||
|
@ -103,6 +106,7 @@ export class NgSwitch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_registerView(value, view: SwitchView): void {
|
_registerView(value, view: SwitchView): void {
|
||||||
var views = this._valueViews.get(value);
|
var views = this._valueViews.get(value);
|
||||||
if (isBlank(views)) {
|
if (isBlank(views)) {
|
||||||
|
@ -112,6 +116,7 @@ export class NgSwitch {
|
||||||
views.push(view);
|
views.push(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_deregisterView(value, view: SwitchView): void {
|
_deregisterView(value, view: SwitchView): void {
|
||||||
// `_WHEN_DEFAULT` is used a marker for non-registered whens
|
// `_WHEN_DEFAULT` is used a marker for non-registered whens
|
||||||
if (value === _WHEN_DEFAULT) return;
|
if (value === _WHEN_DEFAULT) return;
|
||||||
|
@ -142,7 +147,9 @@ export class NgSwitch {
|
||||||
@Directive({selector: '[ng-switch-when]', inputs: ['ngSwitchWhen']})
|
@Directive({selector: '[ng-switch-when]', inputs: ['ngSwitchWhen']})
|
||||||
export class NgSwitchWhen {
|
export class NgSwitchWhen {
|
||||||
// `_WHEN_DEFAULT` is used as a marker for a not yet initialized value
|
// `_WHEN_DEFAULT` is used as a marker for a not yet initialized value
|
||||||
|
/** @internal */
|
||||||
_value: any = _WHEN_DEFAULT;
|
_value: any = _WHEN_DEFAULT;
|
||||||
|
/** @internal */
|
||||||
_view: SwitchView;
|
_view: SwitchView;
|
||||||
|
|
||||||
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef,
|
constructor(viewContainer: ViewContainerRef, templateRef: TemplateRef,
|
||||||
|
|
|
@ -368,6 +368,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
hasClass(element, classname: string): boolean {
|
hasClass(element, classname: string): boolean {
|
||||||
return ListWrapper.contains(this.classList(element), classname);
|
return ListWrapper.contains(this.classList(element), classname);
|
||||||
}
|
}
|
||||||
|
/** @internal */
|
||||||
_readStyleAttribute(element) {
|
_readStyleAttribute(element) {
|
||||||
var styleMap = {};
|
var styleMap = {};
|
||||||
var attributes = element.attribs;
|
var attributes = element.attribs;
|
||||||
|
@ -383,6 +384,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
}
|
}
|
||||||
return styleMap;
|
return styleMap;
|
||||||
}
|
}
|
||||||
|
/** @internal */
|
||||||
_writeStyleAttribute(element, styleMap) {
|
_writeStyleAttribute(element, styleMap) {
|
||||||
var styleAttrValue = "";
|
var styleAttrValue = "";
|
||||||
for (var key in styleMap) {
|
for (var key in styleMap) {
|
||||||
|
@ -486,6 +488,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
el.href = baseUrl + '/../' + href;
|
el.href = baseUrl + '/../' + href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** @internal */
|
||||||
_buildRules(parsedRules, css?) {
|
_buildRules(parsedRules, css?) {
|
||||||
var rules = [];
|
var rules = [];
|
||||||
for (var i = 0; i < parsedRules.length; i++) {
|
for (var i = 0; i < parsedRules.length; i++) {
|
||||||
|
|
|
@ -60,7 +60,9 @@ export namespace NodeJS {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TimerWrapper {
|
export class TimerWrapper {
|
||||||
static setTimeout(fn: (...args: any[]) => void, millis: number): NodeJS.Timer { return global.setTimeout(fn, millis); }
|
static setTimeout(fn: (...args: any[]) => void, millis: number): NodeJS.Timer {
|
||||||
|
return global.setTimeout(fn, millis);
|
||||||
|
}
|
||||||
static clearTimeout(id: NodeJS.Timer): void { global.clearTimeout(id); }
|
static clearTimeout(id: NodeJS.Timer): void { global.clearTimeout(id); }
|
||||||
|
|
||||||
static setInterval(fn: (...args: any[]) => void, millis: number): NodeJS.Timer {
|
static setInterval(fn: (...args: any[]) => void, millis: number): NodeJS.Timer {
|
||||||
|
@ -132,6 +134,7 @@ export class Observable {
|
||||||
* Once a reference implementation of the spec is available, switch to it.
|
* Once a reference implementation of the spec is available, switch to it.
|
||||||
*/
|
*/
|
||||||
export class EventEmitter extends Observable {
|
export class EventEmitter extends Observable {
|
||||||
|
/** @internal */
|
||||||
_subject = new Subject();
|
_subject = new Subject();
|
||||||
|
|
||||||
observer(generator: any): any {
|
observer(generator: any): any {
|
||||||
|
|
|
@ -78,15 +78,18 @@ export class ExceptionHandler {
|
||||||
if (this._rethrowException) throw exception;
|
if (this._rethrowException) throw exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_extractMessage(exception: any): string {
|
_extractMessage(exception: any): string {
|
||||||
return exception instanceof WrappedException ? exception.wrapperMessage : exception.toString();
|
return exception instanceof WrappedException ? exception.wrapperMessage : exception.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_longStackTrace(stackTrace: any): any {
|
_longStackTrace(stackTrace: any): any {
|
||||||
return isListLikeIterable(stackTrace) ? (<any[]>stackTrace).join("\n\n-----async gap-----\n") :
|
return isListLikeIterable(stackTrace) ? (<any[]>stackTrace).join("\n\n-----async gap-----\n") :
|
||||||
stackTrace.toString();
|
stackTrace.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_findContext(exception: any): any {
|
_findContext(exception: any): any {
|
||||||
try {
|
try {
|
||||||
if (!(exception instanceof WrappedException)) return null;
|
if (!(exception instanceof WrappedException)) return null;
|
||||||
|
@ -98,6 +101,7 @@ export class ExceptionHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_findOriginalException(exception: any): any {
|
_findOriginalException(exception: any): any {
|
||||||
if (!(exception instanceof WrappedException)) return null;
|
if (!(exception instanceof WrappedException)) return null;
|
||||||
|
|
||||||
|
@ -109,6 +113,7 @@ export class ExceptionHandler {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_findOriginalStack(exception: any): any {
|
_findOriginalStack(exception: any): any {
|
||||||
if (!(exception instanceof WrappedException)) return null;
|
if (!(exception instanceof WrappedException)) return null;
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ const controlGroupBinding =
|
||||||
})
|
})
|
||||||
export class NgControlGroup extends ControlContainer implements OnInit,
|
export class NgControlGroup extends ControlContainer implements OnInit,
|
||||||
OnDestroy {
|
OnDestroy {
|
||||||
|
/** @internal */
|
||||||
_parent: ControlContainer;
|
_parent: ControlContainer;
|
||||||
constructor(@Host() @SkipSelf() _parent: ControlContainer) {
|
constructor(@Host() @SkipSelf() _parent: ControlContainer) {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -80,11 +80,13 @@ const controlNameBinding =
|
||||||
})
|
})
|
||||||
export class NgControlName extends NgControl implements OnChanges,
|
export class NgControlName extends NgControl implements OnChanges,
|
||||||
OnDestroy {
|
OnDestroy {
|
||||||
|
/** @internal */
|
||||||
_parent: ControlContainer;
|
_parent: ControlContainer;
|
||||||
update = new EventEmitter();
|
update = new EventEmitter();
|
||||||
model: any;
|
model: any;
|
||||||
viewModel: any;
|
viewModel: any;
|
||||||
validators: Function[];
|
validators: Function[];
|
||||||
|
/** @internal */
|
||||||
_added = false;
|
_added = false;
|
||||||
|
|
||||||
constructor(@Host() @SkipSelf() parent: ControlContainer,
|
constructor(@Host() @SkipSelf() parent: ControlContainer,
|
||||||
|
|
|
@ -157,10 +157,12 @@ export class NgForm extends ControlContainer implements Form {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_findContainer(path: string[]): ControlGroup {
|
_findContainer(path: string[]): ControlGroup {
|
||||||
path.pop();
|
path.pop();
|
||||||
return ListWrapper.isEmpty(path) ? this.form : <ControlGroup>this.form.find(path);
|
return ListWrapper.isEmpty(path) ? this.form : <ControlGroup>this.form.find(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_later(fn): void { PromiseWrapper.then(PromiseWrapper.resolve(null), fn, (_) => {}); }
|
_later(fn): void { PromiseWrapper.then(PromiseWrapper.resolve(null), fn, (_) => {}); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ const formControlBinding =
|
||||||
export class NgFormControl extends NgControl implements OnChanges {
|
export class NgFormControl extends NgControl implements OnChanges {
|
||||||
form: Control;
|
form: Control;
|
||||||
update = new EventEmitter();
|
update = new EventEmitter();
|
||||||
|
/** @internal */
|
||||||
_added = false;
|
_added = false;
|
||||||
model: any;
|
model: any;
|
||||||
viewModel: any;
|
viewModel: any;
|
||||||
|
|
|
@ -140,6 +140,7 @@ export class NgFormModel extends ControlContainer implements Form,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_updateDomValue() {
|
_updateDomValue() {
|
||||||
this.directives.forEach(dir => {
|
this.directives.forEach(dir => {
|
||||||
var ctrl: any = this.form.find(dir.path);
|
var ctrl: any = this.form.find(dir.path);
|
||||||
|
|
|
@ -41,7 +41,9 @@ const formControlBinding = CONST_EXPR(new Binding(NgControl, {toAlias: forwardRe
|
||||||
exportAs: 'form'
|
exportAs: 'form'
|
||||||
})
|
})
|
||||||
export class NgModel extends NgControl implements OnChanges {
|
export class NgModel extends NgControl implements OnChanges {
|
||||||
|
/** @internal */
|
||||||
_control = new Control();
|
_control = new Control();
|
||||||
|
/** @internal */
|
||||||
_added = false;
|
_added = false;
|
||||||
update = new EventEmitter();
|
update = new EventEmitter();
|
||||||
model: any;
|
model: any;
|
||||||
|
|
|
@ -96,6 +96,7 @@ export class FormBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_reduceControls(controlsConfig: any): {[key: string]: modelModule.AbstractControl} {
|
_reduceControls(controlsConfig: any): {[key: string]: modelModule.AbstractControl} {
|
||||||
var controls: {[key: string]: modelModule.AbstractControl} = {};
|
var controls: {[key: string]: modelModule.AbstractControl} = {};
|
||||||
StringMapWrapper.forEach(controlsConfig, (controlConfig, controlName) => {
|
StringMapWrapper.forEach(controlsConfig, (controlConfig, controlName) => {
|
||||||
|
@ -104,6 +105,7 @@ export class FormBuilder {
|
||||||
return controls;
|
return controls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createControl(controlConfig: any): modelModule.AbstractControl {
|
_createControl(controlConfig: any): modelModule.AbstractControl {
|
||||||
if (controlConfig instanceof modelModule.Control ||
|
if (controlConfig instanceof modelModule.Control ||
|
||||||
controlConfig instanceof modelModule.ControlGroup ||
|
controlConfig instanceof modelModule.ControlGroup ||
|
||||||
|
|
|
@ -41,13 +41,19 @@ function _find(control: AbstractControl, path: Array<string | number>| string) {
|
||||||
* Omitting from external API doc as this is really an abstract internal concept.
|
* Omitting from external API doc as this is really an abstract internal concept.
|
||||||
*/
|
*/
|
||||||
export class AbstractControl {
|
export class AbstractControl {
|
||||||
|
/** @internal */
|
||||||
_value: any;
|
_value: any;
|
||||||
|
/** @internal */
|
||||||
_status: string;
|
_status: string;
|
||||||
|
/** @internal */
|
||||||
_errors: {[key: string]: any};
|
_errors: {[key: string]: any};
|
||||||
|
/** @internal */
|
||||||
_pristine: boolean = true;
|
_pristine: boolean = true;
|
||||||
|
/** @internal */
|
||||||
_touched: boolean = false;
|
_touched: boolean = false;
|
||||||
|
/** @internal */
|
||||||
_parent: ControlGroup | ControlArray;
|
_parent: ControlGroup | ControlArray;
|
||||||
|
/** @internal */
|
||||||
_valueChanges: EventEmitter;
|
_valueChanges: EventEmitter;
|
||||||
|
|
||||||
constructor(public validator: Function) {}
|
constructor(public validator: Function) {}
|
||||||
|
@ -128,6 +134,7 @@ export class AbstractControl {
|
||||||
return isPresent(this.getError(errorCode, path));
|
return isPresent(this.getError(errorCode, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_updateValue(): void {}
|
_updateValue(): void {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +155,7 @@ export class AbstractControl {
|
||||||
* ### Example ([live demo](http://plnkr.co/edit/23DESOpbNnBpBHZt1BR4?p=preview))
|
* ### Example ([live demo](http://plnkr.co/edit/23DESOpbNnBpBHZt1BR4?p=preview))
|
||||||
*/
|
*/
|
||||||
export class Control extends AbstractControl {
|
export class Control extends AbstractControl {
|
||||||
|
/** @internal */
|
||||||
_onChange: Function;
|
_onChange: Function;
|
||||||
|
|
||||||
constructor(value: any = null, validator: Function = Validators.nullValidator) {
|
constructor(value: any = null, validator: Function = Validators.nullValidator) {
|
||||||
|
@ -234,12 +242,15 @@ export class ControlGroup extends AbstractControl {
|
||||||
return c && this._included(controlName);
|
return c && this._included(controlName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_setParentForControls() {
|
_setParentForControls() {
|
||||||
StringMapWrapper.forEach(this.controls, (control, name) => { control.setParent(this); });
|
StringMapWrapper.forEach(this.controls, (control, name) => { control.setParent(this); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_updateValue() { this._value = this._reduceValue(); }
|
_updateValue() { this._value = this._reduceValue(); }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_reduceValue() {
|
_reduceValue() {
|
||||||
return this._reduceChildren({}, (acc, control, name) => {
|
return this._reduceChildren({}, (acc, control, name) => {
|
||||||
acc[name] = control.value;
|
acc[name] = control.value;
|
||||||
|
@ -247,6 +258,7 @@ export class ControlGroup extends AbstractControl {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_reduceChildren(initValue: any, fn: Function) {
|
_reduceChildren(initValue: any, fn: Function) {
|
||||||
var res = initValue;
|
var res = initValue;
|
||||||
StringMapWrapper.forEach(this.controls, (control, name) => {
|
StringMapWrapper.forEach(this.controls, (control, name) => {
|
||||||
|
@ -257,6 +269,7 @@ export class ControlGroup extends AbstractControl {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_included(controlName: string): boolean {
|
_included(controlName: string): boolean {
|
||||||
var isOptional = StringMapWrapper.contains(this._optionals, controlName);
|
var isOptional = StringMapWrapper.contains(this._optionals, controlName);
|
||||||
return !isOptional || StringMapWrapper.get(this._optionals, controlName);
|
return !isOptional || StringMapWrapper.get(this._optionals, controlName);
|
||||||
|
@ -331,8 +344,10 @@ export class ControlArray extends AbstractControl {
|
||||||
*/
|
*/
|
||||||
get length(): number { return this.controls.length; }
|
get length(): number { return this.controls.length; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_updateValue(): void { this._value = this.controls.map((control) => control.value); }
|
_updateValue(): void { this._value = this.controls.map((control) => control.value); }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_setParentForControls(): void {
|
_setParentForControls(): void {
|
||||||
this.controls.forEach((control) => { control.setParent(this); });
|
this.controls.forEach((control) => { control.setParent(this); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,11 @@ export abstract class LifeCycle {
|
||||||
export class LifeCycle_ extends LifeCycle {
|
export class LifeCycle_ extends LifeCycle {
|
||||||
static _tickScope: WtfScopeFn = wtfCreateScope('LifeCycle#tick()');
|
static _tickScope: WtfScopeFn = wtfCreateScope('LifeCycle#tick()');
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_changeDetectors: ChangeDetector[];
|
_changeDetectors: ChangeDetector[];
|
||||||
|
/** @internal */
|
||||||
_enforceNoNewChanges: boolean;
|
_enforceNoNewChanges: boolean;
|
||||||
|
/** @internal */
|
||||||
_runningTick: boolean = false;
|
_runningTick: boolean = false;
|
||||||
|
|
||||||
constructor(changeDetector: ChangeDetector = null, enforceNoNewChanges: boolean = false) {
|
constructor(changeDetector: ChangeDetector = null, enforceNoNewChanges: boolean = false) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ export class ComponentUrlMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RuntimeComponentUrlMapper extends ComponentUrlMapper {
|
export class RuntimeComponentUrlMapper extends ComponentUrlMapper {
|
||||||
|
/** @internal */
|
||||||
_componentUrls = new Map<Type, string>();
|
_componentUrls = new Map<Type, string>();
|
||||||
|
|
||||||
constructor() { super(); }
|
constructor() { super(); }
|
||||||
|
|
|
@ -78,6 +78,7 @@ export class StaticKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TreeNode<T extends TreeNode<any>> {
|
export class TreeNode<T extends TreeNode<any>> {
|
||||||
|
/** @internal */
|
||||||
_parent: T;
|
_parent: T;
|
||||||
constructor(parent: T) {
|
constructor(parent: T) {
|
||||||
if (isPresent(parent)) {
|
if (isPresent(parent)) {
|
||||||
|
@ -102,6 +103,7 @@ export class DirectiveDependency extends Dependency {
|
||||||
this._verify();
|
this._verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_verify(): void {
|
_verify(): void {
|
||||||
var count = 0;
|
var count = 0;
|
||||||
if (isPresent(this.queryDecorator)) count++;
|
if (isPresent(this.queryDecorator)) count++;
|
||||||
|
@ -288,12 +290,15 @@ export class ProtoElementInjector {
|
||||||
resolvedViewBindings.forEach(b => bd.push(new BindingWithVisibility(b, Visibility.Private)));
|
resolvedViewBindings.forEach(b => bd.push(new BindingWithVisibility(b, Visibility.Private)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
|
public _firstBindingIsComponent: boolean;
|
||||||
|
|
||||||
|
|
||||||
constructor(public parent: ProtoElementInjector, public index: number,
|
constructor(public parent: ProtoElementInjector, public index: number,
|
||||||
bwv: BindingWithVisibility[], public distanceToParent: number,
|
bwv: BindingWithVisibility[], public distanceToParent: number,
|
||||||
public _firstBindingIsComponent: boolean,
|
_firstBindingIsComponent: boolean,
|
||||||
public directiveVariableBindings: Map<string, number>) {
|
public directiveVariableBindings: Map<string, number>) {
|
||||||
|
this._firstBindingIsComponent = _firstBindingIsComponent;
|
||||||
var length = bwv.length;
|
var length = bwv.length;
|
||||||
this.protoInjector = new ProtoInjector(bwv);
|
this.protoInjector = new ProtoInjector(bwv);
|
||||||
this.eventEmitterAccessors = ListWrapper.createFixedSize(length);
|
this.eventEmitterAccessors = ListWrapper.createFixedSize(length);
|
||||||
|
@ -327,10 +332,12 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
|
||||||
|
|
||||||
private _injector: Injector;
|
private _injector: Injector;
|
||||||
private _strategy: _ElementInjectorStrategy;
|
private _strategy: _ElementInjectorStrategy;
|
||||||
|
/** @internal */
|
||||||
|
public _proto: ProtoElementInjector;
|
||||||
|
|
||||||
constructor(public _proto: ProtoElementInjector, parent: ElementInjector) {
|
constructor(_proto: ProtoElementInjector, parent: ElementInjector) {
|
||||||
super(parent);
|
super(parent);
|
||||||
|
this._proto = _proto;
|
||||||
this._injector =
|
this._injector =
|
||||||
new Injector(this._proto.protoInjector, null, this, () => this._debugContext());
|
new Injector(this._proto.protoInjector, null, this, () => this._debugContext());
|
||||||
|
|
||||||
|
|
|
@ -219,6 +219,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return this._utils.getComponentInstance(hostView, boundElementIndex);
|
return this._utils.getComponentInstance(hostView, boundElementIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#createRootHostView()');
|
_createRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#createRootHostView()');
|
||||||
|
|
||||||
createRootHostView(hostProtoViewRef: ProtoViewRef, overrideSelector: string,
|
createRootHostView(hostProtoViewRef: ProtoViewRef, overrideSelector: string,
|
||||||
|
@ -239,6 +240,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return wtfLeave(s, hostView.ref);
|
return wtfLeave(s, hostView.ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_destroyRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#destroyRootHostView()');
|
_destroyRootHostViewScope: WtfScopeFn = wtfCreateScope('AppViewManager#destroyRootHostView()');
|
||||||
|
|
||||||
destroyRootHostView(hostViewRef: HostViewRef) {
|
destroyRootHostView(hostViewRef: HostViewRef) {
|
||||||
|
@ -254,6 +256,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
wtfLeave(s);
|
wtfLeave(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createEmbeddedViewInContainerScope: WtfScopeFn =
|
_createEmbeddedViewInContainerScope: WtfScopeFn =
|
||||||
wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()');
|
wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()');
|
||||||
|
|
||||||
|
@ -269,6 +272,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
templateRef.elementRef, null));
|
templateRef.elementRef, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createHostViewInContainerScope: WtfScopeFn =
|
_createHostViewInContainerScope: WtfScopeFn =
|
||||||
wtfCreateScope('AppViewManager#createHostViewInContainer()');
|
wtfCreateScope('AppViewManager#createHostViewInContainer()');
|
||||||
|
|
||||||
|
@ -289,6 +293,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* See {@link AppViewManager#destroyViewInContainer}.
|
* See {@link AppViewManager#destroyViewInContainer}.
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
_createViewInContainer(viewContainerLocation: ElementRef, index: number,
|
_createViewInContainer(viewContainerLocation: ElementRef, index: number,
|
||||||
protoView: viewModule.AppProtoView, context: ElementRef,
|
protoView: viewModule.AppProtoView, context: ElementRef,
|
||||||
|
@ -320,6 +325,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return view.ref;
|
return view.ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_attachRenderView(parentView: viewModule.AppView, boundElementIndex: number, index: number,
|
_attachRenderView(parentView: viewModule.AppView, boundElementIndex: number, index: number,
|
||||||
view: viewModule.AppView) {
|
view: viewModule.AppView) {
|
||||||
var elementRef = parentView.elementRefs[boundElementIndex];
|
var elementRef = parentView.elementRefs[boundElementIndex];
|
||||||
|
@ -331,6 +337,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_destroyViewInContainerScope = wtfCreateScope('AppViewMananger#destroyViewInContainer()');
|
_destroyViewInContainerScope = wtfCreateScope('AppViewMananger#destroyViewInContainer()');
|
||||||
|
|
||||||
destroyViewInContainer(viewContainerLocation: ElementRef, index: number) {
|
destroyViewInContainer(viewContainerLocation: ElementRef, index: number) {
|
||||||
|
@ -341,6 +348,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
wtfLeave(s);
|
wtfLeave(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_attachViewInContainerScope = wtfCreateScope('AppViewMananger#attachViewInContainer()');
|
_attachViewInContainerScope = wtfCreateScope('AppViewMananger#attachViewInContainer()');
|
||||||
|
|
||||||
// TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
|
// TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
|
||||||
|
@ -361,6 +369,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return wtfLeave(s, viewRef);
|
return wtfLeave(s, viewRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_detachViewInContainerScope = wtfCreateScope('AppViewMananger#detachViewInContainer()');
|
_detachViewInContainerScope = wtfCreateScope('AppViewMananger#detachViewInContainer()');
|
||||||
|
|
||||||
// TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
|
// TODO(i): refactor detachViewInContainer+attachViewInContainer to moveViewInContainer
|
||||||
|
@ -375,6 +384,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return wtfLeave(s, view.ref);
|
return wtfLeave(s, view.ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createMainView(protoView: viewModule.AppProtoView,
|
_createMainView(protoView: viewModule.AppProtoView,
|
||||||
renderViewWithFragments: RenderViewWithFragments): viewModule.AppView {
|
renderViewWithFragments: RenderViewWithFragments): viewModule.AppView {
|
||||||
var mergedParentView =
|
var mergedParentView =
|
||||||
|
@ -384,6 +394,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return mergedParentView;
|
return mergedParentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createPooledView(protoView: viewModule.AppProtoView): viewModule.AppView {
|
_createPooledView(protoView: viewModule.AppProtoView): viewModule.AppView {
|
||||||
var view = this._viewPool.getView(protoView);
|
var view = this._viewPool.getView(protoView);
|
||||||
if (isBlank(view)) {
|
if (isBlank(view)) {
|
||||||
|
@ -394,6 +405,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_destroyPooledView(view: viewModule.AppView) {
|
_destroyPooledView(view: viewModule.AppView) {
|
||||||
var wasReturned = this._viewPool.returnView(view);
|
var wasReturned = this._viewPool.returnView(view);
|
||||||
if (!wasReturned) {
|
if (!wasReturned) {
|
||||||
|
@ -402,6 +414,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_destroyViewInContainer(parentView: viewModule.AppView, boundElementIndex: number,
|
_destroyViewInContainer(parentView: viewModule.AppView, boundElementIndex: number,
|
||||||
index: number) {
|
index: number) {
|
||||||
var viewContainer = parentView.viewContainers[boundElementIndex];
|
var viewContainer = parentView.viewContainers[boundElementIndex];
|
||||||
|
@ -422,6 +435,7 @@ export class AppViewManager_ extends AppViewManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_viewDehydrateRecurse(view: viewModule.AppView) {
|
_viewDehydrateRecurse(view: viewModule.AppView) {
|
||||||
if (view.hydrated()) {
|
if (view.hydrated()) {
|
||||||
this._utils.dehydrateView(view);
|
this._utils.dehydrateView(view);
|
||||||
|
|
|
@ -172,6 +172,7 @@ export class AppViewManagerUtils {
|
||||||
contextView.locals);
|
contextView.locals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_hydrateView(initView: viewModule.AppView, imperativelyCreatedInjector: Injector,
|
_hydrateView(initView: viewModule.AppView, imperativelyCreatedInjector: Injector,
|
||||||
hostElementInjector: eli.ElementInjector, context: Object, parentLocals: Locals) {
|
hostElementInjector: eli.ElementInjector, context: Object, parentLocals: Locals) {
|
||||||
var viewIdx = initView.viewOffset;
|
var viewIdx = initView.viewOffset;
|
||||||
|
@ -213,6 +214,7 @@ export class AppViewManagerUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_populateViewLocals(view: viewModule.AppView, elementInjector: eli.ElementInjector,
|
_populateViewLocals(view: viewModule.AppView, elementInjector: eli.ElementInjector,
|
||||||
boundElementIdx: number): void {
|
boundElementIdx: number): void {
|
||||||
if (isPresent(elementInjector.getDirectiveVariableBindings())) {
|
if (isPresent(elementInjector.getDirectiveVariableBindings())) {
|
||||||
|
@ -226,6 +228,7 @@ export class AppViewManagerUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_setUpEventEmitters(view: viewModule.AppView, elementInjector: eli.ElementInjector,
|
_setUpEventEmitters(view: viewModule.AppView, elementInjector: eli.ElementInjector,
|
||||||
boundElementIndex: number) {
|
boundElementIndex: number) {
|
||||||
var emitters = elementInjector.getEventEmitterAccessors();
|
var emitters = elementInjector.getEventEmitterAccessors();
|
||||||
|
|
|
@ -9,7 +9,9 @@ export const APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.vi
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AppViewPool {
|
export class AppViewPool {
|
||||||
|
/** @internal */
|
||||||
_poolCapacityPerProtoView: number;
|
_poolCapacityPerProtoView: number;
|
||||||
|
/** @internal */
|
||||||
_pooledViewsPerProtoView = new Map<viewModule.AppProtoView, Array<viewModule.AppView>>();
|
_pooledViewsPerProtoView = new Map<viewModule.AppProtoView, Array<viewModule.AppView>>();
|
||||||
|
|
||||||
constructor(@Inject(APP_VIEW_POOL_CAPACITY) poolCapacityPerProtoView) {
|
constructor(@Inject(APP_VIEW_POOL_CAPACITY) poolCapacityPerProtoView) {
|
||||||
|
|
|
@ -98,8 +98,12 @@ export abstract class ViewRef implements HostViewRef {
|
||||||
|
|
||||||
export class ViewRef_ extends ViewRef {
|
export class ViewRef_ extends ViewRef {
|
||||||
private _changeDetectorRef: ChangeDetectorRef = null;
|
private _changeDetectorRef: ChangeDetectorRef = null;
|
||||||
|
/** @internal */
|
||||||
constructor(public _view: viewModule.AppView) { super(); }
|
public _view: viewModule.AppView;
|
||||||
|
constructor(_view: viewModule.AppView) {
|
||||||
|
super();
|
||||||
|
this._view = _view;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return `RenderViewRef`
|
* Return `RenderViewRef`
|
||||||
|
@ -166,5 +170,10 @@ export class ViewRef_ extends ViewRef {
|
||||||
export abstract class ProtoViewRef {}
|
export abstract class ProtoViewRef {}
|
||||||
|
|
||||||
export class ProtoViewRef_ extends ProtoViewRef {
|
export class ProtoViewRef_ extends ProtoViewRef {
|
||||||
constructor(public _protoView: viewModule.AppProtoView) { super(); }
|
/** @internal */
|
||||||
|
public _protoView: viewModule.AppProtoView;
|
||||||
|
constructor(_protoView: viewModule.AppProtoView) {
|
||||||
|
super();
|
||||||
|
this._protoView = _protoView;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {reflector} from 'angular2/src/core/reflection/reflection';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ViewResolver {
|
export class ViewResolver {
|
||||||
|
/** @internal */
|
||||||
_cache = new Map<Type, ViewMetadata>();
|
_cache = new Map<Type, ViewMetadata>();
|
||||||
|
|
||||||
resolve(component: Type): ViewMetadata {
|
resolve(component: Type): ViewMetadata {
|
||||||
|
@ -24,6 +25,7 @@ export class ViewResolver {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_resolve(component: Type): ViewMetadata {
|
_resolve(component: Type): ViewMetadata {
|
||||||
var compMeta: ComponentMetadata;
|
var compMeta: ComponentMetadata;
|
||||||
var viewMeta: ViewMetadata;
|
var viewMeta: ViewMetadata;
|
||||||
|
@ -87,6 +89,7 @@ export class ViewResolver {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_throwMixingViewAndComponent(propertyName: string, component: Type): void {
|
_throwMixingViewAndComponent(propertyName: string, component: Type): void {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
`Component '${stringify(component)}' cannot have both '${propertyName}' and '@View' set at the same time"`);
|
`Component '${stringify(component)}' cannot have both '${propertyName}' and '@View' set at the same time"`);
|
||||||
|
|
|
@ -957,6 +957,7 @@ export class ComponentMetadata extends DirectiveMetadata {
|
||||||
@CONST()
|
@CONST()
|
||||||
export class PipeMetadata extends InjectableMetadata {
|
export class PipeMetadata extends InjectableMetadata {
|
||||||
name: string;
|
name: string;
|
||||||
|
/** @internal */
|
||||||
_pure: boolean;
|
_pure: boolean;
|
||||||
|
|
||||||
constructor({name, pure}: {name: string, pure: boolean}) {
|
constructor({name, pure}: {name: string, pure: boolean}) {
|
||||||
|
|
|
@ -63,14 +63,19 @@ var _observableStrategy = new ObservableStrategy();
|
||||||
@Pipe({name: 'async', pure: false})
|
@Pipe({name: 'async', pure: false})
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AsyncPipe implements PipeTransform, PipeOnDestroy {
|
export class AsyncPipe implements PipeTransform, PipeOnDestroy {
|
||||||
|
/** @internal */
|
||||||
_latestValue: Object = null;
|
_latestValue: Object = null;
|
||||||
|
/** @internal */
|
||||||
_latestReturnedValue: Object = null;
|
_latestReturnedValue: Object = null;
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_subscription: Object = null;
|
_subscription: Object = null;
|
||||||
|
/** @internal */
|
||||||
_obj: Observable | Promise<any> = null;
|
_obj: Observable | Promise<any> = null;
|
||||||
private _strategy: any = null;
|
private _strategy: any = null;
|
||||||
|
/** @internal */
|
||||||
constructor(public _ref: ChangeDetectorRef) {}
|
public _ref: ChangeDetectorRef;
|
||||||
|
constructor(_ref: ChangeDetectorRef) { this._ref = _ref; }
|
||||||
|
|
||||||
onDestroy(): void {
|
onDestroy(): void {
|
||||||
if (isPresent(this._subscription)) {
|
if (isPresent(this._subscription)) {
|
||||||
|
@ -99,6 +104,7 @@ export class AsyncPipe implements PipeTransform, PipeOnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_subscribe(obj: Observable | Promise<any>): void {
|
_subscribe(obj: Observable | Promise<any>): void {
|
||||||
this._obj = obj;
|
this._obj = obj;
|
||||||
this._strategy = this._selectStrategy(obj);
|
this._strategy = this._selectStrategy(obj);
|
||||||
|
@ -106,6 +112,7 @@ export class AsyncPipe implements PipeTransform, PipeOnDestroy {
|
||||||
this._strategy.createSubscription(obj, value => this._updateLatestValue(obj, value));
|
this._strategy.createSubscription(obj, value => this._updateLatestValue(obj, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_selectStrategy(obj: Observable | Promise<any>): any {
|
_selectStrategy(obj: Observable | Promise<any>): any {
|
||||||
if (isPromise(obj)) {
|
if (isPromise(obj)) {
|
||||||
return _promiseStrategy;
|
return _promiseStrategy;
|
||||||
|
@ -116,6 +123,7 @@ export class AsyncPipe implements PipeTransform, PipeOnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_dispose(): void {
|
_dispose(): void {
|
||||||
this._strategy.dispose(this._subscription);
|
this._strategy.dispose(this._subscription);
|
||||||
this._latestValue = null;
|
this._latestValue = null;
|
||||||
|
@ -124,6 +132,7 @@ export class AsyncPipe implements PipeTransform, PipeOnDestroy {
|
||||||
this._obj = null;
|
this._obj = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_updateLatestValue(async: any, value: Object) {
|
_updateLatestValue(async: any, value: Object) {
|
||||||
if (async === this._obj) {
|
if (async === this._obj) {
|
||||||
this._latestValue = value;
|
this._latestValue = value;
|
||||||
|
|
|
@ -37,6 +37,7 @@ export class ProtoPipes {
|
||||||
|
|
||||||
|
|
||||||
export class Pipes implements cd.Pipes {
|
export class Pipes implements cd.Pipes {
|
||||||
|
/** @internal */
|
||||||
_config: {[key: string]: cd.SelectedPipe} = {};
|
_config: {[key: string]: cd.SelectedPipe} = {};
|
||||||
|
|
||||||
constructor(public proto: ProtoPipes, public injector: Injector) {}
|
constructor(public proto: ProtoPipes, public injector: Injector) {}
|
||||||
|
|
|
@ -19,9 +19,7 @@ interface Events {
|
||||||
createScope(signature: string, flags: any): Scope;
|
createScope(signature: string, flags: any): Scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Scope {
|
export interface Scope { (...args): any; }
|
||||||
(...args): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
var trace: Trace;
|
var trace: Trace;
|
||||||
var events: Events;
|
var events: Events;
|
||||||
|
|
|
@ -83,6 +83,7 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||||
`Cannot create a factory for '${stringify(t)}' because its constructor has more than 20 arguments`);
|
`Cannot create a factory for '${stringify(t)}' because its constructor has more than 20 arguments`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_zipTypesAndAnnotaions(paramTypes, paramAnnotations): any[][] {
|
_zipTypesAndAnnotaions(paramTypes, paramAnnotations): any[][] {
|
||||||
var result;
|
var result;
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,15 @@ export class ReflectionInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Reflector {
|
export class Reflector {
|
||||||
|
/** @internal */
|
||||||
_injectableInfo = new Map<any, ReflectionInfo>();
|
_injectableInfo = new Map<any, ReflectionInfo>();
|
||||||
|
/** @internal */
|
||||||
_getters = new Map<string, GetterFn>();
|
_getters = new Map<string, GetterFn>();
|
||||||
|
/** @internal */
|
||||||
_setters = new Map<string, SetterFn>();
|
_setters = new Map<string, SetterFn>();
|
||||||
|
/** @internal */
|
||||||
_methods = new Map<string, MethodFn>();
|
_methods = new Map<string, MethodFn>();
|
||||||
|
/** @internal */
|
||||||
_usedKeys: Set<any>;
|
_usedKeys: Set<any>;
|
||||||
reflectionCapabilities: PlatformReflectionCapabilities;
|
reflectionCapabilities: PlatformReflectionCapabilities;
|
||||||
|
|
||||||
|
@ -135,6 +140,7 @@ export class Reflector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_getReflectionInfo(typeOrFunc) {
|
_getReflectionInfo(typeOrFunc) {
|
||||||
if (isPresent(this._usedKeys)) {
|
if (isPresent(this._usedKeys)) {
|
||||||
this._usedKeys.add(typeOrFunc);
|
this._usedKeys.add(typeOrFunc);
|
||||||
|
@ -142,6 +148,7 @@ export class Reflector {
|
||||||
return this._injectableInfo.get(typeOrFunc);
|
return this._injectableInfo.get(typeOrFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_containsReflectionInfo(typeOrFunc) { return this._injectableInfo.has(typeOrFunc); }
|
_containsReflectionInfo(typeOrFunc) { return this._injectableInfo.has(typeOrFunc); }
|
||||||
|
|
||||||
importUri(type: Type): string { return this.reflectionCapabilities.importUri(type); }
|
importUri(type: Type): string { return this.reflectionCapabilities.importUri(type); }
|
||||||
|
|
|
@ -195,6 +195,7 @@ export class DomRenderer_ extends DomRenderer {
|
||||||
return this._componentCmds.get(templateId);
|
return this._componentCmds.get(templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createRootHostViewScope: WtfScopeFn = wtfCreateScope('DomRenderer#createRootHostView()');
|
_createRootHostViewScope: WtfScopeFn = wtfCreateScope('DomRenderer#createRootHostView()');
|
||||||
createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number,
|
createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number,
|
||||||
hostElementSelector: string): RenderViewWithFragments {
|
hostElementSelector: string): RenderViewWithFragments {
|
||||||
|
@ -207,6 +208,7 @@ export class DomRenderer_ extends DomRenderer {
|
||||||
return wtfLeave(s, this._createView(hostProtoViewRef, element));
|
return wtfLeave(s, this._createView(hostProtoViewRef, element));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createViewScope = wtfCreateScope('DomRenderer#createView()');
|
_createViewScope = wtfCreateScope('DomRenderer#createView()');
|
||||||
createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments {
|
createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments {
|
||||||
var s = this._createViewScope();
|
var s = this._createViewScope();
|
||||||
|
@ -256,6 +258,7 @@ export class DomRenderer_ extends DomRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_detachFragmentScope = wtfCreateScope('DomRenderer#detachFragment()');
|
_detachFragmentScope = wtfCreateScope('DomRenderer#detachFragment()');
|
||||||
detachFragment(fragmentRef: RenderFragmentRef) {
|
detachFragment(fragmentRef: RenderFragmentRef) {
|
||||||
var s = this._detachFragmentScope();
|
var s = this._detachFragmentScope();
|
||||||
|
|
|
@ -29,6 +29,7 @@ export class EventManager {
|
||||||
|
|
||||||
getZone(): NgZone { return this._zone; }
|
getZone(): NgZone { return this._zone; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_findPluginFor(eventName: string): EventManagerPlugin {
|
_findPluginFor(eventName: string): EventManagerPlugin {
|
||||||
var plugins = this._plugins;
|
var plugins = this._plugins;
|
||||||
for (var i = 0; i < plugins.length; i++) {
|
for (var i = 0; i < plugins.length; i++) {
|
||||||
|
|
|
@ -90,8 +90,8 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
||||||
return fullKey;
|
return fullKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
static eventCallback(element: HTMLElement, fullKey: any, handler: (e: Event) => any, zone: NgZone):
|
static eventCallback(element: HTMLElement, fullKey: any, handler: (e: Event) => any,
|
||||||
(event: KeyboardEvent) => void {
|
zone: NgZone): (event: KeyboardEvent) => void {
|
||||||
return (event) => {
|
return (event) => {
|
||||||
if (StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
|
if (StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
|
||||||
zone.run(() => handler(event));
|
zone.run(() => handler(event));
|
||||||
|
|
|
@ -5,7 +5,9 @@ import {DOCUMENT} from './dom_tokens';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class SharedStylesHost {
|
export class SharedStylesHost {
|
||||||
|
/** @internal */
|
||||||
_styles: string[] = [];
|
_styles: string[] = [];
|
||||||
|
/** @internal */
|
||||||
_stylesSet = new Set<string>();
|
_stylesSet = new Set<string>();
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
@ -34,6 +36,7 @@ export class DomSharedStylesHost extends SharedStylesHost {
|
||||||
super();
|
super();
|
||||||
this._hostNodes.add(doc.head);
|
this._hostNodes.add(doc.head);
|
||||||
}
|
}
|
||||||
|
/** @internal */
|
||||||
_addStylesToHost(styles: string[], host: Node) {
|
_addStylesToHost(styles: string[], host: Node) {
|
||||||
for (var i = 0; i < styles.length; i++) {
|
for (var i = 0; i < styles.length; i++) {
|
||||||
var style = styles[i];
|
var style = styles[i];
|
||||||
|
|
|
@ -14,12 +14,15 @@ import {PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Testability {
|
export class Testability {
|
||||||
|
/** @internal */
|
||||||
_pendingCount: number = 0;
|
_pendingCount: number = 0;
|
||||||
|
/** @internal */
|
||||||
_callbacks: Function[] = [];
|
_callbacks: Function[] = [];
|
||||||
|
/** @internal */
|
||||||
_isAngularEventPending: boolean = false;
|
_isAngularEventPending: boolean = false;
|
||||||
|
constructor(_ngZone: NgZone) { this._watchAngularEvents(_ngZone); }
|
||||||
|
|
||||||
constructor(public _ngZone: NgZone) { this._watchAngularEvents(_ngZone); }
|
/** @internal */
|
||||||
|
|
||||||
_watchAngularEvents(_ngZone: NgZone): void {
|
_watchAngularEvents(_ngZone: NgZone): void {
|
||||||
_ngZone.overrideOnTurnStart(() => { this._isAngularEventPending = true; });
|
_ngZone.overrideOnTurnStart(() => { this._isAngularEventPending = true; });
|
||||||
_ngZone.overrideOnEventDone(() => {
|
_ngZone.overrideOnEventDone(() => {
|
||||||
|
@ -44,6 +47,7 @@ export class Testability {
|
||||||
|
|
||||||
isStable(): boolean { return this._pendingCount == 0 && !this._isAngularEventPending; }
|
isStable(): boolean { return this._pendingCount == 0 && !this._isAngularEventPending; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_runCallbacksIfReady(): void {
|
_runCallbacksIfReady(): void {
|
||||||
if (!this.isStable()) {
|
if (!this.isStable()) {
|
||||||
return; // Not ready
|
return; // Not ready
|
||||||
|
@ -76,6 +80,7 @@ export class Testability {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TestabilityRegistry {
|
export class TestabilityRegistry {
|
||||||
|
/** @internal */
|
||||||
_applications = new Map<any, Testability>();
|
_applications = new Map<any, Testability>();
|
||||||
|
|
||||||
constructor() { testabilityGetter.addToWindow(this); }
|
constructor() { testabilityGetter.addToWindow(this); }
|
||||||
|
|
|
@ -236,8 +236,8 @@ if (!(Reflect && Reflect.getMetadata)) {
|
||||||
throw 'reflect-metadata shim is required when using class decorators';
|
throw 'reflect-metadata shim is required when using class decorators';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeDecorator(annotationCls, chainFn: (fn: Function) => void = null): (...args: any[]) =>
|
export function makeDecorator(annotationCls, chainFn: (fn: Function) => void = null):
|
||||||
(cls: any) => any {
|
(...args: any[]) => (cls: any) => any {
|
||||||
function DecoratorFactory(objOrType): (cls: any) => any {
|
function DecoratorFactory(objOrType): (cls: any) => any {
|
||||||
var annotationInstance = new (<any>annotationCls)(objOrType);
|
var annotationInstance = new (<any>annotationCls)(objOrType);
|
||||||
if (this instanceof annotationCls) {
|
if (this instanceof annotationCls) {
|
||||||
|
|
|
@ -3,7 +3,10 @@ import {normalizeBlank, isPresent, global} from 'angular2/src/core/facade/lang';
|
||||||
import {wtfLeave, wtfCreateScope, WtfScopeFn} from '../profile/profile';
|
import {wtfLeave, wtfCreateScope, WtfScopeFn} from '../profile/profile';
|
||||||
|
|
||||||
|
|
||||||
export interface NgZoneZone extends Zone { _innerZone: boolean; }
|
export interface NgZoneZone extends Zone {
|
||||||
|
/** @internal */
|
||||||
|
_innerZone: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An injectable service for executing work inside or outside of the Angular zone.
|
* An injectable service for executing work inside or outside of the Angular zone.
|
||||||
|
@ -78,36 +81,50 @@ export interface NgZoneZone extends Zone { _innerZone: boolean; }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export class NgZone {
|
export class NgZone {
|
||||||
|
/** @internal */
|
||||||
_runScope: WtfScopeFn = wtfCreateScope(`NgZone#run()`);
|
_runScope: WtfScopeFn = wtfCreateScope(`NgZone#run()`);
|
||||||
|
/** @internal */
|
||||||
_microtaskScope: WtfScopeFn = wtfCreateScope(`NgZone#microtask()`);
|
_microtaskScope: WtfScopeFn = wtfCreateScope(`NgZone#microtask()`);
|
||||||
|
|
||||||
// Code executed in _mountZone does not trigger the onTurnDone.
|
// Code executed in _mountZone does not trigger the onTurnDone.
|
||||||
|
/** @internal */
|
||||||
_mountZone;
|
_mountZone;
|
||||||
// _innerZone is the child of _mountZone. Any code executed in this zone will trigger the
|
// _innerZone is the child of _mountZone. Any code executed in this zone will trigger the
|
||||||
// onTurnDone hook at the end of the current VM turn.
|
// onTurnDone hook at the end of the current VM turn.
|
||||||
|
/** @internal */
|
||||||
_innerZone;
|
_innerZone;
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_onTurnStart: () => void;
|
_onTurnStart: () => void;
|
||||||
|
/** @internal */
|
||||||
_onTurnDone: () => void;
|
_onTurnDone: () => void;
|
||||||
|
/** @internal */
|
||||||
_onEventDone: () => void;
|
_onEventDone: () => void;
|
||||||
|
/** @internal */
|
||||||
_onErrorHandler: (error: any, stack: any) => void;
|
_onErrorHandler: (error: any, stack: any) => void;
|
||||||
|
|
||||||
// Number of microtasks pending from _innerZone (& descendants)
|
// Number of microtasks pending from _innerZone (& descendants)
|
||||||
|
/** @internal */
|
||||||
_pendingMicrotasks: number = 0;
|
_pendingMicrotasks: number = 0;
|
||||||
// Whether some code has been executed in the _innerZone (& descendants) in the current turn
|
// Whether some code has been executed in the _innerZone (& descendants) in the current turn
|
||||||
|
/** @internal */
|
||||||
_hasExecutedCodeInInnerZone: boolean = false;
|
_hasExecutedCodeInInnerZone: boolean = false;
|
||||||
// run() call depth in _mountZone. 0 at the end of a macrotask
|
// run() call depth in _mountZone. 0 at the end of a macrotask
|
||||||
// zone.run(() => { // top-level call
|
// zone.run(() => { // top-level call
|
||||||
// zone.run(() => {}); // nested call -> in-turn
|
// zone.run(() => {}); // nested call -> in-turn
|
||||||
// });
|
// });
|
||||||
|
/** @internal */
|
||||||
_nestedRun: number = 0;
|
_nestedRun: number = 0;
|
||||||
|
|
||||||
// TODO(vicb): implement this class properly for node.js environment
|
// TODO(vicb): implement this class properly for node.js environment
|
||||||
// This disabled flag is only here to please cjs tests
|
// This disabled flag is only here to please cjs tests
|
||||||
|
/** @internal */
|
||||||
_disabled: boolean;
|
_disabled: boolean;
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_inVmTurnDone: boolean = false;
|
_inVmTurnDone: boolean = false;
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_pendingTimeouts: number[] = [];
|
_pendingTimeouts: number[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,6 +244,7 @@ export class NgZone {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createInnerZone(zone, enableLongStackTrace) {
|
_createInnerZone(zone, enableLongStackTrace) {
|
||||||
var microtaskScope = this._microtaskScope;
|
var microtaskScope = this._microtaskScope;
|
||||||
var ngZone = this;
|
var ngZone = this;
|
||||||
|
@ -315,6 +333,7 @@ export class NgZone {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_onError(zone, e): void {
|
_onError(zone, e): void {
|
||||||
if (isPresent(this._onErrorHandler)) {
|
if (isPresent(this._onErrorHandler)) {
|
||||||
var trace = [normalizeBlank(e.stack)];
|
var trace = [normalizeBlank(e.stack)];
|
||||||
|
|
|
@ -35,6 +35,7 @@ import {
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export class Headers {
|
export class Headers {
|
||||||
|
/** @internal */
|
||||||
_headersMap: Map<string, string[]>;
|
_headersMap: Map<string, string[]>;
|
||||||
constructor(headers?: Headers | {[key: string]: any}) {
|
constructor(headers?: Headers | {[key: string]: any}) {
|
||||||
if (headers instanceof Headers) {
|
if (headers instanceof Headers) {
|
||||||
|
|
|
@ -4,8 +4,11 @@ import {Location} from 'angular2/src/router/location';
|
||||||
|
|
||||||
export class SpyLocation implements Location {
|
export class SpyLocation implements Location {
|
||||||
urlChanges: string[] = [];
|
urlChanges: string[] = [];
|
||||||
|
/** @internal */
|
||||||
_path: string = '';
|
_path: string = '';
|
||||||
|
/** @internal */
|
||||||
_subject: EventEmitter = new EventEmitter();
|
_subject: EventEmitter = new EventEmitter();
|
||||||
|
/** @internal */
|
||||||
_baseHref: string = '';
|
_baseHref: string = '';
|
||||||
|
|
||||||
setInitialPath(url: string) { this._path = url; }
|
setInitialPath(url: string) { this._path = url; }
|
||||||
|
|
|
@ -7,6 +7,7 @@ export class MockLocationStrategy extends LocationStrategy {
|
||||||
internalPath: string = '/';
|
internalPath: string = '/';
|
||||||
internalTitle: string = '';
|
internalTitle: string = '';
|
||||||
urlChanges: string[] = [];
|
urlChanges: string[] = [];
|
||||||
|
/** @internal */
|
||||||
_subject: EventEmitter = new EventEmitter();
|
_subject: EventEmitter = new EventEmitter();
|
||||||
constructor() { super(); }
|
constructor() { super(); }
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||||
|
|
||||||
export class MockNgZone extends NgZone {
|
export class MockNgZone extends NgZone {
|
||||||
|
/** @internal */
|
||||||
_onEventDone: () => void;
|
_onEventDone: () => void;
|
||||||
|
|
||||||
constructor() { super({enableLongStackTrace: false}); }
|
constructor() { super({enableLongStackTrace: false}); }
|
||||||
|
|
|
@ -6,9 +6,13 @@ import {ViewMetadata} from '../core/metadata';
|
||||||
import {ViewResolver} from 'angular2/src/core/linker/view_resolver';
|
import {ViewResolver} from 'angular2/src/core/linker/view_resolver';
|
||||||
|
|
||||||
export class MockViewResolver extends ViewResolver {
|
export class MockViewResolver extends ViewResolver {
|
||||||
|
/** @internal */
|
||||||
_views = new Map<Type, ViewMetadata>();
|
_views = new Map<Type, ViewMetadata>();
|
||||||
|
/** @internal */
|
||||||
_inlineTemplates = new Map<Type, string>();
|
_inlineTemplates = new Map<Type, string>();
|
||||||
|
/** @internal */
|
||||||
_viewCache = new Map<Type, ViewMetadata>();
|
_viewCache = new Map<Type, ViewMetadata>();
|
||||||
|
/** @internal */
|
||||||
_directiveOverrides = new Map<Type, Map<Type, Type>>();
|
_directiveOverrides = new Map<Type, Map<Type, Type>>();
|
||||||
|
|
||||||
constructor() { super(); }
|
constructor() { super(); }
|
||||||
|
@ -103,6 +107,8 @@ export class MockViewResolver extends ViewResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
* Once a component has been compiled, the AppProtoView is stored in the compiler cache.
|
* Once a component has been compiled, the AppProtoView is stored in the compiler cache.
|
||||||
*
|
*
|
||||||
* Then it should not be possible to override the component configuration after the component
|
* Then it should not be possible to override the component configuration after the component
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {isPresent, Type} from 'angular2/src/core/facade/lang';
|
import {isPresent, Type} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
export class AsyncRouteHandler implements RouteHandler {
|
export class AsyncRouteHandler implements RouteHandler {
|
||||||
|
/** @internal */
|
||||||
_resolvedComponent: Promise<any> = null;
|
_resolvedComponent: Promise<any> = null;
|
||||||
componentType: Type;
|
componentType: Type;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,9 @@ export const APP_BASE_HREF: OpaqueToken = CONST_EXPR(new OpaqueToken('appBaseHre
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Location {
|
export class Location {
|
||||||
|
/** @internal */
|
||||||
_subject: EventEmitter = new EventEmitter();
|
_subject: EventEmitter = new EventEmitter();
|
||||||
|
/** @internal */
|
||||||
_baseHref: string;
|
_baseHref: string;
|
||||||
|
|
||||||
constructor(public platformStrategy: LocationStrategy,
|
constructor(public platformStrategy: LocationStrategy,
|
||||||
|
|
|
@ -99,6 +99,7 @@ export class RouteRecognizer {
|
||||||
return solutions;
|
return solutions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_redirect(urlParse: Url): Url {
|
_redirect(urlParse: Url): Url {
|
||||||
for (var i = 0; i < this.redirects.length; i += 1) {
|
for (var i = 0; i < this.redirects.length; i += 1) {
|
||||||
let redirector = this.redirects[i];
|
let redirector = this.redirects[i];
|
||||||
|
|
|
@ -204,6 +204,7 @@ export class Router {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_navigate(instruction: Instruction, _skipLocationChange: boolean): Promise<any> {
|
_navigate(instruction: Instruction, _skipLocationChange: boolean): Promise<any> {
|
||||||
return this._settleInstruction(instruction)
|
return this._settleInstruction(instruction)
|
||||||
.then((_) => this._canReuse(instruction))
|
.then((_) => this._canReuse(instruction))
|
||||||
|
@ -230,6 +231,7 @@ export class Router {
|
||||||
// guaranteed that the `componentType`s for the terminal async routes have been loaded by the time
|
// guaranteed that the `componentType`s for the terminal async routes have been loaded by the time
|
||||||
// we begin navigation. The method below simply traverses instructions and resolves any components
|
// we begin navigation. The method below simply traverses instructions and resolves any components
|
||||||
// for which `componentType` is not present
|
// for which `componentType` is not present
|
||||||
|
/** @internal */
|
||||||
_settleInstruction(instruction: Instruction): Promise<any> {
|
_settleInstruction(instruction: Instruction): Promise<any> {
|
||||||
var unsettledInstructions: Array<Promise<any>> = [];
|
var unsettledInstructions: Array<Promise<any>> = [];
|
||||||
if (isBlank(instruction.component.componentType)) {
|
if (isBlank(instruction.component.componentType)) {
|
||||||
|
@ -257,6 +259,7 @@ export class Router {
|
||||||
/*
|
/*
|
||||||
* Recursively set reuse flags
|
* Recursively set reuse flags
|
||||||
*/
|
*/
|
||||||
|
/** @internal */
|
||||||
_canReuse(instruction: Instruction): Promise<any> {
|
_canReuse(instruction: Instruction): Promise<any> {
|
||||||
if (isBlank(this._outlet)) {
|
if (isBlank(this._outlet)) {
|
||||||
return _resolveToFalse;
|
return _resolveToFalse;
|
||||||
|
@ -335,8 +338,10 @@ export class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_startNavigating(): void { this.navigating = true; }
|
_startNavigating(): void { this.navigating = true; }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_finishNavigating(): void { this.navigating = false; }
|
_finishNavigating(): void { this.navigating = false; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -454,6 +459,7 @@ export class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RootRouter extends Router {
|
export class RootRouter extends Router {
|
||||||
|
/** @internal */
|
||||||
_location: Location;
|
_location: Location;
|
||||||
|
|
||||||
constructor(registry: RouteRegistry, location: Location, primaryComponent: Type) {
|
constructor(registry: RouteRegistry, location: Location, primaryComponent: Type) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {Type} from 'angular2/src/core/facade/lang';
|
import {Type} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
export class SyncRouteHandler implements RouteHandler {
|
export class SyncRouteHandler implements RouteHandler {
|
||||||
|
/** @internal */
|
||||||
_resolvedComponent: Promise<any> = null;
|
_resolvedComponent: Promise<any> = null;
|
||||||
|
|
||||||
constructor(public componentType: Type, public data?: Object) {
|
constructor(public componentType: Type, public data?: Object) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ export class Url {
|
||||||
|
|
||||||
segmentToString(): string { return this.path + this._matrixParamsToString(); }
|
segmentToString(): string { return this.path + this._matrixParamsToString(); }
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_auxToString(): string {
|
_auxToString(): string {
|
||||||
return this.auxiliary.length > 0 ?
|
return this.auxiliary.length > 0 ?
|
||||||
('(' + this.auxiliary.map(sibling => sibling.toString()).join('//') + ')') :
|
('(' + this.auxiliary.map(sibling => sibling.toString()).join('//') + ')') :
|
||||||
|
@ -36,6 +37,7 @@ export class Url {
|
||||||
return ';' + serializeParams(this.params).join(';');
|
return ';' + serializeParams(this.params).join(';');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_childString(): string { return isPresent(this.child) ? ('/' + this.child.toString()) : ''; }
|
_childString(): string { return isPresent(this.child) ? ('/' + this.child.toString()) : ''; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,9 @@ export abstract class RootTestComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RootTestComponent_ extends RootTestComponent {
|
export class RootTestComponent_ extends RootTestComponent {
|
||||||
|
/** @internal */
|
||||||
_componentRef: ComponentRef;
|
_componentRef: ComponentRef;
|
||||||
|
/** @internal */
|
||||||
_componentParentView: AppView;
|
_componentParentView: AppView;
|
||||||
|
|
||||||
constructor(componentRef: ComponentRef) {
|
constructor(componentRef: ComponentRef) {
|
||||||
|
@ -55,15 +57,21 @@ var _nextRootElementId = 0;
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TestComponentBuilder {
|
export class TestComponentBuilder {
|
||||||
|
/** @internal */
|
||||||
_bindingsOverrides = new Map<Type, any[]>();
|
_bindingsOverrides = new Map<Type, any[]>();
|
||||||
|
/** @internal */
|
||||||
_directiveOverrides = new Map<Type, Map<Type, Type>>();
|
_directiveOverrides = new Map<Type, Map<Type, Type>>();
|
||||||
|
/** @internal */
|
||||||
_templateOverrides = new Map<Type, string>();
|
_templateOverrides = new Map<Type, string>();
|
||||||
|
/** @internal */
|
||||||
_viewBindingsOverrides = new Map<Type, any[]>();
|
_viewBindingsOverrides = new Map<Type, any[]>();
|
||||||
|
/** @internal */
|
||||||
_viewOverrides = new Map<Type, ViewMetadata>();
|
_viewOverrides = new Map<Type, ViewMetadata>();
|
||||||
|
|
||||||
|
|
||||||
constructor(private _injector: Injector) {}
|
constructor(private _injector: Injector) {}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_clone(): TestComponentBuilder {
|
_clone(): TestComponentBuilder {
|
||||||
var clone = new TestComponentBuilder(this._injector);
|
var clone = new TestComponentBuilder(this._injector);
|
||||||
clone._viewOverrides = MapWrapper.clone(this._viewOverrides);
|
clone._viewOverrides = MapWrapper.clone(this._viewOverrides);
|
||||||
|
|
|
@ -392,6 +392,7 @@ export class SpyObject {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @internal */
|
||||||
_createGuinnessCompatibleSpy(name): GuinessCompatibleSpy {
|
_createGuinnessCompatibleSpy(name): GuinessCompatibleSpy {
|
||||||
var newSpy: GuinessCompatibleSpy = <any>jasmine.createSpy(name);
|
var newSpy: GuinessCompatibleSpy = <any>jasmine.createSpy(name);
|
||||||
newSpy.andCallFake = <any>newSpy.and.callFake;
|
newSpy.andCallFake = <any>newSpy.and.callFake;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
} from 'angular2/src/core/facade/lang';
|
} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
export class Log {
|
export class Log {
|
||||||
|
/** @internal */
|
||||||
_result: any[];
|
_result: any[];
|
||||||
|
|
||||||
constructor() { this._result = []; }
|
constructor() { this._result = []; }
|
||||||
|
|
|
@ -22,7 +22,12 @@ export abstract class ClientMessageBrokerFactory {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ClientMessageBrokerFactory_ extends ClientMessageBrokerFactory {
|
export class ClientMessageBrokerFactory_ extends ClientMessageBrokerFactory {
|
||||||
constructor(private _messageBus: MessageBus, public _serializer: Serializer) { super(); }
|
/** @internal */
|
||||||
|
public _serializer: Serializer;
|
||||||
|
constructor(private _messageBus: MessageBus, _serializer: Serializer) {
|
||||||
|
super();
|
||||||
|
this._serializer = _serializer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the given channel and attaches a new {@link ClientMessageBroker} to it.
|
* Initializes the given channel and attaches a new {@link ClientMessageBroker} to it.
|
||||||
|
@ -40,10 +45,13 @@ export abstract class ClientMessageBroker {
|
||||||
export class ClientMessageBroker_ extends ClientMessageBroker {
|
export class ClientMessageBroker_ extends ClientMessageBroker {
|
||||||
private _pending: Map<string, PromiseCompleter<any>> = new Map<string, PromiseCompleter<any>>();
|
private _pending: Map<string, PromiseCompleter<any>> = new Map<string, PromiseCompleter<any>>();
|
||||||
private _sink: EventEmitter;
|
private _sink: EventEmitter;
|
||||||
|
/** @internal */
|
||||||
|
public _serializer: Serializer;
|
||||||
|
|
||||||
constructor(messageBus: MessageBus, public _serializer: Serializer, public channel) {
|
constructor(messageBus: MessageBus, _serializer: Serializer, public channel) {
|
||||||
super();
|
super();
|
||||||
this._sink = messageBus.to(channel);
|
this._sink = messageBus.to(channel);
|
||||||
|
this._serializer = _serializer;
|
||||||
var source = messageBus.from(channel);
|
var source = messageBus.from(channel);
|
||||||
ObservableWrapper.subscribe(source,
|
ObservableWrapper.subscribe(source,
|
||||||
(message: {[key: string]: any}) => this._handleMessage(message));
|
(message: {[key: string]: any}) => this._handleMessage(message));
|
||||||
|
|
|
@ -19,7 +19,13 @@ export abstract class ServiceMessageBrokerFactory {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
|
export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
|
||||||
constructor(private _messageBus: MessageBus, public _serializer: Serializer) { super(); }
|
/** @internal */
|
||||||
|
public _serializer: Serializer;
|
||||||
|
|
||||||
|
constructor(private _messageBus: MessageBus, _serializer: Serializer) {
|
||||||
|
super();
|
||||||
|
this._serializer = _serializer;
|
||||||
|
}
|
||||||
|
|
||||||
createMessageBroker(channel: string, runInZone: boolean = true): ServiceMessageBroker {
|
createMessageBroker(channel: string, runInZone: boolean = true): ServiceMessageBroker {
|
||||||
this._messageBus.initChannel(channel, runInZone);
|
this._messageBus.initChannel(channel, runInZone);
|
||||||
|
|
|
@ -231,10 +231,9 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||||
|
|
||||||
htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);
|
htmlTree = mergeTrees([htmlTree, scripts, polymer, react]);
|
||||||
|
|
||||||
var typingsTree = new Funnel('modules', {
|
var typingsTree = new Funnel(
|
||||||
include: ['angular2/typings/**/*.d.ts',
|
'modules',
|
||||||
'angular2/manual_typings/*.d.ts'],
|
{include: ['angular2/typings/**/*.d.ts', 'angular2/manual_typings/*.d.ts'], destDir: '/'});
|
||||||
destDir: '/'});
|
|
||||||
|
|
||||||
// Add a line to the end of our top-level .d.ts file.
|
// Add a line to the end of our top-level .d.ts file.
|
||||||
// This HACK for transitive typings is a workaround for
|
// This HACK for transitive typings is a workaround for
|
||||||
|
|
|
@ -41,7 +41,8 @@ module.exports = function makeNodeTree(destinationPath) {
|
||||||
moduleResolution: 1 /* classic */,
|
moduleResolution: 1 /* classic */,
|
||||||
noEmitOnError: true,
|
noEmitOnError: true,
|
||||||
rootDir: '.',
|
rootDir: '.',
|
||||||
rootFilePaths: ['angular2/manual_typings/globals.d.ts', 'angular2/typings/es6-shim/es6-shim.d.ts'],
|
rootFilePaths:
|
||||||
|
['angular2/manual_typings/globals.d.ts', 'angular2/typings/es6-shim/es6-shim.d.ts'],
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
sourceRoot: '.',
|
sourceRoot: '.',
|
||||||
target: 'ES5'
|
target: 'ES5'
|
||||||
|
|
Loading…
Reference in New Issue