isomorfeus-react 16.8.4 → 16.8.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 628a938fb57502749eff1d8736a86caae34e64bc297ac010979734d23706756f
4
- data.tar.gz: b8b7becfb6b8a18b39332120d7b26c83276f3758af83b2c0562551e03e2ef560
3
+ metadata.gz: d8a17f89bdbc05a905aca55121053827da7546aaef0d282426457d7c7a7cdc18
4
+ data.tar.gz: 42eb95d1c5573a6cf22093c95638698a82d31cc2eebfb57b71b528d35d8bd35b
5
5
  SHA512:
6
- metadata.gz: 4d14d2ea8264daffdba51b4c751276ccdb9a0b9a7a3207256b5685ed59e6e23a20cf10d2f5f7998b4b36dc8e75b7dc0384978b4700b3fbbaa3425c401037fe14
7
- data.tar.gz: '04869ca2a335a6ab7d227c13ba9b1b8451399e68f6ad3cc16c504485d9b38d0713ba9885727df6151080a8b4aa8e5ed36e6009508383f84d9be552b5ace77125'
6
+ metadata.gz: a68d65b5722fcca6fdb469bb19aade87fe603c1c6a46b62c3a5bfadc3e9a37e389be1ea77bb493e53faceb51de16cc09330223d7f3aaf26661c0be20990a1e3d
7
+ data.tar.gz: ca252549c6640b4830c32cd224a6b395d04ec764ccb0f2f9d94fcebae55c97090170a488ab6be61393691df55cddd51640a8013b70da42d9b2a42d1b7b0d56f6
@@ -58,6 +58,7 @@ module Isomorfeus
58
58
 
59
59
  def force_render
60
60
  top_component.JS.forceUpdate()
61
+ nil
61
62
  end
62
63
  end
63
64
 
@@ -74,7 +74,7 @@ module LucidComponent
74
74
  self.lucid_react_component.defaultProps = { isomorfeus_store: Opal.Hash.$new() };
75
75
  }
76
76
  }
77
- @default_props = React::Component::Props.new(`self.lucid_react_component.defaultProps`)
77
+ @default_props = React::Component::Props.new(`{props: self.lucid_react_component.defaultProps}`)
78
78
  end
79
79
  end
80
80
  end
@@ -4,7 +4,7 @@ module LucidComponent
4
4
  @native = native_component
5
5
  @app_store = `Opal.React.ReduxComponent.AppStoreProxy.$new(#{self}, 'props')`
6
6
  @class_store = `Opal.React.ReduxComponent.ClassStoreProxy.$new(#{self}, 'props')`
7
- @props = `Opal.React.Component.Props.$new(#@native.props)`
7
+ @props = `Opal.React.Component.Props.$new(#@native)`
8
8
  @state = `Opal.React.Component.State.$new(#@native)`
9
9
  @store = `Opal.React.ReduxComponent.InstanceStoreProxy.$new(#{self}, 'props')`
10
10
  end
