isomorfeus-react 16.6.2 → 16.6.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 +4 -4
- data/lib/isomorfeus/config.rb +17 -53
- data/lib/isomorfeus/view_helpers.rb +0 -16
- data/lib/lucid_app/native_component_constructor.rb +2 -1
- data/lib/lucid_component/native_component_constructor.rb +8 -4
- data/lib/react.rb +7 -3
- data/lib/react/component/api.rb +12 -10
- data/lib/react/component/elements.rb +12 -10
- data/lib/react/component/features.rb +24 -21
- data/lib/react/component/resolution.rb +6 -5
- data/lib/react/context_wrapper.rb +3 -8
- data/lib/react/function_component/resolution.rb +14 -3
- data/lib/react/native_constant_wrapper.rb +6 -5
- data/lib/react/redux_component/native_component_constructor.rb +13 -6
- data/lib/react/redux_component/reducers.rb +2 -9
- data/lib/react/version.rb +1 -1
- data/{README.md → readme.md} +0 -0
- metadata +20 -15
- data/Gemfile +0 -1
- data/isomorfeus-react.gemspec +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e53afc038b68f7a7f6b3fd6471c39a0a4d03e8cdb8f5b9af5b2fc82f88c8bb2
|
4
|
+
data.tar.gz: ad38368017933cbd6f79d9f25bf7c1600129d4cedb60d965edf234a05118a944
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 405733531edf7b1d5e1883f83e58971164d4fb6c088436569cf0fc8c34d454d253c719c880c62a60591c5d93cf2d05eccf41cca803e1cac0f0def4fd91cf5d81
|
7
|
+
data.tar.gz: 65df8532b419500abeeef2ab1b6d36e9af42cfe3924b45a6e9c1f09efd69e82378bda1e445abe249ba58ce64359f59b4e1d1b77698f92fbfd63be830b125b440
|
data/lib/isomorfeus/config.rb
CHANGED
@@ -1,84 +1,48 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Isomorfeus
|
2
|
+
if RUBY_ENGINE == 'opal'
|
3
3
|
class << self
|
4
|
-
attr_reader :
|
5
|
-
attr_reader :initialized
|
4
|
+
attr_reader :initialized?
|
6
5
|
attr_reader :store
|
7
6
|
|
8
7
|
def init
|
9
|
-
return if initialized
|
8
|
+
return if initialized?
|
10
9
|
@initialized = true
|
11
10
|
# at least one reducer must have been added at this stage
|
12
11
|
# this happened in isomorfeus-react.rb, where the component reducers were added
|
13
12
|
@store = Redux::Store.init!
|
14
13
|
`Opal.Isomorfeus.store = #@store`
|
15
|
-
init_options
|
16
14
|
execute_init_classes
|
17
15
|
end
|
18
16
|
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
17
|
+
def add_client_init_class_name(init_class_name)
|
18
|
+
client_init_class_names << init_class_name
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_client_option(key, value = nil)
|
22
|
+
self.class.attr_accessor(key)
|
23
|
+
self.send("#{key}=", value)
|
27
24
|
end
|
28
25
|
|
29
26
|
def execute_init_classes
|
30
|
-
|
31
|
-
|
32
|
-
constant.constantize.send(:init)
|
33
|
-
end
|
27
|
+
client_init_class_names.each do |constant|
|
28
|
+
constant.constantize.send(:init)
|
34
29
|
end
|
35
30
|
end
|
36
31
|
end
|
37
|
-
|
38
|
-
else
|
39
|
-
module Isomorfeus
|
32
|
+
self.add_client_option(:client_init_class_names, [])
|
33
|
+
else
|
40
34
|
class << self
|
41
|
-
attr_accessor :client_init_class_names
|
42
35
|
attr_accessor :prerendering
|
43
|
-
attr_accessor :version
|
44
|
-
|
45
|
-
def add_client_option(option)
|
46
|
-
@options_for_client ||= Set.new
|
47
|
-
@options_for_client << option
|
48
|
-
end
|
49
|
-
|
50
|
-
def add_client_options(options)
|
51
|
-
options.each do |option|
|
52
|
-
add_client_option(option)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def add_client_init_class_name(class_name)
|
57
|
-
client_init_class_names << class_name
|
58
|
-
end
|
59
36
|
|
60
37
|
def configuration(&block)
|
61
38
|
block.call(self)
|
62
39
|
end
|
63
40
|
|
64
|
-
def
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
def options_hash_for_client
|
69
|
-
opts = {}
|
70
|
-
Isomorfeus.options_for_client.each do |option|
|
71
|
-
opts[option] = Isomorfeus.send(option)
|
72
|
-
end
|
73
|
-
opts
|
41
|
+
def version
|
42
|
+
Isomorfeus::VERSION
|
74
43
|
end
|
75
44
|
end
|
76
45
|
|
77
|
-
self.add_client_option(:client_init_class_names)
|
78
|
-
self.add_client_option(:version)
|
79
|
-
|
80
|
-
self.client_init_class_names = []
|
81
46
|
self.prerendering = :off
|
82
|
-
# self.version = ::Isomorfeus::Component::VERSION # thats equal to the isomorfeus version
|
83
47
|
end
|
84
48
|
end
|
@@ -1,21 +1,5 @@
|
|
1
1
|
module Isomorfeus
|
2
2
|
module ViewHelpers
|
3
|
-
def isomorfeus_script_tag(options = {})
|
4
|
-
# client side used options:
|
5
|
-
# current_user_id
|
6
|
-
# session_id
|
7
|
-
# form_authenticity_token
|
8
|
-
options_hash = Isomorfeus.options_hash_for_client
|
9
|
-
options_hash.merge!(options)
|
10
|
-
tag = <<~SCRIPT
|
11
|
-
<script type="text/javascript">
|
12
|
-
Opal.IsomorfeusOptions = #{options_hash.to_json};
|
13
|
-
Opal.Isomorfeus.$init();
|
14
|
-
</script>
|
15
|
-
SCRIPT
|
16
|
-
tag.respond_to?(:html_safe) ? tag.html_safe : tag
|
17
|
-
end
|
18
|
-
|
19
3
|
def react_component(component_name, params)
|
20
4
|
component_name_id = component_id_name(component_name)
|
21
5
|
tag = <<~SCRIPT
|
@@ -56,7 +56,8 @@ module LucidApp
|
|
56
56
|
var current_ruby_state = Opal.Hash.$new(this.state.isomorfeus_store_state);
|
57
57
|
var next_ruby_state = Opal.Hash.$new(next_state);
|
58
58
|
if (#{`next_ruby_state` != `current_ruby_state`}) {
|
59
|
-
this
|
59
|
+
var self = this;
|
60
|
+
/* setTimeout(function() { */ self.setState({ isomorfeus_store_state: next_state }); /*}, 0 ); */
|
60
61
|
}
|
61
62
|
}
|
62
63
|
componentWillUnmount() {
|
@@ -65,8 +65,7 @@ module LucidComponent
|
|
65
65
|
if (property === "isomorfeus_store") {
|
66
66
|
var res = this.scu_for_used_store_paths(this, this.state.isomorfeus_store, next_state.isomorfeus_store);
|
67
67
|
if (res) { return true; }
|
68
|
-
}
|
69
|
-
if (next_props.hasOwnProperty(property)) {
|
68
|
+
} else if (next_props.hasOwnProperty(property)) {
|
70
69
|
if (!this.props.hasOwnProperty(property)) { return true; };
|
71
70
|
if (property == "children") { if (next_props.children !== this.props.children) { return true; }}
|
72
71
|
else if (typeof next_props[property] !== "undefined" && typeof next_props[property]['$!='] !== "undefined" && typeof this.props[property] !== "undefined" && typeof this.props[property]['$!='] !== "undefined") {
|
@@ -85,15 +84,20 @@ module LucidComponent
|
|
85
84
|
return false;
|
86
85
|
}
|
87
86
|
scu_for_used_store_paths(self, current_state, next_state) {
|
88
|
-
var unique_used_store_paths = self.used_store_paths.filter(function(elem, pos) {
|
89
|
-
return (
|
87
|
+
var unique_used_store_paths = self.used_store_paths.filter(function(elem, pos, paths) {
|
88
|
+
return (paths.indexOf(elem) === pos);
|
90
89
|
});
|
91
90
|
var used_length = unique_used_store_paths.length;
|
92
91
|
var store_path;
|
93
92
|
var current_value;
|
94
93
|
var next_value;
|
94
|
+
var store_path_last;
|
95
95
|
for (var i = 0; i < used_length; i++) {
|
96
96
|
store_path = unique_used_store_paths[i];
|
97
|
+
store_path_last = store_path.length - 1;
|
98
|
+
if (store_path[store_path_last].constructor === Array) {
|
99
|
+
store_path[store_path_last] = JSON.stringify(store_path[store_path_last]);
|
100
|
+
}
|
97
101
|
current_value = store_path.reduce(function(prev, curr) { return prev && prev[curr]; }, current_state);
|
98
102
|
next_value = store_path.reduce(function(prev, curr) { return prev && prev[curr]; }, next_state);
|
99
103
|
if (current_value !== next_value) { return true; };
|
data/lib/react.rb
CHANGED
@@ -37,12 +37,15 @@ module React
|
|
37
37
|
return result;
|
38
38
|
}
|
39
39
|
|
40
|
-
self.internal_render = function(component, props, block) {
|
40
|
+
self.internal_render = function(component, props, string_child, block) {
|
41
41
|
var children;
|
42
42
|
var block_result;
|
43
43
|
var react_element;
|
44
|
+
var native_props = null;
|
44
45
|
|
45
|
-
if (
|
46
|
+
if (string_child) {
|
47
|
+
children = string_child;
|
48
|
+
} else if (block !== nil) {
|
46
49
|
Opal.React.render_buffer.push([]);
|
47
50
|
block_result = block.$call();
|
48
51
|
if (block_result && (block_result !== nil && (typeof block_result === "string" || typeof block_result.$$typeof === "symbol" ||
|
@@ -54,7 +57,8 @@ module React
|
|
54
57
|
if (children.length == 1) { children = children[0]; }
|
55
58
|
else if (children.length == 0) { children = null; }
|
56
59
|
}
|
57
|
-
|
60
|
+
if (props) { native_props = Opal.React.to_native_react_props(props); }
|
61
|
+
react_element = React.createElement(component, native_props, children);
|
58
62
|
Opal.React.render_buffer[Opal.React.render_buffer.length - 1].push(react_element);
|
59
63
|
};
|
60
64
|
|
data/lib/react/component/api.rb
CHANGED
@@ -7,23 +7,25 @@ module React
|
|
7
7
|
if base_module != ''
|
8
8
|
base_module.constantize.define_singleton_method(base.to_s.demodulize) do |*args, &block|
|
9
9
|
%x{
|
10
|
-
var props = null;
|
11
|
-
|
12
10
|
if (args.length > 0) {
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
var last_arg = args[args.length - 1];
|
12
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
13
|
+
if (args.length === 1) { Opal.React.internal_render(#{base}.react_component, null, last_arg, null); }
|
14
|
+
else { Opal.React.internal_render(#{base}.react_component, args[0], last_arg, null); }
|
15
|
+
} else { Opal.React.internal_render(#{base}.react_component, args[0], null, block); }
|
16
|
+
} else { Opal.React.internal_render(#{base}.react_component, null, null, block); }
|
16
17
|
}
|
17
18
|
end
|
18
19
|
else
|
19
20
|
Object.define_method(base.to_s) do |*args, &block|
|
20
21
|
%x{
|
21
|
-
var props = null;
|
22
|
-
|
23
22
|
if (args.length > 0) {
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
var last_arg = args[args.length - 1];
|
24
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
25
|
+
if (args.length === 1) { Opal.React.internal_render(#{base}.react_component, null, last_arg, null); }
|
26
|
+
else { Opal.React.internal_render(#{base}.react_component, args[0], last_arg, null); }
|
27
|
+
} else { Opal.React.internal_render(#{base}.react_component, args[0], null, block); }
|
28
|
+
} else { Opal.React.internal_render(#{base}.react_component, null, null, block); }
|
27
29
|
}
|
28
30
|
end
|
29
31
|
end
|
@@ -54,22 +54,24 @@ module React
|
|
54
54
|
SUPPORTED_HTML_AND_SVG_ELEMENTS.each do |element|
|
55
55
|
define_method(element) do |*args, &block|
|
56
56
|
%x{
|
57
|
-
var props = null;
|
58
|
-
|
59
57
|
if (args.length > 0) {
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
var last_arg = args[args.length - 1];
|
59
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
60
|
+
if (args.length === 1) { Opal.React.internal_render(element, null, last_arg, null); }
|
61
|
+
else { Opal.React.internal_render(element, args[0], last_arg, null); }
|
62
|
+
} else { Opal.React.internal_render(element, args[0], null, block); }
|
63
|
+
} else { Opal.React.internal_render(element, null, null, block); }
|
63
64
|
}
|
64
65
|
end
|
65
66
|
define_method(`element.toUpperCase()`) do |*args, &block|
|
66
67
|
%x{
|
67
|
-
var props = null;
|
68
|
-
|
69
68
|
if (args.length > 0) {
|
70
|
-
|
71
|
-
|
72
|
-
|
69
|
+
var last_arg = args[args.length - 1];
|
70
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
71
|
+
if (args.length === 1) { Opal.React.internal_render(element, null, last_arg, null); }
|
72
|
+
else { Opal.React.internal_render(element, args[0], last_arg, null); }
|
73
|
+
} else { Opal.React.internal_render(element, args[0], null, block); }
|
74
|
+
} else { Opal.React.internal_render(element, null, null, block); }
|
73
75
|
}
|
74
76
|
end
|
75
77
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
module React
|
2
2
|
module Component
|
3
3
|
module Features
|
4
|
-
def Fragment(
|
4
|
+
def Fragment(*args, &block)
|
5
5
|
%x{
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
if (args.length > 0) {
|
7
|
+
var last_arg = args[args.length - 1];
|
8
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
9
|
+
if (args.length === 1) { Opal.React.internal_render(React.Fragment, null, last_arg, null); }
|
10
|
+
else { Opal.React.internal_render(React.Fragment, args[0], last_arg, null); }
|
11
|
+
} else { Opal.React.internal_render(React.Fragment, args[0], null, block); }
|
12
|
+
} else { Opal.React.internal_render(React.Fragment, null, null, block); }
|
12
13
|
}
|
13
14
|
end
|
14
15
|
|
@@ -32,25 +33,27 @@ module React
|
|
32
33
|
}
|
33
34
|
end
|
34
35
|
|
35
|
-
def StrictMode(
|
36
|
+
def StrictMode(*args, &block)
|
36
37
|
%x{
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
if (args.length > 0) {
|
39
|
+
var last_arg = args[args.length - 1];
|
40
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
41
|
+
if (args.length === 1) { Opal.React.internal_render(React.StrictMode, null, last_arg, null); }
|
42
|
+
else { Opal.React.internal_render(React.StrictMode, args[0], last_arg, null); }
|
43
|
+
} else { Opal.React.internal_render(React.StrictMode, args[0], null, block); }
|
44
|
+
} else { Opal.React.internal_render(React.StrictMode, null, null, block); }
|
43
45
|
}
|
44
46
|
end
|
45
47
|
|
46
|
-
def Suspense(
|
48
|
+
def Suspense(*args, &block)
|
47
49
|
%x{
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
if (args.length > 0) {
|
51
|
+
var last_arg = args[args.length - 1];
|
52
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
53
|
+
if (args.length === 1) { Opal.React.internal_render(React.Suspense, null, last_arg, null); }
|
54
|
+
else { Opal.React.internal_render(React.Suspense, args[0], last_arg, null); }
|
55
|
+
} else { Opal.React.internal_render(React.Suspense, args[0], null, block); }
|
56
|
+
} else { Opal.React.internal_render(React.Suspense, null, null, block); }
|
54
57
|
}
|
55
58
|
end
|
56
59
|
end
|
@@ -54,12 +54,13 @@ module React
|
|
54
54
|
}
|
55
55
|
}
|
56
56
|
if (component) {
|
57
|
-
var props = null;
|
58
|
-
|
59
57
|
if (args.length > 0) {
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
var last_arg = args[args.length - 1];
|
59
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
60
|
+
if (args.length === 1) { Opal.React.internal_render(component, null, last_arg, null); }
|
61
|
+
else { Opal.React.internal_render(component, args[0], last_arg, null); }
|
62
|
+
} else { Opal.React.internal_render(component, args[0], null, block); }
|
63
|
+
} else { Opal.React.internal_render(component, null, null, block); }
|
63
64
|
} else {
|
64
65
|
return #{_react_component_resolution_original_method_missing(component_name, *args, block)};
|
65
66
|
}
|
@@ -9,9 +9,7 @@ module React
|
|
9
9
|
var props = null;
|
10
10
|
var react_element;
|
11
11
|
|
12
|
-
if (args.length > 0) {
|
13
|
-
props = Opal.React.to_native_react_props(args[0]);
|
14
|
-
}
|
12
|
+
if (args.length > 0) { props = args[0]; }
|
15
13
|
|
16
14
|
var react_element = React.createElement(this.native.Consumer, props, function(value) {
|
17
15
|
if (block !== nil) {
|
@@ -36,11 +34,8 @@ module React
|
|
36
34
|
def Provider(*args, &block)
|
37
35
|
%x{
|
38
36
|
var props = null;
|
39
|
-
|
40
|
-
|
41
|
-
props = Opal.React.to_native_react_props(args[0]);
|
42
|
-
}
|
43
|
-
Opal.React.internal_render(this.native.Provider, props, block);
|
37
|
+
if (args.length > 0) { props = args[0]; }
|
38
|
+
Opal.React.internal_render(this.native.Provider, props, null, block);
|
44
39
|
}
|
45
40
|
end
|
46
41
|
end
|
@@ -45,11 +45,22 @@ module React
|
|
45
45
|
}
|
46
46
|
if (component) {
|
47
47
|
var props = null;
|
48
|
-
|
49
48
|
if (args.length > 0) {
|
50
|
-
|
49
|
+
var last_arg = args[args.length - 1];
|
50
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
51
|
+
if (args.length === 1) {
|
52
|
+
Opal.React.internal_render(component, null, last_arg, null);
|
53
|
+
} else {
|
54
|
+
props = Opal.React.to_native_react_props(args[0]);
|
55
|
+
Opal.React.internal_render(component, props, last_arg, null);
|
56
|
+
}
|
57
|
+
} else {
|
58
|
+
props = Opal.React.to_native_react_props(args[0]);
|
59
|
+
Opal.React.internal_render(component, props, null, block);
|
60
|
+
}
|
61
|
+
} else {
|
62
|
+
Opal.React.internal_render(component, null, null, block);
|
51
63
|
}
|
52
|
-
Opal.React.internal_render(component, props, block);
|
53
64
|
} else {
|
54
65
|
return #{_react_component_resolution_original_method_missing(component_name, *args, block)};
|
55
66
|
}
|
@@ -17,13 +17,14 @@ module React
|
|
17
17
|
if (component) {
|
18
18
|
var children = null;
|
19
19
|
var block_result = null;
|
20
|
-
var props = null;
|
21
20
|
var react_element;
|
22
|
-
|
23
21
|
if (args.length > 0) {
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
var last_arg = args[args.length - 1];
|
23
|
+
if (typeof last_arg === 'string' || last_arg instanceof String) {
|
24
|
+
if (args.length === 1) { Opal.React.internal_render(element, null, last_arg, null); }
|
25
|
+
else { Opal.React.internal_render(element, args[0], last_arg, null); }
|
26
|
+
} else { Opal.React.internal_render(element, args[0], null, block); }
|
27
|
+
} else { Opal.React.internal_render(element, null, null, block); }
|
27
28
|
} else {
|
28
29
|
#{raise NameError, "No such native Component #@const_name.#{name}"};
|
29
30
|
}
|
@@ -55,7 +55,10 @@ module React
|
|
55
55
|
}
|
56
56
|
listener() {
|
57
57
|
var next_state = Object.assign({}, this.state, { isomorfeus_store: Opal.Isomorfeus.store.native.getState() });
|
58
|
-
if (this.scu_for_used_store_paths(this, this.state.isomorfeus_store, next_state.isomorfeus_store)) {
|
58
|
+
if (this.scu_for_used_store_paths(this, this.state.isomorfeus_store, next_state.isomorfeus_store)) {
|
59
|
+
var self = this;
|
60
|
+
/* setTimeout(function() { */ self.setState(next_state); /* }, 0); */
|
61
|
+
}
|
59
62
|
}
|
60
63
|
register_used_store_path(path) {
|
61
64
|
this.used_store_paths.push(path);
|
@@ -83,10 +86,9 @@ module React
|
|
83
86
|
}
|
84
87
|
for (var property in next_state) {
|
85
88
|
if (property === "isomorfeus_store") {
|
86
|
-
|
89
|
+
return this.scu_for_used_store_paths(this, this.state.isomorfeus_store, next_state.isomorfeus_store);
|
87
90
|
if (res) { return true; }
|
88
|
-
}
|
89
|
-
if (next_state.hasOwnProperty(property)) {
|
91
|
+
} else if (next_state.hasOwnProperty(property)) {
|
90
92
|
if (!this.state.hasOwnProperty(property)) { return true; };
|
91
93
|
if (typeof next_state[property]['$!='] !== "undefined" && typeof this.state[property]['$!='] !== "undefined") {
|
92
94
|
if (#{ !! (`next_state[property]` != `this.state[property]`) }) { return true };
|
@@ -96,15 +98,20 @@ module React
|
|
96
98
|
return false;
|
97
99
|
}
|
98
100
|
scu_for_used_store_paths(self, current_state, next_state) {
|
99
|
-
var unique_used_store_paths = self.used_store_paths.filter(function(elem, pos) {
|
100
|
-
return (
|
101
|
+
var unique_used_store_paths = self.used_store_paths.filter(function(elem, pos, paths) {
|
102
|
+
return (paths.indexOf(elem) === pos);
|
101
103
|
});
|
102
104
|
var used_length = unique_used_store_paths.length;
|
103
105
|
var store_path;
|
104
106
|
var current_value;
|
105
107
|
var next_value;
|
108
|
+
var store_path_last;
|
106
109
|
for (var i = 0; i < used_length; i++) {
|
107
110
|
store_path = unique_used_store_paths[i];
|
111
|
+
store_path_last = store_path.length - 1;
|
112
|
+
if (store_path[store_path_last].constructor === Array) {
|
113
|
+
store_path[store_path_last] = JSON.stringify(store_path[store_path_last]);
|
114
|
+
}
|
108
115
|
current_value = store_path.reduce(function(prev, curr) { return prev && prev[curr]; }, current_state);
|
109
116
|
next_value = store_path.reduce(function(prev, curr) { return prev && prev[curr]; }, next_state);
|
110
117
|
if (current_value !== next_value) { return true; };
|
@@ -9,9 +9,6 @@ module React
|
|
9
9
|
new_state[action[:object_id]] = {} unless new_state.has_key?(action[:object_id])
|
10
10
|
new_state[action[:object_id]].merge!(action[:name] => action[:value])
|
11
11
|
new_state
|
12
|
-
when 'INIT'
|
13
|
-
new_state = {}
|
14
|
-
new_state
|
15
12
|
else
|
16
13
|
prev_state
|
17
14
|
end
|
@@ -24,23 +21,19 @@ module React
|
|
24
21
|
new_state[action[:class]] = {} unless new_state.has_key?(action[:class])
|
25
22
|
new_state[action[:class]].merge!(action[:name] => action[:value])
|
26
23
|
new_state
|
27
|
-
when 'INIT'
|
28
|
-
new_state = {}
|
29
|
-
new_state
|
30
24
|
else
|
31
25
|
prev_state
|
32
26
|
end
|
33
27
|
end
|
34
28
|
|
29
|
+
# TODO move application_state to i-redux
|
30
|
+
# TODO implement Isomomorfeus.store.app_store or Isomomorfeus.app_store
|
35
31
|
app_reducer = Redux.create_reducer do |prev_state, action|
|
36
32
|
case action[:type]
|
37
33
|
when 'APPLICATION_STATE'
|
38
34
|
new_state = {}.merge!(prev_state) # make a copy of state
|
39
35
|
new_state.merge!(action[:name] => action[:value])
|
40
36
|
new_state
|
41
|
-
when 'INIT'
|
42
|
-
new_state = {}
|
43
|
-
new_state
|
44
37
|
else
|
45
38
|
prev_state
|
46
39
|
end
|
data/lib/react/version.rb
CHANGED
data/{README.md → readme.md}
RENAMED
File without changes
|
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.6.
|
4
|
+
version: 16.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.11.0
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.12.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,9 +24,6 @@ dependencies:
|
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.11.0
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.12.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: opal-activesupport
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +58,28 @@ dependencies:
|
|
64
58
|
requirements:
|
65
59
|
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
|
-
version: 4.0.
|
61
|
+
version: 4.0.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.0.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: isomorfeus-speednode
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.2.1
|
68
76
|
type: :runtime
|
69
77
|
prerelease: false
|
70
78
|
version_requirements: !ruby/object:Gem::Requirement
|
71
79
|
requirements:
|
72
80
|
- - "~>"
|
73
81
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
82
|
+
version: 0.2.1
|
75
83
|
description: Write React Components in Ruby.
|
76
84
|
email:
|
77
85
|
- jan@kursator.com
|
@@ -79,9 +87,6 @@ executables: []
|
|
79
87
|
extensions: []
|
80
88
|
extra_rdoc_files: []
|
81
89
|
files:
|
82
|
-
- Gemfile
|
83
|
-
- README.md
|
84
|
-
- isomorfeus-react.gemspec
|
85
90
|
- lib/isomorfeus-react.rb
|
86
91
|
- lib/isomorfeus/config.rb
|
87
92
|
- lib/isomorfeus/top_level.rb
|
@@ -140,6 +145,7 @@ files:
|
|
140
145
|
- lib/react/version.rb
|
141
146
|
- lib/react_dom.rb
|
142
147
|
- lib/react_dom_server.rb
|
148
|
+
- readme.md
|
143
149
|
homepage: http://isomorfeus.com
|
144
150
|
licenses:
|
145
151
|
- MIT
|
@@ -159,8 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
165
|
- !ruby/object:Gem::Version
|
160
166
|
version: '0'
|
161
167
|
requirements: []
|
162
|
-
|
163
|
-
rubygems_version: 2.7.6
|
168
|
+
rubygems_version: 3.0.3
|
164
169
|
signing_key:
|
165
170
|
specification_version: 4
|
166
171
|
summary: React for Opal Ruby.
|
data/Gemfile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
gemspec
|
data/isomorfeus-react.gemspec
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require_relative 'lib/react/version.rb'
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = 'isomorfeus-react'
|
6
|
-
s.version = React::VERSION
|
7
|
-
|
8
|
-
s.authors = ['Jan Biedermann']
|
9
|
-
s.email = ['jan@kursator.com']
|
10
|
-
s.homepage = 'http://isomorfeus.com'
|
11
|
-
s.summary = 'React for Opal Ruby.'
|
12
|
-
s.license = 'MIT'
|
13
|
-
s.description = 'Write React Components in Ruby.'
|
14
|
-
|
15
|
-
s.files = `git ls-files`.split("\n").reject { |f| f.match(%r{^(gemfiles|s)/}) }
|
16
|
-
#s.test_files = `git ls-files -- {test,s,features}/*`.split("\n")
|
17
|
-
s.require_paths = ['lib']
|
18
|
-
|
19
|
-
s.add_dependency 'opal', '>= 0.11.0', '< 0.12.0'
|
20
|
-
s.add_dependency 'opal-activesupport', '~> 0.3.1'
|
21
|
-
s.add_dependency 'opal-browser', '~> 0.2.0'
|
22
|
-
s.add_dependency 'isomorfeus-redux', '~> 4.0.0'
|
23
|
-
end
|