isomorfeus-react 16.9.24 → 16.10.0
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
- 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
data/lib/react/children.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Children
|
3
|
-
class << self
|
4
|
-
def count(children)
|
5
|
-
`Opal.global.React.Children.count(children)`
|
6
|
-
end
|
7
|
-
|
8
|
-
def for_each(children, &block)
|
9
|
-
%x{
|
10
|
-
var fun = function(child) {
|
11
|
-
#{block.call(child)};
|
12
|
-
}
|
13
|
-
Opal.global.React.Children.forEach(children, fun);
|
14
|
-
}
|
15
|
-
end
|
16
|
-
|
17
|
-
def map(children, &block)
|
18
|
-
%x{
|
19
|
-
var fun = function(child) {
|
20
|
-
return #{block.call(child)};
|
21
|
-
}
|
22
|
-
return Opal.global.React.Children.map(children, fun);
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def only(children)
|
27
|
-
`Opal.global.React.Children.only(children)`
|
28
|
-
end
|
29
|
-
|
30
|
-
def to_array(children)
|
31
|
-
`Opal.global.React.Children.toArray(children)`
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/react/component/api.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
module API
|
4
|
-
def self.included(base)
|
5
|
-
base.instance_exec do
|
6
|
-
base_module = base.to_s.deconstantize
|
7
|
-
if base_module != ''
|
8
|
-
base_module.constantize.define_singleton_method(base.to_s.demodulize) do |*args, &block|
|
9
|
-
`Opal.React.internal_prepare_args_and_render(#{base}.react_component, args, block)`
|
10
|
-
end
|
11
|
-
else
|
12
|
-
Object.define_method(base.to_s) do |*args, &block|
|
13
|
-
`Opal.React.internal_prepare_args_and_render(#{base}.react_component, args, block)`
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
attr_accessor :props
|
18
|
-
attr_accessor :state
|
19
|
-
|
20
|
-
def ref(ref_name, &block)
|
21
|
-
defined_refs.JS[ref_name] = block_given? ? block : `null`
|
22
|
-
end
|
23
|
-
|
24
|
-
def defined_refs
|
25
|
-
@defined_ref ||= `{}`
|
26
|
-
end
|
27
|
-
|
28
|
-
def default_state_defined
|
29
|
-
@default_state_defined
|
30
|
-
end
|
31
|
-
|
32
|
-
def state
|
33
|
-
return @default_state if @default_state
|
34
|
-
@default_state_defined = true
|
35
|
-
%x{
|
36
|
-
var native_state = {state: {}};
|
37
|
-
native_state.setState = function(new_state, callback) {
|
38
|
-
for (var key in new_state) {
|
39
|
-
this.state[key] = new_state[key];
|
40
|
-
}
|
41
|
-
if (callback) { callback.call(); }
|
42
|
-
}
|
43
|
-
}
|
44
|
-
@default_state = React::Component::State.new(`native_state`)
|
45
|
-
end
|
46
|
-
|
47
|
-
def render(&block)
|
48
|
-
`base.render_block = block`
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def display_name
|
54
|
-
@native.JS[:displayName]
|
55
|
-
end
|
56
|
-
|
57
|
-
def force_update(&block)
|
58
|
-
if block_given?
|
59
|
-
# this maybe needs instance_exec too
|
60
|
-
@native.JS.forceUpdate(`function() { block.$call(); }`)
|
61
|
-
else
|
62
|
-
@native.JS.forceUpdate
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def ref(name)
|
67
|
-
`#@native[name]`
|
68
|
-
end
|
69
|
-
|
70
|
-
def ruby_ref(name)
|
71
|
-
return `#@native[name]` if `(typeof #@native[name] === 'function')`
|
72
|
-
React::Ref::new(`#@native[name]`)
|
73
|
-
end
|
74
|
-
|
75
|
-
def set_state(updater, &callback)
|
76
|
-
@state.set_state(updater, &callback)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
data/lib/react/component/base.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
module Callbacks
|
4
|
-
def self.included(base)
|
5
|
-
base.instance_exec do
|
6
|
-
def component_did_catch(&block)
|
7
|
-
# TODO convert error and info
|
8
|
-
%x{
|
9
|
-
var fun = function(error, info) {
|
10
|
-
Opal.React.active_redux_components.push(this.__ruby_instance);
|
11
|
-
#{`this.__ruby_instance`.instance_exec(`error`, `info`, &block)};
|
12
|
-
Opal.React.active_redux_components.pop();
|
13
|
-
}
|
14
|
-
if (self.lucid_react_component) { self.lucid_react_component.prototype.componentDidCatch = fun; }
|
15
|
-
else { self.react_component.prototype.componentDidCatch = fun; }
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
def component_did_mount(&block)
|
20
|
-
%x{
|
21
|
-
var fun = function() {
|
22
|
-
Opal.React.active_redux_components.push(this.__ruby_instance);
|
23
|
-
#{`this.__ruby_instance`.instance_exec(&block)};
|
24
|
-
Opal.React.active_redux_components.pop();
|
25
|
-
}
|
26
|
-
if (self.lucid_react_component) { self.lucid_react_component.prototype.componentDidMount = fun; }
|
27
|
-
else { self.react_component.prototype.componentDidMount = fun; }
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
def component_did_update(&block)
|
32
|
-
%x{
|
33
|
-
var fun = function(prev_props, prev_state, snapshot) {
|
34
|
-
Opal.React.active_redux_components.push(this.__ruby_instance);
|
35
|
-
#{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
|
36
|
-
`Opal.React.Component.State.$new({state: prev_state})`,
|
37
|
-
`snapshot`, &block)};
|
38
|
-
Opal.React.active_redux_components.pop();
|
39
|
-
}
|
40
|
-
if (self.lucid_react_component) { self.lucid_react_component.prototype.componentDidUpdate = fun; }
|
41
|
-
else { self.react_component.prototype.componentDidUpdate = fun; }
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
def component_will_unmount(&block)
|
46
|
-
%x{
|
47
|
-
var fun = function() {
|
48
|
-
if (typeof this.unsubscriber === "function") { this.unsubscriber(); };
|
49
|
-
Opal.React.active_redux_components.push(this.__ruby_instance);
|
50
|
-
#{`this.__ruby_instance`.instance_exec(&block)};
|
51
|
-
Opal.React.active_redux_components.pop();
|
52
|
-
}
|
53
|
-
if (self.lucid_react_component) { self.lucid_react_component.prototype.componentWillUnmount = fun; }
|
54
|
-
else { self.react_component.prototype.componentWillUnmount = fun; }
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
def get_derived_state_from_error(&block)
|
59
|
-
# TODO convert error
|
60
|
-
%x{
|
61
|
-
var fun = function(error) {
|
62
|
-
var result = #{`this.__ruby_instance`.instance_exec(`error`, &block)};
|
63
|
-
if (typeof result.$to_n === 'function') { result = result.$to_n() }
|
64
|
-
if (result === Opal.nil) { return null; }
|
65
|
-
return result;
|
66
|
-
}
|
67
|
-
if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromError = fun; }
|
68
|
-
else { self.react_component.prototype.getDerivedStateFromError = fun; }
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
def get_derived_state_from_props(&block)
|
73
|
-
%x{
|
74
|
-
var fun = function(props, state) {
|
75
|
-
Opal.React.active_redux_components.push(this.__ruby_instance);
|
76
|
-
var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: props})`,
|
77
|
-
`Opal.React.Component.State.$new({state: state})`, &block)};
|
78
|
-
Opal.React.active_redux_components.pop();
|
79
|
-
if (typeof result.$to_n === 'function') { result = result.$to_n() }
|
80
|
-
if (result === Opal.nil) { return null; }
|
81
|
-
return result;
|
82
|
-
}
|
83
|
-
if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromProps = fun; }
|
84
|
-
else { self.react_component.prototype.getDerivedStateFromProps = fun; }
|
85
|
-
}
|
86
|
-
end
|
87
|
-
|
88
|
-
def get_snapshot_before_update(&block)
|
89
|
-
%x{
|
90
|
-
var fun = function(prev_props, prev_state) {
|
91
|
-
|
92
|
-
var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
|
93
|
-
`Opal.React.Component.State.$new({state: prev_state})`, &block)};
|
94
|
-
Opal.React.active_redux_components.pop();
|
95
|
-
if (result === Opal.nil) { return null; }
|
96
|
-
return result;
|
97
|
-
}
|
98
|
-
if (self.lucid_react_component) { self.lucid_react_component.prototype.getSnapshotBeforeUpdate = fun; }
|
99
|
-
else { self.react_component.prototype.getSnapshotBeforeUpdate = fun; }
|
100
|
-
}
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
module Elements
|
4
|
-
# https://www.w3.org/TR/html52/fullindex.html#index-elements
|
5
|
-
# https://www.w3.org/TR/SVG11/eltindex.html
|
6
|
-
SUPPORTED_HTML_AND_SVG_ELEMENTS = %w[
|
7
|
-
a abbr address area article aside audio
|
8
|
-
b base bdi bdo blockquote body br button
|
9
|
-
canvas caption cite code col colgroup
|
10
|
-
data datalist dd del details dfn dialog div dl dt
|
11
|
-
em embed
|
12
|
-
fieldset figcaption figure footer form
|
13
|
-
h1 h2 h3 h4 h5 h6 head header hr html
|
14
|
-
i iframe img input ins
|
15
|
-
kbd
|
16
|
-
label legend li link
|
17
|
-
main map mark meta meter
|
18
|
-
nav noscript
|
19
|
-
object ol optgroup option output
|
20
|
-
p param picture pre progress
|
21
|
-
q
|
22
|
-
rp rt rtc ruby
|
23
|
-
s samp script section select small source span strong style sub summary sup
|
24
|
-
table tbody td template textarea tfoot th thead time title tr track
|
25
|
-
u ul
|
26
|
-
var video
|
27
|
-
wbr
|
28
|
-
altGlyph altGlyphDef altGlyphItem animate animateColor animateMotion animateTransform
|
29
|
-
circle clipPath color-profile cursor
|
30
|
-
defs desc
|
31
|
-
ellipse
|
32
|
-
feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting
|
33
|
-
feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur
|
34
|
-
feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting
|
35
|
-
feSpotLight feTile feTurbulence
|
36
|
-
filter font font-face font-face-format font-face-name font-face-src font-face-uri foreignObject
|
37
|
-
g glyph glyphRef
|
38
|
-
hkern
|
39
|
-
image
|
40
|
-
line linearGradient
|
41
|
-
marker mask metadata missing-glyph mpath
|
42
|
-
path pattern polygon polyline
|
43
|
-
radialGradient rect
|
44
|
-
script set stop style svg switch symbol
|
45
|
-
text textPath tref tspan
|
46
|
-
use
|
47
|
-
view vkern
|
48
|
-
]
|
49
|
-
|
50
|
-
SUPPORTED_HTML_AND_SVG_ELEMENTS.each do |element|
|
51
|
-
define_method(element) do |*args, &block|
|
52
|
-
`Opal.React.internal_prepare_args_and_render(element, args, block)`
|
53
|
-
end
|
54
|
-
define_method(`element.toUpperCase()`) do |*args, &block|
|
55
|
-
`Opal.React.internal_prepare_args_and_render(element, args, block)`
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
module EventHandler
|
4
|
-
def event_handlers
|
5
|
-
@event_handlers ||= []
|
6
|
-
end
|
7
|
-
|
8
|
-
def event_handler(name, &block)
|
9
|
-
event_handlers << name
|
10
|
-
%x{
|
11
|
-
self.react_component.prototype[name] = function(event, info) {
|
12
|
-
#{ruby_event = ::React::SyntheticEvent.new(`event`)};
|
13
|
-
#{`this.__ruby_instance`.instance_exec(ruby_event, `info`, &block)};
|
14
|
-
}
|
15
|
-
}
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
module Features
|
4
|
-
def Fragment(*args, &block)
|
5
|
-
`Opal.React.internal_prepare_args_and_render(Opal.global.React.Fragment, args, block)`
|
6
|
-
end
|
7
|
-
|
8
|
-
def Portal(element_or_query, &block)
|
9
|
-
if `(typeof element_or_query === 'string')` || (`(typeof element_or_query.$class === 'function')` && element_or_query.class == String)
|
10
|
-
element = `document.body.querySelector(element_or_query)`
|
11
|
-
elsif `(typeof element_or_query.$is_a === 'function')` && element_or_query.is_a?(Browser::Element)
|
12
|
-
element = element_or_query.to_n
|
13
|
-
else
|
14
|
-
element = element_or_query
|
15
|
-
end
|
16
|
-
%x{
|
17
|
-
Opal.React.render_buffer.push([]);
|
18
|
-
if (block !== nil) {
|
19
|
-
let block_result = block.$call()
|
20
|
-
let last_buffer_length = Opal.React.render_buffer[Opal.React.render_buffer.length - 1].length;
|
21
|
-
let last_buffer_element = Opal.React.render_buffer[Opal.React.render_buffer.length - 1][last_buffer_length - 1];
|
22
|
-
if (block_result && block_result !== last_buffer_element && (block_result !== nil && (typeof block_result === "string" || typeof block_result.$$typeof === "symbol" ||
|
23
|
-
(typeof block_result.constructor !== "undefined" && block_result.constructor === Array && block_result[0] && typeof block_result[0].$$typeof === "symbol")
|
24
|
-
))) {
|
25
|
-
Opal.React.render_buffer[Opal.React.render_buffer.length - 1].push(block_result);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
var react_element = Opal.global.React.createPortal(Opal.React.render_buffer.pop(), element);
|
29
|
-
Opal.React.render_buffer[Opal.React.render_buffer.length - 1].push(react_element);
|
30
|
-
return react_element;
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
def Profiler(*args, &block)
|
35
|
-
`Opal.React.internal_prepare_args_and_render(Opal.global.React.Profiler, args, block)`
|
36
|
-
end
|
37
|
-
|
38
|
-
def StrictMode(*args, &block)
|
39
|
-
`Opal.React.internal_prepare_args_and_render(Opal.global.React.StrictMode, args, block)`
|
40
|
-
end
|
41
|
-
|
42
|
-
def Suspense(*args, &block)
|
43
|
-
`Opal.React.internal_prepare_args_and_render(Opal.global.React.Suspense, args, block)`
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
class History
|
4
|
-
include ::Native::Wrapper
|
5
|
-
|
6
|
-
alias_native :block, :block
|
7
|
-
alias_native :create_href, :createHref
|
8
|
-
alias_native :go, :go
|
9
|
-
alias_native :go_back, :goBack
|
10
|
-
alias_native :go_forward, :goForward
|
11
|
-
alias_native :listen, :listen
|
12
|
-
alias_native :push, :push
|
13
|
-
alias_native :replace, :replace
|
14
|
-
|
15
|
-
alias _react_component_hitory_original_method_missing method_missing
|
16
|
-
|
17
|
-
def method_missing(prop, *args, &block)
|
18
|
-
@native.JS[:params].JS[prop]
|
19
|
-
end
|
20
|
-
|
21
|
-
def location
|
22
|
-
return @location if @location
|
23
|
-
return nil unless @native.JS[:props].JS[:location]
|
24
|
-
if @native.JS[:props].JS[:location].JS[:pathname]
|
25
|
-
@location = React::Component::Location.new(@native.JS[:props].JS[:location])
|
26
|
-
else
|
27
|
-
@native.JS[:props].JS[:location]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_n
|
32
|
-
@native
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module React
|
2
|
-
module Component
|
3
|
-
class Match
|
4
|
-
include ::Native::Wrapper
|
5
|
-
|
6
|
-
def method_missing(prop, *args, &block)
|
7
|
-
@native.JS[:params].JS[prop]
|
8
|
-
end
|
9
|
-
|
10
|
-
def is_exact
|
11
|
-
@native.JS[:isExact]
|
12
|
-
end
|
13
|
-
|
14
|
-
def params
|
15
|
-
self
|
16
|
-
end
|
17
|
-
|
18
|
-
def path
|
19
|
-
@native.JS[:path]
|
20
|
-
end
|
21
|
-
|
22
|
-
def url
|
23
|
-
@native.JS[:url]
|
24
|
-
end
|
25
|
-
|
26
|
-
def to_n
|
27
|
-
@native
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|