archetype 0.0.1.pre.13 → 1.0.0.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +97 -24
  3. data/README.md +11 -5
  4. data/VERSION +1 -0
  5. data/lib/archetype.rb +30 -18
  6. data/lib/archetype/actions/migrate.rb +152 -0
  7. data/lib/archetype/actions/theme.rb +6 -7
  8. data/lib/archetype/executor.rb +21 -7
  9. data/lib/archetype/extensions.rb +57 -0
  10. data/lib/archetype/functions.rb +2 -3
  11. data/lib/archetype/functions/css.rb +70 -0
  12. data/lib/archetype/functions/css/constants.rb +247 -0
  13. data/lib/archetype/functions/css/helpers.rb +265 -0
  14. data/lib/archetype/functions/css/routers.rb +28 -0
  15. data/lib/archetype/functions/css/routers/animation.rb +55 -0
  16. data/lib/archetype/functions/css/routers/background.rb +38 -0
  17. data/lib/archetype/functions/css/routers/border.rb +151 -0
  18. data/lib/archetype/functions/css/routers/list.rb +63 -0
  19. data/lib/archetype/functions/css/routers/margin_padding.rb +40 -0
  20. data/lib/archetype/functions/css/routers/outline.rb +56 -0
  21. data/lib/archetype/functions/css/routers/overflow.rb +11 -0
  22. data/lib/archetype/functions/css/routers/target.rb +38 -0
  23. data/lib/archetype/functions/css/routers/transition.rb +48 -0
  24. data/lib/archetype/functions/css/shorthands.rb +43 -0
  25. data/lib/archetype/functions/css/shorthands/animation.rb +18 -0
  26. data/lib/archetype/functions/css/shorthands/background.rb +68 -0
  27. data/lib/archetype/functions/css/shorthands/border.rb +102 -0
  28. data/lib/archetype/functions/hash.rb +3 -149
  29. data/lib/archetype/functions/hash/extend.rb +74 -0
  30. data/lib/archetype/functions/hash/shim.rb +48 -0
  31. data/lib/archetype/functions/helpers.rb +231 -22
  32. data/lib/archetype/functions/styleguide_memoizer.rb +18 -1
  33. data/lib/archetype/sass_extensions.rb +1 -3
  34. data/lib/archetype/sass_extensions/functions.rb +15 -1
  35. data/lib/archetype/sass_extensions/functions/environment.rb +152 -1
  36. data/lib/archetype/sass_extensions/functions/lists.rb +95 -45
  37. data/lib/archetype/sass_extensions/functions/locale.rb +107 -28
  38. data/lib/archetype/sass_extensions/functions/numbers.rb +118 -4
  39. data/lib/archetype/sass_extensions/functions/strings.rb +53 -0
  40. data/lib/archetype/sass_extensions/functions/styleguide.rb +43 -375
  41. data/lib/archetype/sass_extensions/functions/styleguide/components.rb +25 -0
  42. data/lib/archetype/sass_extensions/functions/styleguide/constants.rb +27 -0
  43. data/lib/archetype/sass_extensions/functions/styleguide/grammar.rb +80 -0
  44. data/lib/archetype/sass_extensions/functions/styleguide/helpers.rb +36 -0
  45. data/lib/archetype/sass_extensions/functions/styleguide/resolve.rb +159 -0
  46. data/lib/archetype/sass_extensions/functions/styleguide/styles.rb +146 -0
  47. data/lib/archetype/sass_extensions/functions/styleguide/themes.rb +40 -0
  48. data/lib/archetype/sass_extensions/functions/ui.rb +7 -57
  49. data/lib/archetype/sass_extensions/functions/ui/glyphs.rb +118 -0
  50. data/lib/archetype/sass_extensions/functions/ui/scopes.rb +96 -0
  51. data/lib/archetype/sass_extensions/functions/util.rb +14 -0
  52. data/lib/archetype/sass_extensions/functions/util/debug.rb +22 -0
  53. data/lib/archetype/sass_extensions/functions/util/hacks.rb +44 -0
  54. data/lib/archetype/sass_extensions/functions/util/images.rb +132 -0
  55. data/lib/archetype/sass_extensions/functions/util/misc.rb +220 -0
  56. data/lib/archetype/sass_extensions/functions/util/spacing.rb +83 -0
  57. data/lib/archetype/sass_extensions/functions/version.rb +12 -17
  58. data/lib/archetype/version.rb +1 -1
  59. data/stylesheets/archetype/_config.scss +1 -389
  60. data/stylesheets/archetype/_core.scss +15 -0
  61. data/stylesheets/archetype/_hacks.scss +4 -120
  62. data/stylesheets/archetype/_init.scss +4 -22
  63. data/stylesheets/archetype/_required.scss +3 -0
  64. data/stylesheets/archetype/_reset.scss +3 -0
  65. data/stylesheets/archetype/_styleguide.scss +2 -6
  66. data/stylesheets/archetype/_ui.scss +2 -358
  67. data/stylesheets/archetype/_util.scss +3 -10
  68. data/stylesheets/archetype/config/_core.scss +14 -0
  69. data/stylesheets/archetype/config/_environment.scss +19 -0
  70. data/stylesheets/archetype/config/_formatting.scss +63 -0
  71. data/stylesheets/archetype/config/_glyphs.scss +252 -0
  72. data/stylesheets/archetype/config/_resets.scss +7 -0
  73. data/stylesheets/archetype/config/_resolution.scss +3 -0
  74. data/stylesheets/archetype/config/_spacing.scss +5 -0
  75. data/stylesheets/archetype/config/_targeting.scss +18 -0
  76. data/stylesheets/archetype/config/_theme.scss +3 -0
  77. data/stylesheets/archetype/config/_typography.scss +56 -0
  78. data/stylesheets/archetype/config/_units.scss +2 -0
  79. data/stylesheets/archetype/config/_vars.scss +10 -0
  80. data/stylesheets/archetype/hacks/_core.scss +4 -0
  81. data/stylesheets/archetype/hacks/_hacks.scss +160 -0
  82. data/stylesheets/archetype/hacks/_init.scss +2 -0
  83. data/stylesheets/archetype/styleguide/_core.scss +4 -0
  84. data/stylesheets/archetype/styleguide/_init.scss +1 -0
  85. data/stylesheets/archetype/styleguide/_styleguide.scss +41 -18
  86. data/stylesheets/archetype/ui/_accessibility.scss +41 -0
  87. data/stylesheets/archetype/ui/_breakpoints.scss +19 -0
  88. data/stylesheets/archetype/ui/_core.scss +10 -0
  89. data/stylesheets/archetype/ui/_elements.scss +98 -0
  90. data/stylesheets/archetype/ui/_glyphs.scss +244 -0
  91. data/stylesheets/archetype/ui/_init.scss +5 -0
  92. data/stylesheets/archetype/ui/_layout.scss +37 -0
  93. data/stylesheets/archetype/ui/_locale.scss +12 -0
  94. data/stylesheets/archetype/ui/_scopes.scss +42 -0
  95. data/stylesheets/archetype/util/_core.scss +8 -0
  96. data/stylesheets/archetype/util/_debug.scss +9 -21
  97. data/stylesheets/archetype/util/_init.scss +1 -0
  98. data/stylesheets/archetype/util/_misc.scss +21 -86
  99. data/stylesheets/archetype/util/_spacing.scss +9 -40
  100. data/stylesheets/archetype/util/_styles.scss +189 -178
  101. data/stylesheets/archetype/util/_targeting.scss +51 -68
  102. data/templates/example/manifest.rb +2 -2
  103. data/templates/example/screen.scss +0 -1
  104. data/templates/project/manifest.rb +3 -8
  105. metadata +93 -263
  106. data/bin/archetype +0 -3
  107. data/lib/archetype/sass_extensions/monkey_patches.rb +0 -3
  108. data/lib/archetype/sass_extensions/monkey_patches/handle_include_loop.rb +0 -13
  109. data/stylesheets/archetype/_base.scss +0 -54
  110. data/stylesheets/archetype/_grid.scss +0 -3
  111. data/stylesheets/archetype/base/_h5bp.scss +0 -307
  112. data/stylesheets/archetype/base/_hybrid.scss +0 -25
  113. data/stylesheets/archetype/base/_normalize.scss +0 -634
  114. data/stylesheets/archetype/base/_reset.scss +0 -72
  115. data/stylesheets/archetype/grid/_config.scss +0 -14
  116. data/stylesheets/archetype/grid/_grid.scss +0 -391
  117. data/stylesheets/archetype/styleguide/_components.scss +0 -25
  118. data/stylesheets/archetype/styleguide/_helpers.scss +0 -215
  119. data/stylesheets/archetype/styleguide/_primitives.scss +0 -10
  120. data/stylesheets/archetype/styleguide/components/_alerts.scss +0 -59
  121. data/stylesheets/archetype/styleguide/components/_annotations.scss +0 -27
  122. data/stylesheets/archetype/styleguide/components/_bristol.scss +0 -15
  123. data/stylesheets/archetype/styleguide/components/_button_groups.scss +0 -47
  124. data/stylesheets/archetype/styleguide/components/_button_toolbars.scss +0 -17
  125. data/stylesheets/archetype/styleguide/components/_buttons.scss +0 -339
  126. data/stylesheets/archetype/styleguide/components/_canvas.scss +0 -15
  127. data/stylesheets/archetype/styleguide/components/_carets.scss +0 -336
  128. data/stylesheets/archetype/styleguide/components/_closes.scss +0 -63
  129. data/stylesheets/archetype/styleguide/components/_container.scss +0 -27
  130. data/stylesheets/archetype/styleguide/components/_copy.scss +0 -85
  131. data/stylesheets/archetype/styleguide/components/_flyouts.scss +0 -52
  132. data/stylesheets/archetype/styleguide/components/_headings.scss +0 -33
  133. data/stylesheets/archetype/styleguide/components/_headlines.scss +0 -64
  134. data/stylesheets/archetype/styleguide/components/_hovercards.scss +0 -27
  135. data/stylesheets/archetype/styleguide/components/_icons.scss +0 -17
  136. data/stylesheets/archetype/styleguide/components/_identities.scss +0 -34
  137. data/stylesheets/archetype/styleguide/components/_links.scss +0 -68
  138. data/stylesheets/archetype/styleguide/components/_loaders.scss +0 -154
  139. data/stylesheets/archetype/styleguide/components/_menu_items.scss +0 -31
  140. data/stylesheets/archetype/styleguide/components/_module.scss +0 -15
  141. data/stylesheets/archetype/styleguide/components/_pullquotes.scss +0 -29
  142. data/stylesheets/archetype/styleguide/components/_punchcut.scss +0 -18
  143. data/stylesheets/archetype/styleguide/components/_tooltips.scss +0 -28
  144. data/stylesheets/archetype/styleguide/primitives/_animations.scss +0 -17
  145. data/stylesheets/archetype/styleguide/primitives/_dimensions.scss +0 -50
  146. data/stylesheets/archetype/styleguide/primitives/_glyphs.scss +0 -11
  147. data/stylesheets/archetype/styleguide/primitives/_misc.scss +0 -8
  148. data/stylesheets/archetype/styleguide/primitives/_palettes.scss +0 -94
  149. data/stylesheets/archetype/styleguide/primitives/_shadows.scss +0 -23
  150. data/stylesheets/archetype/styleguide/primitives/_sprites.scss +0 -46
  151. data/stylesheets/archetype/styleguide/primitives/_textures.scss +0 -10
  152. data/stylesheets/archetype/styleguide/primitives/_typography.scss +0 -56
  153. data/stylesheets/archetype/util/_lists.scss +0 -57
  154. data/stylesheets/archetype/util/_rtl.scss +0 -279
  155. data/stylesheets/archetype/util/_units.scss +0 -18
  156. data/templates/project/screen.scss +0 -1
  157. data/templates/project/vendor/archetype/animations/loaders/large/large.png +0 -0
  158. data/templates/project/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
  159. data/templates/project/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
  160. data/templates/project/vendor/archetype/animations/loaders/large/large_static.png +0 -0
  161. data/templates/project/vendor/archetype/animations/loaders/medium/medium.png +0 -0
  162. data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
  163. data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
  164. data/templates/project/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
  165. data/templates/project/vendor/archetype/animations/loaders/small/small.png +0 -0
  166. data/templates/project/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
  167. data/templates/project/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
  168. data/templates/project/vendor/archetype/animations/loaders/small/small_static.png +0 -0
  169. data/templates/project/vendor/archetype/fontawesome-webfont.eot +0 -0
  170. data/templates/project/vendor/archetype/fontawesome-webfont.svg +0 -255
  171. data/templates/project/vendor/archetype/fontawesome-webfont.ttf +0 -0
  172. data/templates/project/vendor/archetype/fontawesome-webfont.woff +0 -0
  173. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.eot +0 -0
  174. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.svg +0 -255
  175. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.ttf +0 -0
  176. data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.woff +0 -0
  177. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders-s7889ccc8c1.png +0 -0
  178. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large.png +0 -0
  179. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
  180. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
  181. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_static.png +0 -0
  182. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium.png +0 -0
  183. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
  184. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
  185. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
  186. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small.png +0 -0
  187. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
  188. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
  189. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_static.png +0 -0
  190. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/sprites/hovercard_tip.png +0 -0
  191. data/test/fixtures/stylesheets/archetype/config.rb +0 -21
  192. data/test/fixtures/stylesheets/archetype/source/b.scss +0 -9
  193. data/test/fixtures/stylesheets/archetype/source/base.scss +0 -3
  194. data/test/fixtures/stylesheets/archetype/source/hacks/ie_pseudo.scss +0 -13
  195. data/test/fixtures/stylesheets/archetype/source/hacks/transparent_focusable.scss +0 -5
  196. data/test/fixtures/stylesheets/archetype/source/locale.scss +0 -43
  197. data/test/fixtures/stylesheets/archetype/source/styleguide/alerts.scss +0 -21
  198. data/test/fixtures/stylesheets/archetype/source/styleguide/buttons.scss +0 -18
  199. data/test/fixtures/stylesheets/archetype/source/styleguide/drop.scss +0 -101
  200. data/test/fixtures/stylesheets/archetype/source/styleguide/extend.scss +0 -24
  201. data/test/fixtures/stylesheets/archetype/source/styleguide/fallback_styles.scss +0 -23
  202. data/test/fixtures/stylesheets/archetype/source/styleguide/invalid_structures.scss +0 -85
  203. data/test/fixtures/stylesheets/archetype/source/styleguide/multi_value.scss +0 -18
  204. data/test/fixtures/stylesheets/archetype/source/styleguide/nested_styleguides.scss +0 -40
  205. data/test/fixtures/stylesheets/archetype/source/styleguide/selective_state.scss +0 -22
  206. data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +0 -35
  207. data/test/fixtures/stylesheets/archetype/source/ui/hide_element.scss +0 -5
  208. data/test/fixtures/stylesheets/archetype/source/ui/stroke.scss +0 -13
  209. data/test/fixtures/stylesheets/archetype/source/ui/triangle.scss +0 -13
  210. data/test/fixtures/stylesheets/archetype/source/utilities/associative.scss +0 -24
  211. data/test/fixtures/stylesheets/archetype/source/utilities/custom_output_styler.scss +0 -22
  212. data/test/fixtures/stylesheets/archetype/source/utilities/if-set.scss +0 -16
  213. data/test/fixtures/stylesheets/archetype/source/utilities/spacing/horizontal-spacing.scss +0 -27
  214. data/test/fixtures/stylesheets/archetype/source/utilities/spacing/vertical-spacing.scss +0 -27
  215. data/test/fixtures/stylesheets/archetype/source/utilities/styles/filter.scss +0 -9
  216. data/test/fixtures/stylesheets/archetype/source/utilities/styles/font-family.scss +0 -9
  217. data/test/fixtures/stylesheets/archetype/source/utilities/styles/z-index.scss +0 -18
  218. data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +0 -77
  219. data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-os.scss +0 -42
  220. data/test/fixtures/stylesheets/archetype/tmp/b.css +0 -14
  221. data/test/fixtures/stylesheets/archetype/tmp/base.css +0 -349
  222. data/test/fixtures/stylesheets/archetype/tmp/hacks/ie_pseudo.css +0 -11
  223. data/test/fixtures/stylesheets/archetype/tmp/hacks/transparent_focusable.css +0 -4
  224. data/test/fixtures/stylesheets/archetype/tmp/locale.css +0 -23
  225. data/test/fixtures/stylesheets/archetype/tmp/styleguide/alerts.css +0 -711
  226. data/test/fixtures/stylesheets/archetype/tmp/styleguide/buttons.css +0 -2119
  227. data/test/fixtures/stylesheets/archetype/tmp/styleguide/drop.css +0 -63
  228. data/test/fixtures/stylesheets/archetype/tmp/styleguide/extend.css +0 -11
  229. data/test/fixtures/stylesheets/archetype/tmp/styleguide/fallback_styles.css +0 -10
  230. data/test/fixtures/stylesheets/archetype/tmp/styleguide/invalid_structures.css +0 -21
  231. data/test/fixtures/stylesheets/archetype/tmp/styleguide/multi_value.css +0 -13
  232. data/test/fixtures/stylesheets/archetype/tmp/styleguide/nested_styleguides.css +0 -28
  233. data/test/fixtures/stylesheets/archetype/tmp/styleguide/selective_state.css +0 -177
  234. data/test/fixtures/stylesheets/archetype/tmp/ui/glyph_icon.css +0 -127
  235. data/test/fixtures/stylesheets/archetype/tmp/ui/hide_element.css +0 -8
  236. data/test/fixtures/stylesheets/archetype/tmp/ui/stroke.css +0 -17
  237. data/test/fixtures/stylesheets/archetype/tmp/ui/triangle.css +0 -35
  238. data/test/fixtures/stylesheets/archetype/tmp/utilities/associative.css +0 -9
  239. data/test/fixtures/stylesheets/archetype/tmp/utilities/custom_output_styler.css +0 -8
  240. data/test/fixtures/stylesheets/archetype/tmp/utilities/if-set.css +0 -9
  241. data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/horizontal-spacing.css +0 -29
  242. data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/vertical-spacing.css +0 -29
  243. data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/filter.css +0 -11
  244. data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/font-family.css +0 -16
  245. data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/z-index.css +0 -15
  246. data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-browser.css +0 -105
  247. data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-os.css +0 -55
  248. data/test/helpers/diff.rb +0 -49
  249. data/test/helpers/io.rb +0 -36
  250. data/test/helpers/test_case.rb +0 -62
  251. data/test/integrations/archetype_test.rb +0 -126
  252. data/test/test_helper.rb +0 -26
  253. data/test/units/sass_extensions_test.rb +0 -200
