view_component_reflex 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c0c42d6658ac5c2c6af6bc78a4de1c04cfaaa38bdf4a206106975cbf7c5c049
4
- data.tar.gz: 5bc792233916b8d16dd364eadb02eb9183ede8da619ed67908b47b410a9c80d5
3
+ metadata.gz: 81ad30d3c12022e55c857cfc03487e06ed18522ffcaaae123d8f6e8a6c778677
4
+ data.tar.gz: c976d4533673254f126579ab91f0c9f808c82ff8d8e7ba9c38c6826a22e3c2ea
5
5
  SHA512:
6
- metadata.gz: 2747491eede7da7ccfab22ec260426755a44ee46a28218da5297ef3b1108cf6fe8c9cb38559f03cc20b68e6f0c00e79d5480fddd5a6595f1e0c979e2f2865e4a
7
- data.tar.gz: c979f87cc33842ced72066d2dc262e876ff77cd5b3764052c0e388d5139a060c7b22fdcc9963fef5f8a3a0f2e82c8a6b35ede0feaaca4bdc70f32ffe59a1abee
6
+ metadata.gz: 12064756297206323014293e7fe801fe501754c0506f6f7afed4e2fc551293169e63efadc7e90cc410154c7ad16c15ae8328728121808e152398d5536bbeb4ce
7
+ data.tar.gz: 4c7149d348dacc75b239f44098dd8d08b7f9899884bdc879ed67bde8f53f4d3d6d547d3576a092c7fa62dfb3209059d89480db710c49eb13014a1bd0832bdec7
data/README.md CHANGED
@@ -21,7 +21,7 @@ In addition to calling reflexes, there is a rudimentary state system. You can in
21
21
 
22
22
  You can access state with the `state` helper. See the code below for an example.
23
23
 
24
- If you're using state, include `super()` at the beginning of your initialize method, and add `data-key="<%= key %>"` to any html element using a reflex. This
24
+ If you're using state add `data-key="<%= key %>"` to any html element using a reflex. This
25
25
  lets ViewComponentReflex keep track of which state belongs to which component.
26
26
 
27
27
 
@@ -30,7 +30,6 @@ lets ViewComponentReflex keep track of which state belongs to which component.
30
30
  class CounterComponent < ViewComponentReflex::Component
31
31
 
32
32
  def initialize
33
- super()
34
33
  initialize_state({
35
34
  count: 0
36
35
  })
@@ -1,7 +1,16 @@
1
1
  require "view_component_reflex/engine"
2
2
  require 'stimulus_reflex'
3
- require_relative 'stimulus_reflex/channel'
4
3
 
5
4
  module ViewComponentReflex
6
5
  # Your code goes here...
7
6
  end
7
+
8
+ class StimulusReflex::Channel < ActionCable::Channel::Base
9
+ def render_page_and_broadcast_morph(reflex, selectors, data = {})
10
+ html = render_page(reflex)
11
+ if reflex.respond_to? :stimulus_controller
12
+ selectors = ["[data-controller=\"#{reflex.stimulus_controller}\"]"]
13
+ end
14
+ broadcast_morphs selectors, data, html if html.present?
15
+ end
16
+ end
@@ -1,5 +1,4 @@
1
1
  module ViewComponentReflex
2
2
  class Engine < ::Rails::Engine
3
- isolate_namespace ViewComponentReflex
4
3
  end
5
4
  end
@@ -1,3 +1,3 @@
1
1
  module ViewComponentReflex
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component_reflex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua LeBlanc
@@ -69,7 +69,6 @@ files:
69
69
  - README.md
70
70
  - Rakefile
71
71
  - app/components/view_component_reflex/component.rb
72
- - lib/stimulus_reflex/channel.rb
73
72
  - lib/view_component_reflex.rb
74
73
  - lib/view_component_reflex/engine.rb
75
74
  - lib/view_component_reflex/version.rb
@@ -1,9 +0,0 @@
1
- class StimulusReflex::Channel < ActionCable::Channel::Base
2
- def render_page_and_broadcast_morph(reflex, selectors, data = {})
3
- html = render_page(reflex)
4
- if reflex.respond_to? :stimulus_controller
5
- selectors = ["[data-controller=\"#{reflex.stimulus_controller}\"]"]
6
- end
7
- broadcast_morphs selectors, data, html if html.present?
8
- end
9
- end