archetype 0.0.1.pre.13 → 1.0.0.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +97 -24
- data/README.md +11 -5
- data/VERSION +1 -0
- data/lib/archetype.rb +30 -18
- data/lib/archetype/actions/migrate.rb +152 -0
- data/lib/archetype/actions/theme.rb +6 -7
- data/lib/archetype/executor.rb +21 -7
- data/lib/archetype/extensions.rb +57 -0
- data/lib/archetype/functions.rb +2 -3
- data/lib/archetype/functions/css.rb +70 -0
- data/lib/archetype/functions/css/constants.rb +247 -0
- data/lib/archetype/functions/css/helpers.rb +265 -0
- data/lib/archetype/functions/css/routers.rb +28 -0
- data/lib/archetype/functions/css/routers/animation.rb +55 -0
- data/lib/archetype/functions/css/routers/background.rb +38 -0
- data/lib/archetype/functions/css/routers/border.rb +151 -0
- data/lib/archetype/functions/css/routers/list.rb +63 -0
- data/lib/archetype/functions/css/routers/margin_padding.rb +40 -0
- data/lib/archetype/functions/css/routers/outline.rb +56 -0
- data/lib/archetype/functions/css/routers/overflow.rb +11 -0
- data/lib/archetype/functions/css/routers/target.rb +38 -0
- data/lib/archetype/functions/css/routers/transition.rb +48 -0
- data/lib/archetype/functions/css/shorthands.rb +43 -0
- data/lib/archetype/functions/css/shorthands/animation.rb +18 -0
- data/lib/archetype/functions/css/shorthands/background.rb +68 -0
- data/lib/archetype/functions/css/shorthands/border.rb +102 -0
- data/lib/archetype/functions/hash.rb +3 -149
- data/lib/archetype/functions/hash/extend.rb +74 -0
- data/lib/archetype/functions/hash/shim.rb +48 -0
- data/lib/archetype/functions/helpers.rb +231 -22
- data/lib/archetype/functions/styleguide_memoizer.rb +18 -1
- data/lib/archetype/sass_extensions.rb +1 -3
- data/lib/archetype/sass_extensions/functions.rb +15 -1
- data/lib/archetype/sass_extensions/functions/environment.rb +152 -1
- data/lib/archetype/sass_extensions/functions/lists.rb +95 -45
- data/lib/archetype/sass_extensions/functions/locale.rb +107 -28
- data/lib/archetype/sass_extensions/functions/numbers.rb +118 -4
- data/lib/archetype/sass_extensions/functions/strings.rb +53 -0
- data/lib/archetype/sass_extensions/functions/styleguide.rb +43 -375
- data/lib/archetype/sass_extensions/functions/styleguide/components.rb +25 -0
- data/lib/archetype/sass_extensions/functions/styleguide/constants.rb +27 -0
- data/lib/archetype/sass_extensions/functions/styleguide/grammar.rb +80 -0
- data/lib/archetype/sass_extensions/functions/styleguide/helpers.rb +36 -0
- data/lib/archetype/sass_extensions/functions/styleguide/resolve.rb +159 -0
- data/lib/archetype/sass_extensions/functions/styleguide/styles.rb +146 -0
- data/lib/archetype/sass_extensions/functions/styleguide/themes.rb +40 -0
- data/lib/archetype/sass_extensions/functions/ui.rb +7 -57
- data/lib/archetype/sass_extensions/functions/ui/glyphs.rb +118 -0
- data/lib/archetype/sass_extensions/functions/ui/scopes.rb +96 -0
- data/lib/archetype/sass_extensions/functions/util.rb +14 -0
- data/lib/archetype/sass_extensions/functions/util/debug.rb +22 -0
- data/lib/archetype/sass_extensions/functions/util/hacks.rb +44 -0
- data/lib/archetype/sass_extensions/functions/util/images.rb +132 -0
- data/lib/archetype/sass_extensions/functions/util/misc.rb +220 -0
- data/lib/archetype/sass_extensions/functions/util/spacing.rb +83 -0
- data/lib/archetype/sass_extensions/functions/version.rb +12 -17
- data/lib/archetype/version.rb +1 -1
- data/stylesheets/archetype/_config.scss +1 -389
- data/stylesheets/archetype/_core.scss +15 -0
- data/stylesheets/archetype/_hacks.scss +4 -120
- data/stylesheets/archetype/_init.scss +4 -22
- data/stylesheets/archetype/_required.scss +3 -0
- data/stylesheets/archetype/_reset.scss +3 -0
- data/stylesheets/archetype/_styleguide.scss +2 -6
- data/stylesheets/archetype/_ui.scss +2 -358
- data/stylesheets/archetype/_util.scss +3 -10
- data/stylesheets/archetype/config/_core.scss +14 -0
- data/stylesheets/archetype/config/_environment.scss +19 -0
- data/stylesheets/archetype/config/_formatting.scss +63 -0
- data/stylesheets/archetype/config/_glyphs.scss +252 -0
- data/stylesheets/archetype/config/_resets.scss +7 -0
- data/stylesheets/archetype/config/_resolution.scss +3 -0
- data/stylesheets/archetype/config/_spacing.scss +5 -0
- data/stylesheets/archetype/config/_targeting.scss +18 -0
- data/stylesheets/archetype/config/_theme.scss +3 -0
- data/stylesheets/archetype/config/_typography.scss +56 -0
- data/stylesheets/archetype/config/_units.scss +2 -0
- data/stylesheets/archetype/config/_vars.scss +10 -0
- data/stylesheets/archetype/hacks/_core.scss +4 -0
- data/stylesheets/archetype/hacks/_hacks.scss +160 -0
- data/stylesheets/archetype/hacks/_init.scss +2 -0
- data/stylesheets/archetype/styleguide/_core.scss +4 -0
- data/stylesheets/archetype/styleguide/_init.scss +1 -0
- data/stylesheets/archetype/styleguide/_styleguide.scss +41 -18
- data/stylesheets/archetype/ui/_accessibility.scss +41 -0
- data/stylesheets/archetype/ui/_breakpoints.scss +19 -0
- data/stylesheets/archetype/ui/_core.scss +10 -0
- data/stylesheets/archetype/ui/_elements.scss +98 -0
- data/stylesheets/archetype/ui/_glyphs.scss +244 -0
- data/stylesheets/archetype/ui/_init.scss +5 -0
- data/stylesheets/archetype/ui/_layout.scss +37 -0
- data/stylesheets/archetype/ui/_locale.scss +12 -0
- data/stylesheets/archetype/ui/_scopes.scss +42 -0
- data/stylesheets/archetype/util/_core.scss +8 -0
- data/stylesheets/archetype/util/_debug.scss +9 -21
- data/stylesheets/archetype/util/_init.scss +1 -0
- data/stylesheets/archetype/util/_misc.scss +21 -86
- data/stylesheets/archetype/util/_spacing.scss +9 -40
- data/stylesheets/archetype/util/_styles.scss +189 -178
- data/stylesheets/archetype/util/_targeting.scss +51 -68
- data/templates/example/manifest.rb +2 -2
- data/templates/example/screen.scss +0 -1
- data/templates/project/manifest.rb +3 -8
- metadata +93 -263
- data/bin/archetype +0 -3
- data/lib/archetype/sass_extensions/monkey_patches.rb +0 -3
- data/lib/archetype/sass_extensions/monkey_patches/handle_include_loop.rb +0 -13
- data/stylesheets/archetype/_base.scss +0 -54
- data/stylesheets/archetype/_grid.scss +0 -3
- data/stylesheets/archetype/base/_h5bp.scss +0 -307
- data/stylesheets/archetype/base/_hybrid.scss +0 -25
- data/stylesheets/archetype/base/_normalize.scss +0 -634
- data/stylesheets/archetype/base/_reset.scss +0 -72
- data/stylesheets/archetype/grid/_config.scss +0 -14
- data/stylesheets/archetype/grid/_grid.scss +0 -391
- data/stylesheets/archetype/styleguide/_components.scss +0 -25
- data/stylesheets/archetype/styleguide/_helpers.scss +0 -215
- data/stylesheets/archetype/styleguide/_primitives.scss +0 -10
- data/stylesheets/archetype/styleguide/components/_alerts.scss +0 -59
- data/stylesheets/archetype/styleguide/components/_annotations.scss +0 -27
- data/stylesheets/archetype/styleguide/components/_bristol.scss +0 -15
- data/stylesheets/archetype/styleguide/components/_button_groups.scss +0 -47
- data/stylesheets/archetype/styleguide/components/_button_toolbars.scss +0 -17
- data/stylesheets/archetype/styleguide/components/_buttons.scss +0 -339
- data/stylesheets/archetype/styleguide/components/_canvas.scss +0 -15
- data/stylesheets/archetype/styleguide/components/_carets.scss +0 -336
- data/stylesheets/archetype/styleguide/components/_closes.scss +0 -63
- data/stylesheets/archetype/styleguide/components/_container.scss +0 -27
- data/stylesheets/archetype/styleguide/components/_copy.scss +0 -85
- data/stylesheets/archetype/styleguide/components/_flyouts.scss +0 -52
- data/stylesheets/archetype/styleguide/components/_headings.scss +0 -33
- data/stylesheets/archetype/styleguide/components/_headlines.scss +0 -64
- data/stylesheets/archetype/styleguide/components/_hovercards.scss +0 -27
- data/stylesheets/archetype/styleguide/components/_icons.scss +0 -17
- data/stylesheets/archetype/styleguide/components/_identities.scss +0 -34
- data/stylesheets/archetype/styleguide/components/_links.scss +0 -68
- data/stylesheets/archetype/styleguide/components/_loaders.scss +0 -154
- data/stylesheets/archetype/styleguide/components/_menu_items.scss +0 -31
- data/stylesheets/archetype/styleguide/components/_module.scss +0 -15
- data/stylesheets/archetype/styleguide/components/_pullquotes.scss +0 -29
- data/stylesheets/archetype/styleguide/components/_punchcut.scss +0 -18
- data/stylesheets/archetype/styleguide/components/_tooltips.scss +0 -28
- data/stylesheets/archetype/styleguide/primitives/_animations.scss +0 -17
- data/stylesheets/archetype/styleguide/primitives/_dimensions.scss +0 -50
- data/stylesheets/archetype/styleguide/primitives/_glyphs.scss +0 -11
- data/stylesheets/archetype/styleguide/primitives/_misc.scss +0 -8
- data/stylesheets/archetype/styleguide/primitives/_palettes.scss +0 -94
- data/stylesheets/archetype/styleguide/primitives/_shadows.scss +0 -23
- data/stylesheets/archetype/styleguide/primitives/_sprites.scss +0 -46
- data/stylesheets/archetype/styleguide/primitives/_textures.scss +0 -10
- data/stylesheets/archetype/styleguide/primitives/_typography.scss +0 -56
- data/stylesheets/archetype/util/_lists.scss +0 -57
- data/stylesheets/archetype/util/_rtl.scss +0 -279
- data/stylesheets/archetype/util/_units.scss +0 -18
- data/templates/project/screen.scss +0 -1
- data/templates/project/vendor/archetype/animations/loaders/large/large.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/large/large_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
- data/templates/project/vendor/archetype/animations/loaders/small/small_static.png +0 -0
- data/templates/project/vendor/archetype/fontawesome-webfont.eot +0 -0
- data/templates/project/vendor/archetype/fontawesome-webfont.svg +0 -255
- data/templates/project/vendor/archetype/fontawesome-webfont.ttf +0 -0
- data/templates/project/vendor/archetype/fontawesome-webfont.woff +0 -0
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.eot +0 -0
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.svg +0 -255
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/test/fixtures/stylesheets/archetype/assets/fonts/fontawesome-webfont.woff +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders-s7889ccc8c1.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_dark_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/large/large_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_dark_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/medium/medium_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_dark_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders/small/small_static.png +0 -0
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/sprites/hovercard_tip.png +0 -0
- data/test/fixtures/stylesheets/archetype/config.rb +0 -21
- data/test/fixtures/stylesheets/archetype/source/b.scss +0 -9
- data/test/fixtures/stylesheets/archetype/source/base.scss +0 -3
- data/test/fixtures/stylesheets/archetype/source/hacks/ie_pseudo.scss +0 -13
- data/test/fixtures/stylesheets/archetype/source/hacks/transparent_focusable.scss +0 -5
- data/test/fixtures/stylesheets/archetype/source/locale.scss +0 -43
- data/test/fixtures/stylesheets/archetype/source/styleguide/alerts.scss +0 -21
- data/test/fixtures/stylesheets/archetype/source/styleguide/buttons.scss +0 -18
- data/test/fixtures/stylesheets/archetype/source/styleguide/drop.scss +0 -101
- data/test/fixtures/stylesheets/archetype/source/styleguide/extend.scss +0 -24
- data/test/fixtures/stylesheets/archetype/source/styleguide/fallback_styles.scss +0 -23
- data/test/fixtures/stylesheets/archetype/source/styleguide/invalid_structures.scss +0 -85
- data/test/fixtures/stylesheets/archetype/source/styleguide/multi_value.scss +0 -18
- data/test/fixtures/stylesheets/archetype/source/styleguide/nested_styleguides.scss +0 -40
- data/test/fixtures/stylesheets/archetype/source/styleguide/selective_state.scss +0 -22
- data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +0 -35
- data/test/fixtures/stylesheets/archetype/source/ui/hide_element.scss +0 -5
- data/test/fixtures/stylesheets/archetype/source/ui/stroke.scss +0 -13
- data/test/fixtures/stylesheets/archetype/source/ui/triangle.scss +0 -13
- data/test/fixtures/stylesheets/archetype/source/utilities/associative.scss +0 -24
- data/test/fixtures/stylesheets/archetype/source/utilities/custom_output_styler.scss +0 -22
- data/test/fixtures/stylesheets/archetype/source/utilities/if-set.scss +0 -16
- data/test/fixtures/stylesheets/archetype/source/utilities/spacing/horizontal-spacing.scss +0 -27
- data/test/fixtures/stylesheets/archetype/source/utilities/spacing/vertical-spacing.scss +0 -27
- data/test/fixtures/stylesheets/archetype/source/utilities/styles/filter.scss +0 -9
- data/test/fixtures/stylesheets/archetype/source/utilities/styles/font-family.scss +0 -9
- data/test/fixtures/stylesheets/archetype/source/utilities/styles/z-index.scss +0 -18
- data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +0 -77
- data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-os.scss +0 -42
- data/test/fixtures/stylesheets/archetype/tmp/b.css +0 -14
- data/test/fixtures/stylesheets/archetype/tmp/base.css +0 -349
- data/test/fixtures/stylesheets/archetype/tmp/hacks/ie_pseudo.css +0 -11
- data/test/fixtures/stylesheets/archetype/tmp/hacks/transparent_focusable.css +0 -4
- data/test/fixtures/stylesheets/archetype/tmp/locale.css +0 -23
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/alerts.css +0 -711
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/buttons.css +0 -2119
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/drop.css +0 -63
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/extend.css +0 -11
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/fallback_styles.css +0 -10
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/invalid_structures.css +0 -21
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/multi_value.css +0 -13
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/nested_styleguides.css +0 -28
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/selective_state.css +0 -177
- data/test/fixtures/stylesheets/archetype/tmp/ui/glyph_icon.css +0 -127
- data/test/fixtures/stylesheets/archetype/tmp/ui/hide_element.css +0 -8
- data/test/fixtures/stylesheets/archetype/tmp/ui/stroke.css +0 -17
- data/test/fixtures/stylesheets/archetype/tmp/ui/triangle.css +0 -35
- data/test/fixtures/stylesheets/archetype/tmp/utilities/associative.css +0 -9
- data/test/fixtures/stylesheets/archetype/tmp/utilities/custom_output_styler.css +0 -8
- data/test/fixtures/stylesheets/archetype/tmp/utilities/if-set.css +0 -9
- data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/horizontal-spacing.css +0 -29
- data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/vertical-spacing.css +0 -29
- data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/filter.css +0 -11
- data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/font-family.css +0 -16
- data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/z-index.css +0 -15
- data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-browser.css +0 -105
- data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-os.css +0 -55
- data/test/helpers/diff.rb +0 -49
- data/test/helpers/io.rb +0 -36
- data/test/helpers/test_case.rb +0 -62
- data/test/integrations/archetype_test.rb +0 -126
- data/test/test_helper.rb +0 -26
- data/test/units/sass_extensions_test.rb +0 -200
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
$archetype-glyph-selector: null !default;
|
|
2
|
+
$archetype-pseudo-selector: null !default;
|
|
3
|
+
$archetype-placeholder-registry: () !default;
|
|
4
|
+
|
|
5
|
+
// TODO - not sure if these should be defaulted or not, who knows?
|
|
6
|
+
$archetype-current-value: null !global;
|
|
7
|
+
$archetype-origin-function: null !global;
|
|
8
|
+
|
|
9
|
+
$CORE_GLYPH_SELECTOR_VAR: '$archetype-glyph-selector';
|
|
10
|
+
$CORE_GLYPH_SELECTOR_VAR: '$archetype-pseudo-selector';
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// @category hacks
|
|
2
|
+
|
|
3
|
+
$a-blackhole: require-archetype-modules(archetype/config);
|
|
4
|
+
|
|
5
|
+
// hack to support negative margins in legacy IE
|
|
6
|
+
// @mixin hack-negative-margin
|
|
7
|
+
@mixin hack-negative-margin() {
|
|
8
|
+
@if(support-legacy-browser('ie', '7', $threshold: $critical-usage-threshold)) {
|
|
9
|
+
@include has-layout();
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// max-height hack
|
|
15
|
+
// @mixin max-height
|
|
16
|
+
// @param $value {String} the height
|
|
17
|
+
@mixin max-height($value) {
|
|
18
|
+
@include hacked-maximum(height, $value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// max-width hack
|
|
22
|
+
// @mixin max-width
|
|
23
|
+
// @param $value {String} the width
|
|
24
|
+
@mixin max-width($value) {
|
|
25
|
+
@include hacked-maximum(width, $value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// generic max-* hack wrapper
|
|
29
|
+
// @mixin hacked-maximum
|
|
30
|
+
// @param $property {String} property [height|width]
|
|
31
|
+
// @param $value {String} the value
|
|
32
|
+
@mixin hacked-maximum($property, $value) {
|
|
33
|
+
max-#{$property}: $value;
|
|
34
|
+
@include underscore-hack($property, auto, $value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// helper to create a :before pseudo element
|
|
38
|
+
// @mixin before
|
|
39
|
+
// @param $content {String} the content to set on the element
|
|
40
|
+
// @content
|
|
41
|
+
@mixin before($content: false) {
|
|
42
|
+
@include -archetype-pseudo($placement: before, $content: $content) {
|
|
43
|
+
@content;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// helper to create a :after pseudo element
|
|
48
|
+
// @mixin after
|
|
49
|
+
// @param $content {String} the content to set on the element
|
|
50
|
+
// @content
|
|
51
|
+
@mixin after($content: false) {
|
|
52
|
+
@include -archetype-pseudo($placement: after, $content: $content) {
|
|
53
|
+
@content;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// creates a cross-browser pseudo before/after element
|
|
58
|
+
// @mixin after
|
|
59
|
+
// @param $content {String} the content to set on the element
|
|
60
|
+
// @content
|
|
61
|
+
@mixin -archetype-pseudo($placement: before, $content: false) {
|
|
62
|
+
$selector: '&:#{$placement}';
|
|
63
|
+
@include ie-pseudo($placement: $placement, $content: $content);
|
|
64
|
+
$archetype-pseudo-selector: if($archetype-pseudo-selector, '#{$selector}, #{$archetype-pseudo-selector}', $selector) !global;
|
|
65
|
+
#{$archetype-pseudo-selector} {
|
|
66
|
+
@if $content {
|
|
67
|
+
content: $content;
|
|
68
|
+
}
|
|
69
|
+
@content;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// proxy for ie-pseudo
|
|
74
|
+
// @mixin ie-pseudo-before
|
|
75
|
+
// @param $styles {String} the styles to apply to the pseudo-element
|
|
76
|
+
// @param $content {String} the content to insert into the element (similar to css `content` attribute)
|
|
77
|
+
// @param $name {String} the name of the element
|
|
78
|
+
// @content
|
|
79
|
+
@mixin ie-pseudo-before($styles: false, $content: false, $name: '') {
|
|
80
|
+
@include ie-pseudo($styles, $content, before, $name) {
|
|
81
|
+
@content;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// proxy for ie-pseudo
|
|
86
|
+
// @mixin ie-pseudo-after
|
|
87
|
+
// @param $styles {String} the styles to apply to the pseudo-element
|
|
88
|
+
// @param $content {String} the content to insert into the element (similar to css `content` attribute)
|
|
89
|
+
// @param $name {String} the name of the element
|
|
90
|
+
// @content
|
|
91
|
+
@mixin ie-pseudo-after($styles: false, $content: false, $name: '') {
|
|
92
|
+
@include ie-pseudo($styles, $content, after, $name) {
|
|
93
|
+
@content;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// this creates a one-time executing expression that inserts an element relative to `this` element.
|
|
98
|
+
// this allows some level of support for :before/:after in IE6/7
|
|
99
|
+
// inspired by http://nicolasgallagher.com/better-float-containment-in-ie/
|
|
100
|
+
// @mixin ie-pseudo
|
|
101
|
+
// @param $styles {String} the styles to apply to the pseudo-element
|
|
102
|
+
// @param $content {String} the content to insert into the element (similar to css `content` attribute)
|
|
103
|
+
// @param $placement {String} [before|after] simulate :before or :after behavior
|
|
104
|
+
// @param $name {String} the name of the element
|
|
105
|
+
// @param $uid {String} a custom, unique identifier for the generate element
|
|
106
|
+
// @content
|
|
107
|
+
@mixin ie-pseudo($styles: false, $content: false, $placement: before, $name: '', $uid: false) {
|
|
108
|
+
$archetype-pseudo-selector: null !global;
|
|
109
|
+
@if(support-legacy-browser('ie', '7', $threshold: $critical-usage-threshold)) {
|
|
110
|
+
$uid: if($uid, $uid, unique('ie-pseudo-'));
|
|
111
|
+
$archetype-pseudo-selector: '& ##{$uid}' !global;
|
|
112
|
+
$this: 't';
|
|
113
|
+
$method: if($placement == before, insertBefore, appendChild);
|
|
114
|
+
@if $CONFIG_GENERATED_TAG_CSS {
|
|
115
|
+
$styles: if($styles and not is_null($styles), #{$CONFIG_GENERATED_TAG_CSS}#{$styles}, $CONFIG_GENERATED_TAG_CSS);
|
|
116
|
+
}
|
|
117
|
+
$cmd: (unquote('#{$this}.el=document.createElement("#{prefixed-tag($name)}"),#{$this}.el.id="#{$uid}"'));
|
|
118
|
+
$method: if($placement == before, insertBefore, appendChild);
|
|
119
|
+
@if $content and not is_null($content) {
|
|
120
|
+
$cmd: append($cmd, unquote('#{$this}.el.innerHTML="#{-ie-pseudo-content($content)}"'));
|
|
121
|
+
}
|
|
122
|
+
@if $styles and not is_null($styles) and $styles != '' and $CONFIG_GENERATED_TAG_INLINE {
|
|
123
|
+
// sets the icon styles on the node if we're using inline styles...
|
|
124
|
+
$cmd: append($cmd, unquote('#{$this}.el.style.cssText="#{$styles}"'));
|
|
125
|
+
}
|
|
126
|
+
// if we're using the insertBefore method, we need to specify the node reference to the first childNode
|
|
127
|
+
$reference-node: if($placement == before, ',#{$this}.childNodes[0]||null', '');
|
|
128
|
+
$cmd: append($cmd, unquote('#{$this}.#{$method}(#{$this}.el#{$reference-node})'));
|
|
129
|
+
$runOnce: unquote('this.runtimeStyle.zoom="1"'); // this ensures the expression is only invoked once
|
|
130
|
+
|
|
131
|
+
// delim with a single comma, no spaces
|
|
132
|
+
$cmd: list-join($cmd, ',');
|
|
133
|
+
|
|
134
|
+
// we execute in a setTimeout to decouple from the current UI thread
|
|
135
|
+
// this prevents an edge case in IE crashing with an `Operation Aborted` if the node hasn't finished rendering yet
|
|
136
|
+
// http://www.nczonline.net/blog/2008/03/17/the-dreaded-operation-aborted-error/
|
|
137
|
+
*zoom: expression(#{$runOnce},(function(#{$this}){setTimeout(function(){#{$cmd}})}(this)));
|
|
138
|
+
|
|
139
|
+
// if we're NOT using inline styles...
|
|
140
|
+
@if not $CONFIG_GENERATED_TAG_INLINE and $styles and not is_null($styles) {
|
|
141
|
+
// output it on the generated selector
|
|
142
|
+
#{$archetype-pseudo-selector} {
|
|
143
|
+
@include to-styles(-style-string-to-map(unquote($styles)));
|
|
144
|
+
@content;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// a hack that allows elements with transparent backgrounds to be focusable in IE
|
|
151
|
+
// @mixin transparent-focusable
|
|
152
|
+
// @param $url {String} an optional URL to point to an image (not required)
|
|
153
|
+
// @param $data {String} an optional data URI for a transparent image (not required)
|
|
154
|
+
@mixin transparent-focusable($url: url(https://), $data: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7') {
|
|
155
|
+
$bg: (transparent);
|
|
156
|
+
background: append($bg, $data);
|
|
157
|
+
@if $url {
|
|
158
|
+
@include target-browser(ie lte 7, background, append($bg, $url));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$a-blackhole: require-archetype-modules(archetype/styleguide);
|
|
@@ -7,35 +7,58 @@
|
|
|
7
7
|
// @param $exclude {List} a list of styles to exclude from output
|
|
8
8
|
// @param $state {String} a specific state to output
|
|
9
9
|
// @param $theme {String} the theme name
|
|
10
|
-
@
|
|
10
|
+
// @param $here {Boolean} if true, will force the content to be output in the current context, and not extended
|
|
11
|
+
// @content
|
|
12
|
+
@mixin styleguide($is: (), $is-2: false, $is-3: false, $is-4: false, $is-5: false, $is-6: false, $is-7: false, $is-8: false, $is-9: false, $is-10: false, $exclude: (), $state: null, $theme: $CONFIG_THEME, $here: null) {
|
|
11
13
|
$definition: compact($is, $is-2, $is-3, $is-4, $is-5, $is-6, $is-7, $is-8, $is-9, $is-10);
|
|
12
14
|
@if length($definition) > 0 {
|
|
13
|
-
$styles:
|
|
14
|
-
// output
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
$styles: _styleguide($definition, $state, $theme);
|
|
16
|
+
// output the styles
|
|
17
|
+
$archetype-origin-function: styleguide !global;
|
|
18
|
+
@include to-styles($styles, $exclude: $exclude, $here: $here) {
|
|
19
|
+
@content;
|
|
20
|
+
};
|
|
21
|
+
$archetype-origin-function: null !global;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
// returns the styleguide object
|
|
26
|
+
// @function styleguide
|
|
27
|
+
// @param $is ... $is-10 {List} a descriptive definition of the element, must contain an ID and optionally any modifiers e.g. `large primary button`
|
|
28
|
+
// @param $exclude {List} a list of styles to exclude from output
|
|
29
|
+
// @param $state {String} a specific state to output
|
|
30
|
+
// @param $theme {String} the theme name
|
|
31
|
+
@function styleguide($is: (), $is-2: false, $is-3: false, $is-4: false, $is-5: false, $is-6: false, $is-7: false, $is-8: false, $is-9: false, $is-10: false, $exclude: (), $state: null, $theme: $CONFIG_THEME) {
|
|
32
|
+
$definition: compact($is, $is-2, $is-3, $is-4, $is-5, $is-6, $is-7, $is-8, $is-9, $is-10);
|
|
33
|
+
@return _styleguide($definition, $state, $theme);
|
|
34
|
+
}
|
|
35
|
+
|
|
23
36
|
// output the difference between two styelguide invocations
|
|
24
37
|
// @mixin styleguide-diff
|
|
25
38
|
// @param $original {List} the original styleguide reference to compare to
|
|
26
39
|
// @param $other {List} the other styleguide reference
|
|
27
40
|
// @param $exclude {List} a list of styles to exclude from output
|
|
28
41
|
// @param $theme {String} the theme name
|
|
29
|
-
@
|
|
30
|
-
|
|
31
|
-
$
|
|
32
|
-
$diff: styleguide-diff($original, $other, $theme);
|
|
42
|
+
// @content
|
|
43
|
+
@mixin styleguide-diff($original, $other, $exclude: ()) {
|
|
44
|
+
$diff: styleguide-diff($original, $other);
|
|
33
45
|
@if length($diff) > 0 {
|
|
34
|
-
// output
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
// output the styles
|
|
47
|
+
$archetype-origin-function: styleguide-diff !global;
|
|
48
|
+
@include to-styles($diff, $exclude: $exclude, $meta: (origin: styleguide-diff)) {
|
|
49
|
+
@content;
|
|
50
|
+
};
|
|
51
|
+
$archetype-origin-function: null !global;
|
|
40
52
|
}
|
|
41
53
|
}
|
|
54
|
+
|
|
55
|
+
// checks to see whether or not a component should be registered
|
|
56
|
+
// @function should-register-component
|
|
57
|
+
// @param $component-id {String} the component identifier
|
|
58
|
+
// @param $extension-id {String} the extension identifier
|
|
59
|
+
// @return {Boolean} whether or not the component should be registered
|
|
60
|
+
@function should-register-component($component-id, $extension-id: null) {
|
|
61
|
+
$component-exists: if($extension-id, styleguide-component-exists($component-id, $CONFIG_THEME), styleguide-component-exists($component-id, $CONFIG_THEME, $extension-id));
|
|
62
|
+
$component-excluded: index($CONFIG_THEME_EXCLUDE, $component-id);
|
|
63
|
+
@return not ($component-exists or $component-excluded);
|
|
64
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// @category ui/accessibility
|
|
2
|
+
|
|
3
|
+
// throw an error if archetype/ui has not been registered
|
|
4
|
+
$a-blackhole: require-archetype-modules(archetype/ui);
|
|
5
|
+
|
|
6
|
+
// hide element visibly but preserve screen-reader support
|
|
7
|
+
// @mixin hide-element
|
|
8
|
+
// @credit Jonathan Snook
|
|
9
|
+
// @link http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
|
|
10
|
+
@mixin hide-element() {
|
|
11
|
+
position: absolute !important;
|
|
12
|
+
height: 1px;
|
|
13
|
+
width: 1px;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
@include target-browser(ie lte 7, clip, rect(1px 1px 1px 1px));
|
|
16
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// reverse hide-element and make the element visible again
|
|
20
|
+
// @mixin unhide-element
|
|
21
|
+
// @see hide-element
|
|
22
|
+
// @param $position {String} value for the position property
|
|
23
|
+
// @param $height {String} value for the height property
|
|
24
|
+
// @param $width {String} value for the width property
|
|
25
|
+
// @param $overflow {String} value for the overflow property
|
|
26
|
+
@mixin unhide-element($position: static, $height: auto, $width: auto, $overflow: visible) {
|
|
27
|
+
position: $position !important;
|
|
28
|
+
height: $height;
|
|
29
|
+
width: $width;
|
|
30
|
+
overflow: $overflow;
|
|
31
|
+
clip: auto;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// a method for removing default styling from a button
|
|
35
|
+
// @mixin unstyled-button
|
|
36
|
+
@mixin unstyled-button() {
|
|
37
|
+
background: none;
|
|
38
|
+
border: none;
|
|
39
|
+
padding: 0;
|
|
40
|
+
@include appearance(none);
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @category ui/breakpoints
|
|
2
|
+
|
|
3
|
+
// wraps the content block in a breakpoint media query
|
|
4
|
+
// @mixin breakpoint
|
|
5
|
+
// @param $key {String} the breakpoint to use
|
|
6
|
+
// @content
|
|
7
|
+
@mixin breakpoint($key) {
|
|
8
|
+
$breakpoint: get-breakpoint($key);
|
|
9
|
+
@if $breakpoint {
|
|
10
|
+
@media #{$breakpoint} {
|
|
11
|
+
/* [archetype:breakpoint:begin] --- #{$key} --- */
|
|
12
|
+
@content;
|
|
13
|
+
/* [archetype:breakpoint:end] --- #{$key} --- */
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
@else {
|
|
17
|
+
@warn "[archetype:breakpoint] could not find a breakpoint for `#{$key}`";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// @category ui/elements
|
|
2
|
+
|
|
3
|
+
// throw an error if archetype/ui has not been registered
|
|
4
|
+
$a-blackhole: require-archetype-modules(archetype/ui);
|
|
5
|
+
|
|
6
|
+
// computes the border position to use
|
|
7
|
+
// @function _getTriangleBorderDirection
|
|
8
|
+
// @private
|
|
9
|
+
// @param $direction {String} the direction the arrow is pointing (top, left, top left, etc)
|
|
10
|
+
// @return {List} the computed border position (e.g. top, left, bottom)
|
|
11
|
+
@function _getTriangleBorderDirection($direction) {
|
|
12
|
+
@if(length($direction) == 1) {
|
|
13
|
+
@return opposite-position($direction);
|
|
14
|
+
}
|
|
15
|
+
@return if(index($direction, top), bottom, top);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// computes the border width for the triangle
|
|
19
|
+
// @function _getTriangleBorderWidth
|
|
20
|
+
// @private
|
|
21
|
+
// @param $width {Number} the width of the arrow
|
|
22
|
+
// @param $height {Number} the height of the arrow
|
|
23
|
+
// @param $direction {String} the direction the arrow is pointing (top, left, top left, etc)
|
|
24
|
+
// @return {List} the computed border widths
|
|
25
|
+
@function _getTriangleBorderWidth($width, $height, $direction) {
|
|
26
|
+
@if(length($direction) == 1) {
|
|
27
|
+
// TOP
|
|
28
|
+
@if($direction == top) {
|
|
29
|
+
@return 0 ($width/2) $height;
|
|
30
|
+
}
|
|
31
|
+
// BOTTOM
|
|
32
|
+
@else if($direction == bottom) {
|
|
33
|
+
@return $height ($width/2) 0;
|
|
34
|
+
}
|
|
35
|
+
// LEFT
|
|
36
|
+
@else if($direction == left) {
|
|
37
|
+
@return ($height/2) $width ($height/2) 0;
|
|
38
|
+
}
|
|
39
|
+
// RIGHT
|
|
40
|
+
@else if($direction == right) {
|
|
41
|
+
@return ($height/2) 0 ($height/2) $width;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
@else if(index($direction, top)) {
|
|
45
|
+
// TOP LEFT
|
|
46
|
+
@if(index($direction, left)) {
|
|
47
|
+
@return 0 $width $height 0;
|
|
48
|
+
}
|
|
49
|
+
// TOP RIGHT
|
|
50
|
+
@else {
|
|
51
|
+
@return 0 0 $height $width;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
@else if(index($direction, bottom)) {
|
|
55
|
+
// BOTTOM LEFT
|
|
56
|
+
@if(index($direction, left)) {
|
|
57
|
+
@return $height $width 0 0;
|
|
58
|
+
}
|
|
59
|
+
// BOTTOM RIGHT
|
|
60
|
+
@else {
|
|
61
|
+
@return $height 0 0 $width;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
@return 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// generates a cross-browser triangle using borders
|
|
68
|
+
// @mixin triangle
|
|
69
|
+
// @param $direction {String} the direction the arrow is pointing (top, left, top left, etc)
|
|
70
|
+
// @param $width {Number} the width of the arrow
|
|
71
|
+
// @param $height {Number} the height of the arrow
|
|
72
|
+
// @param $color {Color} the color of the arrow
|
|
73
|
+
@mixin triangle($direction: bottom, $width: 1em, $height: false, $color: #aaa) {
|
|
74
|
+
// if no height was specified, assume it's identical to width
|
|
75
|
+
@if(not $height) {
|
|
76
|
+
$height: $width;
|
|
77
|
+
}
|
|
78
|
+
// zero out it's content
|
|
79
|
+
height: 0;
|
|
80
|
+
width : 0;
|
|
81
|
+
// IE6 needs some extra love
|
|
82
|
+
@include target-browser(ie 6, font-size, 0);
|
|
83
|
+
@include target-browser(ie 6, line-height, 0);
|
|
84
|
+
border: {
|
|
85
|
+
// for IE6, transparent borders are simulated using `dashed` styles instead of a chroma filter
|
|
86
|
+
// IE won't render a `dashed` border-style unless (width * 5) >= border-width
|
|
87
|
+
// since width is always 0, dashed borders aren't rendered
|
|
88
|
+
// @link http://hedgerwow.appspot.com/demo/arrows
|
|
89
|
+
style: dashed;
|
|
90
|
+
// transparent for all other browsers
|
|
91
|
+
color: transparent;
|
|
92
|
+
width: _getTriangleBorderWidth($width, $height, $direction);
|
|
93
|
+
#{_getTriangleBorderDirection($direction)}: {
|
|
94
|
+
color: $color;
|
|
95
|
+
style: solid;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// @category ui/glyphs
|
|
2
|
+
|
|
3
|
+
// throw an error if archetype/ui has not been registered
|
|
4
|
+
$a-blackhole: require-archetype-modules(archetype/ui);
|
|
5
|
+
|
|
6
|
+
// create a stroke line around text (or font icon)
|
|
7
|
+
// @mixin stroke
|
|
8
|
+
// @param $width {Number} the width of the stroke
|
|
9
|
+
// @param $color {Color} the color of the stroke
|
|
10
|
+
// @param $shadow {List} an additional drop shadow to attach
|
|
11
|
+
@mixin glyph-stroke($width: 1px, $color: black, $shadow: false) {
|
|
12
|
+
@include box-shadow(compact(0 $width 0 $color, 0 -1*$width 0 $color, $width 0 0 $color, -1*$width 0 0 $color, $shadow));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// computes the glyph icon info
|
|
16
|
+
// @function glyph-icon
|
|
17
|
+
// @param $icon {String} the icon name
|
|
18
|
+
// @param $size {Number} the size of the icon
|
|
19
|
+
// @param $color {Color} the color of the font
|
|
20
|
+
// @param $library {String} the glyph library to use
|
|
21
|
+
// @param $grid {Number|String} the grid to use (defaults to a smart selection, use `preferred` to always use the first (preferred) grid option)
|
|
22
|
+
@function glyph-icon($icon, $size: default, $color: inherit, $library: default, $grid: null) {
|
|
23
|
+
$char-mapping: null;
|
|
24
|
+
$char-code: null;
|
|
25
|
+
// check that the library is valid, if not, throw a warning and use the default
|
|
26
|
+
$library: get-glyph-library($library);
|
|
27
|
+
// if we have an icon...
|
|
28
|
+
@if $icon {
|
|
29
|
+
// if it looks like it's a character code...
|
|
30
|
+
@if looks-like-character-code($icon) {
|
|
31
|
+
// just use it
|
|
32
|
+
$char-code: $icon;
|
|
33
|
+
}
|
|
34
|
+
// otherwise, we'll look up the character code from the library mapping
|
|
35
|
+
@else {
|
|
36
|
+
$char-mapping: map-get(map-get($library, mappings), $icon);
|
|
37
|
+
@if $char-mapping {
|
|
38
|
+
@if type-of($char-mapping) == map {
|
|
39
|
+
$char-code: map-get($char-mapping, char) or $char-mapping;
|
|
40
|
+
$char-code: get-runtime-locale-value($char-code);
|
|
41
|
+
}
|
|
42
|
+
@else {
|
|
43
|
+
$char-code: $char-mapping;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// if we couldn't find a valid character code (and we were asked to output an icon)...
|
|
49
|
+
@if $char-code == null and $icon != false {
|
|
50
|
+
// throw a warning and be done with it
|
|
51
|
+
@warn "[archetype:glyph] could not find character mapping for `#{icon}`";
|
|
52
|
+
}
|
|
53
|
+
// otherwise continue on
|
|
54
|
+
@if $size == default {
|
|
55
|
+
$default-size: null;
|
|
56
|
+
@if $icon and type-of($char-mapping) == map {
|
|
57
|
+
$default-size: map-get($char-mapping, size);
|
|
58
|
+
}
|
|
59
|
+
$size: $default-size or 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// choose which grid size to use
|
|
63
|
+
$grids: map-get($library, grids);
|
|
64
|
+
@if $grid == preferred {
|
|
65
|
+
$grid: nth(-archetype-list($grids), 1);
|
|
66
|
+
}
|
|
67
|
+
@else if not ($grid and index(-archetype-list($grids), $grid)) {
|
|
68
|
+
$grid: choose-best-glyph-grid($grids, $size);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
$version: map-get($library, version);
|
|
72
|
+
|
|
73
|
+
$name: archetype-namespace(map-get($library, name));
|
|
74
|
+
@if $grid {
|
|
75
|
+
$name: "#{$name}_#{$grid}";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
$font-family: unquote(if($version, "'#{$name}-#{$version}', ", "") + "'#{$name}'");
|
|
79
|
+
$font-weight: map-get($library, weight) or $CONFIG_GLYPHS_WEIGHT;
|
|
80
|
+
$font-style: map-get($library, style) or $CONFIG_GLYPHS_STYLE;
|
|
81
|
+
|
|
82
|
+
@return (
|
|
83
|
+
char-code: $char-code,
|
|
84
|
+
font-family: $font-family,
|
|
85
|
+
font-weight: $font-weight,
|
|
86
|
+
font-style: $font-style,
|
|
87
|
+
font-size: $size,
|
|
88
|
+
color: $color
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// create a glyph icon
|
|
93
|
+
// @mixin glyph-icon
|
|
94
|
+
// @param $icon {String} the icon name
|
|
95
|
+
// @param $size {Number} the size of the icon
|
|
96
|
+
// @param $color {Color} the color of the font
|
|
97
|
+
// @param $placement {String} where to place the icon [before|after|inline]
|
|
98
|
+
// @param $ie-styles {String} styles to apply to IE6/7
|
|
99
|
+
// @param $ie-uid {String} a custom, unique identifier for the generate IE6/7 element
|
|
100
|
+
// @param $library {String} the glyph library to use
|
|
101
|
+
// @param $grid {Number|String} the grid to use (defaults to a smart selection, use `preferred` to always use the first (preferred) grid option)
|
|
102
|
+
// @content
|
|
103
|
+
@mixin glyph-icon($icon, $size: default, $color: inherit, $placement: before, $ie-styles: false, $ie-uid: false, $library: default, $grid: null, $smoothing: $CONFIG_GLYPHS_SMOOTHING) {
|
|
104
|
+
$icons: -archetype-list($icon);
|
|
105
|
+
// compute the glyph info
|
|
106
|
+
$glyph-info: null;
|
|
107
|
+
$char-codes: ();
|
|
108
|
+
// allow multiple glyph character codes, but we can only use the styles for the first (primary) glyph
|
|
109
|
+
// for each icon...
|
|
110
|
+
@each $icon in $icons {
|
|
111
|
+
// compute it's info
|
|
112
|
+
$info: glyph-icon($icon: $icon, $size: $size, $color: $color, $library: $library, $grid: $grid);
|
|
113
|
+
// if the info is good...
|
|
114
|
+
@if $info {
|
|
115
|
+
$char-codes: append($char-codes, unquote(map-get($info, char-code)), space);
|
|
116
|
+
@if not $glyph-info {
|
|
117
|
+
$glyph-info: $info;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
$archetype-glyph-selector: null !global;
|
|
123
|
+
|
|
124
|
+
@if $glyph-info and (length($char-codes) > 0) {
|
|
125
|
+
$char-codes: "#{$char-codes}";
|
|
126
|
+
$selector: if(index(before after, $placement), '&:#{$placement}', '&');
|
|
127
|
+
$archetype-glyph-selector: $selector !global;
|
|
128
|
+
|
|
129
|
+
@if $selector != '&' {
|
|
130
|
+
#{$selector} {
|
|
131
|
+
content: $char-codes;
|
|
132
|
+
}
|
|
133
|
+
@include ie-pseudo($styles: $ie-styles, $content: $char-codes, $placement: $placement, $name: glyph, $uid: $ie-uid);
|
|
134
|
+
@if $archetype-pseudo-selector {
|
|
135
|
+
$archetype-glyph-selector: '#{$selector}, #{$archetype-pseudo-selector}' !global;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// apply it to all selector contexts
|
|
140
|
+
#{$archetype-glyph-selector} {
|
|
141
|
+
// things that are likely not to change...
|
|
142
|
+
@include to-styles((
|
|
143
|
+
font-family: map-get($glyph-info, font-family),
|
|
144
|
+
font-weight: map-get($glyph-info, font-weight),
|
|
145
|
+
font-style: map-get($glyph-info, font-style),
|
|
146
|
+
text-decoration: none, // prevents a double underline in firefox
|
|
147
|
+
display: inline-block, // prevents the icon from being underlined in most browsers
|
|
148
|
+
speak: none,
|
|
149
|
+
-moz-osx-font-smoothing: if($smoothing, grayscale, null),
|
|
150
|
+
-webkit-font-smoothing: if($smoothing, antialiased, null)
|
|
151
|
+
));
|
|
152
|
+
|
|
153
|
+
// things that are likely to change more often...
|
|
154
|
+
@include to-styles((
|
|
155
|
+
font-size: map-get($glyph-info, font-size),
|
|
156
|
+
color: map-get($glyph-info, color)
|
|
157
|
+
)) {
|
|
158
|
+
// pass the block context here
|
|
159
|
+
@content;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// generates all `@font-face` definitions for all the potential glyph libraries
|
|
166
|
+
// @mixin glyph-libraries
|
|
167
|
+
// @param $only {List} if set, only use the libraries defined in this list
|
|
168
|
+
@mixin glyph-libraries($only: null) {
|
|
169
|
+
$only: if($only == null, $only, -archetype-list($only));
|
|
170
|
+
// the font-face mixin will likely change in a future version, keep an eye on this
|
|
171
|
+
// https://github.com/chriseppstein/compass/issues/867
|
|
172
|
+
|
|
173
|
+
@each $key, $library in get-all-glyph-libraries() {
|
|
174
|
+
@if not $only or list($only, $key) {
|
|
175
|
+
$library: get-glyph-library($key);
|
|
176
|
+
$name_raw: archetype-namespace(map-get($library, name));
|
|
177
|
+
$files: map-get($library, files);
|
|
178
|
+
$weight: map-get($library, weight) or $CONFIG_GLYPHS_WEIGHT;
|
|
179
|
+
$style: map-get($library, style) or $CONFIG_GLYPHS_STYLE;
|
|
180
|
+
$version: map-get($library, version);
|
|
181
|
+
$path: map-get($library, path);
|
|
182
|
+
$svg-id: map-get($library, svg-id) or $name_raw;
|
|
183
|
+
$grids: -archetype-list(map-get($library, grids));
|
|
184
|
+
|
|
185
|
+
$inlined: map-get($files, inline);
|
|
186
|
+
@if $inlined == null {
|
|
187
|
+
$inlined: $CONFIG_GLYPHS_INLINE_FONTS;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
$output-fallback: $CONFIG_GLYPHS_OUTPUT_FALLBACK;
|
|
191
|
+
|
|
192
|
+
$subs: map-merge($library, (
|
|
193
|
+
path: str-substitute($path, (version: $version)),
|
|
194
|
+
svg-id: $svg-id
|
|
195
|
+
));
|
|
196
|
+
|
|
197
|
+
// files
|
|
198
|
+
$files_eot_raw: str-substitute(map-get($files, eot), $library);
|
|
199
|
+
$files_std_raw: map-get($files, std);
|
|
200
|
+
|
|
201
|
+
@each $grid in $grids {
|
|
202
|
+
$name: $name_raw;
|
|
203
|
+
$subs: map-merge($subs, (grid: $grid));
|
|
204
|
+
|
|
205
|
+
$files_eot: if($files_eot_raw and $files_eot_raw != '', quote(str-substitute($files_eot_raw, $subs)), false);
|
|
206
|
+
$files_std: ();
|
|
207
|
+
$files: ();
|
|
208
|
+
@each $file in $files_std_raw {
|
|
209
|
+
$file: quote(str-substitute($file, $subs));
|
|
210
|
+
$files_std: append($files_std, $file);
|
|
211
|
+
// keep track of the file for later...
|
|
212
|
+
$files: append($files, $file);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// decide if we're using inline (data URI) files
|
|
216
|
+
$files_std: if($inlined, inline-font-files($files_std...), font-files($files_std...));
|
|
217
|
+
|
|
218
|
+
@if $grid {
|
|
219
|
+
$name: "#{$name}_#{$grid}";
|
|
220
|
+
// output the fallback @font-face
|
|
221
|
+
@if $output-fallback {
|
|
222
|
+
@include font-face($name_raw, $files_std, $files_eot, $weight, $style);
|
|
223
|
+
@include font-face('#{$name_raw}-#{$version}', $files_std, $files_eot, $weight, $style);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
@if $output-fallback or not $version {
|
|
227
|
+
@include font-face($name, $files_std, $files_eot, $weight, $style);
|
|
228
|
+
}
|
|
229
|
+
@if $version {
|
|
230
|
+
// output the @font-face set with a versioned family name
|
|
231
|
+
// this will help avoid collisions when multi-app CSS is loaded on a single page
|
|
232
|
+
@include font-face('#{$name}-#{$version}', $files_std, $files_eot, $weight, $style);
|
|
233
|
+
}
|
|
234
|
+
$output-fallback: false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// here for back-compat only
|
|
241
|
+
@mixin base-glyph {
|
|
242
|
+
@warn "the `base-glyph` mixin will be deprecated soon. instead use the `glyph-libraries` mixin";
|
|
243
|
+
@include glyph-libraries;
|
|
244
|
+
}
|