phlex-rails 1.2.1 → 2.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/phlex/component/USAGE +2 -2
  3. data/lib/generators/phlex/component/component_generator.rb +1 -1
  4. data/lib/generators/phlex/component/templates/component.rb.erb +2 -3
  5. data/lib/generators/phlex/install/USAGE +3 -1
  6. data/lib/generators/phlex/install/install_generator.rb +28 -38
  7. data/lib/generators/phlex/install/templates/base_component.rb.erb +15 -0
  8. data/lib/generators/phlex/install/templates/base_view.rb.erb +9 -0
  9. data/lib/generators/phlex/install/templates/phlex.rb.erb +16 -0
  10. data/lib/generators/phlex/view/USAGE +1 -1
  11. data/lib/generators/phlex/view/templates/view.rb.erb +2 -3
  12. data/lib/generators/phlex/view/view_generator.rb +1 -1
  13. data/lib/phlex/rails/buffered.rb +6 -7
  14. data/lib/phlex/rails/csv.rb +3 -3
  15. data/lib/phlex/rails/engine.rb +0 -1
  16. data/lib/phlex/rails/{html/method_missing.rb → helper_finder.rb} +2 -2
  17. data/lib/phlex/rails/helper_macros.rb +2 -12
  18. data/lib/phlex/rails/helpers/notice.rb +8 -0
  19. data/lib/phlex/rails/helpers/routes.rb +1 -0
  20. data/lib/phlex/rails/helpers/tag.rb +2 -2
  21. data/lib/phlex/rails/helpers/translate.rb +2 -2
  22. data/lib/phlex/rails/helpers/turbo_stream.rb +1 -1
  23. data/lib/phlex/rails/helpers.rb +11 -56
  24. data/lib/phlex/rails/html.rb +0 -2
  25. data/lib/phlex/rails/layout.rb +7 -7
  26. data/lib/phlex/rails/sgml.rb +35 -53
  27. data/lib/phlex/rails/streaming.rb +11 -9
  28. data/lib/phlex/rails/testing.rb +18 -0
  29. data/lib/phlex/rails/unbuffered.rb +50 -0
  30. data/lib/phlex/rails/version.rb +1 -1
  31. data/lib/phlex/rails.rb +6 -7
  32. metadata +16 -26
  33. data/.editorconfig +0 -13
  34. data/.rubocop.yml +0 -15
  35. data/.ruby-version +0 -1
  36. data/.yardopts +0 -1
  37. data/Appraisals +0 -11
  38. data/CHANGELOG.md +0 -38
  39. data/CODE_OF_CONDUCT.md +0 -84
  40. data/Gemfile +0 -17
  41. data/SECURITY.md +0 -5
  42. data/config.ru +0 -9
  43. data/lib/generators/phlex/install/templates/application_component.rb +0 -12
  44. data/lib/generators/phlex/install/templates/application_layout.rb +0 -24
  45. data/lib/generators/phlex/install/templates/application_view.rb +0 -9
  46. data/lib/phlex/rails/unbuffered_overrides.rb +0 -30
  47. data/lib/phlex/testing/rails/view_helper.rb +0 -19
  48. data/phlex_logo.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93b219be78b50160aa9712bfec6ff25b59c33f512087cda4ee027a1f0f39ff05
4
- data.tar.gz: 55c366bb60dc4f5bb343317e9c948642fb5121d9e3ec65372392c2b5a751fe81
3
+ metadata.gz: 884bb8de02703c59d0756050a402a853af780a4c9bc37805483d3446b17acdb2
4
+ data.tar.gz: de4bd44c31da7580ec9c158d1d004b03c3be89b419b78abc5c6eb9b67b97e1c0
5
5
  SHA512:
6
- metadata.gz: 65519c2590bff066155afb33418089c948a4fb7dbdceb9cdfbaac5a2d88a4fa2a86432b19ba9b6f42af8578d84e7469bde1cd66137f572ca84d691031f91de27
7
- data.tar.gz: cc3773ccad8dc3bfcc4a3267cc1c78189560e93d0bff31e1930d4cafb036724483f17e4923dc13acbcf3d50b2baa7d92da7f6f694205066bfc3860668983c5bc
6
+ metadata.gz: 20f911fd5441cbca7281b63c94b4d1f3ef8b604c88550b5e0b1c4889eab9286f827430a7e05cd35b3be8c49d9d0679f781c33ee8d0e7a6d8bdfbf3676d3a54bd
7
+ data.tar.gz: 0a096db9f03bc6164b5cf951128a2b751d2de052588aea26f1a8c82a36d125798c198fbd32b06ebce2e0b6c65c52158f8d17e0d61586408307cd98808266e84b
@@ -1,8 +1,8 @@
1
1
  Description:
