flammarion 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Readme.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Flammarion GUI Toolkit
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/flammarion.svg)](https://badge.fury.io/rb/flammarion)
4
+
3
5
  ## Overview
4
6
 
5
7
  Flammarion is an easy-to-use library for displaying information that you might
@@ -0,0 +1,9 @@
1
+ app = require 'app'
2
+ BrowserWindow = require('browser-window')
3
+ require('crash-reporter').start()
4
+ path = require('path')
5
+
6
+ app.on 'ready', ->
7
+ preload = path.resolve(path.join(__dirname, 'preload.js'))
8
+ main_window = new BrowserWindow({width:800, height: 600, "node-integration": false, "web-security":false, preload:preload})
9
+ main_window.loadUrl(process.argv[2])
data/electron/main.js ADDED
@@ -0,0 +1,26 @@
1
+ // Generated by CoffeeScript 1.9.0
2
+ (function() {
3
+ var BrowserWindow, app, path;
4
+
5
+ app = require('app');
6
+
7
+ BrowserWindow = require('browser-window');
8
+
9
+ require('crash-reporter').start();
10
+
11
+ path = require('path');
12
+
13
+ app.on('ready', function() {
14
+ var main_window, preload;
15
+ preload = path.resolve(path.join(__dirname, 'preload.js'));
16
+ main_window = new BrowserWindow({
17
+ width: 800,
18
+ height: 600,
19
+ "node-integration": false,
20
+ "web-security": false,
21
+ preload: preload
22
+ });
23
+ return main_window.loadUrl(process.argv[2]);
24
+ });
25
+
26
+ }).call(this);
@@ -0,0 +1,5 @@
1
+ {
2
+ "name" : "flammarion",
3
+ "version" : "0.1.0",
4
+ "main" : "main.js"
5
+ }
@@ -0,0 +1 @@
1
+ window.$remote = require('remote')
@@ -0,0 +1,5 @@
1
+ // Generated by CoffeeScript 1.9.0
2
+ (function() {
3
+ window.$remote = require('remote');
4
+
5
+ }).call(this);
data/lib/flammarion.rb CHANGED
@@ -1,21 +1,26 @@
1
- require 'monitor'
2
1
  require 'open3'
3
2
  require 'ostruct'
4
3
  require 'em-websocket'
5
4
  require 'json'
6
- require 'slim'
7
- require 'coffee-script'
8
- require 'sass'
9
5
  require 'colorize'
10
6
  require 'filewatcher'
11
7
  require 'rbconfig'
12
8
 
9
+ # Optional requires
10
+ require 'sass'
11
+ require 'slim'
12
+ require 'coffee-script'
13
+ require 'redcarpet'
14
+
13
15
  require_relative 'flammarion/writeable.rb'
14
16
  require_relative 'flammarion/pane.rb'
15
17
  require_relative 'flammarion/server.rb'
18
+ require_relative 'flammarion/version.rb'
19
+ require_relative 'flammarion/revelator.rb'
16
20
 
17
21
  module Flammarion
18
22
  class Engraving
23
+ include Revelator
19
24
  attr_reader :chrome
20
25
  attr_accessor :callbacks, :sockets, :on_disconnect, :on_connect, :actions
21
26
  include Writeable
@@ -25,15 +30,18 @@ module Flammarion
25
30
  @actions = {}
26
31
  @front_end = self
27
32
  @pane_name = "default"
33
+ @on_connect = options[:on_connect]
34
+ @ignore_old = options.fetch(:ignore_old, false)
35
+ @on_disconnect = options[:on_disconnect]
36
+ @exit_on_disconnect = options.fetch(:exit_on_disconnect, false)
37
+
28
38
  start_server
29
39
  @window_id = @@server.register_window(self)
30
40
  open_a_window unless options[:no_chrome]
31
41
  @callbacks = {}
32
- @exit_on_disconnect = options.fetch(:exit_on_disconnect, false)
33
42
  wait_for_a_connection unless options[:no_wait]
34
- @on_disconnect = options[:on_disconnect]
35
- @ignore_old = options.fetch(:ignore_old, false)
36
- @on_connect = options[:on_connect]
43
+
44
+ at_exit {close} if options.fetch(:close_on_exit, false)
37
45
  end
38
46
 
39
47
  def disconnect(ws)
@@ -76,39 +84,12 @@ module Flammarion
76
84
  @@server ||= Server.new
77
85
  end
78
86
 
87
+ def server; @@server; end;
88
+
79
89
  def wait_for_a_connection
80
90
  sleep 0.5 while @sockets.empty?
81
91
  end
82
92
 
83
- CHROME_PATH = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
84
- def open_a_window_on_windows
85
- file_path = File.absolute_path(File.dirname(__FILE__))
86
- file_path = `cygpath -w '#{file_path}'`.strip if RbConfig::CONFIG["host_os"] == "cygwin"
87
- resource = %[file\://#{file_path}/html/build/index.html]
88
- chrome_path = CHROME_PATH
89
- chrome_path = `cygpath -u '#{CHROME_PATH}'`.strip if RbConfig::CONFIG["host_os"] == "cygwin"
90
- spawn(chrome_path, %[--app=#{resource}?path=#{@window_id}&port=#{@@server.port}])
91
- end
92
-
93
- def open_a_window
94
- return open_a_window_on_windows if RbConfig::CONFIG["host_os"] =~ /cygwin|mswin|mingw/
95
- developmentMode = system("lsof -i:#{4567}", out: '/dev/null')
96
- host = "file://#{File.dirname(File.absolute_path(__FILE__))}/html/build/index.html"
97
- host = "http://localhost:4567/" if developmentMode
98
-
99
- # data_dir = Dir.mktmpdir("flammarion")
100
- # File.open("#{data_dir}/First\ Run", "w") {}
101
-
102
- @expect_title = "Flammarion-#{rand.to_s[2..-1]}"
103
-
104
- %w[google-chrome google-chrome-stable chromium chromium-browser chrome C:\Program\ Files\ (x86)\Google\Chrome\Application\chrome.exe].each do |executable|
105
- @chrome.in, @chrome.out, @chrome.err, @chrome.thread = Open3.popen3("#{executable} --app='#{host}?path=#{@window_id}&port=#{@@server.port}&title=#{@expect_title}'")
106
- break if @chrome.in
107
- end
108
-
109
- raise StandardError.new("Cannot launch any browser") unless @chrome.in
110
- end
111
-
112
93
  def window_open?
113
94
  not @sockets.empty?
114
95
  end
@@ -144,6 +125,10 @@ module Flammarion
144
125
  send_json({action:'layout', data:data})
145
126
  end
146
127
 
128
+ def close
129
+ send_json({action:'close'})
130
+ end
131
+
147
132
  def live_reload_layout(file)
148
133
  layout(file); yield if block_given?
149
134
  FileWatcher.new(file).watch {|file| layout(file); yield if block_given? }
@@ -0,0 +1,48 @@
1
+ module Flammarion
2
+ module Revelator
3
+ def which(cmd)
4
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
5
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
6
+ exts.each do |ext|
7
+ exe = File.join(path, "#{cmd}#{ext}")
8
+ return exe if File.executable?(exe) && !File.directory?(exe)
9
+ end
10
+ end
11
+ return nil
12
+ end
13
+
14
+ CHROME_PATH = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
15
+ def open_a_window_on_windows
16
+ file_path = File.absolute_path(File.join(File.dirname(__FILE__), ".."))
17
+ file_path = `cygpath -w '#{file_path}'`.strip if RbConfig::CONFIG["host_os"] == "cygwin"
18
+ resource = %[file\://#{file_path}/html/build/index.html]
19
+ chrome_path = CHROME_PATH
20
+ chrome_path = `cygpath -u '#{CHROME_PATH}'`.strip if RbConfig::CONFIG["host_os"] == "cygwin"
21
+ spawn(chrome_path, %[--app=#{resource}?path=#{@window_id}&port=#{server.port}])
22
+ end
23
+
24
+ def open_a_window
25
+ return open_a_window_on_windows if RbConfig::CONFIG["host_os"] =~ /cygwin|mswin|mingw/
26
+ developmentMode = system("lsof -i:#{4567}", out: '/dev/null')
27
+ host = "file://#{File.dirname(File.absolute_path(__FILE__))}/../html/build/index.html"
28
+ host = "http://localhost:4567/" if developmentMode
29
+
30
+ # data_dir = Dir.mktmpdir("flammarion")
31
+ # File.open("#{data_dir}/First\ Run", "w") {}
32
+
33
+ @expect_title = "Flammarion-#{rand.to_s[2..-1]}"
34
+
35
+ if which('electron') then
36
+ Process.detach(spawn("electron #{File.dirname(File.absolute_path(__FILE__))}/../../electron '#{host}?path=#{@window_id}&port=#{server.port}&title=#{@expect_title}'"))
37
+ return
38
+ end
39
+
40
+ %w[google-chrome google-chrome-stable chromium chromium-browser chrome C:\Program\ Files\ (x86)\Google\Chrome\Application\chrome.exe].each do |executable|
41
+ @chrome.in, @chrome.out, @chrome.err, @chrome.thread = Open3.popen3("#{executable} --app='#{host}?path=#{@window_id}&port=#{server.port}&title=#{@expect_title}'")
42
+ break if @chrome.in
43
+ end
44
+
45
+ raise StandardError.new("Cannot launch any browser") unless @chrome.in
46
+ end
47
+ end
48
+ end
@@ -19,6 +19,10 @@ module Flammarion
19
19
  end
20
20
  end
21
21
  sleep 0.5 while not @started
22
+
23
+ # This is a hack. For some reason, you need to wait a bit for everything
24
+ # to get written.
25
+ at_exit { sleep 0.1 }
22
26
  end
23
27
  def start_server_internal
24
28
  EM.run {
@@ -1,3 +1,3 @@
1
1
  module Flammarion
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -87,6 +87,12 @@ module Flammarion
87
87
  @front_end.callbacks[id] = block
88
88
  end
89
89
 
90
+ def embedded_button(label, options = {}, &block)
91
+ id = @front_end.make_id
92
+ @front_end.callbacks[id] = block
93
+ %|<a class="floating-button" href="#" onClick="$ws.send({id:'#{id}', action:'callback', source:'embedded_button'})">#{label}</a>|
94
+ end
95
+
90
96
  def input(label, options = {}, &block)
91
97
  id = @front_end.make_id
92
98
  send_json({action:'input', label:label, id:id}.merge(options))
@@ -120,9 +126,13 @@ module Flammarion
120
126
  send_json({action:'replace', text:data, raw:true})
121
127
  end
122
128
 
123
- def script(coffee)
124
- data = CoffeeScript.compile(coffee)
125
- send_json({action:'script', data:data})
129
+ def script(coffee, options = {})
130
+ data = options.fetch(:coffee, true) ? CoffeeScript.compile(coffee) : coffee
131
+ send_json({action:'script', data:data}.merge(options))
132
+ end
133
+
134
+ def style(attribute, value)
135
+ send_json({action: 'style', attribute: attribute, value: value})
126
136
  end
127
137
 
128
138
  def template(file)
@@ -134,6 +144,17 @@ module Flammarion
134
144
  FileWatcher.new(file).watch {|file| template(file) }
135
145
  end
136
146
 
147
+ def markdown(text, options = {})
148
+ markdown_html = Redcarpet::Markdown.new(Redcarpet::Render::HTML, {
149
+ tables: true,
150
+ fenced_code_blocks: true,
151
+ autolink: true,
152
+ strikethrough: true,
153
+ superscript: true,
154
+ }.merge(options[:markdown_extensions] || {})).render(text)
155
+ send_json({action:'markdown', text: markdown_html}.merge(options))
156
+ end
157
+
137
158
  def hide
138
159
  send_json({action:'hidepane'})
139
160
  end
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><meta charset="utf-8" /><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" /><meta content="width=device-width, initial-scale=1.0" name="viewport" /><link href="stylesheets/all.css" rel="stylesheet" type="text/css" /><script src="javascripts/all.js" type="text/javascript"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="hidden" id="toolbar"><a class="tool-button" href="#">Open</a><a class="tool-button" href="#">Save</a></div><div id="panes"><pre class="pane" id="console-default" style="height:100%"></pre></div><div class="hidden" id="dialog"><pre id="message">Hi World</pre><a class="full-button" href="#">Ok</a></div><div id="status"><div class="left"></div><div class="center"></div><div class="right"></div></div></body></html>
1
+ <!DOCTYPE html><html><head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><meta charset="utf-8" /><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" /><meta content="width=device-width, initial-scale=1.0" name="viewport" /><title>Flammarion</title><link href="stylesheets/all.css" rel="stylesheet" type="text/css" /><script src="javascripts/all.js" type="text/javascript"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="hidden" id="toolbar"><a class="tool-button" href="#">Open</a><a class="tool-button" href="#">Save</a></div><div id="panes"><pre class="pane" id="console-default" style="height:100%"></pre></div><div class="hidden" id="dialog"><pre id="message">Hi World</pre><a class="full-button" href="#">Ok</a></div><div id="status"><div class="left"></div><div class="center"></div><div class="right"></div></div></body></html>
@@ -50,6 +50,7 @@ void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?voi
50
50
  console.log("Path: " + ($qs.get("path")) + ", Port: " + ($qs.get("port")) + ", Host: " + host);
51
51
  this.ws = new WebSocket("ws://" + host + ":" + ($qs.get("port")) + "/" + ($qs.get("path")));
52
52
  this.actions["__parent"] = this;
53
+ document.title = $qs.get("title") || "Flammarion Unconnected";
53
54
  this.ws.onopen = function(msg) {
54
55
  return $('body').addClass("connected");
55
56
  };
@@ -246,6 +247,13 @@ void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?voi
246
247
  this.__parent.add(code, target, data);
247
248
  return hljs.highlightBlock(code[0]);
248
249
  },
250
+ markdown: function(data) {
251
+ var newblock, target;
252
+ target = this.__parent.check_target(data);
253
+ newblock = $("<div class='markdown'></div>");
254
+ newblock.html(data.text);
255
+ return this.__parent.add(newblock, target, data);
256
+ },
249
257
  button: function(data) {
250
258
  var class_name, element, target;
251
259
  target = this.__parent.check_target(data);
@@ -376,6 +384,11 @@ void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?voi
376
384
  script: function(data) {
377
385
  return eval(data.data);
378
386
  },
387
+ style: function(data) {
388
+ var target;
389
+ target = this.__parent.check_target(data);
390
+ return target.css(data.attribute, data.value);
391
+ },
379
392
  table: function(data) {
380
393
  var cell, header, html, i, j, k, len, len1, len2, ref, ref1, row, target;
381
394
  target = this.__parent.check_target(data);
@@ -409,6 +422,12 @@ void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?voi
409
422
  });
410
423
  }
411
424
  return this.__parent.add(html, target, data);
425
+ },
426
+ focus: function(data) {
427
+ return window.show();
428
+ },
429
+ close: function(data) {
430
+ return window.close();
412
431
  }
413
432
  });
414
433
 
@@ -8,6 +8,27 @@ void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?voi
8
8
  // author : Dru Nelson
9
9
  // license : MIT
10
10
  // http://github.com/drudru/ansi_up
11
+ // (The MIT License)
12
+ //
13
+ // Copyright (c) 2011 Dru Nelson
14
+ //
15
+ // Permission is hereby granted, free of charge, to any person obtaining
16
+ // a copy of this software and associated documentation files (the
17
+ // 'Software'), to deal in the Software without restriction, including
18
+ // without limitation the rights to use, copy, modify, merge, publish,
19
+ // distribute, sublicense, and/or sell copies of the Software, and to
20
+ // permit persons to whom the Software is furnished to do so, subject to
21
+ // the following conditions:
22
+ //
23
+ // The above copyright notice and this permission notice shall be
24
+ // included in all copies or substantial portions of the Software.
25
+ //
26
+ // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
27
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
29
+ // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
30
+ // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
31
+ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
11
32
 
12
33
  (function (Date, undefined) {
13
34
 
@@ -6650,6 +6671,7 @@ if (typeof module !== 'undefined') {
6650
6671
  console.log("Path: " + ($qs.get("path")) + ", Port: " + ($qs.get("port")) + ", Host: " + host);
6651
6672
  this.ws = new WebSocket("ws://" + host + ":" + ($qs.get("port")) + "/" + ($qs.get("path")));
6652
6673
  this.actions["__parent"] = this;
6674
+ document.title = $qs.get("title") || "Flammarion Unconnected";
6653
6675
  this.ws.onopen = function(msg) {
6654
6676
  return $('body').addClass("connected");
6655
6677
  };
@@ -6846,6 +6868,13 @@ if (typeof module !== 'undefined') {
6846
6868
  this.__parent.add(code, target, data);
6847
6869
  return hljs.highlightBlock(code[0]);
6848
6870
  },
6871
+ markdown: function(data) {
6872
+ var newblock, target;
6873
+ target = this.__parent.check_target(data);
6874
+ newblock = $("<div class='markdown'></div>");
6875
+ newblock.html(data.text);
6876
+ return this.__parent.add(newblock, target, data);
6877
+ },
6849
6878
  button: function(data) {
6850
6879
  var class_name, element, target;
6851
6880
  target = this.__parent.check_target(data);
@@ -6976,6 +7005,11 @@ if (typeof module !== 'undefined') {
6976
7005
  script: function(data) {
6977
7006
  return eval(data.data);
6978
7007
  },
7008
+ style: function(data) {
7009
+ var target;
7010
+ target = this.__parent.check_target(data);
7011
+ return target.css(data.attribute, data.value);
7012
+ },
6979
7013
  table: function(data) {
6980
7014
  var cell, header, html, i, j, k, len, len1, len2, ref, ref1, row, target;
6981
7015
  target = this.__parent.check_target(data);
@@ -7009,6 +7043,12 @@ if (typeof module !== 'undefined') {
7009
7043
  });
7010
7044
  }
7011
7045
  return this.__parent.add(html, target, data);
7046
+ },
7047
+ focus: function(data) {
7048
+ return window.show();
7049
+ },
7050
+ close: function(data) {
7051
+ return window.close();
7012
7052
  }
7013
7053
  });
7014
7054
 
@@ -50,6 +50,7 @@ void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?voi
50
50
  console.log("Path: " + ($qs.get("path")) + ", Port: " + ($qs.get("port")) + ", Host: " + host);
51
51
  this.ws = new WebSocket("ws://" + host + ":" + ($qs.get("port")) + "/" + ($qs.get("path")));
52
52
  this.actions["__parent"] = this;
53
+ document.title = $qs.get("title") || "Flammarion Unconnected";
53
54
  this.ws.onopen = function(msg) {
54
55
  return $('body').addClass("connected");
55
56
  };
@@ -3,6 +3,27 @@
3
3
  // author : Dru Nelson
4
4
  // license : MIT
5
5
  // http://github.com/drudru/ansi_up
6
+ // (The MIT License)
7
+ //
8
+ // Copyright (c) 2011 Dru Nelson
9
+ //
10
+ // Permission is hereby granted, free of charge, to any person obtaining
11
+ // a copy of this software and associated documentation files (the
12
+ // 'Software'), to deal in the Software without restriction, including
13
+ // without limitation the rights to use, copy, modify, merge, publish,
14
+ // distribute, sublicense, and/or sell copies of the Software, and to
15
+ // permit persons to whom the Software is furnished to do so, subject to
16
+ // the following conditions:
17
+ //
18
+ // The above copyright notice and this permission notice shall be
19
+ // included in all copies or substantial portions of the Software.
20
+ //
21
+ // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
22
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24
+ // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25
+ // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26
+ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
6
27
 
7
28
  (function (Date, undefined) {
8
29
 
@@ -50,6 +50,7 @@ void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?voi
50
50
  console.log("Path: " + ($qs.get("path")) + ", Port: " + ($qs.get("port")) + ", Host: " + host);
51
51
  this.ws = new WebSocket("ws://" + host + ":" + ($qs.get("port")) + "/" + ($qs.get("path")));
52
52
  this.actions["__parent"] = this;
53
+ document.title = $qs.get("title") || "Flammarion Unconnected";
53
54
  this.ws.onopen = function(msg) {
54
55
  return $('body').addClass("connected");
55
56
  };
@@ -381,6 +381,13 @@ html {
381
381
  a {
382
382
  text-decoration: none;
383
383
  }
384
+ p a {
385
+ text-decoration: underline;
386
+ color: #92779b;
387
+ }
388
+ p a:hover {
389
+ color: #a477b3;
390
+ }
384
391
  .hidden {
385
392
  display: none;
386
393
  }
@@ -953,6 +960,12 @@ a {
953
960
  background: #fff;
954
961
  border: 1px solid #666;
955
962
  }
963
+ .markdown {
964
+ white-space: normal;
965
+ font-family: serif;
966
+ max-width: 45em;
967
+ margin: auto;
968
+ }
956
969
  ::-webkit-scrollbar {
957
970
  width: 0.5em;
958
971
  height: 0.5em;
@@ -17,6 +17,13 @@ html {
17
17
  a {
18
18
  text-decoration: none;
19
19
  }
20
+ p a {
21
+ text-decoration: underline;
22
+ color: #92779b;
23
+ }
24
+ p a:hover {
25
+ color: #a477b3;
26
+ }
20
27
  .hidden {
21
28
  display: none;
22
29
  }
@@ -0,0 +1,6 @@
1
+ .markdown {
2
+ white-space: normal;
3
+ font-family: serif;
4
+ max-width: 45em;
5
+ margin: auto;
6
+ }
@@ -54,13 +54,8 @@ $.extend WSClient.prototype.actions,
54
54
  target.addClass("horizontal")
55
55
  else
56
56
  target.removeClass("horizontal")
57
-
58
57
  @__parent.resize_panes(data)
59
58
 
60
- # plot: (data) ->
61
- # @__parent.check_target(data)
62
- # drawPlot("#console-#{data.target}", data.data, $.extend({orientation:@__parent.orientation}, data))
63
-
64
59
  highlight: (data) ->
65
60
  target = @__parent.check_target(data)
66
61
  code = $("<code>#{ansi_up.escape_for_html(data.text)}</code>")
@@ -68,6 +63,12 @@ $.extend WSClient.prototype.actions,
68
63
  @__parent.add(code, target, data)
69
64
  hljs.highlightBlock(code[0])
70
65
 
66
+ markdown: (data) ->
67
+ target = @__parent.check_target(data)
68
+ newblock = $("<div class='markdown'></div>")
69
+ newblock.html(data.text)
70
+ @__parent.add(newblock, target, data)
71
+
71
72
  button: (data) ->
72
73
  target = @__parent.check_target(data)
73
74
  class_name = if data.inline then 'inline-button' else 'full-button'
@@ -172,6 +173,10 @@ $.extend WSClient.prototype.actions,
172
173
  script: (data) ->
173
174
  eval(data.data)
174
175
 
176
+ style: (data) ->
177
+ target = @__parent.check_target(data)
178
+ target.css(data.attribute, data.value)
179
+
175
180
  table: (data) ->
176
181
  target = @__parent.check_target(data)
177
182
  html = "<table>"
@@ -190,3 +195,9 @@ $.extend WSClient.prototype.actions,
190
195
  pos = $(this).index()
191
196
  html.find("td:nth-child(#{(pos+1)})").toggleClass("hover")
192
197
  @__parent.add(html, target, data)
198
+
199
+ focus: (data) ->
200
+ window.show()
201
+
202
+ close: (data) ->
203
+ window.close()
@@ -16,3 +16,5 @@ $active-highlight = activate($bg-color, 20%)
16
16
  $normal-border = 1px solid darken($fg-color, 30%)
17
17
  $scrollbar-track-color = desaturate($active-highlight, 80%)
18
18
  $scrollbar-thumb-color = desaturate(activate($scrollbar-track-color, 30%), 20%)
19
+ $fg-highlight = mix($fg-color, $highlight, 50%)
20
+ $fg-active-highlight = mix($fg-color, $active-highlight, 50%)
@@ -18,6 +18,11 @@ html
18
18
 
19
19
  a
20
20
  text-decoration none
21
+ p &
22
+ text-decoration underline
23
+ color $fg-highlight
24
+ &:hover
25
+ color $fg-active-highlight
21
26
 
22
27
  .hidden
23
28
  display none
@@ -0,0 +1,5 @@
1
+ .markdown
2
+ white-space normal
3
+ font-family serif
4
+ max-width 45em
5
+ margin auto
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flammarion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -107,6 +107,22 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: redcarpet
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
110
126
  - !ruby/object:Gem::Dependency
111
127
  name: bundler
112
128
  requirement: !ruby/object:Gem::Requirement
@@ -156,6 +172,7 @@ files:
156
172
  - lib/html/source/stylesheets/frontend.styl
157
173
  - lib/html/source/stylesheets/railscasts.css
158
174
  - lib/html/source/stylesheets/colors.styl
175
+ - lib/html/source/stylesheets/markdown.styl
159
176
  - lib/html/source/stylesheets/table.styl
160
177
  - lib/html/source/stylesheets/map.styl
161
178
  - lib/html/source/images/marker-shadow.png
@@ -186,6 +203,7 @@ files:
186
203
  - lib/html/build/stylesheets/leaflet.css
187
204
  - lib/html/build/stylesheets/colors.css
188
205
  - lib/html/build/stylesheets/frontend.css
206
+ - lib/html/build/stylesheets/markdown.css
189
207
  - lib/html/build/stylesheets/all.css
190
208
  - lib/html/build/stylesheets/map.css
191
209
  - lib/html/build/stylesheets/buttons.css
@@ -218,10 +236,16 @@ files:
218
236
  - lib/flammarion/server.rb
219
237
  - lib/flammarion/pane.rb
220
238
  - lib/flammarion/version.rb
239
+ - lib/flammarion/revelator.rb
221
240
  - lib/flammarion/writeable.rb
222
241
  - lib/flammarion.rb
223
242
  - LICENSE
224
243
  - Readme.md
244
+ - electron/package.json
245
+ - electron/main.js
246
+ - electron/preload.coffee
247
+ - electron/preload.js
248
+ - electron/main.coffee
225
249
  homepage: https://github.com/zach-capalbo/flammarion
226
250
  licenses:
227
251
  - MIT