doggystyle 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.hound.yml +5 -0
  4. data/.npmignore +18 -0
  5. data/.ruby-version +1 -0
  6. data/.scss-lint.yml +243 -0
  7. data/.travis.yml +5 -0
  8. data/CHANGELOG.md +5 -0
  9. data/Gemfile +4 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +40 -0
  12. data/RELEASING.md +1 -0
  13. data/Rakefile +9 -0
  14. data/bin/doggystyle +5 -0
  15. data/bower.json +38 -0
  16. data/circle.yml +13 -0
  17. data/core/_imports.scss +229 -0
  18. data/core/animations/_jump.scss +7 -0
  19. data/core/animations/_shake.scss +24 -0
  20. data/core/animations/_wobble.scss +8 -0
  21. data/core/functions/_mobile-first.scss +3 -0
  22. data/core/functions/_opposite-direction.scss +45 -0
  23. data/core/functions/casts/_to-bool.scss +19 -0
  24. data/core/functions/casts/_to-color.scss +74 -0
  25. data/core/functions/casts/_to-list.scss +38 -0
  26. data/core/functions/casts/_to-map.scss +27 -0
  27. data/core/functions/casts/_to-null.scss +15 -0
  28. data/core/functions/casts/_to-number.scss +66 -0
  29. data/core/functions/casts/_to-string.scss +15 -0
  30. data/core/functions/colours/_colour-contrast.scss +61 -0
  31. data/core/functions/colours/_colour.scss +69 -0
  32. data/core/functions/colours/_random-colour.scss +78 -0
  33. data/core/functions/lists/_contains.scss +62 -0
  34. data/core/functions/lists/_first.scss +19 -0
  35. data/core/functions/lists/_insert-nth.scss +37 -0
  36. data/core/functions/lists/_last.scss +11 -0
  37. data/core/functions/lists/_merge.scss +30 -0
  38. data/core/functions/lists/_prepend.scss +11 -0
  39. data/core/functions/lists/_remove-nth.scss +53 -0
  40. data/core/functions/lists/_remove.scss +30 -0
  41. data/core/functions/lists/_replace-nth.scss +55 -0
  42. data/core/functions/lists/_replace.scss +36 -0
  43. data/core/functions/lists/_reverse.scss +31 -0
  44. data/core/functions/lists/_second.scss +19 -0
  45. data/core/functions/lists/_shift.scss +24 -0
  46. data/core/functions/lists/_slice.scss +52 -0
  47. data/core/functions/lists/_sort.scss +51 -0
  48. data/core/functions/maps/_map-deep-get.scss +51 -0
  49. data/core/functions/maps/_map-deep-set.scss +34 -0
  50. data/core/functions/maps/_map-depth.scss +23 -0
  51. data/core/functions/maps/_map-extend.scss +47 -0
  52. data/core/functions/maps/_map-has-keys.scss +23 -0
  53. data/core/functions/maps/_map-has-nested-keys.scss +24 -0
  54. data/core/functions/maps/_map-set.scss +4 -0
  55. data/core/functions/maps/_map-zip.scss +50 -0
  56. data/core/functions/numbers/_add-unit.scss +54 -0
  57. data/core/functions/numbers/_pad.scss +16 -0
  58. data/core/functions/numbers/_spacer.scss +16 -0
  59. data/core/functions/numbers/_strip.scss +29 -0
  60. data/core/functions/numbers/_units.scss +17 -0
  61. data/core/functions/svg/_dots.scss +84 -0
  62. data/core/functions/svg/_fake-radius.scss +131 -0
  63. data/core/functions/svg/_lines.scss +76 -0
  64. data/core/functions/svg/_svg.scss +12 -0
  65. data/core/functions/text/_smart-lineheight.scss +13 -0
  66. data/core/functions/text/_string-explode.scss +45 -0
  67. data/core/functions/text/_string-replace.scss +38 -0
  68. data/core/helpers/_custom-elements.scss +114 -0
  69. data/core/helpers/_eases.scss +44 -0
  70. data/core/helpers/_reset.scss +282 -0
  71. data/core/helpers/_show-breakpoints.scss +25 -0
  72. data/core/helpers/_strings.scss +648 -0
  73. data/core/helpers/_warnings.scss +3 -0
  74. data/core/helpers/checks/_check.scss +69 -0
  75. data/core/helpers/checks/_is-absolute-length.scss +25 -0
  76. data/core/helpers/checks/_is-angel.scss +25 -0
  77. data/core/helpers/checks/_is-arglist.scss +11 -0
  78. data/core/helpers/checks/_is-bool.scss +23 -0
  79. data/core/helpers/checks/_is-calc.scss +11 -0
  80. data/core/helpers/checks/_is-colour.scss +23 -0
  81. data/core/helpers/checks/_is-dark.scss +14 -0
  82. data/core/helpers/checks/_is-duration.scss +15 -0
  83. data/core/helpers/checks/_is-false.scss +13 -0
  84. data/core/helpers/checks/_is-first-character.scss +11 -0
  85. data/core/helpers/checks/_is-frequency.scss +15 -0
  86. data/core/helpers/checks/_is-function.scss +44 -0
  87. data/core/helpers/checks/_is-integer.scss +15 -0
  88. data/core/helpers/checks/_is-length.scss +16 -0
  89. data/core/helpers/checks/_is-light.scss +14 -0
  90. data/core/helpers/checks/_is-list.scss +11 -0
  91. data/core/helpers/checks/_is-map.scss +11 -0
  92. data/core/helpers/checks/_is-null.scss +11 -0
  93. data/core/helpers/checks/_is-number.scss +19 -0
  94. data/core/helpers/checks/_is-percentage.scss +13 -0
  95. data/core/helpers/checks/_is-position.scss +16 -0
  96. data/core/helpers/checks/_is-pseudo.scss +24 -0
  97. data/core/helpers/checks/_is-relative-length.scss +25 -0
  98. data/core/helpers/checks/_is-resolution.scss +15 -0
  99. data/core/helpers/checks/_is-selector.scss +3 -0
  100. data/core/helpers/checks/_is-string.scss +11 -0
  101. data/core/helpers/checks/_is-time.scss +15 -0
  102. data/core/helpers/checks/_is-unit.scss +16 -0
  103. data/core/helpers/private/_arglist-to-list.scss +36 -0
  104. data/core/helpers/private/_brightness.scss +13 -0
  105. data/core/helpers/private/_find-digits.scss +41 -0
  106. data/core/helpers/private/_find-integer.scss +40 -0
  107. data/core/helpers/private/_from-hex.scss +48 -0
  108. data/core/helpers/private/_from-hsl.scss +55 -0
  109. data/core/helpers/private/_from-rgb.scss +55 -0
  110. data/core/helpers/private/_get-color-value.scss +26 -0
  111. data/core/helpers/private/_hash-fix.scss +15 -0
  112. data/core/helpers/private/_hex-to-dec.scss +28 -0
  113. data/core/helpers/private/_length.scss +26 -0
  114. data/core/helpers/private/_lightness.scss +15 -0
  115. data/core/helpers/private/_list-items-to-strings.scss +8 -0
  116. data/core/helpers/private/_min-max-number.scss +12 -0
  117. data/core/helpers/private/_pow.scss +29 -0
  118. data/core/helpers/private/_string-compare.scss +38 -0
  119. data/core/helpers/private/_string-explode.scss +43 -0
  120. data/core/helpers/private/_sudo.scss +23 -0
  121. data/core/helpers/symbols/_arrows.scss +337 -0
  122. data/core/helpers/symbols/_block.scss +97 -0
  123. data/core/helpers/symbols/_box.scss +385 -0
  124. data/core/helpers/symbols/_common.scss +101 -0
  125. data/core/helpers/symbols/_currency.scss +82 -0
  126. data/core/helpers/symbols/_dingbats.scss +565 -0
  127. data/core/helpers/symbols/_geometric.scss +289 -0
  128. data/core/helpers/symbols/_letterlike.scss +235 -0
  129. data/core/helpers/symbols/_misc.scss +568 -0
  130. data/core/helpers/symbols/_operators.scss +766 -0
  131. data/core/helpers/symbols/_punctuation.scss +214 -0
  132. data/core/mixins/_align.scss +15 -0
  133. data/core/mixins/_animate.scss +16 -0
  134. data/core/mixins/_aspect-ratio.scss +86 -0
  135. data/core/mixins/_backface-visibility.scss +7 -0
  136. data/core/mixins/_background-image.scss +13 -0
  137. data/core/mixins/_blend.scss +10 -0
  138. data/core/mixins/_blendmodes.scss +24 -0
  139. data/core/mixins/_border-radius.scss +105 -0
  140. data/core/mixins/_browsers.scss +155 -0
  141. data/core/mixins/_bulletpoint.scss +12 -0
  142. data/core/mixins/_center.scss +3 -0
  143. data/core/mixins/_clearfix.scss +7 -0
  144. data/core/mixins/_columns.scss +22 -0
  145. data/core/mixins/_custom-property.scss +15 -0
  146. data/core/mixins/_devices.scss +97 -0
  147. data/core/mixins/_dropdown.scss +38 -0
  148. data/core/mixins/_fake-radius.scss +99 -0
  149. data/core/mixins/_filters.scss +163 -0
  150. data/core/mixins/_flip.scss +11 -0
  151. data/core/mixins/_font-face.scss +11 -0
  152. data/core/mixins/_fontsize.scss +126 -0
  153. data/core/mixins/_gallery.scss +134 -0
  154. data/core/mixins/_gradient.scss +72 -0
  155. data/core/mixins/_image-size.scss +18 -0
  156. data/core/mixins/_image.scss +12 -0
  157. data/core/mixins/_inputs.scss +18 -0
  158. data/core/mixins/_keyframes.scss +8 -0
  159. data/core/mixins/_last.scss +5 -0
  160. data/core/mixins/_nth-last.scss +7 -0
  161. data/core/mixins/_nth.scss +10 -0
  162. data/core/mixins/_placeholder.scss +15 -0
  163. data/core/mixins/_prefixer.scss +55 -0
  164. data/core/mixins/_selection.scss +15 -0
  165. data/core/mixins/_shadow.scss +7 -0
  166. data/core/mixins/_size.scss +13 -0
  167. data/core/mixins/_smart-horizontal.scss +21 -0
  168. data/core/mixins/_sudo-image.scss +12 -0
  169. data/core/mixins/_text-shadow.scss +30 -0
  170. data/core/mixins/_transforms.scss +264 -0
  171. data/core/mixins/_transition.scss +189 -0
  172. data/core/mixins/_triangle-classic.scss +170 -0
  173. data/core/mixins/_triangle.scss +250 -0
  174. data/core/mixins/_unwrap.scss +5 -0
  175. data/core/mixins/_user-select.scss +5 -0
  176. data/core/mixins/_vertical.scss +10 -0
  177. data/core/mixins/columns/_columns.scss +92 -0
  178. data/core/mixins/flexbox/_flex-container.scss +201 -0
  179. data/core/mixins/flexbox/_flex-grid.scss +235 -0
  180. data/core/mixins/flexbox/_flex-items.scss +140 -0
  181. data/core/mixins/flexbox/_flex-remove.scss +12 -0
  182. data/core/mixins/grid/_break-between.scss +6 -0
  183. data/core/mixins/grid/_grid.scss +150 -0
  184. data/core/mixins/svg/_svg-size.scss +4 -0
  185. data/core/mixins/svg/_svg.scss +9 -0
  186. data/core/placeholders/_clear.scss +27 -0
  187. data/core/placeholders/_cursor.scss +35 -0
  188. data/core/placeholders/_misc.scss +20 -0
  189. data/core/placeholders/_rendering.scss +21 -0
  190. data/core/placeholders/_text.scss +41 -0
  191. data/core/settings/_colours.scss +30 -0
  192. data/core/settings/_directories.scss +7 -0
  193. data/core/settings/_global.scss +14 -0
  194. data/core/settings/_grid.scss +24 -0
  195. data/core/settings/_padding.scss +8 -0
  196. data/core/settings/_spacing.scss +8 -0
  197. data/core/settings/_text.scss +13 -0
  198. data/doggystyle.gemspec +29 -0
  199. data/eyeglass-exports.js +7 -0
  200. data/features/install.feature +29 -0
  201. data/features/step_definitions/doggystyle_steps.rb +31 -0
  202. data/features/support/bourbon_support.rb +19 -0
  203. data/features/support/env.rb +1 -0
  204. data/features/update.feature +30 -0
  205. data/features/version.feature +5 -0
  206. data/index.js +7 -0
  207. data/lib/doggystyle.rb +7 -0
  208. data/lib/doggystyle/generator.rb +81 -0
  209. data/lib/doggystyle/version.rb +3 -0
  210. data/package.json +33 -0
  211. data/spec/doggystyle/library/border_color_spec.rb +51 -0
  212. data/spec/doggystyle/library/border_radius_spec.rb +25 -0
  213. data/spec/doggystyle/library/border_style_spec.rb +51 -0
  214. data/spec/doggystyle/library/border_width_spec.rb +51 -0
  215. data/spec/doggystyle/library/buttons_spec.rb +53 -0
  216. data/spec/doggystyle/library/clearfix_spec.rb +18 -0
  217. data/spec/doggystyle/library/contrast_switch_spec.rb +23 -0
  218. data/spec/doggystyle/library/ellipsis_spec.rb +20 -0
  219. data/spec/doggystyle/library/font_face_spec_1.rb +16 -0
  220. data/spec/doggystyle/library/font_face_spec_2.rb +21 -0
  221. data/spec/doggystyle/library/font_face_spec_3.rb +16 -0
  222. data/spec/doggystyle/library/font_face_spec_4.rb +17 -0
  223. data/spec/doggystyle/library/font_stacks_spec.rb +40 -0
  224. data/spec/doggystyle/library/hide_text_spec.rb +17 -0
  225. data/spec/doggystyle/library/hide_visually_spec.rb +35 -0
  226. data/spec/doggystyle/library/margin_spec.rb +51 -0
  227. data/spec/doggystyle/library/modular_scale_spec.rb +43 -0
  228. data/spec/doggystyle/library/padding_spec.rb +51 -0
  229. data/spec/doggystyle/library/position_spec.rb +67 -0
  230. data/spec/doggystyle/library/prefixer_spec.rb +34 -0
  231. data/spec/doggystyle/library/shade_spec.rb +31 -0
  232. data/spec/doggystyle/library/size_spec.rb +31 -0
  233. data/spec/doggystyle/library/strip_unit_spec.rb +31 -0
  234. data/spec/doggystyle/library/text_inputs_spec.rb +75 -0
  235. data/spec/doggystyle/library/tint_spec.rb +31 -0
  236. data/spec/doggystyle/library/triangle_spec.rb +31 -0
  237. data/spec/doggystyle/library/word_wrap_spec.rb +29 -0
  238. data/spec/doggystyle/utilities/assign_inputs_spec.rb +50 -0
  239. data/spec/doggystyle/utilities/collapse_directionals.rb +25 -0
  240. data/spec/doggystyle/utilities/directional_values_spec.rb +21 -0
  241. data/spec/doggystyle/utilities/font_source_declaration_spec.rb +29 -0
  242. data/spec/doggystyle/utilities/retrieve_bourbon_setting_spec.rb +31 -0
  243. data/spec/doggystyle/utilities/unpack_spec.rb +32 -0
  244. data/spec/doggystyle/validators/contains_spec.rb +27 -0
  245. data/spec/doggystyle/validators/is_length_spec.rb +49 -0
  246. data/spec/doggystyle/validators/is_light_spec.rb +37 -0
  247. data/spec/doggystyle/validators/is_number_spec.rb +43 -0
  248. data/spec/doggystyle/validators/is_size_spec.rb +43 -0
  249. data/spec/fixtures/_setup.scss +1 -0
  250. data/spec/fixtures/library/border-color.scss +26 -0
  251. data/spec/fixtures/library/border-radius.scss +17 -0
  252. data/spec/fixtures/library/border-style.scss +21 -0
  253. data/spec/fixtures/library/border-width.scss +21 -0
  254. data/spec/fixtures/library/buttons.scss +17 -0
  255. data/spec/fixtures/library/clearfix.scss +5 -0
  256. data/spec/fixtures/library/contrast-switch.scss +9 -0
  257. data/spec/fixtures/library/ellipsis.scss +5 -0
  258. data/spec/fixtures/library/font-face-1.scss +6 -0
  259. data/spec/fixtures/library/font-face-2.scss +10 -0
  260. data/spec/fixtures/library/font-face-3.scss +8 -0
  261. data/spec/fixtures/library/font-face-4.scss +7 -0
  262. data/spec/fixtures/library/font-stacks.scss +41 -0
  263. data/spec/fixtures/library/hide-text.scss +5 -0
  264. data/spec/fixtures/library/hide-visually.scss +9 -0
  265. data/spec/fixtures/library/margin.scss +21 -0
  266. data/spec/fixtures/library/modular-scale.scss +29 -0
  267. data/spec/fixtures/library/padding.scss +21 -0
  268. data/spec/fixtures/library/position.scss +25 -0
  269. data/spec/fixtures/library/prefixer.scss +13 -0
  270. data/spec/fixtures/library/shade.scss +17 -0
  271. data/spec/fixtures/library/size.scss +13 -0
  272. data/spec/fixtures/library/strip-unit.scss +17 -0
  273. data/spec/fixtures/library/text-inputs.scss +21 -0
  274. data/spec/fixtures/library/tint.scss +17 -0
  275. data/spec/fixtures/library/triangle.scss +9 -0
  276. data/spec/fixtures/library/word-wrap.scss +9 -0
  277. data/spec/fixtures/utilities/assign-inputs.scss +19 -0
  278. data/spec/fixtures/utilities/collapse-directionals.scss +17 -0
  279. data/spec/fixtures/utilities/directional-values.scss +13 -0
  280. data/spec/fixtures/utilities/font-source-declaration.scss +11 -0
  281. data/spec/fixtures/utilities/retrieve-bourbon-setting.scss +16 -0
  282. data/spec/fixtures/utilities/unpack.scss +17 -0
  283. data/spec/fixtures/validators/contains.scss +28 -0
  284. data/spec/fixtures/validators/is-length.scss +35 -0
  285. data/spec/fixtures/validators/is-light.scss +29 -0
  286. data/spec/fixtures/validators/is-number.scss +31 -0
  287. data/spec/fixtures/validators/is-size.scss +31 -0
  288. data/spec/spec_helper.rb +22 -0
  289. data/spec/support/matchers/have_rule.rb +35 -0
  290. data/spec/support/matchers/have_ruleset.rb +20 -0
  291. data/spec/support/matchers/have_value.rb +17 -0
  292. data/spec/support/parser_support.rb +16 -0
  293. data/spec/support/sass_support.rb +10 -0
  294. metadata +527 -0
