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

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,72 +0,0 @@
1
- // @category base
2
-
3
- // leverage the Compass reset functions
4
- // this is an adaptation of global-reset()
5
- // @mixin base-reset
6
- // @param $exclude {List} the list of features to exclude from the reset [html5|page|lists|typography|quotes|embeds|quotes|ime]
7
- // @link http://compass-style.org/reference/compass/reset/utilities/#mixin-global-reset
8
- @mixin base-reset($exclude: ()) {
9
- html, body, div, span, applet, object, iframe,
10
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
11
- a, abbr, acronym, address, big, cite, code,
12
- del, dfn, em, img, ins, kbd, q, s, samp,
13
- small, strike, strong, sub, sup, tt, var,
14
- b, u, i, center,
15
- dl, dt, dd, ol, ul, li,
16
- fieldset, form, label, legend,
17
- table, caption, tbody, tfoot, thead, tr, th, td,
18
- article, aside, canvas, details, embed,
19
- figure, figcaption, footer, header, hgroup,
20
- menu, nav, output, ruby, section, summary,
21
- time, mark, audio, video {
22
- // PAGE
23
- @if(not index($exclude, reset-page)) {
24
- @include reset-box-model();
25
- }
26
- // TYPOGRAPHY
27
- @if(not index($exclude, reset-typography)) {
28
- @include reset-font();
29
- }
30
- }
31
- // PAGE
32
- @if(not index($exclude, reset-page)) {
33
- body {
34
- @include reset-body();
35
- }
36
- }
37
- // LISTS
38
- @if(not index($exclude, reset-lists)) {
39
- ol, ul {
40
- @include reset-list-style();
41
- }
42
- }
43
- // TABLES
44
- @if(not index($exclude, reset-tables)) {
45
- table {
46
- @include reset-table();
47
- }
48
- caption, th, td {
49
- @include reset-table-cell();
50
- }
51
- }
52
- // QUOTES
53
- @if(not index($exclude, reset-quotes)) {
54
- q, blockquote {
55
- @include reset-quotation();
56
- }
57
- }
58
- // EMBEDS
59
- @if(not index($exclude, reset-embeds)) {
60
- a img {
61
- @include reset-image-anchor-border();
62
- }
63
- }
64
- // HTML5
65
- @if(not index($exclude, reset-html5)) {
66
- @include reset-html5();
67
- }
68
- // IME
69
- @if(not index($exclude, reset-ime)) {
70
- @include base-normalize-ime();
71
- }
72
- }
@@ -1,14 +0,0 @@
1
- @import "../config";
2
-
3
- // grids
4
- $CONFIG_GRID_COLUMN: 31px !default; // column width
5
- $CONFIG_GRID_GUTTER: 10px !default; // gutter width (margin)
6
- $CONFIG_GRID_MAX_COLUMNS: 24 !default; // max number of columns on the grid
7
- $CONFIG_GRID_MIN_THRESHOLD: 1.0 !default; // minimum threshold for fractional columns
8
- $CONFIG_GRID_ALLOWED_DIVISORS: (3) !default; // allowed list of divisors e.g. (3, 4, 5) => (1/3, 2/3, 1/4, 2/4, 3/4, 1/5, 2/5, 3/5, 4/5)
9
- $CONFIG_GRID_ALLOWED_DIVISABLE: (8, 10, 12, 14, 16, 18, 20, $CONFIG_GRID_MAX_COLUMNS) !default; // list of specific column widths
10
- $CONFIG_GRID_OFFSET_METHOD: margin !default; // offset method to use [padding|margin|position]
11
- $CONFIG_GRID_ALIGN_METHOD: float !default; // alignment method [float|inline-block|table-cell] (NOTE: table-cell doesn't work in all cases
12
- $CONFIG_GRID_DIRECTION: reading-direction() !default; // direction of grid
13
- $CONFIG_GRID_DEBUG: false !default; // debugging mode
14
- $CONFIG_GRID_SPACING_FACTOR: 4 !default; // the factor to use when converting grid indents/outdents to horizontal units
@@ -1,391 +0,0 @@
1
- // this is the grid framework
2
- // @category grid
3
- @import "config";
4
- @import "compass";
5
- @import "../util";
6
-
7
- // calculate the width of a grid block
8
- // @function _getGridWidth
9
- // @private
10
- // @param $columns {Number} the number or fraction of columns to span, if fraction, must specify $of
11
- // @param $of {Number} the total number of columns spanned, only use with fractional $columns
12
- // @param $indent {List} total indent for both left and right sides (needed to adjust for box-model padding)
13
- // @return $width {Number} calculated width
14
- // @usage:
15
- // _getGridWidth(5) => width of 5 columns
16
- // _getGridWidth(1/3, $of: 8) => splits an 8 column grid into 1/3
17
- // _getGridWidth(5, $indent: (10px 0px)) => subtracts the $indent from the total width
18
- @function _getGridWidth($columns, $of: false, $indent: false) {
19
- $width: 0;
20
- // if we're doing 1/3, 2/3, etc...
21
- @if($of or $columns < 1) {
22
- @if(type-of($of) != number) {
23
- $of: $CONFIG_GRID_MAX_COLUMNS;
24
- }
25
-
26
- // check if the divisors conform to our restrictions
27
- @if($CONFIG_GRID_ALLOWED_DIVISORS) {
28
- $allowed-column-factors: ();
29
- @each $divisor in $CONFIG_GRID_ALLOWED_DIVISORS {
30
- $numerator: $divisor;
31
- @while($numerator > 0) {
32
- $numerator: ($numerator - 1);
33
- $allowed-column-factors: append($allowed-column-factors, ($numerator / $divisor));
34
- }
35
- }
36
- @if(not index($allowed-column-factors, $columns)) {
37
- @warn "you can't divide a block into #{columns}";
38
- $columns: 1;
39
- }
40
- }
41
- // check if the specified columns are valid
42
- @if($CONFIG_GRID_ALLOWED_DIVISABLE) {
43
- @if(not index($CONFIG_GRID_ALLOWED_DIVISABLE, $of)) {
44
- @warn "you can't divide #{of} columns";
45
- $of: $CONFIG_GRID_MAX_COLUMNS;
46
- }
47
- }
48
-
49
- $columns: ($columns * $of);
50
- @if($columns < $CONFIG_GRID_MIN_THRESHOLD and $columns > 0) {
51
- @warn "#{$columns} of #{$of} columns is too small. Use a larger column size";
52
- $columns: $CONFIG_GRID_MIN_THRESHOLD;
53
- }
54
- }
55
- // calculate
56
- $width: ($columns * $CONFIG_GRID_COLUMN) + (($columns - 1) * $CONFIG_GRID_GUTTER);
57
-
58
- @if(length($indent) == 2) {
59
- $width: ($width - nth($indent,1) - nth($indent,2));
60
- }
61
- @return $width;
62
- }
63
-
64
- // abstract function to indent or outdent a grid block
65
- // @function _gridDent
66
- // @private
67
- // @param $list {List} list of dents
68
- // @param $left {Number} the number of units to dent left
69
- // @param $right {Number} the number of units to dent right
70
- // @param $direction {String} [in|out] the direction to dent
71
- // @param $abuse {Boolean} @see _getUnit
72
- // @return $dent {List} list of dents
73
- @function _gridDent($list: false, $left: 0, $right: 0, $direction: in, $abuse: false) {
74
- $factor: if($direction == out, -1, 1) * $CONFIG_GRID_SPACING_FACTOR;
75
- $dent: ();
76
- $list: get-collection($list, ($left $right), $min: 2);
77
-
78
- @each $unit in $list {
79
- $unit: ($factor * $unit);
80
- $dent: append($dent, horizontal-spacing($unit, $abuse: $abuse), space);
81
- }
82
-
83
- @if(length($dent) == 1) {
84
- $dent: append($dent, $dent);
85
- }
86
-
87
- @return $dent;
88
- }
89
-
90
- // calculate indents on a grid block
91
- // @function grid-indent
92
- // @param $list {List} list of indents
93
- // @param $left {Number} the number of units to indent left
94
- // @param $right {Number} the number of units to indent right
95
- // @param $abuse {Boolean} @see _getUnit
96
- // @return {List} list of indents
97
- @function grid-indent($list: false, $left: 0, $right: 0, $abuse: false) {
98
- @return _gridDent($list, $left, $right, $direction: in, $abuse: $abuse);
99
- }
100
-
101
- // calculate outdents on a grid block
102
- // @function grid-outdent
103
- // @param $list {List} list of outdents
104
- // @param $left {Number} the number of units to outdent left
105
- // @param $right {Number} the number of units to outdent right
106
- // @param $abuse {Boolean} @see _getUnit
107
- // @return {List} list of outdents
108
- @function grid-outdent($list: false, $left: 0, $right: 0, $abuse: false) {
109
- @return _gridDent($list, $left, $right, $direction: out, $abuse: $abuse);
110
- }
111
-
112
- // generate the negative margins needed for a grid-outdent
113
- // @mixin grid-outdent
114
- // @param $list {List} list of outdents
115
- // @param $left {Number} the number of units to outdent left
116
- // @param $right {Number} the number of units to outdent right
117
- @mixin grid-outdent($list: false, $left: 0, $right: 0) {
118
- $outdent: grid-outdent($list, $left, $right);
119
- @include grid-output-left-right(margin, $outdent);
120
- @include hack-negative-margin();
121
- }
122
-
123
- // calculate offsets for a grid block
124
- // @function grid-offset
125
- // @param $list {List} list of offsets
126
- // @param $left {Number} the number of columns to offset left
127
- // @param $right {Number} the number of columns to offset right
128
- // @param $of {Number} the total number of columns, used if $left/$right are fractional
129
- // @return {List} list of offsets
130
- @function grid-offset($list: false, $left: 0, $right: 0, $of: false) {
131
- $list: get-collection($list, ($left, $right), $min: 2);
132
- $left: nth($list,1);
133
- $left: if($left > 0, _getGridWidth($columns: $left, $of: $of) + $CONFIG_GRID_GUTTER, 0);
134
- $right: nth($list,2);
135
- $right: if($right > 0, _getGridWidth($columns: $right, $of: $of) + $CONFIG_GRID_GUTTER, 0);
136
- @return ($left, $right);
137
- }
138
- // convenience mixin for grid-offset
139
- @mixin grid-offset($list: false, $left: 0, $right: 0, $of: false, $first: false, $method: $CONFIG_GRID_OFFSET_METHOD) {
140
- $offset: grid-offset($list: $list, $left: $left, $right: $right, $of: $of);
141
- @if($method == position) {
142
- @include grid-offset-position($offset: $offset);
143
- }
144
- @else {
145
- @include grid-offset-margin($offset: $offset, $first: $first);
146
- }
147
- }
148
- // convenience method for using the position offset method
149
- @mixin grid-offset-position($offset) {
150
- position: relative;
151
- @include grid-output-left-right($values: $offset);
152
- }
153
- // convenience method for using the margin offset method
154
- @mixin grid-offset-margin($offset, $first: false, $outdent: false) {
155
- $outdent: get-collection($outdent, 0, $min: 2);
156
- $gutter: if($first, 0, $CONFIG_GRID_GUTTER);
157
- @include grid-output-left-right(margin, list-add($outdent, list-add($offset, ($gutter $gutter))), $ignore: ($gutter));
158
- @include hack-negative-margin();
159
- }
160
-
161
- // calculate push (offset) for a grid block
162
- // @function grid-push
163
- // @param $columns {List} the number of columns to offset left
164
- // @param $of {Number} the total number of columns, used if $left is fractional
165
- // @return {List} list of pushes
166
- @function grid-push($columns: 0, $of: false) {
167
- @return grid-offset($left: $columns, $of: $of);
168
- }
169
- // convenience mixin for grid-push
170
- @mixin grid-push($columns:0, $of: false, $first: false, $method: position) {
171
- @include grid-offset($left: $columns, $of: $of, $first: false, $method: $method);
172
- }
173
-
174
- // calculate pull (offset) for a grid block
175
- // @function grid-pull
176
- // @param $columns {List} the number of columns to offset right
177
- // @param $of {Number} the total number of columns, used if $right is fractional
178
- // @return {List} list of pulls
179
- @function grid-pull($columns: 0, $of: false) {
180
- @return grid-offset($right: $columns, $of: $of);
181
- }
182
- // convenience mixin for grid-push
183
- @mixin grid-pull($columns: 0, $of: false, $first: false, $method: position) {
184
- @include grid-offset($right: $columns, $of: $of, $first: false, $method: $method);
185
- }
186
-
187
- // this makes it possible to undo $first: true
188
- // @mixin grid-not-first
189
- @mixin grid-not-first() {
190
- margin-#{rtl(left, $CONFIG_GRID_DIRECTION)}: $CONFIG_GRID_GUTTER;
191
- }
192
-
193
- // this makes it possible to force a non first-column to behave as a first-column
194
- // @mixin grid-is-first
195
- @mixin grid-is-first() {
196
- margin-#{rtl(left, $CONFIG_GRID_DIRECTION)}: 0;
197
- }
198
-
199
- // given a set of values, output the left and right properties
200
- // @mixin grid-output-left-right
201
- // @param $property {String} prefix [margin|padding|border|etc] if false, no prefix is used
202
- // @param $values {List} the list of values to output e.g. (10px 5px). if only one value (10px), it's used for both left and right
203
- // @param $ignore {List} list of values to ignore, @see if-set
204
- @mixin grid-output-left-right($property: false, $values: false, $ignore: false) {
205
- $property: if($property, unquote('#{$property}-'), unquote(''));
206
- $left: 0;
207
- @if(length($values) > 0) {
208
- $left: nth($values,1);
209
- }
210
- $right: 0;
211
- @if(length($values) > 1) {
212
- $right: nth($values,2);
213
- }
214
- @include if-set(#{$property}#{rtl(left, $CONFIG_GRID_DIRECTION)}, $left, $ignore: $ignore);
215
- @include if-set(#{$property}#{rtl(right, $CONFIG_GRID_DIRECTION)}, $right, $ignore: $ignore);
216
- }
217
-
218
- // this lets rows clear the floated containers
219
- // @mixin grid-row
220
- // @param $debug {Boolean} use debug stylings
221
- @mixin grid-row($debug: false) {
222
- @include grid-block(true);
223
- @include debug-hover-box(rgb(255, 0, 255), $if: ($debug or $CONFIG_GRID_DEBUG));
224
- }
225
-
226
- // output the block methods
227
- // @mixin grid-block
228
- // @param $row {Boolean} is this block a row
229
- @mixin grid-block($row: false) {
230
- // FLOAT
231
- @if($CONFIG_GRID_ALIGN_METHOD == float){
232
- @if($row) {
233
- @include legacy-pie-clearfix();
234
- }
235
- @else {
236
- // make it a floater
237
- float: #{rtl(left, $CONFIG_GRID_DIRECTION)};
238
- }
239
- }
240
- // INLINE-BLOCK
241
- @else if($CONFIG_GRID_ALIGN_METHOD == inline-block) {
242
- @if($row) {
243
- // if the reading direction is different from the grid direction,
244
- // we have to switch the direction of the individual rows
245
- @if(reading-direction() != $CONFIG_GRID_DIRECTION) {
246
- direction: $CONFIG_GRID_DIRECTION;
247
- }
248
- // fix to collapse white space between inline-block elements
249
- letter-spacing: -0.313em; // webkit
250
- @if($legacy-support-for-ie6 or $legacy-support-for-ie7) {
251
- *letter-spacing: normal; // restore for IE6/7
252
- }
253
- word-spacing: -0.438em; // IE/firefox
254
- // other methods: no browsers support this yet
255
- // http://dev.w3.org/csswg/css3-text/#white-space-collapsing
256
- //white-space-collapse: discard;
257
- //text-space-collapse: collapse;
258
- }
259
- @else {
260
- // if reading direction is different from the grid direction,
261
- // reset the reading direction of the inner container
262
- @if(reading-direction() != $CONFIG_GRID_DIRECTION) {
263
- direction: reading-direction();
264
- }
265
- @include inline-block();
266
- vertical-align: top;
267
- // restore spacing @see grid-row
268
- letter-spacing: normal;
269
- word-spacing: normal;
270
- }
271
- }
272
- // TABLE-CELL (doesn't work well)
273
- @else if($CONFIG_GRID_ALIGN_METHOD == table-cell) {
274
- @warn "table-cell method doesn't work yet!";
275
- @if($row) {
276
- // if the reading direction is different from the grid direction,
277
- // we have to switch the direction of the individual rows
278
- @if(reading-direction() != $CONFIG_GRID_DIRECTION) {
279
- direction: $CONFIG_GRID_DIRECTION;
280
- }
281
- display: table;
282
- // table cells don't respect margin, so we have to use border-spacing
283
- border-spacing: $CONFIG_GRID_GUTTER 0;
284
- }
285
- @else {
286
- // if reading direction is different from the grid direction,
287
- // reset the reading direction of the inner container
288
- @if(reading-direction() != $CONFIG_GRID_DIRECTION) {
289
- direction: reading-direction();
290
- }
291
- @if($legacy-support-for-ie6 or $legacy-support-for-ie7) {
292
- *display: inline;
293
- }
294
- display: table-cell;
295
- vertical-align: top;
296
- @include has-layout();
297
- }
298
- }
299
- }
300
-
301
- // convenience method for creating a grid canvas, @see grid
302
- // @mixin grid-canvas
303
- // @param $columns {Number} the number or fraction of columns to span, if fraction, must specify $of
304
- // @param $of {Number} the total number of columns spanned, only use with fractional $columns
305
- // @param $debug {Boolean} use debug stylings
306
- @mixin grid-canvas($columns: false, $of: false, $debug: false) {
307
- @include grid($columns: $columns, $of: $of, $debug: $debug, $canvas: true);
308
- }
309
-
310
- // the main grid mixin
311
- // @mixin grid
312
- // @param $columns {Number} the number or fraction of columns to span, if fraction, must specify $of
313
- // @param $first {Boolean} is this the first grid block of a row
314
- // @param $of {Number} the total number of columns spanned, only use with fractional $columns
315
- // @param $indent {List} the grid indents @see grid-indent
316
- // @param $outdent {List} the grid outdents @see grid-outdent
317
- // @param $offset {List} the grid offsets @see grid-offset, grid-push, grid-pull
318
- // @param $canvas {Boolean} treat this grid block as a canvas; a canvas is a non-floated, centered grid-block
319
- // @param $row {Boolean} @see grid-row
320
- // @param $center {Boolean} whether or not to center the grid block
321
- // @param $debug {Boolean} use debug stylings
322
- @mixin grid($columns: false, $first: false, $of: false, $indent: false, $outdent: false, $offset: false, $offset-method: $CONFIG_GRID_OFFSET_METHOD, $canvas: false, $row: false, $center: false, $debug: false) {
323
- @if($row) {
324
- @include grid-row($debug: $debug);
325
- }
326
- @else {
327
- @if(not $columns) {
328
- $columns: $CONFIG_GRID_MAX_COLUMNS;
329
- }
330
-
331
- $width: _getGridWidth($columns, $of, $indent);
332
-
333
- // margin
334
- @if(not ($first or $canvas or $center)) {
335
- @include grid-not-first();
336
- }
337
-
338
- @if($canvas or $center) {
339
- // center it
340
- margin-left: auto;
341
- margin-right: auto;
342
-
343
- // debug
344
- @if(is-debug-enabled($debug or $CONFIG_GRID_DEBUG)) {
345
- @include column-grid-background($CONFIG_GRID_MAX_COLUMNS, $CONFIG_GRID_COLUMN, $CONFIG_GRID_GUTTER);
346
- }
347
-
348
- @if($CONFIG_GRID_ALIGN_METHOD == inline-block) {
349
- // the inline-block method needs to use horizontal overflow on the canvas to prevent an unwanted scrollbar
350
- //overflow-x: hidden;
351
- }
352
- }
353
- @else {
354
- // align the block
355
- @include grid-block();
356
- // debug
357
- @include debug-hover-box($if: ($debug or $CONFIG_GRID_DEBUG));
358
- }
359
-
360
- // offset (push, pull)
361
- @if($offset) {
362
- // ... with positioning
363
- @if($offset-method == position) {
364
- @include grid-offset-position($offset);
365
- }
366
- // ... with margin (adjust outdent)
367
- @else if($offset-method == margin) {
368
- @include grid-offset-margin($offset: $offset, $first: $first, $outdent: $outdent);
369
- $outdent: false;
370
- }
371
- // ... with padding (adjust indent)
372
- @else {
373
- $indent: list-add(get-collection($indent, 0, $min: 2), $offset);
374
- }
375
- }
376
-
377
- // indent
378
- @if($indent) {
379
- @include grid-output-left-right(padding, $indent);
380
- }
381
-
382
- // outdent
383
- @if($outdent) {
384
- @include grid-output-left-right(margin, $outdent);
385
- @include hack-negative-margin();
386
- }
387
-
388
- // width
389
- width: $width;
390
- }
391
- }