isomorfeus-react 16.9.13 → 16.9.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 361db45417f5db77cc41e4e6c77bf2689865ade2d842426da780e3b0eb5e0e2e
4
- data.tar.gz: 86232d87590c5b153e177188f6907d49d9393008296c5e5f84f969d721db813d
3
+ metadata.gz: 70053e0a26f29ea0ee7021a2842b5c87a90059663cd6632c6d0f09537fde5a14
4
+ data.tar.gz: d4e4392d9c50afce0a800afd847d5490ef915614fbe8a31944088e03ca38d3d9
5
5
  SHA512:
6
- metadata.gz: 0d2aad7c2f64836276f924db57370a92d7f69022e4ae368beb227f7531a5ed32cad5cfdc054c0c2a996b6dc97a158bc796d23bc710705a48bbda073cee39a923
7
- data.tar.gz: 69e09d3d348def640b0e0936b537e4fe1b0797f907cd398542c8fbf4c36db279d2c5a4e766e9aa387758171947cfb86068915347b2ecbe4511026c55d92892f8
6
+ metadata.gz: 94d4bf83a2dbcdcd8842b11bd8b1a2f5724d4862b1c4a27b07786542222a1b0aba390f8c01639e1680c7787d9183a93269fb6972418b20bbe243c62e925a69fb
7
+ data.tar.gz: bd391ac3e496bf54711ef02f0b2e113dac261b1f5e802dd36ba557660f8da1863e5e3ddbd450531a653d5a7f9aa84b09d2271924e916f1f8f24b19f7e34edd0b
@@ -1,7 +1,6 @@
1
1
  require 'isomorfeus-react'
2
2
 
3
3
  # LucidMaterial::Component
4
- require 'lucid_material/component/api'
5
4
  require 'lucid_material/component/native_component_constructor'
6
5
  require 'lucid_material/component/mixin'
7
6
  require 'lucid_material/component/base'
@@ -92,6 +92,7 @@ if RUBY_ENGINE == 'opal'
92
92
  LucidApp::Context.create_application_context
93
93
 
94
94
  # LucidComponent
95
+ require 'lucid_component/styles_support'
95
96
  require 'lucid_component/store_api'
96
97
  require 'lucid_component/app_store_defaults'
97
98
  require 'lucid_component/component_class_store_defaults'
@@ -5,11 +5,12 @@ module LucidApp
5
5
  base.extend(::LucidApp::NativeComponentConstructor)
6
6
  base.extend(::LucidPropDeclaration::Mixin)
7
7
  base.extend(::React::Component::ShouldComponentUpdate)
8
- base.extend(::React::Component::EventHandler)
8
+ base.extend(::LucidComponent::EventHandler)
9
9
  base.include(::React::Component::Elements)
10
10
  base.include(::React::Component::API)
11
11
  base.include(::React::Component::Callbacks)
12
12
  base.include(::LucidComponent::StoreAPI)
13
+ base.include(::LucidComponent::StylesSupport)
13
14
  base.include(::LucidApp::API)
14
15
  base.include(::LucidComponent::Initializer)
15
16
  base.include(::React::Component::Features)
@@ -7,7 +7,8 @@ module LucidApp
7
7
  component_name = base.to_s
8
8
  # language=JS
