hyper-d3 1.0.0.lap24 → 1.0.0.lap25

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf7f8fca3e3344573cc1f2506af87d7d3b2e466053589cc8e163a96d88d3f36f
4
- data.tar.gz: 0b83f3eb27f4c97fd944dcf34b39249c185420d1003ed8305e0b9a475c27d04f
3
+ metadata.gz: 601cd3dc65a184cef36a4c898995f6321339720b78a3f4f4237ed453f5f7cf72
4
+ data.tar.gz: 6828c8e3f9bf9320d74426cc428fdf634f9948aac650bd6ae4f6e307c9e791bf
5
5
  SHA512:
6
- metadata.gz: 0d43121a885cb575eb7295ae7c1facde28f4644fd3fa19f7ca22f914f1a5a5ac32b2aae2913683a37e8148007c9ff39b51a11f390a029c46686b2af1130bb6d6
7
- data.tar.gz: 74b869f81d8936ec0e85c0a40ed8674a13069eb875ba05ebc893df952deb75420c038a0c85b7108b8b372e0f8b6afba8edddf29e05fc67ce91bd6ead624b5bf0
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
@@ -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 Haperloop Component"
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")
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Hyperloop
2
2
  module D3
3
- VERSION = "1.0.0.lap24"
3
+ VERSION = "1.0.0.lap25"
4
4
  end
5
5
  end
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rails"
4
+ gem "listen"
5
+ gem 'sqlite3'
6
+ gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: "master"
7
+ gem "hyper-d3", path: "../.."
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.lap24
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.lock
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 Haperloop Component
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.lock
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