feat(core): speed up view creation via code gen for view factories.
BREAKING CHANGE: - Platform pipes can only contain types and arrays of types, but no bindings any more. - When using transformers, platform pipes need to be specified explicitly in the pubspec.yaml via the new config option `platform_pipes`. - `Compiler.compileInHost` now returns a `HostViewFactoryRef` - Component view is not yet created when component constructor is called. -> use `onInit` lifecycle callback to access the view of a component - `ViewRef#setLocal` has been moved to new type `EmbeddedViewRef` - `internalView` is gone, use `EmbeddedViewRef.rootNodes` to access the root nodes of an embedded view - `renderer.setElementProperty`, `..setElementStyle`, `..setElementAttribute` now take a native element instead of an ElementRef - `Renderer` interface now operates on plain native nodes, instead of `RenderElementRef`s or `RenderViewRef`s Closes #5993
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
Injector,
|
||||
Injectable,
|
||||
ViewMetadata,
|
||||
ViewRef,
|
||||
EmbeddedViewRef,
|
||||
ViewResolver,
|
||||
provide
|
||||
} from 'angular2/core';
|
||||
@@ -15,8 +15,8 @@ import {Type, isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {Promise} from 'angular2/src/facade/async';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {ViewRef_} from 'angular2/src/core/linker/view_ref';
|
||||
import {AppView} from 'angular2/src/core/linker/view';
|
||||
import {internalView} from 'angular2/src/core/linker/view_ref';
|
||||
|
||||
import {el} from './utils';
|
||||
|
||||
@@ -65,10 +65,10 @@ export class ComponentFixture_ extends ComponentFixture {
|
||||
|
||||
constructor(componentRef: ComponentRef) {
|
||||
super();
|
||||
this.debugElement = new DebugElement_(internalView(<ViewRef>componentRef.hostView), 0);
|
||||
this._componentParentView = (<ViewRef_>componentRef.hostView).internalView;
|
||||
this.debugElement = new DebugElement_(this._componentParentView.appElements[0]);
|
||||
this.componentInstance = this.debugElement.componentInstance;
|
||||
this.nativeElement = this.debugElement.nativeElement;
|
||||
this._componentParentView = internalView(<ViewRef>componentRef.hostView);
|
||||
this._componentRef = componentRef;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
|
||||
import {MockAnimationBuilder} from 'angular2/src/mock/animation_builder_mock';
|
||||
|
||||
import {ProtoViewFactory} from 'angular2/src/core/linker/proto_view_factory';
|
||||
import {ResolvedMetadataCache} from 'angular2/src/core/linker/resolved_metadata_cache';
|
||||
import {Reflector, reflector} from 'angular2/src/core/reflection/reflection';
|
||||
import {
|
||||
IterableDiffers,
|
||||
@@ -46,11 +46,10 @@ import {
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {FunctionWrapper, Type} from 'angular2/src/facade/lang';
|
||||
|
||||
import {AppViewPool, APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/linker/view_pool';
|
||||
import {AppViewManagerUtils} from 'angular2/src/core/linker/view_manager_utils';
|
||||
import {RootRenderer} from 'angular2/src/core/render/api';
|
||||
|
||||
import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens';
|
||||
import {DomRenderer} from 'angular2/src/platform/dom/dom_renderer';
|
||||
import {DomRootRenderer, DomRootRenderer_} from 'angular2/src/platform/dom/dom_renderer';
|
||||
import {DomSharedStylesHost} from 'angular2/src/platform/dom/shared_styles_host';
|
||||
import {SharedStylesHost} from 'angular2/src/platform/dom/shared_styles_host';
|
||||
import {DomEventsPlugin} from 'angular2/src/platform/dom/events/dom_events';
|
||||
@@ -58,7 +57,6 @@ import {DomEventsPlugin} from 'angular2/src/platform/dom/events/dom_events';
|
||||
import {Serializer} from "angular2/src/web_workers/shared/serializer";
|
||||
import {Log} from './utils';
|
||||
import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler';
|
||||
import {DomRenderer_} from "angular2/src/platform/dom/dom_renderer";
|
||||
import {DynamicComponentLoader_} from "angular2/src/core/linker/dynamic_component_loader";
|
||||
import {AppViewManager_} from "angular2/src/core/linker/view_manager";
|
||||
|
||||
@@ -92,20 +90,17 @@ function _getAppBindings() {
|
||||
|
||||
return [
|
||||
APPLICATION_COMMON_PROVIDERS,
|
||||
provide(ChangeDetectorGenConfig, {useValue: new ChangeDetectorGenConfig(true, false, true)}),
|
||||
provide(ChangeDetectorGenConfig, {useValue: new ChangeDetectorGenConfig(true, false, false)}),
|
||||
provide(DOCUMENT, {useValue: appDoc}),
|
||||
provide(DomRenderer, {useClass: DomRenderer_}),
|
||||
provide(Renderer, {useExisting: DomRenderer}),
|
||||
provide(DomRootRenderer, {useClass: DomRootRenderer_}),
|
||||
provide(RootRenderer, {useExisting: DomRootRenderer}),
|
||||
provide(APP_ID, {useValue: 'a'}),
|
||||
DomSharedStylesHost,
|
||||
provide(SharedStylesHost, {useExisting: DomSharedStylesHost}),
|
||||
AppViewPool,
|
||||
provide(AppViewManager, {useClass: AppViewManager_}),
|
||||
AppViewManagerUtils,
|
||||
Serializer,
|
||||
ELEMENT_PROBE_PROVIDERS,
|
||||
provide(APP_VIEW_POOL_CAPACITY, {useValue: 500}),
|
||||
ProtoViewFactory,
|
||||
ResolvedMetadataCache,
|
||||
provide(DirectiveResolver, {useClass: MockDirectiveResolver}),
|
||||
provide(ViewResolver, {useClass: MockViewResolver}),
|
||||
provide(IterableDiffers, {useValue: defaultIterableDiffers}),
|
||||
|
||||
Reference in New Issue
Block a user