hyalite 0.3.2 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hyalite.gemspec +1 -1
- data/lib/hyalite/dom/element.rb +15 -11
- data/lib/hyalite/dom/html_input.rb +14 -0
- data/lib/hyalite/dom/node.rb +18 -10
- data/lib/hyalite/multi_children.rb +1 -1
- data/lib/hyalite/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5df6a60774832f8c464f4068dcb1e9b41d5032d96845da36641cae82af36c05a
|
4
|
+
data.tar.gz: 18c395c9fe8555880b94c6260fa99c3f95c22176db8598f644397944b1c13d37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4746cfb7725e9b47924e7999e89b1d163a0974e6ba08260da8726696e0030642a113a442cfd6d961b87db98ad870b2800a60f1939e14d013da7932155d2a2a44
|
7
|
+
data.tar.gz: f8f3bedb133ddcda97686e6733c47a5444dee37596dd1bc24a0bb4d93ec3a7c97cad1cd98064f733471d8030d1eaa04269a9611700d68a1cf227911def4b6a5f
|
data/hyalite.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency 'opal'
|
22
|
+
spec.add_dependency 'opal', "~> 1.0"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.8"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/hyalite/dom/element.rb
CHANGED
@@ -15,20 +15,20 @@ module Hyalite::DOM
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def input_type
|
18
|
-
|
18
|
+
`#@native.type`
|
19
19
|
end
|
20
20
|
|
21
21
|
def [](prop_name)
|
22
|
-
|
22
|
+
`#@native[#{prop_name}]`
|
23
23
|
end
|
24
24
|
|
25
25
|
def add_class(name)
|
26
|
-
|
26
|
+
`#@native.classList.add(name)`
|
27
27
|
self
|
28
28
|
end
|
29
29
|
|
30
30
|
def class_names
|
31
|
-
Array.new(
|
31
|
+
Array.new(`#@native.classList`).to_a
|
32
32
|
end
|
33
33
|
|
34
34
|
def attributes
|
@@ -36,11 +36,11 @@ module Hyalite::DOM
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def text
|
39
|
-
|
39
|
+
`#@native.textContent`
|
40
40
|
end
|
41
41
|
|
42
42
|
def text=(text)
|
43
|
-
|
43
|
+
`#@native.textContent = text`
|
44
44
|
end
|
45
45
|
|
46
46
|
def width
|
@@ -59,22 +59,26 @@ module Hyalite::DOM
|
|
59
59
|
`#@native.clientLeft`
|
60
60
|
end
|
61
61
|
|
62
|
+
def client_rect
|
63
|
+
Native(`#@native.getBoundingClientRect()`)
|
64
|
+
end
|
65
|
+
|
62
66
|
def style(hash)
|
63
67
|
hash.each do |key, value|
|
64
|
-
|
68
|
+
`#@native.style[key] = value`
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
68
72
|
def add_child(child)
|
69
|
-
|
73
|
+
`#@native.appendChild(child.native)`
|
70
74
|
end
|
71
75
|
|
72
76
|
def inner_html
|
73
|
-
|
77
|
+
`#@native.innerHTML`
|
74
78
|
end
|
75
79
|
|
76
80
|
def inner_html=(html)
|
77
|
-
|
81
|
+
`#@native.innerHTML = html`
|
78
82
|
end
|
79
83
|
|
80
84
|
def inner_dom=(dom)
|
@@ -87,7 +91,7 @@ module Hyalite::DOM
|
|
87
91
|
end
|
88
92
|
|
89
93
|
def to_s
|
90
|
-
"<#{
|
94
|
+
"<#{`#@native.tagName`} class='#{self.class_names.join(' ')}' id='#{self['id']}' />"
|
91
95
|
end
|
92
96
|
|
93
97
|
def self.create(tag)
|
data/lib/hyalite/dom/node.rb
CHANGED
@@ -27,47 +27,55 @@ module Hyalite::DOM
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def attr(name)
|
30
|
-
|
30
|
+
`#@native[name] || #{nil}`
|
31
|
+
end
|
32
|
+
|
33
|
+
def data(name)
|
34
|
+
`#@native.dataset[#{name}] || #{nil}`
|
35
|
+
end
|
36
|
+
|
37
|
+
def insert_before(node)
|
38
|
+
`#@native.parentNode.insertBefore(#{node.native}, #@native)`
|
31
39
|
end
|
32
40
|
|
33
41
|
def node_name
|
34
|
-
|
42
|
+
`#@native.tagName`
|
35
43
|
end
|
36
44
|
|
37
45
|
def <<(child)
|
38
|
-
|
46
|
+
`#@native.appendChild(child.native)`
|
39
47
|
end
|
40
48
|
|
41
49
|
def clear
|
42
50
|
%x(
|
43
|
-
var len =
|
51
|
+
var len = #@native.childNodes.length;
|
44
52
|
for (var i = 0; i < len; i++) {
|
45
|
-
|
53
|
+
#@native.childNodes[0].remove();
|
46
54
|
}
|
47
55
|
)
|
48
56
|
end
|
49
57
|
|
50
58
|
def parent
|
51
|
-
if parent =
|
59
|
+
if parent = `#@native.parentNode`
|
52
60
|
Node.create(parent)
|
53
61
|
end
|
54
62
|
end
|
55
63
|
|
56
64
|
def children
|
57
|
-
Collection.new
|
65
|
+
Collection.new `#@native.childNodes`
|
58
66
|
end
|
59
67
|
|
60
68
|
def remove
|
61
|
-
|
69
|
+
`#@native.remove()`
|
62
70
|
end
|
63
71
|
|
64
72
|
def next_sibling
|
65
|
-
sib =
|
73
|
+
sib = `#@native.nextSibling`
|
66
74
|
Node.create(sib) if sib
|
67
75
|
end
|
68
76
|
|
69
77
|
def ==(other)
|
70
|
-
|
78
|
+
`#@native === other.native`
|
71
79
|
end
|
72
80
|
end
|
73
81
|
end
|
@@ -198,7 +198,7 @@ module Hyalite
|
|
198
198
|
if index >= parent_node.children.length
|
199
199
|
parent_node.add_child(child_node)
|
200
200
|
else
|
201
|
-
parent_node.children[index].
|
201
|
+
parent_node.children[index].insert_before(child_node)
|
202
202
|
end
|
203
203
|
end
|
204
204
|
end
|
data/lib/hyalite/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyalite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/hyalite/dom/event/mouse_event_interface.rb
|
93
93
|
- lib/hyalite/dom/event/touch_event.rb
|
94
94
|
- lib/hyalite/dom/event_target.rb
|
95
|
+
- lib/hyalite/dom/html_input.rb
|
95
96
|
- lib/hyalite/dom/node.rb
|
96
97
|
- lib/hyalite/dom/text.rb
|
97
98
|
- lib/hyalite/dom/window.rb
|
@@ -143,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
144
|
- !ruby/object:Gem::Version
|
144
145
|
version: '0'
|
145
146
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
+
rubygems_version: 3.1.2
|
147
148
|
signing_key:
|
148
149
|
specification_version: 4
|
149
150
|
summary: Virtual DOM implimentation in Ruby
|