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 +4 -4
- data/lib/hyalite/dom.rb +3 -0
- data/lib/hyalite/dom/element.rb +16 -0
- data/lib/hyalite/dom/event_target.rb +8 -0
- data/lib/hyalite/dom/node.rb +1 -5
- data/lib/hyalite/dom/window.rb +24 -0
- data/lib/hyalite/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d58bd8050435b3431c42a72193bac5e4d6b31e99
|
4
|
+
data.tar.gz: 115eb893beb63f8e054a6708a749381fb347f615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29dd07302e29aaf53e3ae4cb171a2dea290f0bfc461f67cea7cdd1f653bc60d7058006ef4460c67aa9923aed2283aeb45254ce1957f4031d6aff034e7b7047f2
|
7
|
+
data.tar.gz: ec49f438f12e1a1701ac97b918d076339b09da932cb1e2903ff3adfbf4f7acba9015d557eaab0e8bb04f13d5887ca133f83e296d0c481805925c7704dfa4bfc3
|
data/lib/hyalite/dom.rb
CHANGED
@@ -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
|
data/lib/hyalite/dom/element.rb
CHANGED
@@ -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`
|
data/lib/hyalite/dom/node.rb
CHANGED
@@ -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
|
data/lib/hyalite/version.rb
CHANGED
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.
|
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-
|
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
|