2
- Generates a Phlex component with the given name
2
+ Generates a new Phlex component
3
3
 
4
4
  Example:
5
5
  rails generate phlex:component Sidebar
6
6
 
7
7
  This will create:
8
- app/views/components/sidebar_component.rb
8
+ app/components/sidebar.rb
@@ -5,7 +5,7 @@ module Phlex::Generators
5
5
  source_root File.expand_path("templates", __dir__)
6
6
 
7
7
  def create_view
8
- @path = File.join("app/views/components", class_path, "#{file_name}_component.rb")
8
+ @path = File.join("app/components", class_path, "#{file_name}.rb")
9
9
  template "component.rb.erb", @path
10
10
  end
11
11
  end
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- <% module_namespacing do -%>
4
- class <%= class_name %>Component < ApplicationComponent
3
+ class Components::<%= class_name %> < Components::Base
5
4
  def view_template
6
5
  h1 { "<%= class_name %>" }
7
6
  p { "Find me in <%= @path %>" }
8
7
  end
9
- end<% end %>
8
+ end
@@ -5,4 +5,6 @@ Example:
5
5
  rails generate phlex:install
6
6
 
7
7
  This will create:
8
- app/views/application_view.rb
8
+ app/views/base.rb
9
+ app/components/base.rb
10
+ app/initializers/phlex.rb
@@ -5,56 +5,46 @@ module Phlex::Generators
5
5
  source_root File.expand_path("templates", __dir__)
6
6
 
7
7
  APPLICATION_CONFIGURATION_PATH = Rails.root.join("config/application.rb")
8
- TAILWIND_CONFIGURATION_PATH = Rails.root.join("tailwind.config.js")
9
8
 
10
- def autoload_components
11
- return unless APPLICATION_CONFIGURATION_PATH.exist?
12
-
13
- inject_into_class(
14
- APPLICATION_CONFIGURATION_PATH,
15
- "Application",
16
- %( config.autoload_paths << "\#{root}/app/views/components"\n)
17
- )
9
+ def configure_tailwind
10
+ if tailwind_configuration_path
11
+ insert_into_file tailwind_configuration_path, after: "content: [" do
12
+ "\n './app/views/**/*.rb', // Phlex views" \
13
+ "\n './app/components/**/*.rb', // Phlex components" \
14
+ end
15
+ end
18
16
  end
19
17
 
20
- def autoload_layouts
21
- return unless APPLICATION_CONFIGURATION_PATH.exist?
22
-
23
- inject_into_class(
24
- APPLICATION_CONFIGURATION_PATH,
25
- "Application",
26
- %( config.autoload_paths << "\#{root}/app/views/layouts"\n)
27
- )
18
+ def create_application_component
19
+ template "base_component.rb.erb", Rails.root.join("app/components/base.rb")
28
20
  end
29
21
 
30
- def autoload_views
31
- return unless APPLICATION_CONFIGURATION_PATH.exist?
32
-
33
- inject_into_class(
34
- APPLICATION_CONFIGURATION_PATH,
35
- "Application",
36
- %( config.autoload_paths << "\#{root}/app/views"\n)
37
- )
22
+ def create_application_view
23
+ template "base_view.rb.erb", Rails.root.join("app/views/base.rb")
38
24
  end
39
25
 
40
- def configure_tailwind
41
- return unless TAILWIND_CONFIGURATION_PATH.exist?
42
-
43
- insert_into_file TAILWIND_CONFIGURATION_PATH, after: "content: [" do
44
- "\n './app/views/**/*.rb'," \
45
- end
26
+ def create_initializer
27
+ template "phlex.rb.erb", Rails.root.join("config/initializers/phlex.rb")
46
28
  end
47
29
 
