1
1
import {
2
2
Inject , Injectable , Optional , NgZone ,
3
- Renderer , RootRenderer , RenderComponentType ,
3
+ Renderer , RootRenderer , RenderComponentType , AnimationPlayer
4
4
} from "@angular/core" ;
5
- import { AnimationPlayer } from "@angular/core" ;
6
5
import { AnimationStyles , AnimationKeyframe } from "./private_import_core" ;
7
6
import { APP_ROOT_VIEW , DEVICE } from "./platform-providers" ;
8
7
import { isBlank } from "./lang-facade" ;
9
8
import { View } from "ui/core/view" ;
10
- import * as application from "application" ;
9
+ import { addCss } from "application" ;
11
10
import { topmost } from "ui/frame" ;
12
11
import { Page } from "ui/page" ;
13
- import { ViewUtil , NgView } from "./view-util" ;
12
+ import { ViewUtil } from "./view-util" ;
13
+ import { NgView } from "./element-registry" ;
14
14
import { rendererLog as traceLog } from "./trace" ;
15
15
import { escapeRegexSymbols } from "utils/utils" ;
16
16
import { Device } from "platform" ;
17
17
18
- import * as nsAnimationDriver from "./animation-driver" ;
19
- let nsAnimationDriverModule : typeof nsAnimationDriver ;
20
-
21
- function ensureAnimationDriverModule ( ) {
22
- if ( ! nsAnimationDriverModule ) {
23
- nsAnimationDriverModule = require ( "./animation-driver" ) ;
24
- }
25
- }
18
+ import { NativeScriptAnimationDriver } from "./animation-driver" ;
26
19
27
20
// CONTENT_ATTR not exported from dom_renderer - we need it for styles application.
28
21
export const COMPONENT_VARIABLE = "%COMP%" ;
@@ -32,12 +25,11 @@ export const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
32
25
@Injectable ( )
33
26
export class NativeScriptRootRenderer implements RootRenderer {
34
27
private _viewUtil : ViewUtil ;
35
- private _animationDriver : nsAnimationDriver . NativeScriptAnimationDriver ;
28
+ private _animationDriver : NativeScriptAnimationDriver ;
36
29
37
- protected get animationDriver ( ) : nsAnimationDriver . NativeScriptAnimationDriver {
30
+ protected get animationDriver ( ) : NativeScriptAnimationDriver {
38
31
if ( ! this . _animationDriver ) {
39
- ensureAnimationDriverModule ( ) ;
40
- this . _animationDriver = new nsAnimationDriverModule . NativeScriptAnimationDriver ( ) ;
32
+ this . _animationDriver = new NativeScriptAnimationDriver ( ) ;
41
33
}
42
34
return this . _animationDriver ;
43
35
}
@@ -89,18 +81,18 @@ export class NativeScriptRenderer extends Renderer {
89
81
90
82
constructor (
91
83
private rootRenderer : NativeScriptRootRenderer ,
92
- componentProto : RenderComponentType ,
93
- private animationDriver : nsAnimationDriver . NativeScriptAnimationDriver ,
84
+ private componentProto : RenderComponentType ,
85
+ private animationDriver : NativeScriptAnimationDriver ,
94
86
private zone : NgZone ) {
95
87
96
88
super ( ) ;
97
- let stylesLength = componentProto . styles . length ;
98
- this . componentProtoId = componentProto . id ;
89
+ let stylesLength = this . componentProto . styles . length ;
90
+ this . componentProtoId = this . componentProto . id ;
99
91
for ( let i = 0 ; i < stylesLength ; i ++ ) {
100
92
this . hasComponentStyles = true ;
101
- let cssString = componentProto . styles [ i ] + "" ;
93
+ let cssString = this . componentProto . styles [ i ] + "" ;
102
94
const realCSS = this . replaceNgAttribute ( cssString , this . componentProtoId ) ;
103
- application . addCss ( realCSS ) ;
95
+ addCss ( realCSS ) ;
104
96
}
105
97
traceLog ( "NativeScriptRenderer created" ) ;
106
98
}
0 commit comments