utility_colors 1.0.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7bcb54e43ef56335b61de7c5657477471310d42b4c7150821d874e35cc48af36
4
- data.tar.gz: b45099cb134d67fb04898daf013d78a1908d970c63950220e6fc9368eca4653c
3
+ metadata.gz: e3618ff643c2a5bc3490ac06ff03f0234d19436f81fd89d3dcf97df01308b07c
4
+ data.tar.gz: 622631249521f919b6f2b1e6e025599fdfa2e97fa14dbca82b16fc0fd3335d3f
5
5
  SHA512:
6
- metadata.gz: ad703fe0a83d64355550e011eed509101935794f3954e20c8d4bca8b5556ab86f41d6ba0777e021f6afd447c2c5d03b1ba6c3341155a0c8289472b840b38a4d8
7
- data.tar.gz: 5ac4ff72a529536744477e3317578c0001f5bb76181aa2618183d984db22900b26f0c5c611124d9ac82d6fcadfff4165227a495cd7a65529376c6c1cec39a155
6
+ metadata.gz: 151c184752fc1c92353ba66f936e2dcd1d702fc6a761fb7c80fe736a0b2cf3b29519a7dcf133f2e2f4b19c9fb874a89a19ab04690ee60cdf4045a599f8adbe26
7
+ data.tar.gz: 5705a8d8c5d9319d39c71cd3fbd8716faf917902264918756d58f2d9946203b0b01d507adfaecb2c1ed7c826e04e0fcf92ca5a916278063cbc91733f640aff2c
data/README.md CHANGED
@@ -83,7 +83,7 @@ What types of classes should be built:
83
83
  | regular_classes | Should 'regular' classes be built, e.g. ".bg--red-50" | true | Boolean | true / false |
84
84
  | breakpoint_classes | Should 'breakpoint' classes be built, e.g. ".md\\|color--black" | false | Boolean | true / false |
85
85
  | pseudo_classes | Should 'pseudo' classes be built, e.g. ".hover\\|border-c--blue-50:hover" | false | Boolean | true / false |
86
- | breakpoint_pseudo_classes | Should 'regular' classes be built, e.g. ".hover\\|md\\|bg--blue-50:hover" | false | Boolean | true / false |
86
+ | pseudo_breakpoint_classes | Should 'regular' classes be built, e.g. ".hover\\|md\\|bg--blue-50:hover" | false | Boolean | true / false |
87
87
 
88
88
  ### Extra Information
89
89
 
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -18,5 +18,5 @@ UtilityColors.configure do |config|
18
18
  # config.regular_classes = true
19
19
  # config.breakpoint_classes = false
20
20
  # config.pseudo_classes = false
21
- # config.breakpoint_pseudo_classes = false
21
+ # config.pseudo_breakpoint_classes = false
22
22
  end
