dashy 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,79 @@
1
+ $number-silver-ratio: 2.414;
2
+
3
+ $number-golden-ratio: 1.618;
4
+ $number-golden-ratio-doubled: $number-golden-ratio * 2;
5
+
6
+ $number-golden-ratio: 1.618;
7
+ $number-golden-ratio-doubled: $number-golden-ratio * 2;
8
+
9
+ $number-euler: 2.718;
10
+ $number-pi: 3.142;
11
+
12
+ $numbers-from-fractions:
13
+ ("0" 0.000)
14
+ ("1/1" 1.000)
15
+ ("1/2" 0.500)
16
+ ("1/3" 0.333)
17
+ ("2/3" 0.667)
18
+ ("1/4" 0.250)
19
+ ("2/4" 0.500)
20
+ ("3/4" 0.750)
21
+ ;
22
+
23
+ @function number-squared($number)
24
+ {
25
+ @return $number * $number;
26
+ }
27
+
28
+ @function number-of($amt, $n)
29
+ {
30
+ @return ($amt * 0) + $n;
31
+ }
32
+
33
+ @function number-one($amt)
34
+ {
35
+ @return number-of($amt, 1);
36
+ }
37
+
38
+ @function number-integral($amt)
39
+ {
40
+ @return number-floor($amt + 0.049999);
41
+ }
42
+
43
+ @function number-fractional($amt)
44
+ {
45
+ @return $amt - number-integral($amt);
46
+ }
47
+
48
+ /** @param $amt The source.
49
+ * @returns the first digit after the decimal point.
50
+ */
51
+ @function number-decimal($amt)
52
+ {
53
+ @return number-round(number-fractional($amt) * 10);
54
+ }
55
+
56
+ @function number-ceiling($amt)
57
+ {
58
+ @return ceil($amt);
59
+ }
60
+
61
+ @function number-floor($amt)
62
+ {
63
+ @return floor($amt);
64
+ }
65
+
66
+ @function number-round($amt)
67
+ {
68
+ @return round($amt);
69
+ }
70
+
71
+ @function number-unit($number)
72
+ {
73
+ @return unit($number);
74
+ }
75
+
76
+ @function number-from-fraction($fraction)
77
+ {
78
+ @return list-lookup($numbers-from-fractions, $fraction);
79
+ }
@@ -0,0 +1,36 @@
1
+ @import "dashy/list";
2
+
3
+ $opposite-sides:
4
+ (top bottom)
5
+ (left right)
6
+ ;
7
+
8
+ $opposite-corners:
9
+ (top-left bottom-right)
10
+ (top-right bottom-left)
11
+ ;
12
+
13
+ $opposite-directions:
14
+ (up down)
15
+ (left right)
16
+ ;
17
+
18
+ @function opposite-side($side)
19
+ {
20
+ @return list-find-opposite($opposite-sides, $side);
21
+ }
22
+
23
+ @function opposite-corner($corner)
24
+ {
25
+ @return list-find-opposite($opposite-corners, $corner);
26
+ }
27
+
28
+ @function opposite-direction($direction)
29
+ {
30
+ @return list-find-opposite($opposite-directions, $direction);
31
+ }
32
+
33
+ @function opposite-direction-of-side($side)
34
+ {
35
+ @return opposite-direction(direction-of-side($side));
36
+ }
@@ -0,0 +1,124 @@
1
+ @function select-buttons($button: '*')
2
+ {
3
+ @return select-either(
4
+ select-as-children('ol.buttons' $button),
5
+ select('a.button' $button),
6
+ select(button $button),
7
+ select('input[type=submit]' $button)
8
+ );
9
+ }
10
+
11
+ @function select-inputs($input: '*')
12
+ {
13
+ @return select-either(select(input $input), select(textarea $input));
14
+ }
15
+
16
+ @function select-text-inputs($input: '*')
17
+ {
18
+ @return select-either(select(('input[type=text]', 'input[type=password]') $input), select(textarea $input));
19
+ }
20
+
21
+ @function select-headings($heading: '*')
22
+ {
23
+ @return select-either(select-main-headings($heading), select-subheadings($heading));
24
+ }
25
+
26
+ @function select-main-headings($heading: '*')
27
+ {
28
+ @return select(h1 $heading);
29
+ }
30
+
31
+ @function select-subheadings($heading: '*')
32
+ {
33
+ @return select-either(select(h2 $heading),
34
+ select(h3 $heading),
35
+ select(h4 $heading),
36
+ select(h5 $heading),
37
+ select(h6 $heading));
38
+ }
39
+
40
+ @function select-lists($list:'*')
41
+ {
42
+ @return select((ul, ol) $list);
43
+ }
44
+
45
+ @function select-list-items($list-items:'*')
46
+ {
47
+ @return select-lists-items('*', $list-items);
48
+ }
49
+
50
+ @function select-lists-items($list:'*', $items:'*')
51
+ {
52
+ @return select($list select-children(select(li $items)));
53
+ }
54
+
55
+ @function select-tables($table:'*')
56
+ {
57
+ @return select(table $table);
58
+ }
59
+
60
+ @function select-table-groups($group:'*')
61
+ {
62
+ @return select((thead, tbody, tfoot) $group);
63
+ }
64
+
65
+ @function select-tabloids($tabloid:'*')
66
+ {
67
+ @return select-either(select-tables($tabloid), select-table-groups($tabloid));
68
+ }
69
+
70
+ @function select-tabloids-rows($tabloid:'*', $row:'*')
71
+ {
72
+ @return select-either(select-as('>', select-table-groups($tabloid) $row),
73
+ select-as('>', select-tables($tabloid) '*' $row));
74
+ }
75
+
76
+ @function select-table-groups-rows($table-group:'*', $row:'*')
77
+ {
78
+ @return select-as('>', $table-group select(tr, $row));
79
+ }
80
+
81
+ @function select-tabloids-rows-cells($tabloid:'*', $row:'*', $cell:'*')
82
+ {
83
+ @return select-as('>', select-tabloids-rows($tabloid, $row) $cell);
84
+ }
85
+
86
+ @function select-table-groups-rows-cells($table-group:'*', $row:'*', $cell:'*')
87
+ {
88
+ @return select-as('>', select-table-groups-rows($table-group, $row) $cell);
89
+ }
90
+
91
+ @function select-table-rows($row:'*')
92
+ {
93
+ @return select(tr $row);
94
+ }
95
+
96
+ @function select-table-cells($cell:'*')
97
+ {
98
+ @return select((th, td) $cell);
99
+ }
100
+
101
+ // select-grids ///////////////////////////////////////////////////////////////////////////////////
102
+ //
103
+ @function select-grids($grid:'*', $gutter-width:'', $gutter-height-ratio:'')
104
+ {
105
+ @if is($gutter-width) and default != $gutter-width { $grid: select($grid select-class(gutter-width $gutter-width)); }
106
+ @if is($gutter-height-ratio) and default != $gutter-height-ratio { $grid: select($grid select-class(gutter-height-ratio $gutter-height-ratio)); }
107
+ @return select($grid, '.grid');
108
+ }
109
+
110
+ // select-grid-cells //////////////////////////////////////////////////////////////////////////////
111
+ //
112
+ @function select-grid-cells($cell:'*', $span:'', $columns:'')
113
+ {
114
+ @return select-grids-cells('*', $cell, $span:$span, $columns:$columns);
115
+ }
116
+
117
+ // select-grids-cells /////////////////////////////////////////////////////////////////////////////
118
+ //
119
+ @function select-grids-cells($grid:'*', $cell:'*', $gutter-width:'', $gutter-height-ratio:'', $span:'', $columns:'')
120
+ {
121
+ @if is($span) and default != $span { $cell: select(select-parameter(grid-cell, width, $span + '/' + $columns), $cell); }
122
+ @return select-as-children(select-grids($grid, $gutter-width, $gutter-height-ratio) $cell);
123
+ }
124
+
@@ -0,0 +1,79 @@
1
+ @mixin set-box-shadow($parameters)
2
+ {
3
+ -webkit-box-shadow: $parameters;
4
+ -moz-box-shadow: $parameters;
5
+ box-shadow: $parameters;
6
+ }
7
+
8
+ @mixin set-border-radius($corners)
9
+ {
10
+ -webkit-border-radius: $corners;
11
+ -moz-border-radius: $corners;
12
+ border-radius: $corners;
13
+ }
14
+
15
+ @mixin set-box-sizing($prefix)
16
+ {
17
+ -webkit-box-sizing: #{ $prefix }-box;
18
+ -moz-box-sizing: #{ $prefix }-box;
19
+ box-sizing: #{ $prefix }-box;
20
+ }
21
+
22
+ @mixin set-min-height($height:100%)
23
+ {
24
+ min-height:$height; height:auto!important; height:$height;
25
+ }
26
+
27
+ @mixin set-max-width($width)
28
+ {
29
+ max-width:$width;
30
+ }
31
+
32
+ @mixin set-display($value)
33
+ {
34
+ display:$value; @if $value == inline-block { *display:inline; zoom:1; }
35
+ }
36
+
37
+ @mixin set-keyframes($name)
38
+ {
39
+ @-webkit-keyframes #{ $name } { @content; }
40
+ @-moz-keyframes #{ $name } { @content; }
41
+ @-o-keyframes #{ $name } { @content; }
42
+ @keyframes #{ $name } { @content; }
43
+ }
44
+
45
+ @mixin set-transition($arguments...)
46
+ {
47
+ @if 1 == length($arguments)
48
+ {
49
+ -webkit-transition: $arguments;
50
+ -moz-transition: $arguments;
51
+ -o-transition: $arguments;
52
+ transition: $arguments;
53
+ }
54
+ }
55
+
56
+ @mixin animation($arguments...)
57
+ {
58
+ @if 1 == length($arguments)
59
+ {
60
+ -webkit-animation: $arguments;
61
+ -moz-animation: $arguments;
62
+ -o-animation: $arguments;
63
+ animation: $arguments;
64
+ }
65
+ }
66
+
67
+ @mixin set-border-radius($arguments...)
68
+ {
69
+ -webkit-border-radius: $arguments;
70
+ -moz-border-radius: $arguments;
71
+ border-radius: $arguments;
72
+ }
73
+
74
+ @mixin set-inner-box-shadow($arguments)
75
+ {
76
+ -webkit-box-shadow: inset $arguments;
77
+ -moz-box-shadow: inset $arguments;
78
+ box-shadow: inset $arguments;
79
+ }
@@ -0,0 +1,23 @@
1
+ @import "dashy/list";
2
+
3
+ $sides-horizontal: left right;
4
+
5
+ $sides-vertical: top bottom;
6
+
7
+ $sides: join($sides-horizontal, $sides-vertical);
8
+
9
+ $sides-directions:
10
+ (top up)
11
+ (bottom down)
12
+ (left left)
13
+ (right right);
14
+
15
+ @function side-in-direction($direction)
16
+ {
17
+ @return list-reverse-lookup($side-directions, $direction);
18
+ }
19
+
20
+ @function side-in-opposite-direction($direction)
21
+ {
22
+ @return side-in-direction(opposite-direction($direction));
23
+ }
data/bin/dashy ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # CodeKit needs relative paths
4
+ require File.dirname(__FILE__) + '/../lib/dashy.rb'
5
+
6
+ Dashy::Generator.start
7
+
8
+ # Gem structure adapted from thoughtbot/bourbon...
data/dashy.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "dashy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "dashy"
7
+ s.version = Dashy::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Alex Goldsmith"]
10
+ s.email = ["alex.tosyx@gmail.com"]
11
+ s.license = "MIT"
12
+ s.homepage = "https://github.com/tosyx/dashy"
13
+ s.summary = "Selector combinators and other helpers for Sass."
14
+ s.description = <<-DESC
15
+ Dashy provides...
16
+ DESC
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_dependency('sass', '~> 3.3')
24
+ s.add_dependency('thor')
25
+
26
+ s.add_development_dependency('aruba', '~> 0.4')
27
+ s.add_development_dependency('rake')
28
+ end
29
+
30
+ # Gem structure adapted from thoughtbot/bourbon...
data/dashy.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "dashy",
3
+ "description": "Selector combinators and other helpers for Sass.",
4
+ "version": "0.0.1",
5
+ "main": "app/assets/stylesheets/_dashy.scss",
6
+ "license": "MIT",
7
+ "ignore": [
8
+ "**/.*",
9
+ "bin",
10
+ "dashy.gemspec",
11
+ "CONTRIBUTING.md",
12
+ "features",
13
+ "LICENSE.md",
14
+ "lib",
15
+ "Gemfile",
16
+ "Gemfile.lock",
17
+ "package.json",
18
+ "Rakefile"
19
+ ],
20
+ "keywords": [
21
+ "css",
22
+ "mixins",
23
+ "sass",
24
+ "scss"
25
+ ],
26
+ "authors": [
27
+ "tosyx (http://tosyx.com)"
28
+ ],
29
+ "homepage": "http://dashy.io",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/tosyx/dashy.git"
33
+ }
34
+ }
@@ -0,0 +1,7 @@
1
+ module Dashy
2
+ class Engine < Rails::Engine
3
+ # auto wire
4
+ end
5
+ end
6
+
7
+ # Gem structure adapted from thoughtbot/bourbon...
@@ -0,0 +1,82 @@
1
+ require 'dashy/version'
2
+ require "fileutils"
3
+ require 'thor'
4
+
5
+ module Dashy
6
+ class Generator < Thor
7
+ map ['-v', '--version'] => :version
8
+
9
+ desc 'install', 'Install Dashy into your project'
10
+ method_options :path => :string, :force => :boolean
11
+ def install
12
+ if dashy_files_already_exist? && !options[:force]
13
+ puts "Dashy files already installed, doing nothing."
14
+ else
15
+ install_files
16
+ puts "Dashy files installed to #{install_path}/"
17
+ end
18
+ end
19
+
20
+ desc 'update', 'Update Dashy'
21
+ method_options :path => :string
22
+ def update
23
+ if dashy_files_already_exist?
24
+ remove_dashy_directory
25
+ install_files
26
+ puts "Dashy files updated."
27
+ else
28
+ puts "No existing dashy installation. Doing nothing."
29
+ end
30
+ end
31
+
32
+ desc 'version', 'Show Dashy version'
33
+ def version
34
+ say "Dashy #{Dashy::VERSION}"
35
+ end
36
+
37
+ private
38
+
39
+ def dashy_files_already_exist?
40
+ install_path.exist?
41
+ end
42
+
43
+ def install_path
44
+ @install_path ||= if options[:path]
45
+ Pathname.new(File.join(options[:path], 'dashy'))
46
+ else
47
+ Pathname.new('dashy')
48
+ end
49
+ end
50
+
51
+ def install_files
52
+ make_install_directory
53
+ copy_in_scss_files
54
+ end
55
+
56
+ def remove_dashy_directory
57
+ FileUtils.rm_rf("dashy")
58
+ end
59
+
60
+ def make_install_directory
61
+ FileUtils.mkdir_p(install_path)
62
+ end
63
+
64
+ def copy_in_scss_files
65
+ FileUtils.cp_r(all_stylesheets, install_path)
66
+ end
67
+
68
+ def all_stylesheets
69
+ Dir["#{stylesheets_directory}/*"]
70
+ end
71
+
72
+ def stylesheets_directory
73
+ File.join(top_level_directory, "app", "assets", "stylesheets")
74
+ end
75
+
76
+ def top_level_directory
77
+ File.dirname(File.dirname(File.dirname(__FILE__)))
78
+ end
79
+ end
80
+ end
81
+
82
+ # Gem structure adapted from thoughtbot/bourbon...
@@ -0,0 +1,5 @@
1
+ module Dashy
2
+ VERSION = "0.0.1"
3
+ end
4
+
5
+ # Gem structure adapted from thoughtbot/bourbon...
data/lib/dashy.rb ADDED
@@ -0,0 +1,30 @@
1
+ # CodeKit needs relative paths
2
+ dir = File.dirname(__FILE__)
3
+ $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
4
+
5
+ require "dashy/generator"
6
+
7
+ unless defined?(Sass)
8
+ require 'sass'
9
+ end
10
+
11
+ module Dashy
12
+ if defined?(Rails) && defined?(Rails::Engine)
13
+ class Engine < ::Rails::Engine
14
+ require 'dashy/engine'
15
+ end
16
+
17
+ module Rails
18
+ class Railtie < ::Rails::Railtie
19
+ rake_tasks do
20
+ load "tasks/install.rake"
21
+ end
22
+ end
23
+ end
24
+ else
25
+ dashy_path = File.expand_path("../../app/assets/stylesheets", __FILE__)
26
+ ENV["SASS_PATH"] = [ENV["SASS_PATH"], dashy_path].compact.join(File::PATH_SEPARATOR)
27
+ end
28
+ end
29
+
30
+ # Gem structure adapted from thoughtbot/bourbon...