isomorfeus-react 16.10.0 → 16.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +64 -0
  3. data/lib/browser/delegate_native.rb +70 -0
  4. data/lib/browser/element.rb +176 -0
  5. data/lib/browser/element/canvas.rb +17 -0
  6. data/lib/browser/element/media.rb +78 -0
  7. data/lib/browser/event.rb +92 -0
  8. data/lib/browser/event_target.rb +39 -0
  9. data/lib/browser/file_list.rb +125 -0
  10. data/lib/browser/iterable.rb +15 -0
  11. data/lib/isomorfeus-react-material-ui.rb +10 -0
  12. data/lib/isomorfeus-react.rb +145 -0
  13. data/lib/isomorfeus/config.rb +130 -0
  14. data/lib/isomorfeus/props/validate_hash_proxy.rb +178 -0
  15. data/lib/isomorfeus/props/validator.rb +131 -0
  16. data/lib/isomorfeus/react_view_helper.rb +130 -0
  17. data/lib/isomorfeus/top_level.rb +86 -0
  18. data/lib/isomorfeus/top_level_ssr.rb +28 -0
  19. data/lib/lucid_app/api.rb +30 -0
  20. data/lib/lucid_app/base.rb +7 -0
  21. data/lib/lucid_app/context.rb +7 -0
  22. data/lib/lucid_app/mixin.rb +20 -0
  23. data/lib/lucid_app/native_component_constructor.rb +105 -0
  24. data/lib/lucid_component/app_store_defaults.rb +36 -0
  25. data/lib/lucid_component/app_store_proxy.rb +38 -0
  26. data/lib/lucid_component/base.rb +7 -0
  27. data/lib/lucid_component/class_store_proxy.rb +41 -0
  28. data/lib/lucid_component/component_class_store_defaults.rb +38 -0
  29. data/lib/lucid_component/component_instance_store_defaults.rb +35 -0
  30. data/lib/lucid_component/event_handler.rb +17 -0
  31. data/lib/lucid_component/initializer.rb +12 -0
  32. data/lib/lucid_component/instance_store_proxy.rb +45 -0
  33. data/lib/lucid_component/mixin.rb +18 -0
  34. data/lib/lucid_component/native_component_constructor.rb +116 -0
  35. data/lib/lucid_component/reducers.rb +48 -0
  36. data/lib/lucid_component/store_api.rb +38 -0
  37. data/lib/lucid_component/styles_support.rb +37 -0
  38. data/lib/lucid_material/app/base.rb +9 -0
  39. data/lib/lucid_material/app/mixin.rb +22 -0
  40. data/lib/lucid_material/app/native_component_constructor.rb +107 -0
  41. data/lib/lucid_material/component/base.rb +9 -0
  42. data/lib/lucid_material/component/mixin.rb +20 -0
  43. data/lib/lucid_material/component/native_component_constructor.rb +118 -0
  44. data/lib/lucid_prop_declaration/mixin.rb +91 -0
  45. data/lib/react.rb +195 -0
  46. data/lib/react/active_support_support.rb +13 -0
  47. data/lib/react/children.rb +35 -0
  48. data/lib/react/component/api.rb +80 -0
  49. data/lib/react/component/base.rb +9 -0
  50. data/lib/react/component/callbacks.rb +106 -0
  51. data/lib/react/component/elements.rb +60 -0
  52. data/lib/react/component/event_handler.rb +19 -0
  53. data/lib/react/component/features.rb +47 -0
  54. data/lib/react/component/history.rb +36 -0
  55. data/lib/react/component/initializer.rb +11 -0
  56. data/lib/react/component/location.rb +15 -0
  57. data/lib/react/component/match.rb +31 -0
  58. data/lib/react/component/mixin.rb +19 -0
  59. data/lib/react/component/native_component_constructor.rb +93 -0
  60. data/lib/react/component/props.rb +59 -0
  61. data/lib/react/component/resolution.rb +70 -0
  62. data/lib/react/component/should_component_update.rb +14 -0
  63. data/lib/react/component/state.rb +52 -0
  64. data/lib/react/component/styles.rb +27 -0
  65. data/lib/react/component/unsafe_api.rb +33 -0
  66. data/lib/react/context_wrapper.rb +46 -0
  67. data/lib/react/function_component/api.rb +63 -0
  68. data/lib/react/function_component/base.rb +9 -0
  69. data/lib/react/function_component/creator.rb +32 -0
  70. data/lib/react/function_component/event_handler.rb +13 -0
  71. data/lib/react/function_component/mixin.rb +14 -0
  72. data/lib/react/function_component/resolution.rb +62 -0
  73. data/lib/react/memo_component/base.rb +9 -0
  74. data/lib/react/memo_component/creator.rb +32 -0
  75. data/lib/react/memo_component/mixin.rb +14 -0
  76. data/lib/react/native_constant_wrapper.rb +26 -0
  77. data/lib/react/pure_component/base.rb +9 -0
  78. data/lib/react/pure_component/mixin.rb +18 -0
  79. data/lib/react/ref.rb +13 -0
  80. data/lib/react/synthetic_event.rb +53 -0
  81. data/lib/react/version.rb +3 -0
  82. data/lib/react_dom.rb +47 -0
  83. data/lib/react_dom_server.rb +19 -0
  84. metadata +84 -2
