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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19c24958766ef5775522d34cbc2f489d6bfe72078871c0c9bd76d9d19d897cdc
4
- data.tar.gz: 4adddf57f24a86246f00ba9f191c30709d0d52efb9d8c2ecc35e4eed25fe51eb
3
+ metadata.gz: 5df6a60774832f8c464f4068dcb1e9b41d5032d96845da36641cae82af36c05a
4
+ data.tar.gz: 18c395c9fe8555880b94c6260fa99c3f95c22176db8598f644397944b1c13d37
5
5
  SHA512:
6
- metadata.gz: 002e3d88b280e90433b4d1c9c9611b3c2e3d12d441b600a061055241d9d9322dc3276bf25e8e5ce99ee92545a57c38822d8959b5220b41e202a853056a08e06e
7
- data.tar.gz: e40a56767b7a4c3a0cef6697cf956a4c68cfbe46d11730a5f9b9a6b789414dba1081767e2d7040c3810b9d4898bda5335979b8794205cd6de1ef2a63bbcf6407
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"
@@ -15,20 +15,20 @@ module Hyalite::DOM
15
15
  end
16
16
 
17
17
  def input_type
18
- `self.native.type`
18
+ `#@native.type`
19
19
  end
20
20
 
21
21
  def [](prop_name)
22
- `self.native[#{prop_name}]`
22
+ `#@native[#{prop_name}]`
23
23
  end
24
24
 
25
25
  def add_class(name)
26
- `self.native.classList.add(name)`
26
+ `#@native.classList.add(name)`
27
27
  self
28
28
  end
29
29
 
30
30
  def class_names
31
- Array.new(`self.native.classList`).to_a
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
- `self.native.textContent`
39
+ `#@native.textContent`
40
40
  end
41
41
 
42
42
  def text=(text)
43
- `self.native.textContent = text`
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
- `self.native.style[key] = value`
68
+ `#@native.style[key] = value`
65
69
  end
66
70
  end
67
71
 
68
72
  def add_child(child)
69
- `self.native.appendChild(child.native)`
73
+ `#@native.appendChild(child.native)`
70
74
  end
71
75
 
72
76
  def inner_html
73
- `self.native.innerHTML`
77
+ `#@native.innerHTML`
74
78
  end
75
79
 
76
80
  def inner_html=(html)
77
- `self.native.innerHTML = html`
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
- "<#{`self.native.tagName`} class='#{self.class_names.join(' ')}' id='#{self['id']}'/>"
94
+ "<#{`#@native.tagName`} class='#{self.class_names.join(' ')}' id='#{self['id']}' />"
91
95
  end
92
96
 
93
97
  def self.create(tag)
@@ -0,0 +1,14 @@
1
+ module Hyalite::DOM
2
+ class HtmlInput
3
+ include Native
4
+ include Element
5
+
6
+ def self.create()
7
+ $document.create_text(text)
8
+ end
9
+
10
+ def checked?
11
+ `#@native.checked`
12
+ end
13
+ end
14
+ end
@@ -27,47 +27,55 @@ module Hyalite::DOM
27
27
  end
28
28
 
29
29
  def attr(name)
30
- `self.native[name]`
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
- `self.native.tagName`
42
+ `#@native.tagName`
35
43
  end
36
44
 
37
45
  def <<(child)
38
- `self.native.appendChild(child.native)`
46
+ `#@native.appendChild(child.native)`
39
47
  end
40
48
 
41
49
  def clear
42
50
  %x(
43
- var len = self.native.childNodes.length;
51
+ var len = #@native.childNodes.length;
44
52
  for (var i = 0; i < len; i++) {
45
- self.native.childNodes[0].remove();
53
+ #@native.childNodes[0].remove();
46
54
  }
47
55
  )
48
56
  end
49
57
 
50
58
  def parent
51
- if parent = `self.native.parentNode`
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 `self.native.childNodes`
65
+ Collection.new `#@native.childNodes`
58
66
  end
59
67
 
60
68
  def remove
61
- `self.native.remove()`
69
+ `#@native.remove()`
62
70
  end
63
71
 
64
72
  def next_sibling
65
- sib = `self.native.nextSibling`
73
+ sib = `#@native.nextSibling`
66
74
  Node.create(sib) if sib
67
75
  end
68
76
 
69
77
  def ==(other)
70
- `self.native === other.native`
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].add_previous_sibling(child_node)
201
+ parent_node.children[index].insert_before(child_node)
202
202
  end
203
203
  end
204
204
  end
@@ -1,3 +1,3 @@
1
1
  module Hyalite
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.4"
3
3
  end
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.2
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: 2019-05-08 00:00:00.000000000 Z
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.0.1
147
+ rubygems_version: 3.1.2
147
148
  signing_key:
148
149
  specification_version: 4
149
150
  summary: Virtual DOM implimentation in Ruby