hyper-react 0.12.7 → 0.99.0
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 +5 -5
- data/.gitignore +48 -34
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +5 -6
- data/README.md +47 -98
- data/Rakefile +6 -28
- data/hyper-react.gemspec +36 -43
- data/lib/hyper-react.rb +4 -73
- data/lib/react/version.rb +3 -0
- metadata +91 -249
- data/.codeclimate.yml +0 -27
- data/.rubocop.yml +0 -1159
- data/.travis.yml +0 -62
- data/Appraisals +0 -31
- data/CHANGELOG.md +0 -143
- data/LICENSE +0 -19
- data/UPGRADING.md +0 -24
- data/component-name-lookup.md +0 -145
- data/config.ru +0 -26
- data/gemfiles/opal_0.10_react_13.gemfile +0 -15
- data/gemfiles/opal_0.10_react_14.gemfile +0 -15
- data/gemfiles/opal_0.10_react_15.gemfile +0 -15
- data/gemfiles/opal_0.8_react_13.gemfile +0 -15
- data/gemfiles/opal_0.8_react_14.gemfile +0 -15
- data/gemfiles/opal_0.8_react_15.gemfile +0 -15
- data/gemfiles/opal_0.9_react_13.gemfile +0 -15
- data/gemfiles/opal_0.9_react_14.gemfile +0 -15
- data/gemfiles/opal_0.9_react_15.gemfile +0 -15
- data/gemfiles/opal_master_react_15.gemfile +0 -16
- data/lib/generators/reactive_ruby/test_app/templates/assets/javascripts/components.rb +0 -3
- data/lib/generators/reactive_ruby/test_app/templates/assets/javascripts/test_application.rb +0 -2
- data/lib/generators/reactive_ruby/test_app/templates/boot.rb.erb +0 -6
- data/lib/generators/reactive_ruby/test_app/templates/script/rails +0 -5
- data/lib/generators/reactive_ruby/test_app/templates/test_application.rb.erb +0 -13
- data/lib/generators/reactive_ruby/test_app/templates/views/components/hello_world.rb +0 -11
- data/lib/generators/reactive_ruby/test_app/templates/views/components/todo.rb +0 -14
- data/lib/generators/reactive_ruby/test_app/templates/views/layouts/test_layout.html.erb +0 -0
- data/lib/generators/reactive_ruby/test_app/test_app_generator.rb +0 -111
- data/lib/rails-helpers/top_level_rails_component.rb +0 -54
- data/lib/react-sources/react-server.js +0 -2
- data/lib/react/api.rb +0 -173
- data/lib/react/callbacks.rb +0 -41
- data/lib/react/children.rb +0 -30
- data/lib/react/component.rb +0 -168
- data/lib/react/component/api.rb +0 -50
- data/lib/react/component/base.rb +0 -13
- data/lib/react/component/class_methods.rb +0 -189
- data/lib/react/component/dsl_instance_methods.rb +0 -23
- data/lib/react/component/params.rb +0 -6
- data/lib/react/component/props_wrapper.rb +0 -78
- data/lib/react/component/should_component_update.rb +0 -94
- data/lib/react/component/tags.rb +0 -129
- data/lib/react/config.rb +0 -5
- data/lib/react/config/client.rb.erb +0 -19
- data/lib/react/config/server.rb +0 -23
- data/lib/react/element.rb +0 -169
- data/lib/react/event.rb +0 -76
- data/lib/react/ext/hash.rb +0 -9
- data/lib/react/ext/opal-jquery/element.rb +0 -26
- data/lib/react/ext/string.rb +0 -8
- data/lib/react/hash.rb +0 -13
- data/lib/react/native_library.rb +0 -87
- data/lib/react/object.rb +0 -15
- data/lib/react/react-source-browser.rb +0 -3
- data/lib/react/react-source-server.rb +0 -3
- data/lib/react/react-source.rb +0 -20
- data/lib/react/ref_callback.rb +0 -31
- data/lib/react/rendering_context.rb +0 -144
- data/lib/react/server.rb +0 -23
- data/lib/react/state_wrapper.rb +0 -23
- data/lib/react/test.rb +0 -16
- data/lib/react/test/dsl.rb +0 -17
- data/lib/react/test/matchers/render_html_matcher.rb +0 -56
- data/lib/react/test/rspec.rb +0 -15
- data/lib/react/test/session.rb +0 -37
- data/lib/react/test/utils.rb +0 -25
- data/lib/react/top_level.rb +0 -118
- data/lib/react/top_level_render.rb +0 -29
- data/lib/react/validator.rb +0 -136
- data/lib/reactive-ruby/component_loader.rb +0 -50
- data/lib/reactive-ruby/isomorphic_helpers.rb +0 -212
- data/lib/reactive-ruby/rails.rb +0 -7
- data/lib/reactive-ruby/rails/component_mount.rb +0 -46
- data/lib/reactive-ruby/rails/controller_helper.rb +0 -15
- data/lib/reactive-ruby/rails/railtie.rb +0 -33
- data/lib/reactive-ruby/serializers.rb +0 -15
- data/lib/reactive-ruby/server_rendering/contextual_renderer.rb +0 -42
- data/lib/reactive-ruby/version.rb +0 -3
- data/lib/reactrb/auto-import.rb +0 -27
- data/lib/reactrb/deep-compare.rb +0 -24
- data/lib/reactrb/new-event-name-convention.rb +0 -11
- data/logo1.png +0 -0
- data/logo2.png +0 -0
- data/logo3.png +0 -0
- data/path_release_steps.md +0 -9
- data/spec/controller_helper_spec.rb +0 -34
- data/spec/index.html.erb +0 -11
- data/spec/react/callbacks_spec.rb +0 -138
- data/spec/react/children_spec.rb +0 -76
- data/spec/react/component/base_spec.rb +0 -32
- data/spec/react/component_spec.rb +0 -884
- data/spec/react/dsl_spec.rb +0 -303
- data/spec/react/element_spec.rb +0 -136
- data/spec/react/event_spec.rb +0 -24
- data/spec/react/native_library_spec.rb +0 -322
- data/spec/react/observable_spec.rb +0 -42
- data/spec/react/opal_jquery_extensions_spec.rb +0 -68
- data/spec/react/param_declaration_spec.rb +0 -269
- data/spec/react/react_spec.rb +0 -215
- data/spec/react/refs_callback_spec.rb +0 -56
- data/spec/react/server_spec.rb +0 -25
- data/spec/react/state_spec.rb +0 -55
- data/spec/react/test/dsl_spec.rb +0 -43
- data/spec/react/test/matchers/render_html_matcher_spec.rb +0 -83
- data/spec/react/test/rspec_spec.rb +0 -62
- data/spec/react/test/session_spec.rb +0 -88
- data/spec/react/test/utils_spec.rb +0 -28
- data/spec/react/top_level_component_spec.rb +0 -101
- data/spec/react/tutorial/tutorial_spec.rb +0 -36
- data/spec/react/validator_spec.rb +0 -124
- data/spec/reactive-ruby/component_loader_spec.rb +0 -77
- data/spec/reactive-ruby/isomorphic_helpers_spec.rb +0 -160
- data/spec/reactive-ruby/rails/asset_pipeline_spec.rb +0 -10
- data/spec/reactive-ruby/rails/component_mount_spec.rb +0 -66
- data/spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb +0 -35
- data/spec/spec_helper.rb +0 -149
- data/spec/support/react/spec_helpers.rb +0 -44
- data/spec/vendor/es5-shim.min.js +0 -6
- data/spec/vendor/jquery-2.2.4.min.js +0 -4
data/.travis.yml
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
rvm:
|
|
3
|
-
- 1.9.3
|
|
4
|
-
- 2.0.0
|
|
5
|
-
- 2.1
|
|
6
|
-
- jruby-19mode
|
|
7
|
-
before_script:
|
|
8
|
-
- phantomjs --version
|
|
9
|
-
env:
|
|
10
|
-
- PHANTOMJS_VERSION=1.9.8
|
|
11
|
-
gemfile:
|
|
12
|
-
- gemfiles/opal_0.8_react_13.gemfile
|
|
13
|
-
- gemfiles/opal_0.8_react_14.gemfile
|
|
14
|
-
- gemfiles/opal_0.8_react_15.gemfile
|
|
15
|
-
- gemfiles/opal_0.9_react_13.gemfile
|
|
16
|
-
- gemfiles/opal_0.9_react_14.gemfile
|
|
17
|
-
- gemfiles/opal_0.9_react_15.gemfile
|
|
18
|
-
cache:
|
|
19
|
-
directories:
|
|
20
|
-
- "travis_phantomjs"
|
|
21
|
-
branches:
|
|
22
|
-
only:
|
|
23
|
-
- master
|
|
24
|
-
before_install:
|
|
25
|
-
- "phantomjs --version"
|
|
26
|
-
- "export PATH=$PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin:$PATH"
|
|
27
|
-
- "phantomjs --version"
|
|
28
|
-
- "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then rm -rf $PWD/travis_phantomjs; mkdir -p $PWD/travis_phantomjs; fi"
|
|
29
|
-
- "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then wget https://github.com/Medium/phantomjs/releases/download/v$PHANTOMJS_VERSION/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -O $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2; fi"
|
|
30
|
-
- "if [ $(phantomjs --version) != $PHANTOMJS_VERSION ]; then tar -xvf $PWD/travis_phantomjs/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs; fi"
|
|
31
|
-
- "phantomjs --version"
|
|
32
|
-
- gem install bundler -v 1.13.7
|
|
33
|
-
script:
|
|
34
|
-
- bundle exec rake test_app
|
|
35
|
-
- bundle exec rake
|
|
36
|
-
# These two setup seems to run indefinitely long
|
|
37
|
-
# further investigation required.
|
|
38
|
-
matrix:
|
|
39
|
-
exclude:
|
|
40
|
-
- rvm: jruby-19mode
|
|
41
|
-
gemfile: gemfiles/opal_0.9_react_13.gemfile
|
|
42
|
-
- rvm: jruby-19mode
|
|
43
|
-
gemfile: gemfiles/opal_0.9_react_14.gemfile
|
|
44
|
-
- rvm: jruby-19mode
|
|
45
|
-
gemfile: gemfiles/opal_0.9_react_15.gemfile
|
|
46
|
-
include:
|
|
47
|
-
- rvm: 2.1
|
|
48
|
-
env: PHANTOMJS_VERSION=2.1.1
|
|
49
|
-
gemfile: gemfiles/opal_0.10_react_13.gemfile
|
|
50
|
-
- rvm: 2.1
|
|
51
|
-
env: PHANTOMJS_VERSION=2.1.1
|
|
52
|
-
gemfile: gemfiles/opal_0.10_react_14.gemfile
|
|
53
|
-
- rvm: 2.1
|
|
54
|
-
env: PHANTOMJS_VERSION=2.1.1
|
|
55
|
-
gemfile: gemfiles/opal_0.10_react_15.gemfile
|
|
56
|
-
- rvm: 2.1
|
|
57
|
-
env: PHANTOMJS_VERSION=2.1.1
|
|
58
|
-
gemfile: gemfiles/opal_master_react_15.gemfile
|
|
59
|
-
allow_failures:
|
|
60
|
-
- rvm: 2.1
|
|
61
|
-
env: PHANTOMJS_VERSION=2.1.1
|
|
62
|
-
gemfile: gemfiles/opal_master_react_15.gemfile
|
data/Appraisals
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
opal_versions = ['0.8', '0.9', '0.10']
|
|
2
|
-
react_versions_map = {
|
|
3
|
-
'13' => '~> 1.3.3',
|
|
4
|
-
'14' => '~> 1.6.2',
|
|
5
|
-
'15' => '~> 1.10.0'
|
|
6
|
-
}
|
|
7
|
-
opal_rails_versions_map = {
|
|
8
|
-
'0.8' => '~> 0.8.1',
|
|
9
|
-
'0.9' => '~> 0.9.0',
|
|
10
|
-
'0.10' => '~> 0.9.0',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
opal_versions.each do |opal_v|
|
|
14
|
-
react_versions_map.each do |react_v, react_rails_v|
|
|
15
|
-
appraise "opal-#{opal_v}-react-#{react_v}" do
|
|
16
|
-
ruby ">= 1.9.3"
|
|
17
|
-
gem 'opal', "~> #{opal_v}.0"
|
|
18
|
-
gem 'opal-rails', opal_rails_versions_map[opal_v]
|
|
19
|
-
gem 'react-rails', react_rails_v, require: false
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
appraise "opal-master-react-15" do
|
|
26
|
-
ruby '>= 2.0.0'
|
|
27
|
-
gem 'opal', git: 'https://github.com/opal/opal.git'
|
|
28
|
-
gem "opal-sprockets", git: 'https://github.com/opal/opal-sprockets.git'
|
|
29
|
-
gem 'opal-rails', '~> 0.9.0'
|
|
30
|
-
gem 'react-rails', '~> 1.10.0', require: false
|
|
31
|
-
end
|
data/CHANGELOG.md
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file starting with v0.8.6.
|
|
4
|
-
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
|
5
|
-
|
|
6
|
-
Changes are grouped as follows:
|
|
7
|
-
- **Added** for new features.
|
|
8
|
-
- **Changed** for changes in existing functionality.
|
|
9
|
-
- **Deprecated** for once-stable features to be removed in upcoming releases.
|
|
10
|
-
- **Removed** for deprecated features removed in this release.
|
|
11
|
-
- **Fixed** for any bug fixes.
|
|
12
|
-
- **Security** to invite users to upgrade in case of vulnerabilities.
|
|
13
|
-
|
|
14
|
-
<!--
|
|
15
|
-
Whitespace conventions:
|
|
16
|
-
- 4 spaces before ## titles
|
|
17
|
-
- 2 spaces before ### titles
|
|
18
|
-
- 1 spaces before normal text
|
|
19
|
-
-->
|
|
20
|
-
|
|
21
|
-
## [0.12.0] - Unreleased
|
|
22
|
-
|
|
23
|
-
### Added
|
|
24
|
-
|
|
25
|
-
- `React::Server` is provided as a module wrapping the original `ReactDOMServer` API, require `react/server` to use it. (#186)
|
|
26
|
-
- `React::Config` is introduced, `environment` is the only config option provided for now. See [#204](https://github.com/ruby-hyperloop/hyper-react/issues/204) for usage details.
|
|
27
|
-
|
|
28
|
-
### Changed
|
|
29
|
-
|
|
30
|
-
- State syntax is now consistent with Hyperloop::Store, old syntax is deprecated. (#209, #97)
|
|
31
|
-
|
|
32
|
-
### Deprecated
|
|
33
|
-
|
|
34
|
-
- Current ref callback behavior is deprecated. Require `"react/ref_callback"` to get the updated behavior. (#188)
|
|
35
|
-
- `React.render_to_string` & `React.render_to_static_markup` is deprecated, use `React::Server.render_to_string` & `React::Server.render_to_static_markup` instead. (#186)
|
|
36
|
-
- `react/react-source` is deprecated, use `react/react-source-browser` or `react/react-source-server` instead. For most usecase, `react/react-source-browser` is sufficient. If you are using the built-in server side rendering feature, the actual `ReactDOMServer` is already provided by the `react-rails` gem. Therefore, unless you are building a custom server side rendering mechanism, it's not suggested to use `react/react-source-server` in browser code. (#186)
|
|
37
|
-
|
|
38
|
-
### Removed
|
|
39
|
-
|
|
40
|
-
- `react-latest` & `react-v1x` is removed. Use `react/react-source-browser` or `react/react-source-server` instead.
|
|
41
|
-
- Support for Ruby < 2.0 is removed. (#201)
|
|
42
|
-
|
|
43
|
-
### Fixed
|
|
44
|
-
|
|
45
|
-
- [NativeLibrary] Passing native JS object as props will raise exception. (#195)
|
|
46
|
-
- Returns better error message if result of rendering block is not suitable (#207)
|
|
47
|
-
- Batch all state changes and execute *after* rendering cycle (#206, #178) (Code is now moved to Hyper::Store)
|
|
48
|
-
You can revert to the old behavior by defining the `React::State::ALWAYS_UPDATE_STATE_AFTER_RENDER = false`
|
|
49
|
-
- Memory Leak in render context fixed (#192)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## [0.11.0] - 2016-12-13
|
|
53
|
-
|
|
54
|
-
### Changed
|
|
55
|
-
|
|
56
|
-
- The whole opal-activesuppport is not loaded by default now. This gave us about 18% size reduction on the built file. If your code rely on any of the module which is not required by hyper-react, you need to require it yourself. (#135)
|
|
57
|
-
|
|
58
|
-
### Deprecated
|
|
59
|
-
|
|
60
|
-
- Current `React.render` behavior is deprecated. Require `"react/top_level_render"` to get the updated behavior. (#187)
|
|
61
|
-
- `React.is_valid_element` is deprecated in favor of `React.is_valid_element?`.
|
|
62
|
-
- `expect(component).to render('<div />')` is now deprecated in favor of `expect(component).to render_static_html('<div />')`, which is much clearer.
|
|
63
|
-
|
|
64
|
-
### Fixed
|
|
65
|
-
|
|
66
|
-
- `ReferenceError: window is not defined` error in prerender context with react-rails v1.10.0. (#196)
|
|
67
|
-
- State might not be updated using `React::Observable` from a param. (#175)
|
|
68
|
-
- Arity checking failed for `_react_param_conversion` & `React::Element#initialize` (#167)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
## [0.10.0] - 2016-10-30
|
|
72
|
-
|
|
73
|
-
### Changed
|
|
74
|
-
|
|
75
|
-
- This gem is now renamed to `hyper-react`, see [UPGRADING](UPGRADING.md) for details.
|
|
76
|
-
|
|
77
|
-
### Fixed
|
|
78
|
-
|
|
79
|
-
- ReactJS functional stateless component could not be imported from `NativeLibrary`. Note that functional component is only supported in React v14+. (#162)
|
|
80
|
-
- Prerender log got accumulated between reqeusts. (#176)
|
|
81
|
-
|
|
82
|
-
## [0.9.0] - 2016-10-19
|
|
83
|
-
|
|
84
|
-
### Added
|
|
85
|
-
|
|
86
|
-
- `react/react-source` is the suggested way to include ReactJS sources now. Simply require `react/react-source` immediately before the `require "reactrb"` in your Opal code will make it work.
|
|
87
|
-
|
|
88
|
-
### Deprecated
|
|
89
|
-
|
|
90
|
-
- `react-latest` & `react-v1x` is deprecated. Use `react/react-source` instead.
|
|
91
|
-
|
|
92
|
-
### Removed
|
|
93
|
-
|
|
94
|
-
- `opal-browser` is removed from runtime dependency. (#133) You will have to add `gem 'opal-browser'` to your gemfile (recommended) or remove all references to opal-browser from your manifest files.
|
|
95
|
-
|
|
96
|
-
### Fixed
|
|
97
|
-
|
|
98
|
-
- `$window#on` in `opal-jquery` is broken. (#166)
|
|
99
|
-
- `Element#render` trigger unnecessary re-mounts when called multiple times. (#170)
|
|
100
|
-
- Gets rid of react warnings about updating state during render (#155)
|
|
101
|
-
- Multiple HAML classes (i.e. div.foo.bar) was not working (regression introduced in 0.8.8)
|
|
102
|
-
- Don't send nil (null) to form components as the value string (#157)
|
|
103
|
-
- Process `params` (props) correctly when using `Element#on` or `Element#render` (#158)
|
|
104
|
-
- Deprecate shallow param compare (#156)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
## [0.8.8] - 2016-07-13
|
|
108
|
-
|
|
109
|
-
### Added
|
|
110
|
-
|
|
111
|
-
- More helpful error messages on render failures (#152)
|
|
112
|
-
- `Element#on('<my_event_name>')` subscribes to `my_event_name` (#153)
|
|
113
|
-
|
|
114
|
-
### Changed
|
|
115
|
-
|
|
116
|
-
- `Element#on(:event)` subscribes to `on_event` for reactrb components and `onEvent` for native components. (#153)
|
|
117
|
-
|
|
118
|
-
### Deprecated
|
|
119
|
-
|
|
120
|
-
- `Element#on(:event)` subscription to `_onEvent` is deprecated. Once you have changed params named `_on...` to `on_...` you can `require 'reactrb/new-event-name-convention.rb'` to avoid spurious react warning messages. (#153)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
### Fixed
|
|
124
|
-
|
|
125
|
-
- The `Element['#container'].render...` method generates a spurious react error (#154)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
## [0.8.7] - 2016-07-08
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### Fixed
|
|
134
|
-
|
|
135
|
-
- Opal 0.10.x compatibility
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
## [0.8.6] - 2016-06-30
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
### Fixed
|
|
142
|
-
|
|
143
|
-
- Method missing within a component was being reported as `incorrect const name` (#151)
|
data/LICENSE
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2015 Yi-Cheng Chang (http://github.com/zetachang)
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
data/UPGRADING.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
## Upgrading to hyper-react from Reactrb
|
|
2
|
-
|
|
3
|
-
Follow these steps to upgrade:
|
|
4
|
-
|
|
5
|
-
1. Replace `reactrb` with `hyper-react` both in **Gemfile** and any `require`s in your code.
|
|
6
|
-
2. To include the React.js source, the suggested way is to add `require 'react/react-source'` before `require 'hyper-react'`. This will use the copy of React.js source from `react-rails` gem.
|
|
7
|
-
|
|
8
|
-
## Upgrading to Reactrb
|
|
9
|
-
|
|
10
|
-
The original gem `react.rb` was superceeded by `reactive-ruby`, which has had over 15,000 downloads. This name has now been superceeded by `reactrb` (see #144 for detailed discussion on why.)
|
|
11
|
-
|
|
12
|
-
Going forward the name `reactrb` will be used consistently as the organization name, the gem name, the domain name, the twitter handle, etc.
|
|
13
|
-
|
|
14
|
-
The first initial version of `reactrb` is 0.8.x.
|
|
15
|
-
|
|
16
|
-
It is very unlikely that there will be any more releases of the `reactive-ruby` gem, so users should upgrade to `reactrb`.
|
|
17
|
-
|
|
18
|
-
There are no syntactic or semantic breaking changes between `reactrb` v 0.8.x and
|
|
19
|
-
previous versions, however the `reactrb` gem does *not* include the react-js source as previous versions did. This allows you to pick the react js source compatible with other gems and react js components you may be using.
|
|
20
|
-
|
|
21
|
-
Follow these steps to upgrade:
|
|
22
|
-
|
|
23
|
-
1. Replace `reactive-ruby` with `reactrb` both in **Gemfile** and any `require`s in your code.
|
|
24
|
-
2. To include the React.js source, the suggested way is to add `require 'react/react-source'` before `require 'reactrb'`. This will use the copy of React.js source from `react-rails` gem.
|
data/component-name-lookup.md
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
#### Notes on how component names are looked up
|
|
2
|
-
|
|
3
|
-
Given:
|
|
4
|
-
|
|
5
|
-
```ruby
|
|
6
|
-
|
|
7
|
-
class Blat < React::Component::Base
|
|
8
|
-
|
|
9
|
-
render do
|
|
10
|
-
Bar()
|
|
11
|
-
Foo::Bar()
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class Bar < React::Component::Base
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
module Foo
|
|
20
|
-
|
|
21
|
-
class Bar < React::Component::Base
|
|
22
|
-
|
|
23
|
-
render do
|
|
24
|
-
Blat()
|
|
25
|
-
Baz()
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
class Baz < React::Component::Base
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
end
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
The problem is that method lookup is different than constant lookup. We can prove it by running this code:
|
|
36
|
-
|
|
37
|
-
```ruby
|
|
38
|
-
def try_it(test, &block)
|
|
39
|
-
puts "trying #{test}"
|
|
40
|
-
result = yield
|
|
41
|
-
puts "success#{': '+result.to_s if result}"
|
|
42
|
-
rescue Exception => e
|
|
43
|
-
puts "failed: #{e}"
|
|
44
|
-
ensure
|
|
45
|
-
puts "---------------------------------"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
module Boom
|
|
49
|
-
|
|
50
|
-
Bar = 12
|
|
51
|
-
|
|
52
|
-
def self.Bar
|
|
53
|
-
puts " Boom::Bar says hi"
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
class Baz
|
|
57
|
-
def doit
|
|
58
|
-
try_it("Bar()") { Bar() }
|
|
59
|
-
try_it("Boom::Bar()") {Boom::Bar()}
|
|
60
|
-
try_it("Bar") { Bar }
|
|
61
|
-
try_it("Boom::Bar") { Boom::Bar }
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Boom::Baz.new.doit
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
which prints:
|
|
72
|
-
|
|
73
|
-
```text
|
|
74
|
-
trying Bar()
|
|
75
|
-
failed: Bar: undefined method `Bar' for #<Boom::Baz:0x774>
|
|
76
|
-
---------------------------------
|
|
77
|
-
trying Boom::Bar()
|
|
78
|
-
Boom::Bar says hi
|
|
79
|
-
success
|
|
80
|
-
---------------------------------
|
|
81
|
-
trying Bar
|
|
82
|
-
success: 12
|
|
83
|
-
---------------------------------
|
|
84
|
-
trying Boom::Bar
|
|
85
|
-
success: 12
|
|
86
|
-
---------------------------------
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
[try-it](http://opalrb.org/try/?code:def%20try_it(test%2C%20%26block)%0A%20%20puts%20%22trying%20%23%7Btest%7D%22%0A%20%20result%20%3D%20yield%0A%20%20puts%20%22success%23%7B%27%3A%20%27%2Bresult.to_s%20if%20result%7D%22%0Arescue%20Exception%20%3D%3E%20e%0A%20%20puts%20%22failed%3A%20%23%7Be%7D%22%0Aensure%0A%20%20puts%20%22---------------------------------%22%0Aend%0A%0Amodule%20Boom%0A%20%20%0A%20%20Bar%20%3D%2012%0A%20%20%0A%20%20def%20self.Bar%0A%20%20%20%20puts%20%22%20%20%20Boom%3A%3ABar%20says%20hi%22%0A%20%20end%0A%0A%20%20class%20Baz%0A%20%20%20%20def%20doit%0A%20%20%20%20%20%20try_it(%22Bar()%22)%20%7B%20Bar()%20%7D%0A%20%20%20%20%20%20try_it(%22Boom%3A%3ABar()%22)%20%7BBoom%3A%3ABar()%7D%0A%20%20%20%20%20%20try_it(%22Bar%22)%20%7B%20Bar%20%7D%0A%20%20%20%20%20%20try_it(%22Boom%3A%3ABar%22)%20%7B%20Boom%3A%3ABar%20%7D%0A%20%20%20%20end%0A%20%20end%0Aend%0A%20%20%0A%0A%0ABoom%3A%3ABaz.new.doit)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
What we need to do is:
|
|
93
|
-
|
|
94
|
-
1. when defining a component class `Foo`, also define in the same scope that Foo is being defined a method `self.Foo` that will accept Foo's params and child block, and render it.
|
|
95
|
-
|
|
96
|
-
2. As long as a name is qualified with at least one scope (i.e. `ModName::Foo()`) everything will work out, but if we say just `Foo()` then the only way I believe out of this is to handle it via method_missing, and let method_missing do a const_get on the method_name (which will return the class) and then render that component.
|
|
97
|
-
|
|
98
|
-
#### details
|
|
99
|
-
|
|
100
|
-
To define `self.Foo` in the same scope level as the class `Foo`, we need code like this:
|
|
101
|
-
|
|
102
|
-
```ruby
|
|
103
|
-
def register_component_dsl_method(component)
|
|
104
|
-
split_name = component.name && component.name.split('::')
|
|
105
|
-
return unless split_name && split_name.length > 2
|
|
106
|
-
component_name = split_name.last
|
|
107
|
-
parent = split_name.inject([Module]) { |nesting, next_const| nesting + [nesting.last.const_get(next_const)] }[-2]
|
|
108
|
-
class << parent
|
|
109
|
-
define_method component_name do |*args, &block|
|
|
110
|
-
React::RenderingContext.render(name, *args, &block)
|
|
111
|
-
end
|
|
112
|
-
define_method "#{component_name}_as_node" do |*args, &block|
|
|
113
|
-
React::Component.deprecation_warning("..._as_node is deprecated. Render component and then use the .node method instead")
|
|
114
|
-
send(component_name, *args, &block).node
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
module React
|
|
120
|
-
module Component
|
|
121
|
-
def self.included(base)
|
|
122
|
-
...
|
|
123
|
-
register_component_dsl_method(base.name)
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
The component's method_missing function will look like this:
|
|
130
|
-
|
|
131
|
-
```ruby
|
|
132
|
-
def method_missing(name, *args, &block)
|
|
133
|
-
if name =~ /_as_node$/
|
|
134
|
-
React::Component.deprecation_warning("..._as_node is deprecated. Render component and then use the .node method instead")
|
|
135
|
-
method_missing(name.gsub(/_as_node$/,""), *args, &block).node
|
|
136
|
-
else
|
|
137
|
-
component = const_get name if defined? name
|
|
138
|
-
React::RenderingContext.render(nil, component, *args, &block)
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### other related issues
|
|
144
|
-
|
|
145
|
-
The Kernel#p method conflicts with the <p> tag. However the p method can be invoked on any object so we are going to go ahead and use it, and deprecate the para method.
|
data/config.ru
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require 'bundler'
|
|
2
|
-
Bundler.require
|
|
3
|
-
|
|
4
|
-
require "opal/rspec"
|
|
5
|
-
|
|
6
|
-
Opal::Config.arity_check_enabled = true
|
|
7
|
-
|
|
8
|
-
if Opal::RSpec.const_defined?("SprocketsEnvironment")
|
|
9
|
-
sprockets_env = Opal::RSpec::SprocketsEnvironment.new
|
|
10
|
-
sprockets_env.cache = Sprockets::Cache::FileStore.new("tmp")
|
|
11
|
-
sprockets_env.add_spec_paths_to_sprockets
|
|
12
|
-
run Opal::Server.new(sprockets: sprockets_env) { |s|
|
|
13
|
-
s.main = 'opal/rspec/sprockets_runner'
|
|
14
|
-
s.debug = false
|
|
15
|
-
s.append_path 'spec/vendor'
|
|
16
|
-
s.index_path = 'spec/index.html.erb'
|
|
17
|
-
}
|
|
18
|
-
else
|
|
19
|
-
run Opal::Server.new { |s|
|
|
20
|
-
s.main = 'opal/rspec/sprockets_runner'
|
|
21
|
-
s.append_path 'spec'
|
|
22
|
-
s.append_path 'spec/vendor'
|
|
23
|
-
s.debug = false
|
|
24
|
-
s.index_path = 'spec/index.html.erb'
|
|
25
|
-
}
|
|
26
|
-
end
|