staple 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cb1ab7deac68105ba25cc4cc760b54b24eebce3
4
- data.tar.gz: b90559e7aac08c6e848e6389bbbd2c07ec31ed67
3
+ metadata.gz: 2b2768265c039f6c125d5a0213c9e7afdc3a850d
4
+ data.tar.gz: 4c5ab01ee33a83747039b18f62d3c6e994a37e70
5
5
  SHA512:
6
- metadata.gz: f4000c40f8e3595d9ebccaa2a45d9c93648e67046be1dd994c22471b0bf1cc663be8fb1fe03e12c02716ddf12e7fabab721e6599cc32b879c3bea8220c9cf139
7
- data.tar.gz: a4f462bd3836eba657330924202f53ffcd457e1fec5070dc8b31a1acbf3fd1b368ad557675a76ace6d07cb656e502965924b55a7751968f3c29fa4f3d6783a67
6
+ metadata.gz: 4279b536e81a4b033fcdcae425d57ab02e50841ac46b8ffb989950dccda42de792dd852d1cb7d18143872d9066ae35712a02e47cf8e41638df48aebe8e83136e
7
+ data.tar.gz: 3f2838e8df5211b49268a849ea5b2da687bb1f6525f4a8ad6b97b989b53ba15d986372fbcab75717c303ed262d33ed499b0e282c15a47b5cc5bd5e93f51f1c93
data/README.md CHANGED
@@ -4,11 +4,17 @@ High level UI framework. Built on top of foundation.
4
4
 
5
5
  ##TODO
6
6
 
7
- * add overrides to foundation file using big list, seperate into files
7
+ * Simple default generators first. Basic Theme.
8
+ * Load vars then override before
9
+ * Generate override components after using vars
10
+ * Modify files using generators or manual
11
+
12
+ ##LOW PRIORITY
8
13
  * declaring as dependency does not load it?
9
14
  * integration with existing projects
10
15
 
11
16
  ##Install
17
+
12
18
  ```ruby
13
19
  #Gemfile
14
20
  gem 'slim-rails'
@@ -41,19 +47,19 @@ section.row
41
47
 
42
48
  ##Modify Overall, Modular Style With Commands
43
49
  ```console
44
- staple theme:Flat
50
+ staple theme:flat
45
51
  ```
46
52
 
47
53
  ```console
48
- staple typeface_primary:HelveticaNeau
54
+ staple type-face-primary:HelveticaNeau
49
55
  ```
50
56
 
51
57
  ```console
52
- staple typeface_secondary:ComicSans
58
+ staple type-face-secondary:ComicSans
53
59
  ```
54
60
 
55
61
  ```console