48
- def create_application_component
49
- template "application_component.rb", Rails.root.join("app/views/components/application_component.rb")
50
- end
30
+ private
51
31
 
52
- def create_application_layout
53
- template "application_layout.rb", Rails.root.join("app/views/layouts/application_layout.rb")
32
+ def tailwind_configuration_path
33
+ if tailwind_configuration_files.any?
34
+ Pathname.new(
35
+ tailwind_configuration_files.first,
36
+ )
37
+ end
54
38
  end
55
39
 
56
- def create_application_view
57
- template "application_view.rb", Rails.root.join("app/views/application_view.rb")
40
+ def tailwind_configuration_files
41
+ Dir.glob(
42
+ [
43
+ "#{Rails.root}/tailwind.config.js",
44
+ "#{Rails.root}/app/**/tailwind.config.js",
45
+ "#{Rails.root}/config/**/tailwind.config.js",
46
+ ],
47
+ )
58
48
  end
59
49
  end
60
50
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Components::Base < Phlex::HTML
4
+ include Components
5
+
6
+ # Include any helpers you want to be available across all components
7
+ include Phlex::Rails::Helpers::Routes
8
+
9
+ if Rails.env.development?
10
+ def before_template
11
+ comment { "Before #{self.class.name}" }
12
+ super
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Views::Base < Components::Base
4
+ # The ApplicationView is an abstract class for all your views.
5
+
6
+ # By default, it inherits from `ApplicationComponent`, but you
7
+ # can change that to `Phlex::HTML` if you want to keep views and
8
+ # components independent.
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Views
4
+ end
5
+
6
+ module Components
7
+ extend Phlex::Kit
8
+ end
9
+
10
+ Rails.autoloaders.main.push_dir(
11
+ "#{Rails.root}/app/views", namespace: Views
12
+ )
13
+
14
+ Rails.autoloaders.main.push_dir(
15
+ "#{Rails.root}/app/components", namespace: Components
16
+ )
@@ -5,4 +5,4 @@ Example:
5
5
  rails generate phlex:view Articles::Index
6
6
 
7
7
  This will create:
8
- app/views/articles/index_view.rb
8
+ app/views/articles/index.rb
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- <% module_namespacing do -%>
4
- class <%= class_name %>View < ApplicationView
3
+ class Views::<%= "#{namespace}::" if namespaced? %><%= class_name %> < Views::Base
5
4
  def view_template
6
5
  h1 { "<%= class_name %>" }
7
6
  p { "Find me in <%= @path %>" }
8
7
  end
9
- end<% end %>
8
+ end
@@ -5,7 +5,7 @@ module Phlex::Generators
5
5
  source_root File.expand_path("templates", __dir__)
6
6
 
7
7
  def create_view
8
- @path = File.join("app/views", class_path, "#{file_name}_view.rb")
8
+ @path = File.join("app/views", class_path, "#{file_name}.rb")
9
9
  template "view.rb.erb", @path
10
10
  end
11
11
  end
@@ -30,7 +30,7 @@ module Phlex::Rails
30
30
 
31
31
  case output
32
32
  when ::ActiveSupport::SafeBuffer
33
- @view.instance_variable_get(:@_context).target << output
33
+ @view.instance_variable_get(:@_context).buffer << output
34
34
  end
35
35
 
36
36
  nil
@@ -48,16 +48,15 @@ module Phlex::Rails
48
48
  @object.respond_to?(...)
49
49
  end
50
50
 
51
- def method_missing(*args, **kwargs, &block)
51
+ def method_missing(*, **, &block)
52
52
  output = if block
53
- @object.public_send(*args, **kwargs) { @view.capture(&block) }
53
+ @object.public_send(*, **) { |*a| @view.capture(*a, &block) }
54
54
  else
55
- @object.public_send(*args, **kwargs)
55
+ @object.public_send(*, **)
56
56
  end
57
57
 
58
- case output
59
- when ::ActiveSupport::SafeBuffer
60
- @view.instance_variable_get(:@_context).target << output
58
+ if ::ActiveSupport::SafeBuffer === output
59
+ @view.instance_variable_get(:@_context).buffer << output
61
60
  end
62
61
 
63
62
  nil
@@ -4,11 +4,11 @@ module Phlex
4
4
  module Rails
5
5
  module CSV
6
6
  module Overrides
