isomorfeus-react 16.13.11 → 16.13.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/isomorfeus/react/config.rb +189 -189
- data/lib/isomorfeus/react/memcached_component_cache.rb +19 -19
- data/lib/isomorfeus/react/redis_component_cache.rb +19 -19
- data/lib/isomorfeus/react/thread_local_component_cache.rb +15 -15
- data/lib/isomorfeus/react_view_helper.rb +231 -231
- data/lib/isomorfeus/top_level.rb +103 -103
- data/lib/isomorfeus/top_level_ssr.rb +42 -42
- data/lib/isomorfeus-react-material-ui.rb +4 -4
- data/lib/isomorfeus-react-native.rb +5 -5
- data/lib/isomorfeus-react-paper.rb +4 -4
- data/lib/isomorfeus-react.rb +120 -120
- data/lib/isomorfeus_react/lucid_app/api.rb +26 -26
- data/lib/isomorfeus_react/lucid_app/base.rb +7 -7
- data/lib/isomorfeus_react/lucid_app/mixin.rb +23 -23
- data/lib/isomorfeus_react/lucid_app/native_component_constructor.rb +48 -48
- data/lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb +94 -95
- data/lib/isomorfeus_react/lucid_component/api.rb +75 -75
- data/lib/isomorfeus_react/lucid_component/app_store_proxy.rb +37 -37
- data/lib/isomorfeus_react/lucid_component/base.rb +7 -7
- data/lib/isomorfeus_react/lucid_component/class_store_proxy.rb +44 -44
- data/lib/isomorfeus_react/lucid_component/initializer.rb +14 -14
- data/lib/isomorfeus_react/lucid_component/instance_store_proxy.rb +44 -44
- data/lib/isomorfeus_react/lucid_component/mixin.rb +22 -22
- data/lib/isomorfeus_react/lucid_component/native_component_constructor.rb +35 -35
- data/lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb +82 -83
- data/lib/isomorfeus_react/lucid_component/styles_api.rb +34 -34
- data/lib/isomorfeus_react/lucid_func/base.rb +7 -7
- data/lib/isomorfeus_react/lucid_func/initializer.rb +11 -11
- data/lib/isomorfeus_react/lucid_func/mixin.rb +18 -18
- data/lib/isomorfeus_react/lucid_func/native_component_constructor.rb +81 -81
- data/lib/isomorfeus_react/react/function_component/api.rb +105 -105
- data/lib/isomorfeus_react/react/function_component/base.rb +8 -8
- data/lib/isomorfeus_react/react/function_component/initializer.rb +10 -10
- data/lib/isomorfeus_react/react/function_component/mixin.rb +17 -17
- data/lib/isomorfeus_react/react/function_component/native_component_constructor.rb +48 -48
- data/lib/isomorfeus_react/react/memo_component/base.rb +8 -8
- data/lib/isomorfeus_react/react/memo_component/mixin.rb +17 -17
- data/lib/isomorfeus_react/react/memo_component/native_component_constructor.rb +49 -49
- data/lib/isomorfeus_react_material/lucid_material/app/base.rb +8 -8
- data/lib/isomorfeus_react_material/lucid_material/app/mixin.rb +20 -20
- data/lib/isomorfeus_react_material/lucid_material/app/native_component_constructor.rb +50 -50
- data/lib/isomorfeus_react_material/lucid_material/component/base.rb +9 -9
- data/lib/isomorfeus_react_material/lucid_material/component/mixin.rb +19 -19
- data/lib/isomorfeus_react_material/lucid_material/component/native_component_constructor.rb +36 -36
- data/lib/isomorfeus_react_material/lucid_material/func/base.rb +9 -9
- data/lib/isomorfeus_react_material/lucid_material/func/mixin.rb +15 -15
- data/lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb +83 -83
- data/lib/isomorfeus_react_paper/lucid_paper/app/base.rb +9 -9
- data/lib/isomorfeus_react_paper/lucid_paper/app/mixin.rb +19 -19
- data/lib/isomorfeus_react_paper/lucid_paper/app/native_component_constructor.rb +32 -32
- data/lib/isomorfeus_react_paper/lucid_paper/component/base.rb +9 -9
- data/lib/isomorfeus_react_paper/lucid_paper/component/mixin.rb +18 -18
- data/lib/isomorfeus_react_paper/lucid_paper/component/native_component_constructor.rb +25 -25
- data/lib/isomorfeus_react_paper/lucid_paper/func/base.rb +9 -9
- data/lib/isomorfeus_react_paper/lucid_paper/func/mixin.rb +14 -14
- data/lib/isomorfeus_react_paper/lucid_paper/func/native_component_constructor.rb +71 -71
- data/lib/lucid_app/context.rb +7 -7
- data/lib/lucid_prop_declaration/mixin.rb +126 -126
- data/lib/react/children.rb +34 -34
- data/lib/react/component/api.rb +134 -134
- data/lib/react/component/base.rb +8 -8
- data/lib/react/component/callbacks.rb +115 -115
- data/lib/react/component/elements.rb +60 -60
- data/lib/react/component/features.rb +48 -48
- data/lib/react/component/history.rb +69 -65
- data/lib/react/component/initializer.rb +11 -11
- data/lib/react/component/location.rb +19 -15
- data/lib/react/component/match.rb +35 -31
- data/lib/react/component/mixin.rb +20 -20
- data/lib/react/component/native_component_constructor.rb +69 -70
- data/lib/react/component/props.rb +83 -83
- data/lib/react/component/resolution.rb +97 -97
- data/lib/react/component/state.rb +58 -54
- data/lib/react/component/styles.rb +66 -66
- data/lib/react/context_wrapper.rb +48 -44
- data/lib/react/native_constant_wrapper.rb +29 -29
- data/lib/react/ref.rb +16 -12
- data/lib/react/synthetic_event.rb +52 -52
- data/lib/react/version.rb +3 -3
- data/lib/react.rb +296 -296
- data/lib/react_dom.rb +41 -41
- data/lib/react_dom_server.rb +18 -18
- data/lib/react_native/component/elements.rb +203 -203
- data/lib/react_native/lucid_app/react_native_component_constructor.rb +51 -51
- data/lib/react_native/lucid_component/react_native_component_constructor.rb +37 -37
- data/lib/react_native/lucid_func/react_native_component_constructor.rb +82 -82
- data/lib/react_native/react.rb +120 -120
- metadata +23 -17
@@ -1,54 +1,58 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
class State
|
4
|
-
include ::Native::Wrapper
|
5
|
-
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
1
|
+
module React
|
2
|
+
module Component
|
3
|
+
class State
|
4
|
+
include ::Native::Wrapper
|
5
|
+
|
6
|
+
def initialize(native)
|
7
|
+
@native = native
|
8
|
+
end
|
9
|
+
|
10
|
+
def method_missing(key, *args, &block)
|
11
|
+
if `args.length > 0`
|
12
|
+
new_state = `{}`
|
13
|
+
new_state.JS[(`key.endsWith('=')` ? key.chop : key)] = args[0]
|
14
|
+
if block_given?
|
15
|
+
@native.JS.setState(new_state, `function() { block.$call(); }`)
|
16
|
+
else
|
17
|
+
@native.JS.setState(new_state, `null`)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
%x{
|
21
|
+
if (typeof #@native.state[key] === 'undefined') { return nil; }
|
22
|
+
return #@native.state[key];
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_state(updater, &block)
|
28
|
+
new_state = `{}`
|
29
|
+
updater.each do |key, value|
|
30
|
+
new_state.JS[key] = value
|
31
|
+
end
|
32
|
+
if block_given?
|
33
|
+
@native.JS.setState(new_state, `function() { block.$call(); }`)
|
34
|
+
else
|
35
|
+
@native.JS.setState(new_state, `null`)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def size
|
40
|
+
`Object.keys(#@native.state).length`;
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_n
|
44
|
+
%x{
|
45
|
+
var new_native = {};
|
46
|
+
for (var key in #@native.state) {
|
47
|
+
if (typeof #@native.state[key].$to_n !== "undefined") {
|
48
|
+
new_native[key] = #@native.state[key].$to_n();
|
49
|
+
} else {
|
50
|
+
new_native[key] = #@native.state[key];
|
51
|
+
}
|
52
|
+
}
|
53
|
+
return new_native;
|
54
|
+
}
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -1,66 +1,66 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
class Styles
|
4
|
-
|
5
|
-
def initialize(native, props_prop = false)
|
6
|
-
@native = native
|
7
|
-
@props_prop = props_prop
|
8
|
-
end
|
9
|
-
|
10
|
-
def [](prop)
|
11
|
-
method_missing(prop)
|
12
|
-
end
|
13
|
-
|
14
|
-
def []=(prop, val)
|
15
|
-
method_missing(prop, val)
|
16
|
-
end
|
17
|
-
|
18
|
-
def deep_merge(a_hash)
|
19
|
-
native_hash = a_hash.to_n
|
20
|
-
React::Component::Styles.new(`Opal.React.merge_deep(#@native, native_hash)`)
|
21
|
-
end
|
22
|
-
|
23
|
-
def deep_merge!(a_hash)
|
24
|
-
native_hash = a_hash.to_n
|
25
|
-
`#@native = Opal.React.merge_deep(#@native, native_hash)`
|
26
|
-
self
|
27
|
-
end
|
28
|
-
|
29
|
-
def method_missing(prop, *args, &block)
|
30
|
-
%x{
|
31
|
-
let value;
|
32
|
-
if (#@props_prop) {
|
33
|
-
if (!#@native.props[#@props_prop] || typeof #@native.props[#@props_prop][prop] === 'undefined') {
|
34
|
-
console.warn("Style/Theme key '" + prop + "' returning nil!");
|
35
|
-
return #{nil};
|
36
|
-
}
|
37
|
-
value = #@native.props[#@props_prop][prop];
|
38
|
-
} else {
|
39
|
-
if (!#@native || typeof #@native[prop] === 'undefined') {
|
40
|
-
console.warn("Style/Theme key '" + prop + "' returning nil!");
|
41
|
-
return #{nil};
|
42
|
-
}
|
43
|
-
value = #@native[prop];
|
44
|
-
}
|
45
|
-
if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value)) { return value; }
|
46
|
-
if (typeof value === 'function') { return value.apply(#@native, args); }
|
47
|
-
return Opal.React.Component.Styles.$new(value);
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
def to_h
|
52
|
-
%x{
|
53
|
-
if (#@props_prop) { return Opal.Hash.$new(#@native.props[#@props_prop]); }
|
54
|
-
else { return Opal.Hash.$new(#@native); }
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
def to_n
|
59
|
-
%x{
|
60
|
-
if (#@props_prop) { return #@native.props[#@props_prop]; }
|
61
|
-
else { return #@native; }
|
62
|
-
}
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
1
|
+
module React
|
2
|
+
module Component
|
3
|
+
class Styles
|
4
|
+
|
5
|
+
def initialize(native, props_prop = false)
|
6
|
+
@native = native
|
7
|
+
@props_prop = props_prop
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](prop)
|
11
|
+
method_missing(prop)
|
12
|
+
end
|
13
|
+
|
14
|
+
def []=(prop, val)
|
15
|
+
method_missing(prop, val)
|
16
|
+
end
|
17
|
+
|
18
|
+
def deep_merge(a_hash)
|
19
|
+
native_hash = a_hash.to_n
|
20
|
+
React::Component::Styles.new(`Opal.React.merge_deep(#@native, native_hash)`)
|
21
|
+
end
|
22
|
+
|
23
|
+
def deep_merge!(a_hash)
|
24
|
+
native_hash = a_hash.to_n
|
25
|
+
`#@native = Opal.React.merge_deep(#@native, native_hash)`
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
def method_missing(prop, *args, &block)
|
30
|
+
%x{
|
31
|
+
let value;
|
32
|
+
if (#@props_prop) {
|
33
|
+
if (!#@native.props[#@props_prop] || typeof #@native.props[#@props_prop][prop] === 'undefined') {
|
34
|
+
console.warn("Style/Theme key '" + prop + "' returning nil!");
|
35
|
+
return #{nil};
|
36
|
+
}
|
37
|
+
value = #@native.props[#@props_prop][prop];
|
38
|
+
} else {
|
39
|
+
if (!#@native || typeof #@native[prop] === 'undefined') {
|
40
|
+
console.warn("Style/Theme key '" + prop + "' returning nil!");
|
41
|
+
return #{nil};
|
42
|
+
}
|
43
|
+
value = #@native[prop];
|
44
|
+
}
|
45
|
+
if (typeof value === 'string' || typeof value === 'number' || Array.isArray(value)) { return value; }
|
46
|
+
if (typeof value === 'function') { return value.apply(#@native, args); }
|
47
|
+
return Opal.React.Component.Styles.$new(value);
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_h
|
52
|
+
%x{
|
53
|
+
if (#@props_prop) { return Opal.Hash.$new(#@native.props[#@props_prop]); }
|
54
|
+
else { return Opal.Hash.$new(#@native); }
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def to_n
|
59
|
+
%x{
|
60
|
+
if (#@props_prop) { return #@native.props[#@props_prop]; }
|
61
|
+
else { return #@native; }
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,44 +1,48 @@
|
|
1
|
-
module React
|
2
|
-
class ContextWrapper
|
3
|
-
include ::Native::Wrapper
|
4
|
-
|
5
|
-
def
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
let
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
1
|
+
module React
|
2
|
+
class ContextWrapper
|
3
|
+
include ::Native::Wrapper
|
4
|
+
|
5
|
+
def initialize(native)
|
6
|
+
@native = native
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_wrapped_context
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def Consumer(*args, &block)
|
14
|
+
# why not use internal_prepare_args and render?
|
15
|
+
%x{
|
16
|
+
let operabu = Opal.React.render_buffer;
|
17
|
+
let props = null;
|
18
|
+
|
19
|
+
if (args.length > 0) { props = Opal.React.to_native_react_props(args[0]); }
|
20
|
+
|
21
|
+
let react_element = Opal.global.React.createElement(this.native.Consumer, props, function(value) {
|
22
|
+
let children = null;
|
23
|
+
if (block !== nil) {
|
24
|
+
operabu.push([]);
|
25
|
+
// console.log("consumer pushed", operabu, operabu.toString());
|
26
|
+
let block_result = block.$call();
|
27
|
+
if (block_result && block_result !== nil) { Opal.React.render_block_result(block_result); }
|
28
|
+
// console.log("consumer popping", operabu, operabu.toString());
|
29
|
+
children = operabu.pop();
|
30
|
+
if (children.length === 1) { children = children[0]; }
|
31
|
+
else if (children.length === 0) { children = null; }
|
32
|
+
}
|
33
|
+
return children;
|
34
|
+
});
|
35
|
+
operabu[operabu.length - 1].push(react_element);
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def Provider(*args, &block)
|
40
|
+
# why not use internal_prepare_args and render?
|
41
|
+
%x{
|
42
|
+
var props = null;
|
43
|
+
if (args.length > 0) { props = Opal.React.to_native_react_props(args[0]); }
|
44
|
+
Opal.React.internal_render(this.native.Provider, props, null, block);
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -1,29 +1,29 @@
|
|
1
|
-
module React
|
2
|
-
class NativeConstantWrapper
|
3
|
-
include ::Native::Wrapper
|
4
|
-
|
5
|
-
def initialize(native, const_name)
|
6
|
-
@native = native
|
7
|
-
@const_name = const_name
|
8
|
-
end
|
9
|
-
|
10
|
-
def method_missing(name, *args, &block)
|
11
|
-
%x{
|
12
|
-
if (name[0] === 'u' && name[1] === 's' && name[2] === 'e') {
|
13
|
-
if (name.indexOf('_') > 0) { name = Opal.React.lower_camelize(name); }
|
14
|
-
return #@native[name].call(this, args);
|
15
|
-
}
|
16
|
-
var component = null;
|
17
|
-
var component_type = typeof #@native[name];
|
18
|
-
if (component_type === "function" || component_type === "object") {
|
19
|
-
component = #@native[name];
|
20
|
-
}
|
21
|
-
if (component) {
|
22
|
-
return Opal.React.internal_prepare_args_and_render(component, args, block);
|
23
|
-
} else {
|
24
|
-
#{Isomorfeus.raise_error(error_class: NameError, message: "No such native Component #@const_name.#{name}")};
|
25
|
-
}
|
26
|
-
}
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
1
|
+
module React
|
2
|
+
class NativeConstantWrapper
|
3
|
+
include ::Native::Wrapper
|
4
|
+
|
5
|
+
def initialize(native, const_name)
|
6
|
+
@native = native
|
7
|
+
@const_name = const_name
|
8
|
+
end
|
9
|
+
|
10
|
+
def method_missing(name, *args, &block)
|
11
|
+
%x{
|
12
|
+
if (name[0] === 'u' && name[1] === 's' && name[2] === 'e') {
|
13
|
+
if (name.indexOf('_') > 0) { name = Opal.React.lower_camelize(name); }
|
14
|
+
return #@native[name].call(this, args);
|
15
|
+
}
|
16
|
+
var component = null;
|
17
|
+
var component_type = typeof #@native[name];
|
18
|
+
if (component_type === "function" || component_type === "object") {
|
19
|
+
component = #@native[name];
|
20
|
+
}
|
21
|
+
if (component) {
|
22
|
+
return Opal.React.internal_prepare_args_and_render(component, args, block);
|
23
|
+
} else {
|
24
|
+
#{Isomorfeus.raise_error(error_class: NameError, message: "No such native Component #@const_name.#{name}")};
|
25
|
+
}
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/react/ref.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
-
module React
|
2
|
-
class Ref
|
3
|
-
include ::Native::Wrapper
|
4
|
-
|
5
|
-
def
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def
|
10
|
-
|
11
|
-
end
|
12
|
-
|
1
|
+
module React
|
2
|
+
class Ref
|
3
|
+
include ::Native::Wrapper
|
4
|
+
|
5
|
+
def initialize(native)
|
6
|
+
@native = native
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_wrapped_ref
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def current
|
14
|
+
`Opal.React.native_element_or_component_to_ruby(#@native.current)`
|
15
|
+
end
|
16
|
+
end
|
13
17
|
end
|
@@ -1,53 +1,53 @@
|
|
1
|
-
module React
|
2
|
-
class SyntheticEvent
|
3
|
-
include Native::Wrapper
|
4
|
-
# helpers
|
5
|
-
def self.native_accessors(*js_names)
|
6
|
-
js_names.each do |js_name|
|
7
|
-
ruby_name = js_name.underscore
|
8
|
-
define_method(ruby_name) do
|
9
|
-
@native.JS[js_name]
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.native_boolean_accessors(*js_names)
|
15
|
-
js_names.each do |js_name|
|
16
|
-
ruby_name = js_name.underscore + '?'
|
17
|
-
define_method(ruby_name) do
|
18
|
-
@native.JS[js_name]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
alias_native :get_modifier_state, :getModifierState
|
24
|
-
alias_native :is_default_prevented?, :isDefaultPrevented
|
25
|
-
alias_native :is_propagation_stopped?, :isPropagationStopped
|
26
|
-
alias_native :persist, :persist
|
27
|
-
alias_native :prevent_default, :preventDefault
|
28
|
-
alias_native :stop_propagation, :stopPropagation
|
29
|
-
|
30
|
-
native_accessors :animationName, :button, :buttons, :changedTouches, :charCode, :clientX, :clientY, :clipboardData, :data, :deltaMode, :deltaX,
|
31
|
-
:deltaY, :deltaZ, :detail, :elapsedTime, :eventPhase, :height, :key, :keyCode, :locale, :location, :pageX, :pageY, :pointerId,
|
32
|
-
:pointerType, :pressure, :propertyName, :pseudoElement, :screenX, :screenY, :tangentialPressure, :targetTouches, :tiltX, :tiltY,
|
33
|
-
:timestamp, :touches, :twist, :type, :view, :which, :width
|
34
|
-
|
35
|
-
native_boolean_accessors :altKey, :bubbles, :cancelable, :ctrlKey, :defaultPrevented, :isPrimary, :isTrusted, :metaKey, :repeat, :shiftKey
|
36
|
-
|
37
|
-
def current_target
|
38
|
-
Browser::Element.new(@native.JS[:currentTarget])
|
39
|
-
end
|
40
|
-
|
41
|
-
def native_event
|
42
|
-
Browser::Event.new(@native.JS[:nativeEvent])
|
43
|
-
end
|
44
|
-
|
45
|
-
def related_target
|
46
|
-
Browser::Element.new(@native.JS[:relatedTarget])
|
47
|
-
end
|
48
|
-
|
49
|
-
def target
|
50
|
-
Browser::Element.new(@native.JS[:target])
|
51
|
-
end
|
52
|
-
end
|
1
|
+
module React
|
2
|
+
class SyntheticEvent
|
3
|
+
include Native::Wrapper
|
4
|
+
# helpers
|
5
|
+
def self.native_accessors(*js_names)
|
6
|
+
js_names.each do |js_name|
|
7
|
+
ruby_name = js_name.underscore
|
8
|
+
define_method(ruby_name) do
|
9
|
+
@native.JS[js_name]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.native_boolean_accessors(*js_names)
|
15
|
+
js_names.each do |js_name|
|
16
|
+
ruby_name = js_name.underscore + '?'
|
17
|
+
define_method(ruby_name) do
|
18
|
+
@native.JS[js_name]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
alias_native :get_modifier_state, :getModifierState
|
24
|
+
alias_native :is_default_prevented?, :isDefaultPrevented
|
25
|
+
alias_native :is_propagation_stopped?, :isPropagationStopped
|
26
|
+
alias_native :persist, :persist
|
27
|
+
alias_native :prevent_default, :preventDefault
|
28
|
+
alias_native :stop_propagation, :stopPropagation
|
29
|
+
|
30
|
+
native_accessors :animationName, :button, :buttons, :changedTouches, :charCode, :clientX, :clientY, :clipboardData, :data, :deltaMode, :deltaX,
|
31
|
+
:deltaY, :deltaZ, :detail, :elapsedTime, :eventPhase, :height, :key, :keyCode, :locale, :location, :pageX, :pageY, :pointerId,
|
32
|
+
:pointerType, :pressure, :propertyName, :pseudoElement, :screenX, :screenY, :tangentialPressure, :targetTouches, :tiltX, :tiltY,
|
33
|
+
:timestamp, :touches, :twist, :type, :view, :which, :width
|
34
|
+
|
35
|
+
native_boolean_accessors :altKey, :bubbles, :cancelable, :ctrlKey, :defaultPrevented, :isPrimary, :isTrusted, :metaKey, :repeat, :shiftKey
|
36
|
+
|
37
|
+
def current_target
|
38
|
+
Browser::Element.new(@native.JS[:currentTarget])
|
39
|
+
end
|
40
|
+
|
41
|
+
def native_event
|
42
|
+
Browser::Event.new(@native.JS[:nativeEvent])
|
43
|
+
end
|
44
|
+
|
45
|
+
def related_target
|
46
|
+
Browser::Element.new(@native.JS[:relatedTarget])
|
47
|
+
end
|
48
|
+
|
49
|
+
def target
|
50
|
+
Browser::Element.new(@native.JS[:target])
|
51
|
+
end
|
52
|
+
end
|
53
53
|
end
|
data/lib/react/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module React
|
2
|
-
VERSION = '16.13.
|
3
|
-
end
|
1
|
+
module React
|
2
|
+
VERSION = '16.13.12'
|
3
|
+
end
|