3
3
4
4
var atoms = require ( './atoms' ) . atoms ;
5
5
6
- var createSnake = function ( renderer , rules ) {
6
+ exports . addon = function ( renderer , rules ) {
7
7
rules = rules || { } ;
8
8
9
9
var defaultRules = renderer . assign ( { } , atoms , {
@@ -14,9 +14,25 @@ var createSnake = function (renderer, rules) {
14
14
bgBlack : function ( ) {
15
15
this . backgroundColor = '#000' ;
16
16
} ,
17
+
18
+ pointer : function ( ) {
19
+ this . cursor = 'pointer' ;
20
+ } ,
21
+
22
+ inlineBlock : function ( ) {
23
+ this . display = 'inline-block' ;
24
+ } ,
25
+
26
+ bold : function ( ) {
27
+ this . fontWeight = 'bold' ;
28
+ } ,
29
+
30
+ em : function ( ) {
31
+ this . fontStyle = 'italic' ;
32
+ }
17
33
} ) ;
18
34
19
- rules = renderer . assign ( { } , defaultRules , rules ) ;
35
+ rules = renderer . assign ( defaultRules , rules ) ;
20
36
21
37
var snake = { } ;
22
38
@@ -31,6 +47,7 @@ var createSnake = function (renderer, rules) {
31
47
32
48
return renderer . cache ( instance . obj ) ;
33
49
} ;
50
+ instance . valueOf = instance . toString ;
34
51
35
52
return instance ;
36
53
} ;
@@ -78,11 +95,5 @@ var createSnake = function (renderer, rules) {
78
95
79
96
for ( var name in rules ) onRule ( name ) ;
80
97
81
- return snake ;
82
- } ;
83
-
84
- exports . addon = function ( renderer ) {
85
- var snake = createSnake ( renderer ) ;
86
-
87
98
renderer . s = snake ;
88
99
} ;
0 commit comments