7
- def each_item(&block)
8
- return super unless collection.is_a?(ActiveRecord::Relation)
7
+ def each_item(&)
8
+ return super unless ActiveRecord::Relation === collection
9
9
  return super unless collection.arel.orders.empty?
10
10
 
11
- collection.find_each(&block)
11
+ collection.find_each(&)
12
12
  end
13
13
  end
14
14
  end
@@ -4,7 +4,6 @@ require "rails/engine"
4
4
 
5
5
  module Phlex
6
6
  module Rails
7
- # @api private
8
7
  class Engine < ::Rails::Engine
9
8
  end
10
9
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Phlex::Rails::HTML::MethodMissing
3
+ module Phlex::Rails::HelperFinder
4
4
  def method_missing(name, *args, **kwargs, &block)
5
5
  return super unless helpers.respond_to?(name)
6
6
 
@@ -8,6 +8,6 @@ module Phlex::Rails::HTML::MethodMissing
8
8
  module_name = Phlex::Rails::Helpers.constants.find { |mod| mod.to_s.underscore.gsub("domid", "dom_id") == const_name }
9
9
  return super unless module_name
10
10
 
11
- raise NoMethodError, "Try including `Phlex::Rails::Helpers::#{module_name}` in #{self.class.name}."
11
+ raise NoMethodError.new("Try including `Phlex::Rails::Helpers::#{module_name}` in #{self.class.name}.")
12
12
  end
13
13
  end
@@ -16,12 +16,7 @@ module Phlex::Rails::HelperMacros
16
16
  helpers.#{method_name}(*args, **kwargs)
17
17
  end
18
18
 
19
- case output
20
- when ActiveSupport::SafeBuffer
21
- @_context.target << output
22
- end
23
-
24
- nil
19
+ raw(output)
25
20
  end
26
21
  RUBY
27
22
  end
@@ -63,12 +58,7 @@ module Phlex::Rails::HelperMacros
63
58
  helpers.#{method_name}(*args, **kwargs)
64
59
  end
65
60
 
66
- case output
67
- when ActiveSupport::SafeBuffer
68
- @_context.target << output
69
- end
70
-
71
- nil
61
+ raw(output)
72
62
  end
73
63
  RUBY
74
64
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Phlex::Rails::Helpers::Notice
4
+ extend Phlex::Rails::HelperMacros
5
+
6
+ # @!method notice(...)
7
+ register_value_helper :notice
8
+ end
@@ -5,6 +5,7 @@ module Phlex::Rails::Helpers
5
5
  module Routes
6
6
  # This must be included first because it defines `url_options` rather than delegating it to the view context.
7
7
  include Rails.application.routes.url_helpers
8
+ include Rails.application.routes.mounted_helpers
8
9
 
9
10
  include URLOptions
10
11
  include DefaultURLOptions
@@ -10,11 +10,11 @@ module Phlex::Rails::Helpers::Tag
10
10
 
11
11
  case result
12
12
  when ActiveSupport::SafeBuffer
13
- @_context.target << result
13
+ @_context.buffer << result
14
14
  when ActionView::Helpers::TagHelper::TagBuilder
15
15
  Phlex::Rails::Buffered.new(
16
16
  result,
17
- view: self
17
+ view: self,
18
18
  )
19
19
  end
20
20
  end
@@ -15,10 +15,10 @@ module Phlex::Rails::Helpers::Translate
15
15
  base.extend(ClassMethods)
16
16
  end
17
17
 
18
- def translate(key, **options)
18
+ def translate(key, **)
19
19
  key = "#{self.class.translation_path}#{key}" if key.start_with?(".")
20
20
 
21
- helpers.t(key, **options)
21
+ helpers.t(key, **)
22
22
  end
23
23
 
24
24
  alias_method :t, :translate
@@ -8,7 +8,7 @@ module Phlex::Rails::Helpers::TurboStream
8
8
  def turbo_stream(...)
9
9
  Phlex::Rails::Buffered.new(
10
10
  helpers.turbo_stream(...),
11
- view: self
11
+ view: self,
12
12
  )
13
13
  end
14
14
  end
@@ -12,8 +12,6 @@ module Phlex::Rails::Helpers
12
12
  autoload :BuildTagValues, "phlex/rails/helpers/build_tag_values"
