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,189 @@
1
+ /// Transition mixin handles animation for any number of transitions in any format/order
2
+ ///
3
+ /// @author Mark Notton
4
+ ///
5
+ /// @access public
6
+ ///
7
+ /// @todo Stagger option. Make it so each transition happens one after the other, regardless of delay
8
+ ///
9
+ /// @param {arglist} $args - Pass in the following transtion settings, in any order.
10
+ /// [property] - width, margin, rotate, skew, color, etc...
11
+ /// [delay] - delay times are always calculated in seconds (not miliseconds). You do not have to define the 's'
12
+ /// [ease-type] - ease-in, ease-in-out etc... You can also refer to the eases variables. $easeInSine, $easeInOutBack
13
+ /// [duration] - duration times are always calculated in seconds (not miliseconds). You do not have to define the 's'
14
+ /// [direction] - forwards, default, backwards, reverse. direction should be in it's own argment, not part of a list of transition settings. It can however be in the same argument as 'stagger'.
15
+ /// Directions can be backwards or forwards (default). Setting it backwards will reverse the order
16
+ /// of the delays if more than one argument has been made.
17
+ /// [stagger] - stagger should be in it's own argment, not part of a list of transition settings. It can however be in the same argument as 'direction'.
18
+ /// Stagger can be defined just by passing the string 'stagger'. This will add previous transition delays and directions to the current
19
+ /// transtion so each argument is called one after the other.
20
+ /// [off] - passing off within any argument will ignore everything and set the transition to 'initial'. Essentially disabling all transitions
21
+ ///
22
+ /// @require {Mixin} contains
23
+ /// @require {Mixin} prepend
24
+ /// @require {Mixin} prefixer
25
+ /// @require {Variables} eases - optional
26
+ ///
27
+ /// @example scss - Usage
28
+ /// .foo {
29
+ /// @include transition(
30
+ /// background-color 0 ease-in,
31
+ /// border-radius 0.5 ease-out,
32
+ /// rotate 1 1 $easeInOutBack,
33
+ /// reverse
34
+ /// );
35
+ /// }
36
+ ///
37
+ /// @example css - CSS output
38
+ /// .foo {
39
+ /// -webkit-transition: background-color 0.2s ease-in 0s, border-radius 0.2s ease-out 0.5s, -webkit-transform 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) 1s;
40
+ /// transition: background-color 0.2s ease-in 0s, border-radius 0.2s ease-out 0.5s, transform 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) 1s; }
41
+ /// }
42
+ ///
43
+
44
+ @mixin transition($settings...) {
45
+
46
+ // Default Settings
47
+ $direction : forwards;
48
+ $stagger : false;
49
+
50
+ // Private Settings
51
+ $transitions : ();
52
+ $transitions-webkit : ();
53
+ $animations : ();
54
+ $delays : ();
55
+ $eases : ();
56
+ $durations : ();
57
+ $off : false;
58
+
59
+ // Quick check to make sure anything at all has been passed.
60
+ // If not, set 'all' as the default transition
61
+ // $args: if(length($args) > 0, $args, all);
62
+
63
+ $settings-list : _arglist-to-list($settings);
64
+
65
+ // Loop through and check all arguments for any special options
66
+ @each $settings in $settings-list {
67
+ @if contains($settings, forwards default backwards reverse) {
68
+ $direction : $settings;
69
+ } @elseif contains($settings, stagger) {
70
+ $stagger : true;
71
+ } @elseif contains($settings, off) {
72
+ $off : true;
73
+ }
74
+ }
75
+
76
+ @if $off == true {
77
+ @include prefixer(transition, initial);
78
+ }
79
+
80
+ // Loop through and set all the necessary settings for each animation set
81
+ @each $settings in $settings-list {
82
+
83
+ // Default Settings
84
+ $animation : ();
85
+ $duration : 0.2;
86
+ $ease : ease-in-out;
87
+ $delay : 0;
88
+
89
+ // Private Settings
90
+ $excluded : false;
91
+ $value-counter : 0;
92
+
93
+ @each $setting in $settings {
94
+ // Check a range of special rules. Exclude this transition if this is true.
95
+ @if contains($setting, forwards default backwards reverse stagger) {
96
+ $excluded : true;
97
+ } @else {
98
+ // Checks for 'strings'
99
+ @if type-of($setting) == string {
100
+ @if contains(str-slice(#{$setting}, 0, 4), ease line step cubi init) {
101
+ // If the first 4 characters of the string match the first 4 characters
102
+ // of a ease type, update the ease variable
103
+ $ease : $setting;
104
+ } @elseif contains($setting, transform matrix translate translateX translateY scale scaleX scaleY rotate skew skewX skewY matrix3d translate3d translateZ scale3d scaleZ rotate3d rotateX rotateY rotateZ perspective) {
105
+ // If the string mataches a transform type, define the animation as a transform
106
+ $animation : append($animation, transform);
107
+ } @else {
108
+ $animation : append($animation, $setting);
109
+ }
110
+ }
111
+ // Checks for 'numbers'
112
+ @if type-of($setting) == number {
113
+ @if $value-counter < 1 {
114
+ // Add the first instance of a number as the delay
115
+ $delay : $setting;
116
+ $value-counter : $value-counter + 1;
117
+ } @elseif $value-counter >= 1 {
118
+ // Add the second instance of a number as the duration
119
+ $duration : $setting;
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ @if not $excluded {
126
+ // Quick check to make sure animation has a fallback if none were defined
127
+ $animations : if(length($animation) == 0, append($animations, all), append($animations, $animation));
128
+ // Quick check for the direction rule. If backwards or reversed, add delays the the start of the $delays list
129
+ $delays : if(contains($direction, backwards reverse), prepend($delays, $delay), append($delays, $delay));
130
+ $eases : append($eases, $ease);
131
+ $durations : append($durations, $duration);
132
+ }
133
+ }
134
+
135
+ // Loop through all the animations and add the transition to the overall transitions list
136
+ @for $i from 1 through length($animations) {
137
+ $animation : nth($animations, $i);
138
+ $duration : nth($durations, $i);
139
+ $ease : nth($eases, $i);
140
+ $delay : nth($delays, $i);
141
+ @each $ani in $animation {
142
+ $transition : ($ani #{$duration + 's'} $ease #{$delay + 's'});
143
+ $transitions : append($transitions, $transition, comma);
144
+
145
+ $transition-webkit : (if($ani == transform, -#{webkit}-#{$ani}, $ani) #{$duration + 's'} $ease #{$delay + 's'});
146
+ $transitions-webkit : append($transitions-webkit, $transition-webkit, comma);
147
+ }
148
+ }
149
+
150
+ @include prefixer(transition, $transitions-webkit, webkit only);
151
+ @include prefixer(transition, $transitions, null);
152
+
153
+ }
154
+
155
+ @mixin transition-remove() {
156
+ @include prefixer(transition, initial, webkit);
157
+ }
158
+
159
+
160
+ /// @alias transition-delay
161
+ ///
162
+ /// @access public
163
+ ///
164
+ /// @require {mixin} transition-delay
165
+ ///
166
+ /// @return
167
+
168
+ @mixin ani-remove() {
169
+ @include transition-remove();
170
+ }
171
+
172
+ /// @alias transition
173
+ @mixin ani($settings...) { @include transition($settings...); }
174
+
175
+ @mixin transition-delay($time) {
176
+ @include prefixer(transition-delay, addUnit($time, s), webkit);
177
+ }
178
+
179
+ /// @alias transition-delay
180
+ ///
181
+ /// @access public
182
+ ///
183
+ /// @require {mixin} transition-delay
184
+ ///
185
+ /// @return
186
+
187
+ @mixin dalay($time) {
188
+ @include transition-delay($time);
189
+ }
@@ -0,0 +1,170 @@
1
+ /// Create a triangle/carrat/arrow
2
+ ///
3
+ /// @param {list} $args
4
+ /// In any order and without comma delimination, add any of the follwing arrow settings
5
+ /// Colour { color } - Hex or RGBA
6
+ /// Width { int } - First intiger is used as the width. 'px' units are used by defualt if not specified.
7
+ /// Height { int } - Second intiger is used as the height. 'px' units are used by defualt if not specified. Width is used if second unit is not found.
8
+ /// Direction { string } - top-left, up, top-right, left, right, bottom-left, down, bottom-right.
9
+ /// Center { string } - In addition to the direction, you can add the unquote string 'center' to center the arrow
10
+ /// Sudo { string } - Use an unquote string 'before' or 'after' to distinguish what sudo element to use
11
+ ///
12
+ /// @param {bool} $position
13
+ /// Determines wether the arrow should be positioned at all
14
+ ///
15
+ /// @require {map} triangle-settings
16
+ /// @require {function} random-color
17
+ /// @require {function} map-fetch
18
+ /// @require {function} is-calc
19
+ ///
20
+ ///
21
+ /// @example {scss} - Usage
22
+ /// @include triangle-classic(50% 20 purple right);
23
+ /// @include triangle-classic(100 100 green up center after);
24
+ ///
25
+ /// @return {sudo}
26
+
27
+
28
+ @mixin triangle-classic($args...) {
29
+
30
+ // Deafult Triangle Settings
31
+ $size : ();
32
+ $sudo : before;
33
+ $colour : random-colour();
34
+ $direction : right;
35
+ $center : false;
36
+ $triangle : map-fetch($triangle-settings, $direction, points);
37
+
38
+ // Deafult Position Settings
39
+ $position : true;
40
+ $x-pos : nth(map-fetch($triangle-settings, $direction, x), 1);
41
+ $x-amount : nth(map-fetch($triangle-settings, $direction, x), 2);
42
+ $y-pos : nth(map-fetch($triangle-settings, $direction, y), 1);
43
+ $y-amount : nth(map-fetch($triangle-settings, $direction, y), 2);
44
+
45
+ $args: if(length($args) > 0, $args, null);
46
+
47
+ // Loop through and check all arguments for any special options.
48
+
49
+ @for $i from 1 through length($args) {
50
+ @each $option in nth($args, $i) {
51
+ // If there is an arugment, with just one value, and it's set to true or false.
52
+ // Assume this is the position condition.
53
+ @if type-of($option) == bool and length(nth($args, $i)) == 1 {
54
+ $position : $option;
55
+ }
56
+ }
57
+ }
58
+
59
+ // Check Triangle Settings
60
+ @each $rule in nth($args, 1) {
61
+
62
+ @if type-of($rule) == number or is-calc($rule) and length($size) < 2 {
63
+ $size : append($size, $rule);
64
+ }
65
+ @elseif type-of($rule) == color {
66
+ $colour : $rule;
67
+ }
68
+ @elseif type-of($rule) == string {
69
+ @if $rule == before or $rule == after {
70
+ $sudo : unquote($rule);
71
+ }
72
+ @elseif $rule == center {
73
+ $center : true;
74
+ }
75
+ @elseif map-has-key($triangle-settings, $rule) {
76
+ $direction: $rule;
77
+
78
+ $x:map-fetch($triangle-settings, $direction, x);
79
+ $x-pos:nth($x, 1);
80
+ $x-amount:nth($x, 2);
81
+
82
+ $y:map-fetch($triangle-settings, $direction, y);
83
+ $y-pos:nth($y, 1);
84
+ $y-amount:nth($y, 2);
85
+ }
86
+ }
87
+ }
88
+
89
+ // Deafult size set if it remains empty
90
+ $size : if(length($size) == 0, 50, $size);
91
+
92
+ // Define width and height
93
+ $width : nth($size, 1);
94
+ $height : if(length($size) == 1, $width, nth($size, 2));
95
+
96
+ // Define all settings with strings
97
+
98
+ &#{_sudo($sudo)} {
99
+ content:"";
100
+ position:absolute;
101
+ height:0;
102
+ width:0;
103
+ border-style:solid;
104
+ border-color:transparent;
105
+ border-width:0;
106
+ pointer-events:none;
107
+
108
+ @if $center {
109
+ top:calc(50% - #{addUnit($height)}/2); left:calc(50% - #{addUnit($width)}/2);
110
+ } @elseif ($position) {
111
+ @if $direction == up or $direction == down {
112
+ #{$y-pos}:calc(#{$y-amount} - #{addUnit($width)}/2);
113
+ #{$x-pos}:$x-amount;
114
+ }
115
+ @elseif $direction == left {
116
+ #{$y-pos}:$y-amount;
117
+ #{$x-pos}:calc(#{$x-amount} - #{addUnit($height)}/2);
118
+ }
119
+ @elseif $direction == right {
120
+ #{$y-pos}:calc(#{$y-amount} - #{addUnit($height)}/2);
121
+ #{$x-pos}:$x-amount;
122
+ }
123
+ @else {
124
+ #{$y-pos}:$y-amount;
125
+ #{$x-pos}:$x-amount;
126
+ }
127
+ }
128
+
129
+ // Directions
130
+ @if $direction == left {
131
+ border-width:addUnit($height/2) addUnit($width) addUnit($height/2) 0;
132
+ }
133
+ @elseif $direction == right {
134
+ border-width:addUnit($height/2) 0 addUnit($height/2) addUnit($width);
135
+ }
136
+ @elseif $direction == up {
137
+ border-width:0 addUnit($width/2) addUnit($height) addUnit($width/2);
138
+ }
139
+ @elseif $direction == down {
140
+ border-width:addUnit($height) addUnit($width/2) 0 addUnit($width/2);
141
+ }
142
+
143
+ @if contains(left right up down, $direction) {
144
+ border-#{opposite-direction($direction)}-color:$colour;
145
+ }
146
+
147
+ @if $direction == top-left {
148
+ border-width:addUnit($height) addUnit($width) 0 0;
149
+ border-top-color:$colour;
150
+ }
151
+ @elseif $direction == top-right {
152
+ border-width:0 addUnit($width) addUnit($height) 0;
153
+ border-right-color:$colour;
154
+ }
155
+ @elseif $direction == bottom-left {
156
+ border-width:addUnit($height) 0 0 addUnit($width);
157
+ border-left-color:$colour;
158
+ }
159
+ @elseif $direction == bottom-right {
160
+ border-width:0 0 addUnit($height) addUnit($width);
161
+ border-bottom-color:$colour;
162
+ }
163
+
164
+ @if $direction == up { $direction : top; }
165
+ @if $direction == down { $direction : bottom; }
166
+
167
+
168
+ @content;
169
+ }
170
+ }
@@ -0,0 +1,250 @@
1
+ /// Triangle Settings
2
+ ///
3
+ /// @author Mark Notton
4
+ ///
5
+ /// @type variables
6
+
7
+ $triangle-settings: (
8
+ top-left : (
9
+ points : "0,100 0,0 100,0",
10
+ y : ( left , 0 ),
11
+ x : ( top , 0 )
12
+ ),
13
+ up : (
14
+ points : "100,100 0,100 50,0",
15
+ y : ( left , 50% ),
16
+ x : ( bottom , 100% )
17
+ ),
18
+ top-right : (
19
+ points : "100,100 0,0 100,0",
20
+ y : ( right , 0 ),
21
+ x : ( top , 0 )
22
+ ),
23
+ left : (
24
+ points : "100,100 0,50 100,0",
25
+ y : ( right , 100% ),
26
+ x : ( top , 50% )
27
+ ),
28
+ right : (
29
+ points : "0,100 0,0 100,50",
30
+ y : ( top , 50% ),
31
+ x : ( left , 100% )
32
+ ),
33
+ bottom-left : (
34
+ points : "100,100 0,100 0,0",
35
+ y : ( left , 0 ),
36
+ x : ( bottom , 0 )
37
+ ),
38
+ down : (
39
+ points : "0,0 100,0 50,100",
40
+ y : ( left , 50% ),
41
+ x : ( top , 100% )
42
+ ),
43
+ bottom-right : (
44
+ points : "0,100 100,0 100,100",
45
+ y : ( bottom , 0 ),
46
+ x : ( right , 0 )
47
+ ),
48
+ );
49
+
50
+
51
+ /// Create a triangle/carrat/arrow
52
+ ///
53
+ /// @todo Figure a way to animate the fill colour of the svg background
54
+ /// @todo Get Stroke Alignment to work "inner".
55
+ ///
56
+ /// @param {list} $args
57
+ /// In any order and without comma delimination, add any of the follwing arrow settings
58
+ /// Colour { color } - Hex or RGBA
59
+ /// Width { int } - First intiger is used as the width. 'px' units are used by defualt if not specified.
60
+ /// Height { int } - Second intiger is used as the height. 'px' units are used by defualt if not specified. Width is used if second unit is not found.
61
+ /// Direction { string } - top-left, up, top-right, left, right, bottom-left, down, bottom-right.
62
+ /// Center { string } - In addition to the direction, you can add the unquote string 'center' to center the arrow
63
+ /// Sudo { string } - Use an unquote string 'before' or 'after' to distinguish what sudo element to use
64
+ ///
65
+ /// @param {bool} $position
66
+ /// Determines wether the arrow should be positioned at all
67
+ ///
68
+ /// @require {map} triangle-settings
69
+ /// @require {function} random-color
70
+ /// @require {function} map-fetch
71
+ /// @require {function} is-calc
72
+ ///
73
+ ///
74
+ /// @example {scss} - Usage
75
+ /// @include arrow(50% 20 purple right);
76
+ /// @include arrow(100 100 green up center after);
77
+ ///
78
+ /// @return {sudo}
79
+
80
+ @mixin triangle($args...) {
81
+
82
+ // Deafult Triangle Settings
83
+ $size : ();
84
+ $sudo : before;
85
+ $colour : random-colour();
86
+ $direction : right;
87
+ $center : false;
88
+ $triangle : map-fetch($triangle-settings, $direction, points);
89
+
90
+ // Deafult Position Settings
91
+ $position : true;
92
+ $x-pos : nth(map-fetch($triangle-settings, $direction, x), 1);
93
+ $x-amount : nth(map-fetch($triangle-settings, $direction, x), 2);
94
+ $y-pos : nth(map-fetch($triangle-settings, $direction, y), 1);
95
+ $y-amount : nth(map-fetch($triangle-settings, $direction, y), 2);
96
+
97
+ // Deafult Stroke Settings
98
+ $stroke : false;
99
+ $s-colour : random-colour();
100
+ $s-width : 5;
101
+ $s-linecap : round;
102
+ $s-linejoin : round;
103
+ $s-dasharray : null;
104
+
105
+ $args: if(length($args) > 0, $args, null);
106
+ $value-counter : 0;
107
+
108
+ // Loop through and check all arguments for any special options
109
+ @for $i from 1 through length($args) {
110
+ @each $option in nth($args, $i) {
111
+ @if type-of($option) == bool and length(nth($args, $i)) == 1 {
112
+ $position : $option;
113
+ } @elseif length($args) > 1 {
114
+ $stroke : nth($args, $i);
115
+ }
116
+ }
117
+ }
118
+
119
+ // Check Triangle Settings
120
+ @each $rule in nth($args, 1) {
121
+
122
+ @if type-of($rule) == number or is-calc($rule) and length($size) < 2 {
123
+ $size : append($size, $rule);
124
+ }
125
+ @elseif type-of($rule) == color {
126
+ $colour : $rule;
127
+ }
128
+ @elseif type-of($rule) == string {
129
+ @if $rule == before or $rule == after {
130
+ $sudo : unquote($rule);
131
+ }
132
+ @elseif $rule == center {
133
+ $center : true;
134
+ }
135
+ @elseif map-has-key($triangle-settings, $rule) {
136
+ $direction: $rule;
137
+ $triangle: map-fetch($triangle-settings, $direction, points);
138
+
139
+ $x:map-fetch($triangle-settings, $direction, x);
140
+ $x-pos:nth($x, 1);
141
+ $x-amount:nth($x, 2);
142
+
143
+ $y:map-fetch($triangle-settings, $direction, y);
144
+ $y-pos:nth($y, 1);
145
+ $y-amount:nth($y, 2);
146
+ }
147
+ }
148
+ }
149
+
150
+ // Check Stroke Settings
151
+ @if $stroke {
152
+ @each $rule in $stroke {
153
+ @if type-of($rule) == string {
154
+ @if index((butt round square), $rule) {
155
+ $s-linecap : $rule;
156
+ }
157
+ @if index((miter miter-clip round bevel arcs), $rule) {
158
+ $s-linejoin : $rule;
159
+ }
160
+ }
161
+ @elseif type-of($rule) == list {
162
+ @each $dash in $rule {
163
+ $s-dasharray: append($s-dasharray, $dash, comma);
164
+ }
165
+ }
166
+ @elseif type-of($rule) == color {
167
+ $s-colour : $rule;
168
+ }
169
+ @elseif type-of($rule) == number {
170
+ @if $value-counter < 1 {
171
+ $s-width : $rule;
172
+ $value-counter : $value-counter + 1;
173
+ } @elseif $value-counter >= 1 {
174
+ $s-dasharray : ($rule, $rule);
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ // Deafult size set if it remains empty
181
+ $size : if(length($size) == 0, 50, $size);
182
+
183
+ // Define width and height
184
+ $width : nth($size, 1);
185
+ $height : if(length($size) == 1, $width, nth($size, 2));
186
+
187
+ // Define all settings with strings
188
+ $fill : "' fill='" + _hash-fix($colour);
189
+
190
+ @if $stroke {
191
+ $s-colour : "' stroke='" + _hash-fix($s-colour);
192
+ $s-width : "' stroke-width='" + strip($s-width);
193
+ $s-alignment : "' stroke-alignment='inner";
194
+ $s-linecap : if($s-linecap, "' stroke-linecap='" + $s-linecap, '');
195
+ $s-linejoin : if($s-linejoin, "' stroke-linejoin='" + $s-linejoin, '');
196
+ $s-dasharray : if($s-dasharray, "' stroke-dasharray='" + $s-dasharray, '');
197
+ }
198
+
199
+ &#{_sudo($sudo)} {
200
+ content:"";
201
+ @include size($width $height);
202
+ position:absolute;
203
+ pointer-events:none;
204
+ background-image:svg("<svg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 100 100'><polygon points='" + $triangle + $fill + if($stroke, $s-colour + $s-linecap + $s-linejoin + $s-width + $s-alignment + $s-dasharray,'') + "'/></svg>");
205
+ background-size:100% 100%;
206
+ background-repeat:no-repeat;
207
+ @if $center {
208
+ top:calc(50% - #{addUnit($height)}/2); left:calc(50% - #{addUnit($width)}/2);
209
+ } @elseif ($position) {
210
+ @if $direction == up or $direction == down {
211
+ #{$y-pos}:calc(#{$y-amount} - #{addUnit($width)}/2);
212
+ #{$x-pos}:$x-amount;
213
+ }
214
+ @elseif $direction == left {
215
+ #{$y-pos}:$y-amount;
216
+ #{$x-pos}:calc(#{$x-amount} - #{addUnit($height)}/2);
217
+ }
218
+ @elseif $direction == right {
219
+ #{$y-pos}:calc(#{$y-amount} - #{addUnit($height)}/2);
220
+ #{$x-pos}:$x-amount;
221
+ }
222
+ @else {
223
+ #{$y-pos}:$y-amount;
224
+ #{$x-pos}:$x-amount;
225
+ }
226
+ }
227
+
228
+ @content;
229
+ }
230
+
231
+ @include ie {
232
+ @include triangle-classic($width $height $colour $direction $sudo) { background-image:none $imp; @content };
233
+ }
234
+ }
235
+
236
+
237
+ /// @alias triangle
238
+ ///
239
+ /// @access public
240
+ ///
241
+ /// @require {mixin} triangle
242
+ ///
243
+ /// @return {*}
244
+
245
+ @mixin arrow($args...) {
246
+ @include triangle($args...) {
247
+ @content
248
+ }
249
+ }
250
+