hyper-console 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/hyper-console-client.js +323 -274
- data/lib/hyper-console-client.min.js +3 -3
- data/lib/hyperloop/console/client_components.rb +211 -207
- data/lib/hyperloop/console/evaluate.rb +18 -16
- data/lib/hyperloop/console/hyper-console-client-manifest.rb +1 -0
- data/lib/hyperloop/console/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b7e14468087ce59afcaf9cdc072aa16fddf72ed
|
4
|
+
data.tar.gz: 33c1e0d1698aafd57567e8a3a78e8024815179bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bd4929b548ac43217422ff403aeb22f28214a91c53068465ce26645e9f47e646c8933b0367dee6d8a6cb1acbace1091e845d534492849941107a4696f9ed75a
|
7
|
+
data.tar.gz: 23c0b145926ef76fcf6855fee09fc2c0c50cbfe0a093f9d234d67f0613658523baed4bc0c3c6f3228ab3188b57ea408e28864eadc2583386e7c99cad703a68d2
|
data/Gemfile.lock
CHANGED
data/lib/hyper-console-client.js
CHANGED
@@ -48011,47 +48011,79 @@ if (ch == null) ch = nil;
|
|
48011
48011
|
|
48012
48012
|
/* Generated by Opal 0.10.3 */
|
48013
48013
|
Opal.modules["hyperloop/console/evaluate"] = function(Opal) {
|
48014
|
-
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2;
|
48014
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2;
|
48015
48015
|
|
48016
48016
|
Opal.add_stubs(['$param', '$dispatch_to']);
|
48017
|
-
(function($base
|
48018
|
-
|
48019
|
-
var self = $Evaluate = $klass($base, $super, 'Evaluate', $Evaluate);
|
48017
|
+
return (function($base) {
|
48018
|
+
var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop');
|
48020
48019
|
|
48021
|
-
var def = self.$$proto, $scope = self.$$scope
|
48020
|
+
var def = self.$$proto, $scope = self.$$scope;
|
48022
48021
|
|
48023
|
-
|
48022
|
+
(function($base) {
|
48023
|
+
var $Console, self = $Console = $module($base, 'Console');
|
48024
48024
|
|
48025
|
-
|
48025
|
+
var def = self.$$proto, $scope = self.$$scope;
|
48026
48026
|
|
48027
|
-
|
48027
|
+
(function($base, $super) {
|
48028
|
+
function $Evaluate(){};
|
48029
|
+
var self = $Evaluate = $klass($base, $super, 'Evaluate', $Evaluate);
|
48028
48030
|
|
48029
|
-
|
48031
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_1;
|
48030
48032
|
|
48031
|
-
|
48033
|
+
self.$param($hash2(["acting_user", "nils"], {"acting_user": nil, "nils": true}));
|
48032
48034
|
|
48033
|
-
|
48035
|
+
self.$param("target_id");
|
48034
48036
|
|
48035
|
-
|
48036
|
-
})($scope.base, (($scope.get('Hyperloop')).$$scope.get('ServerOp')));
|
48037
|
-
return (function($base, $super) {
|
48038
|
-
function $Response(){};
|
48039
|
-
var self = $Response = $klass($base, $super, 'Response', $Response);
|
48037
|
+
self.$param("sender_id");
|
48040
48038
|
|
48041
|
-
|
48039
|
+
self.$param("context");
|
48042
48040
|
|
48043
|
-
|
48041
|
+
self.$param($hash2(["string"], {"string": nil}));
|
48044
48042
|
|
48045
|
-
|
48043
|
+
return ($a = ($b = self).$dispatch_to, $a.$$p = (TMP_1 = function(){var self = TMP_1.$$s || this;
|
48046
48044
|
|
48047
|
-
|
48045
|
+
return (($scope.get('Hyperloop')).$$scope.get('Application'))}, TMP_1.$$s = self, TMP_1.$$arity = 0, TMP_1), $a).call($b);
|
48046
|
+
})($scope.base, (($scope.get('Hyperloop')).$$scope.get('ServerOp')));
|
48048
48047
|
|
48049
|
-
|
48048
|
+
(function($base, $super) {
|
48049
|
+
function $Response(){};
|
48050
|
+
var self = $Response = $klass($base, $super, 'Response', $Response);
|
48051
|
+
|
48052
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_2;
|
48053
|
+
|
48054
|
+
self.$param($hash2(["acting_user", "nils"], {"acting_user": nil, "nils": true}));
|
48055
|
+
|
48056
|
+
self.$param("target_id");
|
48057
|
+
|
48058
|
+
self.$param("kind");
|
48050
48059
|
|
48051
|
-
|
48060
|
+
self.$param("message");
|
48052
48061
|
|
48053
|
-
|
48054
|
-
|
48062
|
+
return ($a = ($b = self).$dispatch_to, $a.$$p = (TMP_2 = function(){var self = TMP_2.$$s || this;
|
48063
|
+
|
48064
|
+
return (($scope.get('Hyperloop')).$$scope.get('Application'))}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2), $a).call($b);
|
48065
|
+
})($scope.base, (($scope.get('Hyperloop')).$$scope.get('ServerOp')));
|
48066
|
+
})($scope.base)
|
48067
|
+
})($scope.base)
|
48068
|
+
};
|
48069
|
+
|
48070
|
+
/* Generated by Opal 0.10.3 */
|
48071
|
+
Opal.modules["hyperloop/console/version"] = function(Opal) {
|
48072
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module;
|
48073
|
+
|
48074
|
+
return (function($base) {
|
48075
|
+
var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop');
|
48076
|
+
|
48077
|
+
var def = self.$$proto, $scope = self.$$scope;
|
48078
|
+
|
48079
|
+
(function($base) {
|
48080
|
+
var $Console, self = $Console = $module($base, 'Console');
|
48081
|
+
|
48082
|
+
var def = self.$$proto, $scope = self.$$scope;
|
48083
|
+
|
48084
|
+
Opal.cdecl($scope, 'VERSION', "0.1.2")
|
48085
|
+
})($scope.base)
|
48086
|
+
})($scope.base)
|
48055
48087
|
};
|
48056
48088
|
|
48057
48089
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
@@ -89725,340 +89757,356 @@ Opal.modules["hyperloop/console/client_components"] = function(Opal) {
|
|
89725
89757
|
function $rb_lt(lhs, rhs) {
|
89726
89758
|
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
|
89727
89759
|
}
|
89728
|
-
var
|
89760
|
+
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $range = Opal.range, $hash = Opal.hash;
|
89729
89761
|
|
89730
89762
|
Opal.add_stubs(['$param', '$state', '$attr_accessor', '$tap', '$uuid', '$error_message', '$mutate', '$=~', '$evaluate', '$[]', '$<<', '$history', '$console_state', '$run', '$application_window_id', '$console_id', '$context', '$after_mount', '$application_window_id=', '$params', '$context=', '$parse', '$title', '$on_dispatch', '$==', '$target_id', '$kind', '$message', '$to_json', '$after_update', '$render', '$on', '$set_focus', '$prevent_default', '$DIV', '$each', '$CodeHistoryItem', '$first', '$last', '$CodeEditor', '$attr_reader', '$dom_node', '$to_s', '$!', '$item_type', '$===', '$value', '$format_lines', '$gsub', '$split', '$join', '$+', '$shift', '$collect', '$include?', '$length', '$-', '$count', '$before_mount', '$format', '$mark_response_lines', '$stop_propagation', '$editor', '$set_focus_at_end', '$compact', '$lambda', '$on_change', '$on_key_down', '$editor=', '$class', '$before_unmount', '$[]=', '$after', '$>', '$move_history', '$<', '$parse_error', '$to_n', '$clear_error', '$empty?', '$compile', '$ready!', '$mark_error', '$ready?', '$DebugConsole', '$attr']);
|
89731
|
-
(function($base
|
89732
|
-
|
89733
|
-
|
89763
|
+
return (function($base) {
|
89764
|
+
var $Hyperloop, self = $Hyperloop = $module($base, 'Hyperloop');
|
89765
|
+
|
89766
|
+
var def = self.$$proto, $scope = self.$$scope;
|
89767
|
+
|
89768
|
+
(function($base) {
|
89769
|
+
var $Console, self = $Console = $module($base, 'Console');
|
89734
89770
|
|
89735
|
-
|
89771
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_40;
|
89736
89772
|
|
89737
|
-
|
89773
|
+
(function($base, $super) {
|
89774
|
+
function $DebugConsole(){};
|
89775
|
+
var self = $DebugConsole = $klass($base, $super, 'DebugConsole', $DebugConsole);
|
89738
89776
|
|
89739
|
-
|
89777
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_5, $c, TMP_7, $d, TMP_8;
|
89740
89778
|
|
89741
|
-
|
89779
|
+
self.$param("application_window_id");
|
89742
89780
|
|
89743
|
-
|
89781
|
+
self.$param("context");
|
89744
89782
|
|
89745
|
-
|
89783
|
+
self.$param("title");
|
89746
89784
|
|
89747
|
-
|
89748
|
-
var $scope = self.$$scope, def = self.$$proto, TMP_2, TMP_3, TMP_4;
|
89785
|
+
self.$state($hash2(["history", "scope"], {"history": [], "scope": "shared"}));
|
89749
89786
|
|
89750
|
-
|
89751
|
-
|
89752
|
-
|
89753
|
-
|
89754
|
-
if (self.console_id == null) self.console_id = nil;
|
89787
|
+
self.$state($hash2(["console_state", "scope"], {"console_state": "waiting_for_code", "scope": "shared"}));
|
89788
|
+
|
89789
|
+
(function(self) {
|
89790
|
+
var $scope = self.$$scope, def = self.$$proto, TMP_2, TMP_3, TMP_4;
|
89755
89791
|
|
89756
|
-
|
89792
|
+
self.$attr_accessor("application_window_id");
|
89793
|
+
self.$attr_accessor("context");
|
89794
|
+
Opal.defn(self, '$console_id', TMP_2 = function $$console_id() {
|
89795
|
+
var $a, $b, $c, $d, TMP_1, self = this;
|
89796
|
+
if (self.console_id == null) self.console_id = nil;
|
89797
|
+
|
89798
|
+
return ((($a = self.console_id) !== false && $a !== nil && $a != null) ? $a : self.console_id = (((($b = sessionStorage.getItem('Hyperloop::Console::ConsoleId')) !== false && $b !== nil && $b != null) ? $b : ($c = ($d = $scope.get('SecureRandom').$uuid()).$tap, $c.$$p = (TMP_1 = function(id){var self = TMP_1.$$s || this;
|
89757
89799
|
if (id == null) id = nil;
|
89758
|
-
|
89759
|
-
|
89760
|
-
|
89761
|
-
|
89762
|
-
|
89800
|
+
return sessionStorage.setItem('Hyperloop::Console::ConsoleId', id);}, TMP_1.$$s = self, TMP_1.$$arity = 1, TMP_1), $c).call($d))));
|
89801
|
+
}, TMP_2.$$arity = 0);
|
89802
|
+
Opal.defn(self, '$ready!', TMP_3 = function(code, compiled_code) {
|
89803
|
+
var $a, self = this;
|
89804
|
+
if (self.code_to_send == null) self.code_to_send = nil;
|
89763
89805
|
|
89764
|
-
|
89765
|
-
|
89766
|
-
|
89767
|
-
|
89768
|
-
|
89769
|
-
|
89770
|
-
|
89771
|
-
|
89772
|
-
|
89773
|
-
|
89774
|
-
|
89806
|
+
self.code_to_send = code;
|
89807
|
+
self.$mutate().$error_message(nil);
|
89808
|
+
if ((($a = self.code_to_send['$=~'](/.\n$/)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
89809
|
+
return self.$evaluate(compiled_code)
|
89810
|
+
} else {
|
89811
|
+
return nil
|
89812
|
+
};
|
89813
|
+
}, TMP_3.$$arity = 2);
|
89814
|
+
return (Opal.defn(self, '$evaluate', TMP_4 = function $$evaluate(compiled_code) {
|
89815
|
+
var self = this;
|
89816
|
+
if (self.code_to_send == null) self.code_to_send = nil;
|
89775
89817
|
|
89776
|
-
|
89777
|
-
|
89778
|
-
|
89779
|
-
|
89780
|
-
|
89781
|
-
|
89818
|
+
self.code_to_send = self.code_to_send['$[]']($range(0, -2, false));
|
89819
|
+
self.$mutate().$history()['$<<']($hash2(["eval"], {"eval": self.code_to_send}));
|
89820
|
+
self.$mutate().$console_state("sending");
|
89821
|
+
return $scope.get('Evaluate').$run($hash2(["target_id", "sender_id", "context", "string"], {"target_id": self.$application_window_id(), "sender_id": self.$console_id(), "context": self.$context(), "string": compiled_code}));
|
89822
|
+
}, TMP_4.$$arity = 1), nil) && 'evaluate';
|
89823
|
+
})(Opal.get_singleton_class(self));
|
89782
89824
|
|
89783
|
-
|
89825
|
+
($a = ($b = self).$after_mount, $a.$$p = (TMP_5 = function(){var self = TMP_5.$$s || this, $c, $d, TMP_6;
|
89784
89826
|
|
89785
|
-
|
89786
|
-
|
89787
|
-
|
89788
|
-
|
89789
|
-
|
89790
|
-
|
89827
|
+
(($c = [self.$params().$application_window_id()]), $d = $scope.get('DebugConsole'), $d['$application_window_id='].apply($d, $c), $c[$c.length-1]);
|
89828
|
+
(($c = [self.$params().$context()]), $d = $scope.get('DebugConsole'), $d['$context='].apply($d, $c), $c[$c.length-1]);
|
89829
|
+
self.$mutate().$history($scope.get('JSON').$parse(((($c = sessionStorage.getItem('Hyperloop::Console.history')) !== false && $c !== nil && $c != null) ? $c : "[]")));
|
89830
|
+
document.title = self.$params().$title();
|
89831
|
+
window.scrollTo(window.scrollX, 99999);
|
89832
|
+
return ($c = ($d = $scope.get('Response')).$on_dispatch, $c.$$p = (TMP_6 = function(p){var self = TMP_6.$$s || this;
|
89791
89833
|
if (p == null) p = nil;
|
89792
|
-
|
89793
|
-
|
89794
|
-
|
89795
|
-
|
89796
|
-
|
89797
|
-
|
89798
|
-
|
89834
|
+
if (p.$target_id()['$==']($scope.get('DebugConsole').$console_id())) {
|
89835
|
+
} else {
|
89836
|
+
return nil;
|
89837
|
+
};
|
89838
|
+
self.$mutate().$console_state("waiting_for_code");
|
89839
|
+
self.$mutate().$history()['$<<']($hash(p.$kind(), p.$message()));
|
89840
|
+
return sessionStorage.setItem('Hyperloop::Console.history', self.$state().$history().$to_json());}, TMP_6.$$s = self, TMP_6.$$arity = 1, TMP_6), $c).call($d);}, TMP_5.$$s = self, TMP_5.$$arity = 0, TMP_5), $a).call($b);
|
89799
89841
|
|
89800
|
-
|
89842
|
+
($a = ($c = self).$after_update, $a.$$p = (TMP_7 = function(){var self = TMP_7.$$s || this;
|
89801
89843
|
|
89802
|
-
|
89844
|
+
return window.scrollTo(window.scrollX, 99999);}, TMP_7.$$s = self, TMP_7.$$arity = 0, TMP_7), $a).call($c);
|
89803
89845
|
|
89804
|
-
|
89846
|
+
return ($a = ($d = self).$render, $a.$$p = (TMP_8 = function(){var self = TMP_8.$$s || this, $e, $f, TMP_9, $g, $h, TMP_10;
|
89805
89847
|
|
89806
|
-
|
89848
|
+
return ($e = ($f = ($g = ($h = self).$DIV, $g.$$p = (TMP_10 = function(){var self = TMP_10.$$s || this, $i, $j, TMP_11;
|
89807
89849
|
|
89808
|
-
|
89850
|
+
($i = ($j = self.$state().$history()).$each, $i.$$p = (TMP_11 = function(item){var self = TMP_11.$$s || this, $k;
|
89809
89851
|
if (item == null) item = nil;
|
89810
|
-
|
89811
|
-
|
89812
|
-
|
89813
|
-
|
89814
|
-
|
89815
|
-
|
89852
|
+
return self.$CodeHistoryItem($hash2(["item_type", "value"], {"item_type": item.$first().$first(), "value": ((($k = item.$first().$last()) !== false && $k !== nil && $k != null) ? $k : "")}))}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11), $i).call($j);
|
89853
|
+
if (self.$state().$console_state()['$==']("sending")) {
|
89854
|
+
return nil
|
89855
|
+
} else {
|
89856
|
+
return self.$CodeEditor($hash2(["history", "context"], {"history": self.$state().$history(), "context": self.$params().$context()}))
|
89857
|
+
};}, TMP_10.$$s = self, TMP_10.$$arity = 0, TMP_10), $g).call($h, $hash2(["class"], {"class": "card"}))).$on, $e.$$p = (TMP_9 = function(e){var self = TMP_9.$$s || this;
|
89816
89858
|
if (e == null) e = nil;
|
89817
|
-
|
89818
|
-
|
89819
|
-
|
89820
|
-
(function($base, $super) {
|
89821
|
-
function $CodeMirror(){};
|
89822
|
-
var self = $CodeMirror = $klass($base, $super, 'CodeMirror', $CodeMirror);
|
89859
|
+
$scope.get('CodeEditor').$set_focus();
|
89860
|
+
return e.$prevent_default();}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9), $e).call($f, "mouse_down")}, TMP_8.$$s = self, TMP_8.$$arity = 0, TMP_8), $a).call($d, $scope.get('DIV'), $hash2(["style"], {"style": $hash2(["height"], {"height": "100vh"})}));
|
89861
|
+
})($scope.base, (($scope.get('Hyperloop')).$$scope.get('Component')));
|
89823
89862
|
|
89824
|
-
|
89863
|
+
(function($base, $super) {
|
89864
|
+
function $CodeMirror(){};
|
89865
|
+
var self = $CodeMirror = $klass($base, $super, 'CodeMirror', $CodeMirror);
|
89825
89866
|
|
89826
|
-
|
89867
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_12;
|
89827
89868
|
|
89828
|
-
|
89829
|
-
if (self.code == null) self.code = nil;
|
89830
|
-
if (self.read_only == null) self.read_only = nil;
|
89869
|
+
self.$attr_reader("editor");
|
89831
89870
|
|
89832
|
-
|
89833
|
-
|
89834
|
-
|
89835
|
-
matchBrackets: true,
|
89836
|
-
lineNumbers: false,
|
89837
|
-
indentUnit: 2,
|
89838
|
-
theme: 'github',
|
89839
|
-
readOnly: self.read_only['$!']()['$!']()
|
89840
|
-
});}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12), $a).call($b);
|
89871
|
+
($a = ($b = self).$after_mount, $a.$$p = (TMP_12 = function(){var self = TMP_12.$$s || this;
|
89872
|
+
if (self.code == null) self.code = nil;
|
89873
|
+
if (self.read_only == null) self.read_only = nil;
|
89841
89874
|
|
89842
|
-
|
89843
|
-
|
89844
|
-
|
89845
|
-
|
89846
|
-
|
89875
|
+
return self.editor = CodeMirror(self.$dom_node(), {
|
89876
|
+
value: self.code.$to_s(),
|
89877
|
+
mode: 'text/x-ruby',
|
89878
|
+
matchBrackets: true,
|
89879
|
+
lineNumbers: false,
|
89880
|
+
indentUnit: 2,
|
89881
|
+
theme: 'github',
|
89882
|
+
readOnly: self.read_only['$!']()['$!']()
|
89883
|
+
});}, TMP_12.$$s = self, TMP_12.$$arity = 0, TMP_12), $a).call($b);
|
89847
89884
|
|
89848
|
-
|
89885
|
+
return self.$render($scope.get('DIV'));
|
89886
|
+
})($scope.base, (($scope.get('Hyperloop')).$$scope.get('Component')));
|
89849
89887
|
|
89850
|
-
|
89851
|
-
|
89888
|
+
(function($base, $super) {
|
89889
|
+
function $CodeHistoryItem(){};
|
89890
|
+
var self = $CodeHistoryItem = $klass($base, $super, 'CodeHistoryItem', $CodeHistoryItem);
|
89852
89891
|
|
89853
|
-
|
89892
|
+
var def = self.$$proto, $scope = self.$$scope, TMP_13, TMP_15, TMP_16, $a, $b, TMP_17, $c, TMP_18, $d, TMP_19;
|
89854
89893
|
|
89855
|
-
|
89856
|
-
|
89894
|
+
def.editor = nil;
|
89895
|
+
self.$param("item_type");
|
89857
89896
|
|
89858
|
-
|
89859
|
-
}, TMP_13.$$arity = 0);
|
89897
|
+
self.$param("value");
|
89860
89898
|
|
89861
|
-
|
89862
|
-
|
89899
|
+
Opal.defn(self, '$format', TMP_13 = function $$format() {
|
89900
|
+
var self = this, $case = nil;
|
89901
|
+
|
89902
|
+
return (function() {$case = self.$params().$item_type();if ("eval"['$===']($case)) {return self.$params().$value()}else if ("exception"['$===']($case)) {return self.$format_lines("!!", self.$params().$value())}else if ("result"['$===']($case)) {return self.$format_lines(">>", self.$params().$value())}else {return self.$format_lines("" + (self.$params().$item_type()) + ":", self.$params().$value())}})();
|
89903
|
+
}, TMP_13.$$arity = 0);
|
89863
89904
|
|
89864
|
-
|
89865
|
-
|
89866
|
-
|
89905
|
+
Opal.defn(self, '$format_lines', TMP_15 = function $$format_lines(prefix, value) {
|
89906
|
+
var $a, $b, TMP_14, self = this, fill = nil, lines = nil;
|
89907
|
+
|
89908
|
+
fill = prefix.$gsub(/./, " ");
|
89909
|
+
lines = value.$split("\n");
|
89910
|
+
return ($rb_plus(["" + (prefix) + " " + (lines.$shift())], ($a = ($b = lines).$collect, $a.$$p = (TMP_14 = function(line){var self = TMP_14.$$s || this;
|
89867
89911
|
if (line == null) line = nil;
|
89868
|
-
|
89869
|
-
|
89912
|
+
return "" + (fill) + " " + (line)}, TMP_14.$$s = self, TMP_14.$$arity = 1, TMP_14), $a).call($b))).$join("\n");
|
89913
|
+
}, TMP_15.$$arity = 2);
|
89870
89914
|
|
89871
|
-
|
89872
|
-
|
89915
|
+
Opal.defn(self, '$mark_response_lines', TMP_16 = function $$mark_response_lines() {
|
89916
|
+
var $a, self = this, lines = nil, padding = nil, last_line = nil;
|
89873
89917
|
|
89874
|
-
|
89875
|
-
|
89876
|
-
|
89877
|
-
|
89878
|
-
|
89879
|
-
|
89880
|
-
|
89881
|
-
|
89882
|
-
|
89883
|
-
|
89884
|
-
|
89918
|
+
if (self.$params().$item_type()['$==']("eval")) {
|
89919
|
+
return nil};
|
89920
|
+
lines = self.$params().$value().$split("\n");
|
89921
|
+
padding = (function() {if ((($a = ["exception", "result"]['$include?'](self.$params().$item_type())) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
89922
|
+
return 3
|
89923
|
+
} else {
|
89924
|
+
return $rb_plus(2, self.$params().$item_type().$to_s().$length())
|
89925
|
+
}; return nil; })();
|
89926
|
+
last_line = ((($a = lines['$[]'](-1)) !== false && $a !== nil && $a != null) ? $a : "");
|
89927
|
+
return self.editor.markText({line: 0, ch: 0}, {line: $rb_minus(lines.$count(), 1), ch: $rb_plus(last_line.$length(), padding)}, {className: 'response-line'});
|
89928
|
+
}, TMP_16.$$arity = 0);
|
89885
89929
|
|
89886
|
-
|
89930
|
+
($a = ($b = self).$before_mount, $a.$$p = (TMP_17 = function(){var self = TMP_17.$$s || this;
|
89887
89931
|
|
89888
|
-
|
89889
|
-
|
89932
|
+
self.code = self.$format();
|
89933
|
+
return self.read_only = true;}, TMP_17.$$s = self, TMP_17.$$arity = 0, TMP_17), $a).call($b);
|
89890
89934
|
|
89891
|
-
|
89935
|
+
($a = ($c = self).$after_mount, $a.$$p = (TMP_18 = function(){var self = TMP_18.$$s || this;
|
89892
89936
|
|
89893
|
-
|
89937
|
+
return self.$mark_response_lines()}, TMP_18.$$s = self, TMP_18.$$arity = 0, TMP_18), $a).call($c);
|
89894
89938
|
|
89895
|
-
|
89939
|
+
return ($a = ($d = self).$render, $a.$$p = (TMP_19 = function(){var self = TMP_19.$$s || this, $e, $f, TMP_20, $g, $h, TMP_21;
|
89896
89940
|
|
89897
|
-
|
89941
|
+
return ($e = ($f = ($g = ($h = self).$DIV, $g.$$p = (TMP_21 = function(){var self = TMP_21.$$s || this;
|
89898
89942
|
|
89899
|
-
|
89943
|
+
return nil}, TMP_21.$$s = self, TMP_21.$$arity = 0, TMP_21), $g).call($h)).$on, $e.$$p = (TMP_20 = function(e){var self = TMP_20.$$s || this;
|
89900
89944
|
if (e == null) e = nil;
|
89901
|
-
|
89902
|
-
|
89903
|
-
(function($base, $super) {
|
89904
|
-
function $CodeEditor(){};
|
89905
|
-
var self = $CodeEditor = $klass($base, $super, 'CodeEditor', $CodeEditor);
|
89945
|
+
return e.$stop_propagation()}, TMP_20.$$s = self, TMP_20.$$arity = 1, TMP_20), $e).call($f, "mouse_down")}, TMP_19.$$s = self, TMP_19.$$arity = 0, TMP_19), $a).call($d);
|
89946
|
+
})($scope.base, $scope.get('CodeMirror'));
|
89906
89947
|
|
89907
|
-
|
89948
|
+
(function($base, $super) {
|
89949
|
+
function $CodeEditor(){};
|
89950
|
+
var self = $CodeEditor = $klass($base, $super, 'CodeEditor', $CodeEditor);
|
89908
89951
|
|
89909
|
-
|
89910
|
-
self.$param("history");
|
89952
|
+
var def = self.$$proto, $scope = self.$$scope, $a, $b, TMP_23, $c, TMP_25, $d, TMP_28, TMP_30, TMP_31, TMP_32, TMP_33, TMP_34, TMP_35, TMP_36, $e, TMP_37;
|
89911
89953
|
|
89912
|
-
|
89954
|
+
def.history = def.history_pos = def.editor = def.error = nil;
|
89955
|
+
self.$param("history");
|
89913
89956
|
|
89914
|
-
|
89915
|
-
var $scope = self.$$scope, def = self.$$proto, TMP_22;
|
89957
|
+
self.$param("context");
|
89916
89958
|
|
89917
|
-
|
89918
|
-
|
89919
|
-
var $a, self = this;
|
89959
|
+
(function(self) {
|
89960
|
+
var $scope = self.$$scope, def = self.$$proto, TMP_22;
|
89920
89961
|
|
89921
|
-
|
89922
|
-
return self
|
89923
|
-
|
89924
|
-
return nil
|
89925
|
-
};
|
89926
|
-
}, TMP_22.$$arity = 0), nil) && 'set_focus';
|
89927
|
-
})(Opal.get_singleton_class(self));
|
89962
|
+
self.$attr_accessor("editor");
|
89963
|
+
return (Opal.defn(self, '$set_focus', TMP_22 = function $$set_focus() {
|
89964
|
+
var $a, self = this;
|
89928
89965
|
|
89929
|
-
|
89930
|
-
|
89966
|
+
if ((($a = self.$editor()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
89967
|
+
return self.$editor().$set_focus_at_end()
|
89968
|
+
} else {
|
89969
|
+
return nil
|
89970
|
+
};
|
89971
|
+
}, TMP_22.$$arity = 0), nil) && 'set_focus';
|
89972
|
+
})(Opal.get_singleton_class(self));
|
89973
|
+
|
89974
|
+
($a = ($b = self).$before_mount, $a.$$p = (TMP_23 = function(){var self = TMP_23.$$s || this, $c, $d, TMP_24;
|
89975
|
+
if (self.history == null) self.history = nil;
|
89931
89976
|
|
89932
|
-
|
89977
|
+
self.history = $rb_plus(($c = ($d = self.$params().$history()).$collect, $c.$$p = (TMP_24 = function(item){var self = TMP_24.$$s || this;
|
89933
89978
|
if (item == null) item = nil;
|
89934
|
-
|
89935
|
-
|
89979
|
+
return item['$[]']("eval")}, TMP_24.$$s = self, TMP_24.$$arity = 1, TMP_24), $c).call($d).$compact(), [""]);
|
89980
|
+
return self.history_pos = $rb_minus(self.history.$length(), 1);}, TMP_23.$$s = self, TMP_23.$$arity = 0, TMP_23), $a).call($b);
|
89936
89981
|
|
89937
|
-
|
89938
|
-
|
89982
|
+
($a = ($c = self).$after_mount, $a.$$p = (TMP_25 = function(){var self = TMP_25.$$s || this, $d, $e, TMP_26, $f, TMP_27, $g;
|
89983
|
+
if (self.editor == null) self.editor = nil;
|
89939
89984
|
|
89940
|
-
|
89985
|
+
self.editor.on('change', ($d = ($e = self).$lambda, $d.$$p = (TMP_26 = function(){var self = TMP_26.$$s || this;
|
89941
89986
|
|
89942
|
-
|
89943
|
-
|
89987
|
+
return self.$on_change()}, TMP_26.$$s = self, TMP_26.$$arity = 0, TMP_26), $d).call($e));
|
89988
|
+
self.editor.on('keydown', ($d = ($f = self).$lambda, $d.$$p = (TMP_27 = function(cm, e){var self = TMP_27.$$s || this;
|
89944
89989
|
if (cm == null) cm = nil;if (e == null) e = nil;
|
89945
|
-
|
89946
|
-
|
89947
|
-
|
89990
|
+
return self.$on_key_down(cm, e)}, TMP_27.$$s = self, TMP_27.$$arity = 2, TMP_27), $d).call($f));
|
89991
|
+
self.editor.focus();
|
89992
|
+
return (($d = [self]), $g = self.$class(), $g['$editor='].apply($g, $d), $d[$d.length-1]);}, TMP_25.$$s = self, TMP_25.$$arity = 0, TMP_25), $a).call($c);
|
89948
89993
|
|
89949
|
-
|
89994
|
+
($a = ($d = self).$before_unmount, $a.$$p = (TMP_28 = function(){var self = TMP_28.$$s || this, $e, $f;
|
89950
89995
|
|
89951
|
-
|
89996
|
+
return (($e = [nil]), $f = self.$class(), $f['$editor='].apply($f, $e), $e[$e.length-1])}, TMP_28.$$s = self, TMP_28.$$arity = 0, TMP_28), $a).call($d);
|
89952
89997
|
|
89953
|
-
|
89954
|
-
|
89998
|
+
Opal.defn(self, '$move_history', TMP_30 = function $$move_history(n) {
|
89999
|
+
var $a, $b, TMP_29, self = this, text = nil, lines = nil;
|
89955
90000
|
|
89956
|
-
|
89957
|
-
|
89958
|
-
|
89959
|
-
|
89960
|
-
|
89961
|
-
|
89962
|
-
|
90001
|
+
self.history['$[]='](self.history_pos, self.editor.getValue());
|
90002
|
+
self.history_pos = $rb_plus(self.history_pos, n);
|
90003
|
+
text = self.history['$[]'](self.history_pos);
|
90004
|
+
lines = text.$split("\n");
|
90005
|
+
self.editor.setValue(text);
|
90006
|
+
return ($a = ($b = self).$after, $a.$$p = (TMP_29 = function(){var self = TMP_29.$$s || this, $c;
|
90007
|
+
if (self.editor == null) self.editor = nil;
|
89963
90008
|
|
89964
|
-
|
89965
|
-
|
89966
|
-
|
90009
|
+
window.scrollTo(window.scrollX, 99999);
|
90010
|
+
return self.editor.setCursor({line: lines.$count(), ch: (((($c = lines.$last()) !== false && $c !== nil && $c != null) ? $c : "")).$length()});}, TMP_29.$$s = self, TMP_29.$$arity = 0, TMP_29), $a).call($b, 0);
|
90011
|
+
}, TMP_30.$$arity = 1);
|
89967
90012
|
|
89968
|
-
|
89969
|
-
|
90013
|
+
Opal.defn(self, '$set_focus_at_end', TMP_31 = function $$set_focus_at_end() {
|
90014
|
+
var $a, self = this, lines = nil;
|
89970
90015
|
|
89971
|
-
|
89972
|
-
|
89973
|
-
|
89974
|
-
|
90016
|
+
self.editor.focus();
|
90017
|
+
lines = (self.editor.getValue()).$split("\n");
|
90018
|
+
return self.editor.setCursor({line: lines.$count(), ch: (((($a = lines.$last()) !== false && $a !== nil && $a != null) ? $a : "")).$length()});
|
90019
|
+
}, TMP_31.$$arity = 0);
|
89975
90020
|
|
89976
|
-
|
89977
|
-
|
90021
|
+
Opal.defn(self, '$on_key_down', TMP_32 = function $$on_key_down(cm, e) {
|
90022
|
+
var $a, $b, self = this;
|
89978
90023
|
|
89979
|
-
|
89980
|
-
|
89981
|
-
|
89982
|
-
|
89983
|
-
|
89984
|
-
|
89985
|
-
|
89986
|
-
|
89987
|
-
|
89988
|
-
|
89989
|
-
|
89990
|
-
|
89991
|
-
|
89992
|
-
|
89993
|
-
|
89994
|
-
|
89995
|
-
|
89996
|
-
|
89997
|
-
|
89998
|
-
|
89999
|
-
|
90000
|
-
|
90024
|
+
if ((($a = ((($b = e.metaKey) !== false && $b !== nil && $b != null) ? $b : e.ctrlKey)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
90025
|
+
if ((e.keyCode)['$=='](13)) {
|
90026
|
+
} else {
|
90027
|
+
return nil
|
90028
|
+
};
|
90029
|
+
return self.editor.setValue(self.editor.getValue()+"\n");
|
90030
|
+
} else if ((e.key)['$==']("ArrowUp")) {
|
90031
|
+
if ((($a = $rb_gt(self.history_pos, 0)) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
90032
|
+
return self.$move_history(-1)
|
90033
|
+
} else {
|
90034
|
+
return nil
|
90035
|
+
}
|
90036
|
+
} else if ((e.key)['$==']("ArrowDown")) {
|
90037
|
+
if ((($a = $rb_lt(self.history_pos, $rb_minus(self.history.$length(), 1))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
90038
|
+
return self.$move_history(1)
|
90039
|
+
} else {
|
90040
|
+
return nil
|
90041
|
+
}
|
90042
|
+
} else {
|
90043
|
+
return nil
|
90044
|
+
};
|
90045
|
+
}, TMP_32.$$arity = 2);
|
90001
90046
|
|
90002
|
-
|
90003
|
-
|
90047
|
+
Opal.defn(self, '$mark_error', TMP_33 = function $$mark_error(message) {
|
90048
|
+
var $a, $b, self = this, from = nil, to = nil, title = nil;
|
90004
90049
|
|
90005
|
-
|
90006
|
-
|
90007
|
-
|
90050
|
+
$b = self.$parse_error(message), $a = Opal.to_ary($b), from = ($a[0] == null ? nil : $a[0]), to = ($a[1] == null ? nil : $a[1]), title = ($a[2] == null ? nil : $a[2]), $b;
|
90051
|
+
return self.error = self.editor.markText(from.$to_n(), to.$to_n(), {className: 'syntax-error', title: title});
|
90052
|
+
}, TMP_33.$$arity = 1);
|
90008
90053
|
|
90009
|
-
|
90010
|
-
|
90054
|
+
Opal.defn(self, '$parse_error', TMP_34 = function $$parse_error(message) {
|
90055
|
+
var self = this, position_info = nil, last_line_number = nil, last_line = nil;
|
90011
90056
|
|
90012
|
-
|
90013
|
-
|
90014
|
-
|
90015
|
-
|
90016
|
-
|
90017
|
-
|
90057
|
+
message = message.$split("\n");
|
90058
|
+
position_info = message['$[]'](3).$split(":");
|
90059
|
+
last_line_number = self.editor.lineCount();
|
90060
|
+
last_line = self.editor.getLine(last_line_number-1);
|
90061
|
+
return [$hash2(["line", "ch"], {"line": 0, "ch": 0}), $hash2(["line", "ch"], {"line": last_line_number, "ch": last_line.$length()}), message['$[]'](2).$split(":(file)")['$[]'](0)];
|
90062
|
+
}, TMP_34.$$arity = 1);
|
90018
90063
|
|
90019
|
-
|
90020
|
-
|
90064
|
+
Opal.defn(self, '$clear_error', TMP_35 = function $$clear_error() {
|
90065
|
+
var $a, self = this;
|
90021
90066
|
|
90022
|
-
|
90023
|
-
|
90024
|
-
|
90025
|
-
|
90067
|
+
if ((($a = self.error) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
90068
|
+
self.error.clear();};
|
90069
|
+
return self.error = nil;
|
90070
|
+
}, TMP_35.$$arity = 0);
|
90026
90071
|
|
90027
|
-
|
90028
|
-
|
90072
|
+
Opal.defn(self, '$on_change', TMP_36 = function $$on_change() {
|
90073
|
+
var $a, self = this, code = nil, compiled_code = nil, e = nil;
|
90029
90074
|
|
90030
|
-
try {
|
90031
|
-
self.$clear_error();
|
90032
|
-
code = self.editor.getValue();
|
90033
|
-
if ((($a = self.$params().$context()['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
90034
|
-
compiled_code = $scope.get('Opal').$compile(code, $hash2(["irb"], {"irb": true}))
|
90035
|
-
} else {
|
90036
|
-
compiled_code = $scope.get('Opal').$compile("" + (self.$params().$context()) + ".instance_eval {" + (code) + "}")
|
90037
|
-
};
|
90038
|
-
return $scope.get('DebugConsole')['$ready!'](code, compiled_code);
|
90039
|
-
} catch ($err) {
|
90040
|
-
if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err;
|
90041
90075
|
try {
|
90042
|
-
|
90043
|
-
|
90044
|
-
|
90045
|
-
|
90046
|
-
|
90076
|
+
self.$clear_error();
|
90077
|
+
code = self.editor.getValue();
|
90078
|
+
if ((($a = self.$params().$context()['$empty?']()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) {
|
90079
|
+
compiled_code = $scope.get('Opal').$compile(code, $hash2(["irb"], {"irb": true}))
|
90080
|
+
} else {
|
90081
|
+
compiled_code = $scope.get('Opal').$compile("" + (self.$params().$context()) + ".instance_eval {" + (code) + "}")
|
90082
|
+
};
|
90083
|
+
return $scope.get('DebugConsole')['$ready!'](code, compiled_code);
|
90084
|
+
} catch ($err) {
|
90085
|
+
if (Opal.rescue($err, [$scope.get('Exception')])) {e = $err;
|
90086
|
+
try {
|
90087
|
+
return self.$mark_error(e.$message())
|
90088
|
+
} finally { Opal.pop_exception() }
|
90089
|
+
} else { throw $err; }
|
90090
|
+
};
|
90091
|
+
}, TMP_36.$$arity = 0);
|
90047
90092
|
|
90048
|
-
|
90093
|
+
return ($a = ($e = self).$render, $a.$$p = (TMP_37 = function(){var self = TMP_37.$$s || this, $f, $g, TMP_38, $h, $i, TMP_39;
|
90049
90094
|
|
90050
|
-
|
90095
|
+
return ($f = ($g = ($h = ($i = self).$DIV, $h.$$p = (TMP_39 = function(){var self = TMP_39.$$s || this;
|
90051
90096
|
|
90052
|
-
|
90097
|
+
return nil}, TMP_39.$$s = self, TMP_39.$$arity = 0, TMP_39), $h).call($i)).$on, $f.$$p = (TMP_38 = function(e){var self = TMP_38.$$s || this;
|
90053
90098
|
if (e == null) e = nil;
|
90054
|
-
|
90055
|
-
|
90056
|
-
|
90099
|
+
return e.$stop_propagation()}, TMP_38.$$s = self, TMP_38.$$arity = 1, TMP_38), $f).call($g, "mouse_down")}, TMP_37.$$s = self, TMP_37.$$arity = 0, TMP_37), $a).call($e);
|
90100
|
+
})($scope.base, $scope.get('CodeMirror'));
|
90101
|
+
|
90102
|
+
($a = ($b = $scope.get('Document'))['$ready?'], $a.$$p = (TMP_40 = function(){var self = TMP_40.$$s || this, $c, $d, TMP_41, mount_point = nil;
|
90057
90103
|
|
90058
|
-
|
90059
|
-
|
90104
|
+
mount_point = $scope.get('Element')['$[]']("[data-react-class='React.TopLevelRailsComponent']");
|
90105
|
+
return ($c = ($d = mount_point).$render, $c.$$p = (TMP_41 = function(){var self = TMP_41.$$s || this;
|
90060
90106
|
|
90061
|
-
|
90107
|
+
return (($scope.get('Hyperloop')).$$scope.get('Console')).$DebugConsole($scope.get('JSON').$parse(mount_point.$attr("data-react-props"))['$[]']("render_params"))}, TMP_41.$$s = self, TMP_41.$$arity = 0, TMP_41), $c).call($d);}, TMP_40.$$s = self, TMP_40.$$arity = 0, TMP_40), $a).call($b);
|
90108
|
+
})($scope.base)
|
90109
|
+
})($scope.base)
|
90062
90110
|
};
|
90063
90111
|
|
90064
90112
|
/*!
|
@@ -90191,6 +90239,7 @@ Opal.loaded(["hyperloop/pusher"]);
|
|
90191
90239
|
self.$require("active_support");
|
90192
90240
|
self.$require("securerandom");
|
90193
90241
|
self.$require("hyperloop/console/evaluate");
|
90242
|
+
self.$require("hyperloop/console/version");
|
90194
90243
|
self.$require("hyperloop/console/sources/codemirror");
|
90195
90244
|
self.$require("hyperloop/console/sources/jquery-2.1.4");
|
90196
90245
|
self.$require("hyperloop/console/sources/react");
|