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,149 +1,3 @@
1
- # :stopdoc:
2
- # This module extends the native Ruby Hash class to support deep merging
3
- # and comparing the difference between hashes.
4
- # This functionality mimics that found in ActiveSupport
5
- # @see https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
6
- #
7
- module Archetype::Functions::Hash
8
- #
9
- # recursively merge two hashes with deep merging
10
- #
11
- # *Parameters*:
12
- # - +other_hash+ {Hash} the other hash to merge with
13
- # *Returns*:
14
- # - {Hash} a new hash containing the contents of other_hash and the contents of hsh, deep merged
15
- #
16
- def rmerge(other_hash, &block)
17
- dup.rmerge!(other_hash, &block)
18
- end
19
-
20
- #
21
- # adds the contents of other_hash to hsh, deep merged
22
- #
23
- # *Parameters*:
24
- # - +other_hash+ {Hash} the other hash to merge with
25
- # *Returns*:
26
- # - {Hash} the original hash with the addition of the contents of other_hash
27
- #
28
- def rmerge!(other_hash, &block)
29
- other_hash.each_pair do |k,v|
30
- tv = self[k]
31
- if tv.is_a?(Hash) && v.is_a?(Hash)
32
- self[k] = tv.rmerge(v, &block)
33
- else
34
- self[k] = block && tv ? block.call(k, tv, v) : v
35
- end
36
- end
37
- return self
38
- end
39
-
40
- #
41
- # get the difference of another hash
42
- #
43
- # *Parameters*:
44
- # - +other_hash+ {Hash} the other hash to compare against
45
- # *Returns*:
46
- # - {Hash} a representation of the difference between the two hashes
47
- #
48
- def diff(other_hash)
49
- (self.keys + other_hash.keys).uniq.inject(Archetype::Hash.new) do |tmp, key|
50
- # special comparison for gradients
51
- are_gradients = self[key].is_a?(Compass::SassExtensions::Functions::GradientSupport::LinearGradient) and other_hash[key].is_a?(Compass::SassExtensions::Functions::GradientSupport::LinearGradient)
52
- eq_gradients = are_gradients ? (self[key].to_s == other_hash[key].to_s) : true
53
- unless self[key] == other_hash[key] and eq_gradients
54
- if self[key].kind_of?(Hash) && other_hash[key].kind_of?(Hash)
55
- tmp[key] = self[key].diff(other_hash[key])
56
- else
57
- tmp[key] = other_hash[key] || css_defaults(key)
58
- # if the key is `filter-gradient` and it was removed, we need to change the key to `ie-filter`
59
- tmp['ie-filter'] = css_defaults('ie-filter') if key == 'filter-gradient' and tmp[key].nil?
60
- # if it came back as `nil` we couldn't understand it or it has no default, so axe it
61
- tmp.delete(key) if tmp[key].nil?
62
- end
63
- end
64
- tmp
65
- end
66
- end
67
-
68
- private
69
- #
70
- # returns a best guess for the default CSS value of a given property
71
- #
72
- # *Parameters*:
73
- # - <tt>key</tt> {String} the property to lookup
74
- # *Returns*:
75
- # - {Sass::String|Sass::Number} the default value
76
- #
77
- def css_defaults(key)
78
- if @css_defaults.nil?
79
- s = {}
80
- # color
81
- s['color'] = 'inherit'
82
- # text
83
- s['font'] = s['font-size'] = s['font-family'] = s['font-style'] = s['font-variant'] = s['font-weight'] = 'inherit'
84
- s['text-decoration'] = s['text-transform'] = 'none'
85
- s['text-align'] = 'left'
86
- s['text-indent'] = 0
87
- s['text-justify'] = 'auto'
88
- s['text-overflow'] = 'clip'
89
- s['line-height'] = 'normal'
90
- # backgrounds
91
- s['background'] = 'none'
92
- s['background-color'] = 'transparent'
93
- s['background-image'] = 'none'
94
- s['background-repeat'] = 'repeat'
95
- s['background-position'] = 'left top'
96
- s['background-attachment'] = 'scroll'
97
- s['background-clip'] = 'border-box'
98
- s['background-size'] = 'auto'
99
- s['background-origin'] = 'padding-box'
100
- # borders
101
- s['border'] = s['border-top'] = s['border-left'] = s['border-bottom'] = s['border-right'] = 'none'
102
- s['border-color'] = s['border-top-color'] = s['border-left-color'] = s['border-bottom-color'] = s['border-right-color'] = 'transparent'
103
- s['border-width'] = s['border-top-width'] = s['border-left-width'] = s['border-bottom-width'] = s['border-right-width'] = 0
104
- s['border-style'] = s['border-top-style'] = s['border-left-style'] = s['border-bottom-style'] = s['border-right-style'] = 'solid'
105
- # border-radius
106
- s['border-radius'] = s['border-top-left-radius'] = s['border-top-right-radius'] = s['border-bottom-left-radius'] = s['border-bottom-right-radius'] = 0
107
- # margin
108
- s['margin'] = s['margin-top'] = s['margin-left'] = s['margin-bottom'] = s['margin-right'] = 0
109
- # padding
110
- s['padding'] = s['padding-top'] = s['padding-left'] = s['padding-bottom'] = s['padding-right'] = 0
111
- # shadows
112
- s['text-shadow'] = s['box-shadow'] = 'none'
113
- # width/height
114
- s['height'] = s['width'] = 'auto'
115
- s['min-width'] = s['max-width'] = s['min-height'] = s['max-height'] = 'none'
116
- # position
117
- s['position'] = 'static'
118
- s['top'] = s['right'] = s['bottom'] = s['left'] = 'auto'
119
- s['clear'] = s['float'] = 'none'
120
- # misc
121
- s['overflow'] = 'visible'
122
- s['opacity'] = 1
123
- s['visibility'] = 'visible'
124
- s['ie-filter'] = 'gradient(enabled=false)'
125
- s['z-index'] = 0
126
- # --------------------
127
- @css_defaults = s
128
- end
129
- value = @css_defaults[key]
130
- value = Sass::Script::String.new(value) if value.is_a? String
131
- value = Sass::Script::Number.new(value) if value.is_a? Numeric
132
- return value
133
- end
134
- end
135
-
136
- # this shims the Hash functionality to ensure we have an ordered hash guarantee
137
- module Archetype
138
- if RUBY_VERSION < '1.9'
139
- require 'hashery/ordered_hash'
140
- class Hash < Hashery::OrderedHash
141
- include Archetype::Functions::Hash
142
- end
143
- else
144
- class Hash < ::Hash
145
- include Archetype::Functions::Hash
146
- end
147
- end
148
- end
149
-
1
+ %w(extend shim).each do |dep|
2
+ require "archetype/functions/hash/#{dep}"
3
+ end
@@ -0,0 +1,74 @@
1
+ # :stopdoc:
2
+ # This module extends the native Ruby Hash class to support deep merging
3
+ # and comparing the difference between hashes.
4
+ # This functionality mimics that found in ActiveSupport
5
+ # @see https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_merge.rb
6
+ #
7
+ module Archetype::Functions::Hash
8
+ #
9
+ # recursively merge two hashes with deep merging
10
+ #
11
+ # *Parameters*:
12
+ # - +other_hash+ {Hash} the other hash to merge with
13
+ # *Returns*:
14
+ # - {Hash} a new hash containing the contents of other_hash and the contents of hsh, deep merged
15
+ #
16
+ def rmerge(other_hash, &block)
17
+ dup.rmerge!(other_hash, &block)
18
+ end
19
+
20
+ #
21
+ # adds the contents of other_hash to hsh, deep merged
22
+ #
23
+ # *Parameters*:
24
+ # - +other_hash+ {Hash} the other hash to merge with
25
+ # *Returns*:
26
+ # - {Hash} the original hash with the addition of the contents of other_hash
27
+ #
28
+ def rmerge!(other_hash, &block)
29
+ other_hash.each_pair do |k,v|
30
+ tv = self[k]
31
+ if tv.is_a?(Hash) && v.is_a?(Hash)
32
+ self[k] = tv.rmerge(v, &block)
33
+ else
34
+ self[k] = block && tv ? block.call(k, tv, v) : v
35
+ end
36
+ end
37
+ return self
38
+ end
39
+
40
+ #
41
+ # get the difference of another hash
42
+ #
43
+ # *Parameters*:
44
+ # - +other_hash+ {Hash} the other hash to compare against
45
+ # *Returns*:
46
+ # - {Hash} a representation of the difference between the two hashes
47
+ #
48
+ def diff(other_hash)
49
+ (self.keys + other_hash.keys).uniq.inject(Archetype::Hash.new) do |tmp, key|
50
+ item_1, item_2 = self[key], other_hash[key]
51
+ # special comparison for gradients
52
+ are_gradients = (item_1.class == item_2.class) && (item_1.is_a?(Compass::Core::SassExtensions::Functions::GradientSupport::LinearGradient) or item_1.is_a?(Compass::Core::SassExtensions::Functions::GradientSupport::RadialGradient))
53
+ eq_gradients = are_gradients ? (item_1.to_s == item_2.to_s) : true
54
+ unless item_1 == item_2 and eq_gradients
55
+ if item_1.kind_of?(Hash) and item_2.kind_of?(Hash)
56
+ tmp[key] = item_1.diff(item_2)
57
+ else
58
+ tmp[key] = item_2 || Archetype::Functions::CSS.default(key)
59
+ # if the key is `filter-gradient` and it was removed, we need to change the key to `ie-filter`
60
+ tmp['ie-filter'] = Archetype::Functions::CSS.default('ie-filter') if key == 'filter-gradient' and tmp[key].nil?
61
+ # if it came back as `nil` we couldn't understand it or it has no default, so axe it
62
+ tmp.delete(key) if tmp[key].nil?
63
+ end
64
+ end
65
+ tmp
66
+ end
67
+ end
68
+
69
+ unless self.respond_to?(:to_h)
70
+ def to_h
71
+ return self
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,48 @@
1
+ # :stopdoc:
2
+ # this shims the Hash functionality to ensure we have an ordered hash guarantee
3
+ module Archetype
4
+ if RUBY_VERSION < '1.9'
5
+ require 'hashery/ordered_hash'
6
+ class Hash < Hashery::OrderedHash
7
+ include Archetype::Functions::Hash
8
+
9
+ # make select behave like its 1.9+ counterpart
10
+ def select
11
+ hsh = ::Archetype::Hash.new
12
+ self.each do |key, value|
13
+ hsh[key] = value if yield(key, value)
14
+ end
15
+ return hsh
16
+ end
17
+
18
+ # make select! behave like its 1.9+ counterpart
19
+ def select!
20
+ self.each do |key, value|
21
+ self.delete[key] unless yield(key, value)
22
+ end
23
+ return self
24
+ end
25
+
26
+ # make reject behave like its 1.9+ counterpart
27
+ def reject
28
+ hsh = ::Archetype::Hash.new
29
+ self.each do |key, value|
30
+ hsh[key] = value unless yield(key, value)
31
+ end
32
+ return hsh
33
+ end
34
+
35
+ # make reject! behave like its 1.9+ counterpart
36
+ def reject!
37
+ self.each do |key, value|
38
+ self.delete[key] if yield(key, value)
39
+ end
40
+ return self
41
+ end
42
+ end
43
+ else
44
+ class Hash < ::Hash
45
+ include Archetype::Functions::Hash
46
+ end
47
+ end
48
+ end
@@ -2,7 +2,18 @@
2
2
  # This module provides a set of helper functions and methods for working with Sass literals.
