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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d89b9e9e140202b8dadbe041cd0fd60eaf8a6df6
4
- data.tar.gz: 4aa2d43c948f25716b9199184836b5aee1156293
3
+ metadata.gz: a4e112b8dcbdb4c854a4567bfb783242273ee3f2
4
+ data.tar.gz: c2d7a195d21c8cf8096f52e96fee5777a954b24f
5
5
  SHA512:
6
- metadata.gz: 45c0d50be1bf7a12aaf21c6c168ad66fb47a1e3053187dc030810a541e3821aa33715957c35ce431c56db906bf344f0d14cbb8377a730e40de4d08b54aaec23f
7
- data.tar.gz: 509ba34af727a051ddede9b65c50f3fc1b2bc417029b98cd9f16adb63cf94984b1b300683f3be213bf6a1d54b0d674b3333ce2b497dbe8ef89a98ae6a38240a3
6
+ metadata.gz: f8a1e6ff96ce93693b281dfb5638be48d61de9bd4f4621c4b86a5b9e646724295d908f9618b53ece3c0ad953176cc14a103f75c3a0b2ba4e2d052c19ea8c42d0
7
+ data.tar.gz: a8f1f3cf120c7c464d43e2121427c0c4710adadcec24deefdfed54e488e313bb45be6ad068a4c5336f3c432d91000fe4eb237934ec59d00f6bbea6f2c08de98f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hyalite (0.2.0)
4
+ hyalite (0.2.1)
5
5
  opal
6
6
 
7
7
  GEM
@@ -1,3 +1,4 @@
1
+ require 'opal'
1
2
  require 'hyalite/version'
2
3
 
3
4
  module Hyalite
@@ -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
@@ -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'
@@ -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`
@@ -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
+
@@ -52,7 +52,7 @@ module Hyalite
52
52
  checked = props[:checked]
53
53
  node = Mount.node(@dom_component.root_node_id)
54
54
  if checked
55
- node[:checked] = checked
55
+ node.attributes[:checked] = checked
56
56
  else
57
57
  node.remove_attribute(:checked)
58
58
  end
@@ -1,3 +1,3 @@
1
1
  module Hyalite
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
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.1
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-08-08 00:00:00.000000000 Z
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