hyalite 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c77f32732643edc41f54bd5a760841bfdb3b40e9
4
- data.tar.gz: be55debba2df6ee12ece3c68858f345f19a6828c
3
+ metadata.gz: d58bd8050435b3431c42a72193bac5e4d6b31e99
4
+ data.tar.gz: 115eb893beb63f8e054a6708a749381fb347f615
5
5
  SHA512:
6
- metadata.gz: 0f4fffb7cc9d62205fab9c4abd9b6d6d6dcab37c9117c32906d368cefc6e583263d64286770bad5b62e3fcb4178cf0dd4739b5359a19e1b6f14497c8cbee4bcd
7
- data.tar.gz: 69e7d327fd33efa27ac58a56aecd6655d5394d991af105be96c392c6c668ca49447be03c87bce85d177b9f006c99d6e19b2c9660c0517a874bb8c702a5cb1f9b
6
+ metadata.gz: 29dd07302e29aaf53e3ae4cb171a2dea290f0bfc461f67cea7cdd1f653bc60d7058006ef4460c67aa9923aed2283aeb45254ce1957f4031d6aff034e7b7047f2
7
+ data.tar.gz: ec49f438f12e1a1701ac97b918d076339b09da932cb1e2903ff3adfbf4f7acba9015d557eaab0e8bb04f13d5887ca133f83e296d0c481805925c7704dfa4bfc3
@@ -11,11 +11,14 @@ require_relative 'dom/event/mouse_event'
11
11
  require_relative 'dom/event/drag_event'
12
12
  require_relative 'dom/event/touch_event'
13
13
  require_relative 'dom/event'
14
+ require_relative 'dom/event_target'
14
15
  require_relative 'dom/node'
15
16
  require_relative 'dom/collection'
16
17
  require_relative 'dom/text'
17
18
  require_relative 'dom/element'
18
19
  require_relative 'dom/body'
19
20
  require_relative 'dom/document'
21
+ require_relative 'dom/window'
20
22
 
21
23
  $document = Hyalite::DOM::Document.singleton
24
+ $window = Hyalite::DOM::Window.singleton
@@ -43,6 +43,22 @@ module Hyalite::DOM
43
43
  `self.native.textContent = text`
44
44
  end
45
45
 
46
+ def width
47
+ `#@native.clientWidth`
48
+ end
49
+
50
+ def height
51
+ `#@native.clientHeight`
52
+ end
53
+
54
+ def top
55
+ `#@native.clientTop`
56
+ end
57
+
58
+ def left
59
+ `#@native.clientLeft`
60
+ end
61
+
46
62
  def style(hash)
47
63
  hash.each do |key, value|
48
64
  `self.native.style[key] = value`
@@ -0,0 +1,8 @@
1
+ module Hyalite::DOM
2
+ module EventTarget
3
+ def on(name, &block)
4
+ callback = Proc.new{|event| block.call(Event.create(event))}
5
+ `#@native.addEventListener(name, callback)`
6
+ end
7
+ end
8
+ end
@@ -1,5 +1,6 @@
1
1
  module Hyalite::DOM
2
2
  module Node
3
+ include EventTarget
3
4
 
4
5
  def self.create(node)
5
6
  @classes ||= [nil, Element, nil, Text, nil, nil, nil, nil, nil, Document, nil, nil]
@@ -59,11 +60,6 @@ module Hyalite::DOM
59
60
  Node.create(sib) if sib
60
61
  end
61
62
 
62
- def on(name, &block)
63
- callback = Proc.new{|event| block.call(Event.create(event))}
64
- `self.native.addEventListener(name, callback)`
65
- end
66
-
67
63
  def ==(other)
68
64
  `self.native === other.native`
69
65
  end
@@ -0,0 +1,24 @@
1
+ module Hyalite::DOM
2
+ class Window
3
+ include Native
4
+ include EventTarget
5
+
6
+ native_reader :document
7
+
8
+ def location
9
+ Native(`#@native.location`)
10
+ end
11
+
12
+ def width
13
+ `#@native.innerWidth`
14
+ end
15
+
16
+ def height
17
+ `#@native.innerHeight`
18
+ end
19
+
20
+ def self.singleton
21
+ @singleton ||= self.new(`window`)
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Hyalite
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyalite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - youchan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-08 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -92,8 +92,10 @@ files:
92
92
  - lib/hyalite/dom/event/mouse_event.rb
93
93
  - lib/hyalite/dom/event/mouse_event_interface.rb
94
94
  - lib/hyalite/dom/event/touch_event.rb
95
+ - lib/hyalite/dom/event_target.rb
95
96
  - lib/hyalite/dom/node.rb
96
97
  - lib/hyalite/dom/text.rb
98
+ - lib/hyalite/dom/window.rb
97
99
  - lib/hyalite/dom_component.rb
98
100
  - lib/hyalite/dom_operations.rb
99
101
  - lib/hyalite/dom_property.rb