56
- staple color_scheme:Flatland
62
+ staple color-scheme:Flatland
57
63
  ```
58
64
 
59
65
  ##Build
@@ -3,48 +3,48 @@ require 'rails/generators'
3
3
  module Staple
4
4
  class ImportGenerator < Rails::Generators::Base
5
5
  desc 'Copy refills'
6
- source_root File.expand_path("../../../source", __FILE__)
7
- argument :snippet, type: :string, required: true
8
-
9
- def copy_html
10
- copy_file_if_exists(
11
- partial_name,
12
- File.join('app', 'views', 'refills', partial_name),
13
- )
14
- end
15
-
16
- def copy_styles
17
- copy_file_if_exists(
18
- File.join('stylesheets', 'refills', stylesheet_name),
19
- File.join('app', 'assets', 'stylesheets', 'refills', stylesheet_name),
20
- )
21
- end
22
-
23
- def copy_javascripts
24
- copy_file_if_exists(
25
- File.join('javascripts', 'refills', javascript_name),
26
- File.join('app', 'assets', 'javascripts', 'refills', javascript_name),
27
- )
28
- end
29
-
30
- private
31
-
32
- def copy_file_if_exists(source, destination)
33
- if File.exists?(File.join(self.class.source_root, source))
34
- copy_file source, destination
35
- end
36
- end
37
-
38
- def partial_name
39
- "_#{snippet.underscore}.html.erb"
40
- end
41
-
42
- def stylesheet_name
43
- "_#{snippet.dasherize}.scss"
44
- end
45
-
46
- def javascript_name
47
- "#{snippet.underscore}.js"
48
- end
6
+ # source_root File.expand_path("../../../source", __FILE__)
7
+ # argument :snippet, type: :string, required: true
8
+
9
+ # def copy_html
10
+ # copy_file_if_exists(
11
+ # partial_name,
12
+ # File.join('app', 'views', 'refills', partial_name),
13
+ # )
14
+ # end
15
+
16
+ # def copy_styles
17
+ # copy_file_if_exists(
18
+ # File.join('stylesheets', 'refills', stylesheet_name),
19
+ # File.join('app', 'assets', 'stylesheets', 'refills', stylesheet_name),
20
+ # )
21
+ # end
22
+
23
+ # def copy_javascripts
24
+ # copy_file_if_exists(
25
+ # File.join('javascripts', 'refills', javascript_name),
26
+ # File.join('app', 'assets', 'javascripts', 'refills', javascript_name),
27
+ # )
28
+ # end
29
+
30
+ # private
31
+
32
+ # def copy_file_if_exists(source, destination)
33
+ # if File.exists?(File.join(self.class.source_root, source))
34
+ # copy_file source, destination
35
+ # end
36
+ # end
37
+
38
+ # def partial_name
39
+ # "_#{snippet.underscore}.html.erb"
40
+ # end
41
+
42
+ # def stylesheet_name
43
+ # "_#{snippet.dasherize}.scss"
44
+ # end
45
+
46
+ # def javascript_name
47
+ # "#{snippet.underscore}.js"
48
+ # end
49
49
  end
50
50
  end
@@ -48,14 +48,7 @@ module Staple
48
48
 
49
49
  #import base style
50
50
  def staple_install
51
- copy_file "source/stylesheets/before.scss", "app/assets/stylesheets/before.scss"
52
- copy_file "source/stylesheets/after.scss", "app/assets/stylesheets/after.scss"
53
- copy_file "source/stylesheets/buttons.scss", "app/assets/stylesheets/buttons.scss"
54
- copy_file "source/stylesheets/color.scss", "app/assets/stylesheets/color.scss"
55
- copy_file "source/stylesheets/forms.scss", "app/assets/stylesheets/forms.scss"
56
- copy_file "source/stylesheets/sizing.scss", "app/assets/stylesheets/sizing.scss"
57
- copy_file "source/stylesheets/typography.scss", "app/assets/stylesheets/typography.scss"
58
- copy_file "source/stylesheets/utilities.scss", "app/assets/stylesheets/utilities.scss"
51
+ directory "source/stylesheets/staple", "app/assets/stylesheets/staple"
59
52
  end
60
53
 
61
54
  def detect_css_format
@@ -7,16 +7,16 @@ module Staple
7
7
  def list
8
8
  puts 'Available Staples'
9
9
  puts '================='
10
- stylesheets.each do |file_name|
11
- puts '- ' + file_name.gsub(/_|\.scss/, '')
12
- end
10
+ # stylesheets.each do |file_name|
11
+ # puts '- ' + file_name.gsub(/_|\.scss/, '')
12
+ # end
13
13
  end
14
14
 
15
- private
16
- def stylesheets
17
- refills_dir = File.expand_path('../../../source/stylesheets/staple', __FILE__)
18
- stylesheets = Dir.entries(refills_dir)
19
- stylesheets.reject {|f| f == '.' || f == '..' }
20
- end
15
+ # private
16
+ # def stylesheets
17
+ # refills_dir = File.expand_path('../../../source/stylesheets/staple', __FILE__)
18
+ # stylesheets = Dir.entries(refills_dir)
19
+ # stylesheets.reject {|f| f == '.' || f == '..' }
20
+ # end
21
21
  end
22
22
  end
@@ -1,3 +1,6 @@
1
- @import 'before';
1
+ @import "foundation/functions";
2
+ $include-html-classes: true;
3
+ $include-html-global-classes: $include-html-classes;
4
+ @import 'staple/before';
2
5
  @import 'foundation';
3
- @import 'after';
6
+ @import 'staple/after';
@@ -1,5 +1,6 @@
1
1
  //after.scss
2
- //Must load after foundation. Overrides some of foundations defaults
3
- @import 'utilities';
2
+ //Must load after foundation. Overrides some of foundations defaults. Generators
3
+ @import 'build_colors'
4
4
  @import 'buttons';
5
- @import 'forms';
5
+ @import 'forms';
6
+ //BUILD IT
@@ -0,0 +1,7 @@
1
+ //before.scss
2
+ //must be loaded before loading foundation because variables will affect foundation
3
+ @import 'size';
4
+ @import 'color';
5
+ @import 'utilities';
6
+ @import 'typography';
7
+ @import 'overrides'
@@ -0,0 +1,32 @@
1
+ //load functions before calling them
2
+ @function set-text-color($color) {
3
+ @if (lightness($color) > 60%) {
4
+ @return rgba($black, $transparent-weak); // Lighter backgorund, return dark color
5
+ } @else {
6
+ @return rgba($white, $transparent-strong); // Darker background, return light color
7
+ }
8
+ }
9
+ //DEFAULT
10
+ .button{
11
+ background-color: $primary-color;
12
+ color: set-text-color($primary-color);
13
+ }
14
+ .button:hover{
15
+ background-color: lighten($primary-color, $transition-brighten);
16
+ }
17
+
18
+ //BUTTON GENERATOR FOR EACH COLOR
19
+ @each $color in $button-classes {
20
+ $i: index($button-classes, $color);
21
+ $temp-color: nth($button-define, $i);
22
+ .button.#{$color}{
23
+ background-color: $temp-color;
24
+ color: set-text-color($temp-color);
25
+ }
26
+ .button.#{$color}:hover{
27
+ background-color: lighten($temp-color, $transition-brighten);
28
+ }
29
+ }
30
+
31
+ //MODIFY DEFAULT STYLE
32
+ //APPEND ADDITIONAL GENERATORS WITH COMMANDS AS NEEDED
@@ -0,0 +1,45 @@
1
+ //BACKGROUNDS
2
+ @each $class in $accent-classes {
3
+ $i: index($accent-classes, $class);
4
+ $color: nth($accent-define, $i);
5
+ .#{$class}-bg{
6
+ background-color: $color;
7
+ }
8
+ @each $value in $opacity-values {
9
+ $j: index($opacity-values, $value);
10
+ $opacity: nth($opacity-define, $j);
11
+ .#{$class}-bg-#{$value}{
12
+ background-color: rgba($color, $opacity);
13
+ }
14
+ }
15
+ }
16
+ //BORDERS
17
+ @each $class in $accent-classes {
18
+ $i: index($accent-classes, $class);
19
+ $color: nth($accent-define, $i);
20
+ .#{$class}-border{
21
+ border: $border-size solid $color;
22
+ }
23
+ @each $value in $opacity-values {
24
+ $j: index($opacity-values, $value);
25
+ $opacity: nth($opacity-define, $j);
26
+ .#{$class}-border-#{$value}{
27
+ border: $border-size solid rgba($color, $opacity);
28
+ }
29
+ }
30
+ }
31
+ //TEXT
32
+ @each $class in $accent-classes {
33
+ $i: index($accent-classes, $class);
34
+ $color: nth($accent-define, $i);
35
+ .#{$class}-text{
36
+ color: $color;
37
+ }
38
+ @each $value in $opacity-values {
39
+ $j: index($opacity-values, $value);
40
+ $opacity: nth($opacity-define, $j);
41
+ .#{$class}-text-#{$value}{
42
+ color: rgba($color, $opacity);
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,60 @@
1
+ // .button{
2
+ // //permutations
3
+ // font-weight: 200;
4
+ // letter-spacing: 1px;
5
+
6
+ // background-color: $primary-color;
7
+ // border-color: $primary-color;
8
+ // color: white;
9
+ // transition: background-color 150ms ease-out;
10
+
11
+ // padding-top: 0.9rem;
12
+ // padding-right: 2.1rem;
13
+ // padding-bottom: 0.96rem;
14
+ // padding-left: 2.1rem;
15
+
16
+ // margin-right: 0.5rem;//arbitrary
17
+ // }
18
+ // .button.tiny{
19
+ // padding-top: 0.525rem;
20
+ // padding-right: 1.35rem;
21
+ // padding-bottom: 0.5875rem;
22
+ // padding-left: 1.35rem;
23
+ // }
24
+ // .button.small{
25
+ // padding-top: 0.775rem;
26
+ // padding-right: 1.85rem;
27
+ // padding-bottom: 0.8375rem;
28
+ // padding-left: 1.85rem;
29
+ // }
30
+ // .button.large{
31
+ // padding-top: 1.025rem;
32
+ // padding-right: 2.55rem;
33
+ // padding-bottom: 1.0875rem;
34
+ // padding-left: 2.55rem;
35
+ // }
36
+ // //used for rounded buttons
37
+ // .button.wider{
38
+ // padding-right: 2.5rem;
39
+ // padding-left: 2.5rem;
40
+ // }
41
+ // .button.shadow{
42
+ // box-shadow: 1px 1px 1px rgba(0,0,0,0.4);
43
+ // }
44
+ // .button.text-shadow{
45
+ // text-shadow: 1px 1px 0px rgba(0,0,0,0.3);
46
+ // }
47
+ // .button.inner-text-shadow{
48
+ // text-shadow: 1px 1px 0px rgba(255,255,255,0.3);
49
+ // }
50
+ // .button.expand{
51
+ // margin-right:0;
52
+ // }
53
+ // //FIX
54
+ // .button-group{
55
+ // .button{
56
+ // margin-right:0px;
57
+ // }
58
+ // }
59
+
60
+ @import 'build_buttons'
@@ -0,0 +1,33 @@
1
+ $primary-color: #3389dd;
2
+ $complement-color: adjust_hue($primary-color, 180);
3
+ $secondary-color: adjust_hue($primary-color, 135);
4
+ $tertiary-color: adjust_hue($primary-color, 200);
5
+
6
+ //AUTO GENERATE FOUNDATION COLORS: (CAN OVERRIDE)
7
+ @import 'color_functions';
8
+ $alert-color: alert($primary-color);//red
9
+ $success-color: success($primary-color);//green
10
+ $warning-color: warning($primary-color);//yellow/orange
11
+ $info-color: info($primary-color);//blue
12
+
13
+ //BUTTON CLASSES TO GENERATE:
14
+ $button-classes: primary compliment secondary tertiary;
15
+ $button-define: $primary-color $complement-color $secondary-color $tertiary-color;
16
+
17
+ //ACCENTS CLASSES TO GENERATE: (BACKGROUNDS, BORDERS, AND TEXT-COLOR)
18
+ $white: #ffffff;
19
+ $black: #000000;
20
+ $accent-classes: white black;
21
+ $accent-define: $white $black;
22
+
23
+ //OPACITY CLASSES TO GENERATE: (% OPACITY OF ACCENT CLASSES)
24
+ $transparent-strong:0.8;
25
+ $transparent-medium:0.6;
26
+ $transparent-weak:0.4;
27
+ $transparent-light:0.2;
28
+ $opacity-values:light weak medium strong;
29
+ $opacity-define:$transparent-light $transparent-weak $transparent-medium $transparent-strong;
30
+
31
+ //DIFFERENCE IN SHADE WHEN ACCENTING COMPONENTS
32
+ $primary-difference: 30;
33
+ $transition-brighten: 8%;
@@ -0,0 +1,63 @@
1
+ //FUNCTIONS
2
+ @function determine-color($color){
3
+ $high: red($color);
4
+ $r_color: 0;
5
+ @if (green($color) > $high){
6
+ $high: green($color);
7
+ $r_color: 1;
8
+ }
9
+ @if (blue($color) > $high){
10
+ $high: blue($color);
11
+ $r_color: 2;
12
+ }
13
+ @return $r_color;
14
+ }
15
+
16
+ @function alert($p-color){
17
+ //determine what primary color is closest to then alter
18
+ @if (determine-color($p-color) == 0){
19
+ @return adjust-hue($p-color, 0);
20
+ }
21
+ @if (determine-color($p-color) == 1){
22
+ @return adjust-hue($p-color, -135);
23
+ }
24
+ @if (determine-color($p-color) == 2){
25
+ @return adjust-hue($p-color, 150);
26
+ }
27
+ }
28
+
29
+ @function success($p-color){
30
+ @if (determine-color($p-color) == 0){
31
+ @return adjust-hue($p-color, 135);
32
+ }
33
+ @if (determine-color($p-color) == 1){
34
+ @return adjust-hue($p-color, 0);
35
+ }
36
+ @if (determine-color($p-color) == 2){
37
+ @return adjust-hue($p-color, -60);
38
+ }
39
+ }
40
+
41
+ @function warning($p-color){
42
+ @if (determine-color($p-color) == 0){
43
+ @return adjust-hue($p-color, 30);
44
+ }
45
+ @if (determine-color($p-color) == 1){
46
+ @return adjust-hue($p-color, 255);
47
+ }
48
+ @if (determine-color($p-color) == 2){
49
+ @return adjust-hue($p-color, 200);
50
+ }
51
+ }
52
+
53
+ @function info($p-color){
54
+ @if (determine-color($p-color) == 0){
55
+ @return adjust-hue($p-color, 200);
56
+ }
57
+ @if (determine-color($p-color) == 1){
58
+ @return adjust-hue($p-color, 60);
59
+ }
60
+ @if (determine-color($p-color) == 2){
61
+ @return adjust-hue($p-color, 0);
62
+ }
63
+ }