archetype 0.0.1.pre.1 → 0.0.1.pre.3.00dfd9a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +88 -0
  3. data/LICENSE +16 -0
  4. data/README.md +87 -1
  5. data/VERSION.yml +6 -0
  6. data/lib/README.rdoc +4 -0
  7. data/lib/archetype.rb +45 -0
  8. data/lib/archetype/functions.rb +9 -0
  9. data/lib/archetype/functions/hash.rb +149 -0
  10. data/lib/archetype/functions/helpers.rb +125 -0
  11. data/lib/archetype/functions/styleguide_memoizer.rb +61 -0
  12. data/lib/archetype/sass_extensions.rb +6 -0
  13. data/lib/archetype/sass_extensions/functions.rb +14 -0
  14. data/lib/archetype/sass_extensions/functions/environment.rb +14 -0
  15. data/lib/archetype/sass_extensions/functions/lists.rb +284 -0
  16. data/lib/archetype/sass_extensions/functions/locale.rb +77 -0
  17. data/lib/archetype/sass_extensions/functions/numbers.rb +19 -0
  18. data/lib/archetype/sass_extensions/functions/styleguide.rb +406 -0
  19. data/lib/archetype/sass_extensions/functions/ui.rb +59 -0
  20. data/lib/archetype/sass_extensions/functions/version.rb +95 -0
  21. data/lib/archetype/version.rb +75 -0
  22. data/stylesheets/_archetype.scss +2 -0
  23. data/stylesheets/archetype/_base.scss +46 -0
  24. data/stylesheets/archetype/_config.scss +366 -0
  25. data/stylesheets/archetype/_grid.scss +3 -0
  26. data/stylesheets/archetype/_hacks.scss +72 -0
  27. data/stylesheets/archetype/_init.scss +23 -0
  28. data/stylesheets/archetype/_styleguide.scss +6 -0
  29. data/stylesheets/archetype/_ui.scss +326 -0
  30. data/stylesheets/archetype/_util.scss +12 -0
  31. data/stylesheets/archetype/base/_h5bp.scss +307 -0
  32. data/stylesheets/archetype/base/_hybrid.scss +25 -0
  33. data/stylesheets/archetype/base/_normalize.scss +595 -0
  34. data/stylesheets/archetype/base/_reset.scss +72 -0
  35. data/stylesheets/archetype/grid/_config.scss +14 -0
  36. data/stylesheets/archetype/grid/_grid.scss +391 -0
  37. data/stylesheets/archetype/styleguide/_components.scss +25 -0
  38. data/stylesheets/archetype/styleguide/_helpers.scss +215 -0
  39. data/stylesheets/archetype/styleguide/_primitives.scss +10 -0
  40. data/stylesheets/archetype/styleguide/_styleguide.scss +41 -0
  41. data/stylesheets/archetype/styleguide/components/_alerts.scss +59 -0
  42. data/stylesheets/archetype/styleguide/components/_annotations.scss +27 -0
  43. data/stylesheets/archetype/styleguide/components/_bristol.scss +15 -0
  44. data/stylesheets/archetype/styleguide/components/_button_groups.scss +47 -0
  45. data/stylesheets/archetype/styleguide/components/_button_toolbars.scss +17 -0
  46. data/stylesheets/archetype/styleguide/components/_buttons.scss +338 -0
  47. data/stylesheets/archetype/styleguide/components/_canvas.scss +15 -0
  48. data/stylesheets/archetype/styleguide/components/_carets.scss +336 -0
  49. data/stylesheets/archetype/styleguide/components/_closes.scss +63 -0
  50. data/stylesheets/archetype/styleguide/components/_container.scss +27 -0
  51. data/stylesheets/archetype/styleguide/components/_copy.scss +85 -0
  52. data/stylesheets/archetype/styleguide/components/_flyouts.scss +52 -0
  53. data/stylesheets/archetype/styleguide/components/_headings.scss +33 -0
  54. data/stylesheets/archetype/styleguide/components/_headlines.scss +63 -0
  55. data/stylesheets/archetype/styleguide/components/_hovercards.scss +27 -0
  56. data/stylesheets/archetype/styleguide/components/_icons.scss +17 -0
  57. data/stylesheets/archetype/styleguide/components/_identities.scss +34 -0
  58. data/stylesheets/archetype/styleguide/components/_links.scss +66 -0
  59. data/stylesheets/archetype/styleguide/components/_loaders.scss +154 -0
  60. data/stylesheets/archetype/styleguide/components/_menu_items.scss +31 -0
  61. data/stylesheets/archetype/styleguide/components/_module.scss +15 -0
  62. data/stylesheets/archetype/styleguide/components/_pullquotes.scss +29 -0
  63. data/stylesheets/archetype/styleguide/components/_punchcut.scss +18 -0
  64. data/stylesheets/archetype/styleguide/components/_tooltips.scss +28 -0
  65. data/stylesheets/archetype/styleguide/primitives/_animations.scss +17 -0
  66. data/stylesheets/archetype/styleguide/primitives/_dimensions.scss +50 -0
  67. data/stylesheets/archetype/styleguide/primitives/_glyphs.scss +11 -0
  68. data/stylesheets/archetype/styleguide/primitives/_misc.scss +8 -0
  69. data/stylesheets/archetype/styleguide/primitives/_palettes.scss +94 -0
  70. data/stylesheets/archetype/styleguide/primitives/_shadows.scss +23 -0
  71. data/stylesheets/archetype/styleguide/primitives/_sprites.scss +46 -0
  72. data/stylesheets/archetype/styleguide/primitives/_textures.scss +10 -0
  73. data/stylesheets/archetype/styleguide/primitives/_typography.scss +56 -0
  74. data/stylesheets/archetype/util/_debug.scss +40 -0
  75. data/stylesheets/archetype/util/_lists.scss +57 -0
  76. data/stylesheets/archetype/util/_misc.scss +108 -0
  77. data/stylesheets/archetype/util/_rtl.scss +279 -0
  78. data/stylesheets/archetype/util/_spacing.scss +78 -0
  79. data/stylesheets/archetype/util/_styles.scss +466 -0
  80. data/stylesheets/archetype/util/_targeting.scss +210 -0
  81. data/stylesheets/archetype/util/_units.scss +18 -0
  82. data/templates/example/index.html +40 -0
  83. data/templates/example/manifest.rb +13 -0
  84. data/templates/example/screen.scss +99 -0
  85. data/templates/example/vendor/archetype/animations/loaders/large/large.png +0 -0
  86. data/templates/example/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
  87. data/templates/example/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
  88. data/templates/example/vendor/archetype/animations/loaders/large/large_static.png +0 -0
  89. data/templates/example/vendor/archetype/animations/loaders/medium/medium.png +0 -0
  90. data/templates/example/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
  91. data/templates/example/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
  92. data/templates/example/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
  93. data/templates/example/vendor/archetype/animations/loaders/small/small.png +0 -0
  94. data/templates/example/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
  95. data/templates/example/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
  96. data/templates/example/vendor/archetype/animations/loaders/small/small_static.png +0 -0
  97. data/templates/example/vendor/archetype/fontawesome-webfont.eot +0 -0
  98. data/templates/example/vendor/archetype/fontawesome-webfont.svg +255 -0
  99. data/templates/example/vendor/archetype/fontawesome-webfont.ttf +0 -0
  100. data/templates/example/vendor/archetype/fontawesome-webfont.woff +0 -0
  101. data/templates/project/manifest.rb +9 -0
  102. data/templates/project/screen.scss +1 -0
  103. data/templates/project/vendor/archetype/animations/loaders/large/large.png +0 -0
  104. data/templates/project/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
  105. data/templates/project/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
  106. data/templates/project/vendor/archetype/animations/loaders/large/large_static.png +0 -0
  107. data/templates/project/vendor/archetype/animations/loaders/medium/medium.png +0 -0
  108. data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
  109. data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
  110. data/templates/project/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
  111. data/templates/project/vendor/archetype/animations/loaders/small/small.png +0 -0
  112. data/templates/project/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
  113. data/templates/project/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
  114. data/templates/project/vendor/archetype/animations/loaders/small/small_static.png +0 -0
  115. data/templates/project/vendor/archetype/fontawesome-webfont.eot +0 -0
  116. data/templates/project/vendor/archetype/fontawesome-webfont.svg +255 -0
  117. data/templates/project/vendor/archetype/fontawesome-webfont.ttf +0 -0
  118. data/templates/project/vendor/archetype/fontawesome-webfont.woff +0 -0
  119. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.eot +0 -0
  120. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.svg +255 -0
  121. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.ttf +0 -0
  122. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.woff +0 -0
  123. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large.png +0 -0
  124. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
  125. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
  126. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_static.png +0 -0
  127. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium.png +0 -0
  128. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
  129. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
  130. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
  131. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small.png +0 -0
  132. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
  133. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
  134. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_static.png +0 -0
  135. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/sprites/hovercard_tip.png +0 -0
  136. data/test/fixtures/stylesheets/archetype/config.rb +19 -0
  137. data/test/fixtures/stylesheets/archetype/expected/b.css +14 -0
  138. data/test/fixtures/stylesheets/archetype/expected/base.css +349 -0
  139. data/test/fixtures/stylesheets/archetype/expected/hacks/ie_pseudo.css +11 -0
  140. data/test/fixtures/stylesheets/archetype/expected/locale.css +23 -0
  141. data/test/fixtures/stylesheets/archetype/expected/styleguide/buttons.css +2091 -0
  142. data/test/fixtures/stylesheets/archetype/expected/styleguide/fallback_styles.css +9 -0
  143. data/test/fixtures/stylesheets/archetype/expected/styleguide/nested_styleguides.css +24 -0
  144. data/test/fixtures/stylesheets/archetype/expected/styleguide/selective_state.css +174 -0
  145. data/test/fixtures/stylesheets/archetype/expected/ui/glyph_icon.css +37 -0
  146. data/test/fixtures/stylesheets/archetype/expected/ui/hide_element.css +8 -0
  147. data/test/fixtures/stylesheets/archetype/expected/ui/stroke.css +17 -0
  148. data/test/fixtures/stylesheets/archetype/expected/ui/triangle.css +35 -0
  149. data/test/fixtures/stylesheets/archetype/expected/utilities/associative.css +9 -0
  150. data/test/fixtures/stylesheets/archetype/expected/utilities/if-set.css +9 -0
  151. data/test/fixtures/stylesheets/archetype/expected/utilities/spacing/horizontal-spacing.css +29 -0
  152. data/test/fixtures/stylesheets/archetype/expected/utilities/spacing/vertical-spacing.css +29 -0
  153. data/test/fixtures/stylesheets/archetype/expected/utilities/styles/filter.css +11 -0
  154. data/test/fixtures/stylesheets/archetype/expected/utilities/styles/font-family.css +16 -0
  155. data/test/fixtures/stylesheets/archetype/expected/utilities/styles/z-index.css +15 -0
  156. data/test/fixtures/stylesheets/archetype/expected/utilities/targeting/target-browser.css +100 -0
  157. data/test/fixtures/stylesheets/archetype/expected/utilities/targeting/target-os.css +55 -0
  158. data/test/fixtures/stylesheets/archetype/source/b.scss +9 -0
  159. data/test/fixtures/stylesheets/archetype/source/base.scss +3 -0
  160. data/test/fixtures/stylesheets/archetype/source/hacks/ie_pseudo.scss +13 -0
  161. data/test/fixtures/stylesheets/archetype/source/locale.scss +43 -0
  162. data/test/fixtures/stylesheets/archetype/source/styleguide/buttons.scss +18 -0
  163. data/test/fixtures/stylesheets/archetype/source/styleguide/fallback_styles.scss +22 -0
  164. data/test/fixtures/stylesheets/archetype/source/styleguide/nested_styleguides.scss +40 -0
  165. data/test/fixtures/stylesheets/archetype/source/styleguide/selective_state.scss +22 -0
  166. data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +13 -0
  167. data/test/fixtures/stylesheets/archetype/source/ui/hide_element.scss +5 -0
  168. data/test/fixtures/stylesheets/archetype/source/ui/stroke.scss +13 -0
  169. data/test/fixtures/stylesheets/archetype/source/ui/triangle.scss +13 -0
  170. data/test/fixtures/stylesheets/archetype/source/utilities/associative.scss +24 -0
  171. data/test/fixtures/stylesheets/archetype/source/utilities/if-set.scss +16 -0
  172. data/test/fixtures/stylesheets/archetype/source/utilities/spacing/horizontal-spacing.scss +27 -0
  173. data/test/fixtures/stylesheets/archetype/source/utilities/spacing/vertical-spacing.scss +27 -0
  174. data/test/fixtures/stylesheets/archetype/source/utilities/styles/filter.scss +9 -0
  175. data/test/fixtures/stylesheets/archetype/source/utilities/styles/font-family.scss +9 -0
  176. data/test/fixtures/stylesheets/archetype/source/utilities/styles/z-index.scss +18 -0
  177. data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +70 -0
  178. data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-os.scss +42 -0
  179. data/test/helpers/diff.rb +49 -0
  180. data/test/helpers/io.rb +36 -0
  181. data/test/helpers/test_case.rb +62 -0
  182. data/test/integrations/archetype_test.rb +126 -0
  183. data/test/test_helper.rb +26 -0
  184. data/test/units/sass_extensions_test.rb +207 -0
  185. metadata +303 -15
