isomorfeus-react 16.13.9 → 16.13.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -10
  3. data/lib/isomorfeus/props/validator.rb +2 -2
  4. data/lib/isomorfeus/{react_config.rb → react/config.rb} +189 -189
  5. data/lib/isomorfeus/react/memcached_component_cache.rb +19 -0
  6. data/lib/isomorfeus/react/redis_component_cache.rb +19 -0
  7. data/lib/isomorfeus/{thread_local_component_cache.rb → react/thread_local_component_cache.rb} +15 -15
  8. data/lib/isomorfeus/react_view_helper.rb +231 -231
  9. data/lib/isomorfeus/top_level.rb +103 -103
  10. data/lib/isomorfeus/top_level_ssr.rb +42 -42
  11. data/lib/isomorfeus-react-material-ui.rb +4 -4
  12. data/lib/isomorfeus-react-native.rb +5 -0
  13. data/lib/isomorfeus-react-paper.rb +4 -0
  14. data/lib/isomorfeus-react.rb +120 -118
  15. data/lib/isomorfeus_react/lucid_app/api.rb +26 -26
  16. data/lib/isomorfeus_react/lucid_app/base.rb +7 -7
  17. data/lib/isomorfeus_react/lucid_app/mixin.rb +23 -22
  18. data/lib/isomorfeus_react/lucid_app/native_component_constructor.rb +48 -49
  19. data/lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb +94 -95
  20. data/lib/isomorfeus_react/lucid_component/api.rb +75 -102
  21. data/lib/isomorfeus_react/lucid_component/app_store_proxy.rb +37 -37
  22. data/lib/isomorfeus_react/lucid_component/base.rb +7 -7
  23. data/lib/isomorfeus_react/lucid_component/class_store_proxy.rb +44 -44
  24. data/lib/isomorfeus_react/lucid_component/initializer.rb +14 -14
  25. data/lib/isomorfeus_react/lucid_component/instance_store_proxy.rb +44 -44
  26. data/lib/isomorfeus_react/lucid_component/mixin.rb +22 -21
  27. data/lib/isomorfeus_react/lucid_component/native_component_constructor.rb +35 -35
  28. data/lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb +82 -108
  29. data/lib/isomorfeus_react/lucid_component/styles_api.rb +34 -0
  30. data/lib/isomorfeus_react/lucid_func/base.rb +7 -7
  31. data/lib/isomorfeus_react/lucid_func/initializer.rb +11 -11
  32. data/lib/isomorfeus_react/lucid_func/mixin.rb +18 -17
  33. data/lib/isomorfeus_react/lucid_func/native_component_constructor.rb +81 -81
  34. data/lib/isomorfeus_react/react/function_component/api.rb +105 -104
  35. data/lib/isomorfeus_react/react/function_component/base.rb +8 -8
  36. data/lib/isomorfeus_react/react/function_component/initializer.rb +10 -10
  37. data/lib/isomorfeus_react/react/function_component/mixin.rb +17 -17
  38. data/lib/isomorfeus_react/react/function_component/native_component_constructor.rb +48 -48
  39. data/lib/isomorfeus_react/react/memo_component/base.rb +8 -8
  40. data/lib/isomorfeus_react/react/memo_component/mixin.rb +17 -17
  41. data/lib/isomorfeus_react/react/memo_component/native_component_constructor.rb +49 -49
  42. data/lib/isomorfeus_react_material/lucid_material/app/base.rb +8 -8
  43. data/lib/isomorfeus_react_material/lucid_material/app/mixin.rb +20 -19
  44. data/lib/isomorfeus_react_material/lucid_material/app/native_component_constructor.rb +50 -51
  45. data/lib/isomorfeus_react_material/lucid_material/component/base.rb +9 -9
  46. data/lib/isomorfeus_react_material/lucid_material/component/mixin.rb +19 -18
  47. data/lib/isomorfeus_react_material/lucid_material/component/native_component_constructor.rb +36 -36
  48. data/lib/isomorfeus_react_material/lucid_material/func/base.rb +9 -9
  49. data/lib/isomorfeus_react_material/lucid_material/func/mixin.rb +15 -14
  50. data/lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb +83 -83
  51. data/lib/isomorfeus_react_paper/lucid_paper/app/base.rb +9 -0
  52. data/lib/isomorfeus_react_paper/lucid_paper/app/mixin.rb +19 -0
  53. data/lib/isomorfeus_react_paper/lucid_paper/app/native_component_constructor.rb +32 -0
  54. data/lib/isomorfeus_react_paper/lucid_paper/component/base.rb +9 -0
  55. data/lib/isomorfeus_react_paper/lucid_paper/component/mixin.rb +18 -0
  56. data/lib/isomorfeus_react_paper/lucid_paper/component/native_component_constructor.rb +25 -0
  57. data/lib/isomorfeus_react_paper/lucid_paper/func/base.rb +9 -0
  58. data/lib/isomorfeus_react_paper/lucid_paper/func/mixin.rb +14 -0
  59. data/lib/isomorfeus_react_paper/lucid_paper/func/native_component_constructor.rb +71 -0
  60. data/lib/lucid_app/context.rb +7 -7
  61. data/lib/lucid_prop_declaration/mixin.rb +126 -126
  62. data/lib/react/children.rb +34 -34
  63. data/lib/react/component/api.rb +134 -133
  64. data/lib/react/component/base.rb +8 -8
  65. data/lib/react/component/callbacks.rb +115 -115
  66. data/lib/react/component/elements.rb +60 -60
  67. data/lib/react/component/features.rb +48 -48
  68. data/lib/react/component/history.rb +69 -65
  69. data/lib/react/component/initializer.rb +11 -11
  70. data/lib/react/component/location.rb +19 -15
  71. data/lib/react/component/match.rb +35 -31
  72. data/lib/react/component/mixin.rb +20 -20
  73. data/lib/react/component/native_component_constructor.rb +69 -95
  74. data/lib/react/component/props.rb +83 -83
  75. data/lib/react/component/resolution.rb +97 -97
  76. data/lib/react/component/state.rb +58 -54
  77. data/lib/react/component/styles.rb +66 -66
  78. data/lib/react/context_wrapper.rb +48 -44
  79. data/lib/react/native_constant_wrapper.rb +29 -29
  80. data/lib/react/ref.rb +16 -12
  81. data/lib/react/synthetic_event.rb +52 -52
  82. data/lib/react/version.rb +3 -3
  83. data/lib/react.rb +296 -262
  84. data/lib/react_dom.rb +41 -41
  85. data/lib/react_dom_server.rb +18 -18
  86. data/lib/react_native/component/elements.rb +203 -0
  87. data/lib/react_native/lucid_app/react_native_component_constructor.rb +51 -0
  88. data/lib/react_native/lucid_component/react_native_component_constructor.rb +37 -0
  89. data/lib/react_native/lucid_func/react_native_component_constructor.rb +82 -0
  90. data/lib/react_native/react.rb +120 -0
  91. metadata +76 -23
