isomorfeus-react 16.6.8 → 16.8.0
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 +4 -4
- data/README.md +39 -413
- data/lib/isomorfeus-react-base.rb +55 -0
- data/lib/isomorfeus-react-component.rb +20 -0
- data/lib/isomorfeus-react-lucid.rb +39 -0
- data/lib/isomorfeus-react-material-ui.rb +41 -0
- data/lib/isomorfeus-react-redux-component.rb +25 -0
- data/lib/isomorfeus-react.rb +4 -101
- data/lib/isomorfeus/config.rb +3 -8
- data/lib/isomorfeus/top_level_browser.rb +1 -1
- data/lib/lucid_app/api.rb +1 -12
- data/lib/lucid_app/mixin.rb +1 -0
- data/lib/lucid_app/native_component_constructor.rb +10 -0
- data/lib/lucid_component/api.rb +1 -1
- data/lib/lucid_component/initializer.rb +5 -5
- data/lib/lucid_component/mixin.rb +1 -0
- data/lib/lucid_component/native_component_constructor.rb +13 -3
- data/lib/lucid_material/app/base.rb +9 -0
- data/lib/lucid_material/app/mixin.rb +20 -0
- data/lib/lucid_material/app/native_component_constructor.rb +116 -0
- data/lib/lucid_material/component/api.rb +19 -0
- data/lib/lucid_material/component/base.rb +9 -0
- data/lib/lucid_material/component/mixin.rb +21 -0
- data/lib/lucid_material/component/native_component_constructor.rb +158 -0
- data/lib/react.rb +13 -5
- data/lib/react/children.rb +35 -0
- data/lib/react/component/api.rb +5 -91
- data/lib/react/component/callbacks.rb +103 -0
- data/lib/react/component/elements.rb +3 -23
- data/lib/react/component/features.rb +12 -29
- data/lib/react/component/initializer.rb +2 -2
- data/lib/react/component/mixin.rb +1 -0
- data/lib/react/component/native_component_constructor.rb +7 -0
- data/lib/react/component/props.rb +13 -1
- data/lib/react/component/resolution.rb +14 -15
- data/lib/react/component/styles.rb +23 -0
- data/lib/react/context_wrapper.rb +4 -0
- data/lib/react/function_component/api.rb +83 -0
- data/lib/react/function_component/base.rb +9 -0
- data/lib/react/function_component/creator.rb +19 -65
- data/lib/react/function_component/event_handler.rb +13 -0
- data/lib/react/function_component/mixin.rb +14 -0
- data/lib/react/function_component/resolution.rb +17 -15
- data/lib/react/memo_component/base.rb +9 -0
- data/lib/react/memo_component/creator.rb +32 -0
- data/lib/react/memo_component/mixin.rb +14 -0
- data/lib/react/native_constant_wrapper.rb +1 -11
- data/lib/react/pure_component/mixin.rb +2 -0
- data/lib/react/redux_component/api.rb +1 -93
- data/lib/react/redux_component/initializer.rb +5 -5
- data/lib/react/redux_component/mixin.rb +1 -0
- data/lib/react/redux_component/native_component_constructor.rb +13 -3
- data/lib/react/redux_component/reducers.rb +29 -35
- data/lib/react/ref.rb +4 -0
- data/lib/react/version.rb +1 -1
- data/lib/react_dom.rb +9 -3
- metadata +70 -8
- data/lib/lucid_router.rb +0 -18
- data/lib/react/function_component/runner.rb +0 -19
@@ -1,45 +1,39 @@
|
|
1
1
|
module React
|
2
2
|
module ReduxComponent
|
3
3
|
module Reducers
|
4
|
-
|
5
|
-
|
6
|
-
case action[:type]
|
7
|
-
when 'COMPONENT_STATE'
|
8
|
-
new_state = {}.merge!(prev_state) # make a copy of state
|
9
|
-
new_state[action[:object_id]] = {} unless new_state.has_key?(action[:object_id])
|
10
|
-
new_state[action[:object_id]].merge!(action[:name] => action[:value])
|
11
|
-
new_state
|
12
|
-
else
|
13
|
-
prev_state
|
14
|
-
end
|
15
|
-
end
|
4
|
+
class << self
|
5
|
+
attr_reader :component_reducers_added
|
16
6
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
7
|
+
def add_component_reducers_to_store
|
8
|
+
unless component_reducers_added
|
9
|
+
@_component_reducers_added = true
|
10
|
+
component_reducer = Redux.create_reducer do |prev_state, action|
|
11
|
+
case action[:type]
|
12
|
+
when 'COMPONENT_STATE'
|
13
|
+
new_state = {}.merge!(prev_state) # make a copy of state
|
14
|
+
new_state[action[:object_id]] = {} unless new_state.has_key?(action[:object_id])
|
15
|
+
new_state[action[:object_id]].merge!(action[:name] => action[:value])
|
16
|
+
new_state
|
17
|
+
else
|
18
|
+
prev_state
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
component_class_reducer = Redux.create_reducer do |prev_state, action|
|
23
|
+
case action[:type]
|
24
|
+
when 'COMPONENT_CLASS_STATE'
|
25
|
+
new_state = {}.merge!(prev_state) # make a copy of state
|
26
|
+
new_state[action[:class]] = {} unless new_state.has_key?(action[:class])
|
27
|
+
new_state[action[:class]].merge!(action[:name] => action[:value])
|
28
|
+
new_state
|
29
|
+
else
|
30
|
+
prev_state
|
31
|
+
end
|
32
|
+
end
|
28
33
|
|
29
|
-
|
30
|
-
# TODO implement Isomomorfeus.store.app_store or Isomomorfeus.app_store
|
31
|
-
app_reducer = Redux.create_reducer do |prev_state, action|
|
32
|
-
case action[:type]
|
33
|
-
when 'APPLICATION_STATE'
|
34
|
-
new_state = {}.merge!(prev_state) # make a copy of state
|
35
|
-
new_state.merge!(action[:name] => action[:value])
|
36
|
-
new_state
|
37
|
-
else
|
38
|
-
prev_state
|
34
|
+
Redux::Store.add_reducers(component_state: component_reducer, component_class_state: component_class_reducer)
|
39
35
|
end
|
40
36
|
end
|
41
|
-
|
42
|
-
Redux::Store.add_reducers(component_state: component_reducer, component_class_state: component_class_reducer, application_state: app_reducer)
|
43
37
|
end
|
44
38
|
end
|
45
39
|
end
|
data/lib/react/ref.rb
CHANGED
data/lib/react/version.rb
CHANGED
data/lib/react_dom.rb
CHANGED
@@ -33,9 +33,15 @@ module ReactDOM
|
|
33
33
|
result
|
34
34
|
end
|
35
35
|
|
36
|
-
def unmount_component_at_node(
|
37
|
-
|
38
|
-
|
36
|
+
def unmount_component_at_node(element_or_query)
|
37
|
+
if `(typeof element_or_query === 'string')` || (`(typeof element_or_query.$class === 'function')` && element_or_query.class == String)
|
38
|
+
element = `document.body.querySelector(element_or_query)`
|
39
|
+
elsif `(typeof element_or_query.$is_a === 'function')` && element_or_query.is_a?(Browser::DOM::Node)
|
40
|
+
element = element_or_query.to_n
|
41
|
+
else
|
42
|
+
element = element_or_query
|
43
|
+
end
|
44
|
+
`Opal.global.ReactDOM.unmountComponentAtNode(element)`
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.
|
4
|
+
version: 16.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -86,28 +86,70 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 4.0.
|
89
|
+
version: 4.0.5
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4.0.
|
96
|
+
version: 4.0.5
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: isomorfeus-speednode
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.2.
|
103
|
+
version: 0.2.4
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.2.
|
110
|
+
version: 0.2.4
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: isomorfeus-puppetmaster
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.2.7
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.2.7
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rspec
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.6'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.6'
|
111
153
|
description: Write React Components in Ruby.
|
112
154
|
email:
|
113
155
|
- jan@kursator.com
|
@@ -116,6 +158,11 @@ extensions: []
|
|
116
158
|
extra_rdoc_files: []
|
117
159
|
files:
|
118
160
|
- README.md
|
161
|
+
- lib/isomorfeus-react-base.rb
|
162
|
+
- lib/isomorfeus-react-component.rb
|
163
|
+
- lib/isomorfeus-react-lucid.rb
|
164
|
+
- lib/isomorfeus-react-material-ui.rb
|
165
|
+
- lib/isomorfeus-react-redux-component.rb
|
119
166
|
- lib/isomorfeus-react.rb
|
120
167
|
- lib/isomorfeus/config.rb
|
121
168
|
- lib/isomorfeus/execution_environment.rb
|
@@ -133,11 +180,19 @@ files:
|
|
133
180
|
- lib/lucid_component/initializer.rb
|
134
181
|
- lib/lucid_component/mixin.rb
|
135
182
|
- lib/lucid_component/native_component_constructor.rb
|
136
|
-
- lib/
|
183
|
+
- lib/lucid_material/app/base.rb
|
184
|
+
- lib/lucid_material/app/mixin.rb
|
185
|
+
- lib/lucid_material/app/native_component_constructor.rb
|
186
|
+
- lib/lucid_material/component/api.rb
|
187
|
+
- lib/lucid_material/component/base.rb
|
188
|
+
- lib/lucid_material/component/mixin.rb
|
189
|
+
- lib/lucid_material/component/native_component_constructor.rb
|
137
190
|
- lib/react.rb
|
138
191
|
- lib/react/active_support_support.rb
|
192
|
+
- lib/react/children.rb
|
139
193
|
- lib/react/component/api.rb
|
140
194
|
- lib/react/component/base.rb
|
195
|
+
- lib/react/component/callbacks.rb
|
141
196
|
- lib/react/component/elements.rb
|
142
197
|
- lib/react/component/event_handler.rb
|
143
198
|
- lib/react/component/features.rb
|
@@ -152,11 +207,18 @@ files:
|
|
152
207
|
- lib/react/component/resolution.rb
|
153
208
|
- lib/react/component/should_component_update.rb
|
154
209
|
- lib/react/component/state.rb
|
210
|
+
- lib/react/component/styles.rb
|
155
211
|
- lib/react/component/unsafe_api.rb
|
156
212
|
- lib/react/context_wrapper.rb
|
213
|
+
- lib/react/function_component/api.rb
|
214
|
+
- lib/react/function_component/base.rb
|
157
215
|
- lib/react/function_component/creator.rb
|
216
|
+
- lib/react/function_component/event_handler.rb
|
217
|
+
- lib/react/function_component/mixin.rb
|
158
218
|
- lib/react/function_component/resolution.rb
|
159
|
-
- lib/react/
|
219
|
+
- lib/react/memo_component/base.rb
|
220
|
+
- lib/react/memo_component/creator.rb
|
221
|
+
- lib/react/memo_component/mixin.rb
|
160
222
|
- lib/react/native_constant_wrapper.rb
|
161
223
|
- lib/react/pure_component/base.rb
|
162
224
|
- lib/react/pure_component/mixin.rb
|
data/lib/lucid_router.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# language=JS
|
2
|
-
%x{
|
3
|
-
class LucidRouter extends Opal.global.React.Component {
|
4
|
-
constructor(props) {
|
5
|
-
super(props);
|
6
|
-
}
|
7
|
-
render() {
|
8
|
-
if (Opal.Isomorfeus["$on_ssr?"]()) {
|
9
|
-
var new_props = Object.assign({}, this.props, { location: Opal.Isomorfeus.TopLevel.$ssr_route_path() });
|
10
|
-
return Opal.global.React.createElement(Opal.global.StaticRouter, new_props);
|
11
|
-
} else {
|
12
|
-
return Opal.global.React.createElement(Opal.global.BrowserRouter, this.props);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
Opal.global.LucidRouter = LucidRouter;
|
18
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module FunctionComponent
|
3
|
-
class Runner
|
4
|
-
include ::React::Component::Elements
|
5
|
-
include ::React::Component::Features
|
6
|
-
include ::React::FunctionComponent::Resolution
|
7
|
-
|
8
|
-
attr_accessor :props
|
9
|
-
|
10
|
-
%x{
|
11
|
-
self.event_handlers = {};
|
12
|
-
}
|
13
|
-
|
14
|
-
def initialize(props)
|
15
|
-
@props = ::React::Component::Props.new(props)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|