flint-gs 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +99 -98
  4. data/lib/flint-gs.rb +8 -0
  5. data/lib/flint.rb +22 -16
  6. data/lib/flint/functions.rb +99 -99
  7. data/lib/flint/version.rb +3 -3
  8. data/stylesheets/_flint.scss +7 -7
  9. data/stylesheets/flint/config/_config.scss +56 -56
  10. data/stylesheets/flint/functions/_functions.scss +48 -48
  11. data/stylesheets/flint/functions/helpers/_helpers.scss +229 -229
  12. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +47 -47
  13. data/stylesheets/flint/functions/lib/_calc-width.scss +70 -70
  14. data/stylesheets/flint/functions/lib/_fluid-width.scss +15 -15
  15. data/stylesheets/flint/functions/lib/_get-index.scss +21 -21
  16. data/stylesheets/flint/functions/lib/_get-instance-value.scss +15 -15
  17. data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
  18. data/stylesheets/flint/functions/lib/_has-family-instance.scss +84 -84
  19. data/stylesheets/flint/functions/lib/_html-encode.scss +14 -14
  20. data/stylesheets/flint/functions/lib/_instance.scss +48 -48
  21. data/stylesheets/flint/functions/lib/_last.scss +14 -14
  22. data/stylesheets/flint/functions/lib/_list-to-str.scss +38 -38
  23. data/stylesheets/flint/functions/lib/_map-fetch.scss +31 -31
  24. data/stylesheets/flint/functions/lib/_next-index.scss +14 -14
  25. data/stylesheets/flint/functions/lib/_purge.scss +24 -24
  26. data/stylesheets/flint/functions/lib/_remove.scss +18 -18
  27. data/stylesheets/flint/functions/lib/_replace.scss +30 -30
  28. data/stylesheets/flint/functions/lib/_steal-key.scss +32 -32
  29. data/stylesheets/flint/functions/lib/_steal-values.scss +15 -15
  30. data/stylesheets/flint/functions/lib/_str-replace.scss +39 -39
  31. data/stylesheets/flint/functions/lib/_str-to-list.scss +89 -89
  32. data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +37 -37
  33. data/stylesheets/flint/functions/lib/_support-syntax.scss +31 -31
  34. data/stylesheets/flint/functions/lib/_types-in-list.scss +76 -76
  35. data/stylesheets/flint/functions/lib/_use-syntax.scss +22 -22
  36. data/stylesheets/flint/globals/_globals.scss +122 -122
  37. data/stylesheets/flint/mixins/_mixins.scss +11 -11
  38. data/stylesheets/flint/mixins/lib/_box-sizing.scss +18 -18
  39. data/stylesheets/flint/mixins/lib/_calculate.scss +241 -241
  40. data/stylesheets/flint/mixins/lib/_clearfix.scss +29 -29
  41. data/stylesheets/flint/mixins/lib/_container.scss +45 -45
  42. data/stylesheets/flint/mixins/lib/_grid-overlay.scss +73 -73
  43. data/stylesheets/flint/mixins/lib/_main.scss +1057 -1057
  44. data/stylesheets/flint/mixins/lib/_new-instance.scss +28 -28
  45. data/stylesheets/flint/mixins/lib/_print-instance.scss +44 -44
  46. data/tests/config.rb +22 -34
  47. data/tests/input/functions/_functions.scss +47 -47
  48. data/tests/input/functions/helpers/_helpers.scss +437 -437
  49. data/tests/input/functions/lib/_calc-breakpoint.scss +62 -62
  50. data/tests/input/functions/lib/_calc-width.scss +195 -195
  51. data/tests/input/functions/lib/_fluid-width.scss +32 -32
  52. data/tests/input/functions/lib/_get-index.scss +31 -31
  53. data/tests/input/functions/lib/_get-instance-value.scss +72 -72
  54. data/tests/input/functions/lib/_get-value.scss +28 -28
  55. data/tests/input/functions/lib/_has-family-instance.scss +35 -35
  56. data/tests/input/functions/lib/_instance.scss +187 -187
  57. data/tests/input/functions/lib/_last.scss +18 -18
  58. data/tests/input/functions/lib/_list-to-str.scss +28 -28
  59. data/tests/input/functions/lib/_map-fetch.scss +34 -34
  60. data/tests/input/functions/lib/_next-index.scss +24 -24
  61. data/tests/input/functions/lib/_purge.scss +14 -14
  62. data/tests/input/functions/lib/_remove.scss +14 -14
  63. data/tests/input/functions/lib/_replace.scss +14 -14
  64. data/tests/input/functions/lib/_steal-key.scss +19 -19
  65. data/tests/input/functions/lib/_steal-values.scss +16 -16
  66. data/tests/input/functions/lib/_str-replace.scss +14 -14
  67. data/tests/input/functions/lib/_str-to-list.scss +28 -28
  68. data/tests/input/functions/lib/_support-syntax-bem.scss +14 -14
  69. data/tests/input/functions/lib/_support-syntax.scss +21 -21
  70. data/tests/input/functions/lib/_types-in-list.scss +50 -50
  71. data/tests/input/functions/lib/_use-syntax.scss +14 -14
  72. data/tests/input/output.scss +250 -250
  73. data/tests/output/output.css +3499 -3499
  74. data/tests/tests.html +110 -110
  75. metadata +12 -212
  76. data/tests/bootcamp/CHANGELOG.md +0 -70
  77. data/tests/bootcamp/CONTRIBUTING.md +0 -72
  78. data/tests/bootcamp/Gruntfile.coffee +0 -34
  79. data/tests/bootcamp/LICENSE.md +0 -7
  80. data/tests/bootcamp/README.md +0 -52
  81. data/tests/bootcamp/bower.json +0 -15
  82. data/tests/bootcamp/dist/_bootcamp.scss +0 -46
  83. data/tests/bootcamp/dist/bootcamp.coffee +0 -101
  84. data/tests/bootcamp/dist/core/functions/_actual.scss +0 -3
  85. data/tests/bootcamp/dist/core/functions/_error.scss +0 -29
  86. data/tests/bootcamp/dist/core/functions/_expect.scss +0 -6
  87. data/tests/bootcamp/dist/core/functions/_not-to.scss +0 -5
  88. data/tests/bootcamp/dist/core/functions/_should.scss +0 -6
  89. data/tests/bootcamp/dist/core/functions/_to.scss +0 -5
  90. data/tests/bootcamp/dist/core/mixins/_describe.scss +0 -31
  91. data/tests/bootcamp/dist/core/mixins/_it.scss +0 -31
  92. data/tests/bootcamp/dist/core/mixins/_runner.scss +0 -28
  93. data/tests/bootcamp/dist/core/mixins/_should.scss +0 -46
  94. data/tests/bootcamp/dist/core/mixins/_xdescribe.scss +0 -9
  95. data/tests/bootcamp/dist/core/mixins/_xit.scss +0 -9
  96. data/tests/bootcamp/dist/core/variables/_helpers.scss +0 -5
  97. data/tests/bootcamp/dist/core/variables/_settings.scss +0 -2
  98. data/tests/bootcamp/dist/core/variables/_should.scss +0 -6
  99. data/tests/bootcamp/dist/core/variables/_trackers.scss +0 -6
  100. data/tests/bootcamp/dist/lib/_sassyjson.scss +0 -1075
  101. data/tests/bootcamp/dist/matchers/_be.scss +0 -3
  102. data/tests/bootcamp/dist/matchers/_equal.scss +0 -3
  103. data/tests/bootcamp/dist/matchers/lists/_be-empty.scss +0 -3
  104. data/tests/bootcamp/dist/matchers/lists/_be-longer-than.scss +0 -3
  105. data/tests/bootcamp/dist/matchers/lists/_be-shorter-than.scss +0 -3
  106. data/tests/bootcamp/dist/matchers/lists/_contain.scss +0 -3
  107. data/tests/bootcamp/dist/matchers/lists/_deep-contain.scss +0 -3
  108. data/tests/bootcamp/dist/matchers/lists/_deep-equal.scss +0 -47
  109. data/tests/bootcamp/dist/matchers/lists/_have-length-of.scss +0 -3
  110. data/tests/bootcamp/dist/matchers/numbers/_be-close-to.scss +0 -12
  111. data/tests/bootcamp/dist/matchers/numbers/_be-greater-than.scss +0 -12
  112. data/tests/bootcamp/dist/matchers/numbers/_be-less-than.scss +0 -12
  113. data/tests/bootcamp/dist/matchers/types/_be-falsy.scss +0 -3
  114. data/tests/bootcamp/dist/matchers/types/_be-null.scss +0 -3
  115. data/tests/bootcamp/dist/matchers/types/_be-truthy.scss +0 -3
  116. data/tests/bootcamp/dist/matchers/types/_have-type-of.scss +0 -3
  117. data/tests/bootcamp/dist/utils/_contain.scss +0 -15
  118. data/tests/bootcamp/dist/utils/_equal.scss +0 -23
  119. data/tests/bootcamp/dist/utils/_list-join.scss +0 -35
  120. data/tests/bootcamp/dist/utils/_power.scss +0 -15
  121. data/tests/bootcamp/package.json +0 -63
  122. data/tests/bootcamp/tasks/bootcamp.coffee +0 -83
  123. data/tests/bootcamp/test/core/functions/_actual.scss +0 -10
  124. data/tests/bootcamp/test/core/functions/_expect.scss +0 -6
  125. data/tests/bootcamp/test/core/functions/_not-to.scss +0 -5
  126. data/tests/bootcamp/test/core/functions/_should.scss +0 -10
  127. data/tests/bootcamp/test/core/functions/_to.scss +0 -5
  128. data/tests/bootcamp/test/core/mixins/_describe.scss +0 -11
  129. data/tests/bootcamp/test/core/mixins/_it.scss +0 -5
  130. data/tests/bootcamp/test/core/mixins/_should.scss +0 -5
  131. data/tests/bootcamp/test/core/mixins/_xdescribe.scss +0 -28
  132. data/tests/bootcamp/test/core/mixins/_xit.scss +0 -12
  133. data/tests/bootcamp/test/matchers/_be.scss +0 -90
  134. data/tests/bootcamp/test/matchers/_equal.scss +0 -33
  135. data/tests/bootcamp/test/matchers/lists/_be-empty.scss +0 -12
  136. data/tests/bootcamp/test/matchers/lists/_be-longer-than.scss +0 -29
  137. data/tests/bootcamp/test/matchers/lists/_be-shorter-than.scss +0 -29
  138. data/tests/bootcamp/test/matchers/lists/_contain.scss +0 -39
  139. data/tests/bootcamp/test/matchers/lists/_deep-contain.scss +0 -51
  140. data/tests/bootcamp/test/matchers/lists/_deep-equal.scss +0 -151
  141. data/tests/bootcamp/test/matchers/lists/_have-length-of.scss +0 -31
  142. data/tests/bootcamp/test/matchers/numbers/_be-close-to.scss +0 -24
  143. data/tests/bootcamp/test/matchers/numbers/_be-greater-than.scss +0 -16
  144. data/tests/bootcamp/test/matchers/numbers/_be-less-than.scss +0 -16
  145. data/tests/bootcamp/test/matchers/types/_be-falsy.scss +0 -14
  146. data/tests/bootcamp/test/matchers/types/_be-null.scss +0 -13
  147. data/tests/bootcamp/test/matchers/types/_be-truthy.scss +0 -13
  148. data/tests/bootcamp/test/matchers/types/_have-type-of.scss +0 -17
  149. data/tests/bootcamp/test/specs.scss +0 -45
  150. data/tests/bootcamp/test/utils/_contain.scss +0 -41
  151. data/tests/bootcamp/test/utils/_equal.scss +0 -79
  152. data/tests/bootcamp/test/utils/_list-join.scss +0 -39
  153. data/tests/bootcamp/test/utils/_power.scss +0 -13
  154. data/tests/sass-prof.log +0 -0
@@ -1,32 +1,32 @@
1
- ///
2
- /// Steal breakpoint key by index
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {Number} $index - index of key
7
- ///
8
- /// @return {String}
9
- ///
10
- /// @group Internal Functions
11
- ///
12
- @function flint-steal-key($index) {
13
- $length: length(map-keys(flint-get-value("breakpoints")));
14
-
15
- @if not flint-is-number($index) {
16
- @if not $flint-development-mode {
17
- @error "Passed $index (#{$index}) is not a number. Function takes index number of breakpoint key.";
18
- } @else {
19
- @return false;
20
- }
21
- }
22
-
23
- @if $index > $length {
24
- @if not $flint-development-mode {
25
- @error "Passed $index (#{$index}) is greater than the length of the config map.";
26
- } @else {
27
- @return false;
28
- }
29
- }
30
-
31
- @return if($index != 0, nth(map-keys(flint-get-value("breakpoints")), $index), false);
32
- }
1
+ ///
2
+ /// Steal breakpoint key by index
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {Number} $index - index of key
7
+ ///
8
+ /// @return {String}
9
+ ///
10
+ /// @group Internal Functions
11
+ ///
12
+ @function flint-steal-key($index) {
13
+ $length: length(map-keys(flint-get-value("breakpoints")));
14
+
15
+ @if not flint-is-number($index) {
16
+ @if not $flint-development-mode {
17
+ @error "Passed $index (#{$index}) is not a number. Function takes index number of breakpoint key.";
18
+ } @else {
19
+ @return false;
20
+ }
21
+ }
22
+
23
+ @if $index > $length {
24
+ @if not $flint-development-mode {
25
+ @error "Passed $index (#{$index}) is greater than the length of the config map.";
26
+ } @else {
27
+ @return false;
28
+ }
29
+ }
30
+
31
+ @return if($index != 0, nth(map-keys(flint-get-value("breakpoints")), $index), false);
32
+ }
@@ -1,15 +1,15 @@
1
- ///
2
- /// Steal breakpoint value by index
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {Number} $index - index of key
7
- /// @param {String} $value - value to get from breakpoint
8
- ///
9
- /// @return {String}
10
- ///
11
- /// @group Internal Functions
12
- ///
13
- @function flint-steal-values($index, $value) {
14
- @return if(flint-is-number($index), flint-get-value("breakpoints", flint-steal-key($index), $value), false);
15
- }
1
+ ///
2
+ /// Steal breakpoint value by index
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {Number} $index - index of key
7
+ /// @param {String} $value - value to get from breakpoint
8
+ ///
9
+ /// @return {String}
10
+ ///
11
+ /// @group Internal Functions
12
+ ///
13
+ @function flint-steal-values($index, $value) {
14
+ @return if(flint-is-number($index), flint-get-value("breakpoints", flint-steal-key($index), $value), false);
15
+ }
@@ -1,39 +1,39 @@
1
- ///
2
- /// Replace substring
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {String} $string - string that contains substring
7
- /// @param {String} $substring - substring to replace
8
- /// @param {String} $new-substring [" "] - new string to replace sub with
9
- ///
10
- /// @return {String}
11
- ///
12
- /// @group Internal Functions
13
- ///
14
- @function flint-str-replace($string, $substring, $new-substring: " ") {
15
-
16
- // Use Ruby function if available
17
- @if $flint-use-ruby-functions {
18
- @return flint_ruby_str_replace($string, $substring, $new-substring);
19
- }
20
-
21
- // Loop through length of string
22
- @for $i from 1 through str-length($string) {
23
- // Get index and length of substring
24
- $sub-index: str-index($string, $substring);
25
- $sub-length: str-length($substring);
26
-
27
- // If count is index of substring
28
- @if $i == $sub-index {
29
- // Slice string to exclude substring
30
- $string-before: str-slice($string, 1, $i - 1);
31
- $string-after: str-slice($string, $i + $sub-length, str-length($string));
32
- // Create new string
33
- $string: $string-before + $new-substring + $string-after;
34
- }
35
-
36
- }
37
-
38
- @return $string;
39
- }
1
+ ///
2
+ /// Replace substring
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {String} $string - string that contains substring
7
+ /// @param {String} $substring - substring to replace
8
+ /// @param {String} $new-substring [" "] - new string to replace sub with
9
+ ///
10
+ /// @return {String}
11
+ ///
12
+ /// @group Internal Functions
13
+ ///
14
+ @function flint-str-replace($string, $substring, $new-substring: " ") {
15
+
16
+ // Use Ruby function if available
17
+ @if $flint-use-ruby-functions {
18
+ @return flint_ruby_str_replace($string, $substring, $new-substring);
19
+ }
20
+
21
+ // Loop through length of string
22
+ @for $i from 1 through str-length($string) {
23
+ // Get index and length of substring
24
+ $sub-index: str-index($string, $substring);
25
+ $sub-length: str-length($substring);
26
+
27
+ // If count is index of substring
28
+ @if $i == $sub-index {
29
+ // Slice string to exclude substring
30
+ $string-before: str-slice($string, 1, $i - 1);
31
+ $string-after: str-slice($string, $i + $sub-length, str-length($string));
32
+ // Create new string
33
+ $string: $string-before + $new-substring + $string-after;
34
+ }
35
+
36
+ }
37
+
38
+ @return $string;
39
+ }
@@ -1,89 +1,89 @@
1
- ///
2
- /// Turns string into a flat list
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {String} $string - string to perform on
7
- /// @param {String} $find [" "] - item to find which separates substrings
8
- /// @param {String} $ignore [","] - removes remaining string beyond item
9
- ///
10
- /// @return {List}
11
- ///
12
- /// @group Internal Functions
13
- ///
14
- @function flint-str-to-list($string, $find: " ", $ignore: ",") {
15
- @if not flint-is-string($string) {
16
- @return false;
17
- }
18
-
19
- // Use Ruby function if available
20
- @if $flint-use-ruby-functions {
21
- @return flint_ruby_str_to_list($string, $find, $ignore);
22
- }
23
-
24
- $string-list: ();
25
- $space-indexes: ();
26
- $ignore-remainder: ();
27
- $length: str-length($string);
28
-
29
- // Find ignore separator, and flint-remove remainder of string beyond that point
30
- @for $i from 1 through $length {
31
- $slice: str-slice($string, $i, $i);
32
- @if $slice == $ignore {
33
- $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
34
- }
35
- }
36
-
37
- // Redefine string and length
38
- @if length($ignore-remainder) >= 1 {
39
- $string: str-slice($string, 1, nth($ignore-remainder, 1));
40
- $length: str-length($string);
41
- }
42
-
43
- // Find all spaces and their indices by looking over each character in string
44
- @for $i from 1 through $length {
45
- $slice: str-slice($string, $i, $i);
46
- @if $slice == $find {
47
- $space-indexes: append($space-indexes, $i, "comma");
48
- }
49
- }
50
-
51
- // Check if there are any spaces
52
- @if length($space-indexes) < 1 {
53
- @return flint-purge(append($string-list, $string));
54
- }
55
-
56
- // Keep a count of number of spaces
57
- $count: 1;
58
-
59
- // Loop through each space
60
- @each $space in $space-indexes {
61
-
62
- // If is initial count, grab first substring and store in list
63
- @if $count == 1 {
64
- $matched-string: str-slice($string, 0, ($space - 1));
65
-
66
- @if $matched-string != "" {
67
- $string-list: append($string-list, $matched-string, "comma");
68
- }
69
- // Else, add a little math to make up for the spaces to do the same
70
- } @else {
71
- $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
72
-
73
- @if $matched-string != "" {
74
- $string-list: append($string-list, $matched-string, "comma");
75
- }
76
- }
77
-
78
- // Increase count
79
- $count: $count + 1;
80
- }
81
-
82
- // Now grab that last selector
83
- $flint-last-space: nth($space-indexes, length($space-indexes));
84
- $matched-string: str-slice($string, ($flint-last-space + 1), $length);
85
- $string-list: append($string-list, $matched-string, "comma");
86
-
87
- // Finally, return comma separated list of selectors
88
- @return flint-purge($string-list);
89
- }
1
+ ///
2
+ /// Turns string into a flat list
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {String} $string - string to perform on
7
+ /// @param {String} $find [" "] - item to find which separates substrings
8
+ /// @param {String} $ignore [","] - removes remaining string beyond item
9
+ ///
10
+ /// @return {List}
11
+ ///
12
+ /// @group Internal Functions
13
+ ///
14
+ @function flint-str-to-list($string, $find: " ", $ignore: ",") {
15
+ @if not flint-is-string($string) {
16
+ @return false;
17
+ }
18
+
19
+ // Use Ruby function if available
20
+ @if $flint-use-ruby-functions {
21
+ @return flint_ruby_str_to_list($string, $find, $ignore);
22
+ }
23
+
24
+ $string-list: ();
25
+ $space-indexes: ();
26
+ $ignore-remainder: ();
27
+ $length: str-length($string);
28
+
29
+ // Find ignore separator, and flint-remove remainder of string beyond that point
30
+ @for $i from 1 through $length {
31
+ $slice: str-slice($string, $i, $i);
32
+ @if $slice == $ignore {
33
+ $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
34
+ }
35
+ }
36
+
37
+ // Redefine string and length
38
+ @if length($ignore-remainder) >= 1 {
39
+ $string: str-slice($string, 1, nth($ignore-remainder, 1));
40
+ $length: str-length($string);
41
+ }
42
+
43
+ // Find all spaces and their indices by looking over each character in string
44
+ @for $i from 1 through $length {
45
+ $slice: str-slice($string, $i, $i);
46
+ @if $slice == $find {
47
+ $space-indexes: append($space-indexes, $i, "comma");
48
+ }
49
+ }
50
+
51
+ // Check if there are any spaces
52
+ @if length($space-indexes) < 1 {
53
+ @return flint-purge(append($string-list, $string));
54
+ }
55
+
56
+ // Keep a count of number of spaces
57
+ $count: 1;
58
+
59
+ // Loop through each space
60
+ @each $space in $space-indexes {
61
+
62
+ // If is initial count, grab first substring and store in list
63
+ @if $count == 1 {
64
+ $matched-string: str-slice($string, 0, ($space - 1));
65
+
66
+ @if $matched-string != "" {
67
+ $string-list: append($string-list, $matched-string, "comma");
68
+ }
69
+ // Else, add a little math to make up for the spaces to do the same
70
+ } @else {
71
+ $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
72
+
73
+ @if $matched-string != "" {
74
+ $string-list: append($string-list, $matched-string, "comma");
75
+ }
76
+ }
77
+
78
+ // Increase count
79
+ $count: $count + 1;
80
+ }
81
+
82
+ // Now grab that last selector
83
+ $flint-last-space: nth($space-indexes, length($space-indexes));
84
+ $matched-string: str-slice($string, ($flint-last-space + 1), $length);
85
+ $string-list: append($string-list, $matched-string, "comma");
86
+
87
+ // Finally, return comma separated list of selectors
88
+ @return flint-purge($string-list);
89
+ }
@@ -1,37 +1,37 @@
1
- ///
2
- /// Parser to support BEM syntax
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {List} $selectors - string of selectors to parse
7
- ///
8
- /// @return {List} - parsed list of selectors according to syntax
9
- ///
10
- /// @group Internal Functions
11
- ///
12
- @function flint-support-syntax-bem($selectors) {
13
- $selectors: flint-list-to-str($selectors, " ");
14
- // Clean up selector, remove double underscores for spaces
15
- // add pseudo character to differentiate selectors
16
- $selectors: flint-str-replace($selectors, "__", "/");
17
- // Parse string back to list without pseudo character
18
- $selectors: flint-str-to-list($selectors, "/");
19
- // Define top-most parent of selector
20
- $parent: nth($selectors, 1);
21
- // Create new list of parsed selectors
22
- $selector-list: ($parent,);
23
-
24
- // Loop over each selector and build list of selectors
25
- @each $selector in $selectors {
26
- // Make sure current selector is not the parent
27
- @if $selector != $parent {
28
- // Save to selector list
29
- $selector-list: append($selector-list, "#{$parent}__#{$selector}", "comma");
30
- // Define new parent
31
- $parent: "#{$parent}__#{$selector}";
32
- }
33
- }
34
-
35
- // Return the list of parsed selectors
36
- @return $selector-list;
37
- }
1
+ ///
2
+ /// Parser to support BEM syntax
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {List} $selectors - string of selectors to parse
7
+ ///
8
+ /// @return {List} - parsed list of selectors according to syntax
9
+ ///
10
+ /// @group Internal Functions
11
+ ///
12
+ @function flint-support-syntax-bem($selectors) {
13
+ $selectors: flint-list-to-str($selectors, " ");
14
+ // Clean up selector, remove double underscores for spaces
15
+ // add pseudo character to differentiate selectors
16
+ $selectors: flint-str-replace($selectors, "__", "/");
17
+ // Parse string back to list without pseudo character
18
+ $selectors: flint-str-to-list($selectors, "/");
19
+ // Define top-most parent of selector
20
+ $parent: nth($selectors, 1);
21
+ // Create new list of parsed selectors
22
+ $selector-list: ($parent,);
23
+
24
+ // Loop over each selector and build list of selectors
25
+ @each $selector in $selectors {
26
+ // Make sure current selector is not the parent
27
+ @if $selector != $parent {
28
+ // Save to selector list
29
+ $selector-list: append($selector-list, "#{$parent}__#{$selector}", "comma");
30
+ // Define new parent
31
+ $parent: "#{$parent}__#{$selector}";
32
+ }
33
+ }
34
+
35
+ // Return the list of parsed selectors
36
+ @return $selector-list;
37
+ }
@@ -1,31 +1,31 @@
1
- ///
2
- /// Support syntax
3
- ///
4
- /// @access private
5
- ///
6
- /// @param {String} $syntax - alias of syntax to support
7
- /// @param {List} $selectors - string of selectors to parse
8
- ///
9
- /// @return {List} - list of parsed selectors according to syntax
10
- ///
11
- /// @group Internal Functions
12
- ///
13
- @function flint-support-syntax($syntax, $selectors) {
14
- $syntax: to-lower-case($syntax);
15
-
16
- // Make sure syntax is supported
17
- @if function-exists("flint-support-syntax-#{$syntax}") {
18
-
19
- // Support syntax
20
- //
21
- // WARNING: Be sure you have created a custom function to support an unknown syntax
22
- @return call("flint-support-syntax-#{$syntax}", $selectors);
23
- }
24
-
25
- @if not $flint-development-mode {
26
- // Throw error if the syntax does not exist and a function to call cannot be found
27
- @error "You did not pass a valid syntax to `flint-support-syntax`: #{$syntax}. Either specify a custom `flint-support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes. For more info, please visit the docs.";
28
- } @else {
29
- @return false;
30
- }
31
- }
1
+ ///
2
+ /// Support syntax
3
+ ///
4
+ /// @access private
5
+ ///
6
+ /// @param {String} $syntax - alias of syntax to support
7
+ /// @param {List} $selectors - string of selectors to parse
8
+ ///
9
+ /// @return {List} - list of parsed selectors according to syntax
10
+ ///
11
+ /// @group Internal Functions
12
+ ///
13
+ @function flint-support-syntax($syntax, $selectors) {
14
+ $syntax: to-lower-case($syntax);
15
+
16
+ // Make sure syntax is supported
17
+ @if function-exists("flint-support-syntax-#{$syntax}") {
18
+
19
+ // Support syntax
20
+ //
21
+ // WARNING: Be sure you have created a custom function to support an unknown syntax
22
+ @return call("flint-support-syntax-#{$syntax}", $selectors);
23
+ }
24
+
25
+ @if not $flint-development-mode {
26
+ // Throw error if the syntax does not exist and a function to call cannot be found
27
+ @error "You did not pass a valid syntax to `flint-support-syntax`: #{$syntax}. Either specify a custom `flint-support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes. For more info, please visit the docs.";
28
+ } @else {
29
+ @return false;
30
+ }
31
+ }