ariadne_view_components 0.0.44-x64-mingw-ucrt → 0.0.46-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/app/lib/ariadne/action_view_extensions/form_helper.rb +30 -0
- data/app/lib/ariadne/audited/dsl.rb +32 -0
- data/app/lib/ariadne/class_name_helper.rb +22 -0
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +110 -0
- data/app/lib/ariadne/form_builder.rb +74 -0
- data/app/lib/ariadne/icon_helper.rb +51 -0
- data/app/lib/ariadne/logger_helper.rb +23 -0
- data/app/lib/ariadne/status/dsl.rb +41 -0
- data/app/lib/ariadne/view_helper.rb +22 -0
- data/lib/ariadne/view_components/version.rb +1 -1
- metadata +10 -12
- data/lib/tasks/ariadne_view_components.rake +0 -48
- data/lib/tasks/build.rake +0 -30
- data/lib/tasks/coverage.rake +0 -20
- data/lib/tasks/docs.rake +0 -466
- data/lib/tasks/helpers/ast_processor.rb +0 -44
- data/lib/tasks/helpers/ast_traverser.rb +0 -77
- data/lib/tasks/static.rake +0 -15
- data/lib/tasks/test.rake +0 -19
- data/lib/yard/docs_helper.rb +0 -90
- data/lib/yard/renders_many_handler.rb +0 -19
- data/lib/yard/renders_one_handler.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46fd9bcf19f73e8e73a375c75d6342971a847f569da0f6da394575a98b68ca3e
|
4
|
+
data.tar.gz: 616d5126c65f46009d2f752524536f2d8d22393317860c6620857093bda2fa93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e309f403becd79323cc28b7da2bc6e7ce7ef99eb09f07e7d0e6b743b589aaaf84394d0028638ae6466629304d81d09b8d1ae40a644b4fbe4ab5b8b147fa4a45
|
7
|
+
data.tar.gz: '0088c46003790756564374b959bfd0390969584ffab4dddf87917ec9e2b5dd13b0a59a3a5c86df19064b927dd3c6190eac7442ffd4f97fc7992d06161d2b5e42'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.0.45](https://github.com/yettoapp/ariadne/tree/v0.0.45) (2023-05-04)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/yettoapp/ariadne/compare/v0.0.44...v0.0.45)
|
6
|
+
|
7
|
+
## [v0.0.44](https://github.com/yettoapp/ariadne/tree/v0.0.44) (2023-05-04)
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/yettoapp/ariadne/compare/v0.0.43...v0.0.44)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- build\(deps-dev\): bump @typescript-eslint/eslint-plugin from 5.59.1 to 5.59.2 [\#298](https://github.com/yettoapp/ariadne/pull/298) ([dependabot[bot]](https://github.com/apps/dependabot))
|
14
|
+
- \[auto-browserslist\] Update Browserslist db [\#296](https://github.com/yettoapp/ariadne/pull/296) ([sisyphusbot](https://github.com/sisyphusbot))
|
15
|
+
|
3
16
|
## [v0.0.43](https://github.com/yettoapp/ariadne/tree/v0.0.43) (2023-05-02)
|
4
17
|
|
5
18
|
[Full Changelog](https://github.com/yettoapp/ariadne/compare/v0.0.42...v0.0.43)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ariadne
|
4
|
+
module ActionViewExtensions
|
5
|
+
# :nodoc:
|
6
|
+
module FormHelper
|
7
|
+
include ClassNameHelper
|
8
|
+
|
9
|
+
DEFAULT_FORM_CLASSES = "ariadne-space-y-8 sm:ariadne-space-y-5"
|
10
|
+
def ariadne_form_with(model: nil, scope: nil, url: nil, format: nil, classes: "", attributes: {}, **options, &block)
|
11
|
+
options[:class] = merge_class_names(DEFAULT_FORM_CLASSES, options[:class])
|
12
|
+
options[:builder] ||= Ariadne::FormBuilder
|
13
|
+
options[:html] = attributes
|
14
|
+
|
15
|
+
data_controller = options[:html].fetch(:"data-controller", "")
|
16
|
+
options[:html][:"data-controller"] = if data_controller.present?
|
17
|
+
"#{data_controller} ariadne-form"
|
18
|
+
else
|
19
|
+
"ariadne-form"
|
20
|
+
end
|
21
|
+
|
22
|
+
form_with(model: model, scope: scope, url: url, format: format, **options, &block)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
ActiveSupport.on_load(:action_view) do
|
29
|
+
include Ariadne::ActionViewExtensions::FormHelper
|
30
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Ariadne
|
6
|
+
# :nodoc:
|
7
|
+
module Audited
|
8
|
+
# DSL to register when a component has passed an accessibility audit.
|
9
|
+
#
|
10
|
+
# Example:
|
11
|
+
#
|
12
|
+
# class MyComponent < ViewComponent::Base
|
13
|
+
# include Ariadne::Audited::Dsl
|
14
|
+
# audited_at 'YYYY-MM-DD'
|
15
|
+
# end
|
16
|
+
module Dsl
|
17
|
+
extend ActiveSupport::Concern
|
18
|
+
|
19
|
+
included do
|
20
|
+
class_attribute :audit_date, instance_writer: false
|
21
|
+
end
|
22
|
+
|
23
|
+
class_methods do
|
24
|
+
def audited_at(date = nil)
|
25
|
+
return audit_date if date.nil?
|
26
|
+
|
27
|
+
self.audit_date = date
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Helps build a list of conditional class names
|
4
|
+
module Ariadne
|
5
|
+
# :nodoc:
|
6
|
+
module ClassNameHelper
|
7
|
+
def merge_class_names(*args)
|
8
|
+
[].tap do |classes|
|
9
|
+
args.each do |class_name|
|
10
|
+
next if class_name.blank?
|
11
|
+
|
12
|
+
case class_name
|
13
|
+
when String
|
14
|
+
classes << class_name
|
15
|
+
else
|
16
|
+
raise ArgumentError, "Expected String class name, got #{class_name.class}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end.join(" ")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Ariadne::FetchOrFallbackHelper
|
4
|
+
# A little helper to enable graceful fallbacks
|
5
|
+
#
|
6
|
+
# Use this helper to quietly ensure a value is
|
7
|
+
# one that you expect:
|
8
|
+
#
|
9
|
+
# allowed_values - allowed options for *value*
|
10
|
+
# given_value - input being coerced
|
11
|
+
# fallback - returned if *given_value* is not included in *allowed_values*
|
12
|
+
#
|
13
|
+
# fetch_or_raise([1,2,3], 5) => 2
|
14
|
+
# fetch_or_raise([1,2,3], 1) => 1
|
15
|
+
# fetch_or_raise([1,2,3], nil) => 2
|
16
|
+
module Ariadne
|
17
|
+
# :nodoc:
|
18
|
+
module FetchOrFallbackHelper
|
19
|
+
include LoggerHelper
|
20
|
+
|
21
|
+
mattr_accessor :fallback_raises, default: true
|
22
|
+
|
23
|
+
InvalidValueError = Class.new(StandardError)
|
24
|
+
|
25
|
+
TRUE_OR_FALSE = Set.new([true, false]).freeze
|
26
|
+
|
27
|
+
INTEGER_TYPES = Set.new(["Integer"]).freeze
|
28
|
+
|
29
|
+
def fetch_or_raise(allowed_values, given_value, against: nil)
|
30
|
+
if !allowed_values.is_a?(Array) && !allowed_values.is_a?(Set)
|
31
|
+
raise ArgumentError, "allowed_values must be an array or a set; it was #{allowed_values.class}"
|
32
|
+
end
|
33
|
+
|
34
|
+
check_against_given_value = against || given_value
|
35
|
+
if allowed_values.include?(check_against_given_value)
|
36
|
+
given_value
|
37
|
+
else
|
38
|
+
raise InvalidValueError, <<~MSG
|
39
|
+
fetch_or_raise was called with an invalid value.
|
40
|
+
|
41
|
+
Expected one of: #{allowed_values.inspect}
|
42
|
+
Got: #{given_value.inspect}
|
43
|
+
MSG
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# TODO: use these two more
|
48
|
+
def fetch_or_raise_boolean(given_value)
|
49
|
+
fetch_or_raise(TRUE_OR_FALSE, given_value)
|
50
|
+
end
|
51
|
+
|
52
|
+
def fetch_or_raise_integer(given_value)
|
53
|
+
fetch_or_raise(INTEGER_TYPES, given_value, against: given_value.class.name)
|
54
|
+
end
|
55
|
+
|
56
|
+
# TODO: test this
|
57
|
+
def check_incoming_tag(preferred_tag, given_tag)
|
58
|
+
return preferred_tag if given_tag.blank? || preferred_tag == given_tag
|
59
|
+
|
60
|
+
unless silence_warnings?
|
61
|
+
message = <<~MSG
|
62
|
+
Ariadne: note that `#{preferred_tag}` is the preferred tag here;
|
63
|
+
you passed `#{given_tag}` (which will still be used)
|
64
|
+
MSG
|
65
|
+
|
66
|
+
logger.warn(message)
|
67
|
+
end
|
68
|
+
|
69
|
+
given_tag
|
70
|
+
end
|
71
|
+
|
72
|
+
# TODO: test this
|
73
|
+
def check_incoming_attribute(preferred_attribute, given_attribute)
|
74
|
+
return preferred_attribute if given_attribute.blank? || preferred_attribute != given_attribute
|
75
|
+
|
76
|
+
unless silence_warnings?
|
77
|
+
message = <<~MSG
|
78
|
+
Ariadne: note that `#{preferred_attribute}` is the preferred attribute here;
|
79
|
+
you passed `#{given_attribute}` (which will still be used)
|
80
|
+
MSG
|
81
|
+
|
82
|
+
logger.warn(message)
|
83
|
+
end
|
84
|
+
|
85
|
+
given_attribute
|
86
|
+
end
|
87
|
+
|
88
|
+
# TODO: test this
|
89
|
+
def check_incoming_value(preferred_value, given_pair)
|
90
|
+
return preferred_value if given_pair.blank? || !given_pair.is_a?(Hash)
|
91
|
+
|
92
|
+
given_key = given_pair.keys.first
|
93
|
+
given_value = given_pair.values.first
|
94
|
+
|
95
|
+
return preferred_value if given_value.blank?
|
96
|
+
|
97
|
+
unless silence_warnings?
|
98
|
+
|
99
|
+
message = <<~MSG
|
100
|
+
Ariadne: note that `#{preferred_value}` is the preferred value for `#{given_key}` here;
|
101
|
+
you passed `#{given_value}` (which will still be used)
|
102
|
+
MSG
|
103
|
+
|
104
|
+
logger.warn(message)
|
105
|
+
end
|
106
|
+
|
107
|
+
given_value
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ariadne
|
4
|
+
# :nodoc:
|
5
|
+
# Many of the form methods simply call out to the corresponding ActionView::Helpers::FormBuilder methods,
|
6
|
+
# documented at https://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html, with
|
7
|
+
# default Tailwind classes applied.
|
8
|
+
class FormBuilder < ActionView::Helpers::FormBuilder
|
9
|
+
include ClassNameHelper
|
10
|
+
|
11
|
+
DEFAULT_SECTION_CLASSES = "ariadne-space-y-6 ariadne-px-4"
|
12
|
+
def section(classes: "", attributes: {}, &block)
|
13
|
+
actual_classes = merge_class_names(DEFAULT_SECTION_CLASSES, classes)
|
14
|
+
options = { class: actual_classes, **attributes }
|
15
|
+
@template.content_tag(:div, **options, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
DEFAULT_SECTION_HEADING_CLASSES = "ariadne-text-lg ariadne-leading-6 ariadne-py-4 ariadne-font-medium ariadne-text-gray-900"
|
19
|
+
def heading(tag: :h3, classes: "", attributes: {}, &block)
|
20
|
+
actual_classes = merge_class_names(DEFAULT_SECTION_HEADING_CLASSES, classes)
|
21
|
+
options = { class: actual_classes, **attributes }
|
22
|
+
@template.content_tag(tag, **options, &block)
|
23
|
+
end
|
24
|
+
|
25
|
+
DEFAULT_SECTION_SUBHEADING_CLASSES = "ariadne-mt-1 ariadne-max-w-2xl ariadne-text-sm ariadne-text-gray-500"
|
26
|
+
def subheading(classes: "", attributes: {}, &block)
|
27
|
+
actual_classes = merge_class_names(DEFAULT_SECTION_SUBHEADING_CLASSES, classes)
|
28
|
+
options = { class: actual_classes, **attributes }
|
29
|
+
@template.content_tag(:p, **options, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
DEFAULT_LABEL_CLASSES = "ariadne-block ariadne-text-sm ariadne-font-medium ariadne-text-gray-700 ariadne-pl-2"
|
33
|
+
def label(method, text = nil, options = {}, &block)
|
34
|
+
options[:class] = merge_class_names(DEFAULT_LABEL_CLASSES, options.delete(:classes))
|
35
|
+
super(method, text, options, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
DEFAULT_TEXT_CLASSES = "ariadne-shadow-sm focus:ariadne-ring-slate-500 focus:ariadne-border-slate-500 ariadne-block ariadne-w-full sm:ariadne-text-sm ariadne-border-gray-300 ariadne-rounded-md"
|
39
|
+
def text_field(method, options = {})
|
40
|
+
options[:class] = merge_class_names(DEFAULT_TEXT_CLASSES, options.delete(:classes))
|
41
|
+
super(method, **options)
|
42
|
+
end
|
43
|
+
|
44
|
+
DEFAULT_CHECKBOX_CLASSES = "focus:ariadne-ring-slate-500 ariadne-h-4 ariadne-w-4 ariadne-text-slate-600 ariadne-border-slate-300 ariadne-rounded"
|
45
|
+
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
46
|
+
options[:class] = merge_class_names(DEFAULT_CHECKBOX_CLASSES, options.delete(:classes))
|
47
|
+
super(method, options, checked_value, unchecked_value)
|
48
|
+
end
|
49
|
+
|
50
|
+
DEFAULT_RADIO_CLASSES = "focus:ariadne-ring-slate-500 ariadne-h-4 ariadne-w-4 ariadne-text-slate-600 ariadne-border-gray-300 ariadne-rounded"
|
51
|
+
def radio_button(method, tag_value, options = {})
|
52
|
+
options[:class] = merge_class_names(DEFAULT_RADIO_CLASSES, options.delete(:classes))
|
53
|
+
super(method, tag_value, **options)
|
54
|
+
end
|
55
|
+
|
56
|
+
DEFAULT_TEXTAREA_CLASSES = "ariadne-shadow-sm focus:ariadne-ring-slate-500 focus:ariadne-border-slate-500 ariadne-block ariadne-w-full sm:ariadne-text-sm ariadne-border ariadne-border-gray-300 ariadne-rounded-md"
|
57
|
+
def text_area(method, options = {})
|
58
|
+
options[:class] = merge_class_names(DEFAULT_TEXTAREA_CLASSES, options.delete(:classes))
|
59
|
+
super(method, **options)
|
60
|
+
end
|
61
|
+
|
62
|
+
DEFAULT_EMAIL_CLASSES = "ariadne-shadow-sm focus:ariadne-ring-slate-500 focus:ariadne-border-slate-500 ariadne-block ariadne-w-full sm:ariadne-text-sm ariadne-border-gray-300 ariadne-rounded-md"
|
63
|
+
def email_field(method, options = {})
|
64
|
+
options[:class] = merge_class_names(DEFAULT_EMAIL_CLASSES, options.delete(:classes))
|
65
|
+
super(method, **options)
|
66
|
+
end
|
67
|
+
|
68
|
+
DEFAULT_PASSWORD_CLASSES = "ariadne-appearance-none ariadne-block ariadne-w-full ariadne-px-3 ariadne-py-2 ariadne-border ariadne-border-gray-300 ariadne-rounded-md ariadne-shadow-sm ariadne-placeholder-gray-400 focus:ariadne-outline-none focus:ariadne-ring-slate-500 focus:ariadne-border-slate-500 sm:ariadne-text-sm"
|
69
|
+
def password_field(method, options = {})
|
70
|
+
options[:class] = merge_class_names(DEFAULT_PASSWORD_CLASSES, options.delete(:classes))
|
71
|
+
super(method, **options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Ariadne::IconHelper
|
4
|
+
# A helper that insists on certain values when
|
5
|
+
# checking herocions and their varients.
|
6
|
+
#
|
7
|
+
# Use this helper to loudly ensure a value is
|
8
|
+
# one that you expect.
|
9
|
+
module Ariadne
|
10
|
+
# :nodoc:
|
11
|
+
module IconHelper
|
12
|
+
include FetchOrFallbackHelper
|
13
|
+
|
14
|
+
def check_icon_presence!(icon, variant)
|
15
|
+
return true unless has_partial_icon?(icon, variant)
|
16
|
+
|
17
|
+
icon_presence!(icon, variant)
|
18
|
+
variant_presence!(icon, variant)
|
19
|
+
ensure_valid_variant(variant)
|
20
|
+
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
def ensure_valid_variant(variant)
|
25
|
+
check_variant = if variant.blank? || !variant.respond_to?(:to_s)
|
26
|
+
""
|
27
|
+
else
|
28
|
+
variant.to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
fetch_or_raise(HeroiconsHelper::Icon::VALID_VARIANTS, check_variant)
|
32
|
+
end
|
33
|
+
module_function :ensure_valid_variant
|
34
|
+
|
35
|
+
def has_partial_icon?(icon, variant)
|
36
|
+
icon.present? || variant.present?
|
37
|
+
end
|
38
|
+
|
39
|
+
def icon_presence!(icon, variant)
|
40
|
+
raise(ArgumentError, "You must provide an `icon` when providing a `variant`.") if icon.blank? && variant.present?
|
41
|
+
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
def variant_presence!(icon, variant)
|
46
|
+
raise(ArgumentError, "You must provide a `variant` when providing an `icon`.") if icon.present? && variant.blank?
|
47
|
+
|
48
|
+
true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ariadne
|
4
|
+
# :nodoc:
|
5
|
+
module LoggerHelper
|
6
|
+
def logger
|
7
|
+
return Rails.logger if defined?(Rails) && Rails.logger
|
8
|
+
|
9
|
+
require "logger"
|
10
|
+
Logger.new($stderr)
|
11
|
+
end
|
12
|
+
|
13
|
+
# TODO: test
|
14
|
+
def silence_deprecations?
|
15
|
+
Rails.application.config.ariadne_view_components.silence_deprecations
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO: test
|
19
|
+
def silence_warnings?
|
20
|
+
Rails.application.config.ariadne_view_components.silence_warnings
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Ariadne
|
6
|
+
# :nodoc:
|
7
|
+
module Status
|
8
|
+
# DSL to allow components to register their status.
|
9
|
+
#
|
10
|
+
# Example:
|
11
|
+
#
|
12
|
+
# class MyComponent < ViewComponent::Base
|
13
|
+
# include Ariadne::Status::Dsl
|
14
|
+
# status :experimental
|
15
|
+
# end
|
16
|
+
module Dsl
|
17
|
+
extend ActiveSupport::Concern
|
18
|
+
|
19
|
+
STATUSES = {
|
20
|
+
experimental: :experimental,
|
21
|
+
stable: :stable,
|
22
|
+
}.freeze
|
23
|
+
|
24
|
+
class UnknownStatusError < StandardError; end
|
25
|
+
|
26
|
+
included do
|
27
|
+
class_attribute :component_status, instance_writer: false, default: STATUSES[:stable]
|
28
|
+
end
|
29
|
+
|
30
|
+
class_methods do
|
31
|
+
def status(status = nil)
|
32
|
+
return component_status if status.nil?
|
33
|
+
|
34
|
+
raise UnknownStatusError, "status #{status} does not exist" if STATUSES[status].nil?
|
35
|
+
|
36
|
+
self.component_status = STATUSES[status]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# :nocov:
|
4
|
+
module Ariadne
|
5
|
+
# Module to allow shorthand calls for Ariadne components
|
6
|
+
module ViewHelper
|
7
|
+
class ViewHelperNotFound < StandardError; end
|
8
|
+
|
9
|
+
HELPERS = {
|
10
|
+
heroicon: "Ariadne::HeroiconComponent",
|
11
|
+
heading: "Ariadne::HeadingComponent",
|
12
|
+
time_ago: "Ariadne::TimeAgoComponent",
|
13
|
+
image: "Ariadne::ImageComponent",
|
14
|
+
}.freeze
|
15
|
+
|
16
|
+
HELPERS.each do |name, component|
|
17
|
+
define_method "ariadne_#{name}" do |*args, **kwargs, &block|
|
18
|
+
render component.constantize.new(*args, **kwargs), &block
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ariadne_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.46
|
5
5
|
platform: x64-mingw-ucrt
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
@@ -222,6 +222,15 @@ files:
|
|
222
222
|
- app/components/ariadne/tooltip_component/tooltip-component.js
|
223
223
|
- app/components/ariadne/tooltip_component/tooltip-component.ts
|
224
224
|
- app/components/ariadne/tooltip_component/tooltip_component.html.erb
|
225
|
+
- app/lib/ariadne/action_view_extensions/form_helper.rb
|
226
|
+
- app/lib/ariadne/audited/dsl.rb
|
227
|
+
- app/lib/ariadne/class_name_helper.rb
|
228
|
+
- app/lib/ariadne/fetch_or_fallback_helper.rb
|
229
|
+
- app/lib/ariadne/form_builder.rb
|
230
|
+
- app/lib/ariadne/icon_helper.rb
|
231
|
+
- app/lib/ariadne/logger_helper.rb
|
232
|
+
- app/lib/ariadne/status/dsl.rb
|
233
|
+
- app/lib/ariadne/view_helper.rb
|
225
234
|
- config/importmap.rb
|
226
235
|
- exe/tailwindcss
|
227
236
|
- exe/x64-mingw-ucrt/tailwindcss
|
@@ -241,17 +250,6 @@ files:
|
|
241
250
|
- lib/rubocop/cop/ariadne.rb
|
242
251
|
- lib/rubocop/cop/ariadne/base_cop.rb
|
243
252
|
- lib/rubocop/cop/ariadne/no_tag_memoize.rb
|
244
|
-
- lib/tasks/ariadne_view_components.rake
|
245
|
-
- lib/tasks/build.rake
|
246
|
-
- lib/tasks/coverage.rake
|
247
|
-
- lib/tasks/docs.rake
|
248
|
-
- lib/tasks/helpers/ast_processor.rb
|
249
|
-
- lib/tasks/helpers/ast_traverser.rb
|
250
|
-
- lib/tasks/static.rake
|
251
|
-
- lib/tasks/test.rake
|
252
|
-
- lib/yard/docs_helper.rb
|
253
|
-
- lib/yard/renders_many_handler.rb
|
254
|
-
- lib/yard/renders_one_handler.rb
|
255
253
|
- static/arguments.yml
|
256
254
|
- static/assets/view-components.svg
|
257
255
|
- static/audited_at.json
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
ERB_GLOB = "**/*.html{+*,}.erb"
|
4
|
-
RB_GLOB = "**/*.rb"
|
5
|
-
# copied from Rails: action_view/template/handlers/erb/erubi.rb
|
6
|
-
BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
|
7
|
-
|
8
|
-
namespace :ariadne_view_components do
|
9
|
-
desc "Report arguments used in each component"
|
10
|
-
task :report, [:paths] do |_, args|
|
11
|
-
require "rubocop"
|
12
|
-
require "better_html"
|
13
|
-
require "better_html/parser"
|
14
|
-
require "erb_lint/processed_source"
|
15
|
-
require_relative "helpers/ast_processor"
|
16
|
-
|
17
|
-
paths = args[:paths].split
|
18
|
-
stats = {}
|
19
|
-
|
20
|
-
rb_files = paths.reduce([]) { |mem, path| mem + Dir[File.join(path, RB_GLOB)] }
|
21
|
-
|
22
|
-
rb_files.each do |f|
|
23
|
-
ast = RuboCop::AST::ProcessedSource.from_file(f, RUBY_VERSION.to_f).ast
|
24
|
-
AstProcessor.process_ast(ast, stats)
|
25
|
-
end
|
26
|
-
|
27
|
-
erb_files = paths.reduce([]) { |mem, path| mem + Dir[File.join(path, ERB_GLOB)] }
|
28
|
-
|
29
|
-
erb_files.each do |f|
|
30
|
-
erb_ast = ERBLint::ProcessedSource.new(f, File.read(f)).ast
|
31
|
-
|
32
|
-
erb_ast.descendants(:erb).each do |erb_node|
|
33
|
-
indicator, _, code_node, = *erb_node
|
34
|
-
|
35
|
-
next if indicator&.children&.first == "#" # don't analyze comments
|
36
|
-
|
37
|
-
trimmed_source = code_node.loc.source.sub(BLOCK_EXPR, "").strip
|
38
|
-
ast = RuboCop::AST::ProcessedSource.new(trimmed_source, RUBY_VERSION.to_f).ast
|
39
|
-
AstProcessor.process_ast(ast, stats)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
File.open(".ariadne-view-components-report.json", "w") do |f|
|
44
|
-
f.write(JSON.pretty_generate(stats))
|
45
|
-
f.write($INPUT_RECORD_SEPARATOR)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/lib/tasks/build.rake
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "ariadne/view_components/commands"
|
4
|
-
|
5
|
-
namespace :ariadne_view_components do
|
6
|
-
desc "Build Ariadne View Components CSS"
|
7
|
-
task :build do |_, args|
|
8
|
-
debug = args.extras.include?("debug")
|
9
|
-
command = Ariadne::ViewComponents::Commands.compile_command(debug: debug)
|
10
|
-
puts command.inspect
|
11
|
-
system(*command, exception: true)
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "Watch and build Ariadne View Components CSS on file changes"
|
15
|
-
task :watch do |_, args|
|
16
|
-
debug = args.extras.include?("debug")
|
17
|
-
poll = args.extras.include?("poll")
|
18
|
-
command = Ariadne::ViewComponents::Commands.watch_command(debug: debug, poll: poll)
|
19
|
-
puts command.inspect
|
20
|
-
system(*command)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
Rake::Task["assets:precompile"].enhance(["ariadne_view_components:build"]) if Rake::Task.task_defined?("assets:precompile")
|
25
|
-
|
26
|
-
if Rake::Task.task_defined?("test:prepare")
|
27
|
-
Rake::Task["test:prepare"].enhance(["ariadne_view_components:build"])
|
28
|
-
elsif Rake::Task.task_defined?("db:test:prepare")
|
29
|
-
Rake::Task["db:test:prepare"].enhance(["ariadne_view_components:build"])
|
30
|
-
end
|
data/lib/tasks/coverage.rake
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
namespace :coverage do
|
4
|
-
desc "Run coverage report. This should ideally be done only on CI."
|
5
|
-
task :report do
|
6
|
-
require "simplecov"
|
7
|
-
require "simplecov-console"
|
8
|
-
|
9
|
-
SimpleCov.collate(Dir["coverage/.resultset.json"], "rails") do
|
10
|
-
formatter SimpleCov::Formatter::Console
|
11
|
-
|
12
|
-
minimum_coverage 100
|
13
|
-
maximum_coverage_drop 2
|
14
|
-
|
15
|
-
add_group "Ignored Code" do |src_file|
|
16
|
-
File.readlines(src_file.filename).grep(/:nocov:/).any?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|