isomorfeus-react 16.12.20 → 16.12.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/react.rb +18 -18
- data/lib/react/component/props.rb +1 -1
- data/lib/react/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 862c5e06934e7400c6bbceb223bd1416d67d70146f24ddacb52db37b283c847e
|
4
|
+
data.tar.gz: a39f94af34ac6c1be06fb2a0fbffffb05f0246935e9b749617393502ff7fee6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35e5f07086721a4c5ead02af666864b5c4010c5f18a75f84efb7e0cff35ffe30f31b4303d7d67c46b08567e442faaca347cc89f739a9d766fb05d0311fb8965e
|
7
|
+
data.tar.gz: 863cd04d954af576d63dab83c49e6f593373f8bfc01357aa6595e6974417e5d837c99a5827a11c31e967707dc76992f1f4079c24c62cbc3da81a0cd262409da6
|
data/lib/react.rb
CHANGED
@@ -46,20 +46,20 @@ module React
|
|
46
46
|
let type = typeof handler;
|
47
47
|
if (type === "function") {
|
48
48
|
let active_c = self.active_component();
|
49
|
-
result[
|
50
|
-
let ruby_event =
|
49
|
+
result[self.lower_camelize(key)] = function(event, info) {
|
50
|
+
let ruby_event = self.native_to_ruby_event(event);
|
51
51
|
#{`active_c.__ruby_instance`.instance_exec(`ruby_event`, `info`, &`handler`)};
|
52
52
|
}
|
53
53
|
} else if (type === "object" && typeof handler.$call === "function" ) {
|
54
54
|
if (!handler.react_event_handler_function) {
|
55
55
|
handler.react_event_handler_function = function(event, info) {
|
56
|
-
let ruby_event =
|
56
|
+
let ruby_event = self.native_to_ruby_event(event);
|
57
57
|
handler.$call(ruby_event, info)
|
58
58
|
};
|
59
59
|
}
|
60
|
-
result[
|
60
|
+
result[self.lower_camelize(key)] = handler.react_event_handler_function;
|
61
61
|
} else if (type === "string" ) {
|
62
|
-
let active_component =
|
62
|
+
let active_component = self.active_component();
|
63
63
|
let method_ref;
|
64
64
|
let method_name = '$' + handler;
|
65
65
|
if (typeof active_component[method_name] === "function") {
|
@@ -75,11 +75,11 @@ module React
|
|
75
75
|
if (method_ref) {
|
76
76
|
if (!method_ref.react_event_handler_function) {
|
77
77
|
method_ref.react_event_handler_function = function(event, info) {
|
78
|
-
let ruby_event =
|
78
|
+
let ruby_event = self.native_to_ruby_event(event);
|
79
79
|
method_ref.$call(ruby_event, info)
|
80
80
|
};
|
81
81
|
}
|
82
|
-
result[
|
82
|
+
result[self.lower_camelize(key)] = method_ref.react_event_handler_function;
|
83
83
|
} else {
|
84
84
|
let component_name;
|
85
85
|
if (active_component.__ruby_instance) { component_name = active_component.__ruby_instance.$to_s(); }
|
@@ -87,7 +87,7 @@ module React
|
|
87
87
|
#{Isomorfeus.raise_error(message: "Is #{`handler`} a valid method of #{`component_name`}? If so then please use: #{`key`}: method_ref(:#{`handler`}) within component: #{`component_name`}")}
|
88
88
|
}
|
89
89
|
} else {
|
90
|
-
let active_component =
|
90
|
+
let active_component = self.active_component();
|
91
91
|
let component_name;
|
92
92
|
if (active_component.__ruby_instance) { component_name = active_component.__ruby_instance.$to_s(); }
|
93
93
|
else { component_name = active_component.$to_s(); }
|
@@ -101,14 +101,14 @@ module React
|
|
101
101
|
if (typeof val.$to_n === "function") { val = val.$to_n() }
|
102
102
|
result["style"] = val;
|
103
103
|
} else {
|
104
|
-
result[key.indexOf('_') > 0 ?
|
104
|
+
result[key.indexOf('_') > 0 ? self.lower_camelize(key) : key] = ruby_style_props['$[]'](key);
|
105
105
|
}
|
106
106
|
}
|
107
107
|
return result;
|
108
108
|
};
|
109
109
|
|
110
110
|
self.internal_prepare_args_and_render = function(component, args, block) {
|
111
|
-
const operain =
|
111
|
+
const operain = self.internal_render;
|
112
112
|
if (args.length > 0) {
|
113
113
|
let last_arg = args[args.length - 1];
|
114
114
|
if (last_arg && last_arg.constructor === String) {
|
@@ -119,7 +119,7 @@ module React
|
|
119
119
|
};
|
120
120
|
|
121
121
|
self.internal_render = function(component, props, string_child, block) {
|
122
|
-
const operabu =
|
122
|
+
const operabu = self.render_buffer;
|
123
123
|
let children;
|
124
124
|
let native_props = null;
|
125
125
|
if (string_child) {
|
@@ -134,24 +134,24 @@ module React
|
|
134
134
|
// console.log("internal_render popping", Opal.React.render_buffer, Opal.React.render_buffer.toString());
|
135
135
|
children = operabu.pop();
|
136
136
|
}
|
137
|
-
if (props && props !== nil) { native_props =
|
137
|
+
if (props && props !== nil) { native_props = self.to_native_react_props(props); }
|
138
138
|
operabu[operabu.length - 1].push(Opal.global.React.createElement.apply(this, [component, native_props].concat(children)));
|
139
139
|
};
|
140
140
|
|
141
141
|
self.active_components = [];
|
142
142
|
|
143
143
|
self.active_component = function() {
|
144
|
-
let length =
|
144
|
+
let length = self.active_components.length;
|
145
145
|
if (length === 0) { return null; };
|
146
|
-
return
|
146
|
+
return self.active_components[length-1];
|
147
147
|
};
|
148
148
|
|
149
149
|
self.active_redux_components = [];
|
150
150
|
|
151
151
|
self.active_redux_component = function() {
|
152
|
-
let length =
|
152
|
+
let length = self.active_redux_components.length;
|
153
153
|
if (length === 0) { return null; };
|
154
|
-
return
|
154
|
+
return self.active_redux_components[length-1];
|
155
155
|
};
|
156
156
|
}
|
157
157
|
|
@@ -176,7 +176,7 @@ module React
|
|
176
176
|
|
177
177
|
def self.create_element(type, props = nil, children = nil, &block)
|
178
178
|
%x{
|
179
|
-
const operabu =
|
179
|
+
const operabu = self.render_buffer;
|
180
180
|
let component = null;
|
181
181
|
let native_props = null;
|
182
182
|
if (typeof type.react_component !== 'undefined') { component = type.react_component; }
|
@@ -192,7 +192,7 @@ module React
|
|
192
192
|
children = operabu.pop();
|
193
193
|
} else if (children === nil) { children = []; }
|
194
194
|
else if (typeof children === 'string') { children = [children]; }
|
195
|
-
if (props && props !== nil) { native_props =
|
195
|
+
if (props && props !== nil) { native_props = self.to_native_react_props(props); }
|
196
196
|
return Opal.global.React.createElement.apply(this, [component, native_props].concat(children));
|
197
197
|
}
|
198
198
|
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.12.
|
4
|
+
version: 16.12.21
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|