3
3
  #
4
4
  module Archetype::Functions::Helpers
5
- private
5
+
6
+ # used for archetype meta objects on a Map
7
+ META = {
8
+ :meta => '-archetype-meta',
9
+ :has_multiples => 'has-multiple-values',
10
+ :values => 'values',
11
+ :message => 'message',
12
+ :original => 'original',
13
+ :decorators => {
14
+ :runtime_locales => 'has-runtime-locales'
15
+ }
16
+ }
6
17
 
7
18
  #
8
19
  # provides a convenience interface to the Compass::Logger
@@ -12,14 +23,21 @@ private
12
23
  end
13
24
 
14
25
  #
15
- # convert a Hash to a Sass::List
26
+ # provides a convenience interface for logging warnings
27
+ #
28
+ def self.warn(msg)
29
+ logger.record(:warning, msg)
30
+ end
31
+
32
+ #
33
+ # convert an Archetype::Hash to a Sass::Script::Value::List
16
34
  #
17
35
  # *Parameters*:
18
- # - <tt>hsh</tt> {Hash} the hash to convert
36
+ # - <tt>hsh</tt> {Archetype::Hash} the hash to convert
19
37
  # - <tt>depth</tt> {Integer} the depth to walk down into the hash
20
- # - <tt>separator</tt> {Symbol} the separator to use for the Sass::List
38
+ # - <tt>separator</tt> {Symbol} the separator to use for the Sass::Script::Value::List
21
39
  # *Returns*:
22
- # - {Sass::List} the converted list
40
+ # - {Sass::Script::Value::List} the converted list
23
41
  #
24
42
  def self.hash_to_list(hsh, depth = 0, separator = :comma)
25
43
  if hsh.is_a? Hash
@@ -31,35 +49,47 @@ private
31
49
  tmp = []
32
50
  item[1] = [item[1]] if not item[1].is_a? Array
33
51
  item[1].each do |i|
34
- list.push Sass::Script::List.new([Sass::Script::String.new(item[0]), hash_to_list(i, depth + 1)], separator)
52
+ list.push Sass::Script::Value::List.new([Sass::Script::Value::String.new(item[0]), hash_to_list(i, depth + 1)], separator)
35
53
  end
36
54
  end
37
55
  end
38
- return Sass::Script::List.new(list, separator)
56
+ return Sass::Script::Value::List.new(list, separator)
39
57
  end
40
58
  # if its an array, cast to a List
41
- return Sass::Script::List.new(hsh, separator) if hsh.is_a? Array
59
+ return Sass::Script::Value::List.new(hsh, separator) if hsh.is_a? Array
42
60
  # otherwise just return it
43
61
  return hsh
44
62
  end
45
63
 
46
64
  #
47
- # convert a Sass::List to a Hash
65
+ # convert a Sass::Script::Value::List to an Archetype::Hash
48
66
  #
49
67
  # *Parameters*:
50
- # - <tt>list</tt> {Sass::List} the list to convert
68
+ # - <tt>list</tt> {Sass::Script::Value::List} the list to convert
51
69
  # - <tt>depth</tt> {Integer} the depth to reach into nested Lists
52
70
  # - <tt>nest</tt> {Array} a list of keys to treat as nested objects
71
+ # - <tt>additives</tt> {Array} a list of keys that are additive
53
72
  # *Returns*:
54
- # - {Hash} the converted hash
73
+ # - {Archetype::Hash} the converted hash
55
74
  #
56
75
  def self.list_to_hash(list, depth = 0, nest = [], additives = [])
57
76
  list = list.to_a
58
77
  previous = nil
59
78
  hsh = Archetype::Hash.new
79
+ dups = Set.new
60
80
  list.each do |item|
61
81
  item = item.to_a
62
82
 
83
+ # if a 3rd item exists, we probably forgot a comma or parens somewhere
84
+ if previous.nil? and not item[2].nil?
85
+ msg = "[#{Archetype.name}:hash] you're likely missing a comma or parens in your data structure"
86
+ begin
87
+ warn("#{msg}: #{item}")
88
+ rescue
89
+ warn(msg)
90
+ end
91
+ end
92
+
63
93
  # convert the key to a string and strip off quotes
64
94
  key = to_str(item[0], ' ' , :quotes)
65
95
  # capture the value
@@ -77,7 +107,7 @@ private
77
107
  end
78
108
  elsif not previous.nil?
79
109
  # if we got here, something is wrong with the structure
80
- list.shift if to_str(list[0]) == previous # remove the first item if it's the previous key, which is now the parent key
110
+ list = list[1..-1] if to_str(list[0]) == previous # remove the first item if it's the previous key, which is now the parent key
81
111
  list = list[0].to_a # now the remaining items were munged, so split them out
82
112
  hsh = Archetype::Hash.new
83
113
  hsh[previous] = list_to_hash(list, depth - 1, nest, additives)
@@ -97,39 +127,214 @@ private
97
127
  if additives.include?(key)
98
128
  hsh[key] ||= []
99
129
  hsh[key].push(value)
130
+ dups << key
100
131
  else
101
132
  hsh[key] = value
102
133
  end
103
134
  end
104
135
  end
105
136
 
106
- logger.record(:warning, "one of your data structures is ambiguous, please double check near `#{previous}`") if not previous.nil?
137
+ dups.each do |key|
138
+ # convert it's array of values into a meta object
139
+ hsh[key] = self.array_to_meta(hsh[key])
140
+ end
141
+
142
+ warn("[#{Archetype.name}:hash] one of your data structures is ambiguous, please double check near `#{previous}`") unless (previous.nil? or previous.empty?)
107
143
 
108
144
  return hsh
109
145
  end
110
146
 
147
+ #
148
+ # convert a Sass::Script::Value::List or Sass::Script::Value::Map to an Archetype::Hash
149
+ #
150
+ # *Parameters*:
151
+ # - <tt>data</tt> {Sass::Script::Value::List|Sass::Script::Value::Map} the data to convert
152
+ # - <tt>depth</tt> {Integer} the depth to reach into nested Lists
153
+ # - <tt>nest</tt> {Array} a list of keys to treat as nested objects
154
+ # - <tt>additives</tt> {Array} a list of keys that are additive
155
+ # *Returns*:
156
+ # - {Archetype::Hash} the converted hash
157
+ #
158
+ def self.data_to_hash(data, depth = 0, nest = [], additives = [])
159
+ method = data.is_a?(Sass::Script::Value::Map) ? :map_to_hash : :list_to_hash
160
+ return self.method(method).call(data, depth, nest, additives)
161
+ end
162
+
163
+ #
164
+ # converts a Sass::Script::Value::Map to an Archetype::Hash
165
+ # - <tt>data</tt> {Sass::Script::Value::Map} the map to convert
166
+ # - <tt>depth</tt> {Integer} the depth to reach into nested Lists
167
+ # - <tt>nest</tt> {Array} a list of keys to treat as nested objects
168
+ # - <tt>additives</tt> {Array} a list of keys that are additive
169
+ # *Returns*:
170
+ # - {Archetype::Hash} the converted hash
171
+ #
172
+ def self.map_to_hash(data, depth = 0, nest = [], additives = [])
173
+ data = data.to_h if data.respond_to?(:to_h)
174
+ hsh = Archetype::Hash.new
175
+ # recurisvely convert sub-maps into a hash
176
+ data.each do |key, value|
177
+ key = to_str(key, ' ' , :quotes)
178
+ hsh[key] = value.is_a?(Sass::Script::Value::Map) ? map_to_hash(value) : value
179
+ end
180
+ return hsh
181
+ end
182
+
183
+ #
184
+ # convert an Archetype::Hash to a Sass::Script::Value::Map
185
+ #
186
+ # *Parameters*:
187
+ # - <tt>hsh</tt> {Archetype::Hash} the hash to convert
188
+ # - <tt>depth</tt> {Integer} the depth to walk down into the hash
189
+ # - <tt>separator</tt> {Symbol} the separator to use for the Sass::Script::Value::List
190
+ # *Returns*:
191
+ # - {Sass::Script::Value::List} the converted list
192
+ #
193
+ def self.hash_to_map(hsh)
194
+ if hsh.is_a? Hash
195
+ new_hsh = Archetype::Hash.new
196
+ hsh.each do |key, item|
197
+ new_hsh[Sass::Script::Value::String.new(key)] = (item.is_a? Hash) ? self.hash_to_map(item) : item
198
+ end
199
+ else
200
+ new_hsh = {}
201
+ end
202
+ return Sass::Script::Value::Map.new(new_hsh)
203
+ end
204
+
205
+ #
206
+ # convert an array of values into a Sass map with meta data
207
+ #
208
+ # *Example*:
209
+ # array_to_meta([1, "foo", "bar", 2, "baz"])
210
+ # #=> ((-archetype-meta: (has-multiple-values: true), values: (1, "foo", "bar", 2, "baz")))
211
+ # *Parameters*:
212
+ # - <tt>array</tt> {Array} the array to convert
213
+ # *Returns*:
214
+ # - {Sass::Script::Value::Map} the converted map
215
+ #
216
+ def self.array_to_meta(array)
217
+ return array[0] if array.size == 1
218
+ return Sass::Script::Value::Map.new({
219
+ Sass::Script::Value::String.new(META[:meta]) => Sass::Script::Value::Map.new({
220
+ Sass::Script::Value::String.new(META[:has_multiples]) => Sass::Script::Value::Bool.new(true)
221
+ }),
222
+ Sass::Script::Value::String.new(META[:values]) => Sass::Script::Value::List.new(array, :comma)
223
+ })
224
+ end
225
+
226
+ #
227
+ # convert a Sass map with meta data to an array of values
228
+ #
229
+ # *Example*:
230
+ # meta_to_array(((-archetype-meta: (has-multiple-values: true), values: (1, "foo", "bar", 2, "baz"))))
231
+ # #=> [1, "foo", "bar", 2, "baz"]
232
+ # *Parameters*:
233
+ # - <tt>map</tt> {Sass::Script::Value::Map} the map to convert
234
+ # *Returns*:
235
+ # - {Array} the converted array
236
+ #
237
+ def self.meta_to_array(map)
238
+ hash = map.is_a?(Sass::Script::Value::Map) ? map_to_hash(map) : map
239
+ if hash.is_a?(Hash)
240
+ meta = hash[META[:meta]]
241
+ if not meta.nil? and not meta[META[:has_multiples]].nil? and meta[META[:has_multiples]]
242
+ return (hash[META[:values]] || []).to_a
243
+ end
244
+ end
245
+ # dunno what we got, but it wasn't meta enough, so just return the original map
246
+ return map
247
+ end
248
+
249
+ #
250
+ # decorates a value into a meta object
251
+ #
252
+ # *Parameters*:
253
+ # - <tt>value</tt> {*} the value to decorate
254
+ # *Returns*:
255
+ # - {Sass::Script::Value::Map} the decorated map
256
+ #
257
+ def self.meta_decorate(value, decorator)
258
+ return Sass::Script::Value::Null.new if is_null(value)
259
+ return Sass::Script::Value::Map.new({
260
+ Sass::Script::Value::String.new(META[:meta]) => Sass::Script::Value::Map.new({
261
+ Sass::Script::Value::String.new(META[:decorators][decorator] || decorator) => Sass::Script::Value::Bool.new(true)
262
+ }),
263
+ Sass::Script::Value::String.new(META[:original]) => value
264
+ })
265
+ end
266
+
267
+ #
268
+ # adds a meta message to the hash
269
+ #
270
+ # *Parameters*:
271
+ # - <tt>hash</tt> {Hash} the hash to store the message onto
272
+ # - <tt>message</tt> {String} the message to store
273
+ # *Returns*:
274
+ # - {Hash} the hash with the injected message
275
+ #
276
+ def self.add_meta_message(hash, message)
277
+ hash[META[:meta]] = Sass::Script::Value::Map.new({
278
+ Sass::Script::Value::String.new(META[:message]) => Sass::Script::Value::String.new(message)
279
+ })
280
+ return hash
281
+ end
282
+
283
+ #
284
+ # retrieves a meta message from a hash
285
+ #
286
+ # *Parameters*:
287
+ # - <tt>hash</tt> {Hash} the hash to retrieve the message from
288
+ # *Returns*:
289
+ # - {String} the meta message stored on the hash
290
+ #
291
+ def self.get_meta_message(hash)
292
+ if not hash[META[:meta]].nil?
293
+ meta = map_to_hash(hash[META[:meta]])
294
+ message = meta[META[:message]]
295
+ return message.to_s if not message.nil?
296
+ end
297
+ return nil
298
+ end
299
+
111
300
  #
112
301
  # convert things to a String
113
302
  #
114
303
  # *Parameters*:
115
- # - <tt>value</tt> {String|Sass::String|Sass::List} the thing to convert
116
- # - <tt>separator</tt> {String} the separator to use for joining Sass::List
304
+ # - <tt>value</tt> {String|Sass::Script::Value::String|Sass::Script::Value::List} the thing to convert
305
+ # - <tt>separator</tt> {String} the separator to use for joining Sass::Script::Value::List
306
+ # - <tt>strip</tt> {\*} the properties to strip from the resulting string
117
307
  # *Returns*:
118
308
  # - {String} the converted String
119
309
  #
120
310
  def self.to_str(value, separator = ' ', strip = nil)
121
311
  if not value.is_a?(String)
122
- value = ((value.to_a).each{ |i| i.nil? ? 'nil' : (i.is_a?(String) ? i : i.value) }).join(separator || '')
312
+ value = ((value.to_a).each{ |i| i.nil? ? 'nil' : (i.is_a?(String) ? i : i.is_a?(Array) ? to_str(i, separator, strip) : i.value) }).join(separator || '')
123
313
  end
124
314
  strip = /\A"|"\Z/ if strip == :quotes
125
315
  return strip.nil? ? value : value.gsub(strip, '')
126
316
  end
127
317
 
128
318
  #
129
- # test a value for blankness or nilness
319
+ # simple test for `null` or `nil` (deprecated) value. this is here for back-compat support with old `nil` syntax
320
+ #
321
+ # *Parameters*:
322
+ # - <tt>$value</tt> {*} the value to test
323
+ # *Returns*:
324
+ # - {Boolean} whether or not the value is null
325
+ #
326
+ def self.is_null(value)
327
+ return true if value.nil?
328
+ is_deprecated_nil = (value.is_a?(Sass::Script::Value::String) && value.value == 'nil')
329
+ #helpers.warn("[#{Archetype.name}:nil] the usage of `nil` will be removed in a future release, please use the Sass standard `null`")
330
+ return value.is_a?(Sass::Script::Value::Null) || is_deprecated_nil
331
+ end
332
+
333
+ #
334
+ # test a value for various conditions
130
335
  #
131
336
  # *Parameters*:
132
- # - <tt>value</tt> {String|Array|Sass::String|Sass::List} the thing to test
337
+ # - <tt>value</tt> {String|Array|Sass::Script::Value::String|Sass::Script::Value::List} the thing to test
133
338
  # - <tt>test</tt> {Symbol} the test to perform [:blank|:nil]
134
339
  # *Returns*:
135
340
  # - {Boolean} whether or not the value is nil/blank
@@ -139,16 +344,20 @@ private
139
344
  case test
140
345
  when :blank
141
346
  is_it = false
142
- value = value.value if value.is_a?(Sass::Script::String)
347
+ value = value.value if value.is_a?(Sass::Script::Value::String)
143
348
  is_it = value.nil?
144
349
  is_it = value.empty? if value.is_a?(String)
145
- is_it = value.to_a.empty? if value.is_a?(Sass::Script::List) or value.is_a?(Array)
350
+ is_it = value.to_a.empty? if value.is_a?(Sass::Script::Value::List) or value.is_a?(Array)
146
351
  when :nil
147
352
  is_it = false
148
- value = value.value if value.is_a?(Sass::Script::String)
353
+ value = value.value if value.is_a?(Sass::Script::Value::String)
149
354
  is_it = value.nil?
150
355
  is_it = value == 'nil' if value.is_a?(String)
151
- is_it = to_str(value) == 'nil' if value.is_a?(Sass::Script::List) or value.is_a?(Array)
356
+ is_it = value.empty? if value.is_a?(Hash)
357
+ is_it = to_str(value) == 'nil' if value.is_a?(Sass::Script::Value::List) or value.is_a?(Array)
358
+ is_it = true if value.is_a?(Sass::Script::Value::Null)
359
+ when :hashy
360
+ is_it = value.is_a?(Hash) || value.is_a?(Sass::Script::Value::Map)
152
361
  end
153
362
  return is_it
154
363
  end