flammarion 0.1.7pre2 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -103,3 +103,45 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
103
103
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
104
104
 
105
105
  THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
106
+
107
+ ## Emojione
108
+
109
+ Emoji provided free by [Emoji One](http://emojione.com)
110
+
111
+ #### Emoji One Artwork
112
+
113
+ * Applies to all PNG and SVG files as well as any adaptations made.
114
+ * License: Creative Commons Attribution 4.0 International
115
+ * Human Readable License: http://creativecommons.org/licenses/by/4.0/
116
+ * Complete Legal Terms: http://creativecommons.org/licenses/by/4.0/legalcode
117
+
118
+
119
+ #### Emoji One Non-Artwork
120
+
121
+ * Applies to the Javascript, JSON, PHP, CSS, HTML files, and everything else not covered under the artwork license above.
122
+ * License: MIT
123
+ * Complete Legal Terms: http://opensource.org/licenses/MIT
124
+
125
+ ## Plotly
126
+
127
+ The MIT License (MIT)
128
+
129
+ Copyright (c) 2016 Plotly, Inc
130
+
131
+ Permission is hereby granted, free of charge, to any person obtaining a copy
132
+ of this software and associated documentation files (the "Software"), to deal
133
+ in the Software without restriction, including without limitation the rights
134
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
135
+ copies of the Software, and to permit persons to whom the Software is
136
+ furnished to do so, subject to the following conditions:
137
+
138
+ The above copyright notice and this permission notice shall be included in
139
+ all copies or substantial portions of the Software.
140
+
141
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
142
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
143
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
144
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
145
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
146
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
147
+ THE SOFTWARE.
data/Readme.md CHANGED
@@ -40,12 +40,13 @@ f = Flammarion::Engraving.new
40
40
  f.puts "Hello World!"
41
41
  ```
42
42
 
43
- It can even support standard console color codes: (Thanks to [ansi_up](http://github.com/drudru/ansi_up)!)
43
+ It can even support standard console color codes (Thanks to [ansi_up](http://github.com/drudru/ansi_up)!) and emoji / icons (Thanks to [emojione](http://emojione.com/) and [font awesome](https://fortawesome.github.io/Font-Awesome/))
44
44
 
45
45
  ```ruby
46
46
  require 'colorized'
47
47
  f.puts "This line will be red!".red
48
48
  f.puts "This #{"word".colorize(:green)} will not be blue."
49
+ f.puts "This line will have cows :cow: :cow2:", escape_icons: true
49
50
  ```
50
51
 
51
52
  However, you can also do more advanced things. Say you want to show a table. Easy!
@@ -56,6 +57,13 @@ f.table(
56
57
  10.times.collect{|x| [x, x * x, Math.sqrt(x)]})
57
58
  ```
58
59
 
60
+ Now, instead of a table, you decide you want a plot. No problem.
61
+
62
+ ```ruby
63
+ x = 10.times.to_a
64
+ f.plot([{x:x, y:x}, {x: x, y: x.map{|i| i*i}}, {x: x, y: x.map{|i| Math.sqrt(i)}}])
65
+ ```
66
+
59
67
  Or maybe you want to know where something is:
60
68
 
61
69
  ```ruby
@@ -92,7 +100,7 @@ recipient = f.subpane("number").input("Phone Number")
92
100
  text = f.input("Body", multiline:true)
93
101
  f.button("Send") { send_message(recipient.to_s, text.to_s); f.status("Message Sent!")}
94
102
  f.pane("contacts").puts("Contacts", replace:true)
95
- icons = %w[thumbs-up meh-o bicycle gears star-o star] + [nil] * 5
103
+ icons = %w[thumbs-up meh-o bicycle gears star-o star cow cat cactus] + [nil] * 5
96
104
  30.times do |i|
97
105
  name = Faker::Name.name
98
106
  f.pane("contacts").button(name, right_icon:icons.sample, left_icon:icons.sample) do
@@ -154,6 +162,12 @@ f.pane("sidebar").pane("side2").puts Faker::Hipster.paragraph.green
154
162
 
155
163
  ![Table Sample](http://zach-capalbo.github.io/flammarion/img/table.png)
156
164
 
165
+ ```ruby
166
+ f = Flammarion::Engraving.new
167
+ f.plot(5.times.map{|t| {y:100.times.map{rand * t}}})
168
+ ```
169
+
170
+ ![Plot Sample](http://zach-capalbo.github.io/flammarion/img/plot.png)
157
171
 
158
172
  ## Examples
159
173
 
@@ -1,3 +1,3 @@
1
1
  module Flammarion
2
- VERSION = "0.1.7pre2"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -68,7 +68,7 @@ module Flammarion
68
68
  # plain text. If false, allows any arbitrary html to be rendered in the
69
69
  # writeable area.
70
70
  # @option options [Boolean] :escape_icons (false) If true, will translate
71
- # any text between two `:` into a font-awesome icon. (E.g. :thumbs-up:)
71
+ # any text between two `:` into a font-awesome or emojione icon. (E.g. :thumbs-up:)
72
72
 
73
73
  # @!macro [new] string_representation
74
74
  # The string can be included in text for text-accepting methods (such as
@@ -124,12 +124,29 @@ module Flammarion
124
124
  return nil
125
125
  end
126
126
 
127
- # Creates a new plot to display single axis data
127
+ # Creates a new plot to display single axis data. Uses Plotly javascript
128
+ # library for plotting, options are passed directly to Plotly, so all
129
+ # types of plots and options are supported.
130
+ #
128
131
  # @macro add_options
132
+ # @see https://plot.ly/javascript/
129
133
  # @return [Plot] A Plot object for manipulation after creation.
130
- # @overload plot(array, options)
134
+ # @overload plot(array, options = {})
131
135
  # @param [Array<Number>] values A list of numbers to plot
132
- # @overload plot(dataset, options)
136
+ # @example
137
+ # f.plot([1,3,4,2])
138
+ # @example
139
+ # f.plot(100.times.map{rand}, mode: 'markers')
140
+ # @overload plot(dataset, options = {})
141
+ # @param [Hash] A hash representing a Plotly dataset
142
+ # @example
143
+ # f.plot(x: (1..314).to_a.map{|x| Math.sin(x.to_f / 20.0)}, y:(1..314).to_a.map{|x| Math.sin(x.to_f / 10)}, replace:true)
144
+ # @example
145
+ # f.plot(x: [Time.now, Time.now + 24*60*60].map(&:to_s), y: [55, 38], type:'bar', replace:true)
146
+ # @overload plot(datasets, options = {})
147
+ # @param [Array<Hash>] An array of Plotly datasets
148
+ # @example
149
+ # f.plot(5.times.map{|t| {y: 100.times.map{rand * t}}})f.plot(5.times.map{|t| {y: 100.times.map{rand * t}}})
133
150
  def plot(data, options = {})
134
151
  id = @engraving.make_id
135
152
  p = Plot.new(id, @pane_name, @engraving)
@@ -70,6 +70,8 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
70
70
  var WSClient,
71
71
  hasProp = {}.hasOwnProperty;
72
72
 
73
+ emojione.imagePathPNG = 'images/emoji/';
74
+
73
75
  WSClient = (function() {
74
76
  function WSClient() {
75
77
  var host;
@@ -197,7 +199,6 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
197
199
  }
198
200
  });
199
201
  }
200
- emojione.imagePathPNG = 'images/emoji/';
201
202
  if (options.escape_icons) {
202
203
  text = emojione.toImage(text);
203
204
  }
@@ -6736,6 +6736,8 @@ window.font_awesome_list = ["glass","music","search","envelope-o","heart","star"
6736
6736
  var WSClient,
6737
6737
  hasProp = {}.hasOwnProperty;
6738
6738
 
6739
+ emojione.imagePathPNG = 'images/emoji/';
6740
+
6739
6741
  WSClient = (function() {
6740
6742
  function WSClient() {
6741
6743
  var host;
@@ -6863,7 +6865,6 @@ window.font_awesome_list = ["glass","music","search","envelope-o","heart","star"
6863
6865
  }
6864
6866
  });
6865
6867
  }
6866
- emojione.imagePathPNG = 'images/emoji/';
6867
6868
  if (options.escape_icons) {
6868
6869
  text = emojione.toImage(text);
6869
6870
  }
@@ -7116,11 +7117,20 @@ window.font_awesome_list = ["glass","music","search","envelope-o","heart","star"
7116
7117
  left_icon = "";
7117
7118
  data.right_icon || (data.right_icon = data.icon);
7118
7119
  if (data.left_icon) {
7119
- left_icon = "<i class='fa fa-" + data.left_icon + " label-icon-left'></i>";
7120
+ if ((":" + data.left_icon + ":") in emojione.emojioneList) {
7121
+ left_icon = "<i class='label-icon-left'>" + emojione.shortnameToImage(":" + data.left_icon + ":") + "</i>";
7122
+ console.log(left_icon);
7123
+ } else {
7124
+ left_icon = "<i class='fa fa-" + data.left_icon + " label-icon-left'></i>";
7125
+ }
7120
7126
  }
7121
7127
  right_icon = "";
7122
7128
  if (data.right_icon) {
7123
- right_icon = "<i class='fa fa-" + data.right_icon + " label-icon-right'></i>";
7129
+ if ((":" + data.right_icon + ":") in emojione.emojioneList) {
7130
+ left_icon = "<i class='label-icon-right'>" + emojione.shortnameToImage(":" + data.right_icon + ":") + "</i>";
7131
+ } else {
7132
+ right_icon = "<i class='fa fa-" + data.right_icon + " label-icon-right'></i>";
7133
+ }
7124
7134
  }
7125
7135
  element = $("<a href='#' class='" + class_name + "'>" + left_icon + (this.__parent.escape(data.label, data)) + right_icon + "</a>");
7126
7136
  element.click((function(_this) {
@@ -7362,7 +7372,7 @@ window.font_awesome_list = ["glass","music","search","envelope-o","heart","star"
7362
7372
  paper_bgcolor: $('#plot-style').css("background-color"),
7363
7373
  font: {
7364
7374
  color: $('#plot-style').css("color"),
7365
- family: $('body').css("font-family")
7375
+ family: $('pre').css("font-family")
7366
7376
  },
7367
7377
  titlefont: {
7368
7378
  color: $('#plot-style').css("color"),
@@ -7398,7 +7408,12 @@ window.font_awesome_list = ["glass","music","search","envelope-o","heart","star"
7398
7408
  if (plotDiv.size() === 0) {
7399
7409
  plotDiv = $("<div class='plot' id='plot-" + data.id + "'></div>");
7400
7410
  this.__parent.add(plotDiv, target, data);
7401
- console.log(default_plot_options);
7411
+ $(window).resize(function() {
7412
+ return Plotly.relayout(plotDiv[0], {
7413
+ width: plotDiv.width(),
7414
+ height: plotDiv.height()
7415
+ });
7416
+ });
7402
7417
  return Plotly.newPlot(plotDiv[0], data.data, $.extend({
7403
7418
  width: plotDiv.width()
7404
7419
  }, window.default_plot_options, data));
@@ -70,6 +70,8 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
70
70
  var WSClient,
71
71
  hasProp = {}.hasOwnProperty;
72
72
 
73
+ emojione.imagePathPNG = 'images/emoji/';
74
+
73
75
  WSClient = (function() {
74
76
  function WSClient() {
75
77
  var host;
@@ -197,7 +199,6 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
197
199
  }
198
200
  });
199
201
  }
200
- emojione.imagePathPNG = 'images/emoji/';
201
202
  if (options.escape_icons) {
202
203
  text = emojione.toImage(text);
203
204
  }
@@ -248,11 +249,20 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
248
249
  left_icon = "";
249
250
  data.right_icon || (data.right_icon = data.icon);
250
251
  if (data.left_icon) {
251
- left_icon = "<i class='fa fa-" + data.left_icon + " label-icon-left'></i>";
252
+ if ((":" + data.left_icon + ":") in emojione.emojioneList) {
253
+ left_icon = "<i class='label-icon-left'>" + emojione.shortnameToImage(":" + data.left_icon + ":") + "</i>";
254
+ console.log(left_icon);
255
+ } else {
256
+ left_icon = "<i class='fa fa-" + data.left_icon + " label-icon-left'></i>";
257
+ }
252
258
  }
253
259
  right_icon = "";
254
260
  if (data.right_icon) {
255
- right_icon = "<i class='fa fa-" + data.right_icon + " label-icon-right'></i>";
261
+ if ((":" + data.right_icon + ":") in emojione.emojioneList) {
262
+ left_icon = "<i class='label-icon-right'>" + emojione.shortnameToImage(":" + data.right_icon + ":") + "</i>";
263
+ } else {
264
+ right_icon = "<i class='fa fa-" + data.right_icon + " label-icon-right'></i>";
265
+ }
256
266
  }
257
267
  element = $("<a href='#' class='" + class_name + "'>" + left_icon + (this.__parent.escape(data.label, data)) + right_icon + "</a>");
258
268
  element.click((function(_this) {
@@ -70,6 +70,8 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
70
70
  var WSClient,
71
71
  hasProp = {}.hasOwnProperty;
72
72
 
73
+ emojione.imagePathPNG = 'images/emoji/';
74
+
73
75
  WSClient = (function() {
74
76
  function WSClient() {
75
77
  var host;
@@ -197,7 +199,6 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
197
199
  }
198
200
  });
199
201
  }
200
- emojione.imagePathPNG = 'images/emoji/';
201
202
  if (options.escape_icons) {
202
203
  text = emojione.toImage(text);
203
204
  }
@@ -5,7 +5,7 @@
5
5
  paper_bgcolor: $('#plot-style').css("background-color"),
6
6
  font: {
7
7
  color: $('#plot-style').css("color"),
8
- family: $('body').css("font-family")
8
+ family: $('pre').css("font-family")
9
9
  },
10
10
  titlefont: {
11
11
  color: $('#plot-style').css("color"),
@@ -41,7 +41,12 @@
41
41
  if (plotDiv.size() === 0) {
42
42
  plotDiv = $("<div class='plot' id='plot-" + data.id + "'></div>");
43
43
  this.__parent.add(plotDiv, target, data);
44
- console.log(default_plot_options);
44
+ $(window).resize(function() {
45
+ return Plotly.relayout(plotDiv[0], {
46
+ width: plotDiv.width(),
47
+ height: plotDiv.height()
48
+ });
49
+ });
45
50
  return Plotly.newPlot(plotDiv[0], data.data, $.extend({
46
51
  width: plotDiv.width()
47
52
  }, window.default_plot_options, data));
@@ -70,6 +70,8 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
70
70
  var WSClient,
71
71
  hasProp = {}.hasOwnProperty;
72
72
 
73
+ emojione.imagePathPNG = 'images/emoji/';
74
+
73
75
  WSClient = (function() {
74
76
  function WSClient() {
75
77
  var host;
@@ -197,7 +199,6 @@ return"undefined"!=typeof b&&""!==b&&b in a.jsEscapeMap?(d=a.jsEscapeMap[b],e=a.
197
199
  }
198
200
  });
199
201
  }
200
- emojione.imagePathPNG = 'images/emoji/';
201
202
  if (options.escape_icons) {
202
203
  text = emojione.toImage(text);
203
204
  }
data/lib/html/config.rb CHANGED
@@ -39,7 +39,7 @@
39
39
  configure :development do
40
40
  activate :livereload
41
41
  config[:file_watcher_ignore] += [
42
- /source\/images\/emoji\//
42
+ /emoji\//
43
43
  ]
44
44
  end
45
45
 
@@ -5,9 +5,19 @@ $.extend WSClient.prototype.actions,
5
5
  class_name = if data.inline then 'inline-button' else 'full-button'
6
6
  left_icon = ""
7
7
  data.right_icon ||= data.icon
8
- left_icon = "<i class='fa fa-#{data.left_icon} label-icon-left'></i>" if data.left_icon
8
+ if data.left_icon
9
+ if ":#{data.left_icon}:" of emojione.emojioneList
10
+ left_icon = "<i class='label-icon-left'>" + emojione.shortnameToImage(":#{data.left_icon}:") + "</i>"
11
+ console.log left_icon
12
+ else
13
+ left_icon = "<i class='fa fa-#{data.left_icon} label-icon-left'></i>"
14
+
9
15
  right_icon = ""
10
- right_icon = "<i class='fa fa-#{data.right_icon} label-icon-right'></i>" if data.right_icon
16
+ if data.right_icon
17
+ if ":#{data.right_icon}:" of emojione.emojioneList
18
+ left_icon = "<i class='label-icon-right'>" + emojione.shortnameToImage(":#{data.right_icon}:") + "</i>"
19
+ else
20
+ right_icon = "<i class='fa fa-#{data.right_icon} label-icon-right'></i>"
11
21
 
12
22
  element = $("<a href='#' class='#{class_name}'>#{left_icon}#{@__parent.escape(data.label, data)}#{right_icon}</a>")
13
23
  element.click =>
@@ -4,7 +4,7 @@ $(document).ready ->
4
4
  paper_bgcolor: $('#plot-style').css("background-color")
5
5
  font:
6
6
  color: $('#plot-style').css("color")
7
- family: $('body').css("font-family")
7
+ family: $('pre').css("font-family")
8
8
  titlefont:
9
9
  color: $('#plot-style').css("color")
10
10
  family: $('body').css("font-family")
@@ -29,7 +29,8 @@ $.extend WSClient.prototype.actions,
29
29
  if plotDiv.size() is 0
30
30
  plotDiv = $("<div class='plot' id='plot-#{data.id}'></div>")
31
31
  @__parent.add(plotDiv, target, data)
32
- console.log(default_plot_options)
32
+ $(window).resize ->
33
+ Plotly.relayout plotDiv[0], {width: plotDiv.width(), height:plotDiv.height()}
33
34
  Plotly.newPlot(plotDiv[0], data.data, $.extend(width: plotDiv.width(), window.default_plot_options, data))
34
35
  else
35
36
  plotDiv[0].data = data.data
@@ -3,6 +3,8 @@
3
3
  #= require fontawesome.js
4
4
  #= require vendor/emojione.min.js
5
5
 
6
+ emojione.imagePathPNG = 'images/emoji/'
7
+
6
8
  class WSClient
7
9
  constructor: ->
8
10
  host = $qs.get("host") || "localhost"
@@ -80,7 +82,7 @@ class WSClient
80
82
  if options.escape_icons
81
83
  text = text.replace /:[\w-]+:/g, (match) ->
82
84
  if font_awesome_list.includes(match[1..-2]) then "<i class='fa fa-#{match[1..-2]}'></i>" else match
83
- emojione.imagePathPNG = 'images/emoji/'
85
+
84
86
  text = emojione.toImage(text) if options.escape_icons
85
87
  text = $("<div>#{text}</div>")
86
88
  text.find("a[href^='http']").attr('target','_blank')
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flammarion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7pre2
5
- prerelease: 5
4
+ version: 0.1.7
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Zach Capalbo
@@ -3826,7 +3826,6 @@ files:
3826
3826
  - LICENSE
3827
3827
  - Readme.md
3828
3828
  - electron/package.json
3829
- - electron/flammarion-window.sh
3830
3829
  - electron/main.js
3831
3830
  - electron/icon.png
3832
3831
  - electron/preload.coffee
@@ -3848,9 +3847,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
3848
3847
  required_rubygems_version: !ruby/object:Gem::Requirement
3849
3848
  none: false
3850
3849
  requirements:
3851
- - - ! '>'
3850
+ - - ! '>='
3852
3851
  - !ruby/object:Gem::Version
3853
- version: 1.3.1
3852
+ version: '0'
3854
3853
  requirements: []
3855
3854
  rubyforge_project:
3856
3855
  rubygems_version: 1.8.23
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- electron .