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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/isomorfeus/react/config.rb +189 -189
  4. data/lib/isomorfeus/react/memcached_component_cache.rb +19 -19
  5. data/lib/isomorfeus/react/redis_component_cache.rb +19 -19
  6. data/lib/isomorfeus/react/thread_local_component_cache.rb +15 -15
  7. data/lib/isomorfeus/react_view_helper.rb +231 -231
  8. data/lib/isomorfeus/top_level.rb +103 -103
  9. data/lib/isomorfeus/top_level_ssr.rb +42 -42
  10. data/lib/isomorfeus-react-material-ui.rb +4 -4
  11. data/lib/isomorfeus-react-native.rb +5 -5
  12. data/lib/isomorfeus-react-paper.rb +4 -4
  13. data/lib/isomorfeus-react.rb +120 -120
  14. data/lib/isomorfeus_react/lucid_app/api.rb +26 -26
  15. data/lib/isomorfeus_react/lucid_app/base.rb +7 -7
  16. data/lib/isomorfeus_react/lucid_app/mixin.rb +23 -23
  17. data/lib/isomorfeus_react/lucid_app/native_component_constructor.rb +48 -48
  18. data/lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb +94 -95
  19. data/lib/isomorfeus_react/lucid_component/api.rb +75 -75
  20. data/lib/isomorfeus_react/lucid_component/app_store_proxy.rb +37 -37
  21. data/lib/isomorfeus_react/lucid_component/base.rb +7 -7
  22. data/lib/isomorfeus_react/lucid_component/class_store_proxy.rb +44 -44
  23. data/lib/isomorfeus_react/lucid_component/initializer.rb +14 -14
  24. data/lib/isomorfeus_react/lucid_component/instance_store_proxy.rb +44 -44
  25. data/lib/isomorfeus_react/lucid_component/mixin.rb +22 -22
  26. data/lib/isomorfeus_react/lucid_component/native_component_constructor.rb +35 -35
  27. data/lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb +82 -83
  28. data/lib/isomorfeus_react/lucid_component/styles_api.rb +34 -34
  29. data/lib/isomorfeus_react/lucid_func/base.rb +7 -7
  30. data/lib/isomorfeus_react/lucid_func/initializer.rb +11 -11
  31. data/lib/isomorfeus_react/lucid_func/mixin.rb +18 -18
  32. data/lib/isomorfeus_react/lucid_func/native_component_constructor.rb +81 -81
  33. data/lib/isomorfeus_react/react/function_component/api.rb +105 -105
  34. data/lib/isomorfeus_react/react/function_component/base.rb +8 -8
  35. data/lib/isomorfeus_react/react/function_component/initializer.rb +10 -10
  36. data/lib/isomorfeus_react/react/function_component/mixin.rb +17 -17
  37. data/lib/isomorfeus_react/react/function_component/native_component_constructor.rb +48 -48
  38. data/lib/isomorfeus_react/react/memo_component/base.rb +8 -8
  39. data/lib/isomorfeus_react/react/memo_component/mixin.rb +17 -17
  40. data/lib/isomorfeus_react/react/memo_component/native_component_constructor.rb +49 -49
  41. data/lib/isomorfeus_react_material/lucid_material/app/base.rb +8 -8
  42. data/lib/isomorfeus_react_material/lucid_material/app/mixin.rb +20 -20
  43. data/lib/isomorfeus_react_material/lucid_material/app/native_component_constructor.rb +50 -50
  44. data/lib/isomorfeus_react_material/lucid_material/component/base.rb +9 -9
  45. data/lib/isomorfeus_react_material/lucid_material/component/mixin.rb +19 -19
  46. data/lib/isomorfeus_react_material/lucid_material/component/native_component_constructor.rb +36 -36
  47. data/lib/isomorfeus_react_material/lucid_material/func/base.rb +9 -9
  48. data/lib/isomorfeus_react_material/lucid_material/func/mixin.rb +15 -15
  49. data/lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb +83 -83
  50. data/lib/isomorfeus_react_paper/lucid_paper/app/base.rb +9 -9
  51. data/lib/isomorfeus_react_paper/lucid_paper/app/mixin.rb +19 -19
  52. data/lib/isomorfeus_react_paper/lucid_paper/app/native_component_constructor.rb +32 -32
  53. data/lib/isomorfeus_react_paper/lucid_paper/component/base.rb +9 -9
  54. data/lib/isomorfeus_react_paper/lucid_paper/component/mixin.rb +18 -18
  55. data/lib/isomorfeus_react_paper/lucid_paper/component/native_component_constructor.rb +25 -25
  56. data/lib/isomorfeus_react_paper/lucid_paper/func/base.rb +9 -9
  57. data/lib/isomorfeus_react_paper/lucid_paper/func/mixin.rb +14 -14
  58. data/lib/isomorfeus_react_paper/lucid_paper/func/native_component_constructor.rb +71 -71
  59. data/lib/lucid_app/context.rb +7 -7
  60. data/lib/lucid_prop_declaration/mixin.rb +126 -126
  61. data/lib/react/children.rb +34 -34
  62. data/lib/react/component/api.rb +134 -134
  63. data/lib/react/component/base.rb +8 -8
  64. data/lib/react/component/callbacks.rb +115 -115
  65. data/lib/react/component/elements.rb +60 -60
  66. data/lib/react/component/features.rb +48 -48
  67. data/lib/react/component/history.rb +69 -65
  68. data/lib/react/component/initializer.rb +11 -11
  69. data/lib/react/component/location.rb +19 -15
  70. data/lib/react/component/match.rb +35 -31
  71. data/lib/react/component/mixin.rb +20 -20
  72. data/lib/react/component/native_component_constructor.rb +69 -70
  73. data/lib/react/component/props.rb +83 -83
  74. data/lib/react/component/resolution.rb +97 -97
  75. data/lib/react/component/state.rb +58 -54
  76. data/lib/react/component/styles.rb +66 -66
  77. data/lib/react/context_wrapper.rb +48 -44
  78. data/lib/react/native_constant_wrapper.rb +29 -29
  79. data/lib/react/ref.rb +16 -12
  80. data/lib/react/synthetic_event.rb +52 -52
  81. data/lib/react/version.rb +3 -3
  82. data/lib/react.rb +296 -296
  83. data/lib/react_dom.rb +41 -41
  84. data/lib/react_dom_server.rb +18 -18
  85. data/lib/react_native/component/elements.rb +203 -203
  86. data/lib/react_native/lucid_app/react_native_component_constructor.rb +51 -51
  87. data/lib/react_native/lucid_component/react_native_component_constructor.rb +37 -37
  88. data/lib/react_native/lucid_func/react_native_component_constructor.rb +82 -82
  89. data/lib/react_native/react.rb +120 -120
  90. metadata +23 -17