13
13
  autoload :ButtonTag, "phlex/rails/helpers/button_tag"
14
14
  autoload :ButtonTo, "phlex/rails/helpers/button_to"
15
- autoload :CSPMetaTag, "phlex/rails/helpers/csp_meta_tag"
16
- autoload :CSRFMetaTags, "phlex/rails/helpers/csrf_meta_tags"
17
15
  autoload :CheckBox, "phlex/rails/helpers/check_box"
18
16
  autoload :CheckBoxTag, "phlex/rails/helpers/check_box_tag"
19
17
  autoload :ClassNames, "phlex/rails/helpers/class_names"
@@ -29,11 +27,11 @@ module Phlex::Rails::Helpers
29
27
  autoload :ContentTag, "phlex/rails/helpers/content_tag"
30
28
  autoload :ControllerName, "phlex/rails/helpers/controller_name"
31
29
  autoload :ControllerPath, "phlex/rails/helpers/controller_path"
30
+ autoload :CSPMetaTag, "phlex/rails/helpers/csp_meta_tag"
31
+ autoload :CSRFMetaTags, "phlex/rails/helpers/csrf_meta_tags"
32
32
  autoload :CurrentCycle, "phlex/rails/helpers/current_cycle"
33
33
  autoload :CurrentPage, "phlex/rails/helpers/current_page"
34
34
  autoload :Cycle, "phlex/rails/helpers/cycle"
35
- autoload :DOMClass, "phlex/rails/helpers/dom_class"
36
- autoload :DOMID, "phlex/rails/helpers/dom_id"
37
35
  autoload :DateField, "phlex/rails/helpers/date_field"
38
36
  autoload :DateFieldTag, "phlex/rails/helpers/date_field_tag"
39
37
  autoload :DateSelect, "phlex/rails/helpers/date_select"
@@ -46,6 +44,8 @@ module Phlex::Rails::Helpers
46
44
  autoload :DefaultURLOptions, "phlex/rails/helpers/default_url_options"
47
45
  autoload :DistanceOfTimeInWords, "phlex/rails/helpers/distance_of_time_in_words"
48
46
  autoload :DistanceOfTimeInWordsToNow, "phlex/rails/helpers/distance_of_time_in_words_to_now"
47
+ autoload :DOMClass, "phlex/rails/helpers/dom_class"
48
+ autoload :DOMID, "phlex/rails/helpers/dom_id"
49
49
  autoload :EmailField, "phlex/rails/helpers/email_field"
50
50
  autoload :EmailFieldTag, "phlex/rails/helpers/email_field_tag"
51
51
  autoload :ErrorMessage, "phlex/rails/helpers/error_message"
@@ -55,8 +55,8 @@ module Phlex::Rails::Helpers
55
55
  autoload :FaviconLinkTag, "phlex/rails/helpers/favicon_link_tag"
56
56
  autoload :FieldID, "phlex/rails/helpers/field_id"
57
57
  autoload :FieldName, "phlex/rails/helpers/field_name"
58
- autoload :FieldSetTag, "phlex/rails/helpers/field_set_tag"
59
58
  autoload :Fields, "phlex/rails/helpers/fields"
59
+ autoload :FieldSetTag, "phlex/rails/helpers/field_set_tag"
60
60
  autoload :FieldsFor, "phlex/rails/helpers/fields_for"
61
61
  autoload :FileField, "phlex/rails/helpers/file_field"
62
62
  autoload :FileFieldTag, "phlex/rails/helpers/file_field_tag"
@@ -75,8 +75,8 @@ module Phlex::Rails::Helpers
75
75
  autoload :ImageSubmitTag, "phlex/rails/helpers/image_submit_tag"
76
76
  autoload :ImageTag, "phlex/rails/helpers/image_tag"
77
77
  autoload :ImageURL, "phlex/rails/helpers/image_url"
78
- autoload :JavascriptImportModuleTag, "phlex/rails/helpers/javascript_import_module_tag"
79
78
  autoload :JavascriptImportmapTags, "phlex/rails/helpers/javascript_importmap_tags"
79
+ autoload :JavascriptImportModuleTag, "phlex/rails/helpers/javascript_import_module_tag"
80
80
  autoload :JavascriptIncludeTag, "phlex/rails/helpers/javascript_include_tag"
