SassFunk 0.0.2 → 0.0.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjdiN2I4OTU1NDk4ODBhYmY5Y2Y5MTg2NjJmZTRjMWM0NDVmZDY1Zg==
4
+ MzM3YzI1NmRkYzE0NjIyMTYzNWJkMmExYTg5NjU1NzcwNzc5ZTI1Yw==
5
5
  data.tar.gz: !binary |-
6
- ZjU2NzM2ZDgyOGZiZGFiOTg5MDQ5ZDYwNjE2MDIzMGQwNjM1NzRhYw==
6
+ MzRjMWYzNzVkMTVkODllZmUxYzhkM2ZiYTVhY2I1ZDNjOWUzNjRmNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZThjMGE0YmFhYjlmNzgxNmM4Yjg4OTY2MWJkOTc5MDQ3OTg2OTA3M2EzYzli
10
- MTVkYTMxYzRmNzlkOTE4NTkxZWI0YTk1YjI2N2RiYzA5NzJkNzMwODk3N2Mx
11
- YTVhMWQ3MzE5YjUzM2NiMTE3MWQ2NDRkYWQwNGI0NmM3ZTZjNjM=
9
+ NWFiNTA5M2YxZjQ0N2E0NTk3ZTc0NzMxNGMyM2JlZmQ5MWUwMDgxY2ZhZjEy
10
+ ZmJiNDk2NzQ2NDA1N2Q2Nzk5MmVmMjlhMTI0MGJiMGNiYWQwOWZiZjY1ZTgz
11
+ ZjhlNmU5ODdhZGJkMDE2N2JkNjM3Nzg5MDM5OWE5NjgxYjFmOTY=
12
12
  data.tar.gz: !binary |-
13
- Y2QzMzkxYWY3OGFiYjYzNmE4OWQxY2UyZjBmN2EwY2JjZmQyMTY0YTM5M2Rl
14
- YWUwYmJiYzgxMWFiMmJhYzkwMjU1ZmViZWI1NWU3YTAzMzczZTllMjBkMDk0
15
- NTFiMjRiODBkOWMzY2VhNzVkMTdlNDFkYTZjZTZjMTk3NjYzNWI=
13
+ Zjk5YzdiZmYzZWNlYmUwYzBiOWM5YWRjNzk3NjA5MmY1NjQ2MjJiYmI5YTA5
14
+ Mjk3M2RlNjZlNTgxOWJlYzIxYzYwMDEzMTc3MGI3MDA0NWQ5ZWRlYjFhNDBh
15
+ OTljN2QwZWE3YWY1ODU1OWE5NDU5MWM3NjFhNGJkNDRjZGZiZDg=
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SassFunk
2
2
 
3
- A collection of utility functions for Sass.
3
+ A collection of Sass utility functions.
4
4
 
5
5
  ## Install SassFunk
6
6
 
@@ -11,9 +11,9 @@ When installing as a Ruby Gem, SassFunk will be installed as a Compass extension
11
11
  $ gem install SassFunk
12
12
 
13
13
 
14
- To install ia bower run:
14
+ To install via bower run:
15
15
 
16
- $ bower install --save-dev SassFunk
16
+ $ bower install --save-dev sassfunk
17
17
 
18
18
  For a manual install, include `dist/SassFunk.scss` in the appropriate directory of your project.
19
19
 
@@ -35,13 +35,13 @@ Returns the list of colors darkened by `$value`.
35
35
  Returns the list of colors desatureated by `$value`.
36
36
 
37
37
  #### sfnk-colors-grayscale( $colors )
38
- Returns the list of equivalent grayscale colors.
38
+ Returns the list of equivalent grayscale colors to `$colors`.
39
39
 
40
40
  #### sfnk-colors-invert( $colors )
41
41
  Returns the list of inverted colors.
42
42
 
43
43
  #### sfnk-colors-lighten( $colors, $value )
44
- Returns th elist of colors lightened by `$value`.
44
+ Returns the list of colors lightened by `$value`.
45
45
 
46
46
  #### sfnk-colors-mix( $colors )
47
47
  Returns a single color that is the mix of `$colors`.
@@ -50,49 +50,148 @@ Returns a single color that is the mix of `$colors`.
50
50
  Returns the list of colors saturated by `$value`.