@@ -0,0 +1,5 @@
1
+ $a-blackhole: require-archetype-modules(archetype/ui);
2
+
3
+ @include unless-archetype-module-initalized(archetype/ui/glyph-libraries) {
4
+ @include glyph-libraries;
5
+ }
@@ -0,0 +1,37 @@
1
+ // @category ui/layout
2
+
3
+ // throw an error if archetype/ui has not been registered
4
+ $a-blackhole: require-archetype-modules(archetype/ui);
5
+
6
+ // additional non-standard compass features required in this module
7
+ @import "compass/layout/stretching";
8
+
9
+ // makes your element centered vertically and horizontally in a parent element
10
+ // @mixin centered-box
11
+ @mixin centered-box() {
12
+ @include stretch();
13
+ margin: auto;
14
+ }
15
+
16
+ // mixin for generating a fade box which fades from transparent to white
17
+ // @mixin fade-box
18
+ // @param $width {String} the width of the overlay
19
+ // @param $height {String} the height of the overlay
20
+ // @param $direction {String} top=vertical left=horizontal
21
+ // @param $from {Color} the start color
22
+ // @param $to {Color} the end color
23
+ @mixin fade-box($width: 100%, $height: 100%, $direction: top, $from: rgba(255,255,255,0.4), $to: rgba(255,255,255,1)) {
24
+ @if support-legacy-browser('ie', '8', $threshold: $critical-usage-threshold) {
25
+ @if $direction == left {
26
+ @include ie-filter(gradient(startColorstr=ie-hex-str($from), endColorstr=ie-hex-str($to), GradientType=1));
27
+ }
28
+ @else {
29
+ @include ie-filter(gradient(startColorstr=ie-hex-str($from), endColorstr=ie-hex-str($to)));
30
+ }
31
+ }
32
+ @include background-image(linear-gradient($direction, $from, $to) );
33
+ @include pseudo-element($width: $width, $height: $height, $position: absolute);
34
+ text-align: center;
35
+ bottom: 0;
36
+ #{if($direction == left, right, left)}: 0;
37
+ }
@@ -0,0 +1,12 @@
1
+ // @category ui/locale
2
+
3
+ // temporarily switch the interface locale
4
+ // @mixin switch-locale
5
+ // @param $locale {String} the locale code to switch to
6
+ // @content
7
+ @mixin switch-locale($locale) {
8
+ // keep track of the current locale, and switch
9
+ $tmp: switch-locale($locale);
10
+ @content;
11
+ $tmp: switch-locale($tmp);
12
+ }
@@ -0,0 +1,42 @@
1
+ // @category ui/scopes
2
+
3
+ // a mixin to output the current context in a BEM style selector
4
+ // @link http://bem.info/method/
5
+ // @mixin BEM
6
+ // @param $element {String} the element name
7
+ // @param $modifier {String} the modifier
8
+ // @content
9
+ @mixin bem($element: null, $modifier: null) {
10
+ @at-root #{bem-selector("#{'&'}", $element, $modifier)} {
11
+ @content;
12
+ }
13
+ }
14
+
15
+ // scopes content block for high resolution (HiDPI/Retina) displays
16
+ // @mixin high-resolution
17
+ // @param $resolution {Number} the resolution to use (either a ratio, dpi, dpcm, or dppx)
18
+ // @content
19
+ @mixin high-resolution($resolution: $CONFIG_RESOLUTION_HIGH) {
20
+ @if $resolution {
21
+ $ratio: resolution-to-ratio($resolution);
22
+ $query: ();
23
+
24
+ $queries: (
25
+ if(support-legacy-browser('firefox', '16', $threshold: $critical-usage-threshold), '(min--moz-device-pixel-ratio: #{$ratio})', null),
26
+ '(-webkit-min-device-pixel-ratio: #{$ratio})',
27
+ '(-o-min-device-pixel-ratio: #{to-fraction($ratio)})',
28
+ '(min-resolution: #{resolution-to-dpi($resolution)})',
29
+ '(min-resolution: #{resolution-to-dppx($resolution)})'
30
+ );
31
+
32
+ @each $q in $queries {
33
+ @if $q {
34
+ $query: append($query, unquote('only screen and #{$q}'), comma);
35
+ }
36
+ }
37
+
38
+ @media #{$query} {
39
+ @content;
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,8 @@
1
+ // register module
2
+ $a-blackhole: register-archetype-module(archetype/util);
3
+
4
+ @import "misc";
5
+ @import "spacing";
6
+ @import "debug";
7
+ @import "styles";
8
+ @import "targeting";
@@ -1,27 +1,15 @@
1
1
  // @category utilities/debug
2
2
 
3
- // check if debug is enabled
4
- // @function is-debug-enabled
5
- // @param $if {Boolean} optional override for $CONFIG_DEBUG
6
- // @return {Boolean} whether or not debug is enabled
7
- @function is-debug-enabled($if: nil) {
8
- // debug is only available in DEV environments, so check that first
9
- // then check if the debug flag/override is truthy
10
- @return (index($CONFIG_DEBUG_ENVS, archetype-env()) and if($if == nil, $CONFIG_DEBUG, $if));
11
- }
3
+ // throw an error if archetype/core has not been registered
4
+ $a-blackhole: require-archetype-modules(archetype/util);
12
5
 
13
6
  // a debug helper, print out a message
14
7
  // @mixin debug-message
15
8
  // @param $message {String} the message to output
16
- // @param $if {Boolean} override $CONFIG_DEBUG
17
- @mixin debug-message($message, $if: nil) {
18
- @if(is-debug-enabled($if)) {
19
- @if archetype-version('sass >= 3.2') {
20
- /* #{$message} */
21
- }
22
- @else {
23
- -archetype-debug: quote($message);
24
- }
9
+ // @param $iff {Boolean} override $CONFIG_DEBUG
10
+ @mixin debug-message($message, $iff: null) {
11
+ @if(is-debug-enabled($iff)) {
12
+ /* #{$message} */
25
13
  }
26
14
  }
27
15
 
@@ -29,9 +17,9 @@
29
17
  // @mixin debug-hover-box
30
18
  // @param $color {String} the color to draw the border
31
19
  // @param $opacity {Number}
32
- // @param $if {Boolean} override $CONFIG_DEBUG
33
- @mixin debug-hover-box($color: rgb(0, 255, 255), $opacity: 0.9, $if: nil) {
34
- @if(is-debug-enabled($if)) {
20
+ // @param $iff {Boolean} override $CONFIG_DEBUG
21
+ @mixin debug-hover-box($color: rgb(0, 255, 255), $opacity: 0.9, $iff: null) {
22
+ @if(is-debug-enabled($iff)) {
35
23
  &:hover {
36
24
  @include opacity($opacity);
37
25
  @include box-shadow(0 0 3px 0 $color);
@@ -0,0 +1 @@
1
+ $a-blackhole: require-archetype-modules(archetype/util);
@@ -1,5 +1,8 @@
1
1
  // @category utilities
2
2
 
3
+ // throw an error if archetype/util has not been registered
4
+ $a-blackhole: require-archetype-modules(archetype/util);
5
+
3
6
  // simplify checking if a value is defined before outputting it to a property
4
7
  // @mixin if-set
5
8
  // @param $property {String} css property to define
@@ -11,98 +14,30 @@
11
14
  @if($ignore == false) {
12
15
  $ignore: (0 0px);
13
16
  }
14
- @if($value != false and not index(-compass-list($ignore), $value)) {
17
+ @if($value != false and $value != null and not index(-archetype-list($ignore), $value)) {
15
18
  #{$property}: $value;
16
19
  }
17
20
  }
18
21
 
19
- $REGISTRY_DO_ONCE: () !default;
20
- // a function to prevent routines from executing multiple times
21
- // @function do-once
22
- // @param $name {String} name of the identifier
23
- // @return {Boolean} true if the first time invoked, false otherwise
24
- @function do-once($name) {
25
- @if index($REGISTRY_DO_ONCE, $name) {
26
- @return false;
22
+ // a mixin that prevents a given block from executing multiple times
23
+ // @mixin do-once
24
+ // @param $name {String} identifier to check/register
25
+ @mixin do-once($name) {
26
+ @if do-once($name) {
27
+ @content;
27
28
  }
28
- $REGISTRY_DO_ONCE: append($REGISTRY_DO_ONCE, $name);
29
- @return true;
30
- }
31
-
32
- // helper to determine if a sprite is already set or sprites are disabled
33
- // @function _shouldSetSprite
34
- // @private
35
- // @param $sprite {SpriteMap} the sprite map to check against
36
- // @return {Boolean} should the sprite be set
37
- @function _shouldSetSprite($sprite) {
38
- @return not $CONFIG_DISABLE_STYLEGUIDE_SPRITES and not $sprite;
39
- }
40
-
41
- // check that a sprite isn't nil or false
42
- // @function styleguide-check-sprite
43
- // @param $map {SpriteMap} the sprite map to check against
44
- // @return {Boolean} is the sprite set
45
- @function styleguide-check-sprite($map) {
46
- @return not ($CONFIG_DISABLE_STYLEGUIDE_SPRITES and index(false nil, $map));
47
- }
48
-
49
- // wrapper for sprite()
50
- // @function styleguide-sprite
51
- // @param $map {SpriteMap} the sprite map
52
- // @param $sprite {Sprite} the sprite name
53
- // @param $offset-x {Number} the horizontal offset of the sprite position
54
- // @param $offset-y {Number} the vertical offset of the sprite position
55
- // @return {Sprite} the sprite object or nil
56
- @function styleguide-sprite($map, $sprite, $offset-x: 0, $offset-y: 0) {
57
- @if not styleguide-check-sprite($map) { @return nil; }
58
- @return sprite($map, $sprite, $offset-x, $offset-y);
59
29
  }
60
30
 
61
- // wrapper for sprite-position()
62
- // @function styleguide-sprite-position
63
- // @param $map {SpriteMap} the sprite map
64
- // @param $sprite {Sprite} the sprite name
65
- // @param $offset-x {Number} the horizontal offset of the sprite position
66
- // @param $offset-y {Number} the vertical offset of the sprite position
67
- // @return {List} the sprite position or nil
68
- @function styleguide-sprite-position($map, $sprite, $offset-x: 0, $offset-y: 0) {
69
- @if not styleguide-check-sprite($map) { @return nil; }
70
- @return sprite-position($map, $sprite, $offset-x, $offset-y);
71
- }
72
-
73
- // wrapper for sprite-url()
74
- // @function styleguide-sprite-url
75
- // @param $map {SpriteMap} the sprite map
76
- // @return {String} the sprite URL or nil
77
- @function styleguide-sprite-url($map) {
78
- @if not styleguide-check-sprite($map) { @return nil; }
79
- @return sprite-url($map);
80
- }
81
-
82
- // wrapper for sprite-file()
83
- // @function styleguide-sprite-file
84
- // @param $map {SpriteMap} the sprite map
85
- // @param $sprite {Sprite} the sprite name
86
- // @return {ImageFile} the image or nil
87
- @function styleguide-sprite-file($map, $sprite) {
88
- @if not styleguide-check-sprite($map) { @return nil; }
89
- @return sprite-file($map, $sprite);
90
- }
91
-
92
- // wrapper for image-width()
93
- // @function styleguide-image-width
94
- // @param $image {ImageFile} the image
95
- // @return {Number} the width of the image or nil
96
- @function styleguide-image-width($image) {
97
- @if $image == nil { @return nil; }
98
- @return image-width($image);
31
+ // helper mixin for iterating over a meta object that contains multiple values
32
+ // @mixin with-each-value
33
+ // @param $values {*} the value or meta object of values to iterate over
34
+ // @content
35
+ @mixin with-each-value($values) {
36
+ $values: if(has-multiple-values($values), map-get($values, values), append((), $values));
37
+ @each $value in $values {
38
+ $archetype-current-value: $value !global;
39
+ @content;
40
+ $archetype-current-value: null !global;
41
+ }
99
42
  }
100
43
 
101
- // wrapper for image-height()
102
- // @function styleguide-image-height
103
- // @param $image {ImageFile} the image
104
- // @return {Number} the height of the image or nil
105
- @function styleguide-image-height($image) {
106
- @if $image == nil { @return nil; }
107
- @return image-height($image);
108
- }
@@ -1,38 +1,7 @@
1
1
  // @category utilities/spacing
2
2
 
3
- // abstract spacing calculations
4
- // @function _spacing
5
- // @private
6
- // @param $unit {Number} unit of measurement
7
- // @param $direction {String} [horizontal|vertical] spacing
8
- // @param $abuse {Boolean} @see _getUnit
9
- // @return {String} the calculated spacing
10
- @function _spacing($unit: nil, $direction: horizontal, $abuse: false) {
11
- @if $unit == nil {
12
- @return nil;
13
- }
14
- $unit: _getUnit($unit, $abuse);
15
- $spacing: if($direction == vertical, $CONFIG_VERTICAL_SPACING, $CONFIG_HORIZONTAL_SPACING);
16
- @return ($unit * $spacing);
17
- }
18
-
19
- // horizonatl spacing calculations
20
- // @function horizontal-spacing
21
- // @param $unit {Number} unit of measurement
22
- // @param $abuse {Boolean} @see _getUnit
23
- // @return {String} the calculated horizontal spacing
24
- @function horizontal-spacing($unit, $abuse: false) {
25
- @return _spacing($unit, $abuse: $abuse);
26
- }
27
-
28
- // vertical spacing calculations
29
- // @function vertical-spacing
30
- // @param $unit {Number} unit of measurement
31
- // @param $abuse {Boolean} @see _getUnit
32
- // @return {String} the calculated vertical spacing
33
- @function vertical-spacing($unit, $abuse: false) {
34
- @return _spacing($unit, $direction: vertical, $abuse: $abuse);
35
- }
3
+ // throw an error if archetype/util has not been registered
4
+ $a-blackhole: require-archetype-modules(archetype/util);
36
5
 
37
6
  // generate the vertical spacing offset
38
7
  // @mixin vertical-spacing
@@ -40,8 +9,8 @@
40
9
  // @param $top {Number} the units to offset from the top
41
10
  // @param $bottom {Number} the units to offset from the bottom
42
11
  // @param $method {String} [margin|padding] offset method
43
- // @param $abuse {Boolean} @see _getUnit
44
- @mixin vertical-spacing($list: false, $top: nil, $bottom: nil, $method: false, $abuse: false) {
12
+ // @param $abuse {Boolean} @see _archetype_integerize
13
+ @mixin vertical-spacing($list: false, $top: null, $bottom: null, $method: false, $abuse: false) {
45
14
  $list: get-collection($list, ($top $bottom), $min: 2);
46
15
  @include _spacing($list, vertical, $method: $method, $abuse: $abuse);
47
16
  }
@@ -51,8 +20,8 @@
51
20
  // @param $left {Number} the units to offset from the left
52
21
  // @param $right {Number} the units to offset from the right
53
22
  // @param $method {String} [margin|padding] offset method
54
- // @param $abuse {Boolean} @see _getUnit
55
- @mixin horizontal-spacing($list: false, $left: nil, $right: nil, $method: false, $abuse: false) {
23
+ // @param $abuse {Boolean} @see _archetype_integerize
24
+ @mixin horizontal-spacing($list: false, $left: null, $right: null, $method: false, $abuse: false) {
56
25
  $list: get-collection($list, ($left $right), $min: 2);
57
26
  @include _spacing($list, $method: $method, $abuse: $abuse);
58
27
  }
@@ -62,7 +31,7 @@
62
31
  // @private
63
32
  // @param $units {List} the list of units e.g. (1) => $left:1 $right:1; (1 0) => $left:1 $right:0;
64
33
  // @param $method {String} [margin|padding] offset method
65
- // @param $abuse {Boolean} @see _getUnit
34
+ // @param $abuse {Boolean} @see _archetype_integerize
66
35
  @mixin _spacing($units, $direction: horizontal, $method: false, $abuse: false) {
67
36
  @if(not $method) {
68
37
  $method: $CONFIG_SPACING_METHOD;
@@ -72,7 +41,7 @@
72
41
  @include if-set(#{$method}-bottom, vertical-spacing(nth($units,2), $abuse: $abuse), $ignore: nil);
73
42
  }
74
43
  @else {
75
- @include if-set(#{$method}-#{rtl(left)}, horizontal-spacing(nth($units,1), $abuse: $abuse), $ignore: nil);
76
- @include if-set(#{$method}-#{rtl(right)}, horizontal-spacing(nth($units,2), $abuse: $abuse), $ignore: nil);
44
+ @include if-set(#{$method}-left, horizontal-spacing(nth($units,1), $abuse: $abuse), $ignore: nil);
45
+ @include if-set(#{$method}-right, horizontal-spacing(nth($units,2), $abuse: $abuse), $ignore: nil);
77
46
  }
78
47
  }
@@ -1,19 +1,17 @@
1
- @import "compass/layout/stretching";
2
-
3
1
  // @category utilities/styles
4
2
 
3
+ // throw an error if archetype/util has not been registered
4
+ $a-blackhole: require-archetype-modules(archetype/util);
5
+
5
6
  // this is a proxy for output-style
6
- // we need this to prevent Sass from throwing an error as you currently can't use recursive mixins :/
7
+ // this contains mixins that will eventually call output-style in one form or another
7
8
  // @mixin _outputStyle
8
9
  // @private
9
10
  // @param $property {String} the CSS property to output
10
11
  // @param $value {*} the CSS value to output
11
- @mixin _outputStyle($property, $value: nil) {
12
- @if($value != nil) {
13
- @if($property == round-button-ie-support) {
14
- @include round-button-ie-support($value)
15
- }
16
- @else if($property == target-browser) {
12
+ @mixin _outputStyle($property, $value: null) {
13
+ @if not is-null($value) {
14
+ @if($property == target-browser) {
17
15
  @include target-browser(nth($value,1), nth($value,2), nth($value,3));
18
16
  }
19
17
  @else if($property == font-family) {
@@ -22,98 +20,89 @@
22
20
  @else if($property == font-style) {
23
21
  @include font-style($value);
24
22
  }
25
- @else if($property == hide-element) {
26
- @include hide-element();
27
- }
28
- @else if($property == unstyled-button) {
29
- @include unstyled-button();
30
- }
31
23
  @else {
32
24
  @include output-style($property, $value);
33
25
  }
34
26
  }
35
27
  }
36
28
 
29
+ @function check-for-custom-styler($property, $value, $method: pre) {
30
+ @return mixin-exists('custom-output-styler') and function-exits('has-custom-output-styler') and has-custom-output-styler($property, $value, $method);
31
+ }
32
+
37
33
  // output a property or augment it to use a mixin
38
34
  // @mixin output-style
39
35
  // @param $property {String} the CSS property to output
40
36
  // @param $value {*} the CSS value to output
41
- @mixin output-style($property, $value: nil) {
42
-
43
- @if($property != nil and length(-compass-list($value)) > 0 and first-value-of(-compass-list($value)) != nil and not index($CONFIG_DISABLED_CSS, $property)) {
37
+ @mixin output-style($property, $value: null) {
38
+ @if type-of($property) == map {
39
+ @include to-styles($property);
40
+ }
41
+ @elseif( not is-null($property) and length(-archetype-list($value)) > 0 and not is-null(first-value-of(-archetype-list($value))) and not index($CONFIG_DISABLED_CSS, $property)) {
44
42
  // for mixins, we need to do some custom work
45
43
  // check to see if we have a custom output styler (pre)
46
- @if has-custom-output-styler($property, $value, pre) == true {
44
+ @if check-for-custom-styler($property, $value, pre) {
47
45
  @include custom-output-styler($property, $value, $method: pre);
48
46
  }
47
+ // we're going to assume that any mixins that get invoked here have been properly imported
48
+ // if not, they will simply throw a compilation error
49
49
  // border-radius
50
- @else if($property == border-radius) { @include border-radius(rtl($value, border-radius)); }
50
+ @else if($property == border-radius) { @include border-radius($value...); }
51
51
  // box-sizing
52
- @else if($property == box-sizing) { @include box-sizing($value); }
52
+ @else if($property == box-sizing) { @include box-sizing($value...); }
53
53
  // box-shadow
54
- @else if($property == box-shadow) { @include box-shadow($value); }
54
+ @else if($property == box-shadow) { @include box-shadow($value...); }
55
55
  // text-shadow
56
56
  @else if($property == text-shadow) { @include text-shadow($value); }
57
57
  // filter-gradient
58
- @else if($property == filter-gradient) { @include filter-gradient(nth($value,1), nth($value,2), nth($value,3)); }
58
+ @else if($property == filter-gradient) { @include filter-gradient($value...); }
59
59
  // background
60
- @else if($property == background) { @include background($value); }
60
+ @else if($property == background) { @include background($value...); }
61
61
  // background-image
62
- @else if($property == background-image or $property == gradient) { @include background-image($value); }
62
+ @else if($property == background-image) { @include background-image($value...); }
63
63
  // background-clip
64
- @else if($property == background-clip) { @include background-clip($value); }
64
+ @else if($property == background-clip) { @include background-clip($value...); }
65
65
  // background-size
66
- @else if($property == background-size) { @include background-size($value); }
66
+ @else if($property == background-size) { @include background-size($value...); }
67
67
  // background-origin
68
- @else if($property == background-origin) { @include background-origin($value); }
68
+ @else if($property == background-origin) { @include background-origin($value...); }
69
69
  // IE filters
70
- @else if($property == ie-filter) { @include ie-filter($value); }
70
+ @else if($property == ie-filter) { @include ie-filter($value...); }
71
71
  // hide-text
72
- @else if($property == hide-text) { @include hide-text($direction: if($value == true, $hide-text-direction, $value)); }
72
+ @else if($property == hide-text) { @include hide-text($direction: if($value == true, $hide-text-direction, $value...)); }
73
73
  // inline-block
74
- @else if($property == inline-block) { @include inline-block(); }
74
+ @else if($property == inline-block) { @include inline-block($value...); }
75
75
  // opacity
76
- @else if($property == opacity) { @include opacity($value); }
76
+ @else if($property == opacity) { @include opacity($value...); }
77
77
  // min-width
78
- @else if($property == min-width) { @include min-width($value); }
78
+ @else if($property == min-width) { @include min-width($value...); }
79
79
  // min-height
80
- @else if($property == min-height) { @include min-height($value); }
80
+ @else if($property == min-height) { @include min-height($value...); }
81
81
  // max-width
82
- @else if($property == max-width) { @include max-width($value); }
82
+ @else if($property == max-width) { @include max-width($value...); }
83
83
  // max-height
84
- @else if($property == max-height) { @include max-height($value); }
84
+ @else if($property == max-height) { @include max-height($value...); }
85
85
  // stretch
86
- @else if($property == stretch) { @include stretch(); }
86
+ @else if($property == stretch) { @include stretch($value...); }
87
87
  // appearance
88
- @else if($property == appearance) { @include appearance($value); }
88
+ @else if($property == appearance) { @include appearance($value...); }
89
89
  // unhide-element
90
- @else if($property == unhide-element) { @include unhide-element(); }
90
+ @else if($property == unhide-element) { @include unhide-element($value...); }
91
91
  // ellipsis
92
- @else if($property == ellipsis) { @include ellipsis(); }
92
+ @else if($property == ellipsis) { @include ellipsis($value...); }
93
93
  // scale
94
- @else if($property == scale) { @include scale($value); }
95
- @else if($property == glyph-icon) { @include glyph-icon(nth($value, 1), nth($value, 2), nth($value, 3), nth($value, 4), nth($value, 5)); }
96
- @else if($property == extend) { @extend #{$value}; }
94
+ @else if($property == scale) { @include scale($value...); }
95
+ // z-index
96
+ @else if($property == z-index) { @include z-index($value...); }
97
+ @else if($property == glyph-icon) { @include glyph-icon($value...); }
98
+ @else if($property == extend) {
99
+ @each $v in -archetype-list($value) {
100
+ @extend #{$v};
101
+ }
102
+ }
97
103
  // animations
98
104
  @else if($property == animation) {
99
- @if archetype-version('compass >= 0.13') {
100
- @include animation($value);
101
- }
102
- @else {
103
- @if $experimental-support-for-webkit {
104
- -webkit-animation: $value;
105
- }
106
- @if $experimental-support-for-mozilla {
107
- -moz-animation: $value;
108
- }
109
- @if $experimental-support-for-microsoft {
110
- -ms-animation: $value;
111
- }
112
- @if $experimental-support-for-opera {
113
- -o-animation: $value;
114
- }
115
- animation: $value;
116
- }
105
+ @include animation($value...);
117
106
  }
118
107
  // hasLayout
119
108
  @else if($property == has-layout) {
@@ -122,7 +111,7 @@
122
111
  @include has-layout();
123
112
  }
124
113
  @else {
125
- @include has-layout($value);
114
+ @include has-layout($value...);
126
115
  }
127
116
  }
128
117
  // clearfix
@@ -137,15 +126,9 @@
137
126
  @include clearfix();
138
127
  }
139
128
  }
140
- // z-index
141
- @else if($property == z-index) {
142
- $value: -compass-list($value);
143
- @if(length($value) > 1) { @include z-index(nth($value, 1), nth($value, 2)); }
144
- @else { @include z-index($value); }
145
- }
146
129
  // :before/:after
147
130
  @else if($property == ie-pseudo-before or $property == ie-pseudo-after) {
148
- $value: -compass-list($value);
131
+ $value: -archetype-list($value);
149
132
  $content: false;
150
133
  $tag: '';
151
134
  @if length($value) > 1 {
@@ -161,10 +144,8 @@
161
144
  @include ie-pseudo-after(nth($value, 1), $content, $tag);
162
145
  }
163
146
  }
164
- //ellipsis
165
- @else if($property == ellipsis) { @include ellipsis(); }
166
147
  // check to see if we have a custom output styler (post)
167
- @else if has-custom-output-styler($property, $value, post) == true {
148
+ @else if check-for-custom-styler($property, $value, post) {
168
149
  @include custom-output-styler($property, $value, $method: post);
169
150
  }
170
151
  // otherwise just use a key-value pair
@@ -172,67 +153,147 @@
172
153
  }
173
154
  }
174
155
 
156
+ // outputs @content into a placeholder, and then extends it,
157
+ // if the placeholder already exists, just extend it
158
+ // @mixin archetype-smart-content
159
+ // @param $placeholder {String} the placeholder
160
+ // @param $extend {Boolean} if false, will only create the placeholder, but not extend it
161
+ // @param $here {Boolean} if true, will force the content to be output in the current context, and not extended
162
+ // @content
163
+ @mixin archetype-smart-content($placeholder, $extend: true, $here: null) {
164
+ @if $CONFIG_USE_SMART_CONTENT and not $here {
165
+ // if we haven't already registered this placeholder...
166
+ @if not index($archetype-placeholder-registry, $placeholder) {
167
+ // create it...
168
+ @at-root #{$placeholder} {
169
+ @content;
170
+ }
171
+ // and register it...
172
+ $archetype-placeholder-registry: append($archetype-placeholder-registry, $placeholder) !global;
173
+ }
174
+ @if $extend {
175
+ @extend #{$placeholder} !optional;
176
+ }
177
+ }
178
+ @elseif $extend {
179
+ @content;
180
+ }
181
+ }
182
+
175
183
  // convert a list of key-value pairs into CSS rules
176
184
  // @mixin to-styles
177
- // @param $list {List} a key-value paired list of ($property $value)
185
+ // @param $map {Map} a of styles
178
186
  // @param $states {Boolean|List} if true, output all states; if false, output no states; if a list, output only the states in the list
179
187
  // @param $exclude {List} a list of styles to exclude from output
180
- @mixin to-styles($list: (), $states: true, $selectors: true, $exclude: ()) {
181
- $exclude: -compass-list($exclude);
182
- $states-data: ();
183
- $selectors-data: ();
184
- @each $item in $list {
185
- @if(length($item) > 1) {
186
- $property: nth($item, 1);
187
- $value: nth($item, 2);
188
- @if(not index($exclude, $property)) {
189
- // deal with the states
190
- @if($property == states and $states != false and length($value) > 0) {
191
- @each $state in $value {
192
- $val: nth($state, 2);
193
- $state: first-value-of($state);
194
- @if(index(-compass-list($states), $state) or $states == true) {
195
- #{_getStateSelector($state)} {
196
- @include to-styles($val, true, true, $exclude);
188
+ // @param $here {Boolean} if true, will force the content to be output in the current context, and not extended
189
+ // @content
190
+ @mixin to-styles($map: (), $states: true, $selectors: true, $exclude: (), $meta: (), $here: null) {
191
+ @if $map {
192
+ $exclude: -archetype-list($exclude);
193
+ $placeholder: (
194
+ map: $map,
195
+ states: $states,
196
+ selectors: $selectors,
197
+ exclude: $exclude
198
+ );
199
+
200
+ $message: meta-message($map, map-merge($meta, (phase: begin, origin: $archetype-origin-function or styles)));
201
+ @if $message { /* #{$message} */ }
202
+
203
+ $placeholder: unquote("%#{tokenize($placeholder)}");
204
+ // register a placeholder if needed
205
+ @include archetype-smart-content($placeholder, $here: $here) {
206
+ @each $property, $value in $map {
207
+ @include with-each-value($value) {
208
+ // get the expected value given any runtime locale context
209
+ $value: get-runtime-locale-value($archetype-current-value);
210
+ @if not (index($exclude, $property) or $property == '-archetype-meta') {
211
+ // deal with the states
212
+ @if($property == states and $states != false and length($value) > 0) {
213
+ @each $state, $val in $value {
214
+ @if(index(-archetype-list($states), $state) or $states == true) {
215
+ // get the state selector mappings
216
+ $selector-map: _getStateSelectorMap($state);
217
+ // output the state selectors if we're not using _only_ BEM style
218
+ @if($CONFIG_STATE_BEM != only) {
219
+ $selector: map-get($selector-map, selector);
220
+ // if the selector is valid...
221
+ @if($selector != null) {
222
+ // output it
223
+ #{$selector} {
224
+ @include to-styles($val, true, true, $exclude);
225
+ }
226
+ }
227
+ }
228
+ // if BEM style states are enabled...
229
+ @if($CONFIG_STATE_BEM) {
230
+ // get the BEM states
231
+ $bem-states: map-get($selector-map, states);
232
+ // for each BEM state
233
+ @each $bem-state in $bem-states {
234
+ // output it (this looks scarier than it really is...)
235
+ @include bem($modifier: $bem-state) {
236
+ @include to-styles($val, true, true, $exclude);
237
+ }
238
+ }
239
+ }
240
+ }
197
241
  }
198
242
  }
199
- }
200
- }
201
- // deal with the nested selectors
202
- @else if($property == selectors and $selectors != false and length($value) > 0) {
203
- @each $selector in $value {
204
- @if(index(-compass-list($selectors), $selector) or $selectors == true) {
205
- #{_getSelectorSelector($selector)} {
206
- @include to-styles(nth($selector, 2), true, true, $exclude);
243
+ // deal with the nested selectors
244
+ @else if($property == selectors and $selectors != false and length($value) > 0) {
245
+ @each $selector, $val in $value {
246
+ @if(index(-archetype-list($selectors), $selector) or $selectors == true) {
247
+ $sel: _getSelectorSelector($selector);
248
+ @if str-index($sel, '%bem ') == 1 {
249
+ $sel: str-replace($sel, '%bem ', '');
250
+ @include bem($element: $sel) {
251
+ @include to-styles($val, true, true, $exclude);
252
+ }
253
+ }
254
+ @else {
255
+ #{$sel} {
256
+ @include to-styles($val, true, true, $exclude);
257
+ }
258
+ }
259
+ }
207
260
  }
208
261
  }
262
+ // otherwise, just output it
263
+ @else if($selectors == true and $states == true ) {
264
+ @include _outputStyle($property, $value);
265
+ }
209
266
  }
210
267
  }
211
- // otherwise, just output it
212
- @else if($selectors == true and $states == true ) {
213
- @include _outputStyle($property, $value);
214
-
215
- }
216
268
  }
217
269
  }
270
+
271
+ $message: meta-message($map, map-merge($meta, (phase: end, origin: $archetype-origin-function or styles)));
272
+ @if $message { /* #{$message} */ }
273
+
274
+ // any original block content passed in...
275
+ @content;
218
276
  }
219
277
  }
220
278
 
221
279
  // helper function to compute the selector for various states
222
- // @function _getStateSelector
280
+ // @function _getStateSelectorMap
223
281
  // @private
224
282
  // @param $state {String} the state to select
225
283
  // @param $prefix {String} the prefix to append to the state (for class names only)
226
- @function _getStateSelector($state, $prefix: $CONFIG_STATE_PREFIX) {
227
- $selector: associative($CONFIG_STATE_MAPPINGS, $state, $strict: true);
228
- @if $selector == nil or length($selector) == 0 {
229
- $selector: '&.#{if(index(-compass-list($CONFIG_STATE_NO_PREFIX), $state), $prefix, "")}#{$state}';
284
+ @function _getStateSelectorMap($state, $prefix: $CONFIG_STATE_PREFIX) {
285
+ $map: map-get($CONFIG_STATE_MAPPINGS, $state);
286
+ @if $map == null or length($map) == 0 {
287
+ $map: (
288
+ selector : '&.#{if(index(-archetype-list($CONFIG_STATE_NO_PREFIX), $state), $prefix, "")}#{$state}',
289
+ states : ($state)
290
+ );
230
291
  }
231
- @return $selector;
292
+ @return $map;
232
293
  }
233
294
 
234
295
  @function _getSelectorSelector($selector) {
235
- $selector: first-value-of(-compass-list($selector));
296
+ $selector: first-value-of(-archetype-list($selector));
236
297
  @if $selector == $CORE_GLYPH_SELECTOR_VAR {
237
298
  $selector: $archetype-glyph-selector;
238
299
  }
@@ -244,13 +305,13 @@
244
305
 
245
306
  // mixin for outputting filters in legacy IE
246
307
  // @mixin ie-filter
247
- // @param $value {String|List} a set of filters to output, sans `progid:DXImageTransform.Microsoft` prefix
308
+ // @param $value {String|List} a set of filters to output
248
309
  @mixin ie-filter($value, $use-prefix: false) {
249
310
  $out: false;
250
- $value: -compass-list($value);
311
+ $value: -archetype-list($value);
251
312
  $ms-filter-prefix: 'progid:DXImageTransform.Microsoft.';
252
313
  @each $item in $value {
253
- @if($item != none) {
314
+ @if($item != none and str-index($item, $ms-filter-prefix) != 1) {
254
315
  $item: #{$ms-filter-prefix}#{$item};
255
316
  }
256
317
  $out: if($out, '#{$out},#{$item}', '#{$item}');
@@ -280,61 +341,23 @@
280
341
  @include if-set(position, $position);
281
342
  }
282
343
 
283
- // this is a helper for simple gradients when a direction is desired in degrees,
284
- // but we still want to support old webkit browsers
285
- // @mixin gradient-with-deg
286
- // @param $deg {Number} the direction degree
287
- // @param $start {Color} the start color
288
- // @param $end {Color} the end color
289
- @mixin gradient-with-deg($deg, $start, $end) {
290
- // make sure it's a deg
291
- $deg: if(unitless($deg), $deg * 1deg, $deg);
292
- // we'll divide the circle into sections
293
- $sector: (360deg / 8);
294
- // offset it for calculations
295
- $tmp: $deg - ($sector / 2);
296
- $map: (
297
- (right top),
298
- (right),
299
- (right bottom),
300
- (bottom),
301
- (left bottom),
302
- (left),
303
- (left top),
304
- (top)
305
- );
306
- // compute the region it falls in
307
- $region: nth($map, ceil(if($tmp < 0deg, 360 - $tmp, $tmp) / $sector));
308
- // NOTE: we temporarily disable old webkit gradients as they don't support degrees
309
- // this is a fallback for old webkit
310
- @if($support-for-original-webkit-gradients) {
311
- background-image: -owg(linear-gradient($region, $start, $end));
312
- }
313
- $tmp: $support-for-original-webkit-gradients;
314
- $support-for-original-webkit-gradients: false;
315
- // now the others
316
- @include background-image(linear-gradient($deg, $start, $end));
317
- // restore the old webkit value
318
- $support-for-original-webkit-gradients: $tmp;
319
- }
320
-
321
344
  // abstract common issues and generate safe styles
322
- @mixin safe($property: nil, $value: nil) {
323
- @if($property != nil and $value != nil) {
345
+ @mixin safe($property: null, $value: null) {
346
+ @if not is-null($property) and not is-null($value) {
324
347
  // os friendly font stacks
325
348
  @if($property == font-family) {
326
- $stack: associative($CONFIG_SAFE_FONTS, $value, $strict: true);
327
- @if($stack != nil and length($stack) > 0) {
349
+ $stack: map-get($CONFIG_SAFE_FONTS, $value);
350
+ @if($stack and length($stack) > 0) {
328
351
  // first, step through the list of os safe fonts
329
352
  @each $collection in $stack {
330
353
  @if(length($collection) > 1) {
331
- $default: nil;
354
+ $default: null;
332
355
  $os: nth($collection, 1);
333
356
  $fonts: nth($collection, 2);
334
- $family: nil;
357
+ $family: null;
335
358
  // next, step through the list of lang safe fonts
336
359
  @each $item in $fonts {
337
- @if($item != nil) {
360
+ @if not is-null($item) {
338
361
  $lang: nth($item, 1);
339
362
  $font: nth($item, 2);
340
363
  // check if the language matches or it's the default
@@ -346,13 +369,13 @@
346
369
  $default: $font;
347
370
  }
348
371
  // if the keyword `default` is in the font-stack, substitute it with the default font-stack
349
- $family: list-replace($family, index(-compass-list($family), default), $default, comma);
372
+ $family: list-replace($family, index(-archetype-list($family), default), $default, comma);
350
373
  }
351
374
  }
352
375
  @include target-os($os, font-family, $family);
353
376
  }
354
377
  }
355
- $value: nil;
378
+ $value: null;
356
379
  }
357
380
  }
358
381
  // text-transform: uppercase isn't friendly to turkish
@@ -360,18 +383,18 @@
360
383
  // TODO - more investigation, this may affect other locales as well
361
384
  // @link http://www.w3.org/International/tests/html-css/text-transform/results-text-transform
362
385
  // @link https://developer.mozilla.org/en/CSS/text-transform
363
- $value: nil;
386
+ $value: null;
364
387
  }
365
388
  @else if($property == font-variant and $value == small-caps and lang(tr_TR)) {
366
389
  // TODO - more investigation, this may affect other locales as well
367
390
  // @link https://developer.mozilla.org/en/CSS/font-variant
368
- $value: nil;
391
+ $value: null;
369
392
  }
370
393
  // italics aren't pretty in CJK
371
394
  @else if($property == font-style and $value == italic and lang(CJK)) {
372
- $value: nil;
395
+ $value: null;
373
396
  }
374
- // if $value was set to `nil`, this does nothing
397
+ // if $value was set to `null`, this does nothing
375
398
  @include output-style($property, $value);
376
399
  }
377
400
  }
@@ -379,7 +402,7 @@
379
402
  // web-safe font stacks, if no safe fonts are found, use the raw `$family` as output
380
403
  // @mixin font-family
381
404
  // @param $family {String} the font stack to output
382
- @mixin font-family($family: nil) {
405
+ @mixin font-family($family: null) {
383
406
  @include safe(font-family, $family);
384
407
  }
385
408
 
@@ -398,7 +421,7 @@
398
421
  // safely use font-style without localization issues
399
422
  // @mixin font-style
400
423
  // @param $style {String} the style
401
- @mixin font-style($style: nil) {
424
+ @mixin font-style($style: null) {
402
425
  @include safe(font-style, $style);
403
426
  }
404
427
 
@@ -413,15 +436,3 @@
413
436
  }
414
437
  z-index: ($value + $layer);
415
438
  }
416
-
417
- // generate a tag name with a prefix
418
- // @function prefixed-tag
419
- // @param $tag {String} the tag to prefix
420
- // @param $prefix {String} the prefix to prepend to the tag
421
- // @return {String} the prefix joined with the tag
422
- @function prefixed-tag($tag: '', $prefix: $CONFIG_GENERATED_TAG_PREFIX) {
423
- @if $tag != '' {
424
- $tag: '-#{$tag}';
425
- }
426
- @return '#{$prefix}#{$tag}';
427
- }