opal-react 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +78 -0
- data/Rakefile +24 -0
- data/config.ru +12 -0
- data/dist/opal-react.js +1325 -0
- data/dist/opal-react.js.map +1 -0
- data/examples/todoapp/Gemfile +6 -0
- data/examples/todoapp/Rakefile +11 -0
- data/examples/todoapp/application.rb +44 -0
- data/examples/todoapp/index.html +12 -0
- data/lib/opal/react.rb +16 -0
- data/lib/opal/react/component.rb +201 -0
- data/lib/opal/react/version.rb +5 -0
- data/opal-react.gemspec +25 -0
- data/spec/index.html.erb +8 -0
- data/tutorial/package.json +15 -0
- data/tutorial/tutorial1.html +36 -0
- data/tutorial/tutorial1.rb +19 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 291c9784bec121322e03d271c24de9fd52bce943
|
4
|
+
data.tar.gz: c319315370c32329079fced05761fb0e76057baa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0099cf2f3685f28d81aee7477590d1140869d0153fbb1fd3771af1b4dabeeb88103a608f999594071ab4932a7f8b139d2aa1876320c1b9eaae24805115a69351
|
7
|
+
data.tar.gz: a5d5b9947ba44d919696dc45671dbd2581aafd83b25716d79911101aada34b6c50e7df8638f6e57c8ca4b5c167fade7fb3db16170c952ec9cf625e6610894d1d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 John Susi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 John Susi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# Opal::React
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'opal-react'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install opal-react
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'react'
|
25
|
+
|
26
|
+
class TodoList < React::Component
|
27
|
+
def render
|
28
|
+
console.log('TodoList:render')
|
29
|
+
ul(
|
30
|
+
props[:items].map { |item|
|
31
|
+
li({key: item[:id]}, [ item[:text] ])
|
32
|
+
}
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class TodoApp < React::Component
|
38
|
+
|
39
|
+
def initial_state
|
40
|
+
{ items: [], text: '' }
|
41
|
+
end
|
42
|
+
|
43
|
+
def onChange(e)
|
44
|
+
set_state({text: e.target.value})
|
45
|
+
end
|
46
|
+
|
47
|
+
def handleSubmit(e)
|
48
|
+
e.preventDefault()
|
49
|
+
now = Time.now
|
50
|
+
nextItems = state[:items] + [{ text: state[:text], id: now.to_i * 1e6 + now.usec }]
|
51
|
+
nextText = ''
|
52
|
+
set_state({items: nextItems, text: nextText})
|
53
|
+
end
|
54
|
+
|
55
|
+
def render
|
56
|
+
div([
|
57
|
+
h3('TODO'),
|
58
|
+
TodoList(items: state[:items]),
|
59
|
+
form({onSubmit: method(:handleSubmit)}, [
|
60
|
+
input(onChange: method(:onChange), value: state[:text]),
|
61
|
+
button("Add ##{state[:items].count+1}")
|
62
|
+
])
|
63
|
+
])
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
TodoApp.run()
|
69
|
+
```
|
70
|
+
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
1. Fork it ( https://github.com/[my-github-username]/opal-react/fork )
|
75
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
76
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
77
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
78
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
require 'opal'
|
4
|
+
|
5
|
+
Opal.append_path 'lib/opal'
|
6
|
+
|
7
|
+
def compile(filename, source)
|
8
|
+
compiler = Opal::Compiler.new(source, file: File.basename(filename, '.rb'))
|
9
|
+
compiler.compile
|
10
|
+
File.binwrite(File.basename(filename, '.rb') + '.js',
|
11
|
+
compiler.result.to_s <<
|
12
|
+
"//# sourceMappingURL=#{File.basename(filename, '.rb')}.js.map\n" <<
|
13
|
+
"//# sourceURL=#{File.basename(filename)}\n"
|
14
|
+
)
|
15
|
+
File.binwrite(File.basename(filename, '.rb') + '.js.map', compiler.source_map.as_json.to_json.to_s )
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
task :dist do
|
20
|
+
builder = Opal::Builder.new
|
21
|
+
builder.build 'react'
|
22
|
+
File.binwrite "dist/opal-react.js", builder.to_s << "\n//# sourceMappingURL=opal-react.js.map\n"
|
23
|
+
File.binwrite "dist/opal-react.js.map", builder.source_map.to_s
|
24
|
+
end
|
data/config.ru
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.require
|
3
|
+
|
4
|
+
require 'opal-rspec'
|
5
|
+
Opal.append_path File.expand_path('../spec', __FILE__)
|
6
|
+
|
7
|
+
run Opal::Server.new { |s|
|
8
|
+
s.main = 'opal/rspec/sprockets_runner'
|
9
|
+
s.append_path 'spec'
|
10
|
+
s.debug = false
|
11
|
+
s.index_path = 'spec/index.html.erb'
|
12
|
+
}
|
data/dist/opal-react.js
ADDED
@@ -0,0 +1,1325 @@
|
|
1
|
+
/* Generated by Opal 0.10.2 */
|
2
|
+
Opal.modules["native"] = function(Opal) {
|
3
|
+
function $rb_minus(lhs, rhs) {
|
4
|
+
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
|
5
|
+
}
|
6
|
+
function $rb_ge(lhs, rhs) {
|
7
|
+
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs);
|
8
|
+
}
|
9
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $range = Opal.range, $hash2 = Opal.hash2, $klass = Opal.klass, $gvars = Opal.gvars;
|
10
|
+
|
11
|
+
Opal.add_stubs(['$try_convert', '$native?', '$respond_to?', '$to_n', '$raise', '$inspect', '$Native', '$proc', '$map!', '$end_with?', '$define_method', '$[]', '$convert', '$call', '$to_proc', '$new', '$each', '$native_reader', '$native_writer', '$extend', '$is_a?', '$map', '$alias_method', '$to_a', '$_Array', '$include', '$method_missing', '$bind', '$instance_method', '$[]=', '$slice', '$-', '$length', '$enum_for', '$===', '$>=', '$<<', '$each_pair', '$_initialize', '$name', '$exiting_mid', '$native_module']);
|
12
|
+
(function($base) {
|
13
|
+
var $Native, self = $Native = $module($base, 'Native');
|
14
|
+
|
15
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_19, TMP_20, TMP_21;
|
16
|
+
|
17
|
+
Opal.defs(self, '$is_a?', TMP_1 = function(object, klass) {
|
18
|
+
var self = this;
|
19
|
+
|
20
|
+
|
21
|
+
try {
|
22
|
+
return object instanceof self.$try_convert(klass);
|
23
|
+
}
|
24
|
+
catch (e) {
|
25
|
+
return false;
|
26
|
+
}
|
27
|
+
;
|
28
|
+
}, TMP_1.$$arity = 2);
|
29
|
+
|
30
|
+
Opal.defs(self, '$try_convert', TMP_2 = function ːtry_convert(value, default$) {
|
31
|
+
var self = this;
|
32
|
+
|
33
|
+
if (default$ == null) {
|
34
|
+
default$ = nil;
|
35
|
+
}
|
36
|
+
|
37
|
+
if (self['$native?'](value)) {
|
38
|
+
return value;
|
39
|
+
}
|
40
|
+
else if (value['$respond_to?']("to_n")) {
|
41
|
+
return value.$to_n();
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
return default$;
|
45
|
+
}
|
46
|
+
;
|
47
|
+
}, TMP_2.$$arity = -2);
|
48
|
+
|
49
|
+
Opal.defs(self, '$convert', TMP_3 = function ːconvert(value) {
|
50
|
+
var self = this;
|
51
|
+
|
52
|
+
|
53
|
+
if (self['$native?'](value)) {
|
54
|
+
return value;
|
55
|
+
}
|
56
|
+
else if (value['$respond_to?']("to_n")) {
|
57
|
+
return value.$to_n();
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
self.$raise($scope.get('ArgumentError'), "" + (value.$inspect()) + " isn't native");
|
61
|
+
}
|
62
|
+
;
|
63
|
+
}, TMP_3.$$arity = 1);
|
64
|
+
|
65
|
+
Opal.defs(self, '$call', TMP_4 = function ːcall(obj, key, $a_rest) {
|
66
|
+
var self = this, args, $iter = TMP_4.$$p, block = $iter || nil;
|
67
|
+
|
68
|
+
var $args_len = arguments.length, $rest_len = $args_len - 2;
|
69
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
70
|
+
args = new Array($rest_len);
|
71
|
+
for (var $arg_idx = 2; $arg_idx < $args_len; $arg_idx++) {
|
72
|
+
args[$arg_idx - 2] = arguments[$arg_idx];
|
73
|
+
}
|
74
|
+
TMP_4.$$p = null;
|
75
|
+
|
76
|
+
var prop = obj[key];
|
77
|
+
|
78
|
+
if (prop instanceof Function) {
|
79
|
+
var converted = new Array(args.length);
|
80
|
+
|
81
|
+
for (var i = 0, l = args.length; i < l; i++) {
|
82
|
+
var item = args[i],
|
83
|
+
conv = self.$try_convert(item);
|
84
|
+
|
85
|
+
converted[i] = conv === nil ? item : conv;
|
86
|
+
}
|
87
|
+
|
88
|
+
if (block !== nil) {
|
89
|
+
converted.push(block);
|
90
|
+
}
|
91
|
+
|
92
|
+
return self.$Native(prop.apply(obj, converted));
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
return self.$Native(prop);
|
96
|
+
}
|
97
|
+
;
|
98
|
+
}, TMP_4.$$arity = -3);
|
99
|
+
|
100
|
+
Opal.defs(self, '$proc', TMP_5 = function ːproc() {
|
101
|
+
var $a, $b, TMP_6, self = this, $iter = TMP_5.$$p, block = $iter || nil;
|
102
|
+
|
103
|
+
TMP_5.$$p = null;
|
104
|
+
if (block !== false && block !== nil && block != null) {
|
105
|
+
} else {
|
106
|
+
self.$raise($scope.get('LocalJumpError'), "no block given")
|
107
|
+
};
|
108
|
+
return ($a = ($b = $scope.get('Kernel')).$proc, $a.$$p = (TMP_6 = function($c_rest){var self = TMP_6.$$s || this, args, $d, $e, TMP_7, instance = nil;
|
109
|
+
|
110
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
111
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
112
|
+
args = new Array($rest_len);
|
113
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
114
|
+
args[$arg_idx - 0] = arguments[$arg_idx];
|
115
|
+
}
|
116
|
+
($d = ($e = args)['$map!'], $d.$$p = (TMP_7 = function(arg){var self = TMP_7.$$s || this;
|
117
|
+
if (arg == null) arg = nil;
|
118
|
+
return self.$Native(arg)}, TMP_7.$$s = self, TMP_7.$$arity = 1, TMP_7), $d).call($e);
|
119
|
+
instance = self.$Native(this);
|
120
|
+
|
121
|
+
// if global is current scope, run the block in the scope it was defined
|
122
|
+
if (this === Opal.global) {
|
123
|
+
return block.apply(self, args);
|
124
|
+
}
|
125
|
+
|
126
|
+
var self_ = block.$$s;
|
127
|
+
block.$$s = null;
|
128
|
+
|
129
|
+
try {
|
130
|
+
return block.apply(instance, args);
|
131
|
+
}
|
132
|
+
finally {
|
133
|
+
block.$$s = self_;
|
134
|
+
}
|
135
|
+
;}, TMP_6.$$s = self, TMP_6.$$arity = -1, TMP_6), $a).call($b);
|
136
|
+
}, TMP_5.$$arity = 0);
|
137
|
+
|
138
|
+
(function($base) {
|
139
|
+
var $Helpers, self = $Helpers = $module($base, 'Helpers');
|
140
|
+
|
141
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_11, TMP_14, TMP_17, TMP_18;
|
142
|
+
|
143
|
+
Opal.defn(self, '$alias_native', TMP_11 = function ːalias_native(new$, $old, $kwargs) {
|
144
|
+
var $a, $b, TMP_8, $c, TMP_9, $d, TMP_10, self = this, $post_args, as, old;
|
145
|
+
|
146
|
+
$post_args = Opal.slice.call(arguments, 1, arguments.length);
|
147
|
+
$kwargs = Opal.extract_kwargs($post_args);
|
148
|
+
if ($kwargs == null || !$kwargs.$$is_hash) {
|
149
|
+
if ($kwargs == null) {
|
150
|
+
$kwargs = $hash2([], {});
|
151
|
+
} else {
|
152
|
+
throw Opal.ArgumentError.$new('expected kwargs');
|
153
|
+
}
|
154
|
+
}
|
155
|
+
if ((as = $kwargs.$$smap['as']) == null) {
|
156
|
+
as = nil
|
157
|
+
}
|
158
|
+
if (0 < $post_args.length) {
|
159
|
+
old = $post_args.splice(0,1)[0];
|
160
|
+
}
|
161
|
+
if (old == null) {
|
162
|
+
old = new$;
|
163
|
+
}
|
164
|
+
if ((($a = old['$end_with?']("=")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
165
|
+
return ($a = ($b = self).$define_method, $a.$$p = (TMP_8 = function(value){var self = TMP_8.$$s || this;
|
166
|
+
if (self["native"] == null) self["native"] = nil;
|
167
|
+
if (value == null) value = nil;
|
168
|
+
self["native"][old['$[]']($range(0, -2, false))] = $scope.get('Native').$convert(value);
|
169
|
+
return value;}, TMP_8.$$s = self, TMP_8.$$arity = 1, TMP_8), $a).call($b, new$)
|
170
|
+
} else if (as !== false && as !== nil && as != null) {
|
171
|
+
return ($a = ($c = self).$define_method, $a.$$p = (TMP_9 = function($d_rest){var self = TMP_9.$$s || this, block, args, $e, $f, $g, value = nil;
|
172
|
+
if (self["native"] == null) self["native"] = nil;
|
173
|
+
|
174
|
+
block = TMP_9.$$p || nil, TMP_9.$$p = null;
|
175
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
176
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
177
|
+
args = new Array($rest_len);
|
178
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
179
|
+
args[$arg_idx - 0] = arguments[$arg_idx];
|
180
|
+
}
|
181
|
+
if ((($e = value = ($f = ($g = $scope.get('Native')).$call, $f.$$p = block.$to_proc(), $f).apply($g, [self["native"], old].concat(Opal.to_a(args)))) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) {
|
182
|
+
return as.$new(value.$to_n())
|
183
|
+
} else {
|
184
|
+
return nil
|
185
|
+
}}, TMP_9.$$s = self, TMP_9.$$arity = -1, TMP_9), $a).call($c, new$)
|
186
|
+
} else {
|
187
|
+
return ($a = ($d = self).$define_method, $a.$$p = (TMP_10 = function($e_rest){var self = TMP_10.$$s || this, block, args, $f, $g;
|
188
|
+
if (self["native"] == null) self["native"] = nil;
|
189
|
+
|
190
|
+
block = TMP_10.$$p || nil, TMP_10.$$p = null;
|
191
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
192
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
193
|
+
args = new Array($rest_len);
|
194
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
195
|
+
args[$arg_idx - 0] = arguments[$arg_idx];
|
196
|
+
}
|
197
|
+
return ($f = ($g = $scope.get('Native')).$call, $f.$$p = block.$to_proc(), $f).apply($g, [self["native"], old].concat(Opal.to_a(args)))}, TMP_10.$$s = self, TMP_10.$$arity = -1, TMP_10), $a).call($d, new$)
|
198
|
+
};
|
199
|
+
}, TMP_11.$$arity = -2);
|
200
|
+
|
201
|
+
Opal.defn(self, '$native_reader', TMP_14 = function ːnative_reader($a_rest) {
|
202
|
+
var $b, $c, TMP_12, self = this, names;
|
203
|
+
|
204
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
205
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
206
|
+
names = new Array($rest_len);
|
207
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
208
|
+
names[$arg_idx - 0] = arguments[$arg_idx];
|
209
|
+
}
|
210
|
+
return ($b = ($c = names).$each, $b.$$p = (TMP_12 = function(name){var self = TMP_12.$$s || this, $a, $d, TMP_13;
|
211
|
+
if (name == null) name = nil;
|
212
|
+
return ($a = ($d = self).$define_method, $a.$$p = (TMP_13 = function(){var self = TMP_13.$$s || this;
|
213
|
+
if (self["native"] == null) self["native"] = nil;
|
214
|
+
|
215
|
+
return self.$Native(self["native"][name])}, TMP_13.$$s = self, TMP_13.$$arity = 0, TMP_13), $a).call($d, name)}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12), $b).call($c);
|
216
|
+
}, TMP_14.$$arity = -1);
|
217
|
+
|
218
|
+
Opal.defn(self, '$native_writer', TMP_17 = function ːnative_writer($a_rest) {
|
219
|
+
var $b, $c, TMP_15, self = this, names;
|
220
|
+
|
221
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
222
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
223
|
+
names = new Array($rest_len);
|
224
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
225
|
+
names[$arg_idx - 0] = arguments[$arg_idx];
|
226
|
+
}
|
227
|
+
return ($b = ($c = names).$each, $b.$$p = (TMP_15 = function(name){var self = TMP_15.$$s || this, $a, $d, TMP_16;
|
228
|
+
if (name == null) name = nil;
|
229
|
+
return ($a = ($d = self).$define_method, $a.$$p = (TMP_16 = function(value){var self = TMP_16.$$s || this;
|
230
|
+
if (self["native"] == null) self["native"] = nil;
|
231
|
+
if (value == null) value = nil;
|
232
|
+
return self.$Native(self["native"][name] = value)}, TMP_16.$$s = self, TMP_16.$$arity = 1, TMP_16), $a).call($d, "" + (name) + "=")}, TMP_15.$$s = self, TMP_15.$$arity = 1, TMP_15), $b).call($c);
|
233
|
+
}, TMP_17.$$arity = -1);
|
234
|
+
|
235
|
+
Opal.defn(self, '$native_accessor', TMP_18 = function ːnative_accessor($a_rest) {
|
236
|
+
var $b, $c, self = this, names;
|
237
|
+
|
238
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
239
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
240
|
+
names = new Array($rest_len);
|
241
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
242
|
+
names[$arg_idx - 0] = arguments[$arg_idx];
|
243
|
+
}
|
244
|
+
($b = self).$native_reader.apply($b, Opal.to_a(names));
|
245
|
+
return ($c = self).$native_writer.apply($c, Opal.to_a(names));
|
246
|
+
}, TMP_18.$$arity = -1);
|
247
|
+
})($scope.base);
|
248
|
+
|
249
|
+
Opal.defs(self, '$included', TMP_19 = function ːincluded(klass) {
|
250
|
+
var self = this;
|
251
|
+
|
252
|
+
return klass.$extend($scope.get('Helpers'));
|
253
|
+
}, TMP_19.$$arity = 1);
|
254
|
+
|
255
|
+
Opal.defn(self, '$initialize', TMP_20 = function ːinitialize(native$) {
|
256
|
+
var $a, self = this;
|
257
|
+
|
258
|
+
if ((($a = $scope.get('Kernel')['$native?'](native$)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
259
|
+
} else {
|
260
|
+
$scope.get('Kernel').$raise($scope.get('ArgumentError'), "" + (native$.$inspect()) + " isn't native")
|
261
|
+
};
|
262
|
+
return self["native"] = native$;
|
263
|
+
}, TMP_20.$$arity = 1);
|
264
|
+
|
265
|
+
Opal.defn(self, '$to_n', TMP_21 = function ːto_n() {
|
266
|
+
var self = this;
|
267
|
+
if (self["native"] == null) self["native"] = nil;
|
268
|
+
|
269
|
+
return self["native"];
|
270
|
+
}, TMP_21.$$arity = 0);
|
271
|
+
})($scope.base);
|
272
|
+
(function($base) {
|
273
|
+
var $Kernel, self = $Kernel = $module($base, 'Kernel');
|
274
|
+
|
275
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_22, TMP_25, TMP_26;
|
276
|
+
|
277
|
+
Opal.defn(self, '$native?', TMP_22 = function(value) {
|
278
|
+
var self = this;
|
279
|
+
|
280
|
+
return value == null || !value.$$class;
|
281
|
+
}, TMP_22.$$arity = 1);
|
282
|
+
|
283
|
+
Opal.defn(self, '$Native', TMP_25 = function ːNative(obj) {
|
284
|
+
var $a, $b, TMP_23, $c, TMP_24, self = this;
|
285
|
+
|
286
|
+
if ((($a = obj == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
287
|
+
return nil
|
288
|
+
} else if ((($a = self['$native?'](obj)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
289
|
+
return (($scope.get('Native')).$$scope.get('Object')).$new(obj)
|
290
|
+
} else if ((($a = obj['$is_a?']($scope.get('Array'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
291
|
+
return ($a = ($b = obj).$map, $a.$$p = (TMP_23 = function(o){var self = TMP_23.$$s || this;
|
292
|
+
if (o == null) o = nil;
|
293
|
+
return self.$Native(o)}, TMP_23.$$s = self, TMP_23.$$arity = 1, TMP_23), $a).call($b)
|
294
|
+
} else if ((($a = obj['$is_a?']($scope.get('Proc'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
295
|
+
return ($a = ($c = self).$proc, $a.$$p = (TMP_24 = function($d_rest){var self = TMP_24.$$s || this, block, args, $e, $f;
|
296
|
+
|
297
|
+
block = TMP_24.$$p || nil, TMP_24.$$p = null;
|
298
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
299
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
300
|
+
args = new Array($rest_len);
|
301
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
302
|
+
args[$arg_idx - 0] = arguments[$arg_idx];
|
303
|
+
}
|
304
|
+
return self.$Native(($e = ($f = obj).$call, $e.$$p = block.$to_proc(), $e).apply($f, Opal.to_a(args)))}, TMP_24.$$s = self, TMP_24.$$arity = -1, TMP_24), $a).call($c)
|
305
|
+
} else {
|
306
|
+
return obj
|
307
|
+
};
|
308
|
+
}, TMP_25.$$arity = 1);
|
309
|
+
|
310
|
+
self.$alias_method("_Array", "Array");
|
311
|
+
|
312
|
+
Opal.defn(self, '$Array', TMP_26 = function ːArray(object, $a_rest) {
|
313
|
+
var $b, $c, self = this, args, $iter = TMP_26.$$p, block = $iter || nil;
|
314
|
+
|
315
|
+
var $args_len = arguments.length, $rest_len = $args_len - 1;
|
316
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
317
|
+
args = new Array($rest_len);
|
318
|
+
for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) {
|
319
|
+
args[$arg_idx - 1] = arguments[$arg_idx];
|
320
|
+
}
|
321
|
+
TMP_26.$$p = null;
|
322
|
+
if ((($b = self['$native?'](object)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
|
323
|
+
return ($b = ($c = (($scope.get('Native')).$$scope.get('Array'))).$new, $b.$$p = block.$to_proc(), $b).apply($c, [object].concat(Opal.to_a(args))).$to_a()};
|
324
|
+
return self.$_Array(object);
|
325
|
+
}, TMP_26.$$arity = -2);
|
326
|
+
})($scope.base);
|
327
|
+
(function($base, $super) {
|
328
|
+
function $Object(){};
|
329
|
+
var self = $Object = $klass($base, $super, 'Object', $Object);
|
330
|
+
|
331
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, TMP_37, TMP_38, TMP_39, TMP_40, TMP_41;
|
332
|
+
|
333
|
+
def["native"] = nil;
|
334
|
+
self.$include(Opal.get('Native'));
|
335
|
+
|
336
|
+
Opal.defn(self, '$==', TMP_27 = function(other) {
|
337
|
+
var self = this;
|
338
|
+
|
339
|
+
return self["native"] === $scope.get('Native').$try_convert(other);
|
340
|
+
}, TMP_27.$$arity = 1);
|
341
|
+
|
342
|
+
Opal.defn(self, '$has_key?', TMP_28 = function(name) {
|
343
|
+
var self = this;
|
344
|
+
|
345
|
+
return Opal.hasOwnProperty.call(self["native"], name);
|
346
|
+
}, TMP_28.$$arity = 1);
|
347
|
+
|
348
|
+
Opal.alias(self, 'key?', 'has_key?');
|
349
|
+
|
350
|
+
Opal.alias(self, 'include?', 'has_key?');
|
351
|
+
|
352
|
+
Opal.alias(self, 'member?', 'has_key?');
|
353
|
+
|
354
|
+
Opal.defn(self, '$each', TMP_29 = function ːeach($a_rest) {
|
355
|
+
var $b, self = this, args, $iter = TMP_29.$$p, $yield = $iter || nil;
|
356
|
+
|
357
|
+
var $args_len = arguments.length, $rest_len = $args_len - 0;
|
358
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
359
|
+
args = new Array($rest_len);
|
360
|
+
for (var $arg_idx = 0; $arg_idx < $args_len; $arg_idx++) {
|
361
|
+
args[$arg_idx - 0] = arguments[$arg_idx];
|
362
|
+
}
|
363
|
+
TMP_29.$$p = null;
|
364
|
+
if (($yield !== nil)) {
|
365
|
+
|
366
|
+
for (var key in self["native"]) {
|
367
|
+
Opal.yieldX($yield, [key, self["native"][key]])
|
368
|
+
}
|
369
|
+
;
|
370
|
+
return self;
|
371
|
+
} else {
|
372
|
+
return ($b = self).$method_missing.apply($b, ["each"].concat(Opal.to_a(args)))
|
373
|
+
};
|
374
|
+
}, TMP_29.$$arity = -1);
|
375
|
+
|
376
|
+
Opal.defn(self, '$[]', TMP_30 = function(key) {
|
377
|
+
var self = this;
|
378
|
+
|
379
|
+
|
380
|
+
var prop = self["native"][key];
|
381
|
+
|
382
|
+
if (prop instanceof Function) {
|
383
|
+
return prop;
|
384
|
+
}
|
385
|
+
else {
|
386
|
+
return Opal.get('Native').$call(self["native"], key)
|
387
|
+
}
|
388
|
+
;
|
389
|
+
}, TMP_30.$$arity = 1);
|
390
|
+
|
391
|
+
Opal.defn(self, '$[]=', TMP_31 = function(key, value) {
|
392
|
+
var $a, self = this, native$ = nil;
|
393
|
+
|
394
|
+
native$ = $scope.get('Native').$try_convert(value);
|
395
|
+
if ((($a = native$ === nil) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
396
|
+
return self["native"][key] = value;
|
397
|
+
} else {
|
398
|
+
return self["native"][key] = native$;
|
399
|
+
};
|
400
|
+
}, TMP_31.$$arity = 2);
|
401
|
+
|
402
|
+
Opal.defn(self, '$merge!', TMP_32 = function(other) {
|
403
|
+
var self = this;
|
404
|
+
|
405
|
+
|
406
|
+
other = $scope.get('Native').$convert(other);
|
407
|
+
|
408
|
+
for (var prop in other) {
|
409
|
+
self["native"][prop] = other[prop];
|
410
|
+
}
|
411
|
+
;
|
412
|
+
return self;
|
413
|
+
}, TMP_32.$$arity = 1);
|
414
|
+
|
415
|
+
Opal.defn(self, '$respond_to?', TMP_33 = function(name, include_all) {
|
416
|
+
var self = this;
|
417
|
+
|
418
|
+
if (include_all == null) {
|
419
|
+
include_all = false;
|
420
|
+
}
|
421
|
+
return $scope.get('Kernel').$instance_method("respond_to?").$bind(self).$call(name, include_all);
|
422
|
+
}, TMP_33.$$arity = -2);
|
423
|
+
|
424
|
+
Opal.defn(self, '$respond_to_missing?', TMP_34 = function(name, include_all) {
|
425
|
+
var self = this;
|
426
|
+
|
427
|
+
if (include_all == null) {
|
428
|
+
include_all = false;
|
429
|
+
}
|
430
|
+
return Opal.hasOwnProperty.call(self["native"], name);
|
431
|
+
}, TMP_34.$$arity = -2);
|
432
|
+
|
433
|
+
Opal.defn(self, '$method_missing', TMP_35 = function ːmethod_missing(mid, $a_rest) {
|
434
|
+
var $b, $c, self = this, args, $iter = TMP_35.$$p, block = $iter || nil;
|
435
|
+
|
436
|
+
var $args_len = arguments.length, $rest_len = $args_len - 1;
|
437
|
+
if ($rest_len < 0) { $rest_len = 0; }
|
438
|
+
args = new Array($rest_len);
|
439
|
+
for (var $arg_idx = 1; $arg_idx < $args_len; $arg_idx++) {
|
440
|
+
args[$arg_idx - 1] = arguments[$arg_idx];
|
441
|
+
}
|
442
|
+
TMP_35.$$p = null;
|
443
|
+
|
444
|
+
if (mid.charAt(mid.length - 1) === '=') {
|
445
|
+
return self['$[]='](mid.$slice(0, $rb_minus(mid.$length(), 1)), args['$[]'](0));
|
446
|
+
}
|
447
|
+
else {
|
448
|
+
return ($b = ($c = Opal.get('Native')).$call, $b.$$p = block.$to_proc(), $b).apply($c, [self["native"], mid].concat(Opal.to_a(args)));
|
449
|
+
}
|
450
|
+
;
|
451
|
+
}, TMP_35.$$arity = -2);
|
452
|
+
|
453
|
+
Opal.defn(self, '$nil?', TMP_36 = function() {
|
454
|
+
var self = this;
|
455
|
+
|
456
|
+
return false;
|
457
|
+
}, TMP_36.$$arity = 0);
|
458
|
+
|
459
|
+
Opal.defn(self, '$is_a?', TMP_37 = function(klass) {
|
460
|
+
var self = this;
|
461
|
+
|
462
|
+
return Opal.is_a(self, klass);
|
463
|
+
}, TMP_37.$$arity = 1);
|
464
|
+
|
465
|
+
Opal.alias(self, 'kind_of?', 'is_a?');
|
466
|
+
|
467
|
+
Opal.defn(self, '$instance_of?', TMP_38 = function(klass) {
|
468
|
+
var self = this;
|
469
|
+
|
470
|
+
return self.$$class === klass;
|
471
|
+
}, TMP_38.$$arity = 1);
|
472
|
+
|
473
|
+
Opal.defn(self, '$class', TMP_39 = function() {
|
474
|
+
var self = this;
|
475
|
+
|
476
|
+
return self.$$class;
|
477
|
+
}, TMP_39.$$arity = 0);
|
478
|
+
|
479
|
+
Opal.defn(self, '$to_a', TMP_40 = function ːto_a(options) {
|
480
|
+
var $a, $b, self = this, $iter = TMP_40.$$p, block = $iter || nil;
|
481
|
+
|
482
|
+
if (options == null) {
|
483
|
+
options = $hash2([], {});
|
484
|
+
}
|
485
|
+
TMP_40.$$p = null;
|
486
|
+
return ($a = ($b = (($scope.get('Native')).$$scope.get('Array'))).$new, $a.$$p = block.$to_proc(), $a).call($b, self["native"], options).$to_a();
|
487
|
+
}, TMP_40.$$arity = -1);
|
488
|
+
|
489
|
+
return (Opal.defn(self, '$inspect', TMP_41 = function ːinspect() {
|
490
|
+
var self = this;
|
491
|
+
|
492
|
+
return "#<Native:" + (String(self["native"])) + ">";
|
493
|
+
}, TMP_41.$$arity = 0), nil) && 'inspect';
|
494
|
+
})($scope.get('Native'), $scope.get('BasicObject'));
|
495
|
+
(function($base, $super) {
|
496
|
+
function $Array(){};
|
497
|
+
var self = $Array = $klass($base, $super, 'Array', $Array);
|
498
|
+
|
499
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_42, TMP_43, TMP_44, TMP_45, TMP_46, TMP_47, TMP_48;
|
500
|
+
|
501
|
+
def.named = def["native"] = def.get = def.block = def.set = def.length = nil;
|
502
|
+
self.$include($scope.get('Native'));
|
503
|
+
|
504
|
+
self.$include($scope.get('Enumerable'));
|
505
|
+
|
506
|
+
Opal.defn(self, '$initialize', TMP_42 = function ːinitialize(native$, options) {
|
507
|
+
var $a, $b, self = this, $iter = TMP_42.$$p, block = $iter || nil;
|
508
|
+
|
509
|
+
if (options == null) {
|
510
|
+
options = $hash2([], {});
|
511
|
+
}
|
512
|
+
TMP_42.$$p = null;
|
513
|
+
($a = ($b = self, Opal.find_super_dispatcher(self, 'initialize', TMP_42, false)), $a.$$p = null, $a).call($b, native$);
|
514
|
+
self.get = ((($a = options['$[]']("get")) !== false && $a !== nil && $a != null) ? $a : options['$[]']("access"));
|
515
|
+
self.named = options['$[]']("named");
|
516
|
+
self.set = ((($a = options['$[]']("set")) !== false && $a !== nil && $a != null) ? $a : options['$[]']("access"));
|
517
|
+
self.length = ((($a = options['$[]']("length")) !== false && $a !== nil && $a != null) ? $a : "length");
|
518
|
+
self.block = block;
|
519
|
+
if ((($a = self.$length() == null) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
520
|
+
return self.$raise($scope.get('ArgumentError'), "no length found on the array-like object")
|
521
|
+
} else {
|
522
|
+
return nil
|
523
|
+
};
|
524
|
+
}, TMP_42.$$arity = -2);
|
525
|
+
|
526
|
+
Opal.defn(self, '$each', TMP_43 = function ːeach() {
|
527
|
+
var self = this, $iter = TMP_43.$$p, block = $iter || nil;
|
528
|
+
|
529
|
+
TMP_43.$$p = null;
|
530
|
+
if (block !== false && block !== nil && block != null) {
|
531
|
+
} else {
|
532
|
+
return self.$enum_for("each")
|
533
|
+
};
|
534
|
+
|
535
|
+
for (var i = 0, length = self.$length(); i < length; i++) {
|
536
|
+
Opal.yield1(block, self['$[]'](i));
|
537
|
+
}
|
538
|
+
;
|
539
|
+
return self;
|
540
|
+
}, TMP_43.$$arity = 0);
|
541
|
+
|
542
|
+
Opal.defn(self, '$[]', TMP_44 = function(index) {
|
543
|
+
var $a, self = this, result = nil, $case = nil;
|
544
|
+
|
545
|
+
result = (function() {$case = index;if ($scope.get('String')['$===']($case) || $scope.get('Symbol')['$===']($case)) {if ((($a = self.named) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
546
|
+
return self["native"][self.named](index);
|
547
|
+
} else {
|
548
|
+
return self["native"][index];
|
549
|
+
}}else if ($scope.get('Integer')['$===']($case)) {if ((($a = self.get) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
550
|
+
return self["native"][self.get](index);
|
551
|
+
} else {
|
552
|
+
return self["native"][index];
|
553
|
+
}}else { return nil }})();
|
554
|
+
if (result !== false && result !== nil && result != null) {
|
555
|
+
if ((($a = self.block) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
556
|
+
return self.block.$call(result)
|
557
|
+
} else {
|
558
|
+
return self.$Native(result)
|
559
|
+
}
|
560
|
+
} else {
|
561
|
+
return nil
|
562
|
+
};
|
563
|
+
}, TMP_44.$$arity = 1);
|
564
|
+
|
565
|
+
Opal.defn(self, '$[]=', TMP_45 = function(index, value) {
|
566
|
+
var $a, self = this;
|
567
|
+
|
568
|
+
if ((($a = self.set) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
569
|
+
return self["native"][self.set](index, $scope.get('Native').$convert(value));
|
570
|
+
} else {
|
571
|
+
return self["native"][index] = $scope.get('Native').$convert(value);
|
572
|
+
};
|
573
|
+
}, TMP_45.$$arity = 2);
|
574
|
+
|
575
|
+
Opal.defn(self, '$last', TMP_46 = function ːlast(count) {
|
576
|
+
var $a, $b, self = this, index = nil, result = nil;
|
577
|
+
|
578
|
+
if (count == null) {
|
579
|
+
count = nil;
|
580
|
+
}
|
581
|
+
if (count !== false && count !== nil && count != null) {
|
582
|
+
index = $rb_minus(self.$length(), 1);
|
583
|
+
result = [];
|
584
|
+
while ((($b = $rb_ge(index, 0)) !== nil && $b != null && (!$b.$$is_boolean || $b == true))) {
|
585
|
+
result['$<<'](self['$[]'](index));
|
586
|
+
index = $rb_minus(index, 1);};
|
587
|
+
return result;
|
588
|
+
} else {
|
589
|
+
return self['$[]']($rb_minus(self.$length(), 1))
|
590
|
+
};
|
591
|
+
}, TMP_46.$$arity = -1);
|
592
|
+
|
593
|
+
Opal.defn(self, '$length', TMP_47 = function ːlength() {
|
594
|
+
var self = this;
|
595
|
+
|
596
|
+
return self["native"][self.length];
|
597
|
+
}, TMP_47.$$arity = 0);
|
598
|
+
|
599
|
+
Opal.alias(self, 'to_ary', 'to_a');
|
600
|
+
|
601
|
+
return (Opal.defn(self, '$inspect', TMP_48 = function ːinspect() {
|
602
|
+
var self = this;
|
603
|
+
|
604
|
+
return self.$to_a().$inspect();
|
605
|
+
}, TMP_48.$$arity = 0), nil) && 'inspect';
|
606
|
+
})($scope.get('Native'), null);
|
607
|
+
(function($base, $super) {
|
608
|
+
function $Numeric(){};
|
609
|
+
var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric);
|
610
|
+
|
611
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_49;
|
612
|
+
|
613
|
+
return (Opal.defn(self, '$to_n', TMP_49 = function ːto_n() {
|
614
|
+
var self = this;
|
615
|
+
|
616
|
+
return self.valueOf();
|
617
|
+
}, TMP_49.$$arity = 0), nil) && 'to_n'
|
618
|
+
})($scope.base, null);
|
619
|
+
(function($base, $super) {
|
620
|
+
function $Proc(){};
|
621
|
+
var self = $Proc = $klass($base, $super, 'Proc', $Proc);
|
622
|
+
|
623
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_50;
|
624
|
+
|
625
|
+
return (Opal.defn(self, '$to_n', TMP_50 = function ːto_n() {
|
626
|
+
var self = this;
|
627
|
+
|
628
|
+
return self;
|
629
|
+
}, TMP_50.$$arity = 0), nil) && 'to_n'
|
630
|
+
})($scope.base, null);
|
631
|
+
(function($base, $super) {
|
632
|
+
function $String(){};
|
633
|
+
var self = $String = $klass($base, $super, 'String', $String);
|
634
|
+
|
635
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_51;
|
636
|
+
|
637
|
+
return (Opal.defn(self, '$to_n', TMP_51 = function ːto_n() {
|
638
|
+
var self = this;
|
639
|
+
|
640
|
+
return self.valueOf();
|
641
|
+
}, TMP_51.$$arity = 0), nil) && 'to_n'
|
642
|
+
})($scope.base, null);
|
643
|
+
(function($base, $super) {
|
644
|
+
function $Regexp(){};
|
645
|
+
var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp);
|
646
|
+
|
647
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_52;
|
648
|
+
|
649
|
+
return (Opal.defn(self, '$to_n', TMP_52 = function ːto_n() {
|
650
|
+
var self = this;
|
651
|
+
|
652
|
+
return self.valueOf();
|
653
|
+
}, TMP_52.$$arity = 0), nil) && 'to_n'
|
654
|
+
})($scope.base, null);
|
655
|
+
(function($base, $super) {
|
656
|
+
function $MatchData(){};
|
657
|
+
var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData);
|
658
|
+
|
659
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_53;
|
660
|
+
|
661
|
+
def.matches = nil;
|
662
|
+
return (Opal.defn(self, '$to_n', TMP_53 = function ːto_n() {
|
663
|
+
var self = this;
|
664
|
+
|
665
|
+
return self.matches;
|
666
|
+
}, TMP_53.$$arity = 0), nil) && 'to_n'
|
667
|
+
})($scope.base, null);
|
668
|
+
(function($base, $super) {
|
669
|
+
function $Struct(){};
|
670
|
+
var self = $Struct = $klass($base, $super, 'Struct', $Struct);
|
671
|
+
|
672
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_55;
|
673
|
+
|
674
|
+
return (Opal.defn(self, '$to_n', TMP_55 = function ːto_n() {
|
675
|
+
var $a, $b, TMP_54, self = this, result = nil;
|
676
|
+
|
677
|
+
result = {};
|
678
|
+
($a = ($b = self).$each_pair, $a.$$p = (TMP_54 = function(name, value){var self = TMP_54.$$s || this;
|
679
|
+
if (name == null) name = nil;if (value == null) value = nil;
|
680
|
+
return result[name] = $scope.get('Native').$try_convert(value, value);}, TMP_54.$$s = self, TMP_54.$$arity = 2, TMP_54), $a).call($b);
|
681
|
+
return result;
|
682
|
+
}, TMP_55.$$arity = 0), nil) && 'to_n'
|
683
|
+
})($scope.base, null);
|
684
|
+
(function($base, $super) {
|
685
|
+
function $Array(){};
|
686
|
+
var self = $Array = $klass($base, $super, 'Array', $Array);
|
687
|
+
|
688
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_56;
|
689
|
+
|
690
|
+
return (Opal.defn(self, '$to_n', TMP_56 = function ːto_n() {
|
691
|
+
var self = this;
|
692
|
+
|
693
|
+
|
694
|
+
var result = [];
|
695
|
+
|
696
|
+
for (var i = 0, length = self.length; i < length; i++) {
|
697
|
+
var obj = self[i];
|
698
|
+
|
699
|
+
result.push($scope.get('Native').$try_convert(obj, obj));
|
700
|
+
}
|
701
|
+
|
702
|
+
return result;
|
703
|
+
|
704
|
+
}, TMP_56.$$arity = 0), nil) && 'to_n'
|
705
|
+
})($scope.base, null);
|
706
|
+
(function($base, $super) {
|
707
|
+
function $Boolean(){};
|
708
|
+
var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean);
|
709
|
+
|
710
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_57;
|
711
|
+
|
712
|
+
return (Opal.defn(self, '$to_n', TMP_57 = function ːto_n() {
|
713
|
+
var self = this;
|
714
|
+
|
715
|
+
return self.valueOf();
|
716
|
+
}, TMP_57.$$arity = 0), nil) && 'to_n'
|
717
|
+
})($scope.base, null);
|
718
|
+
(function($base, $super) {
|
719
|
+
function $Time(){};
|
720
|
+
var self = $Time = $klass($base, $super, 'Time', $Time);
|
721
|
+
|
722
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_58;
|
723
|
+
|
724
|
+
return (Opal.defn(self, '$to_n', TMP_58 = function ːto_n() {
|
725
|
+
var self = this;
|
726
|
+
|
727
|
+
return self;
|
728
|
+
}, TMP_58.$$arity = 0), nil) && 'to_n'
|
729
|
+
})($scope.base, null);
|
730
|
+
(function($base, $super) {
|
731
|
+
function $NilClass(){};
|
732
|
+
var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass);
|
733
|
+
|
734
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_59;
|
735
|
+
|
736
|
+
return (Opal.defn(self, '$to_n', TMP_59 = function ːto_n() {
|
737
|
+
var self = this;
|
738
|
+
|
739
|
+
return null;
|
740
|
+
}, TMP_59.$$arity = 0), nil) && 'to_n'
|
741
|
+
})($scope.base, null);
|
742
|
+
(function($base, $super) {
|
743
|
+
function $Hash(){};
|
744
|
+
var self = $Hash = $klass($base, $super, 'Hash', $Hash);
|
745
|
+
|
746
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_60, TMP_61;
|
747
|
+
|
748
|
+
self.$alias_method("_initialize", "initialize");
|
749
|
+
|
750
|
+
Opal.defn(self, '$initialize', TMP_60 = function ːinitialize(defaults) {
|
751
|
+
var $a, $b, self = this, $iter = TMP_60.$$p, block = $iter || nil;
|
752
|
+
|
753
|
+
TMP_60.$$p = null;
|
754
|
+
|
755
|
+
if (defaults != null && defaults.constructor === Object) {
|
756
|
+
var smap = self.$$smap,
|
757
|
+
keys = self.$$keys,
|
758
|
+
key, value;
|
759
|
+
|
760
|
+
for (key in defaults) {
|
761
|
+
value = defaults[key];
|
762
|
+
|
763
|
+
if (value && value.constructor === Object) {
|
764
|
+
smap[key] = $scope.get('Hash').$new(value);
|
765
|
+
} else if (value && value.$$is_array) {
|
766
|
+
value = value.map(function(item) {
|
767
|
+
if (item && item.constructor === Object) {
|
768
|
+
return $scope.get('Hash').$new(item);
|
769
|
+
}
|
770
|
+
|
771
|
+
return item;
|
772
|
+
});
|
773
|
+
smap[key] = value
|
774
|
+
} else {
|
775
|
+
smap[key] = self.$Native(value);
|
776
|
+
}
|
777
|
+
|
778
|
+
keys.push(key);
|
779
|
+
}
|
780
|
+
|
781
|
+
return self;
|
782
|
+
}
|
783
|
+
|
784
|
+
return ($a = ($b = self).$_initialize, $a.$$p = block.$to_proc(), $a).call($b, defaults);
|
785
|
+
|
786
|
+
}, TMP_60.$$arity = -1);
|
787
|
+
|
788
|
+
return (Opal.defn(self, '$to_n', TMP_61 = function ːto_n() {
|
789
|
+
var self = this;
|
790
|
+
|
791
|
+
|
792
|
+
var result = {},
|
793
|
+
keys = self.$$keys,
|
794
|
+
smap = self.$$smap,
|
795
|
+
key, value;
|
796
|
+
|
797
|
+
for (var i = 0, length = keys.length; i < length; i++) {
|
798
|
+
key = keys[i];
|
799
|
+
|
800
|
+
if (key.$$is_string) {
|
801
|
+
value = smap[key];
|
802
|
+
} else {
|
803
|
+
key = key.key;
|
804
|
+
value = key.value;
|
805
|
+
}
|
806
|
+
|
807
|
+
result[key] = $scope.get('Native').$try_convert(value, value);
|
808
|
+
}
|
809
|
+
|
810
|
+
return result;
|
811
|
+
|
812
|
+
}, TMP_61.$$arity = 0), nil) && 'to_n';
|
813
|
+
})($scope.base, null);
|
814
|
+
(function($base, $super) {
|
815
|
+
function $Module(){};
|
816
|
+
var self = $Module = $klass($base, $super, 'Module', $Module);
|
817
|
+
|
818
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_62;
|
819
|
+
|
820
|
+
return (Opal.defn(self, '$native_module', TMP_62 = function ːnative_module() {
|
821
|
+
var self = this;
|
822
|
+
|
823
|
+
return Opal.global[self.$name()] = self;
|
824
|
+
}, TMP_62.$$arity = 0), nil) && 'native_module'
|
825
|
+
})($scope.base, null);
|
826
|
+
(function($base, $super) {
|
827
|
+
function $Class(){};
|
828
|
+
var self = $Class = $klass($base, $super, 'Class', $Class);
|
829
|
+
|
830
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_63, TMP_64;
|
831
|
+
|
832
|
+
Opal.defn(self, '$native_alias', TMP_63 = function ːnative_alias(new_jsid, existing_mid) {
|
833
|
+
var self = this;
|
834
|
+
|
835
|
+
|
836
|
+
var aliased = self.$$proto['$' + existing_mid];
|
837
|
+
if (!aliased) {
|
838
|
+
self.$raise($scope.get('NameError').$new("undefined method `" + (existing_mid) + "' for class `" + (self.$inspect()) + "'", self.$exiting_mid()));
|
839
|
+
}
|
840
|
+
self.$$proto[new_jsid] = aliased;
|
841
|
+
;
|
842
|
+
}, TMP_63.$$arity = 2);
|
843
|
+
|
844
|
+
return (Opal.defn(self, '$native_class', TMP_64 = function ːnative_class() {
|
845
|
+
var self = this;
|
846
|
+
|
847
|
+
self.$native_module();
|
848
|
+
self["new"] = self.$new;
|
849
|
+
}, TMP_64.$$arity = 0), nil) && 'native_class';
|
850
|
+
})($scope.base, null);
|
851
|
+
return $gvars.$ = $gvars.global = self.$Native(Opal.global);
|
852
|
+
};
|
853
|
+
|
854
|
+
/* Generated by Opal 0.10.2 */
|
855
|
+
Opal.modules["opal/react/react"] = function(Opal) {
|
856
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $gvars = Opal.gvars;
|
857
|
+
|
858
|
+
Opal.add_stubs(['$render', '$to_proc', '$ReactDOM', '$renderToString', '$ReactDOMServer', '$renderToStaticMarkup']);
|
859
|
+
|
860
|
+
if (typeof global === 'undefined') global = window;
|
861
|
+
if (typeof React === 'undefined') {
|
862
|
+
if (require) global.React = require('react');
|
863
|
+
}
|
864
|
+
if (typeof ReactDOM === 'undefined') {
|
865
|
+
if (require) global.ReactDOM = require('react-dom');
|
866
|
+
}
|
867
|
+
if (typeof shallowCompare === 'undefined') {
|
868
|
+
if ('addons' in React && 'shallowCompare' in React.addons)
|
869
|
+
global.shallowCompare = React.addons.shallowCompare;
|
870
|
+
else if (require)
|
871
|
+
global.shallowCompare('react-addons-shallow-compare');
|
872
|
+
}
|
873
|
+
|
874
|
+
(function($base) {
|
875
|
+
var $React, self = $React = $module($base, 'React');
|
876
|
+
|
877
|
+
var def = self.$$proto, $scope = self.$$scope;
|
878
|
+
|
879
|
+
nil
|
880
|
+
})($scope.base);
|
881
|
+
(function($base) {
|
882
|
+
var $ReactDOM, self = $ReactDOM = $module($base, 'ReactDOM');
|
883
|
+
|
884
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_1;
|
885
|
+
|
886
|
+
Opal.defs(self, '$render', TMP_1 = function ːrender(element, container) {
|
887
|
+
var $a, $b, self = this, $iter = TMP_1.$$p, block = $iter || nil;
|
888
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
889
|
+
|
890
|
+
TMP_1.$$p = null;
|
891
|
+
return ($a = ($b = $gvars.$.$ReactDOM()).$render, $a.$$p = block.$to_proc(), $a).call($b, element, container);
|
892
|
+
}, TMP_1.$$arity = 2)
|
893
|
+
})($scope.base);
|
894
|
+
return (function($base) {
|
895
|
+
var $ReactDOMServer, self = $ReactDOMServer = $module($base, 'ReactDOMServer');
|
896
|
+
|
897
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_2, TMP_3;
|
898
|
+
|
899
|
+
Opal.defs(self, '$renderToString', TMP_2 = function ːrenderToString(element) {
|
900
|
+
var self = this;
|
901
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
902
|
+
|
903
|
+
return $gvars.$.$ReactDOMServer().$renderToString(element);
|
904
|
+
}, TMP_2.$$arity = 1);
|
905
|
+
|
906
|
+
Opal.defs(self, '$renderToStaticMarkup', TMP_3 = function ːrenderToStaticMarkup(element) {
|
907
|
+
var self = this;
|
908
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
909
|
+
|
910
|
+
return $gvars.$.$ReactDOMServer().$renderToStaticMarkup(element);
|
911
|
+
}, TMP_3.$$arity = 1);
|
912
|
+
})($scope.base);
|
913
|
+
};
|
914
|
+
|
915
|
+
/* Generated by Opal 0.10.2 */
|
916
|
+
Opal.modules["opal/react/dom"] = function(Opal) {
|
917
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $gvars = Opal.gvars;
|
918
|
+
|
919
|
+
Opal.add_stubs(['$each', '$define_method', '$nil?', '$!', '$fix_props', '$to_n', '$DOM', '$React']);
|
920
|
+
return (function($base) {
|
921
|
+
var $React, self = $React = $module($base, 'React');
|
922
|
+
|
923
|
+
var def = self.$$proto, $scope = self.$$scope;
|
924
|
+
|
925
|
+
(function($base) {
|
926
|
+
var $DOM, self = $DOM = $module($base, 'DOM');
|
927
|
+
|
928
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1;
|
929
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
930
|
+
|
931
|
+
($a = ($b = $gvars.$.$React().$DOM()).$each, $a.$$p = (TMP_1 = function(name, factory){var self = TMP_1.$$s || this, $c, $d, TMP_2;
|
932
|
+
if (name == null) name = nil;if (factory == null) factory = nil;
|
933
|
+
return ($c = ($d = self).$define_method, $c.$$p = (TMP_2 = function(props, children){var self = TMP_2.$$s || this, block, $e, $f;
|
934
|
+
|
935
|
+
block = TMP_2.$$p || nil, TMP_2.$$p = null;
|
936
|
+
if (props == null) {
|
937
|
+
props = nil;
|
938
|
+
}
|
939
|
+
if (children == null) {
|
940
|
+
children = nil;
|
941
|
+
}
|
942
|
+
if ((($e = children['$nil?']()) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) {
|
943
|
+
if ((($e = Array.isArray(props)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) {
|
944
|
+
children = props;
|
945
|
+
props = nil;
|
946
|
+
} else if ((($e = ($f = props['$nil?']()['$!'](), $f !== false && $f !== nil && $f != null ?typeof props !== 'object' : $f)) !== nil && $e != null && (!$e.$$is_boolean || $e == true))) {
|
947
|
+
children = [props];
|
948
|
+
props = nil;}};
|
949
|
+
return factory($scope.get('React').$fix_props(props), children.$to_n());;}, TMP_2.$$s = self, TMP_2.$$arity = -1, TMP_2), $c).call($d, name)}, TMP_1.$$s = self, TMP_1.$$arity = 2, TMP_1), $a).call($b)
|
950
|
+
})($scope.base)
|
951
|
+
})($scope.base)
|
952
|
+
};
|
953
|
+
|
954
|
+
/* Generated by Opal 0.10.2 */
|
955
|
+
Opal.modules["opal/react/window"] = function(Opal) {
|
956
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $gvars = Opal.gvars;
|
957
|
+
|
958
|
+
Opal.add_stubs(['$each', '$define_method', '$[]', '$window']);
|
959
|
+
return (function($base) {
|
960
|
+
var $React, self = $React = $module($base, 'React');
|
961
|
+
|
962
|
+
var def = self.$$proto, $scope = self.$$scope;
|
963
|
+
|
964
|
+
(function($base) {
|
965
|
+
var $Window, self = $Window = $module($base, 'Window');
|
966
|
+
|
967
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1;
|
968
|
+
|
969
|
+
($a = ($b = ["closed", "console", "controllers", "crypto", "devicePixelRatio", "dialogArguments", "document", "frameElement", "frames", "fullscreen", "history", "indexedDB", "innerHeight", "innerWidth", "isSecureContext", "length", "localStorage", "location", "locationbar", "menubar", "messageManager", "name", "navigator", "opener", "outerHeight", "outerWidth", "parent", "performance", "personalbar", "screen", "screenX", "screenY", "scrollbars", "scrollX", "scrollY", "sessionStorage", "status", "statusbar", "toolbar", "top", "URL", "window", "alert", "atob", "blur", "btoa", "cancelAnimationFrame", "cancelIdleCallback", "clearImmediate", "clearInterval", "clearTimeout", "close", "confirm", "convertPointFromNodeToPage", "createImageBitmap", "fetch", "focus", "forward", "getAttention", "getComputedStyle", "getDefaultComputedStyle", "getSelection", "home", "matchMedia", "minimize", "moveBy", "moveTo", "open", "postMessage", "prompt", "requestAnimationFrame", "requestIdleCallback", "resizeBy", "resizeTo", "restore", "scroll", "scrollBy", "scrollByPages", "scrollTo", "setImmediate", "setInterval", "setTimeout", "sizeToContent", "stop", "updateCommands"]).$each, $a.$$p = (TMP_1 = function(key){var self = TMP_1.$$s || this, $c, $d, TMP_2;
|
970
|
+
if (key == null) key = nil;
|
971
|
+
return ($c = ($d = self).$define_method, $c.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this;
|
972
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
973
|
+
|
974
|
+
return $gvars.$.$window()['$[]'](key)}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $c).call($d, key)}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $a).call($b)
|
975
|
+
})($scope.base)
|
976
|
+
})($scope.base)
|
977
|
+
};
|
978
|
+
|
979
|
+
/* Generated by Opal 0.10.2 */
|
980
|
+
Opal.modules["opal/react/component"] = function(Opal) {
|
981
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $gvars = Opal.gvars;
|
982
|
+
|
983
|
+
Opal.add_stubs(['$nil?', '$each', '$start_with?', '$lambda', '$call', '$Native', '$==', '$to_n', '$include', '$fix_props', '$new', '$fix_state', '$!', '$dsl_name', '$name', '$define_method', '$render', '$appendChild', '$body', '$document', '$createElement', '$class', '$gsub', '$[]']);
|
984
|
+
return (function($base) {
|
985
|
+
var $React, self = $React = $module($base, 'React');
|
986
|
+
|
987
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_5, TMP_7;
|
988
|
+
|
989
|
+
(function($base, $super) {
|
990
|
+
function $ShallowWrapper(){};
|
991
|
+
var self = $ShallowWrapper = $klass($base, $super, 'ShallowWrapper', $ShallowWrapper);
|
992
|
+
|
993
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_2;
|
994
|
+
|
995
|
+
def["native"] = nil;
|
996
|
+
Opal.defn(self, '$initialize', TMP_1 = function ːinitialize(native$) {
|
997
|
+
var self = this;
|
998
|
+
|
999
|
+
return self["native"] = native$;
|
1000
|
+
}, TMP_1.$$arity = 1);
|
1001
|
+
|
1002
|
+
return (Opal.defn(self, '$[]', TMP_2 = function(key) {
|
1003
|
+
var self = this;
|
1004
|
+
|
1005
|
+
return self["native"][key] || nil;;
|
1006
|
+
}, TMP_2.$$arity = 1), nil) && '[]';
|
1007
|
+
})($scope.base, null);
|
1008
|
+
|
1009
|
+
Opal.defs(self, '$fix_props', TMP_5 = function ːfix_props(props) {
|
1010
|
+
var $a, $b, TMP_3, self = this;
|
1011
|
+
|
1012
|
+
if ((($a = props['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
1013
|
+
return null};
|
1014
|
+
|
1015
|
+
const jsProps = {};
|
1016
|
+
($a = ($b = props).$each, $a.$$p = (TMP_3 = function(key, value){var self = TMP_3.$$s || this, $c, $d, TMP_4, chain = nil;
|
1017
|
+
if (key == null) key = nil;if (value == null) value = nil;
|
1018
|
+
if ((($c = key['$start_with?']("on")) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) {
|
1019
|
+
chain = value;
|
1020
|
+
value = ($c = ($d = self).$lambda, $c.$$p = (TMP_4 = function(event){var self = TMP_4.$$s || this;
|
1021
|
+
if (event == null) event = nil;
|
1022
|
+
return chain.$call(self.$Native(event))}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4), $c).call($d);
|
1023
|
+
} else if (key['$==']("style")) {
|
1024
|
+
value = value.$to_n()};
|
1025
|
+
jsProps[key] = value;}, TMP_3.$$s = self, TMP_3.$$arity = 2, TMP_3), $a).call($b)
|
1026
|
+
return jsProps;
|
1027
|
+
|
1028
|
+
}, TMP_5.$$arity = 1);
|
1029
|
+
|
1030
|
+
Opal.defs(self, '$fix_state', TMP_7 = function ːfix_state(state) {
|
1031
|
+
var $a, $b, TMP_6, self = this;
|
1032
|
+
|
1033
|
+
if ((($a = state['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
1034
|
+
return null};
|
1035
|
+
|
1036
|
+
const jsState = {};
|
1037
|
+
($a = ($b = state).$each, $a.$$p = (TMP_6 = function(key, value){var self = TMP_6.$$s || this;
|
1038
|
+
if (key == null) key = nil;if (value == null) value = nil;
|
1039
|
+
jsState[key] = value;}, TMP_6.$$s = self, TMP_6.$$arity = 2, TMP_6), $a).call($b)
|
1040
|
+
return jsState;
|
1041
|
+
|
1042
|
+
}, TMP_7.$$arity = 1);
|
1043
|
+
|
1044
|
+
(function($base, $super) {
|
1045
|
+
function $Component(){};
|
1046
|
+
var self = $Component = $klass($base, $super, 'Component', $Component);
|
1047
|
+
|
1048
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_8, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_31;
|
1049
|
+
|
1050
|
+
def["this"] = nil;
|
1051
|
+
self.$include($scope.get('DOM'));
|
1052
|
+
|
1053
|
+
self.$include($scope.get('Window'));
|
1054
|
+
|
1055
|
+
Opal.defs(self, '$inherited', TMP_8 = function ːinherited(subclass) {
|
1056
|
+
var $a, $b, $c, TMP_9, $d, TMP_10, self = this, $iter = TMP_8.$$p, $yield = $iter || nil, _class = nil, _create = nil, name = nil, $zuper = nil, $zuper_index = nil, $zuper_length = nil;
|
1057
|
+
|
1058
|
+
TMP_8.$$p = null;
|
1059
|
+
$zuper = [];
|
1060
|
+
|
1061
|
+
for($zuper_index = 0; $zuper_index < arguments.length; $zuper_index++) {
|
1062
|
+
$zuper[$zuper_index] = arguments[$zuper_index];
|
1063
|
+
}
|
1064
|
+
($a = ($b = self, Opal.find_super_dispatcher(self, 'inherited', TMP_8, false, $Component)), $a.$$p = $iter, $a).apply($b, $zuper);
|
1065
|
+
_class =
|
1066
|
+
class extends React.Component {
|
1067
|
+
|
1068
|
+
static get defaultProps() {
|
1069
|
+
return $scope.get('React').$fix_props(subclass.$default_props());
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
constructor(props) {
|
1073
|
+
super(props);
|
1074
|
+
this.self = subclass.$new(props);
|
1075
|
+
this.state = $scope.get('React').$fix_state(this.self.$initial_state());
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
render() {
|
1079
|
+
return this.self.$bridge(this).self.$render();
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
componentWillMount() {
|
1083
|
+
this.self.$bridge(this).self.$component_will_mount();
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
componentDidMount() {
|
1087
|
+
this.self.$bridge(this).self.$component_did_mount();
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
componentWillReceiveProps(nextProps) {
|
1091
|
+
this.self.$bridge(this).self.$component_will_receive_props(nextProps);
|
1092
|
+
}
|
1093
|
+
|
1094
|
+
shouldComponentUpdate(nextProps, nextState) {
|
1095
|
+
return ("$should_component_update?" in this.self)
|
1096
|
+
? this.self.$bridge(this).self["$should_component_update?"](nextProps, nextState)
|
1097
|
+
: shallowCompare(this, nextProps, nextState);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
componentWillUpdate(nextProps, nextState) {
|
1101
|
+
this.self.$bridge(this).self.$component_will_update(nextProps, nextState);
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
componentDidUpdate(prevProps, prevState) {
|
1105
|
+
this.self.$bridge(this).self.$component_did_update(prevProps, prevState);
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
componentWillUnmount() {
|
1109
|
+
this.self.$bridge(this).self.$component_will_unmount();
|
1110
|
+
}
|
1111
|
+
}
|
1112
|
+
;
|
1113
|
+
_create = ($a = ($c = $scope.get('Proc')).$new, $a.$$p = (TMP_9 = function(props, children){var self = TMP_9.$$s || this, block, $d, $e;
|
1114
|
+
|
1115
|
+
block = TMP_9.$$p || nil, TMP_9.$$p = null;
|
1116
|
+
if (props == null) {
|
1117
|
+
props = nil;
|
1118
|
+
}
|
1119
|
+
if (children == null) {
|
1120
|
+
children = nil;
|
1121
|
+
}
|
1122
|
+
if ((($d = children['$nil?']()) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) {
|
1123
|
+
if ((($d = Array.isArray(props)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) {
|
1124
|
+
children = props;
|
1125
|
+
props = nil;
|
1126
|
+
} else if ((($d = ($e = props['$nil?']()['$!'](), $e !== false && $e !== nil && $e != null ?typeof props !== 'object' : $e)) !== nil && $d != null && (!$d.$$is_boolean || $d == true))) {
|
1127
|
+
children = [props];
|
1128
|
+
props = nil;}};
|
1129
|
+
return React.createElement( _class, $scope.get('React').$fix_props(props), children.$to_n() );;}, TMP_9.$$s = self, TMP_9.$$arity = -1, TMP_9), $a).call($c);
|
1130
|
+
name = subclass.$dsl_name(subclass.$name());
|
1131
|
+
$scope.get('DOM').$define_method(name, _create);
|
1132
|
+
return ($a = ($d = subclass.$class()).$define_method, $a.$$p = (TMP_10 = function($kwargs){var self = TMP_10.$$s || this, props, container, $e, $f, TMP_11;
|
1133
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
1134
|
+
|
1135
|
+
if ($kwargs == null || !$kwargs.$$is_hash) {
|
1136
|
+
if ($kwargs == null) {
|
1137
|
+
$kwargs = $hash2([], {});
|
1138
|
+
} else {
|
1139
|
+
throw Opal.ArgumentError.$new('expected kwargs');
|
1140
|
+
}
|
1141
|
+
}
|
1142
|
+
if ((props = $kwargs.$$smap['props']) == null) {
|
1143
|
+
props = nil
|
1144
|
+
}
|
1145
|
+
if ((container = $kwargs.$$smap['container']) == null) {
|
1146
|
+
container = nil
|
1147
|
+
}
|
1148
|
+
if (container !== false && container !== nil && container != null) {
|
1149
|
+
return $scope.get('ReactDOM').$render(_create.$call(props), container)
|
1150
|
+
} else {
|
1151
|
+
return ($e = ($f = $scope.get('ReactDOM')).$render, $e.$$p = (TMP_11 = function(){var self = TMP_11.$$s || this;
|
1152
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
1153
|
+
|
1154
|
+
return $gvars.$.$document().$body().$appendChild(container)}, TMP_11.$$s = self, TMP_11.$$arity = 0, TMP_11), $e).call($f, _create.$call(props), container = $gvars.$.$document().$createElement("div"))
|
1155
|
+
}}, TMP_10.$$s = self, TMP_10.$$arity = -1, TMP_10), $a).call($d, "run");
|
1156
|
+
}, TMP_8.$$arity = 1);
|
1157
|
+
|
1158
|
+
Opal.defs(self, '$dsl_name', TMP_12 = function ːdsl_name(name) {
|
1159
|
+
var self = this;
|
1160
|
+
|
1161
|
+
return name.$gsub(/Component$/, "");
|
1162
|
+
}, TMP_12.$$arity = 1);
|
1163
|
+
|
1164
|
+
Opal.defn(self, '$bridge', TMP_13 = function ːbridge(value) {
|
1165
|
+
var self = this;
|
1166
|
+
|
1167
|
+
return self["this"] = value;
|
1168
|
+
}, TMP_13.$$arity = 1);
|
1169
|
+
|
1170
|
+
Opal.defs(self, '$default_props', TMP_14 = function ːdefault_props() {
|
1171
|
+
var self = this;
|
1172
|
+
|
1173
|
+
return nil;
|
1174
|
+
}, TMP_14.$$arity = 0);
|
1175
|
+
|
1176
|
+
Opal.defn(self, '$initial_state', TMP_15 = function ːinitial_state() {
|
1177
|
+
var self = this;
|
1178
|
+
|
1179
|
+
return nil;
|
1180
|
+
}, TMP_15.$$arity = 0);
|
1181
|
+
|
1182
|
+
Opal.defn(self, '$prop_types', TMP_16 = function ːprop_types() {
|
1183
|
+
var self = this;
|
1184
|
+
|
1185
|
+
return nil;
|
1186
|
+
}, TMP_16.$$arity = 0);
|
1187
|
+
|
1188
|
+
Opal.defn(self, '$component_will_mount', TMP_17 = function ːcomponent_will_mount() {
|
1189
|
+
var self = this;
|
1190
|
+
|
1191
|
+
return nil;
|
1192
|
+
}, TMP_17.$$arity = 0);
|
1193
|
+
|
1194
|
+
Opal.defn(self, '$component_did_mount', TMP_18 = function ːcomponent_did_mount() {
|
1195
|
+
var self = this;
|
1196
|
+
|
1197
|
+
return nil;
|
1198
|
+
}, TMP_18.$$arity = 0);
|
1199
|
+
|
1200
|
+
Opal.defn(self, '$component_will_receive_props', TMP_19 = function ːcomponent_will_receive_props(next_props) {
|
1201
|
+
var self = this;
|
1202
|
+
|
1203
|
+
return nil;
|
1204
|
+
}, TMP_19.$$arity = 1);
|
1205
|
+
|
1206
|
+
Opal.defn(self, '$component_will_update', TMP_20 = function ːcomponent_will_update(next_props, next_state) {
|
1207
|
+
var self = this;
|
1208
|
+
|
1209
|
+
return nil;
|
1210
|
+
}, TMP_20.$$arity = 2);
|
1211
|
+
|
1212
|
+
Opal.defn(self, '$component_did_update', TMP_21 = function ːcomponent_did_update(next_props, next_state) {
|
1213
|
+
var self = this;
|
1214
|
+
|
1215
|
+
return nil;
|
1216
|
+
}, TMP_21.$$arity = 2);
|
1217
|
+
|
1218
|
+
Opal.defn(self, '$component_will_unmount', TMP_22 = function ːcomponent_will_unmount() {
|
1219
|
+
var self = this;
|
1220
|
+
|
1221
|
+
return nil;
|
1222
|
+
}, TMP_22.$$arity = 0);
|
1223
|
+
|
1224
|
+
Opal.defn(self, '$render', TMP_23 = function ːrender() {
|
1225
|
+
var self = this;
|
1226
|
+
|
1227
|
+
return nil;
|
1228
|
+
}, TMP_23.$$arity = 0);
|
1229
|
+
|
1230
|
+
Opal.defn(self, '$props', TMP_24 = function ːprops() {
|
1231
|
+
var self = this;
|
1232
|
+
|
1233
|
+
return $scope.get('ShallowWrapper').$new(self["this"].props);
|
1234
|
+
}, TMP_24.$$arity = 0);
|
1235
|
+
|
1236
|
+
Opal.defn(self, '$state', TMP_25 = function ːstate() {
|
1237
|
+
var self = this;
|
1238
|
+
|
1239
|
+
return $scope.get('ShallowWrapper').$new(self["this"].state);
|
1240
|
+
}, TMP_25.$$arity = 0);
|
1241
|
+
|
1242
|
+
Opal.defn(self, '$set_state', TMP_26 = function ːset_state(next_state) {
|
1243
|
+
var $a, self = this, $iter = TMP_26.$$p, block = $iter || nil;
|
1244
|
+
|
1245
|
+
TMP_26.$$p = null;
|
1246
|
+
if ((($a = block['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
1247
|
+
block = null};
|
1248
|
+
return self["this"].setState($scope.get('React').$fix_state(next_state), block);;
|
1249
|
+
}, TMP_26.$$arity = 1);
|
1250
|
+
|
1251
|
+
Opal.defn(self, '$replace_state', TMP_27 = function ːreplace_state(next_state) {
|
1252
|
+
var $a, self = this, $iter = TMP_27.$$p, block = $iter || nil;
|
1253
|
+
|
1254
|
+
TMP_27.$$p = null;
|
1255
|
+
if ((($a = block['$nil?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
1256
|
+
block = null};
|
1257
|
+
return self["this"].replaceState($scope.get('React').$fix_state(next_state), block);;
|
1258
|
+
}, TMP_27.$$arity = 1);
|
1259
|
+
|
1260
|
+
Opal.defn(self, '$force_update', TMP_28 = function ːforce_update() {
|
1261
|
+
var self = this;
|
1262
|
+
|
1263
|
+
return self["this"].forceUpdate();;
|
1264
|
+
}, TMP_28.$$arity = 0);
|
1265
|
+
|
1266
|
+
Opal.defn(self, '$mounted?', TMP_29 = function() {
|
1267
|
+
var self = this;
|
1268
|
+
|
1269
|
+
return self["this"].isMounted();;
|
1270
|
+
}, TMP_29.$$arity = 0);
|
1271
|
+
|
1272
|
+
return (Opal.defn(self, '$defer', TMP_31 = function ːdefer(ms) {
|
1273
|
+
var $a, $b, TMP_30, self = this, $iter = TMP_31.$$p, $yield = $iter || nil;
|
1274
|
+
if ($gvars.$ == null) $gvars.$ = nil;
|
1275
|
+
|
1276
|
+
if (ms == null) {
|
1277
|
+
ms = 0;
|
1278
|
+
}
|
1279
|
+
TMP_31.$$p = null;
|
1280
|
+
return $gvars.$['$[]']("setTimeout").$call(($a = ($b = self).$lambda, $a.$$p = (TMP_30 = function(){var self = TMP_30.$$s || this;
|
1281
|
+
|
1282
|
+
if (($yield !== nil)) {
|
1283
|
+
return Opal.yieldX($yield, []);
|
1284
|
+
} else {
|
1285
|
+
return nil
|
1286
|
+
}}, TMP_30.$$s = self, TMP_30.$$arity = 0, TMP_30), $a).call($b), ms);
|
1287
|
+
}, TMP_31.$$arity = -1), nil) && 'defer';
|
1288
|
+
})($scope.base, null);
|
1289
|
+
})($scope.base)
|
1290
|
+
};
|
1291
|
+
|
1292
|
+
/* Generated by Opal 0.10.2 */
|
1293
|
+
Opal.modules["opal/react/version"] = function(Opal) {
|
1294
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module;
|
1295
|
+
|
1296
|
+
return (function($base) {
|
1297
|
+
var $Opal, self = $Opal = $module($base, 'Opal');
|
1298
|
+
|
1299
|
+
var def = self.$$proto, $scope = self.$$scope;
|
1300
|
+
|
1301
|
+
(function($base) {
|
1302
|
+
var $React, self = $React = $module($base, 'React');
|
1303
|
+
|
1304
|
+
var def = self.$$proto, $scope = self.$$scope;
|
1305
|
+
|
1306
|
+
Opal.cdecl($scope, 'VERSION', "0.0.3")
|
1307
|
+
})($scope.base)
|
1308
|
+
})($scope.base)
|
1309
|
+
};
|
1310
|
+
|
1311
|
+
/* Generated by Opal 0.10.2 */
|
1312
|
+
(function(Opal) {
|
1313
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;
|
1314
|
+
|
1315
|
+
Opal.add_stubs(['$==', '$require']);
|
1316
|
+
if ($scope.get('RUBY_ENGINE')['$==']("opal")) {
|
1317
|
+
self.$require("native");
|
1318
|
+
self.$require("opal/react"+ '/../' + "react/react.rb");
|
1319
|
+
self.$require("opal/react"+ '/../' + "react/dom.rb");
|
1320
|
+
self.$require("opal/react"+ '/../' + "react/window.rb");
|
1321
|
+
self.$require("opal/react"+ '/../' + "react/component.rb");
|
1322
|
+
return self.$require("opal/react"+ '/../' + "react/version");}
|
1323
|
+
})(Opal);
|
1324
|
+
|
1325
|
+
//# sourceMappingURL=opal-react.js.map
|