primer_view_components 0.0.57 → 0.0.58

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.
@@ -1,20 +1,26 @@
1
1
  import '@github/clipboard-copy-element';
2
2
  const CLIPBOARD_COPY_TIMER_DURATION = 2000;
3
- function toggleSVG(svg) {
4
- if (svg.style.display === '' || svg.style.display === 'block') {
5
- svg.style.display = 'none';
6
- }
7
- else {
8
- svg.style.display = 'block';
9
- }
3
+ function showSVG(svg) {
4
+ svg.style.display = 'inline-block';
5
+ }
6
+ function hideSVG(svg) {
7
+ svg.style.display = 'none';
8
+ }
9
+ // Toggle a copy button.
10
+ function showCopy(button) {
11
+ const [clippyIcon, checkIcon] = button.querySelectorAll('.octicon');
12
+ if (!clippyIcon || !checkIcon)
13
+ return;
14
+ showSVG(clippyIcon);
15
+ hideSVG(checkIcon);
10
16
  }
11
17
  // Toggle a copy button.
12
- function toggleCopyButton(button) {
18
+ function showCheck(button) {
13
19
  const [clippyIcon, checkIcon] = button.querySelectorAll('.octicon');
14
20
  if (!clippyIcon || !checkIcon)
15
21
  return;
16
- toggleSVG(clippyIcon);
17
- toggleSVG(checkIcon);
22
+ hideSVG(clippyIcon);
23
+ showSVG(checkIcon);
18
24
  }
19
25
  const clipboardCopyElementTimers = new WeakMap();
20
26
  document.addEventListener('clipboard-copy', function ({ target }) {
@@ -28,7 +34,10 @@ document.addEventListener('clipboard-copy', function ({ target }) {
28
34
  clipboardCopyElementTimers.delete(target);
29
35
  }
30
36
  else {
31
- toggleCopyButton(target);
37
+ showCheck(target);
32
38
  }
33
- clipboardCopyElementTimers.set(target, setTimeout(toggleCopyButton, CLIPBOARD_COPY_TIMER_DURATION, target));
39
+ clipboardCopyElementTimers.set(target, setTimeout(() => {
40
+ showCopy(target);
41
+ clipboardCopyElementTimers.delete(target);
42
+ }, CLIPBOARD_COPY_TIMER_DURATION));
34
43
  });
@@ -2,22 +2,32 @@ import '@github/clipboard-copy-element'
2
2
 
3
3
  const CLIPBOARD_COPY_TIMER_DURATION = 2000
4
4
 
5
- function toggleSVG(svg: SVGElement) {
6
- if (svg.style.display === '' || svg.style.display === 'block') {
7
- svg.style.display = 'none'
8
- } else {
9
- svg.style.display = 'block'
10
- }
5
+ function showSVG(svg: SVGElement) {
6
+ svg.style.display = 'inline-block'
7
+ }
8
+
9
+ function hideSVG(svg: SVGElement) {
10
+ svg.style.display = 'none'
11
+ }
12
+
13
+ // Toggle a copy button.
14
+ function showCopy(button: HTMLElement) {
15
+ const [clippyIcon, checkIcon] = button.querySelectorAll<SVGElement>('.octicon')
16
+
17
+ if (!clippyIcon || !checkIcon) return
18
+
19
+ showSVG(clippyIcon)
20
+ hideSVG(checkIcon)
11
21
  }
12
22
 
13
23
  // Toggle a copy button.
14
- function toggleCopyButton(button: HTMLElement) {
24
+ function showCheck(button: HTMLElement) {
15
25
  const [clippyIcon, checkIcon] = button.querySelectorAll<SVGElement>('.octicon')
16
26
 
17
27
  if (!clippyIcon || !checkIcon) return
18
28
 
19
- toggleSVG(clippyIcon)
20
- toggleSVG(checkIcon)
29
+ hideSVG(clippyIcon)
30
+ showSVG(checkIcon)
21
31
  }
22
32
 
23
33
  const clipboardCopyElementTimers = new WeakMap<HTMLElement, number>()
@@ -32,8 +42,14 @@ document.addEventListener('clipboard-copy', function ({target}) {
32
42
  clearTimeout(currentTimeout)
33
43
  clipboardCopyElementTimers.delete(target)
34
44
  } else {
35
- toggleCopyButton(target)
45
+ showCheck(target)
36
46
  }
37
47
 
38
- clipboardCopyElementTimers.set(target, setTimeout(toggleCopyButton, CLIPBOARD_COPY_TIMER_DURATION, target))
48
+ clipboardCopyElementTimers.set(
49
+ target,
50
+ setTimeout(() => {
51
+ showCopy(target)
52
+ clipboardCopyElementTimers.delete(target)
53
+ }, CLIPBOARD_COPY_TIMER_DURATION)
54
+ )
39
55
  })
@@ -1,115 +1,125 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "flex"
4
- require_relative "functional_background_colors"
5
- require_relative "functional_border_colors"
6
4
  require_relative "grid"
7
5
 
8
6
  module Primer
9
7
  class Classify
10
8
  # :nodoc:
11
9
  class Cache
12
- # rubocop:disable Style/MutableConstant
13
- LOOKUP = {}
14
- # rubocop:enable Style/MutableConstant
15
-
16
- class <<self
17
- def read(memo, key, val, breakpoint)
18
- value = LOOKUP.dig(breakpoint, key, val)
19
- memo[:classes] << value if value
20
- end
10
+ include Singleton
21
11
 
22
- def clear!
23
- LOOKUP.clear
24
- end
12
+ def initialize
13
+ @cache_enabled = true
14
+ @lookup = {}
15
+ end
16
+
17
+ private :initialize
25
18
 
26
- def preload!
27
- preload(
28
- keys: Primer::Classify::Flex::DIRECTION_KEY,
29
- values: Primer::Classify::Flex::DIRECTION_VALUES
30
- )
31
-
32
- preload(
33
- keys: Primer::Classify::Flex::JUSTIFY_CONTENT_KEY,
34
- values: Primer::Classify::Flex::JUSTIFY_CONTENT_VALUES
35
- )
36
-
37
- preload(
38
- keys: Primer::Classify::Flex::ALIGN_ITEMS_KEY,
39
- values: Primer::Classify::Flex::ALIGN_ITEMS_VALUES
40
- )
41
-
42
- preload(
43
- keys: Primer::Classify::Grid::CONTAINER_KEY,
44
- values: Primer::Classify::Grid::CONTAINER_VALUES
45
- )
46
-
47
- preload(
48
- keys: Primer::Classify::Grid::CLEARFIX_KEY,
49
- values: [true]
50
- )
51
-
52
- preload(
53
- keys: Primer::Classify::Grid::COL_KEY,
54
- values: Primer::Classify::Grid::COL_VALUES
55
- )
56
-
57
- preload(
58
- keys: [Primer::Classify::BG_KEY],
59
- values: Primer::Classify::FunctionalBackgroundColors::OPTIONS
60
- )
61
-
62
- preload(
63
- keys: :text_align,
64
- values: [:left, :center, :right]
65
- )
66
-
67
- preload(
68
- keys: :font_weight,
69
- values: [:bold, :light, :normal]
70
- )
71
-
72
- preload(
73
- keys: Primer::Classify::Flex::FLEX_KEY,
74
- values: Primer::Classify::Flex::FLEX_VALUES
75
- )
76
-
77
- preload(
78
- keys: Primer::Classify::Flex::GROW_KEY,
79
- values: Primer::Classify::Flex::GROW_VALUES
80
- )
81
-
82
- preload(
83
- keys: Primer::Classify::Flex::SHRINK_KEY,
84
- values: Primer::Classify::Flex::SHRINK_VALUES
85
- )
86
-
87
- preload(
88
- keys: Primer::Classify::Flex::ALIGN_SELF_KEY,
89
- values: Primer::Classify::Flex::ALIGN_SELF_VALUES
90
- )
91
-
92
- preload(
93
- keys: Primer::Classify::BOX_SHADOW_KEY,
94
- values: [true, :small, :medium, :large, :extra_large, :none]
95
- )
19
+ def fetch(breakpoint, key, val)
20
+ found = @lookup.dig(breakpoint, key, val)
21
+ return found if found
22
+
23
+ yield.tap do |result|
24
+ set(result, breakpoint, key, val) if @cache_enabled
96
25
  end
26
+ end
27
+
28
+ def disable
29
+ @cache_enabled = false
30
+ yield
31
+ @cache_enabled = true
32
+ end
97
33
 
98
- def preload(keys:, values:)
99
- BREAKPOINTS.each do |breakpoint|
100
- Array(keys).each do |key|
101
- values.each do |value|
102
- classes = { classes: [] }
103
- Primer::Classify.send(:extract_value, classes, key, value, breakpoint)
104
-
105
- LOOKUP[breakpoint] ||= {}
106
- LOOKUP[breakpoint][key] ||= {}
107
- LOOKUP[breakpoint][key][value] = classes[:classes].first
108
- end
34
+ def clear!
35
+ @lookup.clear
36
+ end
37
+
38
+ def preload!
39
+ preload(
40
+ keys: Primer::Classify::Flex::DIRECTION_KEY,
41
+ values: Primer::Classify::Flex::DIRECTION_VALUES
42
+ )
43
+
44
+ preload(
45
+ keys: Primer::Classify::Flex::JUSTIFY_CONTENT_KEY,
46
+ values: Primer::Classify::Flex::JUSTIFY_CONTENT_VALUES
47
+ )
48
+
49
+ preload(
50
+ keys: Primer::Classify::Flex::ALIGN_ITEMS_KEY,
51
+ values: Primer::Classify::Flex::ALIGN_ITEMS_VALUES
52
+ )
53
+
54
+ preload(
55
+ keys: Primer::Classify::Grid::CONTAINER_KEY,
56
+ values: Primer::Classify::Grid::CONTAINER_VALUES
57
+ )
58
+
59
+ preload(
60
+ keys: Primer::Classify::Grid::CLEARFIX_KEY,
61
+ values: [true]
62
+ )
63
+
64
+ preload(
65
+ keys: Primer::Classify::Grid::COL_KEY,
66
+ values: Primer::Classify::Grid::COL_VALUES
67
+ )
68
+
69
+ preload(
70
+ keys: :text_align,
71
+ values: [:left, :center, :right]
72
+ )
73
+
74
+ preload(
75
+ keys: :font_weight,
76
+ values: [:bold, :light, :normal]
77
+ )
78
+
79
+ preload(
80
+ keys: Primer::Classify::Flex::FLEX_KEY,
81
+ values: Primer::Classify::Flex::FLEX_VALUES
82
+ )
83
+
84
+ preload(
85
+ keys: Primer::Classify::Flex::GROW_KEY,
86
+ values: Primer::Classify::Flex::GROW_VALUES
87
+ )
88
+
89
+ preload(
90
+ keys: Primer::Classify::Flex::SHRINK_KEY,
91
+ values: Primer::Classify::Flex::SHRINK_VALUES
92
+ )
93
+
94
+ preload(
95
+ keys: Primer::Classify::Flex::ALIGN_SELF_KEY,
96
+ values: Primer::Classify::Flex::ALIGN_SELF_VALUES
97
+ )
98
+
99
+ preload(
100
+ keys: Primer::Classify::BOX_SHADOW_KEY,
101
+ values: [true, :small, :medium, :large, :extra_large, :none]
102
+ )
103
+ end
104
+
105
+ private
106
+
107
+ def preload(keys:, values:)
108
+ BREAKPOINTS.each do |breakpoint|
109
+ Array(keys).each do |key|
110
+ values.each do |value|
111
+ classes = Primer::Classify.send(:classes_from, key, value, breakpoint)
112
+ set(classes, breakpoint, key, value)
109
113
  end
110
114
  end
111
115
  end
112
116
  end
117
+
118
+ def set(item, breakpoint, key, val)
119
+ @lookup[breakpoint] ||= {}
120
+ @lookup[breakpoint][key] ||= {}
121
+ @lookup[breakpoint][key][val] = item
122
+ end
113
123
  end
114
124
  end
115
125
  end
@@ -26,31 +26,36 @@ module Primer
26
26
  "^wb" => "word_break",
27
27
  "^v" => "visibility",
28
28
  "^width" => "w",
29
- "^height" => "h"
29
+ "^height" => "h",
30
+ "^color-bg" => "bg",
31
+ "^color-border" => "border_color"
30
32
  }.freeze
31
33
 
34
+ SUPPORTED_KEY_CACHE = Hash.new { |h, k| h[k] = !UTILITIES[k].nil? }
35
+ BREAKPOINT_INDEX_CACHE = Hash.new { |h, k| h[k] = BREAKPOINTS.index(k) }
36
+
32
37
  class << self
33
38
  def classname(key, val, breakpoint = "")
34
39
  if (valid = validate(key, val, breakpoint))
35
40
  valid
36
41
  else
37
42
  # Get selector
38
- UTILITIES[key][val][BREAKPOINTS.index(breakpoint)]
43
+ UTILITIES[key][val][BREAKPOINT_INDEX_CACHE[breakpoint]]
39
44
  end
40
45
  end
41
46
 
42
- # Does the Utilitiy class support the given key
47
+ # Does the Utility class support the given key
43
48
  #
44
49
  # returns Boolean
45
50
  def supported_key?(key)
46
- UTILITIES[key].present?
51
+ SUPPORTED_KEY_CACHE[key]
47
52
  end
48
53
 
49
- # Does the Utilitiy class support the given key and value
54
+ # Does the Utility class support the given key and value
50
55
  #
51
56
  # returns Boolean
52
57
  def supported_value?(key, val)
53
- supported_key?(key) && UTILITIES[key][val].present?
58
+ supported_key?(key) && !UTILITIES[key][val].nil?
54
59
  end
55
60
 
56
61
  # Does the given selector exist in the utilities file
@@ -55,6 +55,54 @@
55
55
  - color-icon-success
56
56
  :icon_warning:
57
57
  - color-icon-warning
58
+ :border_color:
59
+ :primary:
60
+ - color-border-primary
61
+ :secondary:
62
+ - color-border-secondary
63
+ :tertiary:
64
+ - color-border-tertiary
65
+ :inverse:
66
+ - color-border-inverse
67
+ :info:
68
+ - color-border-info
69
+ :success:
70
+ - color-border-success
71
+ :danger:
72
+ - color-border-danger
73
+ :warning:
74
+ - color-border-warning
75
+ :bg:
76
+ :canvas:
77
+ - color-bg-canvas
78
+ :canvas_inverse:
79
+ - color-bg-canvas-inverse
80
+ :canvas_inset:
81
+ - color-bg-canvas-inset
82
+ :primary:
83
+ - color-bg-primary
84
+ :secondary:
85
+ - color-bg-secondary
86
+ :tertiary:
87
+ - color-bg-tertiary
88
+ :overlay:
89
+ - color-bg-overlay
90
+ :info:
91
+ - color-bg-info
92
+ :info_inverse:
93
+ - color-bg-info-inverse
94
+ :danger:
95
+ - color-bg-danger
96
+ :danger_inverse:
97
+ - color-bg-danger-inverse
98
+ :success:
99
+ - color-bg-success
100
+ :success_inverse:
101
+ - color-bg-success-inverse
102
+ :warning:
103
+ - color-bg-warning
104
+ :warning_inverse:
105
+ - color-bg-warning-inverse
58
106
  :position:
59
107
  :static:
60
108
  - position-static
@@ -6,7 +6,7 @@ module Primer
6
6
  class Classify
7
7
  # :nodoc:
8
8
  class Validation
9
- INVALID_CLASS_NAME_PREFIXES = /bg-|color-bg-|text-|box-shadow-|box_shadow-/.freeze
9
+ INVALID_CLASS_NAME_PREFIXES = /text-|box-shadow-|box_shadow-/.freeze
10
10
 
11
11
  class << self
12
12
  def invalid?(class_name)
@@ -2,8 +2,6 @@
2
2
 
3
3
  require_relative "classify/cache"
4
4
  require_relative "classify/flex"
5
- require_relative "classify/functional_background_colors"
6
- require_relative "classify/functional_border_colors"
7
5
  require_relative "classify/grid"
8
6
  require_relative "classify/utilities"
9
7
  require_relative "classify/validation"
@@ -14,7 +12,6 @@ module Primer
14
12
  # Keys where we can simply translate { key: value } into ".key-value"
15
13
  CONCAT_KEYS = %i[text box_shadow].freeze
16
14
 
17
- BG_KEY = :bg
18
15
  TEXT_KEYS = %i[font_family font_style font_weight text_align text_transform].freeze
19
16
  BOX_SHADOW_KEY = :box_shadow
20
17
  CONTAINER_KEY = :container
@@ -69,7 +66,6 @@ module Primer
69
66
  }
70
67
  }.freeze
71
68
  BORDER_KEY = :border
72
- BORDER_COLOR_KEY = :border_color
73
69
  BORDER_MARGIN_KEYS = %i[border_top border_bottom border_left border_right].freeze
74
70
  BORDER_RADIUS_KEY = :border_radius
75
71
  TYPOGRAPHY_KEYS = [:font_size].freeze
@@ -84,9 +80,7 @@ module Primer
84
80
  Primer::Classify::Grid::KEYS +
85
81
  [
86
82
  BORDER_KEY,
87
- BORDER_COLOR_KEY,
88
83
  BORDER_RADIUS_KEY,
89
- BG_KEY,
90
84
  BOX_SHADOW_KEY,
91
85
  CONTAINER_KEY
92
86
  ]
@@ -94,23 +88,25 @@ module Primer
94
88
 
95
89
  class << self
96
90
  def call(classes: "", style: nil, **args)
97
- extracted_results = extract_hash(args)
91
+ extract_css_attrs(args).tap do |extracted_results|
92
+ classes = +"#{validated_class_names(classes)} #{extracted_results[:class]}"
93
+ classes.strip!
94
+ extracted_results[:class] = presence(classes)
98
95
 
99
- extracted_results[:class] = [
100
- validated_class_names(classes),
101
- extracted_results.delete(:classes)
102
- ].compact.join(" ").strip.presence
103
-
104
- extracted_results[:style] = [
105
- extracted_results.delete(:styles),
106
- style
107
- ].compact.join.presence
108
-
109
- extracted_results
96
+ styles = "#{extracted_results[:style]}#{style}"
97
+ extracted_results[:style] = presence(styles)
98
+ end
110
99
  end
111
100
 
112
101
  private
113
102
 
103
+ # do this instead of using Rails' presence/blank?, which are a lot slower
104
+ def presence(obj)
105
+ # rubocop:disable Rails/Blank
106
+ !obj || obj.empty? ? nil : obj
107
+ # rubocop:enable Rails/Blank
108
+ end
109
+
114
110
  def validated_class_names(classes)
115
111
  return if classes.blank?
116
112
 
@@ -120,7 +116,11 @@ module Primer
120
116
  memo << class_name if Primer::Classify::Validation.invalid?(class_name)
121
117
  end
122
118
 
123
- raise ArgumentError, "Use System Arguments (https://primer.style/view-components/system-arguments) instead of Primer CSS class #{'name'.pluralize(invalid_class_names.length)} #{invalid_class_names.to_sentence}. This warning will not be raised in production. Set PRIMER_WARNINGS_DISABLED=1 to disable this warning." if invalid_class_names.any?
119
+ if invalid_class_names.any?
120
+ raise ArgumentError, "Use System Arguments (https://primer.style/view-components/system-arguments) "\
121
+ "instead of Primer CSS class #{'name'.pluralize(invalid_class_names.length)} #{invalid_class_names.to_sentence}. "\
122
+ "This warning will not be raised in production. Set PRIMER_WARNINGS_DISABLED=1 to disable this warning."
123
+ end
124
124
  end
125
125
 
126
126
  classes
@@ -133,80 +133,88 @@ module Primer
133
133
  #
134
134
  # styles_hash - A hash with utility keys that mimic the interface used by https://github.com/primer/components
135
135
  #
136
- # Returns a string of Primer CSS class names to be added to an HTML class attribute
136
+ # Returns a string of Primer CSS class names and style attributes to be added to an HTML tag.
137
137
  #
138
138
  # Example usage:
139
- # extract_hash({ mt: 4, py: 2 }) => "mt-4 py-2"
140
- def extract_hash(styles_hash)
141
- memo = { classes: [], styles: +"" }
142
- styles_hash.each do |key, value|
143
- next unless VALID_KEYS.include?(key)
139
+ # extract_css_attrs({ mt: 4, py: 2 }) => "mt-4 py-2"
140
+ def extract_css_attrs(styles_hash)
141
+ classes = []
142
+ styles = +""
144
143
 
144
+ styles_hash.each do |key, value|
145
145
  if value.is_a?(Array)
146
146
  raise ArgumentError, "#{key} does not support responsive values" unless RESPONSIVE_KEYS.include?(key) || Primer::Classify::Utilities.supported_key?(key)
147
147
 
148
148
  value.each_with_index do |val, index|
149
- Primer::Classify::Cache.read(memo, key, val, BREAKPOINTS[index]) || extract_value(memo, key, val, BREAKPOINTS[index])
149
+ extract_one_css_attr(classes, styles, key, val, BREAKPOINTS[index])
150
150
  end
151
151
  else
152
- Primer::Classify::Cache.read(memo, key, value, BREAKPOINTS[0]) || extract_value(memo, key, value, BREAKPOINTS[0])
152
+ extract_one_css_attr(classes, styles, key, value, BREAKPOINTS[0])
153
153
  end
154
154
  end
155
155
 
156
- memo[:classes] = memo[:classes].join(" ")
156
+ {
157
+ class: classes.join(" "),
158
+ style: styles
159
+ }
160
+ end
161
+
162
+ def extract_one_css_attr(classes, styles, key, val, breakpoint)
163
+ found_classes = Primer::Classify::Cache.instance.fetch(breakpoint, key, val) do
164
+ classes_from(key, val, breakpoint)
165
+ end
166
+
167
+ classes << found_classes if found_classes
157
168
 
158
- memo
169
+ found_styles = styles_from(key, val, breakpoint)
170
+ styles << found_styles if found_styles
159
171
  end
160
172
 
161
- def extract_value(memo, key, val, breakpoint)
173
+ def styles_from(key, val, _breakpoint)
174
+ # Turn this into an if/else like classes_from when we have more branches.
175
+ # Could be that way now, but it makes Rubocop unhappy.
176
+ end
177
+
178
+ def classes_from(key, val, breakpoint)
162
179
  return if val.nil? || val == ""
163
180
 
164
181
  if Primer::Classify::Utilities.supported_key?(key)
165
- memo[:classes] << Primer::Classify::Utilities.classname(key, val, breakpoint)
182
+ Primer::Classify::Utilities.classname(key, val, breakpoint)
166
183
  elsif BOOLEAN_MAPPINGS.key?(key)
167
- BOOLEAN_MAPPINGS[key][:mappings].each do |m|
168
- memo[:classes] << m[:css_class] if m[:value] == val && m[:css_class].present?
184
+ bools = BOOLEAN_MAPPINGS[key][:mappings].each_with_object([]) do |m, memo|
185
+ memo << m[:css_class] if m[:value] == val && m[:css_class].present?
169
186
  end
170
- elsif key == BG_KEY
171
- if val.to_s.start_with?("#")
172
- memo[:styles] << "background-color: #{val};"
187
+ bools.empty? ? nil : bools.join(" ")
188
+ elsif key == BORDER_KEY
189
+ if val == true
190
+ "border"
173
191
  else
174
- memo[:classes] << Primer::Classify::FunctionalBackgroundColors.color(val)
192
+ "border-#{val.to_s.dasherize}"
175
193
  end
176
- elsif key == BORDER_KEY
177
- border_value = if val == true
178
- "border"
179
- else
180
- "border-#{val.to_s.dasherize}"
181
- end
182
-
183
- memo[:classes] << border_value
184
- elsif key == BORDER_COLOR_KEY
185
- memo[:classes] << Primer::Classify::FunctionalBorderColors.color(val)
186
194
  elsif BORDER_MARGIN_KEYS.include?(key)
187
- memo[:classes] << "#{key.to_s.dasherize}-#{val}"
195
+ "#{key.to_s.dasherize}-#{val}"
188
196
  elsif key == BORDER_RADIUS_KEY
189
- memo[:classes] << "rounded-#{val}"
197
+ "rounded-#{val}"
190
198
  elsif Primer::Classify::Flex::KEYS.include?(key)
191
- memo[:classes] << Primer::Classify::Flex.classes(key, val, breakpoint)
199
+ Primer::Classify::Flex.classes(key, val, breakpoint)
192
200
  elsif Primer::Classify::Grid::KEYS.include?(key)
193
- memo[:classes] << Primer::Classify::Grid.classes(key, val, breakpoint)
201
+ Primer::Classify::Grid.classes(key, val, breakpoint)
194
202
  elsif TEXT_KEYS.include?(key)
195
- memo[:classes] << "text-#{val.to_s.dasherize}"
203
+ "text-#{val.to_s.dasherize}"
196
204
  elsif TYPOGRAPHY_KEYS.include?(key)
197
- memo[:classes] << if val == :small || val == :normal
198
- "text-#{val.to_s.dasherize}"
199
- else
200
- "f#{val.to_s.dasherize}"
201
- end
205
+ if val == :small || val == :normal
206
+ "text-#{val.to_s.dasherize}"
207
+ else
208
+ "f#{val.to_s.dasherize}"
209
+ end
202
210
  elsif key == BOX_SHADOW_KEY
203
- memo[:classes] << if val == true
204
- "color-shadow-small"
205
- elsif val == :none || val.blank?
206
- "box-shadow-none"
207
- else
208
- "color-shadow-#{val.to_s.dasherize}"
209
- end
211
+ if val == true
212
+ "color-shadow-small"
213
+ elsif val == :none || val.blank?
214
+ "box-shadow-none"
215
+ else
216
+ "color-shadow-#{val.to_s.dasherize}"
217
+ end
210
218
  end
211
219
  end
212
220
 
@@ -215,6 +223,6 @@ module Primer
215
223
  end
216
224
  end
217
225
 
218
- Cache.preload!
226
+ Cache.instance.preload!
219
227
  end
220
228
  end
@@ -14,7 +14,6 @@ module Primer
14
14
 
15
15
  config.primer_view_components = ActiveSupport::OrderedOptions.new
16
16
 
17
- config.primer_view_components.force_functional_colors = true
18
17
  config.primer_view_components.force_system_arguments = false
19
18
  config.primer_view_components.silence_deprecations = false
20
19
 
@@ -5,7 +5,7 @@ module Primer
5
5
  module VERSION
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 57
8
+ PATCH = 58
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].join(".")
11
11
  end