9
9
  %x{
10
- base.react_component = class extends Opal.global.React.Component {
10
+ base.jss_styles = null;
11
+ base.lucid_react_component = class extends Opal.global.React.Component {
11
12
  constructor(props) {
12
13
  super(props);
13
14
  if (base.$default_state_defined()) {
@@ -80,6 +81,22 @@ module LucidApp
80
81
  return null;
81
82
  }
82
83
  }
84
+ base.use_styles = null;
85
+ base.react_component = function(props) {
86
+ let classes = null;
87
+ if (base.jss_styles) {
88
+ if (!base.use_styles || Opal.Isomorfeus["$development?"]()) {
89
+ base.use_styles = Opal.global.ReactJSS.createUseStyles(base.jss_styles);
90
+ }
91
+ classes = base.use_styles();
92
+ }
93
+ if (classes) {
94
+ let classes_props = Object.assign({}, props, { classes: classes });
95
+ return Opal.global.React.createElement(base.lucid_react_component, classes_props);
96
+ } else {
97
+ return Opal.global.React.createElement(base.lucid_react_component, props);
98
+ }
99
+ }
83
100
  }
84
101
  end
85
102
  end
@@ -9,6 +9,7 @@ module LucidComponent
9
9
  base.include(::React::Component::API)
10
10
  base.include(::React::Component::Callbacks)
11
11
  base.include(::LucidComponent::StoreAPI)
12
+ base.include(::LucidComponent::StylesSupport)
12
13
  base.include(::LucidComponent::Initializer)
13
14
  base.include(::React::Component::Features)
14
15
  base.include(::React::Component::Resolution)
@@ -7,12 +7,7 @@ module LucidComponent
7
7
  component_name = base.to_s
8
8
  # language=JS
9
9
  %x{
10
- base.react_component = function(props) {
11
- return Opal.global.React.createElement(Opal.global.LucidApplicationContext.Consumer, null, function(store) {
12
- var store_props = Object.assign({}, props, { isomorfeus_store: store });
13
- return Opal.global.React.createElement(base.lucid_react_component, store_props);
14
- });
15
- }
10
+ base.jss_styles = null;
16
11
  base.lucid_react_component = class extends Opal.global.React.Component {
17
12
  constructor(props) {
18
13
  super(props);
@@ -129,6 +124,25 @@ module LucidComponent
129
124
  }
130
125
  }
131
126
  base.lucid_react_component.contextType = Opal.global.LucidApplicationContext;
127
+ base.use_styles = null;
128
+ base.react_component = function(props) {
129
+ let classes = null;
130
+ if (base.jss_styles) {
131
+ if (!base.use_styles || Opal.Isomorfeus["$development?"]()) {
132
+ base.use_styles = Opal.global.ReactJSS.createUseStyles(base.jss_styles);
133
+ }
134
+ classes = base.use_styles();
135
+ }
136
+ return Opal.global.React.createElement(Opal.global.LucidApplicationContext.Consumer, null, function(store) {
137
+ let store_props = Object.assign({}, props, { isomorfeus_store: store });
138
+ if (classes) {
139
+ let store_classes_props = Object.assign({}, store_props, { classes: classes });
140
+ return Opal.global.React.createElement(base.lucid_react_component, store_classes_props);
141
+ } else {
142
+ return Opal.global.React.createElement(base.lucid_react_component, store_props);
143
+ }
144
+ });
145
+ }
132
146
  }
133
147
  end
134
148
  end
@@ -0,0 +1,31 @@
1
+ module LucidComponent
2
+ module StylesSupport
3
+ def self.included(base)
4
+ base.instance_exec do
5
+ def styles(styles_hash = nil, &block)
6
+ if block_given?
7
+ %x{
8
+ base.jss_styles = function(theme) {
9
+ var result = block.$call(Opal.Hash.$new(theme));
10
+ return result.$to_n();
11
+ }
12
+ }
13
+ nil
14
+ elsif styles_hash
15
+ `base.jss_styles = #{styles_hash.to_n}` if styles_hash
16
+ styles_hash
17
+ elsif `typeof base.jss_styles === 'object'`
18
+ `Opal.Hash.$new(base.jss_styles)`
19
+ else
20
+ nil
21
+ end
22
+ end
23
+ end
24
+
25
+ def classes
26
+ props.classes
27
+ end
28
+ end
29
+ end
30
+ end
31
+
@@ -11,7 +11,7 @@ module LucidMaterial
11
11
  base.include(::React::Component::API)
12
12
  base.include(::React::Component::Callbacks)
13
13
  base.include(::LucidComponent::StoreAPI)
14
- base.include(::LucidMaterial::Component::API)
14
+ base.include(::LucidComponent::StylesSupport)
15
15
  base.include(::LucidApp::API)
16
16
  base.include(::LucidComponent::Initializer)
17
17
  base.include(::React::Component::Features)
@@ -8,7 +8,7 @@ module LucidMaterial
8
8
  component_name = base.to_s
9
9
  # language=JS
10
10
  %x{
11
- base.jss_styles = {};
11
+ base.jss_styles = null;
12
12
  base.lucid_react_component = class extends Opal.global.React.Component {
13
13
  constructor(props) {
14
14
  super(props);
@@ -89,12 +89,16 @@ module LucidMaterial
89
89
  return #{component_name} + 'Shell';
90
90
  }
91
91
  render() {
92
- if (!base.lucid_material_component || Opal.Isomorfeus["$development?"]()) {
93
- base.lucid_material_component = Opal.global.MuiStyles.withStyles(base.jss_styles)(function(props){
94
- return Opal.global.React.createElement(base.lucid_react_component, props);
95
- });
92
+ if (base.jss_styles) {
93
+ if (!base.lucid_material_component || Opal.Isomorfeus["$development?"]()) {
94
+ base.lucid_material_component = Opal.global.MuiStyles.withStyles(base.jss_styles)(function(props){
95
+ return Opal.global.React.createElement(base.lucid_react_component, props);
96
+ });
97
+ }
98
+ return Opal.global.React.createElement(base.lucid_material_component, this.props);
99
+ } else {
100
+ return Opal.global.React.createElement(base.lucid_react_component, this.props)
96
101
  }
97
- return Opal.global.React.createElement(base.lucid_material_component, this.props);
98
102
  }
99
103
  }
100
104
  }
@@ -10,7 +10,7 @@ module LucidMaterial
10
10
  base.include(::React::Component::API)
11
11
  base.include(::React::Component::Callbacks)
12
12
  base.include(::LucidComponent::StoreAPI)
13
- base.include(::LucidMaterial::Component::API)
13
+ base.include(::LucidComponent::StylesSupport)
14
14
  base.include(::LucidComponent::Initializer)
15
15
  base.include(::React::Component::Features)
16
16
  base.include(::React::Component::Resolution)
@@ -8,7 +8,7 @@ module LucidMaterial
8
8
  component_name = base.to_s
9
9
  # language=JS
10
10
  %x{
11
- base.jss_styles = {};
11
+ base.jss_styles = null;
12
12
  base.lucid_react_component = class extends Opal.global.React.Component {
13
13
  constructor(props) {
14
14
  super(props);
@@ -129,12 +129,16 @@ module LucidMaterial
129
129
  base.react_component = function(outer_props) {
130
130
  return Opal.global.React.createElement(Opal.global.LucidApplicationContext.Consumer, null, function(store) {
131
131
  var store_props = Object.assign({}, outer_props, { isomorfeus_store: store });
132
- if (!base.lucid_material_component || Opal.Isomorfeus["$development?"]()) {
133
- base.lucid_material_component = Opal.global.MuiStyles.withStyles(base.jss_styles)(function(props){
134
- return Opal.global.React.createElement(base.lucid_react_component, props);
135
- });
132
+ if (base.jss_styles) {
133
+ if (!base.lucid_material_component || Opal.Isomorfeus["$development?"]()) {
134
+ base.lucid_material_component = Opal.global.MuiStyles.withStyles(base.jss_styles)(function(props) {
135
+ return Opal.global.React.createElement(base.lucid_react_component, props);
136
+ });
137
+ }
138
+ return Opal.global.React.createElement(base.lucid_material_component, store_props);
139
+ } else {
140
+ return Opal.global.React.createElement(base.lucid_react_component, store_props);
136
141
  }
137
- return Opal.global.React.createElement(base.lucid_material_component, store_props);
138
142
  });
139
143
  }
140
144
  }
@@ -7,7 +7,7 @@ module React
7
7
 
8
8
  def method_missing(prop, *args, &block)
9
9
  %x{
10
- if (typeof #@native[prop] === 'undefined') { return #{nil}; }
10
+ if (!#@native || typeof #@native[prop] === 'undefined') { return #{nil}; }
11
11
  return #@native[prop];
12
12
  }
13
13
  end
data/lib/react/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = '16.9.13'
2
+ VERSION = '16.9.14'
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.9.13
4
+ version: 16.9.14
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-08-25 00:00:00.000000000 Z
11
+ date: 2019-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -193,10 +193,10 @@ files:
193
193
  - lib/lucid_component/native_component_constructor.rb
194
194
  - lib/lucid_component/reducers.rb
195
195
  - lib/lucid_component/store_api.rb
196
+ - lib/lucid_component/styles_support.rb
196
197
  - lib/lucid_material/app/base.rb
197
198
  - lib/lucid_material/app/mixin.rb
198
199
  - lib/lucid_material/app/native_component_constructor.rb
199
- - lib/lucid_material/component/api.rb
200
200
  - lib/lucid_material/component/base.rb
201
201
  - lib/lucid_material/component/mixin.rb
202
202
  - lib/lucid_material/component/native_component_constructor.rb
@@ -1,32 +0,0 @@
1
- module LucidMaterial
2
- module Component
3
- module API
4
- def self.included(base)
5
- base.instance_exec do
6
- def styles(styles_hash = nil, &block)
7
- if block_given?
8
- %x{
9
- base.jss_styles = function(theme) {
10
- var result = block.$call(Opal.Hash.$new(theme));
11
- return result.$to_n();
12
- }
13
- }
14
- nil
15
- elsif styles_hash
16
- `base.jss_styles = #{styles_hash.to_n}` if styles_hash
17
- styles_hash
18
- elsif `typeof base.jss_styles === 'object'`
19
- `Opal.Hash.$new(base.jss_styles)`
20
- else
21
- nil
22
- end
23
- end
24
- end
25
-
26
- def classes
27
- props.classes
28
- end
29
- end
30
- end
31
- end
32
- end