@@ -1,44 +1,48 @@
1
- module React
2
- class ContextWrapper
3
- include ::Native::Wrapper
4
-
5
- def is_wrapped_context
6
- true
7
- end
8
-
9
- def Consumer(*args, &block)
10
- # why not use internal_prepare_args and render?
11
- %x{
12
- let operabu = Opal.React.render_buffer;
13
- let props = null;
14
-
15
- if (args.length > 0) { props = Opal.React.to_native_react_props(args[0]); }
16
-
17
- let react_element = Opal.global.React.createElement(this.native.Consumer, props, function(value) {
18
- let children = null;
19
- if (block !== nil) {
20
- operabu.push([]);
21
- // console.log("consumer pushed", operabu, operabu.toString());
22
- let block_result = block.$call();
23
- if (block_result && block_result !== nil) { Opal.React.render_block_result(block_result); }
24
- // console.log("consumer popping", operabu, operabu.toString());
25
- children = operabu.pop();
26
- if (children.length === 1) { children = children[0]; }
27
- else if (children.length === 0) { children = null; }
28
- }
29
- return children;
30
- });
31
- operabu[operabu.length - 1].push(react_element);
32
- }
33
- end
34
-
35
- def Provider(*args, &block)
36
- # why not use internal_prepare_args and render?
37
- %x{
38
- var props = null;
39
- if (args.length > 0) { props = Opal.React.to_native_react_props(args[0]); }
40
- Opal.React.internal_render(this.native.Provider, props, null, block);
41
- }
42
- end
43
- end
44
- end
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 is_wrapped_ref
6
- true
7
- end
8
-
9
- def current
10
- `Opal.React.native_element_or_component_to_ruby(#@native.current)`
11
- end
12
- end
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.9'
3
- end
1
+ module React
2
+ VERSION = '16.13.12'
3
+ end