SassyCast 1.0.0 → 1.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -4
- data/README.md +123 -119
- data/lib/SassyCast.rb +14 -14
- data/stylesheets/SassyCast.scss +2 -7
- data/stylesheets/private/_all.scss +16 -0
- data/stylesheets/private/bool/_bool.scss +16 -0
- data/stylesheets/{types → private}/color/_color.scss +59 -63
- data/stylesheets/{types → private}/color/helpers/_from-hex.scss +41 -39
- data/stylesheets/{types → private}/color/helpers/_from-hsl.scss +48 -46
- data/stylesheets/{types → private}/color/helpers/_from-rgb.scss +49 -47
- data/stylesheets/private/color/helpers/_get-color-value.scss +20 -0
- data/stylesheets/private/color/helpers/_hex-to-dec.scss +22 -0
- data/stylesheets/{types → private}/list/_list.scss +33 -29
- data/stylesheets/private/map/_map.scss +23 -0
- data/stylesheets/private/null/_null.scss +13 -0
- data/stylesheets/{types → private}/number/_number.scss +63 -66
- data/stylesheets/{types → private}/number/helpers/_find-digits.scss +35 -33
- data/stylesheets/{types → private}/number/helpers/_find-integer.scss +35 -33
- data/stylesheets/private/number/helpers/_length.scss +21 -0
- data/stylesheets/private/number/helpers/_pow.scss +24 -0
- data/stylesheets/private/string/_string.scss +15 -0
- data/stylesheets/public/_all.scss +7 -0
- data/stylesheets/public/bool/_bool.scss +13 -0
- data/stylesheets/public/color/_color.scss +13 -0
- data/stylesheets/public/list/_list.scss +13 -0
- data/stylesheets/public/map/_map.scss +13 -0
- data/stylesheets/public/null/_null.scss +13 -0
- data/stylesheets/public/number/_number.scss +13 -0
- data/stylesheets/public/string/_string.scss +12 -0
- metadata +28 -19
- data/stylesheets/types/bool/_bool.scss +0 -12
- data/stylesheets/types/color/helpers/_get-color-value.scss +0 -18
- data/stylesheets/types/color/helpers/_hex-to-dec.scss +0 -20
- data/stylesheets/types/map/_map.scss +0 -17
- data/stylesheets/types/null/_null.scss +0 -9
- data/stylesheets/types/number/helpers/_length.scss +0 -19
- data/stylesheets/types/number/helpers/_pow.scss +0 -22
- data/stylesheets/types/string/_string.scss +0 -12
@@ -1,9 +0,0 @@
|
|
1
|
-
// Convert to null
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $value: value to cast
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return null
|
6
|
-
|
7
|
-
@function to-null($value) {
|
8
|
-
@return null;
|
9
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
// Tries to find a unit that would match a CSS length
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param [number] $number: number
|
4
|
-
// @param [unit] $unit: potential unit
|
5
|
-
// --------------------------------------------------------------------------------
|
6
|
-
// @return [number] length (0 if cast failed)
|
7
|
-
|
8
|
-
@function _length($number, $unit) {
|
9
|
-
$strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax';
|
10
|
-
$units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax;
|
11
|
-
$index: index($strings, $unit);
|
12
|
-
|
13
|
-
@if not $index {
|
14
|
-
@warn "Unknown unit `#{inspect($unit)}`.";
|
15
|
-
@return 0;
|
16
|
-
}
|
17
|
-
|
18
|
-
@return $number * nth($units, $index);
|
19
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
// Power function
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param [number] $x: number
|
4
|
-
// @param [number] $n: power
|
5
|
-
// --------------------------------------------------------------------------------
|
6
|
-
// @return [number] $x ^ $n
|
7
|
-
|
8
|
-
@function _pow($x, $n) {
|
9
|
-
$ret: 1;
|
10
|
-
|
11
|
-
@if $n >= 0 {
|
12
|
-
@for $i from 1 through $n {
|
13
|
-
$ret: $ret * $x;
|
14
|
-
}
|
15
|
-
} @else {
|
16
|
-
@for $i from $n to 0 {
|
17
|
-
$ret: $ret / $x;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
@return $ret;
|
22
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
// Convert to string
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $value: value to cast
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string]
|
6
|
-
|
7
|
-
@function to-string($value) {
|
8
|
-
@if type-of($value) == color {
|
9
|
-
@warn "Beware! Sass does some color conversion. The resulting string may be different from the color input.";
|
10
|
-
}
|
11
|
-
@return if(type-of($value) != string, inspect($value), $value);
|
12
|
-
}
|