@@ -0,0 +1,9 @@
1
+ module React
2
+ module PureComponent
3
+ class Base
4
+ def self.inherited(base)
5
+ base.include(::React::PureComponent::Mixin)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ module React
2
+ module PureComponent
3
+ module Mixin
4
+ def self.included(base)
5
+ base.include(::Native::Wrapper)
6
+ base.extend(::React::Component::NativeComponentConstructor)
7
+ base.extend(::LucidPropDeclaration::Mixin)
8
+ base.extend(::React::Component::EventHandler)
9
+ base.include(::React::Component::Elements)
10
+ base.include(::React::Component::API)
11
+ base.include(::React::Component::Callbacks)
12
+ base.include(::React::Component::Initializer)
13
+ base.include(::React::Component::Features)
14
+ base.include(::React::Component::Resolution)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
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
13
+ end
@@ -0,0 +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
53
+ end
@@ -0,0 +1,3 @@
1
+ module React
2
+ VERSION = '16.10.1'
3
+ end
@@ -0,0 +1,47 @@
1
+ module ReactDOM
2
+ class << self
3
+ def create_portal(child, container)
4
+ # container is a native DOM node
5
+ `Opal.global.ReactDOM.createPortal(child, container)`
6
+ end
7
+
8
+ def find_dom_node(native_react_component)
9
+ `Opal.global.ReactDOM.findDOMNode(native_react_component)`
10
+ end
11
+
12
+ def hydrate(native_react_element, container, &block)
13
+ # container is a native DOM element
14
+ `Opal.React.render_buffer.push([]);`
15
+ result = if block_given?
16
+ `Opal.global.ReactDOM.hydrate(native_react_element, container, function() { block.$call() })`
17
+ else
18
+ `Opal.global.ReactDOM.hydrate(native_react_element, container)`
19
+ end
20
+ `Opal.React.render_buffer.pop()`
21
+ result
22
+ end
23
+
24
+ def render(native_react_element, container, &block)
25
+ # container is a native DOM element
26
+ `Opal.React.render_buffer.push([]);`
27
+ result = if block_given?
28
+ `Opal.global.ReactDOM.render(native_react_element, container, function() { block.$call() })`
29
+ else
30
+ `Opal.global.ReactDOM.render(native_react_element, container)`
31
+ end
32
+ `Opal.React.render_buffer.pop()`
33
+ result
34
+ end
35
+
36
+ def unmount_component_at_node(element_or_query)
37
+ if `(typeof element_or_query === 'string')` || (`(typeof element_or_query.$class === 'function')` && element_or_query.class == String)
38
+ element = `document.body.querySelector(element_or_query)`
39
+ elsif `(typeof element_or_query.$is_a === 'function')` && element_or_query.is_a?(Browser::Element)
40
+ element = element_or_query.to_n
41
+ else
42
+ element = element_or_query
43
+ end
44
+ `Opal.global.ReactDOM.unmountComponentAtNode(element)`
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,19 @@
1
+ module ReactDOMServer
2
+ class << self
3
+ def render_to_string(native_react_element)
4
+ `Opal.global.ReactDOMServer.renderToString(native_react_element)`
5
+ end
6
+
7
+ def render_to_static_markup(native_react_element)
8
+ `Opal.global.ReactDOMServer.renderToStaticMarkup(native_react_element)`
9
+ end
10
+
11
+ def render_to_node_stream(native_react_element)
12
+ `Opal.global.ReactDOMServer.renderToNodeStream(native_react_element)`
13
+ end
14
+
15
+ def render_to_static_node_stream(native_react_element)
16
+ `Opal.global.ReactDOMServer.renderToStaticNodeStream(native_react_element)`
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.10.0
4
+ version: 16.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
@@ -156,7 +156,89 @@ email:
156
156
  executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
