reactionview 0.6.0 → 0.6.1

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.
@@ -3,8 +3,27 @@
3
3
  module ReActionView
4
4
  module Slots
5
5
  class Resolver < ActionView::FileSystemResolver
6
+ def find_all(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
7
+ return [] unless slots_first?(details, key)
8
+
9
+ super
10
+ end
11
+
12
+ # Rails 8.2 resolves a single template through `find`, which no longer goes through `find_all`.
13
+ def find(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
14
+ return nil unless slots_first?(details, key)
15
+
16
+ super
17
+ end
18
+
6
19
  private
7
20
 
21
+ def slots_first?(details, key)
22
+ requested = key || ActionView::TemplateDetails::Requested.new(**details)
23
+
24
+ requested.formats_idx[Slots::FORMAT]&.zero?
25
+ end
26
+
8
27
  def build_unbound_template(template)
9
28
  unbound = super
10
29
  details = unbound.details
@@ -62,6 +62,7 @@ module ReActionView
62
62
  slots = slot_visitors(template, source)
63
63
 
64
64
  config[:visitors] = compile_stack(template, validation_mode: mode, slots: slots)
65
+ config.merge!(filename_annotation_options(template))
65
66
 
66
67
  erb_implementation.new(source, config).src
67
68
  end
@@ -116,6 +117,18 @@ module ReActionView
116
117
 
117
118
  private
118
119
 
120
+ def filename_annotation_options(template)
121
+ return {} unless ActionView::Base.annotate_rendered_view_with_filenames && template.format == :html
122
+
123
+ beginning = "<!-- BEGIN #{template.short_identifier}\n-->"
124
+ ending = "<!-- END #{template.short_identifier} -->"
125
+
126
+ {
127
+ preamble: "@output_buffer.safe_append=#{beginning.dump};",
128
+ postamble: "@output_buffer.safe_append=#{ending.dump};@output_buffer",
129
+ }
130
+ end
131
+
119
132
  def base_visitors(template, validation_mode: ReActionView.config.validation_mode)
120
133
  compile_stack(template, validation_mode: validation_mode).reject { |visitor| rewrites_erb_source?(visitor) }
121
134
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReActionView
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
data/reactionview.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["marco.roth@intergga.ch"]
10
10
  spec.license = "MIT"
11
11
 
12
- spec.summary = "An ActionView-compatible ERB engine with modern DX - re-imagined with Herb."
13
- spec.description = spec.summary
12
+ spec.summary = "Reactive views for the HTML+ERB you already have."
13
+ spec.description = "You get what a client-side framework gives you, without adopting one."
14
14
  spec.homepage = "https://reactionview.dev"
15
15
  spec.required_ruby_version = ">= 3.2.0"
16
16
 
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_dependency "actionview", ">= 7.0"
39
39
  spec.add_dependency "cruise", ">= 0.3.0"
40
- spec.add_dependency "herb", ">= 0.11.0"
40
+ spec.add_dependency "herb", ">= 0.11.2"
41
41
  spec.add_dependency "websocket", "~> 1.2"
42
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Roth
@@ -43,14 +43,14 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 0.11.0
46
+ version: 0.11.2
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 0.11.0
53
+ version: 0.11.2
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: websocket
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -65,8 +65,7 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '1.2'
68
- description: An ActionView-compatible ERB engine with modern DX - re-imagined with
69
- Herb.
68
+ description: You get what a client-side framework gives you, without adopting one.
70
69
  email:
71
70
  - marco.roth@intergga.ch
72
71
  executables: []
@@ -128,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
127
  - !ruby/object:Gem::Version
129
128
  version: '0'
130
129
  requirements: []
131
- rubygems_version: 4.0.6
130
+ rubygems_version: 4.0.20
132
131
  specification_version: 4
133
- summary: An ActionView-compatible ERB engine with modern DX - re-imagined with Herb.
132
+ summary: Reactive views for the HTML+ERB you already have.
134
133
  test_files: []