isomorfeus-react 16.10.5 → 16.10.6
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
- data/README.md +6 -1
- data/lib/isomorfeus-react.rb +0 -1
- data/lib/lucid_app/mixin.rb +0 -1
- data/lib/lucid_component/native_component_constructor.rb +0 -8
- data/lib/lucid_material/app/mixin.rb +0 -1
- data/lib/lucid_material/component/native_component_constructor.rb +0 -8
- data/lib/react.rb +11 -11
- data/lib/react/component/api.rb +4 -0
- data/lib/react/component/mixin.rb +0 -1
- data/lib/react/component/native_component_constructor.rb +22 -31
- data/lib/react/version.rb +1 -1
- metadata +2 -3
- data/lib/react/component/should_component_update.rb +0 -14
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: afd9951ac47f6c2ed3fea7f8135ba03f63c596c52c3f795901fa974d9c36eb2e
         | 
| 4 | 
            +
              data.tar.gz: 80b4226998ea64b6d12ee0a56959d77ca96e78eebb8f553375a7785d8490a800
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a3f3edfbf9c1a600504dd1125721da402dd8ba4bbe56d026a0b62083425b416eb3de66882f46afaf59b07c8c81ae60b929e34d12062698e001c6248324136fab
         | 
| 7 | 
            +
              data.tar.gz: 94d226fca0ad5fdf2699d8dfbbad78777248877ae5d665831b395cfbf12008edbb897e7d0d0b2f4810fd35da95ab9f862a517571db8ad8422dd8f64c29542475
         | 
    
        data/README.md
    CHANGED
    
    | @@ -22,7 +22,7 @@ Component Types: | |
| 22 22 | 
             
            - [Function and Memo Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/function_component.md)
         | 
| 23 23 | 
             
            - [Lucid App, Lucid Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/lucid_component.md)
         | 
