isomorfeus-react 16.9.24 → 16.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +3 -85
- data/README.md +0 -64
- data/lib/browser/delegate_native.rb +0 -70
- data/lib/browser/element.rb +0 -176
- data/lib/browser/element/canvas.rb +0 -17
- data/lib/browser/element/media.rb +0 -78
- data/lib/browser/event.rb +0 -92
- data/lib/browser/event_target.rb +0 -39
- data/lib/browser/file_list.rb +0 -125
- data/lib/browser/iterable.rb +0 -15
- data/lib/isomorfeus-react-material-ui.rb +0 -10
- data/lib/isomorfeus-react.rb +0 -145
- data/lib/isomorfeus/config.rb +0 -130
- data/lib/isomorfeus/props/validate_hash_proxy.rb +0 -178
- data/lib/isomorfeus/props/validator.rb +0 -131
- data/lib/isomorfeus/react_view_helper.rb +0 -130
- data/lib/isomorfeus/top_level.rb +0 -86
- data/lib/isomorfeus/top_level_ssr.rb +0 -28
- data/lib/lucid_app/api.rb +0 -30
- data/lib/lucid_app/base.rb +0 -7
- data/lib/lucid_app/context.rb +0 -7
- data/lib/lucid_app/mixin.rb +0 -20
- data/lib/lucid_app/native_component_constructor.rb +0 -105
- data/lib/lucid_component/app_store_defaults.rb +0 -36
- data/lib/lucid_component/app_store_proxy.rb +0 -38
- data/lib/lucid_component/base.rb +0 -7
- data/lib/lucid_component/class_store_proxy.rb +0 -41
- data/lib/lucid_component/component_class_store_defaults.rb +0 -38
- data/lib/lucid_component/component_instance_store_defaults.rb +0 -35
- data/lib/lucid_component/event_handler.rb +0 -17
- data/lib/lucid_component/initializer.rb +0 -12
- data/lib/lucid_component/instance_store_proxy.rb +0 -45
- data/lib/lucid_component/mixin.rb +0 -18
- data/lib/lucid_component/native_component_constructor.rb +0 -116
- data/lib/lucid_component/reducers.rb +0 -48
- data/lib/lucid_component/store_api.rb +0 -38
- data/lib/lucid_component/styles_support.rb +0 -37
- data/lib/lucid_material/app/base.rb +0 -9
- data/lib/lucid_material/app/mixin.rb +0 -22
- data/lib/lucid_material/app/native_component_constructor.rb +0 -107
- data/lib/lucid_material/component/base.rb +0 -9
- data/lib/lucid_material/component/mixin.rb +0 -20
- data/lib/lucid_material/component/native_component_constructor.rb +0 -118
- data/lib/lucid_prop_declaration/mixin.rb +0 -91
- data/lib/react.rb +0 -195
- data/lib/react/active_support_support.rb +0 -13
- data/lib/react/children.rb +0 -35
- data/lib/react/component/api.rb +0 -80
- data/lib/react/component/base.rb +0 -9
- data/lib/react/component/callbacks.rb +0 -106
- data/lib/react/component/elements.rb +0 -60
- data/lib/react/component/event_handler.rb +0 -19
- data/lib/react/component/features.rb +0 -47
- data/lib/react/component/history.rb +0 -36
- data/lib/react/component/initializer.rb +0 -11
- data/lib/react/component/location.rb +0 -15
- data/lib/react/component/match.rb +0 -31
- data/lib/react/component/mixin.rb +0 -19
- data/lib/react/component/native_component_constructor.rb +0 -93
- data/lib/react/component/props.rb +0 -59
- data/lib/react/component/resolution.rb +0 -70
- data/lib/react/component/should_component_update.rb +0 -14
- data/lib/react/component/state.rb +0 -52
- data/lib/react/component/styles.rb +0 -27
- data/lib/react/component/unsafe_api.rb +0 -33
- data/lib/react/context_wrapper.rb +0 -46
- data/lib/react/function_component/api.rb +0 -63
- data/lib/react/function_component/base.rb +0 -9
- data/lib/react/function_component/creator.rb +0 -32
- data/lib/react/function_component/event_handler.rb +0 -13
- data/lib/react/function_component/mixin.rb +0 -14
- data/lib/react/function_component/resolution.rb +0 -62
- data/lib/react/memo_component/base.rb +0 -9
- data/lib/react/memo_component/creator.rb +0 -32
- data/lib/react/memo_component/mixin.rb +0 -14
- data/lib/react/native_constant_wrapper.rb +0 -26
- data/lib/react/pure_component/base.rb +0 -9
- data/lib/react/pure_component/mixin.rb +0 -18
- data/lib/react/ref.rb +0 -13
- data/lib/react/synthetic_event.rb +0 -53
- data/lib/react/version.rb +0 -3
- data/lib/react_dom.rb +0 -47
- data/lib/react_dom_server.rb +0 -19
@@ -1,32 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module FunctionComponent
|
3
|
-
module Creator
|
4
|
-
def self.extended(base)
|
5
|
-
%x{
|
6
|
-
base.react_component = function(props) {
|
7
|
-
Opal.React.render_buffer.push([]);
|
8
|
-
Opal.React.active_components.push(base);
|
9
|
-
#{base.new(`props`).instance_exec(&`base.function_block`)};
|
10
|
-
Opal.React.active_components.pop();
|
11
|
-
return Opal.React.render_buffer.pop();
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
base_module = base.to_s.deconstantize
|
16
|
-
if base_module != ''
|
17
|
-
base_module.constantize.define_singleton_method(base.to_s.demodulize) do |*args, &block|
|
18
|
-
`Opal.React.internal_prepare_args_and_render(#{base}.react_component, args, block)`
|
19
|
-
end
|
20
|
-
else
|
21
|
-
Object.define_method(base.to_s) do |*args, &block|
|
22
|
-
`Opal.React.internal_prepare_args_and_render(#{base}.react_component, args, block)`
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_function(&block)
|
27
|
-
`base.function_block = #{block}`
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module FunctionComponent
|
3
|
-
module EventHandler
|
4
|
-
def event_handler(name, &block)
|
5
|
-
define_method(name) do |event, info|
|
6
|
-
ruby_event = ::React::SyntheticEvent.new(event)
|
7
|
-
block.call(ruby_event, info)
|
8
|
-
end
|
9
|
-
`self[name] = self.prototype['$' + name]`
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module FunctionComponent
|
3
|
-
module Mixin
|
4
|
-
def self.included(base)
|
5
|
-
base.include(::React::Component::Elements)
|
6
|
-
base.include(::React::Component::Features)
|
7
|
-
base.include(::React::FunctionComponent::API)
|
8
|
-
base.include(::React::FunctionComponent::Resolution)
|
9
|
-
base.extend(::React::FunctionComponent::EventHandler)
|
10
|
-
base.extend(::React::FunctionComponent::Creator)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module FunctionComponent
|
3
|
-
module Resolution
|
4
|
-
def self.included(base)
|
5
|
-
base.instance_exec do
|
6
|
-
alias _react_function_component_resolution_original_const_missing const_missing
|
7
|
-
|
8
|
-
def const_missing(const_name)
|
9
|
-
# language=JS
|
10
|
-
%x{
|
11
|
-
if (typeof Opal.global[const_name] === "object") {
|
12
|
-
var new_const = #{React::NativeConstantWrapper.new(`Opal.global[const_name]`, const_name)};
|
13
|
-
#{Object.const_set(const_name, `new_const`)};
|
14
|
-
return new_const;
|
15
|
-
} else {
|
16
|
-
return #{_react_function_component_resolution_original_const_missing(const_name)};
|
17
|
-
}
|
18
|
-
}
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
alias _react_function_component_resolution_original_method_missing method_missing
|
24
|
-
|
25
|
-
def method_missing(component_name, *args, &block)
|
26
|
-
# html tags are defined as methods, so they will not end up here.
|
27
|
-
# first check for native component and render it, we want to be fast for native components
|
28
|
-
# second check for ruby component and render it, they are a bit slower anyway
|
29
|
-
# third pass on method missing
|
30
|
-
# language=JS
|
31
|
-
%x{
|
32
|
-
var component = null;
|
33
|
-
var component_type = typeof Opal.global[component_name];
|
34
|
-
if (component_type === "function" || component_type === "object") {
|
35
|
-
component = Opal.global[component_name];
|
36
|
-
}
|
37
|
-
else {
|
38
|
-
try {
|
39
|
-
var constant = self.$class().$const_get(component_name, true);
|
40
|
-
if (typeof constant.react_component !== 'undefined') {
|
41
|
-
component = constant.react_component;
|
42
|
-
}
|
43
|
-
} catch(err) { component = null; }
|
44
|
-
}
|
45
|
-
if (!component) {
|
46
|
-
try {
|
47
|
-
constant = Opal.Object.$const_get(component_name);
|
48
|
-
if (typeof constant.react_component !== 'undefined') {
|
49
|
-
component = constant.react_component;
|
50
|
-
}
|
51
|
-
} catch(err) { component = null; }
|
52
|
-
}
|
53
|
-
if (component) {
|
54
|
-
return Opal.React.internal_prepare_args_and_render(component, args, block);
|
55
|
-
} else {
|
56
|
-
return #{_react_function_component_resolution_original_method_missing(component_name, *args, block)};
|
57
|
-
}
|
58
|
-
}
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module MemoComponent
|
3
|
-
module Creator
|
4
|
-
def self.extended(base)
|
5
|
-
%x{
|
6
|
-
base.equality_checker = null;
|
7
|
-
base.react_component = Opal.global.React.memo(function(props) {
|
8
|
-
Opal.React.render_buffer.push([]);
|
9
|
-
Opal.React.active_components.push(base);
|
10
|
-
#{base.new(`props`).instance_exec(&`base.function_block`)};
|
11
|
-
Opal.React.active_components.pop();
|
12
|
-
return Opal.React.render_buffer.pop();
|
13
|
-
}, base.equality_checker);
|
14
|
-
}
|
15
|
-
|
16
|
-
def props_are_equal?(&block)
|
17
|
-
%x{
|
18
|
-
base.equality_checker = function (prev_props, next_props) {
|
19
|
-
var prev_ruby_props = Opal.React.Component.Props.$new({props: prev_props});
|
20
|
-
var next_ruby_props = Opal.React.Component.Props.$new({props: next_props});
|
21
|
-
return #{base.new(`{}`).instance_exec(`prev_ruby_props`, `next_ruby_props`, &block)};
|
22
|
-
}
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def create_memo(&block)
|
27
|
-
`base.function_block = #{block}`
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module MemoComponent
|
3
|
-
module Mixin
|
4
|
-
def self.included(base)
|
5
|
-
base.include(::React::Component::Elements)
|
6
|
-
base.include(::React::Component::Features)
|
7
|
-
base.include(::React::FunctionComponent::API)
|
8
|
-
base.include(::React::FunctionComponent::Resolution)
|
9
|
-
base.extend(::React::FunctionComponent::EventHandler)
|
10
|
-
base.extend(::React::MemoComponent::Creator)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,26 +0,0 @@
|
|
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
|
-
# language=JS
|
12
|
-
%x{
|
13
|
-
var component = null;
|
14
|
-
var component_type = typeof #@native[name];
|
15
|
-
if (component_type === "function" || component_type === "object") {
|
16
|
-
component = #@native[name];
|
17
|
-
}
|
18
|
-
if (component) {
|
19
|
-
return Opal.React.internal_prepare_args_and_render(component, args, block);
|
20
|
-
} else {
|
21
|
-
#{raise NameError, "No such native Component #@const_name.#{name}"};
|
22
|
-
}
|
23
|
-
}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module PureComponent
|
3
|
-
module Mixin
|
4
|
-
def self.included(base)
|
5
|
-
base.include(::Native::Wrapper)
|
6
|
-
base.extend(::React::Component::NativeComponentConstructor)
|
7
|
-
base.extend(::LucidPropDeclaration::Mixin)
|
8
|
-
base.extend(::React::Component::EventHandler)
|
9
|
-
base.include(::React::Component::Elements)
|
10
|
-
base.include(::React::Component::API)
|
11
|
-
base.include(::React::Component::Callbacks)
|
12
|
-
base.include(::React::Component::Initializer)
|
13
|
-
base.include(::React::Component::Features)
|
14
|
-
base.include(::React::Component::Resolution)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/react/ref.rb
DELETED
@@ -1,53 +0,0 @@
|
|
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
|
-
end
|
data/lib/react/version.rb
DELETED
data/lib/react_dom.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
module ReactDOM
|
2
|
-
class << self
|
3
|
-
def create_portal(child, container)
|
4
|
-
# container is a native DOM node
|
5
|
-
`Opal.global.ReactDOM.createPortal(child, container)`
|
6
|
-
end
|
7
|
-
|
8
|
-
def find_dom_node(native_react_component)
|
9
|
-
`Opal.global.ReactDOM.findDOMNode(native_react_component)`
|
10
|
-
end
|
11
|
-
|
12
|
-
def hydrate(native_react_element, container, &block)
|
13
|
-
# container is a native DOM element
|
14
|
-
`Opal.React.render_buffer.push([]);`
|
15
|
-
result = if block_given?
|
16
|
-
`Opal.global.ReactDOM.hydrate(native_react_element, container, function() { block.$call() })`
|
17
|
-
else
|
18
|
-
`Opal.global.ReactDOM.hydrate(native_react_element, container)`
|
19
|
-
end
|
20
|
-
`Opal.React.render_buffer.pop()`
|
21
|
-
result
|
22
|
-
end
|
23
|
-
|
24
|
-
def render(native_react_element, container, &block)
|
25
|
-
# container is a native DOM element
|
26
|
-
`Opal.React.render_buffer.push([]);`
|
27
|
-
result = if block_given?
|
28
|
-
`Opal.global.ReactDOM.render(native_react_element, container, function() { block.$call() })`
|
29
|
-
else
|
30
|
-
`Opal.global.ReactDOM.render(native_react_element, container)`
|
31
|
-
end
|
32
|
-
`Opal.React.render_buffer.pop()`
|
33
|
-
result
|
34
|
-
end
|
35
|
-
|
36
|
-
def unmount_component_at_node(element_or_query)
|
37
|
-
if `(typeof element_or_query === 'string')` || (`(typeof element_or_query.$class === 'function')` && element_or_query.class == String)
|
38
|
-
element = `document.body.querySelector(element_or_query)`
|
39
|
-
elsif `(typeof element_or_query.$is_a === 'function')` && element_or_query.is_a?(Browser::Element)
|
40
|
-
element = element_or_query.to_n
|
41
|
-
else
|
42
|
-
element = element_or_query
|
43
|
-
end
|
44
|
-
`Opal.global.ReactDOM.unmountComponentAtNode(element)`
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/lib/react_dom_server.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module ReactDOMServer
|
2
|
-
class << self
|
3
|
-
def render_to_string(native_react_element)
|
4
|
-
`Opal.global.ReactDOMServer.renderToString(native_react_element)`
|
5
|
-
end
|
6
|
-
|
7
|
-
def render_to_static_markup(native_react_element)
|
8
|
-
`Opal.global.ReactDOMServer.renderToStaticMarkup(native_react_element)`
|
9
|
-
end
|
10
|
-
|
11
|
-
def render_to_node_stream(native_react_element)
|
12
|
-
`Opal.global.ReactDOMServer.renderToNodeStream(native_react_element)`
|
13
|
-
end
|
14
|
-
|
15
|
-
def render_to_static_node_stream(native_react_element)
|
16
|
-
`Opal.global.ReactDOMServer.renderToStaticNodeStream(native_react_element)`
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|