51
51
 
52
52
  #### sfnk-is-color-list( $list )
53
- Retruns a bool whether `$list` consists of color values only.
53
+ Returns a bool whether `$list` consists of color values only.
54
+
55
+ $list: (#fff, green, rgba(255, 255, 255, .5));
56
+
57
+ sfnk-is-color-list($list)
58
+ >> true
54
59
 
55
60
  #### sfnk-is-nested-list( $list )
56
61
  Returns a bool whether `$list` contains any items that are lists.
57
62
 
63
+ $list: (1, 2, 3, 4);
64
+ $nested-list: (1, 2, (3, 4));
65
+
66
+ sfnk-is-nested-list($list)
67
+ >> false
68
+
69
+ sfnk-is-nested-list($nested-list)
70
+ >> true
71
+
58
72
  #### sfnk-is-numeric-list( $list )
59
- Returns a bool whether `$list`consists of numbers only.
73
+ Returns a bool whether `$list` consists of numbers only.
74
+
75
+ $list1: (1, 12px, 4, 1.5.em)
76
+ $list2: (1, '12px', 4, 1.5em)
77
+
78
+ sfnk-is-numeric-list($list1)
79
+ >> true
80
+
81
+ sfnk-is-numeric-list($list1)
82
+ >> false
60
83
 
61
84
  #### sfnk-is-type-list( $list, $type )
62
- Returns a bool whether all items of $list are of type `$type` .
85
+ Returns a bool whether all items of `$list` are of type `$type`.
86
+
87
+ $list: (test, '17px', green)
88
+
89
+ sfnk-is-type-list($list, string)
90
+ >> true
91
+
92
+ sfnk-is-type-list($list, color)
93
+ >> false
63
94
 
64
95
  #### sfnk-is-valid-border( $border, [$strict:false] )
65
- Returns a bool whether $border is a valid CSS border statement. Pass `strict: true`to check whether $border is a complete shorthand CSS border statement consisting of border-width, border-style, and border-color.
96
+ Returns a bool whether `$border` is a valid CSS border statement. Pass `$strict: true`to check whether `$border` is a complete shorthand CSS border statement consisting of `border-width`, `border-style`, and `border-color`.
97
+
98
+ $border1: 1px;
99
+ $border2: 1px solid #000;
100
+
101
+ sfnk-is-valid-border($border1)
102
+ >> true
103
+
104
+ sfnk-is-valid-border($border2)
105
+ >> true
106
+
107
+ sfnk-is-valid-border($border1, $strict: true)
108
+ >> false
109
+
110
+ sfnk-is-valid-border($border2, $strict: true)
111
+ >> true
66
112
 
67
113
  #### sfnk-list-contains-all( $list1, $list2 )
68
- Returns a bool whether `$list1` contains all items in `$list2`.
114
+ Returns a bool whether `$list1` contains all items of `$list2`.
115
+
116
+ $list1: (1, 2, 3, 4, 5)
117
+ $list2: (1, 2)
118
+ $list3: (5, 6)
119
+
120
+ sfnk-list-contains-all($list1, $list2)
121
+ >> true
122
+
123
+ sfnk-list-contains-all($list1, $list3)
124
+ >> false
69
125
 
70
126
  #### sfnk-list-contains( $list, $value )
71
127
  Returns a bool whether `$list` contains `$value`.
72
128
 
73
129
  #### sfnk-list-mapify( $list )
74
- Creates a map from a nested list where the keys are the first items of the items of `$list`, the value the remaining items of each item of `$list`.
130
+ Creates a map from a nested `$list` where the keys are the first items of the items of `$list`, the value the remaining items of each item of `$list`.
131
+
132
+ $list: (border 1px solid black, outline 2px blue)
133
+
134
+ sfnk-list-mapify($list)
135
+ >> (border: 1px solid black, outline: 2px blue)
75
136
 
76
137
  #### sfnk-list-prepend( $list, $value )
77
138
  Returns `$list`prepended with `$value`.
78
139
 
140
+ $list: (2, 3, 4, 5)
141
+
142
+ sfnk-list-prepend($list, 1)
143
+ >> (1, 2, 3, 4, 5)
144
+
79
145
  #### sfnk-list-reject-all( $list, $value )
80
- Returns a list where all occurences of `$value`.
146
+ Returns `$list` with all occurences of `$value` removed.
147
+
148
+ $list: (1, 2, 1, 3, 4, 1, 5)
149
+
150
+ sfnk-list-reject-all($list, 1)
151
+ >> (2, 3, 4, 5)
81
152
 
82
153
  #### sfnk-list-reject-nth( $list, $index, [$pos: 1] )
83
154
  Rejects the item at `$index` from `$list`. Pass `$pos: -1` to reject the item at `$index` from the end of `$list`.
84
155
 
156
+ $list: (1, 2, 3, 4, 5)
157
+
158
+ sfnk-list-reject-nth($list, 2)
159
+ >> (1, 3, 4, 5)
160
+
161
+ sfnk-list-reject-nth($list, 2, -1)
162
+ >> (1, 2, 3, 5)
163
+
85
164
  #### sfnk-list-reject( $list, $value, [$pos: 1])
86
165
  Rejects first occurence of `$value` from `$list`. Pass `$pos: -1`to reject the last occurence.
87
166
 
167
+ $list: (1, 2, 3, 2, 1);
168
+ sfnk-list-reject($list, 2)
169
+ >> (1, 3, 2, 1)
170
+ sfnk-list-reject($list, 2, -1)
171
+ >> (1, 2, 3, 1)
172
+
88
173
  #### sfnk-list-reverse( $list )
89
174
  Reverses `$list`.
90
175
 
176
+ $list: (1, 2, 3, 4);
177
+ sfnk-list-reverse($list)
178
+ >> (4, 3, 2, 1)
179
+
91
180
  #### sfnk-map-listify-deep( $map )
92
- Like `sfnk-map-listify()` , but recursive.
181
+ Like `sfnk-map-listify()`, but recursive.
182
+
183
+ $map: (hover: (border: 1px solid black, outline: 2px blue)
184
+
185
+ sfnk-map-listify-deep($map)
186
+ >> (hover (border 1px solid black, outline 2px blue))
93
187
 
94
188
  #### sfnk-map-listify( $map )
95
- Creates a list of list items from `$map`, where the keys are the first item in each list item of `$list`.
189
+ Creates a list of list items from `$map`, where the keys of `map` become the first item in each list item of `$list`.
190
+
191
+ $map: (border: 1px solid black, outline: 2px blue)
192
+
193
+ sfnk-map-listify($map)
194
+ >> (border 1px solid black, outline 2px blue)
96
195
 
97
196
  #### sfnk-map-set( $map, $key, $value )
98
197
  Sets key `$key` in `$map` to `$value`.
@@ -12,6 +12,6 @@ else
12
12
  end
13
13
 
14
14
  module SassFunk
15
- VERSION = "0.0.2"
16
- DATE = "2015-03-24"
15
+ VERSION = "0.0.3"
16
+ DATE = "2015-03-27"
17
17
  end
@@ -1,12 +1,18 @@
1
1
  @function sfnk-list-mapify($list) {
2
2
  @if type-of($list) == list or type-of($list) == arglist {
3
- $map: null;
3
+ $map: ();
4
4
  @each $item in $list {
5
- @if type-of($item) == list && length($item) > 1 {
5
+ @if type-of($item) == list {
6
6
  // (border 1px solid green, hover (color: red, background: yellow)) --> (border: 1px solid green, hover: (color: red, background-yellow))
7
- $key: nth($item, 1);
8
- $val: sfnk-list-reject-nth($item, 1);
9
- $map: sfnk-map-set($map, $key, $val);
7
+ @if length($item) > 1 {
8
+ $key: nth($item, 1);
9
+ $val: sfnk-list-reject-nth($item, 1);
10
+ $map: map-merge($map, ($key: $val));
11
+ }
12
+ @else {
13
+ @warn "SassFunk: #{type-of($item)} #{$item} is not a list. All items in the list passed to sfnk-list-mapify must be at least 2 items long.";
14
+ @return null;
15
+ }
10
16
  }
11
17
  @else {
12
18
  @warn "SassFunk: #{type-of($item)} #{$item} is not a list. All items in the list passed to sfnk-list-mapify must be at least 2 items long.";
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SassFunk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franz Heidl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass