stylus-source 0.22.6 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/vendor/History.md +6 -0
- data/vendor/docs/comments.md +3 -3
- data/vendor/docs/conditionals.md +8 -8
- data/vendor/docs/css-style.md +4 -4
- data/vendor/docs/error-reporting.md +4 -4
- data/vendor/docs/escape.md +4 -2
- data/vendor/docs/executable.md +23 -19
- data/vendor/docs/extend.md +14 -7
- data/vendor/docs/firebug.md +7 -8
- data/vendor/docs/font-face.md +2 -2
- data/vendor/docs/functions.md +28 -23
- data/vendor/docs/functions.url.md +6 -4
- data/vendor/docs/gedit.md +1 -1
- data/vendor/docs/import.md +10 -8
- data/vendor/docs/interpolation.md +4 -4
- data/vendor/docs/introspection.md +6 -7
- data/vendor/docs/iteration.md +7 -5
- data/vendor/docs/js.md +19 -9
- data/vendor/docs/keyframes.md +6 -4
- data/vendor/docs/kwargs.md +4 -5
- data/vendor/docs/literal.md +2 -2
- data/vendor/docs/media.md +2 -2
- data/vendor/docs/middleware.md +8 -9
- data/vendor/docs/mixins.md +19 -11
- data/vendor/docs/operators.md +32 -26
- data/vendor/docs/selectors.md +18 -16
- data/vendor/docs/textmate.md +1 -1
- data/vendor/docs/vargs.md +9 -9
- data/vendor/docs/variables.md +7 -7
- data/vendor/lib/nodes/extend.js +11 -0
- data/vendor/lib/renderer.js +17 -4
- data/vendor/lib/stylus.js +1 -1
- data/vendor/lib/visitor/evaluator.js +1 -1
- data/vendor/package.json +1 -1
- data/vendor/test/cases/dumb.css +10 -0
- data/vendor/test/cases/dumb.styl +11 -0
- data/vendor/testing/test.js +5 -1
- data/vendor/testing/test.styl +2 -0
- metadata +4 -2
data/vendor/docs/operators.md
CHANGED
@@ -56,7 +56,7 @@ The logical `not` operator has low precedence, therefore the following example c
|
|
56
56
|
// => false
|
57
57
|
// pased as: (!a) and (!b)
|
58
58
|
|
59
|
-
|
59
|
+
With:
|
60
60
|
|
61
61
|
not a or b
|
62
62
|
// => false
|
@@ -66,9 +66,9 @@ with:
|
|
66
66
|
|
67
67
|
### Subscript []
|
68
68
|
|
69
|
-
The subscript operator allows us to grab a value
|
69
|
+
The subscript operator allows us to grab a value inside an expression via index. Parenthesized expressions may act as tuples (e.g. `(15px 5px)`, `(1 2 3)`).
|
70
70
|
|
71
|
-
Below is an example
|
71
|
+
Below is an example that uses tuples for error handling (and showcasing the versatility of this construct):
|
72
72
|
|
73
73
|
add(a, b)
|
74
74
|
if a is a 'unit' and b is a 'unit'
|
@@ -89,7 +89,7 @@ with:
|
|
89
89
|
padding add(1,'5')[1]
|
90
90
|
// => padding: "a and b must be units";
|
91
91
|
|
92
|
-
|
92
|
+
Here's a more complex example. Now we're invoking the built-in `error()` function with the return error message, whenever the ident (the first value) equals `error`.
|
93
93
|
|
94
94
|
|
95
95
|
if (val = add(1,'5'))[0] == error
|
@@ -107,7 +107,7 @@ with:
|
|
107
107
|
|
108
108
|
### Additive: + -
|
109
109
|
|
110
|
-
|
110
|
+
Multiplicative and additive binary operators work as expected. Type conversion is applied within unit type classes, or default to the literal value. For example `5s - 2px` results in `3s`.
|
111
111
|
|
112
112
|
15px - 5px
|
113
113
|
// => 10px
|
@@ -141,15 +141,15 @@ multiplicative and additive binary operators work as expected, and type conversi
|
|
141
141
|
4 % 2
|
142
142
|
// => 0
|
143
143
|
|
144
|
-
When using `/` within a property value you must wrap with parens.
|
144
|
+
When using `/` within a property value, you **must** wrap with parens. Otherwise the `/` is taken literally (to support CSS `line-height`):
|
145
145
|
|
146
146
|
font: 14px/1.5;
|
147
147
|
|
148
|
-
|
148
|
+
But the following is evaluated as `14px` ÷ `1.5`:
|
149
149
|
|
150
150
|
font: (14px/1.5);
|
151
151
|
|
152
|
-
|
152
|
+
This is _only_ required for the `/` operator.
|
153
153
|
|
154
154
|
### Exponent: **
|
155
155
|
|
@@ -160,7 +160,7 @@ The Exponent operator:
|
|
160
160
|
|
161
161
|
### Equality & Relational: == != >= <= > <
|
162
162
|
|
163
|
-
Equality operators can be used to equate units, colors, strings, and even identifiers. This is a powerful concept, as even arbitrary identifiers such as as `wahoo` can be utilized as atoms
|
163
|
+
Equality operators can be used to equate units, colors, strings, and even identifiers. This is a powerful concept, as even arbitrary identifiers (such as as `wahoo`) can be utilized as atoms. A function could return `yes` or `no` instead of `true` or `false` (although not advised).
|
164
164
|
|
165
165
|
5 == 5
|
166
166
|
// => true
|
@@ -201,7 +201,7 @@ Equality operators can be used to equate units, colors, strings, and even identi
|
|
201
201
|
(1 2 3) == (1 1 3)
|
202
202
|
// => false
|
203
203
|
|
204
|
-
Only exact values match
|
204
|
+
Only exact values match. For example, `0 == false` and `null == false` are both `false`.
|
205
205
|
|
206
206
|
Aliases:
|
207
207
|
|
@@ -211,7 +211,11 @@ Aliases:
|
|
211
211
|
|
212
212
|
## Truthfulness
|
213
213
|
|
214
|
-
Nearly everything within Stylus resolves to `true`, including units with a suffix
|
214
|
+
Nearly everything within Stylus resolves to `true`, including units with a suffix. Even `0%`, `0px`, etc. will resolve to `true` (because it's common in Stylus for mixins or functions to accept units as valid).
|
215
|
+
|
216
|
+
However, `0` itself is `false` in terms of arithmetic.
|
217
|
+
|
218
|
+
Expressions (or "lists") with a length greater than 1 are considered truthy.
|
215
219
|
|
216
220
|
`true` examples:
|
217
221
|
|
@@ -302,7 +306,7 @@ Example usage in mixin:
|
|
302
306
|
body
|
303
307
|
pad(padding margin, 10px)
|
304
308
|
|
305
|
-
|
309
|
+
Yielding:
|
306
310
|
|
307
311
|
body {
|
308
312
|
padding: 5px;
|
@@ -317,13 +321,15 @@ yielding:
|
|
317
321
|
|
318
322
|
### Conditional Assignment: ?= :=
|
319
323
|
|
320
|
-
The conditional assignment operator `?=` (aliased as `:=`) lets us define variables without clobbering old values (
|
324
|
+
The conditional assignment operator `?=` (aliased as `:=`) lets us define variables without clobbering old values (if present). This operator expands to an `is defined` binary operation within a ternary.
|
325
|
+
|
326
|
+
For example, the following are equivalent:
|
321
327
|
|
322
328
|
color := white
|
323
329
|
color ?= white
|
324
330
|
color = color is defined ? color : white
|
325
331
|
|
326
|
-
|
332
|
+
When using plain `=`, we simply reassign:
|
327
333
|
|
328
334
|
color = white
|
329
335
|
color = black
|
@@ -331,7 +337,7 @@ For example when using `=` we simply re-assign:
|
|
331
337
|
color
|
332
338
|
// => black
|
333
339
|
|
334
|
-
|
340
|
+
But when using `?=`, our second attempt fails (since the variable is already defined):
|
335
341
|
|
336
342
|
color = white
|
337
343
|
color ?= black
|
@@ -352,12 +358,12 @@ Stylus provides a binary operator named `is a` used to type check.
|
|
352
358
|
15 is a 'rgba'
|
353
359
|
// => false
|
354
360
|
|
355
|
-
Alternatively we could use the `type()` BIF:
|
361
|
+
Alternatively, we could use the `type()` BIF:
|
356
362
|
|
357
363
|
type(#fff) == 'rgba'
|
358
364
|
// => true
|
359
365
|
|
360
|
-
|
366
|
+
**Note:** `color` is the only special-case, evaluating to `true` when the
|
361
367
|
left-hand operand is an `RGBA` or `HSLA` node.
|
362
368
|
|
363
369
|
### Variable Definition: is defined
|
@@ -374,7 +380,7 @@ This pseudo binary operator does not accept a right-hand operator, and does _not
|
|
374
380
|
#fff is defined
|
375
381
|
// => 'invalid "is defined" check on non-variable #fff'
|
376
382
|
|
377
|
-
Alternatively one can use the `lookup(name)` built-in function to do this
|
383
|
+
Alternatively, one can use the `lookup(name)` built-in function to do this—or to perform dynamic lookups:
|
378
384
|
|
379
385
|
name = 'blue'
|
380
386
|
lookup('light-' + name)
|
@@ -390,13 +396,13 @@ This operator is essential, as an undefined identifier is still a truthy value.
|
|
390
396
|
if ohnoes
|
391
397
|
padding 5px
|
392
398
|
|
393
|
-
|
399
|
+
_Will_ yield the following CSS when undefined:
|
394
400
|
|
395
401
|
body {
|
396
402
|
padding: 5px;
|
397
403
|
}
|
398
404
|
|
399
|
-
|
405
|
+
However this will be safe:
|
400
406
|
|
401
407
|
body
|
402
408
|
if ohnoes is defined
|
@@ -404,7 +410,7 @@ however this will be safe:
|
|
404
410
|
|
405
411
|
## Ternary
|
406
412
|
|
407
|
-
The ternary operator works as we would expect in most languages
|
413
|
+
The ternary operator works as we would expect in most languages. It's the only operator with three operands (the _condition_ expression, the _truth_ expression, and the _false_ expression).
|
408
414
|
|
409
415
|
num = 15
|
410
416
|
num ? unit(num, 'px') : 20px
|
@@ -425,12 +431,12 @@ The ternary operator works as we would expect in most languages, being the only
|
|
425
431
|
|
426
432
|
## Color Operations
|
427
433
|
|
428
|
-
Operations on colors provide a terse, expressive way to alter components. For example we can operate on each RGB:
|
434
|
+
Operations on colors provide a terse, expressive way to alter components. For example, we can operate on each RGB:
|
429
435
|
|
430
436
|
#0e0 + #0e0
|
431
437
|
// => #0f0
|
432
438
|
|
433
|
-
Another example is adjust the lightness value by adding or subtracting a percentage. To lighten a color
|
439
|
+
Another example is adjust the lightness value by adding or subtracting a percentage. To lighten a color, add; to darken, subtract.
|
434
440
|
|
435
441
|
#888 + 50%
|
436
442
|
// => #c3c3c3
|
@@ -438,14 +444,14 @@ The ternary operator works as we would expect in most languages, being the only
|
|
438
444
|
#888 - 50%
|
439
445
|
// => #444
|
440
446
|
|
441
|
-
Adjust the hue is also possible by adding or subtracting with degrees
|
447
|
+
Adjust the hue is also possible by adding or subtracting with degrees. For example, adding `50deg` to this red value results in a yellow:
|
442
448
|
|
443
449
|
#f00 + 50deg
|
444
450
|
// => #ffd500
|
445
451
|
|
446
|
-
Values clamp appropriately
|
452
|
+
Values clamp appropriately. For example, we can "spin" the hue 180 degrees, and if the current value is `320deg`, it will resolve to `140deg`.
|
447
453
|
|
448
|
-
We may also tweak several values at once
|
454
|
+
We may also tweak several values at once (including the alpha) by using `rgb()`, `rgba()`, `hsl()`, or `hsla()`:
|
449
455
|
|
450
456
|
#f00 - rgba(100,0,0,0.5)
|
451
457
|
// => rgba(155,0,0,0.5)
|
data/vendor/docs/selectors.md
CHANGED
@@ -2,25 +2,25 @@
|
|
2
2
|
|
3
3
|
### Indentation
|
4
4
|
|
5
|
-
Stylus is "pythonic"
|
5
|
+
Stylus is "pythonic" (i.e. indentation-based). Whitespace is significant, so we substitute `{` and `}` with an _indent_, and an _outdent_ as shown below:
|
6
6
|
|
7
7
|
body
|
8
8
|
color white
|
9
9
|
|
10
|
-
|
10
|
+
Which compiles to:
|
11
11
|
|
12
12
|
body {
|
13
13
|
color: #fff;
|
14
14
|
}
|
15
15
|
|
16
|
-
|
16
|
+
If preferred, you can use colons to separate properties and values:
|
17
17
|
|
18
18
|
body
|
19
19
|
color: white
|
20
20
|
|
21
21
|
### Rule Sets
|
22
22
|
|
23
|
-
Stylus, just like
|
23
|
+
Stylus, just like CSS, allows you to define properties for several selectors at once through comma separation.
|
24
24
|
|
25
25
|
textarea, input
|
26
26
|
border 1px solid #eee
|
@@ -31,20 +31,20 @@ The same can be done with a newline:
|
|
31
31
|
input
|
32
32
|
border 1px solid #eee
|
33
33
|
|
34
|
-
|
34
|
+
Both compile to:
|
35
35
|
|
36
36
|
textarea,
|
37
37
|
input {
|
38
38
|
border: 1px solid #eee;
|
39
39
|
}
|
40
40
|
|
41
|
-
The
|
41
|
+
**The only exception to this rule** are selectors that look like properties. For example, the following `foo bar baz` might be a property **or** a selector:
|
42
42
|
|
43
43
|
foo bar baz
|
44
44
|
> input
|
45
45
|
border 1px solid
|
46
46
|
|
47
|
-
|
47
|
+
So for this reason (or simply if preferred), we may trail with a comma:
|
48
48
|
|
49
49
|
foo bar baz,
|
50
50
|
form input,
|
@@ -53,7 +53,7 @@ so for this reason, or if simply preferred we may trail with a comma:
|
|
53
53
|
|
54
54
|
### Parent Reference
|
55
55
|
|
56
|
-
The `&` character references the parent selector(s). In the example below our two selectors `textarea
|
56
|
+
The `&` character references the parent selector(s). In the example below our two selectors (`textarea` and `input`) both alter the `color` on the `:hover` pseudo selector.
|
57
57
|
|
58
58
|
textarea
|
59
59
|
input
|
@@ -61,7 +61,7 @@ The `&` character references the parent selector(s). In the example below our tw
|
|
61
61
|
&:hover
|
62
62
|
color #000
|
63
63
|
|
64
|
-
|
64
|
+
Compiles to:
|
65
65
|
|
66
66
|
textarea,
|
67
67
|
input {
|
@@ -72,7 +72,7 @@ compiles to:
|
|
72
72
|
color: #000;
|
73
73
|
}
|
74
74
|
|
75
|
-
|
75
|
+
Below is an example providing a simple `2px` border for Internet Exploder utilizing the parent reference within a mixin:
|
76
76
|
|
77
77
|
box-shadow()
|
78
78
|
-webkit-box-shadow arguments
|
@@ -87,7 +87,7 @@ below is an example providing a simple `2px` border for internet exploder utiliz
|
|
87
87
|
#login
|
88
88
|
box-shadow 1px 1px 3px #eee
|
89
89
|
|
90
|
-
|
90
|
+
Yielding:
|
91
91
|
|
92
92
|
body #login {
|
93
93
|
-webkit-box-shadow: 1px 1px 3px #eee;
|
@@ -102,7 +102,7 @@ yielding:
|
|
102
102
|
|
103
103
|
### Disambiguation
|
104
104
|
|
105
|
-
Expressions such as `padding - n` could be interpreted both as a subtraction operation, as well as a property with an unary minus. To disambiguate
|
105
|
+
Expressions such as `padding - n` could be interpreted both as a subtraction operation, as well as a property with an unary minus. To disambiguate, wrap the expression with parens:
|
106
106
|
|
107
107
|
pad(n)
|
108
108
|
padding (- n)
|
@@ -110,22 +110,24 @@ Expressions such as `padding - n` could be interpreted both as a subtraction ope
|
|
110
110
|
body
|
111
111
|
pad(5px)
|
112
112
|
|
113
|
-
|
113
|
+
Compiles to:
|
114
114
|
|
115
115
|
body {
|
116
116
|
padding: -5px;
|
117
117
|
}
|
118
118
|
|
119
|
-
|
119
|
+
However, this is only true in functions (since functions act both as mixins, or calls with return values).
|
120
|
+
|
121
|
+
For example, the following is fine (and yields the same results as above):
|
120
122
|
|
121
123
|
body
|
122
124
|
padding -5px
|
123
125
|
|
124
|
-
Have weird property values that Stylus
|
126
|
+
Have weird property values that Stylus can't process? `unquote()` can help you out:
|
125
127
|
|
126
128
|
filter unquote('progid:DXImageTransform.Microsoft.BasicImage(rotation=1)')
|
127
129
|
|
128
|
-
|
130
|
+
Yields:
|
129
131
|
|
130
132
|
filter progid:DXImageTransform.Microsoft.BasicImage(rotation=1)
|
131
133
|
|
data/vendor/docs/textmate.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
|
2
2
|
## TextMate Bundle
|
3
3
|
|
4
|
-
Stylus ships with a TextMate bundle, located within `./editors`. To install simply execute `make install-bundle`, or place `./editors/Stylus.tmbundle` in the appropriate location.
|
4
|
+
Stylus ships with a TextMate bundle, located within `./editors`. To install, simply execute `make install-bundle`, or place `./editors/Stylus.tmbundle` in the appropriate location.
|
data/vendor/docs/vargs.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
## Rest Parameters
|
3
3
|
|
4
|
-
Stylus supports rest parameters in the form of `name...`. These params consume the remaining arguments passed to a mixin or function. This is useful for example
|
4
|
+
Stylus supports rest parameters in the form of `name...`. These params consume the remaining arguments passed to a mixin or function. This is useful when utilizing (for example) the implicit function call support to apply vendor prefixes like `-webkit` or `-moz`.
|
5
5
|
|
6
6
|
|
7
|
-
In the example below we consume all the arguments passed and simply apply them to multiple properties.
|
7
|
+
In the example below, we consume all the arguments passed, and simply apply them to multiple properties.
|
8
8
|
|
9
9
|
box-shadow(args...)
|
10
10
|
-webkit-box-shadow args
|
@@ -14,7 +14,7 @@ In the example below we consume all the arguments passed and simply apply them t
|
|
14
14
|
#login
|
15
15
|
box-shadow 1px 2px 5px #eee
|
16
16
|
|
17
|
-
|
17
|
+
Yielding:
|
18
18
|
|
19
19
|
#login {
|
20
20
|
-webkit-box-shadow: 1px 2px 5px #eee;
|
@@ -22,7 +22,7 @@ yielding:
|
|
22
22
|
box-shadow: 1px 2px 5px #eee;
|
23
23
|
}
|
24
24
|
|
25
|
-
If we wanted to peek at a specific argument,
|
25
|
+
If we wanted to peek at a specific argument—say, `x-offset`—we could simply use `args[0]`. Or, we may wish to redefine the mixin:
|
26
26
|
|
27
27
|
box-shadow(offset-x, args...)
|
28
28
|
got-offset-x offset-x
|
@@ -33,7 +33,7 @@ If we wanted to peek at a specific argument, for example the x-offset we could s
|
|
33
33
|
#login
|
34
34
|
box-shadow 1px 2px 5px #eee
|
35
35
|
|
36
|
-
|
36
|
+
Yielding:
|
37
37
|
|
38
38
|
#login {
|
39
39
|
got-offset-x: 1px;
|
@@ -44,9 +44,9 @@ yielding:
|
|
44
44
|
|
45
45
|
### arguments
|
46
46
|
|
47
|
-
The `arguments` variable is injected into mixin and function bodies, containing the exact expression passed. This is useful for several reasons
|
47
|
+
The `arguments` variable is injected into mixin and function bodies, containing the exact expression passed. This is useful for several reasons (especially vendor support) as you get the _exact_ expression, commas and all.
|
48
48
|
|
49
|
-
For example, if we use a rest param, the comma is
|
49
|
+
For example, if we use a rest param, the comma is consumed (since it is an expression delimiter):
|
50
50
|
|
51
51
|
box-shadow(args...)
|
52
52
|
-webkit-box-shadow args
|
@@ -56,7 +56,7 @@ yielding:
|
|
56
56
|
#login
|
57
57
|
box-shadow #ddd 1px 1px, #eee 2px 2px
|
58
58
|
|
59
|
-
|
59
|
+
Yielding undesired results:
|
60
60
|
|
61
61
|
#login {
|
62
62
|
-webkit-box-shadow: #ddd 1px 1px #eee 2px 2px;
|
@@ -74,7 +74,7 @@ Let's redefine the mixin using `arguments`:
|
|
74
74
|
body
|
75
75
|
box-shadow #ddd 1px 1px, #eee 2px 2px
|
76
76
|
|
77
|
-
|
77
|
+
Now, yielding the desired result:
|
78
78
|
|
79
79
|
body {
|
80
80
|
-webkit-box-shadow: #ddd 1px 1px, #eee 2px 2px;
|
data/vendor/docs/variables.md
CHANGED
@@ -8,7 +8,7 @@ We may assign expressions to variables and use them throughout our stylesheet:
|
|
8
8
|
body
|
9
9
|
font font-size Arial, sans-serif
|
10
10
|
|
11
|
-
|
11
|
+
Compiles to:
|
12
12
|
|
13
13
|
body {
|
14
14
|
font: 14px Arial, sans-serif;
|
@@ -22,13 +22,13 @@ Variables can even consist of an expression list:
|
|
22
22
|
body
|
23
23
|
font font sans-serif
|
24
24
|
|
25
|
-
|
25
|
+
Compiles to:
|
26
26
|
|
27
27
|
body {
|
28
28
|
font: 14px "Lucida Grande", Arial sans-serif;
|
29
29
|
}
|
30
30
|
|
31
|
-
|
31
|
+
Identifiers (variable names, functions, etc.) may also include the `$` character. For example:
|
32
32
|
|
33
33
|
$font-size = 14px
|
34
34
|
body {
|
@@ -38,7 +38,7 @@ identifiers (variable names, functions, etc) may also include the `$` character,
|
|
38
38
|
## Property Lookup
|
39
39
|
|
40
40
|
Another cool feature unique to Stylus is the ability to reference
|
41
|
-
properties defined _without_ assigning their values to variables. A great example of this is the logic required for vertically and horizontally center an element
|
41
|
+
properties defined _without_ assigning their values to variables. A great example of this is the logic required for vertically and horizontally center an element (typically done using percentages and negative margins, as follows):
|
42
42
|
|
43
43
|
#logo
|
44
44
|
position: absolute
|
@@ -49,7 +49,7 @@ identifiers (variable names, functions, etc) may also include the `$` character,
|
|
49
49
|
margin-left: -(w / 2)
|
50
50
|
margin-top: -(h / 2)
|
51
51
|
|
52
|
-
Instead of assigning the variables `w` and `h
|
52
|
+
Instead of assigning the variables `w` and `h`, we can simply prepend the `@`
|
53
53
|
character to the property name to access the value:
|
54
54
|
|
55
55
|
#logo
|
@@ -61,7 +61,7 @@ identifiers (variable names, functions, etc) may also include the `$` character,
|
|
61
61
|
margin-left: -(@width / 2)
|
62
62
|
margin-top: -(@height / 2)
|
63
63
|
|
64
|
-
Another
|
64
|
+
Another use-case is conditionally defining properties within mixins based on the existence of others . In the following example, we apply a default `z-index` of `1`—but _only_ if `z-index` was not previously specified:
|
65
65
|
|
66
66
|
position()
|
67
67
|
position: arguments
|
@@ -74,7 +74,7 @@ identifiers (variable names, functions, etc) may also include the `$` character,
|
|
74
74
|
#logo2
|
75
75
|
position: absolute
|
76
76
|
|
77
|
-
Property lookup will "bubble
|
77
|
+
Property lookup will "bubble up" the stack until found, or return `null` if the property cannot be resolved. In the following example, `@color` will resolve to `blue`:
|
78
78
|
|
79
79
|
body
|
80
80
|
color: red
|
data/vendor/lib/nodes/extend.js
CHANGED
@@ -29,6 +29,17 @@ var Extend = module.exports = function Extend(selector){
|
|
29
29
|
|
30
30
|
Extend.prototype.__proto__ = Node.prototype;
|
31
31
|
|
32
|
+
/**
|
33
|
+
* Return a clone of this node.
|
34
|
+
*
|
35
|
+
* @return {Node}
|
36
|
+
* @api public
|
37
|
+
*/
|
38
|
+
|
39
|
+
Extend.prototype.clone = function(){
|
40
|
+
return new Extend(this.selector);
|
41
|
+
};
|
42
|
+
|
32
43
|
/**
|
33
44
|
* Return `@extend selector`.
|
34
45
|
*
|
data/vendor/lib/renderer.js
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
*/
|
11
11
|
|
12
12
|
var Parser = require('./parser')
|
13
|
+
, EventEmitter = require('events').EventEmitter
|
13
14
|
, Compiler = require('./visitor/compiler')
|
14
15
|
, Evaluator = require('./visitor/evaluator')
|
15
16
|
, Normalizer = require('./visitor/normalizer')
|
@@ -18,6 +19,12 @@ var Parser = require('./parser')
|
|
18
19
|
, path = require('path')
|
19
20
|
, join = path.join;
|
20
21
|
|
22
|
+
/**
|
23
|
+
* Expose `Renderer`.
|
24
|
+
*/
|
25
|
+
|
26
|
+
module.exports = Renderer;
|
27
|
+
|
21
28
|
/**
|
22
29
|
* Initialize a new `Renderer` with the given `str` and `options`.
|
23
30
|
*
|
@@ -26,7 +33,7 @@ var Parser = require('./parser')
|
|
26
33
|
* @api public
|
27
34
|
*/
|
28
35
|
|
29
|
-
|
36
|
+
function Renderer(str, options) {
|
30
37
|
options = options || {};
|
31
38
|
options.globals = {};
|
32
39
|
options.functions = {};
|
@@ -37,6 +44,12 @@ var Renderer = module.exports = function Renderer(str, options) {
|
|
37
44
|
this.str = str;
|
38
45
|
};
|
39
46
|
|
47
|
+
/**
|
48
|
+
* Inherit from `EventEmitter.prototype`.
|
49
|
+
*/
|
50
|
+
|
51
|
+
Renderer.prototype.__proto__ = EventEmitter.prototype;
|
52
|
+
|
40
53
|
/**
|
41
54
|
* Parse and evaluate AST, then callback `fn(err, css, js)`.
|
42
55
|
*
|
@@ -61,10 +74,10 @@ Renderer.prototype.render = function(fn){
|
|
61
74
|
|
62
75
|
// compile
|
63
76
|
var compiler = new Compiler(ast, this.options)
|
64
|
-
, css = compiler.compile()
|
65
|
-
, js = compiler.js;
|
77
|
+
, css = compiler.compile();
|
66
78
|
|
67
|
-
|
79
|
+
this.emit('end', css);
|
80
|
+
fn(null, css);
|
68
81
|
} catch (err) {
|
69
82
|
var options = {};
|
70
83
|
options.input = err.input || this.str;
|
data/vendor/lib/stylus.js
CHANGED
@@ -772,7 +772,7 @@ Evaluator.prototype.invokeBuiltin = function(fn, args){
|
|
772
772
|
}
|
773
773
|
|
774
774
|
// Invoke the BIF
|
775
|
-
var body = fn.apply(this, args);
|
775
|
+
var body = nodes.cast(fn.apply(this, args));
|
776
776
|
|
777
777
|
// Always wrapping allows js functions
|
778
778
|
// to return several values with a single
|
data/vendor/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{ "name": "stylus"
|
2
2
|
, "description": "Robust, expressive, and feature-rich CSS superset"
|
3
|
-
, "version": "0.
|
3
|
+
, "version": "0.23.0"
|
4
4
|
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
|
5
5
|
, "keywords": ["css", "parser", "style", "stylesheets", "jade", "language"]
|
6
6
|
, "repository": "git://github.com/learnboost/stylus"
|
data/vendor/testing/test.js
CHANGED
@@ -20,7 +20,11 @@ stylus(str)
|
|
20
20
|
.define('string', 'some string')
|
21
21
|
.define('number', 15.5)
|
22
22
|
.define('some-bool', true)
|
23
|
-
.define('list',
|
23
|
+
.define('list', function(){
|
24
|
+
return function(){
|
25
|
+
return ['Helvetica Neue', 'Helvetica', 'sans-serif']
|
26
|
+
}
|
27
|
+
})
|
24
28
|
.render(function(err, css, js){
|
25
29
|
if (err) throw err;
|
26
30
|
process.stdout.write(css);
|
data/vendor/testing/test.styl
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stylus-source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Robust, expressive, and feature-rich CSS superset. This gem packages
|
15
15
|
up stylus for use with the stylus gem.
|
@@ -328,6 +328,8 @@ files:
|
|
328
328
|
- vendor/test/cases/css.selectors.styl
|
329
329
|
- vendor/test/cases/css.whitespace.css
|
330
330
|
- vendor/test/cases/css.whitespace.styl
|
331
|
+
- vendor/test/cases/dumb.css
|
332
|
+
- vendor/test/cases/dumb.styl
|
331
333
|
- vendor/test/cases/eol-escape.css
|
332
334
|
- vendor/test/cases/eol-escape.styl
|
333
335
|
- vendor/test/cases/escape.css
|