view_component_reflex 3.3.1 → 3.3.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0f8913f474b23d0c743eb8a48015bd0f6971f698f51511ff216143648171b17
|
4
|
+
data.tar.gz: 4dbfdaf02139d4ac986ff19b314fa1e88d9e7757a2907b26249767c5ed584d13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 342b1fc02d9cf677e68beca8dedf2efb98d97173363c64e516e311cc3c16ec9f7ddce0ed2698b08c61e9cd13f92217d48b1256b48c33dc9066e492d81587a795
|
7
|
+
data.tar.gz: 419f897312a32ce4bfb13f871967fdc4dcc94621c6edc3842aefe8f0cc109e21fe75499fef5c411c7f9880fd611c930f4c61e2ef1918409634bd81dc7c302c13
|
@@ -252,7 +252,7 @@ module ViewComponentReflex
|
|
252
252
|
:@virtual_path, :@variant, :@current_template, :@output_buffer, :@key,
|
253
253
|
:@helpers, :@controller, :@request, :@tag_builder, :@state_initialized,
|
254
254
|
:@_content_evaluated, :@_render_in_block, :@__cached_content,
|
255
|
-
:@original_view_context,
|
255
|
+
:@original_view_context, :@compiler,
|
256
256
|
]
|
257
257
|
end
|
258
258
|
|
@@ -276,6 +276,8 @@ module ViewComponentReflex
|
|
276
276
|
new_state[k] = instance_variable_get(k)
|
277
277
|
end
|
278
278
|
|
279
|
+
p new_state
|
280
|
+
|
279
281
|
new_state[:@__cached_content__] = content
|
280
282
|
|
281
283
|
new_state
|
@@ -111,21 +111,7 @@ module ViewComponentReflex
|
|
111
111
|
"[data-controller~=\"#{stimulus_controller}\"][data-key=\"#{element.dataset[:key]}\"]"
|
112
112
|
end
|
113
113
|
|
114
|
-
|
115
|
-
# uses method to gather the method parameters, but since we're abusing
|
116
|
-
# method_missing here, that'll always fail
|
117
|
-
def method(name)
|
118
|
-
component.adapter.extend_reflex(self)
|
119
|
-
component.method(name.to_sym)
|
120
|
-
end
|
121
|
-
|
122
|
-
def respond_to_missing?(name, _ = false)
|
123
|
-
!!name.to_proc
|
124
|
-
end
|
125
|
-
|
126
|
-
def method_missing(name, *args, &blk)
|
127
|
-
super unless respond_to_missing?(name)
|
128
|
-
|
114
|
+
def delegate_call_to_reflex(name, *args, &blk)
|
129
115
|
state.each do |k, v|
|
130
116
|
component.instance_variable_set(k, v)
|
131
117
|
end
|
@@ -31,7 +31,23 @@ module ViewComponentReflex
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def reflex_instance
|
34
|
-
@reflex_instance ||=
|
34
|
+
@reflex_instance ||= build_reflex_instance
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Beyond just creating the <Component>Reflex class, we need to define all the component methods on the reflex
|
39
|
+
# class.
|
40
|
+
# This replaces the old method_missing implementation, and passes more strict validation of recent SR versions
|
41
|
+
def build_reflex_instance
|
42
|
+
reflex_methods = @component.instance_methods - @component.superclass.instance_methods - [:call, :"_call_#{@component.name.underscore}"]
|
43
|
+
|
44
|
+
Class.new(@component.reflex_base_class).tap do |klass|
|
45
|
+
reflex_methods.each do |m|
|
46
|
+
klass.define_method(m) do |*args, &blk|
|
47
|
+
delegate_call_to_reflex(method_name, *args, &blk)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
35
51
|
end
|
36
52
|
|
37
53
|
def reflex_from_nested_component
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: view_component_reflex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua LeBlanc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
119
|
+
rubygems_version: 3.5.6
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Allow stimulus reflexes in a view component
|