@@ -0,0 +1,5 @@
1
+ @mixin unwrap($element:"p", $imageType:"img") {
2
+ &:after { content:''; clear:both; visibility:hidden; }
3
+ #{imageType} { float:left; }
4
+ #{element} { overflow: hidden }
5
+ }
@@ -0,0 +1,5 @@
1
+ @mixin user-select($setting) {
2
+ @if contains($setting, (none auto text contain all)) {
3
+ @include prefixer(user-select, $setting);
4
+ }
5
+ }
@@ -0,0 +1,10 @@
1
+ // Align vertically using the table method. Ideal when trying to avoid using specific units
2
+ @mixin vertical($element:":first-child") {
3
+ display:table; height:100%;
4
+ > #{$element} { display: table-cell; vertical-align: middle; }
5
+ }
6
+
7
+ // Align vertically using the table method. Ideal when trying to avoid using specific units
8
+ @mixin vertical-image($element:"img") {
9
+ > #{$element} { max-height:100%; max-width: 90%; width:auto; height:auto; position:absolute; top:0; bottom:0; left:0; right:0; margin:auto; }
10
+ }
@@ -0,0 +1,92 @@
1
+ //
2
+ $column-global-rules : inherit, initial, unset;
3
+ $break-before-after-rules : auto, always, left, right, recto, verso, page, column, region, avoid, avoid-page, avoid-column, avoid-region;
4
+ $break-inside-rules : auto, avoid, avoid-page, avoid-column, avoid-region;
5
+ $column-rule-style-rules : none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset;
6
+
7
+ //
8
+ @mixin break-after($setting) {
9
+ @if contains($break-before-after-rules, $setting) {
10
+ @include prefixer(break-after, $setting);
11
+ }
12
+ }
13
+
14
+ //
15
+ @mixin break-before($setting) {
16
+ @if contains($break-before-after-rules, $setting) {
17
+ @include prefixer(break-before, $setting);
18
+ }
19
+ }
20
+
21
+ //
22
+ @mixin break-inside($setting) {
23
+ @if contains($break-inside, $setting) {
24
+ @include prefixer(break-inside, $setting);
25
+ }
26
+ }
27
+
28
+ //
29
+ @mixin column-count($setting) {
30
+ @if is-number($setting) or contains(join($column-global-rules, auto), $setting) {
31
+ @include prefixer(column-count, strip($setting));
32
+ }
33
+ }
34
+
35
+ //
36
+ @mixin column-fill($setting) {
37
+ @if contains(join($column-global-rules, (auto, balance)), $setting) {
38
+ @include prefixer(column-fill, $setting);
39
+ }
40
+ }
41
+
42
+ //
43
+ @mixin column-gap($setting) {
44
+ @if is-number($setting) or contains(join($column-global-rules, normal), $setting) {
45
+ @include prefixer(column-gap, addUnit($setting));
46
+ }
47
+ }
48
+
49
+ //
50
+ @mixin column-rule($setting) {
51
+ @include prefixer(column-rule, $setting);
52
+ }
53
+
54
+ //
55
+ @mixin column-rule-color($setting) {
56
+ @if is-colour($setting) or contains($column-global-rules, $setting) {
57
+ @include prefixer(column-rule-color, $setting);
58
+ }
59
+ }
60
+
61
+ //
62
+ @mixin column-rule-style($setting) {
63
+ @if is-string($setting) and contains(join($column-global-rules, $column-rule-style-rules), $setting) {
64
+ @include prefixer(column-rule-style, $setting);
65
+ }
66
+ }
67
+
68
+ //
69
+ @mixin column-rule-width($setting) {
70
+ @if is-number($setting) or contains(join($column-global-rules, (thin, medium, thick)), $setting) {
71
+ @include prefixer(column-rule-width, addUnit($setting));
72
+ }
73
+ }
74
+
75
+ //
76
+ @mixin column-span($setting) {
77
+ @if is-string($setting) and contains(join($column-global-rules, (none, all)), $setting) {
78
+ @include prefixer(column-span, $setting);
79
+ }
80
+ }
81
+
82
+ //
83
+ @mixin column-width($setting) {
84
+ @if is-number($setting) or contains(join($column-global-rules, auto), $setting) {
85
+ @include prefixer(column-width, addUnit($setting));
86
+ }
87
+ }
88
+
89
+ //
90
+ @mixin columns($setting) {
91
+ @include prefixer(columns, $setting);
92
+ }
@@ -0,0 +1,201 @@
1
+ // Documentation: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
2
+
3
+ // Container properties
4
+ $flex-container-aliases : direction wrap flow justify items content;
5
+ $flex-container : display flex-direction flex-wrap flex-flow justify-content align-items align-content;
6
+ $flex-container : merge($flex-container, $flex-container-aliases);
7
+
8
+ // Container values
9
+ $flex-display : flex inline-flex;
10
+ $flex-direction : row row-reverse column column-reverse inherit; // default row
11
+ $flex-wrap : nowrap wrap wrap-reverse; // default no-wrap
12
+ $flex-flow : merge($flex-direction, $flex-wrap);
13
+ $flex-justify-content : flex-start flex-end center space-between space-around start end between around; // default flex-start
14
+ $flex-align-items : flex-start flex-end center baseline stretch start end; // default stretch
15
+ $flex-align-content : flex-start flex-end center space-between space-around stretch start end between around; // default stretch
16
+
17
+ /// Flexbox container mixin validates and prefixes the most current Flexbox W3C working draft
18
+ ///
19
+ /// @author Mark Notton
20
+ ///
21
+ /// @access public
22
+ ///
23
+ /// @warning Flexbox does not currently work on buttons, fieldsets or textareas
24
+ ///
25
+ /// @warning box-orient, box-direction, box-ordinal-group, box-left, box-positive, box-pack, box-align
26
+ /// ...and other unsupported/old flexbox values have been excluded
27
+ ///
28
+ /// @todo Do special checks for 'flex-flow'
29
+ ///
30
+ /// @param {Map} $settings - flexbox container property or alias : flexbox value.
31
+ ///
32
+ /// Property Alias Default Values
33
+ /// -------------------------------------------------------------------------------------------------------------------
34
+ /// display (-) (flex) flex | inline-flex
35
+ /// flex-direction (direction) (row) row | row-reverse | column | column-reverse | inherit
36
+ /// flex-wrap (wrap) (nowrap) nowrap | no-wrap | wrap | wrap-reverse
37
+ /// !flex-flow (flow) (-) flex-direction & flex-wrap
38
+ /// justify-content (justify) (flex-start) flex-start | flex-end | center | space-between | space-around
39
+ /// align-items (items) (stretch) flex-start | flex-end | center | baseline | stretch
40
+ /// align-content (content) (stretch) flex-start | flex-end | center | space-between | space-around | stretch
41
+ ///
42
+ /// @param {Bool} $display - If no display value is used, 'display:flex' will be defined automatically.
43
+ /// Unless this paramater is set to 'false'
44
+ ///
45
+ /// @require {mixin} contains
46
+ /// @require {mixin} prefixer
47
+ /// @require {function} merge
48
+ /// @require {variable} flex-container-aliases
49
+ /// @require {variable} flex-container
50
+ /// @require {variable} flex-container
51
+ /// @require {variable} flex-display
52
+ /// @require {variable} flex-direction
53
+ /// @require {variable} flex-wrap
54
+ /// @require {variable} flex-flow
55
+ /// @require {variable} flex-justify-content
56
+ /// @require {variable} flex-align-items
57
+ /// @require {variable} flex-align-content
58
+ ///
59
+ /// @example scss - Usage
60
+ /// .foo {
61
+ /// @include flex-container((
62
+ /// direction:row,
63
+ /// justify-content:flex-end
64
+ /// ));
65
+ /// }
66
+ ///
67
+ /// @example css - CSS Output
68
+ /// .foo {
69
+ /// -webkit-flex-direction: row;
70
+ /// -moz-flex-direction: row;
71
+ /// -ms-flex-direction: row;
72
+ /// -o-flex-direction: row;
73
+ /// flex-direction: row;
74
+ /// -webkit-justify-content: flex-end;
75
+ /// -moz-justify-content: flex-end;
76
+ /// -ms-justify-content: flex-end;
77
+ /// -o-justify-content: flex-end;
78
+ /// justify-content: flex-end;
79
+ /// -js-display: flex;
80
+ /// display: -webkit-box;
81
+ /// display: -moz-box;
82
+ /// display: -webkit-flexbox;
83
+ /// display: -ms-flexbox;
84
+ /// display: -webkit-flex;
85
+ /// display: flex;
86
+ /// }
87
+ ///
88
+ @mixin flex-container($settings:null, $display:true) {
89
+
90
+ // If nothing was passed, just set the display as flex
91
+ @if $settings == null { $settings : (display:flex)}
92
+
93
+ // Add display:flex by default is no display property was set
94
+ @each $property, $value in $settings {
95
+ @if $property == display {
96
+ $display:default;
97
+ }
98
+ }
99
+ @if $display != default and $display == true { $settings : map-set($settings, display, flex);}
100
+
101
+ // Validation checks for every value for every property
102
+ @each $property, $value in $settings {
103
+
104
+ $output : false;
105
+
106
+ @if contains($flex-container, $property) {
107
+ // Alias checks
108
+ @if contains($property, (content items)) {
109
+ $property : #{align-}$property;
110
+ }
111
+ @elseif contains($property, (direction wrap flow)) {
112
+ $property : #{flex-}$property;
113
+ // Special alias check for nowrap
114
+ $value : if($value == no-wrap, nowrap, $value);
115
+ }
116
+ @elseif $property == justify {
117
+ $property : justify-content;
118
+ }
119
+
120
+ @if contains($value, (start end)) {
121
+ $value : #{flex-}$value;
122
+ } @elseif contains($value, (around between)) {
123
+ $value : #{space-}$value;
124
+ }
125
+
126
+ @if $property == display and $value != null {
127
+ @if $value == inline-flex {
128
+ display: -webkit-inline-flex;
129
+ display: inline-flex;
130
+ } @else {
131
+ -js-display: flex; // This is for flexibility support
132
+ display: -webkit-box;
133
+ display: -moz-box;
134
+ display: -webkit-flexbox;
135
+ display: -ms-flexbox;
136
+ display: -webkit-flex;
137
+ display: flex;
138
+ }
139
+ }
140
+
141
+ // Check these properties against their list of valid values
142
+ $checks : (flex-direction: $flex-direction, flex-wrap: $flex-wrap, justify-content: $flex-justify-content, align-items: $flex-align-items, align-content: $flex-align-content);
143
+ @each $prop, $check in $checks {
144
+ @if $property == $prop and contains($check, $value){
145
+ $output : true;
146
+ }
147
+ }
148
+
149
+ // Only output and prefix everything when $output is true
150
+ @if $output {
151
+ @include prefixer($property, $value, all);
152
+ }
153
+
154
+ }
155
+ }
156
+ }
157
+
158
+ // Quick Flex Container Mixins
159
+
160
+ /// @alias flex-container -
161
+ ///
162
+ /// @author Mark Notton
163
+ ///
164
+ /// @access public
165
+ ///
166
+ /// @warning Flexbox does not currently work on buttons, fieldsets or textareas
167
+ ///
168
+ /// @warning box-orient, box-direction, box-ordinal-group, box-left, box-positive, box-pack, box-align
169
+ /// ...and other unsupported/old flexbox values have been excluded
170
+ ///
171
+ /// @todo Do special checks for 'flex-flow'
172
+ ///
173
+ /// @param {Map} $settings - flexbox container property or alias : flexbox value.
174
+
175
+ @mixin flex-display($value:flex, $display:false) {
176
+ @include flex-container((display:$value), $display);
177
+ }
178
+
179
+ @mixin flex-direction($value, $display:false) {
180
+ @include flex-container((direction:$value), $display);
181
+ }
182
+
183
+ @mixin flex-wrap($value, $display:false) {
184
+ @include flex-container((wrap:$value), $display);
185
+ }
186
+
187
+ @mixin flex-flow($value, $display:false) {
188
+ @include flex-container((flow:$value), $display);
189
+ }
190
+
191
+ @mixin flex-justify-content($value, $display:false) {
192
+ @include flex-container((justify:$value), $display);
193
+ }
194
+
195
+ @mixin flex-align-items($value, $display:false) {
196
+ @include flex-container((items:$value), $display);
197
+ }
198
+
199
+ @mixin flex-align-content($value, $display:false) {
200
+ @include flex-container((content:$value), $display);
201
+ }
@@ -0,0 +1,235 @@
1
+ /// Quick mixin to devide a flex item using basis
2
+ ///
3
+ /// @author Mark Notton
4
+ ///
5
+ /// @access public
6
+ ///
7
+ @mixin flex-grid($count, $gutter:$pad) {
8
+ @if $count <= 1 {
9
+ @include flex-basis(auto);
10
+ }
11
+ @elseif $count > 1 {
12
+ @if is-number($gutter) and $gutter != null and strip(to-number($gutter)) > 0 {
13
+ @include flex-basis(calc(100% / #{$count} - #{addUnit($gutter)}));
14
+ } @else {
15
+ @include flex-basis(calc(100% / #{$count}));
16
+ }
17
+ }
18
+ }
19
+
20
+ @function _get-next-breakpoint($setting) {
21
+ @if is_number($setting) and contains(map-values($breakpoints), $setting) {
22
+ // This gets the next available breakpoint from the list of breakpoints. The if-statment is a check if the last breakpoint item is queried.
23
+ @return if(index(map-values($breakpoints), $setting) >= length(map-values($breakpoints)), null, nth(map-values($breakpoints), (index(map-values($breakpoints), $setting) + 1)));
24
+ } @elseif is_string($setting) and map-has-key($breakpoints, $setting) {
25
+ @return map-get-next($breakpoints, $setting);
26
+ } @else {
27
+ @return $setting;
28
+ }
29
+ }
30
+
31
+ // 4 $pad $max, 2 0 $medium, $small
32
+ // 4, 2,
33
+ // @include smart-flex-grid('section', 3 $pad, 2 $pad0 $max, 1 $pad0 bottom $large);
34
+
35
+ @mixin smart-flex-grid($settings...) {
36
+ $nth : 0;
37
+ $selector : null;
38
+
39
+ $settings-list : _arglist-to-list($settings);
40
+
41
+ $multiple-settings : length($settings-list) > 1;
42
+
43
+ $sssbreak : null;
44
+
45
+ // @debug $multiple-settings;
46
+
47
+ @each $settings in $settings-list {
48
+
49
+ @if (length($settings) == 1 and is-string(nth($settings, 1))) {
50
+ // If the current element is the same one that was passed as the first param,
51
+ // don't bother setting the $selector variable and revert to the more generic first of every element;
52
+ @if last(last(to-list(&))) != $settings {
53
+ $selector : $settings;
54
+ } @else {
55
+ $selector : '> *';
56
+ }
57
+ @include flex-container((direction:row, wrap:wrap, justify:stretch-between));
58
+ } @else {
59
+
60
+ $nth : $nth + 1;
61
+ $count : null;
62
+ $gutter : null;
63
+ $grow : null;
64
+ $break : null;
65
+ $next-break : null;
66
+ $gutter-position : ();
67
+ $container : null;
68
+
69
+ @each $setting in $settings {
70
+
71
+ @if is_number($setting) {
72
+ @if is_null($count) {
73
+ $count : $setting;
74
+ } @elseif is_null($gutter) {
75
+ $gutter : $setting;
76
+ } @elseif is_null($break) {
77
+ // $next-break : _get-next-breakpoint($setting);
78
+ $break : $setting;
79
+ }
80
+ }
81
+ @if is_string($setting) {
82
+ @if contains((top bottom left right all), $setting) {
83
+ $gutter-position : append($gutter-position, $setting);
84
+ } @elseif contains((grow), $setting) {
85
+ $grow : true;
86
+ } @elseif map-has-key($breakpoints, $setting) {
87
+ // $next-break : _get-next-breakpoint($setting);
88
+ $break : map-get($breakpoints, $setting);
89
+ }
90
+ }
91
+ @if is_map($setting) {
92
+ $container : $setting;
93
+ }
94
+
95
+ // $next-break : _get-next-breakpoint($setting);
96
+ //@if is_null($break) and length($settings-list) >= 2 {
97
+ // $break : nth($breakpoints, $nth);
98
+
99
+ // @if $nth == 1 {
100
+ // // First
101
+ // $break : $max;
102
+ // $sssbreak : $max;
103
+ // }
104
+
105
+
106
+
107
+ // @if $nth != 1 {
108
+ // @debug $break;
109
+ // // Other settings
110
+ // $break : _get-next-breakpoint($sssbreak);
111
+ // }
112
+ //}
113
+ // $break : if(is_null($break) and $nth == 1, $max, $break);
114
+ // $next-break : if(is_null($next-break) and $multiple-settings and $nth != 1, _get-next-breakpoint($break), $next-break);
115
+ // $break : if(is_null($break) and $nth != 1, $next-break, $break);
116
+ }
117
+
118
+ // Set default gutter position if not defined
119
+ @if length($gutter-position) == 0 { $gutter-position : left right bottom }
120
+
121
+ @if not is-null($container) {
122
+ @include break($break) {
123
+ @include flex-container($container);
124
+ @debug $container;
125
+ }
126
+ }
127
+
128
+ #{if(is-null($selector), '&', $selector)} {
129
+
130
+ // max-width:100% / $count;
131
+
132
+ @include break($break) {
133
+
134
+ @if not is-null($grow) {
135
+ @include flex-grow(1);
136
+ }
137
+
138
+ @if $count <= 1 {
139
+ @include flex-basis(auto); @include flex-grow(1);
140
+ }
141
+ @elseif $count > 1 {
142
+ @if is-number($gutter) and $gutter != null and strip(to-number($gutter)) > 0 {
143
+ @include flex-basis(calc(100% / #{$count} - #{addUnit($gutter)}));
144
+ } @else {
145
+ @include flex-basis(calc(100% / #{$count}));
146
+ }
147
+ }
148
+
149
+
150
+ // // Margins and their positions
151
+ // @if contains(left right, $gutter-position, true) {
152
+ // // $gutter-position contains BOTH left and right, and nothing more
153
+ // margin-left:addUnit($gutter/2);
154
+ // margin-right:addUnit($gutter/2);
155
+ // } @elseif contains(top left, $gutter-position, true) {
156
+ // // $gutter-position contains BOTH top and bottom, and nothing more
157
+ // margin-top:addUnit($gutter/2);
158
+ // margin-bottom:addUnit($gutter/2);
159
+ // } @elseif contains((left right top bottom), $gutter-position) {
160
+ // // $gutter-position contains EITHER left, right, top, bottom
161
+ // $gp : _list-items-to-strings($gutter-position);
162
+
163
+ // @if index($gp, 'left') and index($gp, 'right') {
164
+ // margin-left:addUnit($gutter/2);
165
+ // margin-right:addUnit($gutter/2);
166
+ // } @else {
167
+ // margin-left :if(index($gp, 'left'), addUnit($gutter), null);
168
+ // margin-right :if(index($gp, 'right'), addUnit($gutter), null);
169
+ // }
170
+ // @if index($gp, 'top') and index($gp, 'bottom') {
171
+ // margin-top:addUnit($gutter/2);
172
+ // margin-bottom:addUnit($gutter/2);
173
+ // } @else {
174
+ // margin-top: if(index($gp, 'top'), addUnit($gutter), null);
175
+ // margin-bottom:if(index($gp, 'bottom'), addUnit($gutter), null);
176
+ // }
177
+
178
+ // } @elseif contains((all), $gutter-position) {
179
+ // margin:addUnit($gutter/2);
180
+ // }
181
+
182
+ // TODO: Fix issue of repeat CSS output. The above code is close.
183
+ // Margins and their positions
184
+ @if contains(left right, $gutter-position, true) {
185
+ // $gutter-position contains BOTH left and right, and nothing more
186
+ margin-left:addUnit($gutter/2);
187
+ margin-right:addUnit($gutter/2);
188
+ } @elseif contains(top left, $gutter-position, true) {
189
+ // $gutter-position contains BOTH top and bottom, and nothing more
190
+ margin-top:addUnit($gutter/2);
191
+ margin-bottom:addUnit($gutter/2);
192
+ } @elseif contains((left right top bottom), $gutter-position) {
193
+ // $gutter-position contains EITHER left, right, top, bottom
194
+ $gp : _list-items-to-strings($gutter-position);
195
+ $ml : null;
196
+ $mr : null;
197
+ $mt : null;
198
+ $mb : null;
199
+
200
+ @if index($gp, 'left') and index($gp, 'right') {
201
+ $ml:addUnit($gutter/2);
202
+ $mr:addUnit($gutter/2);
203
+ }
204
+ @if index($gp, 'top') and index($gp, 'bottom') {
205
+ $mt:addUnit($gutter/2);
206
+ $mb:addUnit($gutter/2);
207
+ }
208
+
209
+ @each $g in $gp {
210
+ margin-left : if(is-null($ml), if($g == 'left', addUnit($gutter), 0), $ml);
211
+ margin-right : if(is-null($mr), if($g == 'right', addUnit($gutter), 0), $mr);
212
+ margin-top : if(is-null($mt), if($g == 'top', addUnit($gutter), 0), $mt);
213
+ margin-bottom: if(is-null($mb), if($g == 'bottom', addUnit($gutter), 0), $mb);
214
+ }
215
+
216
+ } @elseif contains((all), $gutter-position) {
217
+ margin:addUnit($gutter/2);
218
+ }
219
+ }
220
+ }
221
+ //}
222
+
223
+ // $next-break : map-get-next($breakpoints, $break);
224
+
225
+ // @debug "Setting: " + #{$nth};
226
+ // @debug "count: " + #{$count};
227
+ // @debug "gutter: " + #{$gutter};
228
+ // @debug "break: " + #{$break};
229
+ // @debug "next-break: " + #{$next-break};
230
+ // @debug "gutter-positions: " + #{$gutter-position};
231
+ // @debug "---";
232
+ }
233
+
234
+ }
235
+ }