| 24 24 | 
             
            - [LucidMaterial App, LucidMaterial Component](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/lucid_material_component.md) - support for [MaterialUI](https://material-ui.com)
         | 
| 25 | 
            -
            - [React Javascript  | 
| 25 | 
            +
            - [React Javascript Components and React Elements](https://github.com/isomorfeus/isomorfeus-react/blob/master/ruby/docs/javascript_component.md)
         | 
| 26 26 |  | 
| 27 27 | 
             
            Which component to use?
         | 
| 28 28 | 
             
            - Usually LucidApp and LucidComponent along with some imported javascript components.
         | 
| @@ -61,3 +61,8 @@ https://github.com/facebook/react-devtools | |
| 61 61 | 
             
            - clone repo
         | 
| 62 62 | 
             
            - `bundle install`
         | 
| 63 63 | 
             
            - `rake`
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            Implementations for the [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark):
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            - [using LucidComponent](https://github.com/janbiedermann/js-framework-benchmark/tree/master/frameworks/keyed/isomorfeus-lucid)
         | 
| 68 | 
            +
            - [using React::Component](https://github.com/janbiedermann/js-framework-benchmark/tree/master/frameworks/keyed/isomorfeus-react)
         | 
    
        data/lib/isomorfeus-react.rb
    CHANGED
    
    | @@ -71,7 +71,6 @@ if RUBY_ENGINE == 'opal' | |
| 71 71 | 
             
              require 'react/component/location'
         | 
| 72 72 | 
             
              require 'react/component/history'
         | 
| 73 73 | 
             
              require 'react/component/resolution'
         | 
| 74 | 
            -
              require 'react/component/should_component_update'
         | 
| 75 74 | 
             
              require 'react/component/event_handler'
         | 
| 76 75 | 
             
              require 'react/component/styles'
         | 
| 77 76 | 
             
              require 'react/component/mixin'
         | 
    
        data/lib/lucid_app/mixin.rb
    CHANGED
    
    | @@ -4,7 +4,6 @@ module LucidApp | |
| 4 4 | 
             
                  base.include(::Native::Wrapper)
         | 
| 5 5 | 
             
                  base.extend(::LucidApp::NativeComponentConstructor)
         | 
| 6 6 | 
             
                  base.extend(::LucidPropDeclaration::Mixin)
         | 
| 7 | 
            -
                  base.extend(::React::Component::ShouldComponentUpdate)
         | 
| 8 7 | 
             
                  base.extend(::LucidComponent::EventHandler)
         | 
| 9 8 | 
             
                  base.include(::React::Component::Elements)
         | 
| 10 9 | 
             
                  base.include(::React::Component::API)
         | 
| @@ -57,14 +57,6 @@ module LucidComponent | |
| 57 57 | 
             
                        return this.context;
         | 
| 58 58 | 
             
                      }
         | 
| 59 59 | 
             
                      shouldComponentUpdate(next_props, next_state) {
         | 
| 60 | 
            -
                        var next_props_keys = Object.keys(next_props);
         | 
| 61 | 
            -
                        var this_props_keys = Object.keys(this.props);
         | 
| 62 | 
            -
                        if (next_props_keys.length !== this_props_keys.length) { return true; }
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                        var next_state_keys = Object.keys(next_state);
         | 
| 65 | 
            -
                        var this_state_keys = Object.keys(this.state);
         | 
| 66 | 
            -
                        if (next_state_keys.length !== this_state_keys.length) { return true; }
         | 
| 67 | 
            -
             | 
| 68 60 | 
             
                        for (var property in next_props) {
         | 
| 69 61 | 
             
                          if (next_props.hasOwnProperty(property)) {
         | 
| 70 62 | 
             
                            if (!this.props.hasOwnProperty(property)) { return true; };
         | 
| @@ -5,7 +5,6 @@ module LucidMaterial | |
| 5 5 | 
             
                    base.include(::Native::Wrapper)
         | 
| 6 6 | 
             
                    base.extend(::LucidMaterial::App::NativeComponentConstructor)
         | 
| 7 7 | 
             
                    base.extend(::LucidPropDeclaration::Mixin)
         | 
| 8 | 
            -
                    base.extend(::React::Component::ShouldComponentUpdate)
         | 
| 9 8 | 
             
                    base.extend(::LucidComponent::EventHandler)
         | 
| 10 9 | 
             
                    base.include(::React::Component::Elements)
         | 
| 11 10 | 
             
                    base.include(::React::Component::API)
         | 
| @@ -58,14 +58,6 @@ module LucidMaterial | |
| 58 58 | 
             
                          return this.context;
         | 
| 59 59 | 
             
                        }
         | 
| 60 60 | 
             
                        shouldComponentUpdate(next_props, next_state) {
         | 
| 61 | 
            -
                          var next_props_keys = Object.keys(next_props);
         | 
| 62 | 
            -
                          var this_props_keys = Object.keys(this.props);
         | 
| 63 | 
            -
                          if (next_props_keys.length !== this_props_keys.length) { return true; }
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                          var next_state_keys = Object.keys(next_state);
         | 
| 66 | 
            -
                          var this_state_keys = Object.keys(this.state);
         | 
| 67 | 
            -
                          if (next_state_keys.length !== this_state_keys.length) { return true; }
         | 
| 68 | 
            -
             | 
| 69 61 | 
             
                          for (var property in next_props) {
         | 
| 70 62 | 
             
                            if (next_props.hasOwnProperty(property)) {
         | 
| 71 63 | 
             
                              if (!this.props.hasOwnProperty(property)) { return true; };
         | 
    
        data/lib/react.rb
    CHANGED
    
    | @@ -17,7 +17,6 @@ module React | |
| 17 17 | 
             
                self.lower_camelize = function(snake_cased_word) {
         | 
| 18 18 | 
             
                  var parts = snake_cased_word.split('_');
         | 
| 19 19 | 
             
                  var res = parts[0];
         | 
| 20 | 
            -
                  if (parts.length === 1) { return res; }
         | 
| 21 20 | 
             
                  for (var i = 1; i < parts.length; i++) {
         | 
| 22 21 | 
             
                        res += parts[i][0].toUpperCase() + parts[i].slice(1);
         | 
| 23 22 | 
             
                  }
         | 
| @@ -34,24 +33,25 @@ module React | |
| 34 33 | 
             
                    var result = {};
         | 
| 35 34 | 
             
                    var keys = ruby_style_props.$keys();
         | 
| 36 35 | 
             
                    var keys_length = keys.length;
         | 
| 36 | 
            +
                    let key;
         | 
| 37 37 | 
             
                    for (var i = 0; i < keys_length; i++) {
         | 
| 38 | 
            -
                       | 
| 39 | 
            -
             | 
| 38 | 
            +
                      key = keys[i];
         | 
| 39 | 
            +
                      if (key[0] === 'o' && key[1] === 'n' && key[2] === '_') {
         | 
| 40 | 
            +
                        var handler = ruby_style_props['$[]'](key);
         | 
| 40 41 | 
             
                        if (typeof handler === "function") {
         | 
| 41 | 
            -
                          result[Opal.React.lower_camelize( | 
| 42 | 
            +
                          result[Opal.React.lower_camelize(key)] = handler;
         | 
| 42 43 | 
             
                        } else {
         | 
| 43 44 | 
             
                          var active_component = Opal.React.active_component();
         | 
| 44 | 
            -
                          result[Opal.React.lower_camelize( | 
| 45 | 
            +
                          result[Opal.React.lower_camelize(key)] = active_component[handler];
         | 
| 45 46 | 
             
                        }
         | 
| 46 | 
            -
                      } else if ( | 
| 47 | 
            -
                        result[ | 
| 48 | 
            -
                      } else if (keys | 
| 49 | 
            -
                        var val = ruby_style_props['$[]']( | 
| 47 | 
            +
                      } else if (key[0] === 'a' && key.startsWith("aria_")) {
         | 
| 48 | 
            +
                        result[key.replace("_", "-")] = ruby_style_props['$[]'](key);
         | 
| 49 | 
            +
                      } else if (keys === "style") {
         | 
| 50 | 
            +
                        var val = ruby_style_props['$[]'](key);
         | 
| 50 51 | 
             
                        if (typeof val.$$is_hash !== "undefined") { val = val.$to_n() }
         | 
| 51 52 | 
             
                        result["style"] = val;
         | 
| 52 53 | 
             
                      } else {
         | 
| 53 | 
            -
                         | 
| 54 | 
            -
                        result[Opal.React.lower_camelize(keys[i])] = ruby_style_props['$[]'](keys[i]);
         | 
| 54 | 
            +
                        result[key.indexOf('_') > 0 ? Opal.React.lower_camelize(key) : key] = ruby_style_props['$[]'](key);
         | 
| 55 55 | 
             
                      }
         | 
| 56 56 | 
             
                    }
         | 
| 57 57 | 
             
                    return result;
         | 
    
        data/lib/react/component/api.rb
    CHANGED
    
    
| @@ -5,7 +5,6 @@ module React | |
| 5 5 | 
             
                    base.include(::Native::Wrapper)
         | 
| 6 6 | 
             
                    base.extend(::React::Component::NativeComponentConstructor)
         | 
| 7 7 | 
             
                    base.extend(::LucidPropDeclaration::Mixin)
         | 
| 8 | 
            -
                    base.extend(::React::Component::ShouldComponentUpdate)
         | 
| 9 8 | 
             
                    base.extend(::React::Component::EventHandler)
         | 
| 10 9 | 
             
                    base.include(::React::Component::Elements)
         | 
| 11 10 | 
             
                    base.include(::React::Component::API)
         | 
| @@ -48,40 +48,31 @@ module React | |
| 48 48 | 
             
                          return Opal.React.render_buffer.pop();
         | 
| 49 49 | 
             
                        }
         | 
| 50 50 | 
             
                        shouldComponentUpdate(next_props, next_state) {
         | 
| 51 | 
            -
                          if (base. | 
| 52 | 
            -
                            return this.__ruby_instance | 
| 53 | 
            -
                          } | 
| 54 | 
            -
             | 
| 55 | 
            -
                             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
                              if (next_props. | 
| 64 | 
            -
                                if (!this.props.hasOwnProperty(property)) { return true; }
         | 
| 65 | 
            -
                                if (property == "children") { if (next_props.children !== this.props.children) { return true; }}
         | 
| 66 | 
            -
                                else if (typeof next_props[property] !== "undefined" && next_props[property] !== null &&
         | 
| 67 | 
            -
                                         typeof next_props[property]['$!='] !== "undefined" &&
         | 
| 68 | 
            -
                                         typeof this.props[property] !== "undefined" && this.props[property] !== null &&
         | 
| 69 | 
            -
                                         typeof this.props[property]['$!='] !== "undefined") {
         | 
| 70 | 
            -
                                  if (#{ !! (`next_props[property]` != `this.props[property]`) }) { return true; }
         | 
| 71 | 
            -
                                } else if (next_props[property] !== this.props[property]) { return true; }
         | 
| 72 | 
            -
                              }
         | 
| 51 | 
            +
                          if (base.should_component_update_block) {
         | 
| 52 | 
            +
                            return #{!!`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), React::Component::State.new(`{state: next_state }`), &`base.should_component_update_block`)};
         | 
| 53 | 
            +
                          }
         | 
| 54 | 
            +
                          for (var property in next_props) {
         | 
| 55 | 
            +
                            if (next_props.hasOwnProperty(property)) {
         | 
| 56 | 
            +
                              if (!this.props.hasOwnProperty(property)) { return true; }
         | 
| 57 | 
            +
                              if (property == "children") { if (next_props.children !== this.props.children) { return true; }}
         | 
| 58 | 
            +
                              else if (typeof next_props[property] !== "undefined" && next_props[property] !== null &&
         | 
| 59 | 
            +
                                       typeof next_props[property]['$!='] !== "undefined" &&
         | 
| 60 | 
            +
                                       typeof this.props[property] !== "undefined" && this.props[property] !== null &&
         | 
| 61 | 
            +
                                       typeof this.props[property]['$!='] !== "undefined") {
         | 
| 62 | 
            +
                                if (#{ !! (`next_props[property]` != `this.props[property]`) }) { return true; }
         | 
| 63 | 
            +
                              } else if (next_props[property] !== this.props[property]) { return true; }
         | 
| 73 64 | 
             
                            }
         | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
                                   | 
| 80 | 
            -
                                 | 
| 81 | 
            -
                              }
         | 
| 65 | 
            +
                          }
         | 
| 66 | 
            +
                          for (var property in next_state) {
         | 
| 67 | 
            +
                            if (next_state.hasOwnProperty(property)) {
         | 
| 68 | 
            +
                              if (!this.state.hasOwnProperty(property)) { return true; };
         | 
| 69 | 
            +
                              if (next_state[property] !== null && typeof next_state[property]['$!='] !== "undefined" &&
         | 
| 70 | 
            +
                                  this.state[property] !== null && typeof this.state[property]['$!='] !== "undefined") {
         | 
| 71 | 
            +
                                if (#{ !! (`next_state[property]` != `this.state[property]`) }) { return true }
         | 
| 72 | 
            +
                              } else if (next_state[property] !== this.state[property]) { return true }
         | 
| 82 73 | 
             
                            }
         | 
| 83 | 
            -
                            return false;
         | 
| 84 74 | 
             
                          }
         | 
| 75 | 
            +
                          return false;
         | 
| 85 76 | 
             
                        }
         | 
| 86 77 | 
             
                        validateProp(props, propName, componentName) {
         | 
| 87 78 | 
             
                          try { base.$validate_prop(propName, props[propName]) }
         | 
    
        data/lib/react/version.rb
    CHANGED
    
    
    
        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.10. | 
| 4 | 
            +
              version: 16.10.6
         | 
| 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-10- | 
| 11 | 
            +
            date: 2019-10-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: oj
         | 
| @@ -217,7 +217,6 @@ files: | |
| 217 217 | 
             
            - lib/react/component/native_component_constructor.rb
         | 
| 218 218 | 
             
            - lib/react/component/props.rb
         | 
| 219 219 | 
             
            - lib/react/component/resolution.rb
         | 
| 220 | 
            -
            - lib/react/component/should_component_update.rb
         | 
| 221 220 | 
             
            - lib/react/component/state.rb
         | 
| 222 221 | 
             
            - lib/react/component/styles.rb
         | 
| 223 222 | 
             
            - lib/react/component/unsafe_api.rb
         | 
| @@ -1,14 +0,0 @@ | |
| 1 | 
            -
            module React
         | 
| 2 | 
            -
              module Component
         | 
| 3 | 
            -
                module ShouldComponentUpdate
         | 
| 4 | 
            -
                  def self.extended(base)
         | 
| 5 | 
            -
                    base.define_singleton_method(:should_component_update?) do |&block|
         | 
| 6 | 
            -
                      `base.has_custom_should_component_update = true`
         | 
| 7 | 
            -
                      define_method(:should_component_update) do |next_props, next_state|
         | 
| 8 | 
            -
                        !!block.call(Hash.new(next_props), Hash.new(next_state))
         | 
| 9 | 
            -
                      end
         | 
| 10 | 
            -
                    end
         | 
| 11 | 
            -
                  end
         | 
| 12 | 
            -
                end
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         |