isomorfeus-react 16.12.4 → 16.12.5
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-material-ui.rb +2 -13
- data/lib/isomorfeus-react.rb +46 -40
- data/lib/{react → isomorfeus}/vivify_module.rb +1 -1
- data/lib/{lucid_app → isomorfeus_react/lucid_app}/api.rb +1 -1
- data/lib/{lucid_app → isomorfeus_react/lucid_app}/base.rb +0 -0
- data/lib/{lucid_app → isomorfeus_react/lucid_app}/mixin.rb +3 -3
- data/lib/{lucid_app → isomorfeus_react/lucid_app}/native_component_constructor.rb +4 -3
- data/lib/{lucid_app → isomorfeus_react/lucid_app}/native_lucid_component_constructor.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/api.rb +31 -1
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/app_store_defaults.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/app_store_proxy.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/base.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/class_store_proxy.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/component_class_store_defaults.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/component_instance_store_defaults.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/environment_support.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/initializer.rb +3 -3
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/instance_store_proxy.rb +0 -0
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/mixin.rb +2 -3
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/native_component_constructor.rb +5 -4
- data/lib/{lucid_component → isomorfeus_react/lucid_component}/native_lucid_component_constructor.rb +0 -0
- data/lib/{lucid_func → isomorfeus_react/lucid_func}/base.rb +0 -0
- data/lib/{lucid_func → isomorfeus_react/lucid_func}/initializer.rb +3 -3
- data/lib/{lucid_func → isomorfeus_react/lucid_func}/mixin.rb +2 -2
- data/lib/{lucid_func → isomorfeus_react/lucid_func}/native_component_constructor.rb +0 -0
- data/lib/{react → isomorfeus_react/react}/function_component/api.rb +1 -1
- data/lib/{react → isomorfeus_react/react}/function_component/base.rb +0 -0
- data/lib/{react → isomorfeus_react/react}/function_component/event_handler.rb +0 -0
- data/lib/{react → isomorfeus_react/react}/function_component/initializer.rb +0 -0
- data/lib/{react → isomorfeus_react/react}/function_component/mixin.rb +1 -1
- data/lib/{react → isomorfeus_react/react}/function_component/native_component_constructor.rb +0 -0
- data/lib/{react → isomorfeus_react/react}/function_component/resolution.rb +0 -0
- data/lib/{react → isomorfeus_react/react}/memo_component/base.rb +0 -0
- data/lib/{react → isomorfeus_react/react}/memo_component/mixin.rb +1 -1
- data/lib/{react → isomorfeus_react/react}/memo_component/native_component_constructor.rb +0 -0
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/app/base.rb +0 -0
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/app/mixin.rb +3 -3
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/app/native_component_constructor.rb +4 -3
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/component/base.rb +0 -0
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/component/mixin.rb +2 -3
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/component/native_component_constructor.rb +0 -0
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/func/base.rb +0 -0
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/func/mixin.rb +2 -2
- data/lib/{lucid_material → isomorfeus_react_material/lucid_material}/func/native_component_constructor.rb +0 -0
- data/lib/{lucid_component → lucid_app}/reducers.rb +1 -1
- data/lib/react.rb +10 -8
- data/lib/react/component/api.rb +1 -1
- data/lib/react/component/features.rb +10 -9
- data/lib/react/component/mixin.rb +1 -1
- data/lib/react/component/resolution.rb +2 -2
- data/lib/react/context_wrapper.rb +7 -6
- data/lib/react/version.rb +1 -1
- metadata +47 -51
- data/lib/lucid_component/preloading_support.rb +0 -34
- data/lib/lucid_material/func/initializer.rb +0 -21
- data/lib/react/active_support_support.rb +0 -13
- data/lib/react/component/unsafe_api.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02d3da5a8c0ad549bf3a6539a220e5d95479e9a21e99392a1a77b29139cb222d
|
4
|
+
data.tar.gz: aaa6f2e790085cb9bbd09b029e49d5394bcc7e5d12d27033d4bfdc7646617719
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6181f6153a988daf46595e245f57c81e460543dc6b9696099870f1122fad7e27c3f973c3848888849dd24abf490720888ea162a062d92437c2031d42721e7a20
|
7
|
+
data.tar.gz: 2cd1c6f37bb100ef10f0bf51801c25951ca4e0797576b9e5f4db28d3054ace409ec440c2e47368e692026572506e3e40cced5f19cf5293c2e0f8299244de6646
|
@@ -1,15 +1,4 @@
|
|
1
1
|
require 'isomorfeus-react'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require 'lucid_material/component/mixin'
|
6
|
-
require 'lucid_material/component/base'
|
7
|
-
# LucidMaterial::App
|
8
|
-
require 'lucid_material/app/native_component_constructor'
|
9
|
-
require 'lucid_material/app/mixin'
|
10
|
-
require 'lucid_material/app/base'
|
11
|
-
# LucidMaterial::Func
|
12
|
-
require 'lucid_material/func/initializer'
|
13
|
-
require 'lucid_material/func/native_component_constructor'
|
14
|
-
require 'lucid_material/func/mixin'
|
15
|
-
require 'lucid_material/func/base'
|
3
|
+
Isomorfeus.zeitwerk.push_dir('isomorfeus_react_material')
|
4
|
+
require_tree 'isomorfeus_react_material', :autoload
|
data/lib/isomorfeus-react.rb
CHANGED
@@ -2,7 +2,7 @@ if RUBY_ENGINE == 'opal'
|
|
2
2
|
# require 'opal'
|
3
3
|
# require 'native'
|
4
4
|
# require 'promise'
|
5
|
-
# rely on i-redux to have included above
|
5
|
+
# rely on i-redux to have included above requirements
|
6
6
|
require 'isomorfeus-redux'
|
7
7
|
require 'active_support/core_ext/string'
|
8
8
|
require 'zeitwerk'
|
@@ -50,21 +50,20 @@ if RUBY_ENGINE == 'opal'
|
|
50
50
|
require 'react/native_constant_wrapper'
|
51
51
|
|
52
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'
|
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
63
|
|
64
64
|
# React::Component
|
65
65
|
require 'react/component/api'
|
66
66
|
require 'react/component/callbacks'
|
67
|
-
# require 'react/component/unsafe_api'
|
68
67
|
require 'react/component/initializer'
|
69
68
|
require 'react/component/native_component_constructor'
|
70
69
|
require 'react/component/state'
|
@@ -78,48 +77,55 @@ if RUBY_ENGINE == 'opal'
|
|
78
77
|
require 'react/component/base'
|
79
78
|
|
80
79
|
# init component reducers
|
81
|
-
require '
|
82
|
-
|
80
|
+
require 'lucid_app/reducers'
|
81
|
+
LucidApp::Reducers.add_component_reducers_to_store
|
83
82
|
|
84
83
|
# init LucidApplicationContext (Store Provider and Consumer)
|
85
84
|
require 'lucid_app/context'
|
86
85
|
LucidApp::Context.create_application_context
|
87
86
|
|
88
87
|
# LucidFunc
|
89
|
-
require 'lucid_func/initializer'
|
90
|
-
require 'lucid_func/native_component_constructor'
|
91
|
-
require 'lucid_func/mixin'
|
92
|
-
require 'lucid_func/base'
|
88
|
+
#require 'lucid_func/initializer'
|
89
|
+
#require 'lucid_func/native_component_constructor'
|
90
|
+
#require 'lucid_func/mixin'
|
91
|
+
#require 'lucid_func/base'
|
93
92
|
|
94
93
|
# LucidComponent
|
95
|
-
require 'lucid_component/environment_support'
|
96
|
-
require 'lucid_component/api'
|
97
|
-
require 'lucid_component/app_store_defaults'
|
98
|
-
require 'lucid_component/component_class_store_defaults'
|
99
|
-
require 'lucid_component/component_instance_store_defaults'
|
100
|
-
require 'lucid_component/app_store_proxy'
|
101
|
-
require 'lucid_component/class_store_proxy'
|
102
|
-
require 'lucid_component/instance_store_proxy'
|
103
|
-
require 'lucid_component/initializer'
|
104
|
-
require 'lucid_component/native_lucid_component_constructor'
|
105
|
-
require 'lucid_component/native_component_constructor'
|
106
|
-
require 'lucid_component/
|
107
|
-
require 'lucid_component/
|
108
|
-
require 'lucid_component/base'
|
94
|
+
#require 'lucid_component/environment_support'
|
95
|
+
#require 'lucid_component/api'
|
96
|
+
#require 'lucid_component/app_store_defaults'
|
97
|
+
#require 'lucid_component/component_class_store_defaults'
|
98
|
+
#require 'lucid_component/component_instance_store_defaults'
|
99
|
+
#require 'lucid_component/app_store_proxy'
|
100
|
+
#require 'lucid_component/class_store_proxy'
|
101
|
+
#require 'lucid_component/instance_store_proxy'
|
102
|
+
#require 'lucid_component/initializer'
|
103
|
+
#require 'lucid_component/native_lucid_component_constructor'
|
104
|
+
#require 'lucid_component/native_component_constructor'
|
105
|
+
#require 'lucid_component/mixin'
|
106
|
+
#require 'lucid_component/base'
|
109
107
|
|
110
108
|
# LucidApp
|
111
|
-
require 'lucid_app/api'
|
112
|
-
require 'lucid_app/native_lucid_component_constructor'
|
113
|
-
require 'lucid_app/native_component_constructor'
|
114
|
-
require 'lucid_app/mixin'
|
115
|
-
require 'lucid_app/base'
|
109
|
+
#require 'lucid_app/api'
|
110
|
+
#require 'lucid_app/native_lucid_component_constructor'
|
111
|
+
#require 'lucid_app/native_component_constructor'
|
112
|
+
#require 'lucid_app/mixin'
|
113
|
+
#require 'lucid_app/base'
|
114
|
+
|
115
|
+
class Object
|
116
|
+
include React::Component::Resolution
|
117
|
+
end
|
116
118
|
|
117
|
-
require '
|
119
|
+
# require 'isomorfeus/vivify_module'
|
118
120
|
|
119
121
|
Isomorfeus.zeitwerk = Zeitwerk::Loader.new
|
122
|
+
# Isomorfeus.zeitwerk.vivify_mod_dir = 'components/'
|
123
|
+
# Isomorfeus.zeitwerk.vivify_mod_class = Isomorfeus::VivifyModule
|
124
|
+
|
125
|
+
Isomorfeus.zeitwerk.push_dir('isomorfeus_react')
|
126
|
+
require_tree 'isomorfeus_react', :autoload
|
127
|
+
|
120
128
|
Isomorfeus.zeitwerk.push_dir('components')
|
121
|
-
Isomorfeus.zeitwerk.vivify_mod_dir = 'components/'
|
122
|
-
Isomorfeus.zeitwerk.vivify_mod_class = React::VivifyModule
|
123
129
|
else
|
124
130
|
require 'oj'
|
125
131
|
require 'opal'
|
File without changes
|
@@ -9,10 +9,10 @@ module LucidApp
|
|
9
9
|
base.extend(::LucidComponent::EnvironmentSupport)
|
10
10
|
base.include(::LucidComponent::EnvironmentSupport)
|
11
11
|
base.include(::React::Component::Elements)
|
12
|
-
base.include(::React::Component::
|
12
|
+
base.include(::React::Component::Api)
|
13
13
|
base.include(::React::Component::Callbacks)
|
14
|
-
base.include(::LucidComponent::
|
15
|
-
base.include(::LucidApp::
|
14
|
+
base.include(::LucidComponent::Api)
|
15
|
+
base.include(::LucidApp::Api)
|
16
16
|
base.include(::LucidComponent::Initializer)
|
17
17
|
base.include(::React::Component::Features)
|
18
18
|
base.include(::React::Component::Resolution)
|
@@ -10,19 +10,20 @@ module LucidApp
|
|
10
10
|
%x{
|
11
11
|
base.jss_theme = {};
|
12
12
|
base.themed_react_component = function(props) {
|
13
|
+
let opag = Opal.global;
|
13
14
|
let classes = null;
|
14
|
-
let theme =
|
15
|
+
let theme = opag.ReactJSS.useTheme();
|
15
16
|
if (base.jss_styles) {
|
16
17
|
if (!base.use_styles || (Opal.Isomorfeus.development && Opal.Isomorfeus.development !== nil)) {
|
17
18
|
let styles;
|
18
19
|
if (typeof base.jss_styles === 'function') { styles = base.jss_styles(theme); }
|
19
20
|
else { styles = base.jss_styles; }
|
20
|
-
base.use_styles =
|
21
|
+
base.use_styles = opag.ReactJSS.createUseStyles(styles);
|
21
22
|
}
|
22
23
|
classes = base.use_styles();
|
23
24
|
}
|
24
25
|
let themed_classes_props = Object.assign({}, props, { classes: classes, theme: theme });
|
25
|
-
return
|
26
|
+
return opag.React.createElement(base.lucid_react_component, themed_classes_props);
|
26
27
|
}
|
27
28
|
base.themed_react_component.displayName = #{theme_component_name};
|
28
29
|
base.react_component = function(props) {
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module LucidComponent
|
2
|
-
module
|
2
|
+
module Api
|
3
3
|
def self.included(base)
|
4
4
|
base.instance_exec do
|
5
5
|
# store
|
@@ -62,8 +62,28 @@ module LucidComponent
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
alias_method :styles=, :styles
|
65
|
+
|
66
|
+
# preloading
|
67
|
+
def preload(&block)
|
68
|
+
`base.preload_block = block`
|
69
|
+
component_did_mount do
|
70
|
+
@_preload_promise.then { self.state.preloaded = true } unless self.state.preloaded
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def while_loading(option = nil, &block)
|
75
|
+
wl_block = proc do
|
76
|
+
if @_preload_promise.resolved?
|
77
|
+
instance_exec(&`base.render_block`)
|
78
|
+
else
|
79
|
+
instance_exec(&block)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
`base.while_loading_block = wl_block`
|
83
|
+
end
|
65
84
|
end
|
66
85
|
|
86
|
+
# styles
|
67
87
|
def styles
|
68
88
|
props.classes
|
69
89
|
end
|
@@ -71,6 +91,16 @@ module LucidComponent
|
|
71
91
|
def theme
|
72
92
|
props.theme
|
73
93
|
end
|
94
|
+
|
95
|
+
# preloading
|
96
|
+
def execute_preload_block
|
97
|
+
@_preload_promise = instance_exec(&self.class.JS[:preload_block])
|
98
|
+
@_preload_promise.resolved?
|
99
|
+
end
|
100
|
+
|
101
|
+
def preloaded?
|
102
|
+
!!state.preloaded
|
103
|
+
end
|
74
104
|
end
|
75
105
|
end
|
76
106
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/{lucid_component → isomorfeus_react/lucid_component}/component_class_store_defaults.rb
RENAMED
File without changes
|
data/lib/{lucid_component → isomorfeus_react/lucid_component}/component_instance_store_defaults.rb
RENAMED
File without changes
|
File without changes
|
@@ -2,11 +2,11 @@ module LucidComponent
|
|
2
2
|
module Initializer
|
3
3
|
def initialize(native_component)
|
4
4
|
@native = native_component
|
5
|
-
@app_store =
|
6
|
-
@class_store =
|
5
|
+
@app_store = LucidComponent::AppStoreProxy.new(self)
|
6
|
+
@class_store = LucidComponent::ClassStoreProxy.new(self)
|
7
7
|
@props = `Opal.React.Component.Props.$new(#@native)`
|
8
8
|
@state = `Opal.React.Component.State.$new(#@native)`
|
9
|
-
@store =
|
9
|
+
@store = LucidComponent::InstanceStoreProxy.new(self)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
File without changes
|
@@ -6,13 +6,12 @@ module LucidComponent
|
|
6
6
|
base.extend(::LucidComponent::NativeComponentConstructor)
|
7
7
|
base.extend(::LucidPropDeclaration::Mixin)
|
8
8
|
base.extend(::React::Component::EventHandler)
|
9
|
-
base.include(::LucidComponent::PreloadingSupport)
|
10
9
|
base.extend(::LucidComponent::EnvironmentSupport)
|
11
10
|
base.include(::LucidComponent::EnvironmentSupport)
|
12
11
|
base.include(::React::Component::Elements)
|
13
|
-
base.include(::React::Component::
|
12
|
+
base.include(::React::Component::Api)
|
14
13
|
base.include(::React::Component::Callbacks)
|
15
|
-
base.include(::LucidComponent::
|
14
|
+
base.include(::LucidComponent::Api)
|
16
15
|
base.include(::LucidComponent::Initializer)
|
17
16
|
base.include(::React::Component::Features)
|
18
17
|
base.include(::React::Component::Resolution)
|
data/lib/{lucid_component → isomorfeus_react/lucid_component}/native_component_constructor.rb
RENAMED
@@ -8,16 +8,17 @@ module LucidComponent
|
|
8
8
|
# language=JS
|
9
9
|
%x{
|
10
10
|
base.react_component = function(props) {
|
11
|
+
let opag = Opal.global;
|
11
12
|
let classes = null;
|
12
13
|
let store;
|
13
|
-
if (base.store_updates) { store =
|
14
|
-
let theme =
|
14
|
+
if (base.store_updates) { store = opag.React.useContext(opag.LucidApplicationContext); }
|
15
|
+
let theme = opag.ReactJSS.useTheme();
|
15
16
|
if (base.jss_styles) {
|
16
17
|
if (!base.use_styles || (Opal.Isomorfeus.development && Opal.Isomorfeus.development !== nil)) {
|
17
18
|
let styles;
|
18
19
|
if (typeof base.jss_styles === 'function') { styles = base.jss_styles(theme); }
|
19
20
|
else { styles = base.jss_styles; }
|
20
|
-
base.use_styles =
|
21
|
+
base.use_styles = opag.ReactJSS.createUseStyles(styles);
|
21
22
|
}
|
22
23
|
classes = base.use_styles();
|
23
24
|
}
|
@@ -25,7 +26,7 @@ module LucidComponent
|
|
25
26
|
new_props.classes = classes;
|
26
27
|
new_props.theme = theme;
|
27
28
|
new_props.store = store;
|
28
|
-
return
|
29
|
+
return opag.React.createElement(base.lucid_react_component, new_props);
|
29
30
|
}
|
30
31
|
base.react_component.displayName = #{component_name};
|
31
32
|
}
|
data/lib/{lucid_component → isomorfeus_react/lucid_component}/native_lucid_component_constructor.rb
RENAMED
File without changes
|
File without changes
|
@@ -3,9 +3,9 @@ module LucidFunc
|
|
3
3
|
def initialize
|
4
4
|
self.JS[:native_props] = `{ props: null }`
|
5
5
|
@native_props = `Opal.React.Component.Props.$new(#{self})`
|
6
|
-
@app_store =
|
7
|
-
@class_store =
|
8
|
-
@store =
|
6
|
+
@app_store = LucidComponent::AppStoreProxy.new(self)
|
7
|
+
@class_store = LucidComponent::ClassStoreProxy.new(self)
|
8
|
+
@store = LucidComponent::InstanceStoreProxy.new(self)
|
9
9
|
event_handlers = self.class.event_handlers
|
10
10
|
event_handler_source = self.class
|
11
11
|
%x{
|
@@ -4,13 +4,13 @@ module LucidFunc
|
|
4
4
|
base.include(::React::Component::Elements)
|
5
5
|
base.include(::React::Component::Features)
|
6
6
|
base.include(::LucidFunc::Initializer)
|
7
|
-
base.include(::React::FunctionComponent::
|
7
|
+
base.include(::React::FunctionComponent::Api)
|
8
8
|
base.include(::React::FunctionComponent::Resolution)
|
9
9
|
base.extend(::React::FunctionComponent::EventHandler)
|
10
10
|
base.extend(::LucidComponent::EnvironmentSupport)
|
11
11
|
base.include(::LucidComponent::EnvironmentSupport)
|
12
12
|
base.extend(::LucidFunc::NativeComponentConstructor)
|
13
|
-
base.include(::LucidComponent::
|
13
|
+
base.include(::LucidComponent::Api)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@ module React
|
|
5
5
|
base.include(::React::Component::Elements)
|
6
6
|
base.include(::React::Component::Features)
|
7
7
|
base.include(::React::FunctionComponent::Initializer)
|
8
|
-
base.include(::React::FunctionComponent::
|
8
|
+
base.include(::React::FunctionComponent::Api)
|
9
9
|
base.include(::React::FunctionComponent::Resolution)
|
10
10
|
base.extend(::React::FunctionComponent::EventHandler)
|
11
11
|
base.extend(::React::FunctionComponent::NativeComponentConstructor)
|
data/lib/{react → isomorfeus_react/react}/function_component/native_component_constructor.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@ module React
|
|
5
5
|
base.include(::React::Component::Elements)
|
6
6
|
base.include(::React::Component::Features)
|
7
7
|
base.include(::React::FunctionComponent::Initializer)
|
8
|
-
base.include(::React::FunctionComponent::
|
8
|
+
base.include(::React::FunctionComponent::Api)
|
9
9
|
base.include(::React::FunctionComponent::Resolution)
|
10
10
|
base.extend(::React::FunctionComponent::EventHandler)
|
11
11
|
base.extend(::React::MemoComponent::NativeComponentConstructor)
|
File without changes
|
File without changes
|
@@ -10,10 +10,10 @@ module LucidMaterial
|
|
10
10
|
base.extend(::LucidComponent::EnvironmentSupport)
|
11
11
|
base.include(::LucidComponent::EnvironmentSupport)
|
12
12
|
base.include(::React::Component::Elements)
|
13
|
-
base.include(::React::Component::
|
13
|
+
base.include(::React::Component::Api)
|
14
14
|
base.include(::React::Component::Callbacks)
|
15
|
-
base.include(::LucidComponent::
|
16
|
-
base.include(::LucidApp::
|
15
|
+
base.include(::LucidComponent::Api)
|
16
|
+
base.include(::LucidApp::Api)
|
17
17
|
base.include(::LucidComponent::Initializer)
|
18
18
|
base.include(::React::Component::Features)
|
19
19
|
base.include(::React::Component::Resolution)
|
@@ -11,19 +11,20 @@ module LucidMaterial
|
|
11
11
|
%x{
|
12
12
|
base.jss_theme = Opal.global.Mui.createMuiTheme();
|
13
13
|
base.themed_react_component = function(props) {
|
14
|
+
let opag = Opal.global;
|
14
15
|
let classes = null;
|
15
|
-
let theme =
|
16
|
+
let theme = opag.MuiStyles.useTheme();
|
16
17
|
if (base.jss_styles) {
|
17
18
|
if (!base.use_styles || (Opal.Isomorfeus.development && Opal.Isomorfeus.development !== nil)) {
|
18
19
|
let styles;
|
19
20
|
if (typeof base.jss_styles === 'function') { styles = base.jss_styles(theme); }
|
20
21
|
else { styles = base.jss_styles; }
|
21
|
-
base.use_styles =
|
22
|
+
base.use_styles = opag.MuiStyles.makeStyles(styles);
|
22
23
|
}
|
23
24
|
classes = base.use_styles();
|
24
25
|
}
|
25
26
|
let themed_classes_props = Object.assign({}, props, { classes: classes, theme: theme });
|
26
|
-
return
|
27
|
+
return opag.React.createElement(base.lucid_react_component, themed_classes_props);
|
27
28
|
}
|
28
29
|
base.themed_react_component.displayName = #{theme_component_name};
|
29
30
|
base.react_component = function(props) {
|
File without changes
|
@@ -7,13 +7,12 @@ module LucidMaterial
|
|
7
7
|
base.extend(::LucidMaterial::Component::NativeComponentConstructor)
|
8
8
|
base.extend(::LucidPropDeclaration::Mixin)
|
9
9
|
base.extend(::React::Component::EventHandler)
|
10
|
-
base.include(::LucidComponent::PreloadingSupport)
|
11
10
|
base.extend(::LucidComponent::EnvironmentSupport)
|
12
11
|
base.include(::LucidComponent::EnvironmentSupport)
|
13
12
|
base.include(::React::Component::Elements)
|
14
|
-
base.include(::React::Component::
|
13
|
+
base.include(::React::Component::Api)
|
15
14
|
base.include(::React::Component::Callbacks)
|
16
|
-
base.include(::LucidComponent::
|
15
|
+
base.include(::LucidComponent::Api)
|
17
16
|
base.include(::LucidComponent::Initializer)
|
18
17
|
base.include(::React::Component::Features)
|
19
18
|
base.include(::React::Component::Resolution)
|
File without changes
|
File without changes
|
@@ -5,13 +5,13 @@ module LucidMaterial
|
|
5
5
|
base.include(::React::Component::Elements)
|
6
6
|
base.include(::React::Component::Features)
|
7
7
|
base.include(::LucidFunc::Initializer)
|
8
|
-
base.include(::React::FunctionComponent::
|
8
|
+
base.include(::React::FunctionComponent::Api)
|
9
9
|
base.include(::React::FunctionComponent::Resolution)
|
10
10
|
base.extend(::React::FunctionComponent::EventHandler)
|
11
11
|
base.extend(::LucidComponent::EnvironmentSupport)
|
12
12
|
base.include(::LucidComponent::EnvironmentSupport)
|
13
13
|
base.extend(::LucidMaterial::Func::NativeComponentConstructor)
|
14
|
-
base.include(::LucidComponent::
|
14
|
+
base.include(::LucidComponent::Api)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
File without changes
|
data/lib/react.rb
CHANGED
@@ -62,34 +62,36 @@ module React
|
|
62
62
|
};
|
63
63
|
|
64
64
|
self.internal_prepare_args_and_render = function(component, args, block) {
|
65
|
+
let operain = Opal.React.internal_render;
|
65
66
|
if (args.length > 0) {
|
66
67
|
let last_arg = args[args.length - 1];
|
67
68
|
if (last_arg && last_arg.constructor === String) {
|
68
|
-
if (args.length === 1) { return
|
69
|
-
else {
|
70
|
-
} else {
|
71
|
-
} else {
|
69
|
+
if (args.length === 1) { return operain(component, null, last_arg, null); }
|
70
|
+
else { operain(component, args[0], last_arg, null); }
|
71
|
+
} else { operain(component, args[0], null, block); }
|
72
|
+
} else { operain(component, null, null, block); }
|
72
73
|
};
|
73
74
|
|
74
75
|
self.internal_render = function(component, props, string_child, block) {
|
76
|
+
let operabu = Opal.React.render_buffer;
|
75
77
|
let children;
|
76
78
|
let native_props = null;
|
77
79
|
if (string_child) {
|
78
80
|
children = string_child;
|
79
81
|
} else if (block && block !== nil) {
|
80
|
-
|
82
|
+
operabu.push([]);
|
81
83
|
// console.log("internal_render pushed", Opal.React.render_buffer, Opal.React.render_buffer.toString());
|
82
84
|
let block_result = block.$call();
|
83
85
|
if (block_result && (block_result.constructor === String || block_result.constructor === Number)) {
|
84
|
-
|
86
|
+
operabu[operabu.length - 1].push(block_result);
|
85
87
|
}
|
86
88
|
// console.log("internal_render popping", Opal.React.render_buffer, Opal.React.render_buffer.toString());
|
87
|
-
children =
|
89
|
+
children = operabu.pop();
|
88
90
|
if (children.length === 1) { children = children[0]; }
|
89
91
|
else if (children.length === 0) { children = null; }
|
90
92
|
}
|
91
93
|
if (props && props !== nil) { native_props = Opal.React.to_native_react_props(props); }
|
92
|
-
|
94
|
+
operabu[operabu.length - 1].push(Opal.global.React.createElement(component, native_props, children));
|
93
95
|
};
|
94
96
|
|
95
97
|
self.active_components = [];
|
data/lib/react/component/api.rb
CHANGED
@@ -14,20 +14,21 @@ module React
|
|
14
14
|
element = element_or_query
|
15
15
|
end
|
16
16
|
%x{
|
17
|
-
Opal.React.render_buffer
|
18
|
-
|
17
|
+
let operabu = Opal.React.render_buffer;
|
18
|
+
operabu.push([]);
|
19
|
+
// console.log("portal pushed", operabu, operabu.toString());
|
19
20
|
if (block !== nil) {
|
20
21
|
let block_result = block.$call()
|
21
|
-
let last_buffer_length =
|
22
|
-
let last_buffer_element =
|
22
|
+
let last_buffer_length = operabu[operabu.length - 1].length;
|
23
|
+
let last_buffer_element = operabu[operabu.length - 1][last_buffer_length - 1];
|
23
24
|
if (block_result && (block_result.constructor === String || block_result.constructor === Number)) {
|
24
|
-
|
25
|
+
operabu[operabu.length - 1].push(block_result);
|
25
26
|
}
|
26
27
|
}
|
27
|
-
// console.log("portal popping",
|
28
|
-
var react_element = Opal.global.React.createPortal(
|
29
|
-
|
30
|
-
// console.log("portal pushed",
|
28
|
+
// console.log("portal popping", operabu, operabu.toString());
|
29
|
+
var react_element = Opal.global.React.createPortal(operabu.pop(), element);
|
30
|
+
operabu[operabu.length - 1].push(react_element);
|
31
|
+
// console.log("portal pushed", operabu, operabu.toString());
|
31
32
|
}
|
32
33
|
end
|
33
34
|
|
@@ -7,7 +7,7 @@ module React
|
|
7
7
|
base.extend(::LucidPropDeclaration::Mixin)
|
8
8
|
base.extend(::React::Component::EventHandler)
|
9
9
|
base.include(::React::Component::Elements)
|
10
|
-
base.include(::React::Component::
|
10
|
+
base.include(::React::Component::Api)
|
11
11
|
base.include(::React::Component::Callbacks)
|
12
12
|
base.include(::React::Component::Initializer)
|
13
13
|
base.include(::React::Component::Features)
|
@@ -75,8 +75,8 @@ module React
|
|
75
75
|
if (component_type === "function" || component_type === "object") {
|
76
76
|
component = Opal.global[component_name];
|
77
77
|
} else {
|
78
|
-
var modules = self.$
|
79
|
-
var modules_length = modules.length
|
78
|
+
var modules = self.$to_s().split("::");
|
79
|
+
var modules_length = modules.length;
|
80
80
|
var module;
|
81
81
|
var constant;
|
82
82
|
for (var i = modules_length; i > 0; i--) {
|
@@ -9,6 +9,7 @@ module React
|
|
9
9
|
def Consumer(*args, &block)
|
10
10
|
# why not use internal_prepare_args and render?
|
11
11
|
%x{
|
12
|
+
let operabu = Opal.React.render_buffer;
|
12
13
|
let props = null;
|
13
14
|
|
14
15
|
if (args.length > 0) { props = Opal.React.to_native_react_props(args[0]); }
|
@@ -16,20 +17,20 @@ module React
|
|
16
17
|
let react_element = Opal.global.React.createElement(this.native.Consumer, props, function(value) {
|
17
18
|
let children = null;
|
18
19
|
if (block !== nil) {
|
19
|
-
|
20
|
-
// console.log("consumer pushed",
|
20
|
+
operabu.push([]);
|
21
|
+
// console.log("consumer pushed", operabu, operabu.toString());
|
21
22
|
let block_result = block.$call();
|
22
23
|
if (block_result && (block_result.constructor === String || block_result.constructor === Number)) {
|
23
|
-
|
24
|
+
operabu[operabu.length - 1].push(block_result);
|
24
25
|
}
|
25
|
-
// console.log("consumer popping",
|
26
|
-
children =
|
26
|
+
// console.log("consumer popping", operabu, operabu.toString());
|
27
|
+
children = operabu.pop();
|
27
28
|
if (children.length == 1) { children = children[0]; }
|
28
29
|
else if (children.length == 0) { children = null; }
|
29
30
|
}
|
30
31
|
return children;
|
31
32
|
});
|
32
|
-
|
33
|
+
operabu[operabu.length - 1].push(react_element);
|
33
34
|
}
|
34
35
|
end
|
35
36
|
|
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.12.
|
4
|
+
version: 16.12.5
|
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-12-
|
11
|
+
date: 2019-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.9.
|
89
|
+
version: 0.9.10
|
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: 0.9.
|
96
|
+
version: 0.9.10
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: isomorfeus-redux
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,44 +202,52 @@ files:
|
|
202
202
|
- lib/isomorfeus/react_view_helper.rb
|
203
203
|
- lib/isomorfeus/top_level.rb
|
204
204
|
- lib/isomorfeus/top_level_ssr.rb
|
205
|
-
- lib/
|
206
|
-
- lib/lucid_app/
|
205
|
+
- lib/isomorfeus/vivify_module.rb
|
206
|
+
- lib/isomorfeus_react/lucid_app/api.rb
|
207
|
+
- lib/isomorfeus_react/lucid_app/base.rb
|
208
|
+
- lib/isomorfeus_react/lucid_app/mixin.rb
|
209
|
+
- lib/isomorfeus_react/lucid_app/native_component_constructor.rb
|
210
|
+
- lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb
|
211
|
+
- lib/isomorfeus_react/lucid_component/api.rb
|
212
|
+
- lib/isomorfeus_react/lucid_component/app_store_defaults.rb
|
213
|
+
- lib/isomorfeus_react/lucid_component/app_store_proxy.rb
|
214
|
+
- lib/isomorfeus_react/lucid_component/base.rb
|
215
|
+
- lib/isomorfeus_react/lucid_component/class_store_proxy.rb
|
216
|
+
- lib/isomorfeus_react/lucid_component/component_class_store_defaults.rb
|
217
|
+
- lib/isomorfeus_react/lucid_component/component_instance_store_defaults.rb
|
218
|
+
- lib/isomorfeus_react/lucid_component/environment_support.rb
|
219
|
+
- lib/isomorfeus_react/lucid_component/initializer.rb
|
220
|
+
- lib/isomorfeus_react/lucid_component/instance_store_proxy.rb
|
221
|
+
- lib/isomorfeus_react/lucid_component/mixin.rb
|
222
|
+
- lib/isomorfeus_react/lucid_component/native_component_constructor.rb
|
223
|
+
- lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb
|
224
|
+
- lib/isomorfeus_react/lucid_func/base.rb
|
225
|
+
- lib/isomorfeus_react/lucid_func/initializer.rb
|
226
|
+
- lib/isomorfeus_react/lucid_func/mixin.rb
|
227
|
+
- lib/isomorfeus_react/lucid_func/native_component_constructor.rb
|
228
|
+
- lib/isomorfeus_react/react/function_component/api.rb
|
229
|
+
- lib/isomorfeus_react/react/function_component/base.rb
|
230
|
+
- lib/isomorfeus_react/react/function_component/event_handler.rb
|
231
|
+
- lib/isomorfeus_react/react/function_component/initializer.rb
|
232
|
+
- lib/isomorfeus_react/react/function_component/mixin.rb
|
233
|
+
- lib/isomorfeus_react/react/function_component/native_component_constructor.rb
|
234
|
+
- lib/isomorfeus_react/react/function_component/resolution.rb
|
235
|
+
- lib/isomorfeus_react/react/memo_component/base.rb
|
236
|
+
- lib/isomorfeus_react/react/memo_component/mixin.rb
|
237
|
+
- lib/isomorfeus_react/react/memo_component/native_component_constructor.rb
|
238
|
+
- lib/isomorfeus_react_material/lucid_material/app/base.rb
|
239
|
+
- lib/isomorfeus_react_material/lucid_material/app/mixin.rb
|
240
|
+
- lib/isomorfeus_react_material/lucid_material/app/native_component_constructor.rb
|
241
|
+
- lib/isomorfeus_react_material/lucid_material/component/base.rb
|
242
|
+
- lib/isomorfeus_react_material/lucid_material/component/mixin.rb
|
243
|
+
- lib/isomorfeus_react_material/lucid_material/component/native_component_constructor.rb
|
244
|
+
- lib/isomorfeus_react_material/lucid_material/func/base.rb
|
245
|
+
- lib/isomorfeus_react_material/lucid_material/func/mixin.rb
|
246
|
+
- lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb
|
207
247
|
- lib/lucid_app/context.rb
|
208
|
-
- lib/lucid_app/
|
209
|
-
- lib/lucid_app/native_component_constructor.rb
|
210
|
-
- lib/lucid_app/native_lucid_component_constructor.rb
|
211
|
-
- lib/lucid_component/api.rb
|
212
|
-
- lib/lucid_component/app_store_defaults.rb
|
213
|
-
- lib/lucid_component/app_store_proxy.rb
|
214
|
-
- lib/lucid_component/base.rb
|
215
|
-
- lib/lucid_component/class_store_proxy.rb
|
216
|
-
- lib/lucid_component/component_class_store_defaults.rb
|
217
|
-
- lib/lucid_component/component_instance_store_defaults.rb
|
218
|
-
- lib/lucid_component/environment_support.rb
|
219
|
-
- lib/lucid_component/initializer.rb
|
220
|
-
- lib/lucid_component/instance_store_proxy.rb
|
221
|
-
- lib/lucid_component/mixin.rb
|
222
|
-
- lib/lucid_component/native_component_constructor.rb
|
223
|
-
- lib/lucid_component/native_lucid_component_constructor.rb
|
224
|
-
- lib/lucid_component/preloading_support.rb
|
225
|
-
- lib/lucid_component/reducers.rb
|
226
|
-
- lib/lucid_func/base.rb
|
227
|
-
- lib/lucid_func/initializer.rb
|
228
|
-
- lib/lucid_func/mixin.rb
|
229
|
-
- lib/lucid_func/native_component_constructor.rb
|
230
|
-
- lib/lucid_material/app/base.rb
|
231
|
-
- lib/lucid_material/app/mixin.rb
|
232
|
-
- lib/lucid_material/app/native_component_constructor.rb
|
233
|
-
- lib/lucid_material/component/base.rb
|
234
|
-
- lib/lucid_material/component/mixin.rb
|
235
|
-
- lib/lucid_material/component/native_component_constructor.rb
|
236
|
-
- lib/lucid_material/func/base.rb
|
237
|
-
- lib/lucid_material/func/initializer.rb
|
238
|
-
- lib/lucid_material/func/mixin.rb
|
239
|
-
- lib/lucid_material/func/native_component_constructor.rb
|
248
|
+
- lib/lucid_app/reducers.rb
|
240
249
|
- lib/lucid_prop_declaration/mixin.rb
|
241
250
|
- lib/react.rb
|
242
|
-
- lib/react/active_support_support.rb
|
243
251
|
- lib/react/children.rb
|
244
252
|
- lib/react/component/api.rb
|
245
253
|
- lib/react/component/base.rb
|
@@ -257,23 +265,11 @@ files:
|
|
257
265
|
- lib/react/component/resolution.rb
|
258
266
|
- lib/react/component/state.rb
|
259
267
|
- lib/react/component/styles.rb
|
260
|
-
- lib/react/component/unsafe_api.rb
|
261
268
|
- lib/react/context_wrapper.rb
|
262
|
-
- lib/react/function_component/api.rb
|
263
|
-
- lib/react/function_component/base.rb
|
264
|
-
- lib/react/function_component/event_handler.rb
|
265
|
-
- lib/react/function_component/initializer.rb
|
266
|
-
- lib/react/function_component/mixin.rb
|
267
|
-
- lib/react/function_component/native_component_constructor.rb
|
268
|
-
- lib/react/function_component/resolution.rb
|
269
|
-
- lib/react/memo_component/base.rb
|
270
|
-
- lib/react/memo_component/mixin.rb
|
271
|
-
- lib/react/memo_component/native_component_constructor.rb
|
272
269
|
- lib/react/native_constant_wrapper.rb
|
273
270
|
- lib/react/ref.rb
|
274
271
|
- lib/react/synthetic_event.rb
|
275
272
|
- lib/react/version.rb
|
276
|
-
- lib/react/vivify_module.rb
|
277
273
|
- lib/react_dom.rb
|
278
274
|
- lib/react_dom_server.rb
|
279
275
|
homepage: http://isomorfeus.com
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module LucidComponent
|
2
|
-
module PreloadingSupport
|
3
|
-
def self.included(base)
|
4
|
-
base.instance_exec do
|
5
|
-
def preload(&block)
|
6
|
-
`base.preload_block = block`
|
7
|
-
component_did_mount do
|
8
|
-
@_preload_promise.then { self.state.preloaded = true } unless self.state.preloaded
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def while_loading(option = nil, &block)
|
13
|
-
wl_block = proc do
|
14
|
-
if @_preload_promise.resolved?
|
15
|
-
instance_exec(&`base.render_block`)
|
16
|
-
else
|
17
|
-
instance_exec(&block)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
`base.while_loading_block = wl_block`
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def execute_preload_block
|
25
|
-
@_preload_promise = instance_exec(&self.class.JS[:preload_block])
|
26
|
-
@_preload_promise.resolved?
|
27
|
-
end
|
28
|
-
|
29
|
-
def preloaded?
|
30
|
-
!!state.preloaded
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module LucidMaterial
|
2
|
-
module Func
|
3
|
-
module Initializer
|
4
|
-
def initialize
|
5
|
-
self.JS[:native_props] = `{ props: null }`
|
6
|
-
@native_props = `Opal.React.Component.Props.$new(#{self})`
|
7
|
-
@app_store = `Opal.LucidComponent.AppStoreProxy.$new(#{self})`
|
8
|
-
@class_store = `Opal.LucidComponent.ClassStoreProxy.$new(#{self})`
|
9
|
-
@store = `Opal.LucidComponent.InstanceStoreProxy.$new(#{self})`
|
10
|
-
event_handlers = self.class.event_handlers
|
11
|
-
event_handler_source = self.class
|
12
|
-
%x{
|
13
|
-
for (var i = 0; i < event_handlers.length; i++) {
|
14
|
-
self[event_handlers[i]] = event_handler_source[event_handlers[i]];
|
15
|
-
self[event_handlers[i]] = self[event_handlers[i]].bind(self);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
module UnsafeAPI
|
4
|
-
def self.included(base)
|
5
|
-
base.instance_exec do
|
6
|
-
def unsafe_component_will_mount(&block)
|
7
|
-
%x{
|
8
|
-
self.react_component.prototype.UNSAFE_componentWillMount = function() {
|
9
|
-
return #{`this.__ruby_instance`.instance_exec(&block)};
|
10
|
-
}
|
11
|
-
}
|
12
|
-
end
|
13
|
-
|
14
|
-
def unsafe_component_will_receive_props(&block)
|
15
|
-
%x{
|
16
|
-
self.react_component.prototype.UNSAFE_componentWillReceiveProps = function(next_props) {
|
17
|
-
return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), &block)};
|
18
|
-
}
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
def unsafe_component_will_update(&block)
|
23
|
-
%x{
|
24
|
-
self.react_component.prototype.UNSAFE_componentWillUpdate = function(next_props, next_state) {
|
25
|
-
return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), `Opal.Hash.$new(next_state)`, &block)};
|
26
|
-
}
|
27
|
-
}
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|