hyper-d3 1.0.0.lap24 → 1.0.0.lap25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/hyper-d3.gemspec +1 -1
- data/lib/hyperloop/d3/mixin.rb +8 -3
- data/lib/hyperloop/d3/version.rb +1 -1
- data/spec/test_app/Gemfile +7 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 601cd3dc65a184cef36a4c898995f6321339720b78a3f4f4237ed453f5f7cf72
|
4
|
+
data.tar.gz: 6828c8e3f9bf9320d74426cc428fdf634f9948aac650bd6ae4f6e307c9e791bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 500424f2a835a0e055e46283464b4e623719c65dcef8d10abbe6cde3276b21b8bc9ca253cb4ad129cfad0131306939fc52584a33a6b32ffed7619e6272f5a4c4
|
7
|
+
data.tar.gz: d5ae2319bb1c9464b399dfd0a6fb10ffce191829fade73fe48ac20be49c7ac01af0901c5fa4af239515569178f1e780f46b246d42dbb94ad08ba2bfe1efe1f10
|
data/README.md
CHANGED
@@ -102,6 +102,7 @@ the block passed to render_with_selection.
|
|
102
102
|
|
103
103
|
### Events
|
104
104
|
Events in the D3 classes are currentyly badly supported. You must most probably revert to native JS inlining.
|
105
|
+
You can refer to the selection, <div> in the example below, by calling the accessor `selection`from within the even handler.
|
105
106
|
To clean up the event handlers, you can use the before_unmount_with_selection callback. It will be called with the root
|
106
107
|
selection and the most recent data received:
|
107
108
|
```ruby
|
@@ -111,6 +112,10 @@ class StarTrekVoyagerComponent < Hyperloop::D3::Component
|
|
111
112
|
# clean up event handlers or anything else here
|
112
113
|
end
|
113
114
|
|
115
|
+
def handler_for_event
|
116
|
+
selection # accessor for the <div> selection below
|
117
|
+
end
|
118
|
+
|
114
119
|
render_with_selection('DIV') do |selection, voyager_data|
|
115
120
|
# draw here
|
116
121
|
end
|
data/hyper-d3.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.author = "Jan Biedermann, Tomasz Wegrzanowski"
|
7
7
|
s.email = "jan@kursator.de"
|
8
8
|
s.homepage = "https://github.com/janbiedermann/hyper-d3"
|
9
|
-
s.summary = "Ruby bindings for D3 as a Ruby
|
9
|
+
s.summary = "Ruby bindings for D3 as a Ruby Hyperloop Component"
|
10
10
|
s.description = "Write React Components in ruby to show graphics created with D3.js"
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
data/lib/hyperloop/d3/mixin.rb
CHANGED
@@ -12,10 +12,17 @@ module Hyperloop
|
|
12
12
|
@_dom_node = dom_node
|
13
13
|
end
|
14
14
|
|
15
|
+
def selection
|
16
|
+
if @_dom_node
|
17
|
+
selection = ::D3.select(@_dom_node)
|
18
|
+
else
|
19
|
+
raise "No DOM Node available for D3::Selection"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
15
23
|
def self.before_unmount_with_selection(&block)
|
16
24
|
before_unmount do
|
17
25
|
if @_dom_node && block
|
18
|
-
selection = ::D3.select(@_dom_node)
|
19
26
|
block.call(selection, @_data)
|
20
27
|
end
|
21
28
|
end
|
@@ -39,7 +46,6 @@ module Hyperloop
|
|
39
46
|
|
40
47
|
after_mount do
|
41
48
|
if @_dom_node && @_d3_render_block
|
42
|
-
selection = ::D3.select(@_dom_node)
|
43
49
|
@_d3_render_block.call(selection, @_data)
|
44
50
|
end
|
45
51
|
end
|
@@ -48,7 +54,6 @@ module Hyperloop
|
|
48
54
|
if new_props[:data] != @_data
|
49
55
|
@_data = new_props[:data]
|
50
56
|
if @_dom_node && @_d3_render_block
|
51
|
-
selection = ::D3.select(@_dom_node)
|
52
57
|
@_d3_render_block.call(selection, @_data)
|
53
58
|
end
|
54
59
|
end
|
data/lib/hyperloop/d3/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-d3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.lap25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann, Tomasz Wegrzanowski
|
@@ -253,7 +253,7 @@ files:
|
|
253
253
|
- spec/statistics_spec.rb
|
254
254
|
- spec/symbol_spec.rb
|
255
255
|
- spec/test_app/.gitignore
|
256
|
-
- spec/test_app/Gemfile
|
256
|
+
- spec/test_app/Gemfile
|
257
257
|
- spec/test_app/README.md
|
258
258
|
- spec/test_app/Rakefile
|
259
259
|
- spec/test_app/app/assets/config/manifest.js
|
@@ -378,7 +378,7 @@ rubyforge_project:
|
|
378
378
|
rubygems_version: 2.7.3
|
379
379
|
signing_key:
|
380
380
|
specification_version: 4
|
381
|
-
summary: Ruby bindings for D3 as a Ruby
|
381
|
+
summary: Ruby bindings for D3 as a Ruby Hyperloop Component
|
382
382
|
test_files:
|
383
383
|
- spec/arc_spec.rb
|
384
384
|
- spec/area_spec.rb
|
@@ -422,7 +422,7 @@ test_files:
|
|
422
422
|
- spec/statistics_spec.rb
|
423
423
|
- spec/symbol_spec.rb
|
424
424
|
- spec/test_app/.gitignore
|
425
|
-
- spec/test_app/Gemfile
|
425
|
+
- spec/test_app/Gemfile
|
426
426
|
- spec/test_app/README.md
|
427
427
|
- spec/test_app/Rakefile
|
428
428
|
- spec/test_app/app/assets/config/manifest.js
|