@@ -0,0 +1,3 @@
1
+ @import "config";
2
+ @import "util";
3
+ @import "grid/grid";
@@ -0,0 +1,72 @@
1
+ // @category hacks
2
+ @import "util";
3
+
4
+ // hack to support negative margins in legacy IE
5
+ // @mixin hack-negative-margin
6
+ @mixin hack-negative-margin() {
7
+ @if($legacy-support-for-ie6 or $legacy-support-for-ie7) {
8
+ @include has-layout();
9
+ position: relative;
10
+ }
11
+ }
12
+
13
+ // max-height hack
14
+ // @mixin max-height
15
+ // @param $value {String} the height
16
+ @mixin max-height($value) {
17
+ @include hacked-maximum(height, $value);
18
+ }
19
+
20
+ // max-width hack
21
+ // @mixin max-width
22
+ // @param $value {String} the width
23
+ @mixin max-width($value) {
24
+ @include hacked-maximum(width, $value);
25
+ }
26
+
27
+ // generic max-* hack wrapper
28
+ // @mixin hacked-maximum
29
+ // @param $property {String} property [height|width]
30
+ // @param $value {String} the value
31
+ @mixin hacked-maximum($property, $value) {
32
+ max-#{$property}: $value;
33
+ @include bang-hack($property, auto, $value);
34
+ }
35
+
36
+ // proxy for ie-pseudo
37
+ // @mixin ie-pseudo-before
38
+ // @param $styles {String} the styles to apply to the pseudo-element
39
+ // @param $content {String} the content to insert into the element (similar to css `content` attribute)
40
+ // @param $name {String} the name of the element
41
+ @mixin ie-pseudo-before($styles: false, $content: false, $name: '') {
42
+ @include ie-pseudo($styles, $content, before, $name);
43
+ }
44
+
45
+ // proxy for ie-pseudo
46
+ // @mixin ie-pseudo-after
47
+ // @param $styles {String} the styles to apply to the pseudo-element
48
+ // @param $content {String} the content to insert into the element (similar to css `content` attribute)
49
+ // @param $name {String} the name of the element
50
+ @mixin ie-pseudo-after($styles: false, $content: false, $name: '') {
51
+ @include ie-pseudo($styles, $content, after, $name);
52
+ }
53
+
54
+ // this creates a one-type executing expression that inserts an element relative to `this` element.
55
+ // this allows some level of support for :before/:after in IE6/7
56
+ // inspired by http://nicolasgallagher.com/better-float-containment-in-ie/
57
+ // @mixin ie-pseudo
58
+ // @param $styles {String} the styles to apply to the pseudo-element
59
+ // @param $content {String} the content to insert into the element (similar to css `content` attribute)
60
+ // @param $placement {String} [before|after] simulate :before or :after behavior
61
+ // @param $name {String} the name of the element
62
+ @mixin ie-pseudo($styles: false, $content: false, $placement: before, $name: '') {
63
+ @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
64
+ $method: if($placement == before, insertBefore, appendChild);
65
+ $content: if($content and $content != nil, 'this.el.innerHTML="#{-ie-pseudo-content($content)}",', '');
66
+ @if $CONFIG_GENERATED_TAG_CSS {
67
+ $styles: if($styles and $styles != nil, #{$CONFIG_GENERATED_TAG_CSS}#{$styles}, $CONFIG_GENERATED_TAG_CSS);
68
+ }
69
+ $styles: if($styles and $styles != nil, 'this.el.style.cssText="#{$styles}",', '');
70
+ *zoom: expression(this.runtimeStyle.zoom="1", this.el=document.createElement("#{prefixed-tag($name)}"),#{$content}#{$styles}this.#{$method}(this.el));
71
+ }
72
+ }
@@ -0,0 +1,23 @@
1
+ // include configs
2
+ @import "archetype/config";
3
+
4
+ // include Compass mixins
5
+ @import "compass";
6
+
7
+ // utility mixins and helper functions
8
+ @import "archetype/util";
9
+
10
+ // custom hacks
11
+ @import "archetype/hacks";
12
+
13
+ // ui
14
+ @import "archetype/ui";
15
+
16
+ // grids
17
+ @import "archetype/grid";
18
+
19
+ // styleguide
20
+ @import "archetype/styleguide";
21
+
22
+ // base
23
+ @import "archetype/base";
@@ -0,0 +1,6 @@
1
+ @import "config";
2
+ @import "util";
3
+ @import "styleguide/styleguide";
4
+ @import "styleguide/primitives";
5
+ @import "styleguide/helpers";
6
+ @import "styleguide/components";
@@ -0,0 +1,326 @@
1
+ // @category ui
2
+ @import "hacks";
3
+ @import "compass/layout/stretching";
4
+
5
+ // computes the border position to use
6
+ // @function _getTriangleBorderDirection
7
+ // @private
8
+ // @param $direction {String} the direction the arrow is pointing (top, left, top left, etc)
9
+ // @return {List} the computed border position (e.g. top, left, bottom)
10
+ @function _getTriangleBorderDirection($direction) {
11
+ @if(length($direction) == 1) {
12
+ @return opposite-position($direction);
13
+ }
14
+ @return if(index($direction, top), bottom, top);
15
+ }
16
+
17
+ // computes the border width for the triangle
18
+ // @function _getTriangleBorderWidth
19
+ // @private
20
+ // @param $width {Number} the width of the arrow
21
+ // @param $height {Number} the height of the arrow
22
+ // @param $direction {String} the direction the arrow is pointing (top, left, top left, etc)
23
+ // @return {List} the computed border widths
24
+ @function _getTriangleBorderWidth($width, $height, $direction) {
25
+ @if(length($direction) == 1) {
26
+ // TOP
27
+ @if($direction == top) {
28
+ @return 0 ($width/2) $height;
29
+ }
30
+ // BOTTOM
31
+ @else if($direction == bottom) {
32
+ @return $height ($width/2) 0;
33
+ }
34
+ // LEFT
35
+ @else if($direction == left) {
36
+ @return ($height/2) $width ($height/2) 0;
37
+ }
38
+ // RIGHT
39
+ @else if($direction == right) {
40
+ @return ($height/2) 0 ($height/2) $width;
41
+ }
42
+ }
43
+ @else if(index($direction, top)) {
44
+ // TOP LEFT
45
+ @if(index($direction, left)) {
46
+ @return 0 $width $height 0;
47
+ }
48
+ // TOP RIGHT
49
+ @else {
50
+ @return 0 0 $height $width;
51
+ }
52
+ }
53
+ @else if(index($direction, bottom)) {
54
+ // BOTTOM LEFT
55
+ @if(index($direction, left)) {
56
+ @return $height $width 0 0;
57
+ }
58
+ // BOTTOM RIGHT
59
+ @else {
60
+ @return $height 0 0 $width;
61
+ }
62
+ }
63
+ @return 0;
64
+ }
65
+
66
+ // generates a cross-browser triangle using borders
67
+ // @mixin triangle
68
+ // @param $direction {String} the direction the arrow is pointing (top, left, top left, etc)
69
+ // @param $width {Number} the width of the arrow
70
+ // @param $height {Number} the height of the arrow
71
+ // @param $color {Color} the color of the arrow
72
+ @mixin triangle($direction: bottom, $width: 1em, $height: false, $color: #aaa) {
73
+ $direction: rtl($direction);
74
+ // if no height was specified, assume it's identitcal to width
75
+ @if(not $height) {
76
+ $height: $width;
77
+ }
78
+ // zero out it's content
79
+ height: 0;
80
+ width : 0;
81
+ // IE6 needs some extra love
82
+ @include target-browser(ie 6, font-size, 0);
83
+ @include target-browser(ie 6, line-height, 0);
84
+ border: {
85
+ // for IE6, transparent borders are simulated using `dashed` styles instead of a chroma filter
86
+ // IE won't render a `dashed` border-style unless (width * 5) >= border-width
87
+ // since width is always 0, dashed borders aren't rendered
88
+ // @link http://hedgerwow.appspot.com/demo/arrows
89
+ style: dashed;
90
+ // transparent for all other browsers
91
+ color: transparent;
92
+ width: _getTriangleBorderWidth($width, $height, $direction);
93
+ #{_getTriangleBorderDirection($direction)}: {
94
+ color: $color;
95
+ style: solid;
96
+ }
97
+ }
98
+ }
99
+
100
+ // makes your element centered vertically and horizontally in a parent element
101
+ // @mixin centered-box
102
+ @mixin centered-box() {
103
+ @include stretch();
104
+ margin: auto;
105
+ }
106
+
107
+ // hide element visibly but preserve screen-reader support
108
+ // @mixin hide-element
109
+ // @credit Jonathan Snook
110
+ // @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
111
+ @mixin hide-element() {
112
+ position: absolute !important;
113
+ height: 1px;
114
+ width: 1px;
115
+ overflow: hidden;
116
+ @include target-browser(ie lte 7, clip, rect(1px 1px 1px 1px));
117
+ clip: rect(1px, 1px, 1px, 1px);
118
+ }
119
+
120
+ // mixin for generating a fade box which fades from transparent to white
121
+ // @mixin fade-box
122
+ // @param $width {String} the width of the overlay
123
+ // @param $height {String} the height of the overlay
124
+ // @param $direction {String} top=vertical left=horizontal
125
+ @mixin fade-box($width: 100%, $height: 100%, $direction: top) {
126
+ $direction: rtl($direction);
127
+ // TODO - update this when Compass supports IE alpha channels
128
+ @if $direction == left {
129
+ @include ie-filter(gradient(startColorstr='#00ffffff', endColorstr='#ffffff', GradientType=1));
130
+ }
131
+ @else {
132
+ @include ie-filter(gradient(startColorstr='#00ffffff', endColorstr='#ffffff'));
133
+ }
134
+ @include background-image(linear-gradient($direction, rgba(255,255,255,0.4), rgba(255,255,255,1)) );
135
+ @include pseudo-element($width: $width, $height: $height, $position: absolute);
136
+ text-align: center;
137
+ bottom: 0;
138
+ #{if($direction == left, right, left)}: 0;
139
+ }
140
+
141
+ // create a stroke line around text (or font icon)
142
+ // @mixin stroke
143
+ // @param $width {Number} the width of the stroke
144
+ // @param $color {Color} the color of the stroke
145
+ // @param $shadow {List} an additional drop shadow to attach
146
+ @mixin glyph-stroke($width: 1px, $color: black, $shadow: false) {
147
+ @include box-shadow(compact(0 $width 0 $color, 0 -1*$width 0 $color, $width 0 0 $color, -1*$width 0 0 $color, $shadow));
148
+ }
149
+
150
+ // create a glyph icon
151
+ // @mixin glyph-icon
152
+ // @param $icon {String} the icon name
153
+ // @param $size {Number} the size of the icon
154
+ // @param $color {Color} the color of the font
155
+ // @param $placement {String} where to place the icon [before|after|inline]
156
+ // @param $ie-styles {String} styles to apply to IE6/7 (this is needed because the faux :before isn't extensible)
157
+ @mixin glyph-icon($icon, $size: default, $color: inherit, $placement: before, $ie-styles: false) {
158
+ $char-mapping: nil;
159
+ $char-code: nil;
160
+ @if $icon {
161
+ $char-mapping: -compass-list(associative($CONFIG_GLYPHS_MAPPINGS, $icon, $strict: true));
162
+ $char-code: nth($char-mapping, 1);
163
+ }
164
+ @if $char-code == nil and $icon != false {
165
+ @warn "could not find character mapping for `#{icon}`";
166
+ }
167
+ @else {
168
+ @if $size == default {
169
+ $default-size: nil;
170
+ @if $icon {
171
+ $default-size: nth-cyclic($char-mapping, 2);
172
+ }
173
+ $size: if(type-of($default-size) == number, $default-size, 100%);
174
+ }
175
+ // if the size is under a given threshold, use a halfling, if available
176
+ @if $icon {
177
+ $char-code: nth-cyclic(-compass-list($char-code), if(comparable($CONFIG_GLYPHS_THRESHOLD, $size) and $size <= $CONFIG_GLYPHS_THRESHOLD, 2, 1));
178
+ }
179
+ $selector: if(index(before after, $placement), '&:#{$placement}', '&');
180
+ #{$selector} {
181
+ font-family: $CONFIG_GLYPHS_NAME;
182
+ font-weight: $CONFIG_GLYPHS_WEIGHT;
183
+ font-style: $CONFIG_GLYPHS_STYLE;
184
+ text-decoration: inherit;
185
+ speak: none;
186
+ @include if-set(font-size, $size);
187
+ @include if-set(color, $color);
188
+ @if $icon {
189
+ content: $char-code;
190
+ }
191
+ }
192
+ @if($selector != '&' and $ie-styles != nil) {
193
+ // support for IE6/7
194
+ $styles: "font-family:'#{$CONFIG_GLYPHS_NAME}';font-weight:#{$CONFIG_GLYPHS_WEIGHT};font-style:#{$CONFIG_GLYPHS_STYLE};text-decoration:inherit;";
195
+ @if($size != nil) {
196
+ $styles: $styles + "font-size:#{$size};"
197
+ }
198
+ @if($color != nil) {
199
+ $styles: $styles + "color:#{$color};"
200
+ }
201
+ @if($ie-styles) {
202
+ $styles: $styles + $ie-styles;
203
+ }
204
+ @include ie-pseudo($styles: $styles, $content: $char-code, $placement: $placement, $name: glyph);
205
+ }
206
+ }
207
+ }
208
+
209
+ // generate rotational and position keyframes for loading spinners
210
+ // @mixin generate-loader-keyframes
211
+ @mixin generate-loader-keyframes() {
212
+ @if not $CONFIG_DISABLE_STYLEGUIDE_SPRITES {
213
+ // generate rotating keyframes
214
+ @include -generate-loader-keyframes-360();
215
+ // generate specific keyframes
216
+ @each $size in $CONFIG_LOADERS {
217
+ @if $size != nil {
218
+ $values: nth($size, 2);
219
+ $size: nth($size, 1);
220
+ @each $context in (1 2) {
221
+ $name: unquote('#{$size}-#{$context}');
222
+ $icon: nth-cyclic(associative($values, default), $context);
223
+ $position: styleguide-sprite-position($CONFIG_SPRITE_LOADERS, $icon);
224
+ $sprite-file: styleguide-sprite-file($CONFIG_SPRITE_LOADERS, $icon);
225
+ $width: styleguide-image-width($sprite-file);
226
+ $height: styleguide-image-height($sprite-file);
227
+ @include -generate-loader-keyframes-position($name, $position, $width, $height);
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
233
+
234
+ // generate rotational keyframes for loading spinners
235
+ // @mixin -generate-loader-keyframes-360
236
+ // @private
237
+ @mixin -generate-loader-keyframes-360() {
238
+ @if do-once("archetype/ui/generate-keyframe/#{$CONFIG_KEYFRAME_LOADERS}") {
239
+ @if archetype-version('compass >= 0.13') {
240
+ @include keyframes($CONFIG_KEYFRAME_LOADERS) {
241
+ from { @include rotate(0deg); }
242
+ to { @include rotate(360deg); }
243
+ }
244
+ }
245
+ @else {
246
+ @-webkit-keyframes #{$CONFIG_KEYFRAME_LOADERS} {
247
+ from { -webkit-transform: rotate(0deg); }
248
+ to { -webkit-transform: rotate(360deg); }
249
+ }
250
+ @-moz-keyframes #{$CONFIG_KEYFRAME_LOADERS} {
251
+ from { -moz-transform: rotate(0deg); }
252
+ to { -moz-transform: rotate(360deg); }
253
+ }
254
+ @-ms-keyframes #{$CONFIG_KEYFRAME_LOADERS} {
255
+ from { -ms-transform: rotate(0deg); }
256
+ to { -ms-transform: rotate(360deg); }
257
+ }
258
+ @-o-keyframes #{$CONFIG_KEYFRAME_LOADERS} {
259
+ from { -o-transform: rotate(0deg); }
260
+ to { -o-transform: rotate(360deg); }
261
+ }
262
+ @keyframes #{$CONFIG_KEYFRAME_LOADERS} {
263
+ from { transform: rotate(0deg); }
264
+ to { transform: rotate(360deg); }
265
+ }
266
+ }
267
+ }
268
+ }
269
+
270
+ // generate position keyframes for loading spinners
271
+ // @mixin -generate-loader-keyframes-position
272
+ // @private
273
+ // @param $name {String} the name for this keyframe
274
+ // @param $position {List} the background-position of the spinner image
275
+ // @param $width {Number} the width of the spinner image
276
+ // @param $height {Number} the height of the spinner image
277
+ @mixin -generate-loader-keyframes-position($name, $position, $width, $height) {
278
+ $name: unquote('#{$CONFIG_KEYFRAME_LOADERS}-position-#{$name}');
279
+ @if do-once("archetype/ui/generate-keyframe/#{$name}") {
280
+ @if archetype-version('compass >= 0.13') {
281
+ @include keyframes($name) {
282
+ from, to { @include -generate-loader-keyframes-position-css($position, $width, $height); }
283
+ }
284
+ }
285
+ @else {
286
+ @-webkit-keyframes #{$name} {
287
+ from, to { @include -generate-loader-keyframes-position-css($position, $width, $height); }
288
+ }
289
+ @-moz-keyframes #{$name} {
290
+ from, to { @include -generate-loader-keyframes-position-css($position, $width, $height); }
291
+ }
292
+ @-ms-keyframes #{$name} {
293
+ from, to { @include -generate-loader-keyframes-position-css($position, $width, $height); }
294
+ }
295
+ @-o-keyframes #{$name} {
296
+ from, to { @include -generate-loader-keyframes-position-css($position, $width, $height); }
297
+ }
298
+ @keyframes #{$name} {
299
+ from, to { @include -generate-loader-keyframes-position-css($position, $width, $height); }
300
+ }
301
+ }
302
+ }
303
+ }
304
+
305
+ // a helper to generate the required CSS for the position keyframe
306
+ // @mixin -generate-loader-keyframes-position-css
307
+ // @private
308
+ // @param $position {List} the background-position of the spinner image
309
+ // @param $width {Number} the width of the spinner image
310
+ // @param $height {Number} the height of the spinner image
311
+ @mixin -generate-loader-keyframes-position-css($position, $width, $height) {
312
+ background-position: $position;
313
+ width: $width;
314
+ height: $height;
315
+ margin-left: $width / -2;
316
+ margin-top: $height / -2;
317
+ }
318
+
319
+ // a method for removing default styling from a button
320
+ // @mixin unstyled-button
321
+ @mixin unstyled-button() {
322
+ background: none;
323
+ border: none;
324
+ padding: 0;
325
+ @include appearance(none);
326
+ }
@@ -0,0 +1,12 @@
1
+ // utility functions and convenience methods
2
+ // @category utilities
3
+ @import "config";
4
+ // import dependencies
5
+ @import "util/units";
6
+ @import "util/lists";
7
+ @import "util/misc";
8
+ @import "util/spacing";
9
+ @import "util/debug";
10
+ @import "util/rtl";
11
+ @import "util/styles";
12
+ @import "util/targeting";