81
81
  autoload :JavascriptPath, "phlex/rails/helpers/javascript_path"
82
82
  autoload :JavascriptTag, "phlex/rails/helpers/javascript_tag"
@@ -93,6 +93,7 @@ module Phlex::Rails::Helpers
93
93
  autoload :MailTo, "phlex/rails/helpers/mail_to"
94
94
  autoload :MonthField, "phlex/rails/helpers/month_field"
95
95
  autoload :MonthFieldTag, "phlex/rails/helpers/month_field_tag"
96
+ autoload :Notice, "phlex/rails/helpers/notice"
96
97
  autoload :NumberField, "phlex/rails/helpers/number_field"
97
98
  autoload :NumberFieldTag, "phlex/rails/helpers/number_field_tag"
98
99
  autoload :NumberToCurrency, "phlex/rails/helpers/number_to_currency"
@@ -130,7 +131,6 @@ module Phlex::Rails::Helpers
130
131
  autoload :ResetCycle, "phlex/rails/helpers/reset_cycle"
131
132
  autoload :RichTextArea, "phlex/rails/helpers/rich_text_area"
132
133
  autoload :Routes, "phlex/rails/helpers/routes"
133
- autoload :SMSTo, "phlex/rails/helpers/sms_to"
134
134
  autoload :Sanitize, "phlex/rails/helpers/sanitize"
135
135
  autoload :SanitizeCSS, "phlex/rails/helpers/sanitize_css"
136
136
  autoload :SearchField, "phlex/rails/helpers/search_field"
@@ -147,6 +147,7 @@ module Phlex::Rails::Helpers
147
147
  autoload :SelectTime, "phlex/rails/helpers/select_time"
148
148
  autoload :SelectYear, "phlex/rails/helpers/select_year"
149
149
  autoload :SimpleFormat, "phlex/rails/helpers/simple_format"
150
+ autoload :SMSTo, "phlex/rails/helpers/sms_to"
150
151
  autoload :StripLinks, "phlex/rails/helpers/strip_links"
151
152
  autoload :StripTags, "phlex/rails/helpers/strip_tags"
152
153
  autoload :StylesheetLinkTag, "phlex/rails/helpers/stylesheet_link_tag"
@@ -173,9 +174,9 @@ module Phlex::Rails::Helpers
173
174
  autoload :Truncate, "phlex/rails/helpers/truncate"
174
175
  autoload :TurboFrameTag, "phlex/rails/helpers/turbo_frame_tag"
175
176
  autoload :TurboIncludeTags, "phlex/rails/helpers/turbo_include_tags"
177
+ autoload :TurboRefreshesWith, "phlex/rails/helpers/turbo_refreshes_with"
176
178
  autoload :TurboRefreshMethodTag, "phlex/rails/helpers/turbo_refresh_method_tag"
177
179
  autoload :TurboRefreshScrollTag, "phlex/rails/helpers/turbo_refresh_scroll_tag"
178
- autoload :TurboRefreshesWith, "phlex/rails/helpers/turbo_refreshes_with"
179
180
  autoload :TurboStream, "phlex/rails/helpers/turbo_stream"
180
181
  autoload :TurboStreamFrom, "phlex/rails/helpers/turbo_stream_from"
181
182
  autoload :URLField, "phlex/rails/helpers/url_field"
@@ -193,56 +194,10 @@ module Phlex::Rails::Helpers
193
194
  autoload :VideoPath, "phlex/rails/helpers/video_path"
194
195
  autoload :VideoTag, "phlex/rails/helpers/video_tag"
195
196
  autoload :VideoURL, "phlex/rails/helpers/video_url"
196
- autoload :WeekField, "phlex/rails/helpers/week_field"
197
- autoload :WeekFieldTag, "phlex/rails/helpers/week_field_tag"
198
197
  autoload :WeekdayOptionsForSelect, "phlex/rails/helpers/weekday_options_for_select"
199
198
  autoload :WeekdaySelect, "phlex/rails/helpers/weekday_select"
199
+ autoload :WeekField, "phlex/rails/helpers/week_field"
200
+ autoload :WeekFieldTag, "phlex/rails/helpers/week_field_tag"
200
201
  autoload :WithOutputBuffer, "phlex/rails/helpers/with_output_buffer"