- files: []
159
+ files:
160
+ - README.md
161
+ - lib/browser/delegate_native.rb
162
+ - lib/browser/element.rb
163
+ - lib/browser/element/canvas.rb
164
+ - lib/browser/element/media.rb
165
+ - lib/browser/event.rb
166
+ - lib/browser/event_target.rb
167
+ - lib/browser/file_list.rb
168
+ - lib/browser/iterable.rb
169
+ - lib/isomorfeus-react-material-ui.rb
170
+ - lib/isomorfeus-react.rb
171
+ - lib/isomorfeus/config.rb
172
+ - lib/isomorfeus/props/validate_hash_proxy.rb
173
+ - lib/isomorfeus/props/validator.rb
174
+ - lib/isomorfeus/react_view_helper.rb
175
+ - lib/isomorfeus/top_level.rb
176
+ - lib/isomorfeus/top_level_ssr.rb
177
+ - lib/lucid_app/api.rb
178
+ - lib/lucid_app/base.rb
179
+ - lib/lucid_app/context.rb
180
+ - lib/lucid_app/mixin.rb
181
+ - lib/lucid_app/native_component_constructor.rb
182
+ - lib/lucid_component/app_store_defaults.rb
183
+ - lib/lucid_component/app_store_proxy.rb
184
+ - lib/lucid_component/base.rb
185
+ - lib/lucid_component/class_store_proxy.rb
186
+ - lib/lucid_component/component_class_store_defaults.rb
187
+ - lib/lucid_component/component_instance_store_defaults.rb
188
+ - lib/lucid_component/event_handler.rb
189
+ - lib/lucid_component/initializer.rb
190
+ - lib/lucid_component/instance_store_proxy.rb
191
+ - lib/lucid_component/mixin.rb
192
+ - lib/lucid_component/native_component_constructor.rb
193
+ - lib/lucid_component/reducers.rb
194
+ - lib/lucid_component/store_api.rb
195
+ - lib/lucid_component/styles_support.rb
196
+ - lib/lucid_material/app/base.rb
197
+ - lib/lucid_material/app/mixin.rb
198
+ - lib/lucid_material/app/native_component_constructor.rb
199
+ - lib/lucid_material/component/base.rb
200
+ - lib/lucid_material/component/mixin.rb
201
+ - lib/lucid_material/component/native_component_constructor.rb
202
+ - lib/lucid_prop_declaration/mixin.rb
203
+ - lib/react.rb
204
+ - lib/react/active_support_support.rb
205
+ - lib/react/children.rb
206
+ - lib/react/component/api.rb
207
+ - lib/react/component/base.rb
208
+ - lib/react/component/callbacks.rb
209
+ - lib/react/component/elements.rb
210
+ - lib/react/component/event_handler.rb
211
+ - lib/react/component/features.rb
212
+ - lib/react/component/history.rb
213
+ - lib/react/component/initializer.rb
214
+ - lib/react/component/location.rb
215
+ - lib/react/component/match.rb
216
+ - lib/react/component/mixin.rb
217
+ - lib/react/component/native_component_constructor.rb
218
+ - lib/react/component/props.rb
219
+ - lib/react/component/resolution.rb
220
+ - lib/react/component/should_component_update.rb
221
+ - lib/react/component/state.rb
222
+ - lib/react/component/styles.rb
223
+ - lib/react/component/unsafe_api.rb
224
+ - lib/react/context_wrapper.rb
225
+ - lib/react/function_component/api.rb
226
+ - lib/react/function_component/base.rb
227
+ - lib/react/function_component/creator.rb
228
+ - lib/react/function_component/event_handler.rb
229
+ - lib/react/function_component/mixin.rb
230
+ - lib/react/function_component/resolution.rb
231
+ - lib/react/memo_component/base.rb
232
+ - lib/react/memo_component/creator.rb
233
+ - lib/react/memo_component/mixin.rb
234
+ - lib/react/native_constant_wrapper.rb
235
+ - lib/react/pure_component/base.rb
236
+ - lib/react/pure_component/mixin.rb
237
+ - lib/react/ref.rb
238
+ - lib/react/synthetic_event.rb
239
+ - lib/react/version.rb
240
+ - lib/react_dom.rb
241
+ - lib/react_dom_server.rb
160
242
  homepage: http://isomorfeus.com
161
243
  licenses:
162
244
  - MIT