hyper-vis 1.0.0.lap32 → 1.0.0.lap33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyperloop/vis/version.rb +1 -1
- data/lib/vis/utilities.rb +84 -51
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f799dc3b8c07ab55625f9ffdf9cac43be68da27c42a30b13f7dac1f34f4317c7
|
4
|
+
data.tar.gz: 2464840ea345428c77007782c3e1869bf807c9156fdb5bbbdfd95a5fb18d37fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ae3ef6974eaf3e282345551c9e20b29fa2edaf39f0e5bdc1f668fdaa4a6ed1bdcb81b9841109bf0bfd567e4755b0e882c08184d037458493abbca333f719752
|
7
|
+
data.tar.gz: 4bebab093bd040555d50092c5b7948c597593c906fb50af64a35dcb1d30614d8e4dcf89ba9a8cf527d34f9a2fc822c30d5fc143d1d3cebc4d1ee621340f3971c
|
data/lib/vis/utilities.rb
CHANGED
@@ -44,7 +44,7 @@ module Vis
|
|
44
44
|
def options_to_native(options)
|
45
45
|
return unless options
|
46
46
|
# options must be duplicated, so callbacks dont get wrapped twice
|
47
|
-
new_opts = options
|
47
|
+
new_opts = {}.merge!(options)
|
48
48
|
_rubyfy_configure_options(new_opts) if new_opts.has_key?(:configure)
|
49
49
|
_rubyfy_edges_options(new_opts) if new_opts.has_key?(:edges)
|
50
50
|
_rubyfy_manipulation_options(new_opts) if new_opts.has_key?(:manipulation)
|
@@ -53,38 +53,47 @@ module Vis
|
|
53
53
|
if new_opts.has_key?(:join_condition)
|
54
54
|
block = new_opts[:join_condition]
|
55
55
|
if `typeof block === "function"`
|
56
|
-
new_opts[:join_condition]
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
unless new_opts[:join_condition].JS[:hyper_wrapped]
|
57
|
+
new_opts[:join_condition] = %x{
|
58
|
+
function(node_options, child_options) {
|
59
|
+
if (child_options !== undefined && child_options !== null) {
|
60
|
+
return #{block.call(`Opal.Hash.$new(node_options)`, `Opal.Hash.$new(child_options)`)};
|
61
|
+
} else {
|
62
|
+
return #{block.call(`Opal.Hash.$new(node_options)`)};
|
63
|
+
}
|
62
64
|
}
|
63
65
|
}
|
64
|
-
|
66
|
+
new_opts[:join_condition].JS[:hyper_wrapped] = true
|
67
|
+
end
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
68
71
|
if new_opts.has_key?(:process_properties)
|
69
72
|
block = new_opts[:process_properties]
|
70
73
|
if `typeof block === "function"`
|
71
|
-
new_opts[:process_properties]
|
72
|
-
|
73
|
-
|
74
|
-
|
74
|
+
unless new_opts[:process_properties].JS[:hyper_wrapped]
|
75
|
+
new_opts[:process_properties] = %x{
|
76
|
+
function(item) {
|
77
|
+
var res = #{block.call(`Opal.Hash.$new(item)`)};
|
78
|
+
return res.$to_n();
|
79
|
+
}
|
75
80
|
}
|
76
|
-
|
81
|
+
new_opts[:process_properties].JS[:hyper_wrapped] = true
|
82
|
+
end
|
77
83
|
end
|
78
84
|
end
|
79
85
|
|
80
86
|
if new_opts.has_key?(:filter)
|
81
87
|
block = new_opts[:filter]
|
82
88
|
if `typeof block === "function"`
|
83
|
-
new_opts[:filter]
|
84
|
-
|
85
|
-
|
89
|
+
unless new_opts[:filter].JS[:hyper_wrapped]
|
90
|
+
new_opts[:filter] = %x{
|
91
|
+
function(item) {
|
92
|
+
return #{block.call(`Opal.Hash.$new(item)`)};
|
93
|
+
}
|
86
94
|
}
|
87
|
-
|
95
|
+
new_opts[:filter].JS[:hyper_wrapped] = true
|
96
|
+
end
|
88
97
|
end
|
89
98
|
end
|
90
99
|
|
@@ -95,11 +104,14 @@ module Vis
|
|
95
104
|
if options[:configure].has_key?(:filter)
|
96
105
|
block = options[:configure][:filter]
|
97
106
|
if `typeof block === "function"`
|
98
|
-
options[:configure][:filter]
|
99
|
-
|
100
|
-
|
107
|
+
unless options[:configure][:filter].JS[:hyper_wrapped]
|
108
|
+
options[:configure][:filter] = %x{
|
109
|
+
function(option, path) {
|
110
|
+
return #{block.call(`Opal.Hash.$new(options)`, `path`)};
|
111
|
+
}
|
101
112
|
}
|
102
|
-
|
113
|
+
options[:configure][:filter].JS[:hyper_wrapped] = true
|
114
|
+
end
|
103
115
|
end
|
104
116
|
end
|
105
117
|
end
|
@@ -111,11 +123,14 @@ module Vis
|
|
111
123
|
if chosen.has_key?(key)
|
112
124
|
block = chosen[key]
|
113
125
|
if `typeof block === "function"`
|
114
|
-
options[:edges][:chosen][key]
|
115
|
-
|
116
|
-
|
126
|
+
unless options[:edges][:chosen][key].JS[:hyper_wrapped]
|
127
|
+
options[:edges][:chosen][key] = %x{
|
128
|
+
function(values, id, selected, hovering) {
|
129
|
+
return #{block.call(`Opal.Hash.$new(values)`, `id`, `selected`, `hovering`)};
|
130
|
+
}
|
117
131
|
}
|
118
|
-
|
132
|
+
options[:edges][:chosen][key].JS[:hyper_wrapped] = true
|
133
|
+
end
|
119
134
|
end
|
120
135
|
end
|
121
136
|
end
|
@@ -124,11 +139,14 @@ module Vis
|
|
124
139
|
if options[:edges].has_key?(key)
|
125
140
|
block = options[:edges][key]
|
126
141
|
if `typeof block === "function"`
|
127
|
-
options[:
|
128
|
-
|
129
|
-
|
142
|
+
unless options[:edges][key].JS[:hyper_wrapped]
|
143
|
+
options[:edges][key] = %x{
|
144
|
+
function(width) {
|
145
|
+
return #{block.call(`width`)};
|
146
|
+
}
|
130
147
|
}
|
131
|
-
|
148
|
+
options[:edges][key].JS[:hyper_wrapped] = true
|
149
|
+
end
|
132
150
|
end
|
133
151
|
end
|
134
152
|
end
|
@@ -136,11 +154,14 @@ module Vis
|
|
136
154
|
if options[:edges][:scaling].has_key?(:custom_scaling_function)
|
137
155
|
block = options[:edges][:scaling][:custom_scaling_function]
|
138
156
|
if `typeof block === "function"`
|
139
|
-
options[:
|
140
|
-
|
141
|
-
|
157
|
+
unless options[:edges][:scaling][:custom_scaling_function].JS[:hyper_wrapped]
|
158
|
+
options[:edges][:scaling][:custom_scaling_function] = %x{
|
159
|
+
function(min, max, total, value) {
|
160
|
+
return #{block.call(`min`, `max`, `total`, `value`)};
|
161
|
+
}
|
142
162
|
}
|
143
|
-
|
163
|
+
options[:edges][:scaling][:custom_scaling_function].JS[:hyper_wrapped] = true
|
164
|
+
end
|
144
165
|
end
|
145
166
|
end
|
146
167
|
end
|
@@ -151,12 +172,15 @@ module Vis
|
|
151
172
|
next unless options[:manipulation].has_key?(key)
|
152
173
|
block = options[:manipulation][key]
|
153
174
|
if `typeof block === "function"`
|
154
|
-
options[:manipulation][key]
|
155
|
-
|
156
|
-
|
157
|
-
|
175
|
+
unless options[:manipulation][key].JS[:hyper_wrapped]
|
176
|
+
options[:manipulation][key] = %x{
|
177
|
+
function(nodeData, callback) {
|
178
|
+
var wrapped_callback = #{ proc { |new_node_data| `callback(new_node_data.$to_n());` }};
|
179
|
+
block.$call(Opal.Hash.$new(nodeData), wrapped_callback);
|
180
|
+
}
|
158
181
|
}
|
159
|
-
|
182
|
+
end
|
183
|
+
options[:manipulation][key].JS[:hyper_wrapped] = true
|
160
184
|
end
|
161
185
|
end
|
162
186
|
# for delete the order of args for the callback is not clear
|
@@ -164,12 +188,15 @@ module Vis
|
|
164
188
|
next unless options[:manipulation].has_key?(key)
|
165
189
|
block = options[:manipulation][key]
|
166
190
|
if `typeof block === "function"`
|
167
|
-
options[:manipulation][key]
|
168
|
-
|
169
|
-
|
170
|
-
|
191
|
+
unless options[:manipulation][key].JS[:hyper_wrapped]
|
192
|
+
options[:manipulation][key] = %x{
|
193
|
+
function(nodeData, callback) {
|
194
|
+
var wrapped_callback = #{ proc { |new_node_data| `callback(new_node_data.$to_n());` }};
|
195
|
+
block.$call(Opal.Hash.$new(nodeData), wrapped_callback);
|
196
|
+
}
|
171
197
|
}
|
172
|
-
|
198
|
+
options[:manipulation][key].JS[:hyper_wrapped] = true
|
199
|
+
end
|
173
200
|
end
|
174
201
|
end
|
175
202
|
end
|
@@ -181,11 +208,14 @@ module Vis
|
|
181
208
|
if chosen.has_key?(key)
|
182
209
|
block = chosen[key]
|
183
210
|
if `typeof block === "function"`
|
184
|
-
options[:nodes][:chosen][key]
|
185
|
-
|
186
|
-
|
211
|
+
unless options[:nodes][:chosen][key].JS[:hyper_wrapped]
|
212
|
+
options[:nodes][:chosen][key] = %x{
|
213
|
+
function(values, id, selected, hovering) {
|
214
|
+
return #{block.call(`Opal.Hash.$new(values)`, `id`, `selected`, `hovering`)};
|
215
|
+
}
|
187
216
|
}
|
188
|
-
|
217
|
+
options[:nodes][:chosen][key].JS[:hyper_wrapped] = true
|
218
|
+
end
|
189
219
|
end
|
190
220
|
end
|
191
221
|
end
|
@@ -194,11 +224,14 @@ module Vis
|
|
194
224
|
if options[:nodes][:scaling].has_key?(:custom_scaling_function)
|
195
225
|
block = options[:nodes][:scaling][:custom_scaling_function]
|
196
226
|
if `typeof block === "function"`
|
197
|
-
options[:nodes][:scaling][:custom_scaling_function]
|
198
|
-
|
199
|
-
|
227
|
+
unless options[:nodes][:scaling][:custom_scaling_function].JS[:hyper_wrapped]
|
228
|
+
options[:nodes][:scaling][:custom_scaling_function] = %x{
|
229
|
+
function(min, max, total, value) {
|
230
|
+
return #{block.call(`min`, `max`, `total`, `value`)};
|
231
|
+
}
|
200
232
|
}
|
201
|
-
|
233
|
+
options[:nodes][:scaling][:custom_scaling_function].JS[:hyper_wrapped] = true
|
234
|
+
end
|
202
235
|
end
|
203
236
|
end
|
204
237
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-vis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.lap33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|