@@ -1,34 +1,34 @@
1
- // v0.1.8 Absolute Sources
2
-
3
- $red: hsl(2, 78%, 64%);
4
- $rust: hsl(16, 82%, 62%);
5
- $orange: hsl(31, 90%, 65%);
6
- $gold: hsl(46, 93%, 54%);
7
- $yellow: hsl(58, 87%, 55%);
8
- $pear: hsl(80, 74%, 57%);
9
- $green: hsl(110, 69%, 58%);
10
- $seaside: hsl(156, 78%, 57%);
11
- $cyan: hsl(180, 69%, 37%);
12
- $capri: hsl(197, 90%, 46%);
13
- $blue: hsl(214, 78%, 36%);
14
- $iris: hsl(265, 87%, 57%);
15
- $purple: hsl(279, 85%, 56%);
16
- $magenta: hsl(300, 64%, 66%);
17
- $pink: hsl(320, 74%, 66%);
18
- $satin: hsl(348, 74%, 57%);
19
- $cement: hsl(42, 6%, 87%);
20
- $grey: hsl(0, 3%, 46%);
21
- $base: hsl(0, 3%, 46%);
22
-
23
- // v0.1.8 Relative Sources
24
-
25
- $success: $green-400;
26
- $danger: $red-400;
27
- $information: $blue-400;
28
- $warning: $gold-400;
29
-
30
- // v0.1.8 Single Sources
31
-
32
- $white: #fff;
33
- $black: #000;
34
- $translucent: rgba(#000, 0.45);
1
+ // v0.1.8 Absolute Sources
2
+
3
+ $red: hsl(2, 78%, 64%);
4
+ $rust: hsl(16, 82%, 62%);
5
+ $orange: hsl(31, 90%, 65%);
6
+ $gold: hsl(46, 93%, 54%);
7
+ $yellow: hsl(58, 87%, 55%);
8
+ $pear: hsl(80, 74%, 57%);
9
+ $green: hsl(110, 69%, 58%);
10
+ $seaside: hsl(156, 78%, 57%);
11
+ $cyan: hsl(180, 69%, 37%);
12
+ $capri: hsl(197, 90%, 46%);
13
+ $blue: hsl(214, 78%, 36%);
14
+ $iris: hsl(265, 87%, 57%);
15
+ $purple: hsl(279, 85%, 56%);
16
+ $magenta: hsl(300, 64%, 66%);
17
+ $pink: hsl(320, 74%, 66%);
18
+ $satin: hsl(348, 74%, 57%);
19
+ $cement: hsl(42, 6%, 87%);
20
+ $grey: hsl(0, 3%, 46%);
21
+ $base: hsl(0, 3%, 46%);
22
+
23
+ // v0.1.8 Relative Sources
24
+
25
+ $success: $green-400;
26
+ $danger: $red-400;
27
+ $information: $blue-400;
28
+ $warning: $gold-400;
29
+
30
+ // v0.1.8 Single Sources
31
+
32
+ $white: #fff;
33
+ $black: #000;
34
+ $translucent: rgba(#000, 0.45);
@@ -1,13 +1,13 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityColors
4
- module Generators
5
- class ConfigGenerator < Rails::Generators::Base
6
- source_root File.expand_path('../../..', __dir__)
7
-
8
- def copy_config
9
- copy_file 'lib/generators/templates/config/utility_colors.rb', 'config/initializers/utility_colors.rb'
10
- end
11
- end
12
- end
13
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityColors
4
+ module Generators
5
+ class ConfigGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('../../..', __dir__)
7
+
8
+ def copy_config
9
+ copy_file 'lib/generators/templates/config/utility_colors.rb', 'config/initializers/utility_colors.rb'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,31 +1,31 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityColors
4
- module Generators
5
- class GenerateGenerator < Rails::Generators::Base
6
- def generate_utility_colors
7
- # TODO: check if the v0.1.8 scss files exists
8
- # "app/app/assets/stylesheets/utility_colors_files" directory
9
- self.class.config_format_warn if File.exist?('config/utility_colors.yml') || File.exist?('config/utility_colors.json')
10
-
11
- if UtilityColors.configuration.enable_environments.include?(Rails.env.to_sym)
12
- UtilityColors::Colors.generate
13
- else
14
- self.class.disabled_warn
15
- end
16
- end
17
-
18
- private
19
-
20
- # TODO: add links to README for migration
21
- def self.config_format_warn
22
- warn 'WARNING: Utility Colors now uses an initializer to set config. You need to migrate and remove your YML/JSON file.'
23
- end
24
-
25
- # TODO: add links to README for environment setting
26
- def self.disabled_warn
27
- warn 'ERROR: Utility Colors is disabled for this environment. Color classes will not be generated.'
28
- end
29
- end
30
- end
31
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityColors
4
+ module Generators
5
+ class GenerateGenerator < Rails::Generators::Base
6
+ def generate_utility_colors
7
+ # TODO: check if the v0.1.8 scss files exists
8
+ # "app/app/assets/stylesheets/utility_colors_files" directory
9
+ self.class.config_format_warn if File.exist?('config/utility_colors.yml') || File.exist?('config/utility_colors.json')
10
+
11
+ if UtilityColors.configuration.enable_environments.include?(Rails.env.to_sym)
12
+ UtilityColors::Colors.generate
13
+ else
14
+ self.class.disabled_warn
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ # TODO: add links to README for migration
21
+ def self.config_format_warn
22
+ warn 'WARNING: Utility Colors now uses an initializer to set config. You need to migrate and remove your YML/JSON file.'
23
+ end
24
+
25
+ # TODO: add links to README for environment setting
26
+ def self.disabled_warn
27
+ warn 'ERROR: Utility Colors is disabled for this environment. Color classes will not be generated.'
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,75 +1,75 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityColors
4
- class Builders
5
- # '.' are appended during final formatting
6
-
7
- # 'color--red-400'
8
- def self.utility_classes_creation(class_name, content)
9
- content = [content] unless content.is_a?(Array)
10
- { class_name => "#{content.join(': ')};" }
11
- end
12
-
13
- # 'md|color--red-400'
14
- def self.utility_pseudo_classes_creation(class_name, content, pseudo)
15
- content = [content] unless content.is_a?(Array)
16
- { "#{pseudo}\|#{class_name}:#{pseudo}" => "#{content.join(': ')};" }
17
- end
18
-
19
- # 'hover|color--red-400'
20
- def self.utility_breakpoint_classes_creation(class_name, content, initial, screen_size)
21
- content = [content] unless content.is_a?(Array)
22
- { "#{initial}\|#{class_name}" => "@media only screen and (min-width: #{screen_size - 1}) { #{content.join(': ')}; }" }
23
- end
24
-
25
- # 'hover|md|color--red-400'
26
- def self.utility_pseudo_breakpoint_classes_creation(class_name, content, pseudo, initial, screen_size)
27
- content = [content] unless content.is_a?(Array)
28
- { "#{pseudo}\|#{initial}\|#{class_name}:#{pseudo}" => "@media only screen and (min-width: #{screen_size - 1}) { #{content.join(': ')}; }" }
29
- end
30
-
31
- # Bulk Methods
32
-
33
- def self.utility_classes(class_name, content)
34
- UtilityColors::Builders.utility_classes_creation(class_name, content)
35
- end
36
-
37
- def self.bulk_breakpoint_class_creation(class_hash)
38
- uc_screens = UtilityColors::Properties.screen_sizes.transform_values(&:to_f)
39
-
40
- uc_screens.collect do |initial, screen_size|
41
- class_hash.collect do |class_name, content|
42
- UtilityColors::Builders.utility_breakpoint_classes_creation(class_name, content, initial, screen_size)
43
- end
44
- end.flatten.reduce({}, :merge)
45
- end
46
-
47
- def self.bulk_pseudo_class_creation(class_hash)
48
- uc_pseudos = UtilityColors::Properties.pseudos
49
-
50
- uc_pseudos.collect do |pseudo|
51
- class_hash.collect do |class_name, content|
52
- UtilityColors::Builders.utility_pseudo_classes_creation(class_name, content, pseudo)
53
- end
54
- end.flatten.reduce({}, :merge)
55
- end
56
-
57
- def self.bulk_pseudo_breakpoint_class_creation(class_hash)
58
- uc_screens = UtilityColors::Properties.screen_sizes.transform_values(&:to_f)
59
- uc_pseudos = UtilityColors::Properties.pseudos
60
-
61
- uc_screens.collect do |initial, screen_size|
62
- uc_pseudos.collect do |pseudo|
63
- class_hash.collect do |class_name, content|
64
- UtilityColors::Builders.utility_pseudo_breakpoint_classes_creation(class_name, content, pseudo, initial, screen_size)
65
- end
66
- end
67
- end.flatten.flatten.reduce({}, :merge)
68
- end
69
-
70
- # * Advanced Classes
71
-
72
- # utility_classes(class)
73
- # .class { content }
74
- end
75
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityColors
4
+ class Builders
5
+ # '.' are appended during final formatting
6
+
7
+ # 'color--red-400'
8
+ def self.utility_classes_creation(class_name, content)
9
+ content = [content] unless content.is_a?(Array)
10
+ { class_name => "#{content.join(': ')};" }
11
+ end
12
+
13
+ # 'md|color--red-400'
14
+ def self.utility_pseudo_classes_creation(class_name, content, pseudo)
15
+ content = [content] unless content.is_a?(Array)
16
+ { "#{pseudo}\|#{class_name}:#{pseudo}" => "#{content.join(': ')};" }
17
+ end
18
+
19
+ # 'hover|color--red-400'
20
+ def self.utility_breakpoint_classes_creation(class_name, content, initial, screen_size)
21
+ content = [content] unless content.is_a?(Array)
22
+ { "#{initial}\|#{class_name}" => "@media only screen and (min-width: #{screen_size - 1}) { #{content.join(': ')}; }" }
23
+ end
24
+
25
+ # 'hover|md|color--red-400'
26
+ def self.utility_pseudo_breakpoint_classes_creation(class_name, content, pseudo, initial, screen_size)
27
+ content = [content] unless content.is_a?(Array)
28
+ { "#{pseudo}\|#{initial}\|#{class_name}:#{pseudo}" => "@media only screen and (min-width: #{screen_size - 1}) { #{content.join(': ')}; }" }
29
+ end
30
+
31
+ # Bulk Methods
32
+
33
+ def self.utility_classes(class_name, content)
34
+ UtilityColors::Builders.utility_classes_creation(class_name, content)
35
+ end
36
+
37
+ def self.bulk_breakpoint_class_creation(class_hash)
38
+ uc_screens = UtilityColors::Properties.screen_sizes.transform_values(&:to_f)
39
+
40
+ uc_screens.collect do |initial, screen_size|
41
+ class_hash.collect do |class_name, content|
42
+ UtilityColors::Builders.utility_breakpoint_classes_creation(class_name, content, initial, screen_size)
43
+ end
44
+ end.flatten.reduce({}, :merge)
45
+ end
46
+
47
+ def self.bulk_pseudo_class_creation(class_hash)
48
+ uc_pseudos = UtilityColors::Properties.pseudos
49
+
50
+ uc_pseudos.collect do |pseudo|
51
+ class_hash.collect do |class_name, content|
52
+ UtilityColors::Builders.utility_pseudo_classes_creation(class_name, content, pseudo)
53
+ end
54
+ end.flatten.reduce({}, :merge)
55
+ end
56
+
57
+ def self.bulk_pseudo_breakpoint_class_creation(class_hash)
58
+ uc_screens = UtilityColors::Properties.screen_sizes.transform_values(&:to_f)
59
+ uc_pseudos = UtilityColors::Properties.pseudos
60
+
61
+ uc_screens.collect do |initial, screen_size|
62
+ uc_pseudos.collect do |pseudo|
63
+ class_hash.collect do |class_name, content|
64
+ UtilityColors::Builders.utility_pseudo_breakpoint_classes_creation(class_name, content, pseudo, initial, screen_size)
65
+ end
66
+ end
67
+ end.flatten.flatten.reduce({}, :merge)
68
+ end
69
+
70
+ # * Advanced Classes
71
+
72
+ # utility_classes(class)
73
+ # .class { content }
74
+ end
75
+ end
@@ -30,14 +30,14 @@ module UtilityColors
30
30
  puts 'Generated breakpoint colour classes...'
31
31
  end
32
32
 
33
- if configuration.breakpoint_classes
33
+ if configuration.pseudo_classes
34
34
  generated_pseudo_classes = UtilityColors::Builders.bulk_pseudo_class_creation(generated_source_classes)
35
- puts 'Generated breakpoint colour classes...'
35
+ puts 'Generated pseudo colour classes...'
36
36
  end
37
37
 
38
- if configuration.breakpoint_classes
38
+ if configuration.pseudo_breakpoint_classes
39
39
  generated_pseudo_breakpoint_classes = UtilityColors::Builders.bulk_pseudo_breakpoint_class_creation(generated_source_classes)
40
- puts 'Generated breakpoint colour classes...'
40
+ puts 'Generated pseudo breakpoint colour classes...'
41
41
  end
42
42
 
43
43
  generated_classes = {}.merge(generated_regular_classes, generated_breakpoint_classes, generated_pseudo_classes, generated_pseudo_breakpoint_classes)
@@ -5,7 +5,7 @@ module UtilityColors
5
5
  attr_accessor :enable_environments,
6
6
  :import_palettes_filepath,
7
7
  :output_filename, :output_dated, :output_files, :output_prefix, :output_suffix,
8
- :regular_classes, :breakpoint_classes, :pseudo_classes, :breakpoint_pseudo_classes # :utility_palettes_configuration
8
+ :regular_classes, :breakpoint_classes, :pseudo_classes, :pseudo_breakpoint_classes # :utility_palettes_configuration
9
9
 
10
10
  def initialize
11
11
  # Enabled Environments
@@ -25,7 +25,7 @@ module UtilityColors
25
25
  @regular_classes = true
26
26
  @breakpoint_classes = false
27
27
  @pseudo_classes = false
28
- @breakpoint_pseudo_classes = false
28
+ @pseudo_breakpoint_classes = false
29
29
 
30
30
  # Configuration instance for UtilityPalettes
31
31
  # @utility_palettes_configuration = UtilityPalettes::Configuration.new
@@ -1,54 +1,54 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityColors
4
- class Exports
5
- def self.json(filename, output_classes)
6
- # TODO: determine if they imported scss or css and return the variables keys in that way
7
- # TODO: determine if the style value should use a syntax variable or be converted to hardcoded value
8
- content = JSON.pretty_generate(output_classes.transform_values { |class_content| class_content.gsub('£$', '$').gsub('$£', '') })
9
- filepath = "#{filename}.json"
10
-
11
- # Create directory if it doesn't exist
12
- FileUtils.mkdir_p(File.dirname(filepath))
13
- File.write(filepath, content)
14
-
15
- puts 'Exporting utility colour classes JSON...'
16
- true
17
- end
18
-
19
- def self.scss(filename, output_classes)
20
- # TODO: determine if the style value should use the syntax variable or be converted to hardcoded value
21
- content = output_classes.collect { |class_name, class_content| "#{class_name} {\n\t#{class_content.gsub('£$', '$').gsub('$£', '')}\n}" }.join("\n\n")
22
- filepath = "#{filename}.scss"
23
-
24
- # Create directory if it doesn't exist
25
- FileUtils.mkdir_p(File.dirname(filepath))
26
- File.write(filepath, content)
27
-
28
- puts 'Exporting utility colour classes SCSS...'
29
- true
30
- end
31
-
32
- def self.css(filename, output_classes)
33
- # TODO: add root for variables at top? Leave for now as this is all based off a palette file where they should exist (easy copy and paste for devs)
34
- # TODO: determine if the style value should use the syntax variable or be converted to hardcoded value
35
- content = output_classes.collect { |class_name, class_content| "#{class_name} {\n\t#{class_content.gsub('£$', 'var(--').gsub('$£', ')')}\n}" }.join("\n\n")
36
- filepath = "#{filename}.css"
37
-
38
- # Create directory if it doesn't exist
39
- FileUtils.mkdir_p(File.dirname(filepath))
40
- File.write(filepath, content)
41
-
42
- puts 'Exporting utility colour classes CSS...'
43
- true
44
- end
45
-
46
- def self.append_percentage(value)
47
- "#{value}%"
48
- end
49
-
50
- def self.append_alpha(alpha)
51
- "/ #{alpha * 100}"
52
- end
53
- end
54
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityColors
4
+ class Exports
5
+ def self.json(filename, output_classes)
6
+ # TODO: determine if they imported scss or css and return the variables keys in that way
7
+ # TODO: determine if the style value should use a syntax variable or be converted to hardcoded value
8
+ content = JSON.pretty_generate(output_classes.transform_values { |class_content| class_content.gsub('£$', '$').gsub('$£', '') })
9
+ filepath = "#{filename}.json"
10
+
11
+ # Create directory if it doesn't exist
12
+ FileUtils.mkdir_p(File.dirname(filepath))
13
+ File.write(filepath, content)
14
+
15
+ puts 'Exporting utility colour classes JSON...'
16
+ true
17
+ end
18
+
19
+ def self.scss(filename, output_classes)
20
+ # TODO: determine if the style value should use the syntax variable or be converted to hardcoded value
21
+ content = output_classes.collect { |class_name, class_content| "#{class_name} {\n\t#{class_content.gsub('£$', '$').gsub('$£', '')}\n}" }.join("\n\n")
22
+ filepath = "#{filename}.scss"
23
+
24
+ # Create directory if it doesn't exist
25
+ FileUtils.mkdir_p(File.dirname(filepath))
26
+ File.write(filepath, content)
27
+
28
+ puts 'Exporting utility colour classes SCSS...'
29
+ true
30
+ end
31
+
32
+ def self.css(filename, output_classes)
33
+ # TODO: add root for variables at top? Leave for now as this is all based off a palette file where they should exist (easy copy and paste for devs)
34
+ # TODO: determine if the style value should use the syntax variable or be converted to hardcoded value
35
+ content = output_classes.collect { |class_name, class_content| "#{class_name} {\n\t#{class_content.gsub('£$', 'var(--').gsub('$£', ')')}\n}" }.join("\n\n")
36
+ filepath = "#{filename}.css"
37
+
38
+ # Create directory if it doesn't exist
39
+ FileUtils.mkdir_p(File.dirname(filepath))
40
+ File.write(filepath, content)
41
+
42
+ puts 'Exporting utility colour classes CSS...'
43
+ true
44
+ end
45
+
46
+ def self.append_percentage(value)
47
+ "#{value}%"
48
+ end
49
+
50
+ def self.append_alpha(alpha)
51
+ "/ #{alpha * 100}"
52
+ end
53
+ end
54
+ end
@@ -1,42 +1,42 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityColors
4
- class Imports
5
- def self.import
6
- import_path = UtilityColors.configuration.import_palettes_filepath
7
-
8
- if import_path.present? && File.file?(import_path)
9
- case File.extname(import_path)
10
- when '.json'
11
- UtilityColors::Imports.json(import_path)
12
- when '.scss'
13
- UtilityColors::Imports.scss(import_path)
14
- when '.css'
15
- UtilityColors::Imports.css(import_path)
16
- else
17
- warn 'WARNING: Palette file could not be imported as it is not JSON, SCSS, or CSS.'
18
- {}
19
- end
20
- else
21
- {}
22
- end
23
- end
24
-
25
- private
26
-
27
- def self.json(import_path)
28
- # expecting a normal json hash of name and value
29
- JSON.parse(File.read(import_path))
30
- end
31
-
32
- def self.scss(import_path)
33
- # expecting a normal scss file of variables
34
- File.read(import_path).scan(/\$([^:]+):\s*([^;]+);/).to_h
35
- end
36
-
37
- def self.css(import_path)
38
- # expecting a normal css file of variables
39
- File.read(import_path).scan(/--([^:]+):\s*([^;]+);/).to_h
40
- end
41
- end
42
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityColors
4
+ class Imports
5
+ def self.import
6
+ import_path = UtilityColors.configuration.import_palettes_filepath
7
+
8
+ if import_path.present? && File.file?(import_path)
9
+ case File.extname(import_path)
10
+ when '.json'
11
+ UtilityColors::Imports.json(import_path)
12
+ when '.scss'
13
+ UtilityColors::Imports.scss(import_path)
14
+ when '.css'
15
+ UtilityColors::Imports.css(import_path)
16
+ else
17
+ warn 'WARNING: Palette file could not be imported as it is not JSON, SCSS, or CSS.'
18
+ {}
19
+ end
20
+ else
21
+ {}
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def self.json(import_path)
28
+ # expecting a normal json hash of name and value
29
+ JSON.parse(File.read(import_path))
30
+ end
31
+
32
+ def self.scss(import_path)
33
+ # expecting a normal scss file of variables
34
+ File.read(import_path).scan(/\$([^:]+):\s*([^;]+);/).to_h
35
+ end
36
+
37
+ def self.css(import_path)
38
+ # expecting a normal css file of variables
39
+ File.read(import_path).scan(/--([^:]+):\s*([^;]+);/).to_h
40
+ end
41
+ end
42
+ end
@@ -1,77 +1,77 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityColors
4
- class Properties
5
- def self.get_property(*keys)
6
- keys = [keys] unless keys.is_a?(Array)
7
-
8
- property = UtilityColors::Properties.send(keys[0])
9
- property = property.dig(*keys.slice(1..-1)) if keys.length > 1
10
-
11
- property
12
- end
13
-
14
- def self.screen_sizes
15
- {
16
- 'sm' => '325px',
17
- 'md' => '768px',
18
- 'lg' => '1024px',
19
- 'xl' => '1440px'
20
- }
21
- end
22
-
23
- def self.pseudo_input
24
- [
25
- 'checked',
26
- 'disabled',
27
- 'enabled',
28
- 'focus'
29
- ]
30
- end
31
-
32
- # TODO: add it in
33
- def self.pseudo_input_extra
34
- [
35
- 'in-range',
36
- 'invalid',
37
- 'optional',
38
- 'out-of-range',
39
- 'read-only',
40
- 'read-write',
41
- 'require',
42
- 'valid'
43
- ]
44
- end
45
-
46
- def self.pseudo_action
47
- [
48
- 'active',
49
- 'hover',
50
- 'link',
51
- 'target',
52
- 'visited'
53
- ]
54
- end
55
-
56
- def self.pseudo_child
57
- [
58
- 'root',
59
- 'first-child',
60
- 'first-of-type',
61
- 'last-child',
62
- 'last-of-type',
63
- 'only-of-type',
64
- 'only-child',
65
- 'empty'
66
- # // nth-child(n},
67
- # // nth-last-child(n},
68
- # // nth-last-of-type(n},
69
- # // nth-of-type(n},
70
- ]
71
- end
72
-
73
- def self.pseudos
74
- UtilityColors::Properties.pseudo_input + UtilityColors::Properties.pseudo_action + UtilityColors::Properties.pseudo_child
75
- end
76
- end
77
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityColors
4
+ class Properties
5
+ def self.get_property(*keys)
6
+ keys = [keys] unless keys.is_a?(Array)
7
+
8
+ property = UtilityColors::Properties.send(keys[0])
9
+ property = property.dig(*keys.slice(1..-1)) if keys.length > 1
10
+
11
+ property
12
+ end
13
+
14
+ def self.screen_sizes
15
+ {
16
+ 'sm' => '325px',
17
+ 'md' => '768px',
18
+ 'lg' => '1024px',
19
+ 'xl' => '1440px'
20
+ }
21
+ end
22
+
23
+ def self.pseudo_input
24
+ [
25
+ 'checked',
26
+ 'disabled',
27
+ 'enabled',
28
+ 'focus'
29
+ ]
30
+ end
31
+
32
+ # TODO: add it in
33
+ def self.pseudo_input_extra
34
+ [
35
+ 'in-range',
36
+ 'invalid',
37
+ 'optional',
38
+ 'out-of-range',
39
+ 'read-only',
40
+ 'read-write',
41
+ 'require',
42
+ 'valid'
43
+ ]
44
+ end
45
+
46
+ def self.pseudo_action
47
+ [
48
+ 'active',
49
+ 'hover',
50
+ 'link',
51
+ 'target',
52
+ 'visited'
53
+ ]
54
+ end
55
+
56
+ def self.pseudo_child
57
+ [
58
+ 'root',
59
+ 'first-child',
60
+ 'first-of-type',
61
+ 'last-child',
62
+ 'last-of-type',
63
+ 'only-of-type',
64
+ 'only-child',
65
+ 'empty'
66
+ # // nth-child(n},
67
+ # // nth-last-child(n},
68
+ # // nth-last-of-type(n},
69
+ # // nth-of-type(n},
70
+ ]
71
+ end
72
+
73
+ def self.pseudos
74
+ UtilityColors::Properties.pseudo_input + UtilityColors::Properties.pseudo_action + UtilityColors::Properties.pseudo_child
75
+ end
76
+ end
77
+ end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- module UtilityColors
4
- VERSION = '1.0.0'
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ module UtilityColors
4
+ VERSION = '1.0.1'
5
+ end
@@ -1,15 +1,15 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'utility_colors/version'
4
-
5
- require_relative 'utility_colors/configuration'
6
- require_relative 'utility_colors/builders'
7
- require_relative 'utility_colors/colors'
8
- require_relative 'utility_colors/exports'
9
- require_relative 'utility_colors/imports'
10
- require_relative 'utility_colors/properties'
11
-
12
- module UtilityColors
13
- class Error < StandardError; end
14
- # Your code goes here...
15
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'utility_colors/version'
4
+
5
+ require_relative 'utility_colors/configuration'
6
+ require_relative 'utility_colors/builders'
7
+ require_relative 'utility_colors/colors'
8
+ require_relative 'utility_colors/exports'
9
+ require_relative 'utility_colors/imports'
10
+ require_relative 'utility_colors/properties'
11
+
12
+ module UtilityColors
13
+ class Error < StandardError; end
14
+ # Your code goes here...
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utility_colors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Davis