hyalite 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/hyalite.rb +1 -0
- data/lib/hyalite/component.rb +24 -0
- data/lib/hyalite/dom.rb +1 -0
- data/lib/hyalite/dom/element.rb +2 -4
- data/lib/hyalite/dom/event.rb +13 -0
- data/lib/hyalite/dom/event/touch_event.rb +19 -0
- data/lib/hyalite/input_wrapper.rb +1 -1
- data/lib/hyalite/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4e112b8dcbdb4c854a4567bfb783242273ee3f2
|
4
|
+
data.tar.gz: c2d7a195d21c8cf8096f52e96fee5777a954b24f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8a1e6ff96ce93693b281dfb5638be48d61de9bd4f4621c4b86a5b9e646724295d908f9618b53ece3c0ad953176cc14a103f75c3a0b2ba4e2d052c19ea8c42d0
|
7
|
+
data.tar.gz: a8f1f3cf120c7c464d43e2121427c0c4710adadcec24deefdfed54e488e313bb45be6ad068a4c5336f3c432d91000fe4eb237934ec59d00f6bbea6f2c08de98f
|
data/Gemfile.lock
CHANGED
data/lib/hyalite.rb
CHANGED
data/lib/hyalite/component.rb
CHANGED
@@ -48,6 +48,22 @@ module Hyalite
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
define_singleton_method(:before_unmount) do |&block|
|
52
|
+
if block
|
53
|
+
@before_unmount = block
|
54
|
+
else
|
55
|
+
@before_unmount
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
define_singleton_method(:after_unmount) do |&block|
|
60
|
+
if block
|
61
|
+
@after_unmount = block
|
62
|
+
else
|
63
|
+
@after_unmount
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
51
67
|
define_singleton_method(:before_update) do |&block|
|
52
68
|
if block
|
53
69
|
@before_update = block
|
@@ -136,6 +152,14 @@ module Hyalite
|
|
136
152
|
self.instance_eval(&self.class.after_mount) if self.class.after_mount
|
137
153
|
end
|
138
154
|
|
155
|
+
def component_will_unmount
|
156
|
+
self.instance_eval(&self.class.before_unmount) if self.class.before_unmount
|
157
|
+
end
|
158
|
+
|
159
|
+
def component_did_unmount
|
160
|
+
self.instance_eval(&self.class.after_unmount) if self.class.after_unmount
|
161
|
+
end
|
162
|
+
|
139
163
|
def component_will_update(props, state, context)
|
140
164
|
self.instance_eval(&self.class.before_update) if self.class.before_update
|
141
165
|
end
|
data/lib/hyalite/dom.rb
CHANGED
@@ -9,6 +9,7 @@ require_relative 'dom/event/data_transfer'
|
|
9
9
|
require_relative 'dom/event/keyboard_event'
|
10
10
|
require_relative 'dom/event/mouse_event'
|
11
11
|
require_relative 'dom/event/drag_event'
|
12
|
+
require_relative 'dom/event/touch_event'
|
12
13
|
require_relative 'dom/event'
|
13
14
|
require_relative 'dom/node'
|
14
15
|
require_relative 'dom/collection'
|
data/lib/hyalite/dom/element.rb
CHANGED
@@ -8,6 +8,8 @@ module Hyalite::DOM
|
|
8
8
|
alias_native :remove_attribute, :removeAttribute
|
9
9
|
alias_native :tag_name, :tagName
|
10
10
|
|
11
|
+
native_accessor :value
|
12
|
+
|
11
13
|
def element?
|
12
14
|
true
|
13
15
|
end
|
@@ -41,10 +43,6 @@ module Hyalite::DOM
|
|
41
43
|
`self.native.textContent = text`
|
42
44
|
end
|
43
45
|
|
44
|
-
def value
|
45
|
-
`self.native.value`
|
46
|
-
end
|
47
|
-
|
48
46
|
def style(hash)
|
49
47
|
hash.each do |key, value|
|
50
48
|
`self.native.style[key] = value`
|
data/lib/hyalite/dom/event.rb
CHANGED
@@ -28,6 +28,12 @@ module Hyalite
|
|
28
28
|
'keydown' => KeyboardEvent,
|
29
29
|
'keyup' => KeyboardEvent,
|
30
30
|
'keypress' => KeyboardEvent,
|
31
|
+
|
32
|
+
# TouchEvent
|
33
|
+
'touchstart' => TouchEvent,
|
34
|
+
'touchcancel' => TouchEvent,
|
35
|
+
'touchmove' => TouchEvent,
|
36
|
+
'touchend' => TouchEvent
|
31
37
|
}
|
32
38
|
|
33
39
|
def self.create(event)
|
@@ -35,6 +41,8 @@ module Hyalite
|
|
35
41
|
event_class = EVENT_CLASSES[type]
|
36
42
|
if event_class
|
37
43
|
event_class.new(event)
|
44
|
+
else
|
45
|
+
DefaultEvent.new(event)
|
38
46
|
end
|
39
47
|
end
|
40
48
|
|
@@ -45,6 +53,11 @@ module Hyalite
|
|
45
53
|
def prevent_default
|
46
54
|
`self.native.preventDefault()`
|
47
55
|
end
|
56
|
+
|
57
|
+
class DefaultEvent
|
58
|
+
include Native
|
59
|
+
include Event
|
60
|
+
end
|
48
61
|
end
|
49
62
|
end
|
50
63
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hyalite
|
2
|
+
module DOM
|
3
|
+
module Event
|
4
|
+
class TouchEvent
|
5
|
+
include Native
|
6
|
+
include Event
|
7
|
+
|
8
|
+
alias_native :touches
|
9
|
+
alias_native :change_touches, :changeTouches
|
10
|
+
alias_native :target_touches, :targetTouches
|
11
|
+
alias_native :shift_key, :shiftKey
|
12
|
+
alias_native :alt_key, :altKey
|
13
|
+
alias_native :ctrl_key, :ctrlKey
|
14
|
+
alias_native :meta_key, :metaKey
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/hyalite/dom/event/keyboard_event.rb
|
91
91
|
- lib/hyalite/dom/event/mouse_event.rb
|
92
92
|
- lib/hyalite/dom/event/mouse_event_interface.rb
|
93
|
+
- lib/hyalite/dom/event/touch_event.rb
|
93
94
|
- lib/hyalite/dom/node.rb
|
94
95
|
- lib/hyalite/dom/text.rb
|
95
96
|
- lib/hyalite/dom_component.rb
|