201
202
  autoload :WordWrap, "phlex/rails/helpers/word_wrap"
202
-
203
- DEPRECATED = {
204
- Checkbox: :CheckBox,
205
- CheckboxTag: :CheckBoxTag,
206
- CollectionCheckboxes: :CollectionCheckBoxes,
207
- DateTimeField: :DatetimeField,
208
- PathToJavaScript: :PathToJavascript,
209
- DateTimeFieldTag: :DatetimeFieldTag,
210
- DateTimeLocalField: :DatetimeLocalField,
211
- DateTimeLocalFieldTag: :DatetimeLocalFieldTag,
212
- DateTimeSelect: :DatetimeSelect,
213
- JavaScriptImportModuleTag: :JavascriptImportModuleTag,
214
- JavaScriptImportMapTags: :JavascriptImportmapTags,
215
- JavaScriptIncludeTag: :JavascriptIncludeTag,
216
- JavaScriptPath: :JavascriptPath,
217
- JavaScriptTag: :JavascriptTag,
218
- JavaScriptURL: :JavascriptURL,
219
- LinkIf: :LinkToIf,
220
- PathToStyleSheet: :PathToStylesheet,
221
- SanitizeCss: :SanitizeCSS,
222
- SelectDateTime: :SelectDatetime,
223
- StyleSheetLinkTag: :StylesheetLinkTag,
224
- StyleSheetPath: :StylesheetPath,
225
- StyleSheetURL: :StylesheetURL,
226
- URLToJavaScript: :URLToJavascript,
227
- URLToStyleSheet: :URLToStylesheet
228
- }
229
-
230
- def self.const_missing(name)
231
- if (helper_module_name = DEPRECATED[name])
232
- message = "`Phlex::Rails::Helpers::#{name}` is deprecated. Please use `Phlex::Rails::Helpers::#{helper_module_name}` instead."
233
-
234
- if name.to_s.downcase == helper_module_name.to_s.downcase
235
- message << " Note the casing of the module name has changed to match the helper method."
236
- end
237
-
238
- Phlex::Rails::Deprecation.warn(message)
239
-
240
- helper_module = const_get(helper_module_name)
241
- const_set(name, helper_module)
242
-
243
- helper_module
244
- else
245
- super
246
- end
247
- end
248
203
  end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlex::Rails::HTML
4
- autoload :MethodMissing, "phlex/rails/html/method_missing"
5
-
6
4
  module Format
7
5
  def format
8
6
  :html
@@ -14,11 +14,12 @@ module Phlex::Rails
14
14
  include Helpers::JavascriptImportModuleTag
15
15
  include Helpers::TurboRefreshMethodTag
16
16
  include Helpers::TurboRefreshScrollTag
17
+ include Helpers::TurboRefreshesWith
17
18
 
18
19
  # @api private
19
20
  module Interface
20
- def render(view_context, _locals, &block)
21
- new.render(view_context, &block)
21
+ def render(view_context, _locals, &)
22
+ new.render(view_context, &)
22
23
  end
23
24
 
24
25
  def identifier
@@ -38,18 +39,17 @@ module Phlex::Rails
38
39
 
39
40
  def self.included(klass)
40
41
  unless klass < Phlex::HTML
41
- raise Phlex::ArgumentError,
42
- "👋 #{name} should only be included into Phlex::HTML classes."
42
+ raise Phlex::ArgumentError.new("👋 #{name} should only be included into Phlex::HTML classes.")
43
43
  end
44
44
 
45
45
  klass.extend(Interface)
46
46
  end
47
47
 
48
- def render(view_context, *args, **kwargs, &block)
48
+ def render(view_context = nil, *args, **kwargs, &block)
49
49
  if @_context
50
50
  super
51
51
  else
52
- call(view_context: view_context) do |yielded|
52
+ call(view_context:) do |yielded|
53
53
  case yielded
54
54
  when Symbol
55
55
  output = view_context.view_flow.get(yielded)
@@ -57,7 +57,7 @@ module Phlex::Rails
57
57
  output = view_context.capture(&block)
58
58
  end
59
59
 
60
- unsafe_raw output
60
+ raw output
61
61
  end
62
62
  end
63
63
  end