isomorfeus-react 16.13.6 → 16.13.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -10
- data/lib/isomorfeus-react-native.rb +5 -0
- data/lib/isomorfeus-react-paper.rb +4 -0
- data/lib/isomorfeus-react.rb +9 -7
- data/lib/isomorfeus/props/validator.rb +2 -2
- data/lib/isomorfeus/{react_config.rb → react/config.rb} +1 -1
- data/lib/isomorfeus/react/memcached_component_cache.rb +19 -0
- data/lib/isomorfeus/react/redis_component_cache.rb +19 -0
- data/lib/isomorfeus/{thread_local_component_cache.rb → react/thread_local_component_cache.rb} +0 -0
- data/lib/isomorfeus/top_level.rb +0 -7
- data/lib/isomorfeus_react/lucid_app/mixin.rb +8 -2
- data/lib/isomorfeus_react/lucid_app/native_component_constructor.rb +18 -7
- data/lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb +1 -2
- data/lib/isomorfeus_react/lucid_component/api.rb +0 -27
- data/lib/isomorfeus_react/lucid_component/mixin.rb +8 -2
- data/lib/isomorfeus_react/lucid_component/native_component_constructor.rb +4 -4
- data/lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb +4 -28
- data/lib/isomorfeus_react/lucid_component/styles_api.rb +34 -0
- data/lib/isomorfeus_react/lucid_func/mixin.rb +8 -2
- data/lib/isomorfeus_react/lucid_func/native_component_constructor.rb +3 -4
- data/lib/isomorfeus_react/react/function_component/api.rb +7 -6
- data/lib/isomorfeus_react/react/function_component/mixin.rb +5 -1
- data/lib/isomorfeus_react/react/function_component/native_component_constructor.rb +3 -2
- data/lib/isomorfeus_react/react/memo_component/mixin.rb +5 -1
- data/lib/isomorfeus_react/react/memo_component/native_component_constructor.rb +2 -3
- data/lib/isomorfeus_react_material/lucid_material/app/mixin.rb +1 -0
- data/lib/isomorfeus_react_material/lucid_material/app/native_component_constructor.rb +17 -6
- data/lib/isomorfeus_react_material/lucid_material/component/mixin.rb +1 -0
- data/lib/isomorfeus_react_material/lucid_material/component/native_component_constructor.rb +3 -3
- data/lib/isomorfeus_react_material/lucid_material/func/mixin.rb +1 -0
- data/lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb +3 -4
- data/lib/isomorfeus_react_paper/lucid_paper/app/base.rb +9 -0
- data/lib/isomorfeus_react_paper/lucid_paper/app/mixin.rb +19 -0
- data/lib/isomorfeus_react_paper/lucid_paper/app/native_component_constructor.rb +32 -0
- data/lib/isomorfeus_react_paper/lucid_paper/component/base.rb +9 -0
- data/lib/isomorfeus_react_paper/lucid_paper/component/mixin.rb +18 -0
- data/lib/isomorfeus_react_paper/lucid_paper/component/native_component_constructor.rb +25 -0
- data/lib/isomorfeus_react_paper/lucid_paper/func/base.rb +9 -0
- data/lib/isomorfeus_react_paper/lucid_paper/func/mixin.rb +14 -0
- data/lib/isomorfeus_react_paper/lucid_paper/func/native_component_constructor.rb +71 -0
- data/lib/react.rb +159 -97
- data/lib/react/component/api.rb +5 -4
- data/lib/react/component/features.rb +1 -3
- data/lib/react/component/mixin.rb +5 -1
- data/lib/react/component/native_component_constructor.rb +4 -28
- data/lib/react/component/props.rb +4 -3
- data/lib/react/component/resolution.rb +47 -63
- data/lib/react/component/state.rb +4 -2
- data/lib/react/component/styles.rb +2 -23
- data/lib/react/context_wrapper.rb +3 -5
- data/lib/react/native_constant_wrapper.rb +0 -1
- data/lib/react/version.rb +1 -1
- data/lib/react_native/component/elements.rb +203 -0
- data/lib/react_native/lucid_app/react_native_component_constructor.rb +51 -0
- data/lib/react_native/lucid_component/react_native_component_constructor.rb +37 -0
- data/lib/react_native/lucid_func/react_native_component_constructor.rb +82 -0
- data/lib/react_native/react.rb +120 -0
- metadata +69 -23
- data/lib/isomorfeus/vivify_module.rb +0 -43
@@ -0,0 +1,120 @@
|
|
1
|
+
module React
|
2
|
+
%x{
|
3
|
+
self.prop_dictionary = {
|
4
|
+
on_click: 'onPress',
|
5
|
+
onClick: 'onPress',
|
6
|
+
on_touch: 'onPress',
|
7
|
+
onTouch: 'onPress',
|
8
|
+
on_change: 'onChangeText',
|
9
|
+
onChange: 'onChangeText',
|
10
|
+
on_blur: 'onSubmitText',
|
11
|
+
onBlur: 'onSubmitText',
|
12
|
+
};
|
13
|
+
|
14
|
+
self.to_native_react_props = function(ruby_style_props) {
|
15
|
+
let result = {};
|
16
|
+
let keys = ruby_style_props.$$keys;
|
17
|
+
let keys_length = keys.length;
|
18
|
+
let key = '';
|
19
|
+
for (let i = 0; i < keys_length; i++) {
|
20
|
+
key = keys[i];
|
21
|
+
let value = ruby_style_props.$$smap[key];
|
22
|
+
if (key[0] === 'o' && key[1] === 'n' && key[2] === '_') {
|
23
|
+
let type = typeof value;
|
24
|
+
if (type === "function") {
|
25
|
+
let active_c = self.active_component();
|
26
|
+
result[self.lower_camelize(key)] = function(event, info) {
|
27
|
+
let ruby_event = self.native_to_ruby_event(event);
|
28
|
+
#{`active_c.__ruby_instance`.instance_exec(`ruby_event`, `info`, &`value`)};
|
29
|
+
}
|
30
|
+
} else if (type === "object" && typeof value.$call === "function" ) {
|
31
|
+
if (!value.react_event_handler_function) {
|
32
|
+
value.react_event_handler_function = function(event, info) {
|
33
|
+
let ruby_event = self.native_to_ruby_event(event);
|
34
|
+
value.$call(ruby_event, info)
|
35
|
+
};
|
36
|
+
}
|
37
|
+
result[self.lower_camelize(key)] = value.react_event_handler_function;
|
38
|
+
} else if (type === "string" ) {
|
39
|
+
let active_component = self.active_component();
|
40
|
+
let method_ref;
|
41
|
+
let method_name = '$' + value;
|
42
|
+
if (typeof active_component[method_name] === "function") {
|
43
|
+
// got a ruby instance
|
44
|
+
if (active_component.native && active_component.native.method_refs && active_component.native.method_refs[value]) { method_ref = active_component.native.method_refs[value]; } // ruby instance with native
|
45
|
+
else if (active_component.method_refs && active_component.method_refs[value]) { method_ref = active_component.method_refs[value]; } // ruby function component
|
46
|
+
else { method_ref = active_component.$method_ref(value); } // create the ref
|
47
|
+
} else if (typeof active_component.__ruby_instance[method_name] === "function") {
|
48
|
+
// got a native instance
|
49
|
+
if (active_component.method_refs && active_component.method_refs[value]) { method_ref = active_component.method_refs[value]; }
|
50
|
+
else { method_ref = active_component.__ruby_instance.$method_ref(value); } // create ref for native
|
51
|
+
}
|
52
|
+
if (method_ref) {
|
53
|
+
if (!method_ref.react_event_handler_function) {
|
54
|
+
method_ref.react_event_handler_function = function(event, info) {
|
55
|
+
let ruby_event = self.native_to_ruby_event(event);
|
56
|
+
method_ref.$call(ruby_event, info)
|
57
|
+
};
|
58
|
+
}
|
59
|
+
result[self.lower_camelize(key)] = method_ref.react_event_handler_function;
|
60
|
+
} else {
|
61
|
+
let component_name;
|
62
|
+
if (active_component.__ruby_instance) { component_name = active_component.__ruby_instance.$to_s(); }
|
63
|
+
else { component_name = active_component.$to_s(); }
|
64
|
+
#{Isomorfeus.raise_error(message: "Is #{`value`} a valid method of #{`component_name`}? If so then please use: #{`key`}: method_ref(:#{`value`}) within component: #{`component_name`}")}
|
65
|
+
}
|
66
|
+
} else {
|
67
|
+
let active_component = self.active_component();
|
68
|
+
let component_name;
|
69
|
+
if (active_component.__ruby_instance) { component_name = active_component.__ruby_instance.$to_s(); }
|
70
|
+
else { component_name = active_component.$to_s(); }
|
71
|
+
#{Isomorfeus.raise_error(message: "Received invalid value for #{`key`} with #{`value`} within component: #{`component_name`}")}
|
72
|
+
console.error( + key + " event handler:", value, " within component:", self.active_component());
|
73
|
+
}
|
74
|
+
} else if (key[0] === 'a' && key.startsWith("aria_")) {
|
75
|
+
result[key.replace("_", "-")] = value;
|
76
|
+
} else if (key === "style" || key === "theme") {
|
77
|
+
if (typeof value.$to_n === "function") { value = value.$to_n() }
|
78
|
+
result[key] = value;
|
79
|
+
} else {
|
80
|
+
result[self.lower_camelize(key)] = value;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
return result;
|
84
|
+
};
|
85
|
+
|
86
|
+
self.render_block_result = function(block_result, component) {
|
87
|
+
if (block_result.constructor === String || block_result.constructor === Number) {
|
88
|
+
if (component && component === Opal.global.Text) {
|
89
|
+
self.render_buffer[self.render_buffer.length - 1].push(block_result);
|
90
|
+
} else {
|
91
|
+
self.render_buffer[self.render_buffer.length - 1].push(Opal.global.React.createElement(Opal.global.Text, {}, block_result));
|
92
|
+
}
|
93
|
+
}
|
94
|
+
};
|
95
|
+
|
96
|
+
self.internal_render = function(component, props, string_child, block) {
|
97
|
+
const operabu = self.render_buffer;
|
98
|
+
let native_props;
|
99
|
+
if (props && props !== nil) { native_props = self.to_native_react_props(props); }
|
100
|
+
if (string_child) {
|
101
|
+
if (component && component === Opal.global.Text) {
|
102
|
+
operabu[operabu.length - 1].push(Opal.global.React.createElement(component, native_props, string_child));
|
103
|
+
} else {
|
104
|
+
let child = [Opal.global.React.createElement(Opal.global.Text, {}, string_child)];
|
105
|
+
operabu[operabu.length - 1].push(Opal.global.React.createElement(component, native_props, child));
|
106
|
+
}
|
107
|
+
} else if (block && block !== nil) {
|
108
|
+
operabu.push([]);
|
109
|
+
// console.log("internal_render pushed", Opal.React.render_buffer, Opal.React.render_buffer.toString());
|
110
|
+
let block_result = block.$call();
|
111
|
+
if (block_result && block_result !== nil) { Opal.React.render_block_result(block_result, component); }
|
112
|
+
// console.log("internal_render popping", Opal.React.render_buffer, Opal.React.render_buffer.toString());
|
113
|
+
let children = operabu.pop();
|
114
|
+
operabu[operabu.length - 1].push(Opal.global.React.createElement.apply(this, [component, native_props].concat(children)));
|
115
|
+
} else {
|
116
|
+
operabu[operabu.length - 1].push(Opal.global.React.createElement(component, native_props));
|
117
|
+
}
|
118
|
+
};
|
119
|
+
}
|
120
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-react
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 16.13.
|
4
|
+
version: 16.13.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-16 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.8
|
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.8
|
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: 3.
|
33
|
+
version: 3.11.0
|
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: 3.
|
40
|
+
version: 3.11.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: opal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,70 +86,98 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.10.1
|
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.
|
96
|
+
version: 0.10.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: isomorfeus-redux
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 4.
|
103
|
+
version: 4.1.1
|
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.
|
110
|
+
version: 4.1.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: isomorfeus-speednode
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.3.1
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.3.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: dalli
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.7.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.7.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: redis
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 4.2.0
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 4.2.0
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: zeitwerk
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
157
|
- - "~>"
|
130
158
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.
|
159
|
+
version: 2.4.2
|
132
160
|
type: :runtime
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
135
163
|
requirements:
|
136
164
|
- - "~>"
|
137
165
|
- !ruby/object:Gem::Version
|
138
|
-
version: 2.
|
166
|
+
version: 2.4.2
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: isomorfeus-puppetmaster
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
142
170
|
requirements:
|
143
171
|
- - "~>"
|
144
172
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
173
|
+
version: 0.4.0
|
146
174
|
type: :development
|
147
175
|
prerelease: false
|
148
176
|
version_requirements: !ruby/object:Gem::Requirement
|
149
177
|
requirements:
|
150
178
|
- - "~>"
|
151
179
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
180
|
+
version: 0.4.0
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: rake
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -195,15 +223,18 @@ files:
|
|
195
223
|
- lib/browser/file_list.rb
|
196
224
|
- lib/browser/iterable.rb
|
197
225
|
- lib/isomorfeus-react-material-ui.rb
|
226
|
+
- lib/isomorfeus-react-native.rb
|
227
|
+
- lib/isomorfeus-react-paper.rb
|
198
228
|
- lib/isomorfeus-react.rb
|
199
229
|
- lib/isomorfeus/props/validate_hash_proxy.rb
|
200
230
|
- lib/isomorfeus/props/validator.rb
|
201
|
-
- lib/isomorfeus/
|
231
|
+
- lib/isomorfeus/react/config.rb
|
232
|
+
- lib/isomorfeus/react/memcached_component_cache.rb
|
233
|
+
- lib/isomorfeus/react/redis_component_cache.rb
|
234
|
+
- lib/isomorfeus/react/thread_local_component_cache.rb
|
202
235
|
- lib/isomorfeus/react_view_helper.rb
|
203
|
-
- lib/isomorfeus/thread_local_component_cache.rb
|
204
236
|
- lib/isomorfeus/top_level.rb
|
205
237
|
- lib/isomorfeus/top_level_ssr.rb
|
206
|
-
- lib/isomorfeus/vivify_module.rb
|
207
238
|
- lib/isomorfeus_react/lucid_app/api.rb
|
208
239
|
- lib/isomorfeus_react/lucid_app/base.rb
|
209
240
|
- lib/isomorfeus_react/lucid_app/mixin.rb
|
@@ -218,6 +249,7 @@ files:
|
|
218
249
|
- lib/isomorfeus_react/lucid_component/mixin.rb
|
219
250
|
- lib/isomorfeus_react/lucid_component/native_component_constructor.rb
|
220
251
|
- lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb
|
252
|
+
- lib/isomorfeus_react/lucid_component/styles_api.rb
|
221
253
|
- lib/isomorfeus_react/lucid_func/base.rb
|
222
254
|
- lib/isomorfeus_react/lucid_func/initializer.rb
|
223
255
|
- lib/isomorfeus_react/lucid_func/mixin.rb
|
@@ -239,6 +271,15 @@ files:
|
|
239
271
|
- lib/isomorfeus_react_material/lucid_material/func/base.rb
|
240
272
|
- lib/isomorfeus_react_material/lucid_material/func/mixin.rb
|
241
273
|
- lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb
|
274
|
+
- lib/isomorfeus_react_paper/lucid_paper/app/base.rb
|
275
|
+
- lib/isomorfeus_react_paper/lucid_paper/app/mixin.rb
|
276
|
+
- lib/isomorfeus_react_paper/lucid_paper/app/native_component_constructor.rb
|
277
|
+
- lib/isomorfeus_react_paper/lucid_paper/component/base.rb
|
278
|
+
- lib/isomorfeus_react_paper/lucid_paper/component/mixin.rb
|
279
|
+
- lib/isomorfeus_react_paper/lucid_paper/component/native_component_constructor.rb
|
280
|
+
- lib/isomorfeus_react_paper/lucid_paper/func/base.rb
|
281
|
+
- lib/isomorfeus_react_paper/lucid_paper/func/mixin.rb
|
282
|
+
- lib/isomorfeus_react_paper/lucid_paper/func/native_component_constructor.rb
|
242
283
|
- lib/lucid_app/context.rb
|
243
284
|
- lib/lucid_prop_declaration/mixin.rb
|
244
285
|
- lib/react.rb
|
@@ -265,12 +306,17 @@ files:
|
|
265
306
|
- lib/react/version.rb
|
266
307
|
- lib/react_dom.rb
|
267
308
|
- lib/react_dom_server.rb
|
309
|
+
- lib/react_native/component/elements.rb
|
310
|
+
- lib/react_native/lucid_app/react_native_component_constructor.rb
|
311
|
+
- lib/react_native/lucid_component/react_native_component_constructor.rb
|
312
|
+
- lib/react_native/lucid_func/react_native_component_constructor.rb
|
313
|
+
- lib/react_native/react.rb
|
268
314
|
homepage: http://isomorfeus.com
|
269
315
|
licenses:
|
270
316
|
- MIT
|
271
317
|
metadata:
|
272
318
|
github_repo: ssh://github.com/isomorfeus/gems
|
273
|
-
post_install_message:
|
319
|
+
post_install_message:
|
274
320
|
rdoc_options: []
|
275
321
|
require_paths:
|
276
322
|
- lib
|
@@ -285,8 +331,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
331
|
- !ruby/object:Gem::Version
|
286
332
|
version: '0'
|
287
333
|
requirements: []
|
288
|
-
rubygems_version: 3.
|
289
|
-
signing_key:
|
334
|
+
rubygems_version: 3.2.15
|
335
|
+
signing_key:
|
290
336
|
specification_version: 4
|
291
337
|
summary: React for Opal Ruby.
|
292
338
|
test_files: []
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Isomorfeus
|
2
|
-
class VivifyModule < ::Module
|
3
|
-
# this is required for autoloading support, as the component may not be loaded and so its method is not registered.
|
4
|
-
# must load it first, done by const_get, and next time the method will be there.
|
5
|
-
alias _react_component_class_resolution_original_method_missing method_missing
|
6
|
-
|
7
|
-
def method_missing(component_name, *args, &block)
|
8
|
-
# check for ruby component and render it
|
9
|
-
# otherwise pass on method missing
|
10
|
-
# language=JS
|
11
|
-
%x{
|
12
|
-
var constant;
|
13
|
-
var component = null;
|
14
|
-
var modules = self.$to_s().split("::");
|
15
|
-
var modules_length = modules.length;
|
16
|
-
var module;
|
17
|
-
for (var i = modules_length; i > 0; i--) {
|
18
|
-
try {
|
19
|
-
module = modules.slice(0, i).join('::');
|
20
|
-
constant = self.$const_get(module).$const_get(component_name, false);
|
21
|
-
if (typeof constant.react_component !== 'undefined') {
|
22
|
-
component = constant.react_component;
|
23
|
-
break;
|
24
|
-
}
|
25
|
-
} catch(err) { component = null; }
|
26
|
-
}
|
27
|
-
if (!component) {
|
28
|
-
try {
|
29
|
-
constant = Opal.Object.$const_get(component_name);
|
30
|
-
if (typeof constant.react_component !== 'undefined') {
|
31
|
-
component = constant.react_component;
|
32
|
-
}
|
33
|
-
} catch(err) { component = null; }
|
34
|
-
}
|
35
|
-
if (component) {
|
36
|
-
return Opal.React.internal_prepare_args_and_render(component, args, block);
|
37
|
-
} else {
|
38
|
-
return #{_react_component_class_resolution_original_method_missing(component_name, *args, block)};
|
39
|
-
}
|
40
|
-
}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|