hyalite 0.0.1 → 0.0.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: d206b2b8ac5745b538a38390d5969f25a938bee0
4
- data.tar.gz: 27970cdf165567fad934301c261f7c9e6b4abf2a
3
+ metadata.gz: ad8c51336a33fc4b94adf83702f0c24611551752
4
+ data.tar.gz: 55032da2177b4efbdf791a7866e6bafea0fe0d90
5
5
  SHA512:
6
- metadata.gz: c0fb1bd06c6e90c252aa874a76e0361136c9dbe0c2f3ff6f48ea2e2027df184daa6b64b2475225bd28f683b59c1be2bc282dbd756c9fb10a14074045f602cb75
7
- data.tar.gz: 9bd0d1ea6396e00a98247f8024990ccbc2bbca354cf401c0ead9345720bb9258b7801d26a816f243ab52c2ce0e643d0f3ba8902f7af3dd763b40029eb4a3ad12
6
+ metadata.gz: 2ea894199b0519cab7c4b75c5b399a81f4d1cd21aa8aaa8b9d8c594870a42e11fc1e8a2e09dbe124e12af46000858a9398287fb284c2bedcbbd51428dfa33809
7
+ data.tar.gz: 1e017dd83054e9b768a47144b4b350534d3b029668169caae99da33011a5ec8558473bc75b73ac79a28476fa54681d13d0df6251ced2e184840cc682942397ae
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ 2.3.1
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'opal-rspec'
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hyalite (0.0.2)
5
+ opal
6
+ opal-browser
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ concurrent-ruby (1.0.2)
12
+ hike (1.2.3)
13
+ opal (0.9.2)
14
+ hike (~> 1.2)
15
+ sourcemap (~> 0.1.0)
16
+ sprockets (~> 3.1)
17
+ tilt (>= 1.4)
18
+ opal-browser (0.2.0)
19
+ opal
20
+ paggio
21
+ opal-rspec (0.5.0)
22
+ opal (>= 0.8.0, < 0.10)
23
+ paggio (0.2.6)
24
+ rack (1.6.4)
25
+ rake (10.5.0)
26
+ sourcemap (0.1.1)
27
+ sprockets (3.6.0)
28
+ concurrent-ruby (~> 1.0)
29
+ rack (> 1, < 3)
30
+ tilt (2.0.5)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ bundler (~> 1.8)
37
+ hyalite!
38
+ opal-rspec
39
+ rake (~> 10.0)
40
+
41
+ BUNDLED WITH
42
+ 1.12.5
data/Rakefile CHANGED
@@ -1,7 +1,16 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler'
2
+ Bundler.require
3
3
 
4
- RSpec::Core::RakeTask.new(:spec)
4
+ require "bundler/gem_tasks"
5
5
 
6
6
  task :default => :spec
7
7
 
8
+ Opal::Processor.source_map_enabled = true
9
+
10
+ require 'opal/rspec/rake_task'
11
+ Opal::RSpec::RakeTask.new(:default) do |server, task|
12
+ server.append_path File.expand_path('./client', __FILE__)
13
+ server.source_map = true
14
+ server.debug = true
15
+ end
16
+
@@ -40,6 +40,25 @@ module Hyalite
40
40
  ElementObject.new(type, key, ref, Hyalite.current_owner, props)
41
41
  end
42
42
 
43
+ def fn(&block)
44
+ Class.new {
45
+ include Component
46
+ include Component::ShortHand
47
+
48
+ def self.render_proc=(proc)
49
+ @render_proc = proc
50
+ end
51
+
52
+ def self.render_proc
53
+ @render_proc
54
+ end
55
+
56
+ def render
57
+ self.instance_exec(@props, &self.class.render_proc)
58
+ end
59
+ }.tap{|cl| cl.render_proc = block }
60
+ end
61
+
43
62
  def instantiate_component(node)
44
63
  node = EmptyComponent.empty_element if node.nil?
45
64
 
@@ -1,5 +1,4 @@
1
1
  require 'set'
2
- require 'math'
3
2
  require 'hyalite/event_dispatcher'
4
3
  require 'hyalite/synthetic_event'
5
4
  require 'hyalite/event_plugin/event_plugin_registry'
@@ -48,7 +47,7 @@ module Hyalite
48
47
  topWheel: 'wheel'
49
48
  }
50
49
 
51
- TOP_LISTENERS_ID_KEY = '_hyliteListenersID' + Math.rand.to_s.chars.drop(2).join
50
+ TOP_LISTENERS_ID_KEY = '_hyliteListenersID' + rand.to_s.chars.drop(2).join
52
51
 
53
52
  class << self
54
53
  def enabled?
@@ -31,6 +31,9 @@ module Hyalite
31
31
  def component_will_mount
32
32
  end
33
33
 
34
+ def component_did_mount
35
+ end
36
+
34
37
  def component_will_unmount
35
38
  end
36
39
 
@@ -44,6 +47,13 @@ module Hyalite
44
47
  true
45
48
  end
46
49
 
50
+ def force_update(&block)
51
+ @updator.enqueue_force_update(self);
52
+ if block_given?
53
+ @updator.enqueue_callback(self, &block)
54
+ end
55
+ end
56
+
47
57
  def set_state(states, &block)
48
58
  @updator.enqueue_set_state(self, states)
49
59
  if block_given?
@@ -7,7 +7,7 @@ module Hyalite
7
7
  include InternalComponent
8
8
 
9
9
  attr_reader :current_element, :rendered_component
10
- attr_accessor :top_level_wrapper, :pending_state_queue, :mount_order, :pending_callbacks, :pending_element
10
+ attr_accessor :top_level_wrapper, :pending_state_queue, :mount_order, :pending_callbacks, :pending_element, :pending_force_update
11
11
 