@@ -1,115 +1,115 @@
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);
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
- let fun = function() {
22
- Opal.React.active_redux_components.push(this);
23
- #{`this.__ruby_instance`.instance_exec(&block)};
24
- Opal.React.active_redux_components.pop();
25
- }
26
- if (self.lucid_react_component) {
27
- if (self.lucid_react_component.prototype.componentDidMount) {
28
- let fun_one = self.lucid_react_component.prototype.componentDidMount;
29
- let fun_two = fun;
30
- fun = function() {
31
- fun_one();
32
- fun_two();
33
- }
34
- }
35
- self.lucid_react_component.prototype.componentDidMount = fun;
36
- } else { self.react_component.prototype.componentDidMount = fun; }
37
- }
38
- end
39
-
40
- def component_did_update(&block)
41
- %x{
42
- var fun = function(prev_props, prev_state, snapshot) {
43
- Opal.React.active_redux_components.push(this);
44
- #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
45
- `Opal.React.Component.State.$new({state: prev_state})`,
46
- `snapshot`, &block)};
47
- Opal.React.active_redux_components.pop();
48
- }
49
- if (self.lucid_react_component) { self.lucid_react_component.prototype.componentDidUpdate = fun; }
50
- else { self.react_component.prototype.componentDidUpdate = fun; }
51
- }
52
- end
53
-
54
- def component_will_unmount(&block)
55
- %x{
56
- var fun = function() {
57
- if (typeof this.unsubscriber === "function") { this.unsubscriber(); };
58
- Opal.React.active_redux_components.push(this);
59
- #{`this.__ruby_instance`.instance_exec(&block)};
60
- Opal.React.active_redux_components.pop();
61
- }
62
- if (self.lucid_react_component) { self.lucid_react_component.prototype.componentWillUnmount = fun; }
63
- else { self.react_component.prototype.componentWillUnmount = fun; }
64
- }
65
- end
66
-
67
- def get_derived_state_from_error(&block)
68
- # TODO convert error
69
- %x{
70
- var fun = function(error) {
71
- var result = #{`this.__ruby_instance`.instance_exec(`error`, &block)};
72
- if (typeof result.$to_n === 'function') { result = result.$to_n() }
73
- if (result === Opal.nil) { return null; }
74
- return result;
75
- }
76
- if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromError = fun; }
77
- else { self.react_component.prototype.getDerivedStateFromError = fun; }
78
- }
79
- end
80
-
81
- def get_derived_state_from_props(&block)
82
- %x{
83
- var fun = function(props, state) {
84
- Opal.React.active_redux_components.push(this);
85
- var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: props})`,
86
- `Opal.React.Component.State.$new({state: state})`, &block)};
87
- Opal.React.active_redux_components.pop();
88
- if (typeof result.$to_n === 'function') { result = result.$to_n() }
89
- if (result === Opal.nil) { return null; }
90
- return result;
91
- }
92
- if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromProps = fun; }
93
- else { self.react_component.prototype.getDerivedStateFromProps = fun; }
94
- }
95
- end
96
-
97
- def get_snapshot_before_update(&block)
98
- %x{
99
- var fun = function(prev_props, prev_state) {
100
- Opal.React.active_redux_components.push(this);
101
- var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
102
- `Opal.React.Component.State.$new({state: prev_state})`, &block)};
103
- Opal.React.active_redux_components.pop();
104
- if (result === Opal.nil) { return null; }
105
- return result;
106
- }
107
- if (self.lucid_react_component) { self.lucid_react_component.prototype.getSnapshotBeforeUpdate = fun; }
108
- else { self.react_component.prototype.getSnapshotBeforeUpdate = fun; }
109
- }
110
- end
111
- end
112
- end
113
- end
114
- end
115
- end
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);
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
+ let fun = function() {
22
+ Opal.React.active_redux_components.push(this);
23
+ #{`this.__ruby_instance`.instance_exec(&block)};
24
+ Opal.React.active_redux_components.pop();
25
+ }
26
+ if (self.lucid_react_component) {
27
+ if (self.lucid_react_component.prototype.componentDidMount) {
28
+ let fun_one = self.lucid_react_component.prototype.componentDidMount;
29
+ let fun_two = fun;
30
+ fun = function() {
31
+ fun_one();
32
+ fun_two();
33
+ }
34
+ }
35
+ self.lucid_react_component.prototype.componentDidMount = fun;
36
+ } else { self.react_component.prototype.componentDidMount = fun; }
37
+ }
38
+ end
39
+
40
+ def component_did_update(&block)
41
+ %x{
42
+ var fun = function(prev_props, prev_state, snapshot) {
43
+ Opal.React.active_redux_components.push(this);
44
+ #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
45
+ `Opal.React.Component.State.$new({state: prev_state})`,
46
+ `snapshot`, &block)};
47
+ Opal.React.active_redux_components.pop();
48
+ }
49
+ if (self.lucid_react_component) { self.lucid_react_component.prototype.componentDidUpdate = fun; }
50
+ else { self.react_component.prototype.componentDidUpdate = fun; }
51
+ }
52
+ end
53
+
54
+ def component_will_unmount(&block)
55
+ %x{
56
+ var fun = function() {
57
+ if (typeof this.unsubscriber === "function") { this.unsubscriber(); };
58
+ Opal.React.active_redux_components.push(this);
59
+ #{`this.__ruby_instance`.instance_exec(&block)};
60
+ Opal.React.active_redux_components.pop();
61
+ }
62
+ if (self.lucid_react_component) { self.lucid_react_component.prototype.componentWillUnmount = fun; }
63
+ else { self.react_component.prototype.componentWillUnmount = fun; }
64
+ }
65
+ end
66
+
67
+ def get_derived_state_from_error(&block)
68
+ # TODO convert error
69
+ %x{
70
+ var fun = function(error) {
71
+ var result = #{`this.__ruby_instance`.instance_exec(`error`, &block)};
72
+ if (typeof result.$to_n === 'function') { result = result.$to_n() }
73
+ if (result === Opal.nil) { return null; }
74
+ return result;
75
+ }
76
+ if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromError = fun; }
77
+ else { self.react_component.prototype.getDerivedStateFromError = fun; }
78
+ }
79
+ end
80
+
81
+ def get_derived_state_from_props(&block)
82
+ %x{
83
+ var fun = function(props, state) {
84
+ Opal.React.active_redux_components.push(this);
85
+ var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: props})`,
86
+ `Opal.React.Component.State.$new({state: state})`, &block)};
87
+ Opal.React.active_redux_components.pop();
88
+ if (typeof result.$to_n === 'function') { result = result.$to_n() }
89
+ if (result === Opal.nil) { return null; }
90
+ return result;
91
+ }
92
+ if (self.lucid_react_component) { self.lucid_react_component.prototype.getDerivedStateFromProps = fun; }
93
+ else { self.react_component.prototype.getDerivedStateFromProps = fun; }
94
+ }
95
+ end
96
+
97
+ def get_snapshot_before_update(&block)
98
+ %x{
99
+ var fun = function(prev_props, prev_state) {
100
+ Opal.React.active_redux_components.push(this);
101
+ var result = #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
102
+ `Opal.React.Component.State.$new({state: prev_state})`, &block)};
103
+ Opal.React.active_redux_components.pop();
104
+ if (result === Opal.nil) { return null; }
105
+ return result;
106
+ }
107
+ if (self.lucid_react_component) { self.lucid_react_component.prototype.getSnapshotBeforeUpdate = fun; }
108
+ else { self.react_component.prototype.getSnapshotBeforeUpdate = fun; }
109
+ }
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
@@ -1,60 +1,60 @@
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
+ 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,48 +1,48 @@
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
- let operabu = Opal.React.render_buffer;
18
- operabu.push([]);
19
- // console.log("portal pushed", operabu, operabu.toString());
20
- if (block !== nil) {
21
- let block_result = block.$call()
22
- let last_buffer_length = operabu[operabu.length - 1].length;
23
- let last_buffer_element = operabu[operabu.length - 1][last_buffer_length - 1];
24
- if (block_result && block_result !== nil) { Opal.React.render_block_result(block_result); }
25
- }
26
- // console.log("portal popping", operabu, operabu.toString());
27
- let result = operabu.pop();
28
- if (result.length === 1) { result = result[0]; }
29
- var react_element = Opal.global.React.createPortal(result, element);
30
- operabu[operabu.length - 1].push(react_element);
31
- // console.log("portal pushed", operabu, operabu.toString());
32
- }
33
- end
34
-
35
- def Profiler(*args, &block)
36
- `Opal.React.internal_prepare_args_and_render(Opal.global.React.Profiler, args, block)`
37
- end
38
-
39
- def StrictMode(*args, &block)
40
- `Opal.React.internal_prepare_args_and_render(Opal.global.React.StrictMode, args, block)`
41
- end
42
-
43
- def Suspense(*args, &block)
44
- `Opal.React.internal_prepare_args_and_render(Opal.global.React.Suspense, args, block)`
45
- end
46
- end
47
- end
48
- end
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
+ let operabu = Opal.React.render_buffer;
18
+ operabu.push([]);
19
+ // console.log("portal pushed", operabu, operabu.toString());
20
+ if (block !== nil) {
21
+ let block_result = block.$call()
22
+ let last_buffer_length = operabu[operabu.length - 1].length;
23
+ let last_buffer_element = operabu[operabu.length - 1][last_buffer_length - 1];
24
+ if (block_result && block_result !== nil) { Opal.React.render_block_result(block_result); }
25
+ }
26
+ // console.log("portal popping", operabu, operabu.toString());
27
+ let result = operabu.pop();
28
+ if (result.length === 1) { result = result[0]; }
29
+ var react_element = Opal.global.React.createPortal(result, element);
30
+ operabu[operabu.length - 1].push(react_element);
31
+ // console.log("portal pushed", operabu, operabu.toString());
32
+ }
33
+ end
34
+
35
+ def Profiler(*args, &block)
36
+ `Opal.React.internal_prepare_args_and_render(Opal.global.React.Profiler, args, block)`
37
+ end
38
+
39
+ def StrictMode(*args, &block)
40
+ `Opal.React.internal_prepare_args_and_render(Opal.global.React.StrictMode, args, block)`
41
+ end
42
+
43
+ def Suspense(*args, &block)
44
+ `Opal.React.internal_prepare_args_and_render(Opal.global.React.Suspense, args, block)`
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,65 +1,69 @@
1
- module React
2
- module Component
3
- class History
4
- include ::Native::Wrapper
5
-
6
- def block(prompt)
7
- @native.JS[:props].JS[:history].JS.block(prompt)
8
- end
9
-
10
- def create_href(location)
11
- @native.JS[:props].JS[:history].JS.createHref(location)
12
- end
13
-
14
- def go(n)
15
- @native.JS[:props].JS[:history].JS.go(n)
16
- end
17
-
18
- def go_back
19
- @native.JS[:props].JS[:history].JS.goBack()
20
- end
21
-
22
- def go_forward
23
- @native.JS[:props].JS[:history].JS.goForward()
24
- end
25
-
26
- def push(*args)
27
- @native.JS[:props].JS[:history].JS.push(*args)
28
- end
29
-
30
- def replace(*args)
31
- @native.JS[:props].JS[:history].JS.replace(*args)
32
- end
33
-
34
- def method_missing(prop, *args, &block)
35
- @native.JS[:props].JS[:history].JS[prop]
36
- end
37
-
38
- def listen(&block)
39
- fun = nil
40
- %x{
41
- fun = function(location, action) {
42
- let ruby_location = #{React::Component::Location.new(`{ props: { location: location }}`)}
43
- block.$call(ruby_location, action);
44
- }
45
- }
46
- unlisten = @native.JS[:props].JS[:history].JS.listen(fun)
47
- -> { unlisten.JS.call() }
48
- end
49
-
50
- def location
51
- return @location if @location
52
- return nil unless @native.JS[:props].JS[:history].JS[:location]
53
- if @native.JS[:props].JS[:history].JS[:location].JS[:pathname]
54
- @location = React::Component::Location.new(@native)
55
- else
56
- @native.JS[:props].JS[:history].JS[:location]
57
- end
58
- end
59
-
60
- def to_n
61
- @native.JS[:props].JS[:history]
62
- end
63
- end
64
- end
65
- end
1
+ module React
2
+ module Component
3
+ class History
4
+ include ::Native::Wrapper
5
+
6
+ def initialize(native)
7
+ @native = native
8
+ end
9
+
10
+ def block(prompt)
11
+ @native.JS[:props].JS[:history].JS.block(prompt)
12
+ end
13
+
14
+ def create_href(location)
15
+ @native.JS[:props].JS[:history].JS.createHref(location)
16
+ end
17
+
18
+ def go(n)
19
+ @native.JS[:props].JS[:history].JS.go(n)
20
+ end
21
+
22
+ def go_back
23
+ @native.JS[:props].JS[:history].JS.goBack()
24
+ end
25
+
26
+ def go_forward
27
+ @native.JS[:props].JS[:history].JS.goForward()
28
+ end
29
+
30
+ def push(*args)
31
+ @native.JS[:props].JS[:history].JS.push(*args)
32
+ end
33
+
34
+ def replace(*args)
35
+ @native.JS[:props].JS[:history].JS.replace(*args)
36
+ end
37
+
38
+ def method_missing(prop, *args, &block)
39
+ @native.JS[:props].JS[:history].JS[prop]
40
+ end
41
+
42
+ def listen(&block)
43
+ fun = nil
44
+ %x{
45
+ fun = function(location, action) {
46
+ let ruby_location = #{React::Component::Location.new(`{ props: { location: location }}`)}
47
+ block.$call(ruby_location, action);
48
+ }
49
+ }
50
+ unlisten = @native.JS[:props].JS[:history].JS.listen(fun)
51
+ -> { unlisten.JS.call() }
52
+ end
53
+
54
+ def location
55
+ return @location if @location
56
+ return nil unless @native.JS[:props].JS[:history].JS[:location]
57
+ if @native.JS[:props].JS[:history].JS[:location].JS[:pathname]
58
+ @location = React::Component::Location.new(@native)
59
+ else
60
+ @native.JS[:props].JS[:history].JS[:location]
61
+ end
62
+ end
63
+
64
+ def to_n
65
+ @native.JS[:props].JS[:history]
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,11 +1,11 @@
1
- module React
2
- module Component
3
- module Initializer
4
- def initialize(native_component)
5
- @native = native_component
6
- @props = `Opal.React.Component.Props.$new(#@native)`
7
- @state = `Opal.React.Component.State.$new(#@native)`
8
- end
9
- end
10
- end
11
- end
1
+ module React
2
+ module Component
3
+ module Initializer
4
+ def initialize(native_component)
5
+ @native = native_component
6
+ @props = `Opal.React.Component.Props.$new(#@native)`
7
+ @state = `Opal.React.Component.State.$new(#@native)`
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,15 +1,19 @@
1
- module React
2
- module Component
3
- class Location
4
- include ::Native::Wrapper
5
-
6
- def method_missing(prop, *args, &block)
7
- @native.JS[:props].JS[:location].JS[prop]
8
- end
9
-
10
- def to_n
11
- @native
12
- end
13
- end
14
- end
15
- end
1
+ module React
2
+ module Component
3
+ class Location
4
+ include ::Native::Wrapper
5
+
6
+ def initialize(native)
7
+ @native = native
8
+ end
9
+
10
+ def method_missing(prop, *args, &block)
11
+ @native.JS[:props].JS[:location].JS[prop]
12
+ end
13
+
14
+ def to_n
15
+ @native
16
+ end
17
+ end
18
+ end
19
+ end