primer_view_components 0.0.50 → 0.0.51
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/app/components/primer/base_component.rb +2 -2
- data/lib/primer/classify.rb +1 -7
- data/lib/primer/classify/utilities.rb +3 -1
- data/lib/primer/classify/utilities.yml +2 -2
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/system_argument_instead_of_class.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e619cd65db4a67059cc81f1d9f7d57a9c3b6c9cf9dadf9cfb2cd4c37fdcedc2
|
4
|
+
data.tar.gz: 18eaf89147d7a3e415520b09f117bf4b748fbb9a06e166df12ccc3a930506007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 821f1b4b53b823049bbc8e1a740b1f21d36ada796e69c59471c9f9a28183b5d94a61958544ef3c3e6386424b595e72627abcab2cd05d61de10104ea40941e201
|
7
|
+
data.tar.gz: 58d0e5f7961736bee805ed3d99d5432bb4dfa16df8170abe89b1f24f2857cf80a17a578fb762b0f6f1e5b307fe96a9803e960cce6a1a2901282908e678295f79
|
data/CHANGELOG.md
CHANGED
@@ -30,6 +30,20 @@ The category for changes related to documentation, testing and tooling. Also, fo
|
|
30
30
|
|
31
31
|
## main
|
32
32
|
|
33
|
+
## 0.0.51
|
34
|
+
|
35
|
+
### Breaking changes
|
36
|
+
|
37
|
+
* Rename `width` and `height` System Arguments to `w` and `h`, resolving conflict with HTML attribute names.
|
38
|
+
|
39
|
+
*Manuel Puyol*
|
40
|
+
|
41
|
+
### Updates
|
42
|
+
|
43
|
+
* `SystemArgumentInsteadOfClass` linter will check for arguments in ViewHelpers.
|
44
|
+
|
45
|
+
*Manuel Puyol*
|
46
|
+
|
33
47
|
## 0.0.50
|
34
48
|
|
35
49
|
### New
|
@@ -93,8 +93,8 @@ module Primer
|
|
93
93
|
# | Name | Type | Description |
|
94
94
|
# | :- | :- | :- |
|
95
95
|
# | `display` | Symbol | <%= one_of(Primer::Classify::Utilities.mappings(:display)) %> |
|
96
|
-
# | `
|
97
|
-
# | `
|
96
|
+
# | `w` | Symbol | <%= one_of(Primer::Classify::Utilities.mappings(:w)) %> Also supports integer values. |
|
97
|
+
# | `h` | Symbol | <%= one_of(Primer::Classify::Utilities.mappings(:h)) %> Also supports integer values. |
|
98
98
|
# | `hide` | Symbol | Hide the element at a specific breakpoint. <%= one_of(Primer::Classify::Utilities.mappings(:hide)) %> |
|
99
99
|
# | `visibility` | Symbol | Visibility. <%= one_of(Primer::Classify::Utilities.mappings(:visibility)) %> |
|
100
100
|
# | `vertical_align` | Symbol | <%= one_of(Primer::Classify::Utilities.mappings(:vertical_align)) %> |
|
data/lib/primer/classify.rb
CHANGED
@@ -20,8 +20,6 @@ module Primer
|
|
20
20
|
COLOR_KEY = :color
|
21
21
|
BG_KEY = :bg
|
22
22
|
TEXT_KEYS = %i[font_family font_style font_weight text_align text_transform].freeze
|
23
|
-
WIDTH_KEY = :width
|
24
|
-
HEIGHT_KEY = :height
|
25
23
|
BOX_SHADOW_KEY = :box_shadow
|
26
24
|
CONTAINER_KEY = :container
|
27
25
|
|
@@ -94,8 +92,6 @@ module Primer
|
|
94
92
|
BORDER_RADIUS_KEY,
|
95
93
|
COLOR_KEY,
|
96
94
|
BG_KEY,
|
97
|
-
WIDTH_KEY,
|
98
|
-
HEIGHT_KEY,
|
99
95
|
BOX_SHADOW_KEY,
|
100
96
|
CONTAINER_KEY
|
101
97
|
]
|
@@ -170,9 +166,7 @@ module Primer
|
|
170
166
|
def extract_value(memo, key, val, breakpoint)
|
171
167
|
return if val.nil? || val == ""
|
172
168
|
|
173
|
-
if
|
174
|
-
memo[key] = val
|
175
|
-
elsif Primer::Classify::Utilities.supported_key?(key)
|
169
|
+
if Primer::Classify::Utilities.supported_key?(key)
|
176
170
|
memo[:classes] << Primer::Classify::Utilities.classname(key, val, breakpoint)
|
177
171
|
elsif BOOLEAN_MAPPINGS.key?(key)
|
178
172
|
BOOLEAN_MAPPINGS[key][:mappings].each do |m|
|
@@ -85,7 +85,7 @@
|
|
85
85
|
- float-md-none
|
86
86
|
- float-lg-none
|
87
87
|
- float-xl-none
|
88
|
-
:
|
88
|
+
:w:
|
89
89
|
:fit:
|
90
90
|
- width-fit
|
91
91
|
:full:
|
@@ -96,7 +96,7 @@
|
|
96
96
|
- width-md-auto
|
97
97
|
- width-lg-auto
|
98
98
|
- width-xl-auto
|
99
|
-
:
|
99
|
+
:h:
|
100
100
|
:fit:
|
101
101
|
- height-fit
|
102
102
|
:full:
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require "rubocop"
|
4
4
|
require "primer/classify/utilities"
|
5
5
|
require "primer/view_components/statuses"
|
6
|
+
require_relative "../../../../app/lib/primer/view_helper"
|
6
7
|
|
7
8
|
module RuboCop
|
8
9
|
module Cop
|
@@ -20,8 +21,7 @@ module RuboCop
|
|
20
21
|
STR
|
21
22
|
|
22
23
|
def on_send(node)
|
23
|
-
return unless node
|
24
|
-
return unless ::Primer::ViewComponents::STATUSES.key?(node.receiver.const_name)
|
24
|
+
return unless valid_node?(node)
|
25
25
|
return unless node.arguments?
|
26
26
|
|
27
27
|
# we are looking for hash arguments and they are always last
|
@@ -55,6 +55,16 @@ module RuboCop
|
|
55
55
|
|
56
56
|
private
|
57
57
|
|
58
|
+
# We only verify SystemArguments if it's a `.new` call on a component or
|
59
|
+
# a ViewHleper call.
|
60
|
+
def valid_node?(node)
|
61
|
+
view_helpers.include?(node.method_name) || (node.method_name == :new && ::Primer::ViewComponents::STATUSES.key?(node.receiver.const_name))
|
62
|
+
end
|
63
|
+
|
64
|
+
def view_helpers
|
65
|
+
::Primer::ViewHelper::HELPERS.keys.map { |key| "primer_#{key}".to_sym }
|
66
|
+
end
|
67
|
+
|
58
68
|
def arguments_as_string(system_arguments)
|
59
69
|
system_arguments.map do |key, value|
|
60
70
|
val = case value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|