1 | import * as is from '../is';
|
2 | import Style from '../style';
|
3 |
|
4 | let corefn = ({
|
5 |
|
6 | style: function( newStyle ){
|
7 | if( newStyle ){
|
8 | let s = this.setStyle( newStyle );
|
9 |
|
10 | s.update();
|
11 | }
|
12 |
|
13 | return this._private.style;
|
14 | },
|
15 |
|
16 | setStyle: function( style ){
|
17 | let _p = this._private;
|
18 |
|
19 | if( is.stylesheet( style ) ){
|
20 | _p.style = style.generateStyle( this );
|
21 |
|
22 | } else if( is.array( style ) ){
|
23 | _p.style = Style.fromJson( this, style );
|
24 |
|
25 | } else if( is.string( style ) ){
|
26 | _p.style = Style.fromString( this, style );
|
27 |
|
28 | } else {
|
29 | _p.style = Style( this );
|
30 | }
|
31 |
|
32 | return _p.style;
|
33 | },
|
34 |
|
35 |
|
36 | updateStyle: function(){
|
37 | this.mutableElements().updateStyle();
|
38 | }
|
39 | });
|
40 |
|
41 | export default corefn;
|