isomorfeus-react 16.12.24 → 16.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus-react.rb +0 -52
- data/lib/isomorfeus/react_view_helper.rb +3 -2
- data/lib/isomorfeus_react/lucid_app/mixin.rb +0 -2
- data/lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb +5 -10
- data/lib/isomorfeus_react/lucid_component/api.rb +10 -24
- data/lib/isomorfeus_react/lucid_component/app_store_proxy.rb +15 -24
- data/lib/isomorfeus_react/lucid_component/class_store_proxy.rb +23 -29
- data/lib/isomorfeus_react/lucid_component/initializer.rb +4 -2
- data/lib/isomorfeus_react/lucid_component/instance_store_proxy.rb +16 -27
- data/lib/isomorfeus_react/lucid_component/mixin.rb +0 -2
- data/lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb +0 -5
- data/lib/isomorfeus_react/lucid_func/initializer.rb +1 -1
- data/lib/isomorfeus_react/lucid_func/mixin.rb +0 -2
- data/lib/isomorfeus_react_material/lucid_material/app/mixin.rb +0 -2
- data/lib/isomorfeus_react_material/lucid_material/component/mixin.rb +0 -2
- data/lib/isomorfeus_react_material/lucid_material/func/mixin.rb +0 -2
- data/lib/react/version.rb +1 -1
- metadata +10 -14
- data/lib/isomorfeus_react/lucid_component/app_store_defaults.rb +0 -36
- data/lib/isomorfeus_react/lucid_component/component_class_store_defaults.rb +0 -38
- data/lib/isomorfeus_react/lucid_component/component_instance_store_defaults.rb +0 -35
- data/lib/lucid_app/reducers.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947da878f70ba5a12ed18872ce80759e8d8653a7690527a906bd91f10edc1333
|
4
|
+
data.tar.gz: 7ed9f57c7eb15dcf6b6b5d7d1650e4e55041702cc948cdec4c14321db995f50e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 260fdc8fc33d3346b7c8f0faf037a9061fda2832aa2713fa12cc0981f9efcbf6084b1768fe5518eb925b5504e667cad95c4b5a0da0cd38bb105783abcf4b4a0d
|
7
|
+
data.tar.gz: 72e8199ae9fe16615f1f6140715ffdda6d9db023e2f54dfb8476d05da9b62849590f6925a02940d5e968a11a307198642ae9af04011f8e9633cb8af647e3b0ff
|
data/lib/isomorfeus-react.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
if RUBY_ENGINE == 'opal'
|
2
|
-
# require 'opal'
|
3
|
-
# require 'native'
|
4
|
-
# require 'promise'
|
5
|
-
# rely on i-redux to have included above requirements
|
6
2
|
require 'isomorfeus-redux'
|
7
3
|
require 'active_support/core_ext/string'
|
8
4
|
require 'zeitwerk'
|
@@ -49,18 +45,6 @@ if RUBY_ENGINE == 'opal'
|
|
49
45
|
require 'react/context_wrapper'
|
50
46
|
require 'react/native_constant_wrapper'
|
51
47
|
|
52
|
-
# Function Component
|
53
|
-
#require 'react/function_component/resolution'
|
54
|
-
#require 'react/function_component/initializer'
|
55
|
-
#require 'react/function_component/api'
|
56
|
-
#require 'react/function_component/event_handler'
|
57
|
-
#require 'react/function_component/native_component_constructor'
|
58
|
-
#require 'react/function_component/mixin'
|
59
|
-
#require 'react/function_component/base'
|
60
|
-
#require 'react/memo_component/native_component_constructor'
|
61
|
-
#require 'react/memo_component/mixin'
|
62
|
-
#require 'react/memo_component/base'
|
63
|
-
|
64
48
|
# React::Component
|
65
49
|
require 'react/component/api'
|
66
50
|
require 'react/component/callbacks'
|
@@ -75,51 +59,15 @@ if RUBY_ENGINE == 'opal'
|
|
75
59
|
require 'react/component/mixin'
|
76
60
|
require 'react/component/base'
|
77
61
|
|
78
|
-
# init component reducers
|
79
|
-
require 'lucid_app/reducers'
|
80
|
-
LucidApp::Reducers.add_component_reducers_to_store
|
81
|
-
|
82
62
|
# init LucidApplicationContext (Store Provider and Consumer)
|
83
63
|
require 'lucid_app/context'
|
84
64
|
LucidApp::Context.create_application_context
|
85
65
|
|
86
|
-
# LucidFunc
|
87
|
-
#require 'lucid_func/initializer'
|
88
|
-
#require 'lucid_func/native_component_constructor'
|
89
|
-
#require 'lucid_func/mixin'
|
90
|
-
#require 'lucid_func/base'
|
91
|
-
|
92
|
-
# LucidComponent
|
93
|
-
#require 'lucid_component/environment_support'
|
94
|
-
#require 'lucid_component/api'
|
95
|
-
#require 'lucid_component/app_store_defaults'
|
96
|
-
#require 'lucid_component/component_class_store_defaults'
|
97
|
-
#require 'lucid_component/component_instance_store_defaults'
|
98
|
-
#require 'lucid_component/app_store_proxy'
|
99
|
-
#require 'lucid_component/class_store_proxy'
|
100
|
-
#require 'lucid_component/instance_store_proxy'
|
101
|
-
#require 'lucid_component/initializer'
|
102
|
-
#require 'lucid_component/native_lucid_component_constructor'
|
103
|
-
#require 'lucid_component/native_component_constructor'
|
104
|
-
#require 'lucid_component/mixin'
|
105
|
-
#require 'lucid_component/base'
|
106
|
-
|
107
|
-
# LucidApp
|
108
|
-
#require 'lucid_app/api'
|
109
|
-
#require 'lucid_app/native_lucid_component_constructor'
|
110
|
-
#require 'lucid_app/native_component_constructor'
|
111
|
-
#require 'lucid_app/mixin'
|
112
|
-
#require 'lucid_app/base'
|
113
|
-
|
114
66
|
class Object
|
115
67
|
include React::Component::Resolution
|
116
68
|
end
|
117
69
|
|
118
|
-
# require 'isomorfeus/vivify_module'
|
119
|
-
|
120
70
|
Isomorfeus.zeitwerk = Zeitwerk::Loader.new
|
121
|
-
# Isomorfeus.zeitwerk.vivify_mod_dir = 'components/'
|
122
|
-
# Isomorfeus.zeitwerk.vivify_mod_class = Isomorfeus::VivifyModule
|
123
71
|
|
124
72
|
Isomorfeus.zeitwerk.push_dir('isomorfeus_react')
|
125
73
|
require_tree 'isomorfeus_react', :autoload
|
@@ -57,6 +57,7 @@ module Isomorfeus
|
|
57
57
|
# initialize speednode context
|
58
58
|
unless Isomorfeus.ssr_contexts.key?(thread_id_asset)
|
59
59
|
asset_file_name = OpalWebpackLoader::Manifest.lookup_path_for(asset)
|
60
|
+
Isomorfeus.raise_error(message: "Server Side Rendering: Build asset file not found for #{asset}. Has it been build?") unless asset_file_name
|
60
61
|
asset_path = File.join('public', asset_file_name)
|
61
62
|
Isomorfeus.ssr_contexts[thread_id_asset] = ExecJS.permissive_compile(File.read(asset_path))
|
62
63
|
end
|
@@ -97,8 +98,8 @@ module Isomorfeus
|
|
97
98
|
else { global.Opal.Isomorfeus.TopLevel.$render_component_to_string('#{component_name}', #{Oj.dump(props, mode: :strict)}); }
|
98
99
|
global.FirstPassFinished = 'transport';
|
99
100
|
} catch (e) {
|
100
|
-
global.Exception = e;
|
101
|
-
global.FirstPassFinished = 'transport';
|
101
|
+
global.Exception = e;
|
102
|
+
global.FirstPassFinished = 'transport';
|
102
103
|
}
|
103
104
|
}, $$1.$$s = this, $$1.$$arity = 0, $$1))
|
104
105
|
} else { return global.FirstPassFinished = true; };
|
@@ -5,8 +5,6 @@ module LucidApp
|
|
5
5
|
base.extend(::LucidApp::NativeLucidComponentConstructor)
|
6
6
|
base.extend(::LucidApp::NativeComponentConstructor)
|
7
7
|
base.extend(::LucidPropDeclaration::Mixin)
|
8
|
-
base.extend(::Isomorfeus::ExecutionEnvironmentHelpers)
|
9
|
-
base.include(::Isomorfeus::ExecutionEnvironmentHelpers)
|
10
8
|
base.include(::React::Component::Elements)
|
11
9
|
base.include(::React::Component::Api)
|
12
10
|
base.include(::React::Component::Callbacks)
|
@@ -18,20 +18,15 @@ module LucidApp
|
|
18
18
|
};
|
19
19
|
this.state.isomorfeus_store_state = Opal.Isomorfeus.store.native.getState();
|
20
20
|
var current_store_state = this.state.isomorfeus_store_state;
|
21
|
-
if (typeof current_store_state.
|
22
|
-
this.state.
|
23
|
-
this.state.
|
21
|
+
if (typeof current_store_state.class_state[#{component_name}] !== "undefined") {
|
22
|
+
this.state.class_state = {};
|
23
|
+
this.state.class_state[#{component_name}] = current_store_state.class_state[#{component_name}];
|
24
24
|
} else {
|
25
|
-
this.state.
|
26
|
-
this.state.
|
25
|
+
this.state.class_state = {};
|
26
|
+
this.state.class_state[#{component_name}] = {};
|
27
27
|
};
|
28
28
|
this.__ruby_instance = base.$new(this);
|
29
|
-
this.__object_id = this.__ruby_instance.$object_id().$to_s();
|
30
29
|
if (Opal.Isomorfeus.$top_component() == nil) { Opal.Isomorfeus['$top_component='](this); }
|
31
|
-
if (!this.state.component_state) {
|
32
|
-
this.state.component_state = {};
|
33
|
-
this.state.component_state[this.__object_id] = {};
|
34
|
-
};
|
35
30
|
var defined_refs = #{base.defined_refs};
|
36
31
|
for (var ref in defined_refs) {
|
37
32
|
if (defined_refs[ref] != null) {
|
@@ -7,31 +7,8 @@ module LucidComponent
|
|
7
7
|
attr_accessor :class_store
|
8
8
|
attr_accessor :store
|
9
9
|
|
10
|
-
def default_app_store_defined
|
11
|
-
@default_app_store_defined
|
12
|
-
end
|
13
|
-
|
14
|
-
def default_class_store_defined
|
15
|
-
@default_class_store_defined
|
16
|
-
end
|
17
|
-
|
18
|
-
def default_instance_store_defined
|
19
|
-
@default_instance_store_defined
|
20
|
-
end
|
21
|
-
|
22
|
-
def app_store
|
23
|
-
@default_app_store_defined = true
|
24
|
-
@default_app_store ||= ::LucidComponent::AppStoreDefaults.new(state, self.to_s)
|
25
|
-
end
|
26
|
-
|
27
10
|
def class_store
|
28
|
-
@
|
29
|
-
@default_class_store ||= ::LucidComponent::ComponentClassStoreDefaults.new(state, self.to_s)
|
30
|
-
end
|
31
|
-
|
32
|
-
def store
|
33
|
-
@default_instance_store_defined = true
|
34
|
-
@default_instance_store ||= ::LucidComponent::ComponentInstanceStoreDefaults.new(state, self.to_s)
|
11
|
+
@class_store ||= ::LucidComponent::ClassStoreProxy.new(self.to_s)
|
35
12
|
end
|
36
13
|
|
37
14
|
def store_updates(switch)
|
@@ -88,6 +65,15 @@ module LucidComponent
|
|
88
65
|
end
|
89
66
|
end
|
90
67
|
|
68
|
+
# stores
|
69
|
+
def local_store
|
70
|
+
LocalStore
|
71
|
+
end
|
72
|
+
|
73
|
+
def session_store
|
74
|
+
SessionStore
|
75
|
+
end
|
76
|
+
|
91
77
|
# styles
|
92
78
|
def styles
|
93
79
|
props.classes
|
@@ -1,46 +1,37 @@
|
|
1
1
|
module LucidComponent
|
2
2
|
class AppStoreProxy
|
3
3
|
def initialize(component_instance)
|
4
|
-
|
5
|
-
|
4
|
+
if component_instance
|
5
|
+
@native = component_instance.to_n
|
6
|
+
@component_instance = component_instance
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](key)
|
11
|
+
method_missing(key)
|
12
|
+
end
|
13
|
+
|
14
|
+
def []=(key, value)
|
15
|
+
method_missing(key, value)
|
6
16
|
end
|
7
17
|
|
8
18
|
def method_missing(key, *args, &block)
|
9
19
|
if `args.length > 0`
|
10
20
|
# set class state, simply a dispatch
|
11
21
|
action = { type: 'APPLICATION_STATE', name: (`key.endsWith('=')` ? key.chop : key), value: args[0] }
|
12
|
-
Isomorfeus.store.
|
22
|
+
Isomorfeus.store.collect_and_defer_dispatch(action)
|
13
23
|
else
|
14
24
|
# check if we have a component local state value
|
15
|
-
if `#@native.props.store`
|
25
|
+
if @native && `#@native.props.store`
|
16
26
|
if `#@native.props.store.application_state && #@native.props.store.application_state.hasOwnProperty(key)`
|
17
27
|
return @native.JS[:props].JS[:store].JS[:application_state].JS[key]
|
18
28
|
end
|
19
29
|
else
|
20
|
-
|
21
|
-
if a_state.key?(:application_state) && a_state[:application_state].key?(key)
|
22
|
-
return a_state[:application_state][key]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
if @component_instance.class.default_app_store_defined && @component_instance.class.app_store.to_h.key?(key)
|
26
|
-
# check if a default value was given
|
27
|
-
return @component_instance.class.app_store.to_h[key]
|
30
|
+
return AppStore[key]
|
28
31
|
end
|
29
32
|
# otherwise return nil
|
30
33
|
return nil
|
31
34
|
end
|
32
35
|
end
|
33
|
-
|
34
|
-
def dispatch(action)
|
35
|
-
Isomorfeus.store.dispatch(action)
|
36
|
-
end
|
37
|
-
|
38
|
-
def subscribe(&block)
|
39
|
-
Isomorfeus.store.subscribe(&block)
|
40
|
-
end
|
41
|
-
|
42
|
-
def unsubscribe(unsubscriber)
|
43
|
-
`unsubscriber()`
|
44
|
-
end
|
45
36
|
end
|
46
37
|
end
|
@@ -1,50 +1,44 @@
|
|
1
1
|
module LucidComponent
|
2
2
|
class ClassStoreProxy
|
3
|
-
def initialize(component_instance)
|
4
|
-
@
|
5
|
-
|
6
|
-
|
3
|
+
def initialize(component_name, component_instance = nil, native = nil)
|
4
|
+
@component_name = component_name
|
5
|
+
if component_instance
|
6
|
+
@native = native
|
7
|
+
@component_instance = component_instance
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def [](key)
|
12
|
+
method_missing(key)
|
13
|
+
end
|
14
|
+
|
15
|
+
def []=(key, value)
|
16
|
+
method_missing(key, value)
|
7
17
|
end
|
8
18
|
|
9
19
|
def method_missing(key, *args, &block)
|
10
20
|
if `args.length > 0`
|
11
21
|
# set class state, simply a dispatch
|
12
|
-
action = { type: '
|
13
|
-
Isomorfeus.store.
|
22
|
+
action = { type: 'CLASS_STATE', class: @component_name, name: (`key.endsWith('=')` ? key.chop : key), value: args[0] }
|
23
|
+
Isomorfeus.store.collect_and_defer_dispatch(action)
|
14
24
|
else
|
15
25
|
# get class state
|
16
26
|
# check if we have a component local state value
|
17
|
-
if @native.JS[:props].JS[:store]
|
18
|
-
if @native.JS[:props].JS[:store].JS[:
|
19
|
-
@native.JS[:props].JS[:store].JS[:
|
20
|
-
@native.JS[:props].JS[:store].JS[:
|
21
|
-
return @native.JS[:props].JS[:store].JS[:
|
27
|
+
if @native && @native.JS[:props].JS[:store]
|
28
|
+
if @native.JS[:props].JS[:store].JS[:class_state] &&
|
29
|
+
@native.JS[:props].JS[:store].JS[:class_state].JS[@component_name] &&
|
30
|
+
@native.JS[:props].JS[:store].JS[:class_state].JS[@component_name].JS.hasOwnProperty(key)
|
31
|
+
return @native.JS[:props].JS[:store].JS[:class_state].JS[@component_name].JS[key]
|
22
32
|
end
|
23
33
|
else
|
24
34
|
a_state = Isomorfeus.store.get_state
|
25
|
-
if a_state.key?(:
|
26
|
-
return a_state[:
|
35
|
+
if a_state.key?(:class_state) && a_state[:class_state].key?(@component_name) && a_state[:class_state][@component_name].key?(key)
|
36
|
+
return a_state[:class_state][@component_name][key]
|
27
37
|
end
|
28
38
|
end
|
29
|
-
if @component_instance.class.default_class_store_defined && @component_instance.class.class_store.to_h.key?(key)
|
30
|
-
# check if a default value was given
|
31
|
-
return @component_instance.class.class_store.to_h[key]
|
32
|
-
end
|
33
39
|
# otherwise return nil
|
34
40
|
return nil
|
35
41
|
end
|
36
42
|
end
|
37
|
-
|
38
|
-
def dispatch(action)
|
39
|
-
Isomorfeus.store.dispatch(action)
|
40
|
-
end
|
41
|
-
|
42
|
-
def subscribe(&block)
|
43
|
-
Isomorfeus.store.subscribe(&block)
|
44
|
-
end
|
45
|
-
|
46
|
-
def unsubscribe(unsubscriber)
|
47
|
-
`unsubscriber()`
|
48
|
-
end
|
49
43
|
end
|
50
44
|
end
|
@@ -3,10 +3,12 @@ module LucidComponent
|
|
3
3
|
def initialize(native_component)
|
4
4
|
@native = native_component
|
5
5
|
@app_store = LucidComponent::AppStoreProxy.new(self)
|
6
|
-
@class_store = LucidComponent::ClassStoreProxy.new(self)
|
6
|
+
@class_store = LucidComponent::ClassStoreProxy.new(self.class.to_s, self, @native)
|
7
|
+
# @iso_store = Isomorfeus::IsomorphicStoreProxy.new(self)
|
8
|
+
# @local_store = Isomorfeus::LocalStoreProxy.new(self)
|
9
|
+
@store = LucidComponent::InstanceStoreProxy.new(self)
|
7
10
|
@props = `Opal.React.Component.Props.$new(#@native)`
|
8
11
|
@state = `Opal.React.Component.State.$new(#@native)`
|
9
|
-
@store = LucidComponent::InstanceStoreProxy.new(self)
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -6,50 +6,39 @@ module LucidComponent
|
|
6
6
|
@component_object_id = component_instance.object_id.to_s
|
7
7
|
end
|
8
8
|
|
9
|
+
def [](key)
|
10
|
+
method_missing(key)
|
11
|
+
end
|
12
|
+
|
13
|
+
def []=(key, value)
|
14
|
+
method_missing(key, value)
|
15
|
+
end
|
16
|
+
|
9
17
|
def method_missing(key, *args, &block)
|
10
18
|
if `args.length > 0`
|
11
19
|
# set instance state, simply a dispatch
|
12
20
|
|
13
|
-
action = { type: '
|
14
|
-
Isomorfeus.store.
|
21
|
+
action = { type: 'INSTANCE_STATE', object_id: @component_object_id, name: (`key.endsWith('=')` ? key.chop : key), value: args[0] }
|
22
|
+
Isomorfeus.store.collect_and_defer_dispatch(action)
|
15
23
|
|
16
24
|
else
|
17
25
|
# get instance state
|
18
|
-
|
19
26
|
if @native.JS[:props].JS[:store]
|
20
|
-
if @native.JS[:props].JS[:store].JS[:
|
21
|
-
@native.JS[:props].JS[:store].JS[:
|
22
|
-
@native.JS[:props].JS[:store].JS[:
|
27
|
+
if @native.JS[:props].JS[:store].JS[:instance_state] &&
|
28
|
+
@native.JS[:props].JS[:store].JS[:instance_state].JS[@component_object_id] &&
|
29
|
+
@native.JS[:props].JS[:store].JS[:instance_state].JS[@component_object_id].JS.hasOwnProperty(key)
|
23
30
|
# check if we have a component local state value
|
24
|
-
return @native.JS[:props].JS[:store].JS[:
|
31
|
+
return @native.JS[:props].JS[:store].JS[:instance_state].JS[@component_object_id].JS[key]
|
25
32
|
end
|
26
33
|
else
|
27
34
|
a_state = Isomorfeus.store.get_state
|
28
|
-
if a_state.key?(:
|
29
|
-
return a_state[:
|
35
|
+
if a_state.key?(:instance_state) && a_state[:instance_state].key?(key)
|
36
|
+
return a_state[:instance_state][key]
|
30
37
|
end
|
31
38
|
end
|
32
|
-
|
33
|
-
if @component_instance.class.default_instance_store_defined && @component_instance.class.store.to_h.key?(key)
|
34
|
-
# check if a default value was given
|
35
|
-
return @component_instance.class.store.to_h[key]
|
36
|
-
end
|
37
|
-
|
38
39
|
# otherwise return nil
|
39
40
|
return nil
|
40
41
|
end
|
41
42
|
end
|
42
|
-
|
43
|
-
def dispatch(action)
|
44
|
-
Isomorfeus.store.dispatch(action)
|
45
|
-
end
|
46
|
-
|
47
|
-
def subscribe(&block)
|
48
|
-
Isomorfeus.store.subscribe(&block)
|
49
|
-
end
|
50
|
-
|
51
|
-
def unsubscribe(unsubscriber)
|
52
|
-
`unsubscriber()`
|
53
|
-
end
|
54
43
|
end
|
55
44
|
end
|
@@ -5,8 +5,6 @@ module LucidComponent
|
|
5
5
|
base.extend(::LucidComponent::NativeLucidComponentConstructor)
|
6
6
|
base.extend(::LucidComponent::NativeComponentConstructor)
|
7
7
|
base.extend(::LucidPropDeclaration::Mixin)
|
8
|
-
base.extend(::Isomorfeus::ExecutionEnvironmentHelpers)
|
9
|
-
base.include(::Isomorfeus::ExecutionEnvironmentHelpers)
|
10
8
|
base.include(::React::Component::Elements)
|
11
9
|
base.include(::React::Component::Api)
|
12
10
|
base.include(::React::Component::Callbacks)
|
@@ -17,11 +17,6 @@ module LucidComponent
|
|
17
17
|
this.state = {};
|
18
18
|
};
|
19
19
|
this.__ruby_instance = base.$new(this);
|
20
|
-
this.__object_id = this.__ruby_instance.$object_id().$to_s();
|
21
|
-
if (!this.state.component_state) {
|
22
|
-
this.state.component_state = {};
|
23
|
-
this.state.component_state[this.__object_id] = {};
|
24
|
-
};
|
25
20
|
var defined_refs = #{base.defined_refs};
|
26
21
|
for (var ref in defined_refs) {
|
27
22
|
if (defined_refs[ref] != null) {
|
@@ -4,7 +4,7 @@ module LucidFunc
|
|
4
4
|
self.JS[:native_props] = `{ props: null }`
|
5
5
|
@native_props = `Opal.React.Component.Props.$new(#{self})`
|
6
6
|
@app_store = LucidComponent::AppStoreProxy.new(self)
|
7
|
-
@class_store = LucidComponent::ClassStoreProxy.new(self)
|
7
|
+
@class_store = LucidComponent::ClassStoreProxy.new(self.class.to_s, self, self)
|
8
8
|
@store = LucidComponent::InstanceStoreProxy.new(self)
|
9
9
|
end
|
10
10
|
end
|
@@ -5,8 +5,6 @@ module LucidFunc
|
|
5
5
|
base.include(::React::Component::Features)
|
6
6
|
base.include(::LucidFunc::Initializer)
|
7
7
|
base.include(::React::FunctionComponent::Api)
|
8
|
-
base.extend(::Isomorfeus::ExecutionEnvironmentHelpers)
|
9
|
-
base.include(::Isomorfeus::ExecutionEnvironmentHelpers)
|
10
8
|
base.extend(::LucidFunc::NativeComponentConstructor)
|
11
9
|
base.include(::LucidComponent::Api)
|
12
10
|
end
|
@@ -6,8 +6,6 @@ module LucidMaterial
|
|
6
6
|
base.extend(::LucidApp::NativeLucidComponentConstructor)
|
7
7
|
base.extend(::LucidMaterial::App::NativeComponentConstructor)
|
8
8
|
base.extend(::LucidPropDeclaration::Mixin)
|
9
|
-
base.extend(::Isomorfeus::ExecutionEnvironmentHelpers)
|
10
|
-
base.include(::Isomorfeus::ExecutionEnvironmentHelpers)
|
11
9
|
base.include(::React::Component::Elements)
|
12
10
|
base.include(::React::Component::Api)
|
13
11
|
base.include(::React::Component::Callbacks)
|
@@ -6,8 +6,6 @@ module LucidMaterial
|
|
6
6
|
base.extend(::LucidComponent::NativeLucidComponentConstructor)
|
7
7
|
base.extend(::LucidMaterial::Component::NativeComponentConstructor)
|
8
8
|
base.extend(::LucidPropDeclaration::Mixin)
|
9
|
-
base.extend(::Isomorfeus::ExecutionEnvironmentHelpers)
|
10
|
-
base.include(::Isomorfeus::ExecutionEnvironmentHelpers)
|
11
9
|
base.include(::React::Component::Elements)
|
12
10
|
base.include(::React::Component::Api)
|
13
11
|
base.include(::React::Component::Callbacks)
|
@@ -6,8 +6,6 @@ module LucidMaterial
|
|
6
6
|
base.include(::React::Component::Features)
|
7
7
|
base.include(::LucidFunc::Initializer)
|
8
8
|
base.include(::React::FunctionComponent::Api)
|
9
|
-
base.extend(::Isomorfeus::ExecutionEnvironmentHelpers)
|
10
|
-
base.include(::Isomorfeus::ExecutionEnvironmentHelpers)
|
11
9
|
base.extend(::LucidMaterial::Func::NativeComponentConstructor)
|
12
10
|
base.include(::LucidComponent::Api)
|
13
11
|
end
|
data/lib/react/version.rb
CHANGED
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.13.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: 2020-02-
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.1.
|
19
|
+
version: 1.1.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.1.
|
26
|
+
version: 1.1.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: oj
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.10.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 3.10.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: opal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 4.0.
|
103
|
+
version: 4.0.22
|
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: 4.0.
|
110
|
+
version: 4.0.22
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: isomorfeus-speednode
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.3.
|
145
|
+
version: 0.3.5
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.3.
|
152
|
+
version: 0.3.5
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rake
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,12 +210,9 @@ files:
|
|
210
210
|
- lib/isomorfeus_react/lucid_app/native_component_constructor.rb
|
211
211
|
- lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb
|
212
212
|
- lib/isomorfeus_react/lucid_component/api.rb
|
213
|
-
- lib/isomorfeus_react/lucid_component/app_store_defaults.rb
|
214
213
|
- lib/isomorfeus_react/lucid_component/app_store_proxy.rb
|
215
214
|
- lib/isomorfeus_react/lucid_component/base.rb
|
216
215
|
- lib/isomorfeus_react/lucid_component/class_store_proxy.rb
|
217
|
-
- lib/isomorfeus_react/lucid_component/component_class_store_defaults.rb
|
218
|
-
- lib/isomorfeus_react/lucid_component/component_instance_store_defaults.rb
|
219
216
|
- lib/isomorfeus_react/lucid_component/initializer.rb
|
220
217
|
- lib/isomorfeus_react/lucid_component/instance_store_proxy.rb
|
221
218
|
- lib/isomorfeus_react/lucid_component/mixin.rb
|
@@ -243,7 +240,6 @@ files:
|
|
243
240
|
- lib/isomorfeus_react_material/lucid_material/func/mixin.rb
|
244
241
|
- lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb
|
245
242
|
- lib/lucid_app/context.rb
|
246
|
-
- lib/lucid_app/reducers.rb
|
247
243
|
- lib/lucid_prop_declaration/mixin.rb
|
248
244
|
- lib/react.rb
|
249
245
|
- lib/react/children.rb
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module LucidComponent
|
2
|
-
class AppStoreDefaults
|
3
|
-
def initialize(state, component_name)
|
4
|
-
@state = state
|
5
|
-
if @state.isomorfeus_store
|
6
|
-
@state.isomorfeus_store.merge!(application_state: {})
|
7
|
-
else
|
8
|
-
@state.isomorfeus_store = { application_state: {}}
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def method_missing(key, *args, &block)
|
13
|
-
if `args.length > 0`
|
14
|
-
# set initial class state
|
15
|
-
key = key.chop if `key.endsWith('=')`
|
16
|
-
@state.isomorfeus_store[:application_state][key] = args[0]
|
17
|
-
current_state = Isomorfeus.store.get_state
|
18
|
-
if !(current_state[:application_state].key?(key))
|
19
|
-
Isomorfeus.store.dispatch(type: 'APPLICATION_STATE', name: key, value: args[0])
|
20
|
-
end
|
21
|
-
else
|
22
|
-
# get class state
|
23
|
-
|
24
|
-
# check if we have a component local state value
|
25
|
-
if @state.isomorfeus_store[:application_state].key?(key)
|
26
|
-
return @state.isomorfeus_store[:application_state][key]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
nil
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_h
|
33
|
-
@state.isomorfeus_store[:application_state]
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module LucidComponent
|
2
|
-
class ComponentClassStoreDefaults
|
3
|
-
def initialize(state, component_name)
|
4
|
-
@state = state
|
5
|
-
@component_name = component_name
|
6
|
-
if @state.isomorfeus_store
|
7
|
-
@state.isomorfeus_store.merge!(component_class_state: { @component_name => {} })
|
8
|
-
else
|
9
|
-
@state.isomorfeus_store = { component_class_state: { @component_name => {} } }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def method_missing(key, *args, &block)
|
14
|
-
if `args.length > 0`
|
15
|
-
# set initial class state
|
16
|
-
key = key.chop if `key.endsWith('=')`
|
17
|
-
@state.isomorfeus_store[:component_class_state][@component_name][key] = args[0]
|
18
|
-
current_state = Isomorfeus.store.get_state
|
19
|
-
if !(current_state[:component_class_state].key?(@component_name) && current_state[:component_class_state][@component_name].key?(key))
|
20
|
-
Isomorfeus.store.dispatch(type: 'COMPONENT_CLASS_STATE', class: @component_name, name: key, value: args[0])
|
21
|
-
end
|
22
|
-
else
|
23
|
-
# get class state
|
24
|
-
|
25
|
-
# check if we have a component local state value
|
26
|
-
|
27
|
-
if @state.isomorfeus_store[:component_class_state][@component_name].key?(key)
|
28
|
-
return @state.isomorfeus_store[:component_class_state][@component_name][key]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
def to_h
|
35
|
-
@state.isomorfeus_store[:component_class_state][@component_name]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module LucidComponent
|
2
|
-
class ComponentInstanceStoreDefaults
|
3
|
-
def initialize(state, component_name)
|
4
|
-
@state = {}
|
5
|
-
@component_name = component_name
|
6
|
-
end
|
7
|
-
|
8
|
-
def method_missing(key, *args, &block)
|
9
|
-
if `args.length > 0`
|
10
|
-
# set initial class state
|
11
|
-
key = key.chop if `key.endsWith('=')`
|
12
|
-
@state[key] = args[0]
|
13
|
-
current_state = Isomorfeus.store.get_state
|
14
|
-
if !(current_state[:component_state].key?(@component_name) &&
|
15
|
-
current_state[:component_state][@component_name].key?(:instance_defaults) &&
|
16
|
-
current_state[:component_state][@component_name][:instance_defaults].key?(key))
|
17
|
-
Isomorfeus.store.dispatch(type: 'COMPONENT_CLASS_STATE', class: @component_name, name: :instance_defaults, value: { key => args[0]})
|
18
|
-
end
|
19
|
-
else
|
20
|
-
# get class state
|
21
|
-
|
22
|
-
# check if we have a component local state value
|
23
|
-
|
24
|
-
if @state.key?(key)
|
25
|
-
return @state[key]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_h
|
32
|
-
@state
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/lucid_app/reducers.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module LucidApp
|
2
|
-
module Reducers
|
3
|
-
class << self
|
4
|
-
attr_reader :component_reducers_added
|
5
|
-
|
6
|
-
def add_component_reducers_to_store
|
7
|
-
unless component_reducers_added
|
8
|
-
@_component_reducers_added = true
|
9
|
-
component_reducer = Redux.create_reducer do |prev_state, action|
|
10
|
-
case action[:type]
|
11
|
-
when 'COMPONENT_STATE'
|
12
|
-
if action.key?(:set_state)
|
13
|
-
action[:set_state]
|
14
|
-
else
|
15
|
-
new_state = {}.merge!(prev_state) # make a copy of state
|
16
|
-
new_state[action[:object_id]] = {} unless new_state.key?(action[:object_id])
|
17
|
-
new_state[action[:object_id]].merge!(action[:name] => action[:value])
|
18
|
-
# new_state == prev_state ? prev_state : new_state
|
19
|
-
new_state
|
20
|
-
end
|
21
|
-
else
|
22
|
-
prev_state
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
component_class_reducer = Redux.create_reducer do |prev_state, action|
|
27
|
-
case action[:type]
|
28
|
-
when 'COMPONENT_CLASS_STATE'
|
29
|
-
if action.key?(:set_state)
|
30
|
-
action[:set_state]
|
31
|
-
else
|
32
|
-
new_state = {}.merge!(prev_state) # make a copy of state
|
33
|
-
new_state[action[:class]] = {} unless new_state.key?(action[:class])
|
34
|
-
new_state[action[:class]].merge!(action[:name] => action[:value])
|
35
|
-
# new_state == prev_state ? prev_state : new_state
|
36
|
-
new_state
|
37
|
-
end
|
38
|
-
else
|
39
|
-
prev_state
|
40
|
-
end
|
41
|
-
end
|
42
|
-
Redux::Store.preloaded_state_merge!(component_state: {}, component_class_state: {})
|
43
|
-
Redux::Store.add_reducers(component_state: component_reducer, component_class_state: component_class_reducer)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|