12
12
  @next_mount_id = 1
13
13
 
@@ -34,6 +34,7 @@ module Hyalite
34
34
  checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
35
35
  classID: MUST_USE_ATTRIBUTE,
36
36
  className: MUST_USE_PROPERTY,
37
+ class: MUST_USE_PROPERTY,
37
38
  cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
38
39
  colSpan: nil,
39
40
  content: nil,
@@ -64,6 +65,7 @@ module Hyalite
64
65
  href: nil,
65
66
  hrefLang: nil,
66
67
  htmlFor: nil,
68
+ for: nil,
67
69
  httpEquiv: nil,
68
70
  icon: nil,
69
71
  id: MUST_USE_PROPERTY,
@@ -211,7 +213,7 @@ module Hyalite
211
213
  end
212
214
 
213
215
  def is_custom_attribute(attribute_name)
214
- /^(data|aria)-[a-z_][a-z\d_.\-]*$/ =~ attribute_name
216
+ !!(/^(data|aria)-[a-z_][a-z\d_.\-]*$/ =~ attribute_name)
215
217
  end
216
218
  end
217
219
  end
@@ -11,7 +11,7 @@ module Hyalite
11
11
  end
12
12
 
13
13
  def inspect
14
- "<#{type} #{props.inspect} />"
14
+ "<#{type} #{props && props.inspect} />"
15
15
  end
16
16
  end
17
17
  end
@@ -26,11 +26,16 @@ module Hyalite
26
26
  def native_props(inst)
27
27
  props = @dom_component.current_element.props
28
28
 
29
+ if props[:checked] || @wrapper_state[:initialChecked]
30
+ props = props.merge({
31
+ checked: props[:checked] || @wrapper_state[:initialChecked],
32
+ })
33
+ end
34
+
29
35
  props.merge({
30
36
  defaultChecked: nil,
31
37
  defaultValue: nil,
32
38
  value: props[:value] || @wrapper_state[:initialValue],
33
- checked: props[:checked] || @wrapper_state[:initialChecked],
34
39
  onChange: @wrapper_state[:onChange],
35
40
  })
36
41
  end
@@ -96,8 +96,9 @@ module Hyalite
96
96
  class << self
97
97
  def wrap_update(&block)
98
98
  self.update_depth += 1
99
- error_thrown = false
99
+ error_thrown = true
100
100
  yield
101
+ error_thrown = false
101
102
  ensure
102
103
  self.update_depth -= 1
103
104
  if self.update_depth == 0
@@ -199,7 +200,7 @@ module Hyalite
199
200
  if index >= parent_node.children.to_ary.length
200
201
  parent_node.add_child(child_node)
201
202
  else
202
- parent_node[index].add_previous_sibling(child_node)
203
+ parent_node.children.to_ary[index].add_previous_sibling(child_node)
203
204
  end
204
205
  end
205
206
  end
@@ -0,0 +1,16 @@
1
+ class ProxyComponent
2
+ include Component
3
+ include Component::ShortHand
4
+
5
+ def self.render_proc=(proc)
6
+ @render_proc = proc
7
+ end
8
+
9
+ def self.render_proc
10
+ @render_proc
11
+ end
12
+
13
+ def render
14
+ self.instance_exec(@props, &self.class.render_proc)
15
+ end
16
+ end
@@ -1,7 +1,13 @@
1
1
  module Hyalite
2
2
  module Component
3
3
  module ShortHand
4
- TAGS = %w(h1 h2 h3 h4 h5 h6 header footer section div p span code strong a img input button label ul li)
4
+ TAGS = %w(
5
+ a abbr address area article aside audio b base bdi bdo blockquote body br button button button button canvas caption
6
+ cite code col colgroup command datalist dd del details dfn div dl dt em embed fieldset figcaption figure footer form
7
+ h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd keygen label legend li link map mark menu meta
8
+ meter nav noscript object ol optgroup option output p param pre progress q rp rt ruby s samp script section select small
9
+ source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr
10
+ )
5
11
 
6
12
  def self.included(klass)
7
13
  TAGS.each do |tag|
@@ -30,6 +30,16 @@ module Hyalite
30
30
  enqueue_update(internal_instance);
31
31
  end
32
32
 
33
+ def enqueue_force_update(public_instance)
34
+ internal_instance = Hyalite.instance_map[public_instance]
35
+
36
+ return unless internal_instance
37
+
38
+ internal_instance.pending_force_update = true
39
+
40
+ enqueue_update(internal_instance)
41
+ end
42
+
33
43
  def enqueue_update(internal_instance)
34
44
  Hyalite.updates.enqueue_update(internal_instance)
35
45
  end
@@ -1,3 +1,3 @@
1
1
  module Hyalite
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.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.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - youchan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -73,7 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".travis.yml"
76
77
  - Gemfile
78
+ - Gemfile.lock
77
79
  - LICENSE.txt
78
80
  - README.md
79
81
  - Rakefile
@@ -98,6 +100,7 @@ files:
98
100
  - client/hyalite/linked_value_utils.rb
99
101
  - client/hyalite/mount.rb
100
102
  - client/hyalite/multi_children.rb
103
+ - client/hyalite/proxy_component.rb
101
104
  - client/hyalite/reconcile_transaction.rb
102
105
  - client/hyalite/reconciler.rb
103
106
  - client/hyalite/short_hand.rb
@@ -137,9 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
140
  version: '0'
138
141
  requirements: []
139
142
  rubyforge_project:
140
- rubygems_version: 2.4.5.1
143
+ rubygems_version: 2.5.1
141
144
  signing_key:
142
145
  specification_version: 4
143
146
  summary: Virtual DOM implimentation in Ruby
144
147
  test_files: []
145
- has_rdoc: