archetype 0.0.1.pre.3.00dfd9a → 0.0.1.pre.3.6ed259b

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/VERSION.yml +1 -1
  5. data/bin/archetype +3 -0
  6. data/lib/archetype.rb +4 -0
  7. data/lib/archetype/actions/help.rb +16 -0
  8. data/lib/archetype/actions/theme.rb +73 -0
  9. data/lib/archetype/executor.rb +27 -0
  10. data/lib/archetype/sass_extensions/functions/lists.rb +26 -32
  11. data/lib/archetype/sass_extensions/functions/styleguide.rb +1 -1
  12. data/lib/archetype/sass_extensions/functions/ui.rb +2 -1
  13. data/lib/archetype/sass_extensions/functions/version.rb +2 -2
  14. data/lib/archetype/version.rb +2 -2
  15. data/stylesheets/archetype/_config.scss +10 -6
  16. data/stylesheets/archetype/_hacks.scss +40 -16
  17. data/stylesheets/archetype/_ui.scss +10 -4
  18. data/stylesheets/archetype/styleguide/components/_buttons.scss +1 -0
  19. data/stylesheets/archetype/util/_styles.scss +14 -3
  20. data/templates/_theme/_components.scss +3 -0
  21. data/templates/_theme/_config.scss +1 -0
  22. data/templates/_theme/_core.scss +13 -0
  23. data/templates/_theme/_helpers.scss +1 -0
  24. data/templates/_theme/_primitives.scss +3 -0
  25. data/templates/_theme/components/README +1 -0
  26. data/templates/_theme/primitives/README +1 -0
  27. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders-s7889ccc8c1.png +0 -0
  28. data/test/fixtures/stylesheets/archetype/config.rb +2 -0
  29. data/test/fixtures/stylesheets/archetype/expected/hacks/ie_pseudo.css +3 -3
  30. data/test/fixtures/stylesheets/archetype/expected/hacks/transparent_focusable.css +4 -0
  31. data/test/fixtures/stylesheets/archetype/expected/styleguide/buttons.css +28 -0
  32. data/test/fixtures/stylesheets/archetype/expected/styleguide/extend.css +7 -0
  33. data/test/fixtures/stylesheets/archetype/expected/styleguide/selective_state.css +3 -0
  34. data/test/fixtures/stylesheets/archetype/expected/ui/glyph_icon.css +52 -5
  35. data/test/fixtures/stylesheets/archetype/expected/utilities/custom_output_styler.css +8 -0
  36. data/test/fixtures/stylesheets/archetype/expected/utilities/targeting/target-browser.css +5 -0
  37. data/test/fixtures/stylesheets/archetype/source/hacks/transparent_focusable.scss +5 -0
  38. data/test/fixtures/stylesheets/archetype/source/styleguide/extend.scss +23 -0
  39. data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +12 -0
  40. data/test/fixtures/stylesheets/archetype/source/utilities/custom_output_styler.scss +21 -0
  41. data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +8 -1
  42. data/test/helpers/test_case.rb +2 -2
  43. data/test/units/sass_extensions_test.rb +18 -25
  44. metadata +29 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97c23e2750bc27861f4602ddb1c1a80f48a172b8
4
- data.tar.gz: fe2470feea0f4c8ae90db32247c4b1a8159400ba
3
+ metadata.gz: eacb5a42bfad733d2f75f8a08cec94a3e8daa4ca
4
+ data.tar.gz: 124027950cc1132c5b6af87f3d7dec19e4320a52
5
5
  SHA512:
6
- metadata.gz: 0125375a83db183fe5f903730204110f0d77073f509696392a5ab91bee052f27e72e6539b16f567102de3be5a9c1106f35d56f6a7198eb92453407d771aa6721
7
- data.tar.gz: d53907489ca4c58266946c2ee08eb49e93f11a4a124c41d7ffba53cf920958c70e6281be8db0e8c13f683759926e710161537d86b74fec367ed15da3358d297f
6
+ metadata.gz: 96feb215ea6e7b46f6c9902a63ac491f6c3a49c41bd4fc4603187527b89ef322f1ccff9cf922e1e3a459a10f2d1f1975f61cea2c64758b9dc17ec0948b60ca83
7
+ data.tar.gz: 5c3f33dbbc76e314af88bfdb4fa22f5723ab1e1d6596d9cdcefa33c4a515df6278464f35c738fd7dfa229b1d9c0e645e680b10ff7edd000cbdd90395727963cc
data/CHANGELOG.md CHANGED
@@ -15,12 +15,19 @@
15
15
  - added `prefixed-tag()` method for consistency when generating tag names