@@ -82,7 +82,10 @@ module LucidComponent
82
82
  } else if (next_props.hasOwnProperty(property)) {
83
83
  if (!this.props.hasOwnProperty(property)) { return true; };
84
84
  if (property == "children") { if (next_props.children !== this.props.children) { return true; }}
85
- else if (typeof next_props[property] !== "undefined" && typeof next_props[property]['$!='] !== "undefined" && typeof this.props[property] !== "undefined" && typeof this.props[property]['$!='] !== "undefined") {
85
+ else if (typeof next_props[property] !== "undefined" && next_props[property] !== null &&
86
+ typeof next_props[property]['$!='] !== "undefined" &&
87
+ typeof this.props[property] !== "undefined" && this.props[property] !== null &&
88
+ typeof this.props[property]['$!='] !== "undefined") {
86
89
  if (#{ !! (`next_props[property]` != `this.props[property]`) }) { return true; };
87
90
  } else if (next_props[property] !== this.props[property]) { return true; };
88
91
  }
@@ -90,7 +93,8 @@ module LucidComponent
90
93
  for (var property in next_state) {
91
94
  if (next_state.hasOwnProperty(property)) {
92
95
  if (!this.state.hasOwnProperty(property)) { return true; };
93
- if (typeof next_state[property]['$!='] !== "undefined" && typeof this.state[property]['$!='] !== "undefined") {
96
+ if (next_state[property] !== null && typeof next_state[property]['$!='] !== "undefined" &&
97
+ this.state[property] !== null && typeof this.state[property]['$!='] !== "undefined") {
94
98
  if (#{ !! (`next_state[property]` != `this.state[property]`) }) { return true };
95
99
  } else if (next_state[property] !== this.state[property]) { return true };
96
100
  }
@@ -78,7 +78,10 @@ module LucidMaterial
78
78
  } else if (next_props.hasOwnProperty(property)) {
79
79
  if (!this.props.hasOwnProperty(property)) { return true; };
80
80
  if (property == "children") { if (next_props.children !== this.props.children) { return true; }}
81
- else if (typeof next_props[property] !== "undefined" && typeof next_props[property]['$!='] !== "undefined" && typeof this.props[property] !== "undefined" && typeof this.props[property]['$!='] !== "undefined") {
81
+ else if (typeof next_props[property] !== "undefined" && next_props[property] !== null &&
82
+ typeof next_props[property]['$!='] !== "undefined" &&
83
+ typeof this.props[property] !== "undefined" && this.props[property] !== null &&
84
+ typeof this.props[property]['$!='] !== "undefined") {
82
85
  if (#{ !! (`next_props[property]` != `this.props[property]`) }) { return true; };
83
86
  } else if (next_props[property] !== this.props[property]) { return true; };
84
87
  }
@@ -86,7 +89,8 @@ module LucidMaterial
86
89
  for (var property in next_state) {
87
90
  if (next_state.hasOwnProperty(property)) {
88
91
  if (!this.state.hasOwnProperty(property)) { return true; };
89
- if (typeof next_state[property]['$!='] !== "undefined" && typeof this.state[property]['$!='] !== "undefined") {
92
+ if (next_state[property] !== null && typeof next_state[property]['$!='] !== "undefined" &&
93
+ this.state[property] !== null && typeof this.state[property]['$!='] !== "undefined") {
90
94
  if (#{ !! (`next_state[property]` != `this.state[property]`) }) { return true };
91
95
  } else if (next_state[property] !== this.state[property]) { return true };
92
96
  }
data/lib/react.rb CHANGED
@@ -46,6 +46,10 @@ module React
46
46
  }
47
47
  } else if (keys[i].startsWith("aria_")) {
48
48
  result[keys[i].replace("_", "-")] = ruby_style_props['$[]'](keys[i]);
49
+ } else if (keys[i] === "style") {
50
+ var val = ruby_style_props['$[]'](keys[i]);
51
+ if (typeof val.$$is_hash !== "undefined") { val = val.$to_n() }
52
+ result["style"] = val;
49
53
  } else {
50
54
  result[Opal.React.lower_camelize(keys[i])] = ruby_style_props['$[]'](keys[i]);
51
55
  }
@@ -71,7 +75,7 @@ module React
71
75
 
72
76
  if (string_child) {
73
77
  children = string_child;
74
- } else if (block !== nil) {
78
+ } else if (block && block !== nil) {
75
79
  Opal.React.render_buffer.push([]);
76
80
  block_result = block.$call();
77
81
  if (block_result && (block_result !== nil && (typeof block_result === "string" || typeof block_result.$$typeof === "symbol" ||
@@ -181,7 +185,7 @@ module React
181
185
  if block_given?
182
186
  %x{
183
187
  var fun = function(prev_props, next_props) {
184
- return #{block.call(::React::Component::Props.new(prev_props), ::React::Component::Props.new(next_props))};
188
+ return #{block.call(::React::Component::Props.new(`{props: prev_props}`), ::React::Component::Props.new(`{props: next_props}`))};
185
189
  }
186
190
  return Opal.global.React.memo(function_component, fun);
187
191
  }
@@ -92,7 +92,7 @@ module React
92
92
  self.lucid_react_component.defaultProps = {};
93
93
  }
94
94
  }
95
- @default_props = `Opal.React.Component.Props.$new(self.react_component.defaultProps)`
95
+ @default_props = `Opal.React.Component.Props.$new({props: self.react_component.defaultProps})`
96
96
  end
97
97
 
98
98
  def render(&block)
@@ -32,7 +32,7 @@ module React
32
32
  %x{
33
33
  var fun = function(prev_props, prev_state, snapshot) {
34
34
  Opal.React.active_redux_components.push(this.__ruby_instance);
35
- #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new(prev_props)`,
35
+ #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
36
36
  `Opal.React.Component.State.$new({state: prev_state})`,
37
37
  `snapshot`, &block)};
38
38
  Opal.React.active_redux_components.pop();
@@ -73,7 +73,7 @@ module React
73
73
  %x{
74
74
  var fun = function(props, state) {
75
75
  Opal.React.active_redux_components.push(this.__ruby_instance);
76
- #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new(props)`,
76
+ #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: props})`,
77
77
  `Opal.React.Component.State.$new({state: state})`,
78
78
  &block)};
79
79
  Opal.React.active_redux_components.pop();
@@ -87,7 +87,7 @@ module React
87
87
  %x{
88
88
  var fun = function(prev_props, prev_state) {
89
89
  Opal.React.active_redux_components.push(this.__ruby_instance);
90
- #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new(prev_props)`,
90
+ #{`this.__ruby_instance`.instance_exec(`Opal.React.Component.Props.$new({props: prev_props})`,
91
91
  `Opal.React.Component.State.$new({state: prev_state})`,
92
92
  &block)};
93
93
  Opal.React.active_redux_components.pop();
@@ -14,9 +14,7 @@ module React
14
14
  element = element_or_query
15
15
  end
16
16
  %x{
17
- var children = null;
18
17
  var block_result = null;
19
-
20
18
  Opal.React.render_buffer.push([]);
21
19
  if (block !== nil) {
22
20
  block_result = block.$call()
@@ -3,7 +3,7 @@ module React
3
3
  module Initializer
4
4
  def initialize(native_component)
5
5
  @native = native_component
6
- @props = `Opal.React.Component.Props.$new(#@native.props)`
6
+ @props = `Opal.React.Component.Props.$new(#@native)`
7
7
  @state = `Opal.React.Component.State.$new(#@native)`
8
8
  end
9
9
  end
@@ -60,7 +60,10 @@ module React
60
60
  if (next_props.hasOwnProperty(property)) {
61
61
  if (!this.props.hasOwnProperty(property)) { return true; };
62
62
  if (property == "children") { if (next_props.children !== this.props.children) { return true; }}
63
- else if (typeof next_props[property] !== "undefined" && typeof next_props[property]['$!='] !== "undefined" && typeof this.props[property] !== "undefined" && typeof this.props[property]['$!='] !== "undefined") {
63
+ else if (typeof next_props[property] !== "undefined" && next_props[property] !== null &&
64
+ typeof next_props[property]['$!='] !== "undefined" &&
65
+ typeof this.props[property] !== "undefined" && this.props[property] !== null &&
66
+ typeof this.props[property]['$!='] !== "undefined") {
64
67
  if (#{ !! (`next_props[property]` != `this.props[property]`) }) { return true; };
65
68
  } else if (next_props[property] !== this.props[property]) { return true; };
66
69
  }
@@ -68,7 +71,8 @@ module React
68
71
  for (var property in next_state) {
69
72
  if (next_state.hasOwnProperty(property)) {
70
73
  if (!this.state.hasOwnProperty(property)) { return true; };
71
- if (typeof next_state[property]['$!='] !== "undefined" && typeof this.state[property]['$!='] !== "undefined") {
74
+ if (next_state[property] !== null && typeof next_state[property]['$!='] !== "undefined" &&
75
+ this.state[property] !== null && typeof this.state[property]['$!='] !== "undefined") {
72
76
  if (#{ !! (`next_state[property]` != `this.state[property]`) }) { return true };
73
77
  } else if (next_state[property] !== this.state[property]) { return true };
74
78
  }
@@ -6,52 +6,52 @@ module React
6
6
  def method_missing(prop, *args, &block)
7
7
  %x{
8
8
  var prop_name = Opal.React.lower_camelize(prop);
9
- if (typeof #@native[prop_name] === 'undefined') { return #{nil}; }
10
- return #@native[prop_name];
9
+ if (typeof #@native.props[prop_name] === 'undefined') { return #{nil}; }
10
+ return #@native.props[prop_name];
11
11
  }
12
12
  end
13
13
 
14
14
  def classes
15
- @classes ||= `Opal.React.Component.Styles.$new(#@native.classes)`
15
+ @classes ||= `Opal.React.Component.Styles.$new(#@native.props.classes)`
16
16
  end
17
17
 
18
18
  def isomorfeus_store
19
- @native.JS[:isomorfeus_store]
19
+ @native.JS[:props].JS[:isomorfeus_store]
20
20
  end
21
21
 
22
22
  # for router convenience
23
23
  def history
24
24
  return @history if @history
25
- return nil unless @native.JS[:history]
26
- if @native.JS[:history].JS[:pathname]
27
- @history = React::Component::History.new(@native.JS[:history])
25
+ return nil unless @native.JS[:props].JS[:history]
26
+ if @native.JS[:props].JS[:history].JS[:pathname]
27
+ @history = React::Component::History.new(@native.JS[:props].JS[:history])
28
28
  else
29
- @native.JS[:history]
29
+ @native.JS[:props].JS[:history]
30
30
  end
31
31
  end
32
32
 
33
33
  def location
34
34
  return @location if @location
35
- return nil unless @native.JS[:location]
36
- if @native.JS[:location].JS[:pathname]
37
- @location = React::Component::Location.new(@native.JS[:location])
35
+ return nil unless @native.JS[:props].JS[:location]
36
+ if @native.JS[:props].JS[:location].JS[:pathname]
37
+ @location = React::Component::Location.new(@native.JS[:props].JS[:location])
38
38
  else
39
- @native.JS[:location]
39
+ @native.JS[:props].JS[:location]
40
40
  end
41
41
  end
42
42
 
43
43
  def match
44
44
  return @match if @match
45
- return nil unless @native.JS[:match]
46
- if @native.JS[:match].JS[:path]
47
- @match = React::Component::Match.new(@native.JS[:match])
45
+ return nil unless @native.JS[:props].JS[:match]
46
+ if @native.JS[:props].JS[:match].JS[:path]
47
+ @match = React::Component::Match.new(@native.JS[:props].JS[:match])
48
48
  else
49
- @native.JS[:match]
49
+ @native.JS[:props].JS[:match]
50
50
  end
51
51
  end
52
52
 
53
53
  def to_n
54
- @native
54
+ @native.JS[:props]
55
55
  end
56
56
  end
57
57
  end
@@ -14,7 +14,7 @@ module React
14
14
  def unsafe_component_will_receive_props(&block)
15
15
  %x{
16
16
  self.react_component.prototype.UNSAFE_componentWillReceiveProps = function(next_props) {
17
- return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`next_props`), &block)};
17
+ return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), &block)};
18
18
  }
19
19
  }
20
20
  end
@@ -22,7 +22,7 @@ module React
22
22
  def unsafe_component_will_update(&block)
23
23
  %x{
24
24
  self.react_component.prototype.UNSAFE_componentWillUpdate = function(next_props, next_state) {
25
- return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`next_props`), `Opal.Hash.$new(next_state)`, &block)};
25
+ return #{`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), `Opal.Hash.$new(next_state)`, &block)};
26
26
  }
27
27
  }
28
28
  end
@@ -4,7 +4,7 @@ module React
4
4
  attr_accessor :props
5
5
 
6
6
  def initialize(props)
7
- @props = ::React::Component::Props.new(props)
7
+ @props = ::React::Component::Props.new(`{props: props}`)
8
8
  end
9
9
 
10
10
  def use_callback(deps, &block)
@@ -16,8 +16,8 @@ module React
16
16
  def props_are_equal?(&block)
17
17
  %x{
18
18
  base.equality_checker = function (prev_props, next_props) {
19
- var prev_ruby_props = Opal.React.Component.Props.$new(prev_props);
20
- var next_ruby_props = Opal.React.Component.Props.$new(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
21
  return #{base.new(`{}`).instance_exec(`prev_ruby_props`, `next_ruby_props`, &block)};
22
22
  }
23
23
  }
@@ -5,7 +5,7 @@ module React
5
5
  @native = native_component
6
6
  @app_store = `Opal.React.ReduxComponent.AppStoreProxy.$new(#{self})`
7
7
  @class_store = `Opal.React.ReduxComponent.ClassStoreProxy.$new(#{self})`
8
- @props = `Opal.React.Component.Props.$new(#@native.props)`
8
+ @props = `Opal.React.Component.Props.$new(#@native)`
9
9
  @state = `Opal.React.Component.State.$new(#@native)`
10
10
  @store = `Opal.React.ReduxComponent.InstanceStoreProxy.$new(#{self})`
11
11
  end
@@ -90,7 +90,10 @@ module React
90
90
  if (next_props.hasOwnProperty(property)) {
91
91
  if (!this.props.hasOwnProperty(property)) { return true; };
92
92
  if (property == "children") { if (next_props.children !== this.props.children) { return true; }}
93
- else if (typeof next_props[property] !== "undefined" && typeof next_props[property]['$!='] !== "undefined" && typeof this.props[property] !== "undefined" && typeof this.props[property]['$!='] !== "undefined") {
93
+ else if (typeof next_props[property] !== "undefined" && next_props[property] !== null &&
94
+ typeof next_props[property]['$!='] !== "undefined" &&
95
+ typeof this.props[property] !== "undefined" && this.props[property] !== null &&
96
+ typeof this.props[property]['$!='] !== "undefined") {
94
97
  if (#{ !! (`next_props[property]` != `this.props[property]`) }) { return true; };
95
98
  } else if (next_props[property] !== this.props[property]) { return true; };
96
99
  }
@@ -104,7 +107,8 @@ module React
104
107
  }
105
108
  } else if (next_state.hasOwnProperty(property)) {
106
109
  if (!this.state.hasOwnProperty(property)) { return true; };
107
- if (typeof next_state[property]['$!='] !== "undefined" && typeof this.state[property]['$!='] !== "undefined") {
110
+ if (next_state[property] !== null && typeof next_state[property]['$!='] !== "undefined" &&
111
+ this.state[property] !== null && typeof this.state[property]['$!='] !== "undefined") {
108
112
  if (#{ !! (`next_state[property]` != `this.state[property]`) }) { return true };
109
113
  } else if (next_state[property] !== this.state[property]) { return true };
110
114
  }
data/lib/react/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = '16.8.4'
2
+ VERSION = '16.8.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.8.4
4
+ version: 16.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-12 00:00:00.000000000 Z
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj