utility_colors 1.0.1 → 1.0.2
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/lib/utility_colors/builders.rb +76 -75
- data/lib/utility_colors/version.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b724d22935983f69caf72f8a4d7f4fda4cb36d9170e3f2bdb903af17429ca3e0
|
4
|
+
data.tar.gz: 2b73c4015dbe484f7ef4e8912ef471273b28580e518275dc729c60f695aad117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90e3859529d811fe17f01c4b419c109e3f9b05359ec14fb6fccd39fa8bab7b4322d39d8a73f24be3a1a63e09c58fe811cc4fcd21632b1542cd45c05f25ad1c11
|
7
|
+
data.tar.gz: 455b3b7cc322b728261aea0647b06b1eeb1685788e30fa60cadd6dbc7af086b019df392ad2237039bb41bd07f9fdc266db0dbe46f66a3dce8529f94616d4ef89
|
@@ -1,75 +1,76 @@
|
|
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
|
-
# '
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
#
|
74
|
-
|
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
|
+
# ';' are already in the content from the above source method
|
14
|
+
# 'md|color--red-400'
|
15
|
+
def self.utility_pseudo_classes_creation(class_name, content, pseudo)
|
16
|
+
content = [content] unless content.is_a?(Array)
|
17
|
+
{ "#{pseudo}\\|#{class_name}:#{pseudo}" => content.join(': ') }
|
18
|
+
end
|
19
|
+
|
20
|
+
# 'hover|color--red-400'
|
21
|
+
def self.utility_breakpoint_classes_creation(class_name, content, initial, screen_size)
|
22
|
+
content = [content] unless content.is_a?(Array)
|
23
|
+
{ "#{initial}\\|#{class_name}" => "@media only screen and (min-width: #{screen_size - 1}) { #{content.join(': ')} }" }
|
24
|
+
end
|
25
|
+
|
26
|
+
# 'hover|md|color--red-400'
|
27
|
+
def self.utility_pseudo_breakpoint_classes_creation(class_name, content, pseudo, initial, screen_size)
|
28
|
+
content = [content] unless content.is_a?(Array)
|
29
|
+
{ "#{pseudo}\\|#{initial}\\|#{class_name}:#{pseudo}" => "@media only screen and (min-width: #{screen_size - 1}) { #{content.join(': ')} }" }
|
30
|
+
end
|
31
|
+
|
32
|
+
# Bulk Methods
|
33
|
+
|
34
|
+
def self.utility_classes(class_name, content)
|
35
|
+
UtilityColors::Builders.utility_classes_creation(class_name, content)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.bulk_breakpoint_class_creation(class_hash)
|
39
|
+
uc_screens = UtilityColors::Properties.screen_sizes.transform_values(&:to_f)
|
40
|
+
|
41
|
+
uc_screens.collect do |initial, screen_size|
|
42
|
+
class_hash.collect do |class_name, content|
|
43
|
+
UtilityColors::Builders.utility_breakpoint_classes_creation(class_name, content, initial, screen_size)
|
44
|
+
end
|
45
|
+
end.flatten.reduce({}, :merge)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.bulk_pseudo_class_creation(class_hash)
|
49
|
+
uc_pseudos = UtilityColors::Properties.pseudos
|
50
|
+
|
51
|
+
uc_pseudos.collect do |pseudo|
|
52
|
+
class_hash.collect do |class_name, content|
|
53
|
+
UtilityColors::Builders.utility_pseudo_classes_creation(class_name, content, pseudo)
|
54
|
+
end
|
55
|
+
end.flatten.reduce({}, :merge)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.bulk_pseudo_breakpoint_class_creation(class_hash)
|
59
|
+
uc_screens = UtilityColors::Properties.screen_sizes.transform_values(&:to_f)
|
60
|
+
uc_pseudos = UtilityColors::Properties.pseudos
|
61
|
+
|
62
|
+
uc_screens.collect do |initial, screen_size|
|
63
|
+
uc_pseudos.collect do |pseudo|
|
64
|
+
class_hash.collect do |class_name, content|
|
65
|
+
UtilityColors::Builders.utility_pseudo_breakpoint_classes_creation(class_name, content, pseudo, initial, screen_size)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end.flatten.flatten.reduce({}, :merge)
|
69
|
+
end
|
70
|
+
|
71
|
+
# * Advanced Classes
|
72
|
+
|
73
|
+
# utility_classes(class)
|
74
|
+
# .class { content }
|
75
|
+
end
|
76
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module UtilityColors
|
4
|
-
VERSION = '1.0.
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module UtilityColors
|
4
|
+
VERSION = '1.0.2'
|
5
|
+
end
|