16
16
  - added Chinese font stacks
17
17
  - added wildcard support to `locale()` function (e.g. `locale(en_ ja_JP _DE)`)
18
+ - added `transparent-focusable()` mixin for transparent background support in older IE
19
+ - added ability to customize `output-style()` with `custom-output-styler()` mixin and `has-custom-output-styler()` function (NEEDS DOCUMENTATION)
20
+ - added better support for targeting IE6/7 glyphs and `ie-pseudo()` generated elements (NEEDS DOCUMENTATION)
21
+ - making `unique()` generated IDs genuinely unique
22
+ - adding support for a `testing` config flag
23
+ - adding support for `@extend` from a styleguide component
18
24
 
19
25
  ### Resolved Issues:
20
26
 
21
27
  - quotes on strings passed to `associative()` weren't being stripped correctly
22
28
  - fixed some minor glyph issues
23
29
  - out-of-order CSS issues in Ruby 1.8.7 are fixed using `Hashery::OrderedHash`
30
+ - fixed issue with `archetype-version()` incorrectly matching comparators
24
31
 
25
32
  ### Tests:
26
33
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Archetype
2
2
 
3
- [![Build Status](https://travis-ci.org/linkedin/archetype.png)](https://travis-ci.org/linkedin/archetype)
3
+ [![Build Status](https://travis-ci.org/linkedin/archetype.png)](https://travis-ci.org/linkedin/archetype) [![Gem Version](https://badge.fury.io/rb/archetype.png)](http://badge.fury.io/rb/archetype)
4
4
 
5
5
  Archetype is a UI pattern and component library for quickly iterating on and maintaining scalable web interfaces.
6
6
 
data/VERSION.yml CHANGED
@@ -3,4 +3,4 @@
3
3
  :minor: 0
4
4
  :build: 1
5
5
  :state: pre
6
- :iteration: 3
6
+ :iteration: 3
data/bin/archetype ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join(File.dirname(__FILE__), '..', 'lib/archetype/executor')
data/lib/archetype.rb CHANGED
@@ -33,6 +33,10 @@ module Archetype
33
33
  Compass::Configuration.add_configuration_property(:memoize, "should the memoizer be used to improve compilation speed") do
34
34
  not (Compass.configuration.environment || :development).to_s.include?('dev')
35
35
  end
36
+ # testing (for running unit tests)
37
+ Compass::Configuration.add_configuration_property(:testing, "is this a testing environment") do
38
+ ENV['CI']
39
+ end
36
40
  end
37
41
  end
38
42
 
@@ -0,0 +1,16 @@
1
+ description = "Get help on an Archetype action"
2
+ if @description.nil?
3
+ # do stuff...
4
+ @help = true
5
+
6
+ if not ARGV[1].nil? and ARGV[1] != 'help'
7
+ action = File.join(@actions_path, ARGV[1])
8
+ begin
9
+ load "#{action}.rb"
10
+ rescue
11
+ puts "unknown action: #{ARGV[1]}"
12
+ end
13
+ end
14
+ else
15
+ @description = description
16
+ end
@@ -0,0 +1,73 @@
1
+ require 'fileutils'
2
+ description = "Generate a new Archetype theme"
3
+
4
+ if @description.nil?
5
+ options = {
6
+ :extends => 'archetype'
7
+ }
8
+ OptionParser.new do |opts|
9
+ opts.banner = description
10
+ opts.define_head "Usage: archetype theme [path] [options]"
11
+ opts.separator ""
12
+ opts.separator "Example usage:"
13
+ opts.separator " archetype theme /path/to/scss/ --name=myCustomTheme"
14
+ opts.separator " archetype theme --name=themes/myExtendedTheme --extends=themes/myBaseTheme"
15
+
16
+ opts.on('-n', '--name THEME', 'theme name') do |v|
17
+ options[:theme] = v
18
+ end
19
+
20
+ opts.on('-x', '--extends THEME', 'theme name to extend') do |v|
21
+ options[:extends] = v
22
+ end
23
+
24
+ opts.on('-h', '--help', 'shows this help message') do
25
+ puts opts
26
+ exit
27
+ end
28
+
29
+ if not @help.nil?
30
+ puts opts
31
+ exit
32
+ end
33
+ end.parse!
34
+
35
+ if not options[:theme].nil?
36
+ base = ARGV[1] || '.'
37
+ tmp = '/tmp/theme_' + rand(36**8).to_s(36)
38
+ theme_template = File.join(File.dirname(__FILE__), '../../../templates/_theme/')
39
+ theme_path = File.join(base, options[:theme])
40
+ extends = "#{options[:extends]}"
41
+ if options[:extends] != 'archetype'
42
+ extends = "#{extends}/core"
43
+ end
44
+ theme_name = File.basename(options[:theme])
45
+ # copy template files to tmp dir
46
+ FileUtils.mkdir_p(tmp)
47
+ FileUtils.cp_r(Dir["#{theme_template}/**"], tmp)
48
+
49
+ puts "Creating theme '#{theme_name}' in #{File.expand_path(theme_path)}..."
50
+ puts "extending from #{options[:extends]}" if options[:extends] != 'archetype'
51
+
52
+ # update all placeholders in template files
53
+ Dir.glob("#{tmp}/**/*.scss") do |filename|
54
+ out = File.read(filename).gsub(/__THEME_NAME__/, theme_name).gsub(/__THEME_EXTENDS__/, extends)
55
+ File.open(filename, "w") { |file| file.puts out }
56
+ end
57
+
58
+ # now move all the theme files to their destination
59
+ FileUtils.mkdir_p(theme_path)
60
+ FileUtils.cp_r(Dir["#{tmp}/**"], theme_path)
61
+
62
+ # create convenience file _<theme>.scss ...
63
+ File.open(File.join(File.dirname(theme_path), "_#{theme_name}.scss"), "w") { |file| file.puts "// #{theme_name} theme\n@import \"#{theme_name}/core\";\n" }
64
+
65
+ # remove tmp dir
66
+ FileUtils.rm_rf(tmp)
67
+ puts "Congratulations! Your new theme has been created!"
68
+ puts "Use @import \"#{options[:theme]}\" in your scss files."
69
+ exit
70
+ end
71
+ else
72
+ @description = description
73
+ end
@@ -0,0 +1,27 @@
1
+ require 'optparse'
2
+
3
+ @actions_path = File.join(File.dirname(__FILE__), 'actions')
4
+
5
+ if not ARGV[0].nil? and not ARGV[0].empty?
6
+ action_name = ARGV[0]
7
+ action = File.join(@actions_path, action_name)
8
+ begin
9
+ require action
10
+ rescue
11
+ puts "unknown action: #{action_name}"
12
+ end
13
+ end
14
+
15
+ # if we got here, there was either no action, or the action was invalid
16
+ OptionParser.new do |opts|
17
+ opts.banner = "Archetype command line actions\n\n"
18
+ opts.define_head "Usage: archetype <action> [options]"
19
+ opts.separator ""
20
+ opts.separator "Available Actions:"
21
+ Dir.glob("#{@actions_path}/*.rb") do |action|
22
+ @description = true
23
+ load action
24
+ opts.separator " * #{File.basename(action, '.rb')}\t- #{@description}"
25
+ end
26
+ puts opts
27
+ end.parse!
@@ -71,38 +71,6 @@ module Archetype::SassExtensions::Lists
71
71
  Sass::Script::Functions.declare :list_insert, [:list, :idx, :value]
72
72
  Sass::Script::Functions.declare :list_insert, [:list, :idx, :value, :separator]
73
73
 
74
- #
75
- # sort a list
76
- #
77
- # *Parameters*:
78
- # - <tt>$list</tt> {List} the list to sort
79
- # - <tt>$reverse</tt> {Boolean} sort the list in reverse order
80
- # *Returns*:
81
- # - {List} the sorted list
82
- #
83
- # TODO - this is failing, fix this
84
- #def list_sort(list, reverse = false)
85
- # separator = list.separator if list.is_a?(Sass::Script::List)
86
- # list = list.to_a.sort
87
- # list = list.reverse if (reverse == Sass::Script::Bool.new(true))
88
- # return Sass::Script::List.new(list, separator)
89
- #end
90
-
91
- #
92
- # reverse order a list
93
- #
94
- # *Parameters*:
95
- # - <tt>$list</tt> {List} the list to reverse
96
- # *Returns*:
97
- # - {List} the reversed list
98
- #
99
- # TODO - this is failing, fix this
100
- #def list_reverse(list)
101
- # separator = list.separator if list.is_a?(Sass::Script::List)
102
- # list = list.to_a.reverse
103
- # return Sass::Script::List.new(list, separator)
104
- #end
105
-
106
74
  #
107
75
  # add values(s) to a list
108
76
  #
@@ -245,6 +213,32 @@ module Archetype::SassExtensions::Lists
245
213
  end
246
214
  Sass::Script::Functions.declare :associative_merge, [:list, :extender]
247
215
 
216
+ #
217
+ # given a string of styles, convert it into a key-value pair list
218
+ #
219
+ # *Parameters*:
220
+ # - <tt>$string</tt> {String} the string to convert
221
+ # *Returns*:
222
+ # - <tt>$list</tt> {List} the converted list of styles
223
+ #
224
+ def _style_string_to_list(string = '')
225
+ # convert to string and strip all comments
226
+ string = helpers.to_str(string, ' ').gsub(/\/\*[^\*\/]*\*\//, '')
227
+ # then split it on each rule
228
+ tmp = string.split(';')
229
+ styles = []
230
+ # and for each rule break it into it's key-value pairs
231
+ tmp.each do |rule|
232
+ kvp = []
233
+ rule.split(':').each do |str|
234
+ kvp.push Sass::Script::String.new(str)
235
+ end
236
+ styles.push Sass::Script::List.new(kvp, :comma)
237
+ end
238
+ # the recompose the list
239
+ return Sass::Script::List.new(styles, :comma)
240
+ end
241
+
248
242
  private
249
243
  def helpers
250
244
  @helpers ||= Archetype::Functions::Helpers
@@ -17,7 +17,7 @@ module Archetype::SassExtensions::Styleguide
17
17
  SPECIAL = %w(states selectors)
18
18
  # these are unique CSS keys that can be exploited to provide fallback functionality by providing a second value
19
19
  # e.g color: red; color: rgba(255,0,0, 0.8);
20
- FALLBACKS = %w(background background-image background-color border border-bottom border-bottom-color border-color border-left border-left-color border-right border-right-color border-top border-top-color clip color layer-background-color outline outline-color white-space)
20
+ FALLBACKS = %w(background background-image background-color border border-bottom border-bottom-color border-color border-left border-left-color border-right border-right-color border-top border-top-color clip color layer-background-color outline outline-color white-space extend)
21
21
  ADDITIVES = FALLBACKS + [DROP, INHERIT, STYLEGUIDE]
22
22
  @@archetype_styleguide_mutex = Mutex.new
23
23
  # :startdoc:
@@ -21,7 +21,8 @@ module Archetype::SassExtensions::UI
21
21
  prefix = helpers.to_str(prefix, ' ', :quotes)
22
22
  prefix = '.' if prefix == 'class'
23
23
  prefix = '#' if prefix == 'id'
24
- return Sass::Script::String.new("#{prefix}archetype-uid-#{uid}")
24
+ suffix = Compass.configuration.testing ? "RANDOM_UID" : "#{Time.now.to_i}-#{rand(36**8).to_s(36)}-#{uid}"
25
+ return Sass::Script::String.new("#{prefix}archetype-uid-#{suffix}")
25
26
  end
26
27
 
27
28
  #
@@ -8,7 +8,7 @@ require 'sass/version'
8
8
  #
9
9
  module Archetype::SassExtensions::Version
10
10
  # :stopdoc:
11
- COMPARATOR_PATTERN = /([neglt]+|[><=!]+)/
11
+ COMPARATOR_PATTERN = /(\s[neqglt]+\s|[><=!]+)/
12
12
  VERSION_PATTERN = /\d+(\.\d+)*(\.[x|\*])?/
13
13
  # :startdoc:
14
14
 
@@ -60,7 +60,7 @@ private
60
60
  # check for wild cards
61
61
  wild = version.index('x')
62
62
  # check the comparison
63
- comparator = (comparator || [])[0] || 'eq'
63
+ comparator = ((comparator || [])[0] || 'eq').strip
64
64
  eq = comparator =~ /(e|=)/
65
65
  lt = comparator =~ /(l|<)/
66
66
  gt = comparator =~ /(g|>)/
@@ -10,7 +10,7 @@ module Archetype
10
10
  # Method borrowed from Compass. All credit goes to Chris Eppstein and other contributors
11
11
  # https://github.com/chriseppstein/compass/blob/stable/lib/compass/version.rb
12
12
  # \(This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum\)
13
- #
13
+ #
14
14
  # *Returns*:
15
15
  # - {String} the version of Archetype
16
16
  #
@@ -30,7 +30,7 @@ module Archetype
30
30
  def read_version
31
31
  require 'yaml'
32
32
  begin
33
- @version = YAML::load(File.read(scope('VERSION.yml')))
33
+ @version = YAML.load(File.read(scope('VERSION.yml')))
34
34
  @version[:teeny] = @version[:patch]
35
35
  @version[:string] = "#{@version[:major]}.#{@version[:minor]}"
36
36
  @version[:string] << ".#{@version[:patch]}" if @version[:patch]
@@ -40,6 +40,7 @@ $CONTENT_PLACEHOLDER: '\0020' !default;
40
40
  $CONFIG_DISABLED_CSS: () !default; // a list of CSS3 features to always disable when using output-style()
41
41
  $CONFIG_GENERATED_TAG_PREFIX: x-archetype !default; // the prefix for the tag name to create when using ie-pseudo method
42
42
  $CONFIG_GENERATED_TAG_CSS: false !default; // styles to apply to the generated tag when using ie-pseudo method (use this as a way to reset styles on these tags)
43
+ $CONFIG_GENERATED_TAG_INLINE: true !default; // if `true` insert the styles inline on the generated tag, otherwise insert the styles in a unique css rule
43
44
 
44
45
  // z-layers
45
46
  $CONFIG_Z_INDEX_BASE: 0 !default; // the default starting layer for z-index calculations
@@ -328,21 +329,21 @@ $CORE_SAFE_FONTS: (
328
329
  (win, (
329
330
  (default (Arial, sans-serif)),
330
331
  (ja_JP (メイリオ, Meiryo, 'MS Pゴシック', 'MS PGothic', default)),
331
- (zh_TW ('微軟正黑體', 'Microsoft JhengHei', PMingLiu, '宋体', SimSun, default)),
332
- (zh_CN ('华文细黑', 'STHeiti Light', '微软雅黑体', 'Microsoft Yahei', '新宋体', NSimSun, '宋体', SimSun, default)),
332
+ (zh_TW (default, '微軟正黑體', 'Microsoft JhengHei', PMingLiu, '宋体', SimSun)),
333
+ (zh_CN (default, '华文细黑', 'STHeiti Light', '微软雅黑体', 'Microsoft Yahei', '新宋体', NSimSun, '宋体', SimSun)),
333
334
  (ko_KR nil)
334
335
  )),
335
336
  (mac, (
336
337
  (default (Helvetica, Arial, sans-serif)),
337
- (zh_TW ('黑體-繁', 'Heiti TC', '儷黑Pro', 'LiHei Pro', PMingLiu, '宋体', SimSun, default)),
338
- (zh_CN ('黑体-简', 'Heiti SC', '华文细黑', 'STHeiti Light', '华文黑体', STHeiti, default)),
338
+ (zh_TW (default, '黑體-繁', 'Heiti TC', '儷黑Pro', 'LiHei Pro', PMingLiu, '宋体', SimSun)),
339
+ (zh_CN (default, '黑体-简', 'Heiti SC', '华文细黑', 'STHeiti Light', '华文黑体', STHeiti)),
339
340
  (ja_JP ('Hiragino Kaku Gothic Pro', 'ヒラギノ角ゴ Pro W3', 'MS Pゴシック', 'MS PGothic', default)),
340
341
  (ko_KR nil)
341
342
  )),
342
343
  (linux, (
343
344
  (default (Helvetica, FreeSans, 'Liberation Sans', Helmet, Arial, sans-serif)),
344
- (zh_TW (PMingLiu, '宋体', SimSun, default)),
345
- (zh_CN ('新宋体', NSimSun, '宋体', SimSun, default)),
345
+ (zh_TW (default, PMingLiu, '宋体', SimSun)),
346
+ (zh_CN (default, '新宋体', NSimSun, '宋体', SimSun)),
346
347
  (ja_JP nil),
347
348
  (ko_KR nil)
348
349
  ))
@@ -364,3 +365,6 @@ $CORE_SAFE_FONTS: (
364
365
  ); // note that this declaration isn't a `default`, but rather is enforced everytime. this can be modified (via extending $CONFIG_SAFE_FONTS)
365
366
  $CONFIG_SAFE_FONTS: () !default;
366
367
  $CONFIG_SAFE_FONTS: associative-merge($CORE_SAFE_FONTS, $CONFIG_SAFE_FONTS);
368
+
369
+ $archetype-glyph-selector: false !default;
370
+ $archetype-pseudo-selector: false !default;
@@ -34,19 +34,19 @@
34
34
  }
35
35
 
36
36
  // proxy for ie-pseudo
37
- // @mixin ie-pseudo-before
38
- // @param $styles {String} the styles to apply to the pseudo-element
39
- // @param $content {String} the content to insert into the element (similar to css `content` attribute)
40
- // @param $name {String} the name of the element
37
+ // @mixin ie-pseudo-before
38
+ // @param $styles {String} the styles to apply to the pseudo-element
39
+ // @param $content {String} the content to insert into the element (similar to css `content` attribute)
40
+ // @param $name {String} the name of the element
41
41
  @mixin ie-pseudo-before($styles: false, $content: false, $name: '') {
42
42
  @include ie-pseudo($styles, $content, before, $name);
43
43
  }
44
44
 
45
45
  // proxy for ie-pseudo
46
- // @mixin ie-pseudo-after
47
- // @param $styles {String} the styles to apply to the pseudo-element
48
- // @param $content {String} the content to insert into the element (similar to css `content` attribute)
49
- // @param $name {String} the name of the element
46
+ // @mixin ie-pseudo-after
47
+ // @param $styles {String} the styles to apply to the pseudo-element
48
+ // @param $content {String} the content to insert into the element (similar to css `content` attribute)
49
+ // @param $name {String} the name of the element
50
50
  @mixin ie-pseudo-after($styles: false, $content: false, $name: '') {
51
51
  @include ie-pseudo($styles, $content, after, $name);
52
52
  }
@@ -54,19 +54,43 @@
54
54
  // this creates a one-type executing expression that inserts an element relative to `this` element.
55
55
  // this allows some level of support for :before/:after in IE6/7
56
56
  // inspired by http://nicolasgallagher.com/better-float-containment-in-ie/
57
- // @mixin ie-pseudo
58
- // @param $styles {String} the styles to apply to the pseudo-element
59
- // @param $content {String} the content to insert into the element (similar to css `content` attribute)
60
- // @param $placement {String} [before|after] simulate :before or :after behavior
61
- // @param $name {String} the name of the element
62
- @mixin ie-pseudo($styles: false, $content: false, $placement: before, $name: '') {
57
+ // @mixin ie-pseudo
58
+ // @param $styles {String} the styles to apply to the pseudo-element
59
+ // @param $content {String} the content to insert into the element (similar to css `content` attribute)
60
+ // @param $placement {String} [before|after] simulate :before or :after behavior
61
+ // @param $name {String} the name of the element
62
+ // @param $uid {String} a custom, unique identifier for the generate element
63
+ @mixin ie-pseudo($styles: false, $content: false, $placement: before, $name: '', $uid: false) {
64
+ $archetype-pseudo-selector: false;
63
65
  @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
66
+ $uid: if($uid, $uid, unique('ie-pseudo-'));
67
+ $archetype-pseudo-selector: '& ##{$uid}';
64
68
  $method: if($placement == before, insertBefore, appendChild);
65
69
  $content: if($content and $content != nil, 'this.el.innerHTML="#{-ie-pseudo-content($content)}",', '');
66
70
  @if $CONFIG_GENERATED_TAG_CSS {
67
71
  $styles: if($styles and $styles != nil, #{$CONFIG_GENERATED_TAG_CSS}#{$styles}, $CONFIG_GENERATED_TAG_CSS);
68
72
  }
69
- $styles: if($styles and $styles != nil, 'this.el.style.cssText="#{$styles}",', '');
70
- *zoom: expression(this.runtimeStyle.zoom="1", this.el=document.createElement("#{prefixed-tag($name)}"),#{$content}#{$styles}this.#{$method}(this.el));
73
+ // if we're using inline styles...
74
+ $inline: if($styles and $styles != nil and $CONFIG_GENERATED_TAG_INLINE, 'this.el.style.cssText="#{$styles}",', '');
75
+ *zoom: expression(this.runtimeStyle.zoom="1", this.el=document.createElement("#{prefixed-tag($name)}"),this.el.id="#{$uid}",#{$content}#{$inline}this.#{$method}(this.el));
76
+ // if we're NOT using inline styles...
77
+ @if not $CONFIG_GENERATED_TAG_INLINE {
78
+ // output it on the generated selector
79
+ #{$archetype-pseudo-selector} {
80
+ @include to-styles(-style-string-to-list($styles));
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ // a hack that allows elements with transparent backgrounds to be focusable in IE
87
+ // @mixin transparent-focusable
88
+ // @param $url {String} an optional URL to point to an image (not required)
89
+ // @param $data {String} an optional data URI for a transparent image (not required)
90
+ @mixin transparent-focusable($url: url(https://), $data: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7') {
91
+ $bg: (transparent);
92
+ background: append($bg, $data);
93
+ @if $url {
94
+ @include target-browser(ie lte 7, background, append($bg, $url));
71
95
  }
72
96
  }
@@ -153,8 +153,10 @@
153
153
  // @param $size {Number} the size of the icon
154
154
  // @param $color {Color} the color of the font
155
155
  // @param $placement {String} where to place the icon [before|after|inline]
156
- // @param $ie-styles {String} styles to apply to IE6/7 (this is needed because the faux :before isn't extensible)
157
- @mixin glyph-icon($icon, $size: default, $color: inherit, $placement: before, $ie-styles: false) {
156
+ // @param $ie-styles {String} styles to apply to IE6/7 (this is needed because the faux :before isn't extendable)
157
+ // @param $ie-uid {String} a custom, unique identifier for the generate IE6/7 element
158
+ @mixin glyph-icon($icon, $size: default, $color: inherit, $placement: before, $ie-styles: false, $ie-uid: false) {
159
+ $archetype-glyph-selector: false;
158
160
  $char-mapping: nil;
159
161
  $char-code: nil;
160
162
  @if $icon {
@@ -178,7 +180,7 @@
178
180
  }
179
181
  $selector: if(index(before after, $placement), '&:#{$placement}', '&');
180
182
  #{$selector} {
181
- font-family: $CONFIG_GLYPHS_NAME;
183
+ font-family: '#{$CONFIG_GLYPHS_NAME}';
182
184
  font-weight: $CONFIG_GLYPHS_WEIGHT;
183
185
  font-style: $CONFIG_GLYPHS_STYLE;
184
186
  text-decoration: inherit;
@@ -189,6 +191,7 @@
189
191
  content: $char-code;
190
192
  }
191
193
  }
194
+ $archetype-glyph-selector: $selector;
192
195
  @if($selector != '&' and $ie-styles != nil) {
193
196
  // support for IE6/7
194
197
  $styles: "font-family:'#{$CONFIG_GLYPHS_NAME}';font-weight:#{$CONFIG_GLYPHS_WEIGHT};font-style:#{$CONFIG_GLYPHS_STYLE};text-decoration:inherit;";
@@ -201,7 +204,10 @@
201
204
  @if($ie-styles) {
202
205
  $styles: $styles + $ie-styles;
203
206
  }
204
- @include ie-pseudo($styles: $styles, $content: $char-code, $placement: $placement, $name: glyph);
207
+ @include ie-pseudo($styles: $styles, $content: $char-code, $placement: $placement, $name: glyph, $uid: $ie-uid);
208
+ @if $archetype-pseudo-selector {
209
+ $archetype-glyph-selector: '#{$selector}, #{$archetype-pseudo-selector}';
210
+ }
205
211
  }
206
212
  }
207
213
  }