hyper-component 1.0.alpha1.1 → 1.0.alpha1.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
  SHA256:
3
- metadata.gz: 913095570e036cd245e669fabf4ff0a7fcdf4e08acf5742d405ea701a3d9c1e8
4
- data.tar.gz: 5518a5a4f50529f4972cd26cd1fcc24cc90311800ca1d7703e39b9a353988edb
3
+ metadata.gz: 32f892af1c88068a155f6a7de78fe37ec32f157fe6e3e20d1a06db63501a43af
4
+ data.tar.gz: 031e39966cb44433d836a82e563236b985b59def309a9bfb39107ac1cc151e08
5
5
  SHA512:
6
- metadata.gz: 526f42bedbb8c7c16c6dda09a61795316aca083f4fdb6c468f0907c304debd94ccc6059c1c271b7140f94d274cef65310829b8f2b9e95727082cf8196975f166
7
- data.tar.gz: 647b5d89b107e933e243eba3d584f1bb566be559b164d728312e10ba96080935286992ddf37c3d3056de763660911cf1bf754c150cbbaa4425f456125b39856b
6
+ metadata.gz: 0ef39af06f446589c0b2ce1137d0403d0125c21657b857e7c3785921c800e9aaa1cb2975cd06e104de4bb45612bc510b0b3fe8ba0233dc68902b2d877bb1d430
7
+ data.tar.gz: b3a8f74fecb413e0fa82eb7ce97de80123b7e67fd9da9b3a5d9bff2d6a7f287f03aad6a8b62703cb776b14fa0233c602964ca20e56d9225a774be11e59bae9c8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../hyper-spec
3
3
  specs:
4
- hyper-spec (1.0.alpha1)
4
+ hyper-spec (1.0.alpha1.2)
5
5
  capybara
6
6
  chromedriver-helper (= 1.2.0)
7
7
  libv8 (~> 6.3.0)
@@ -20,22 +20,22 @@ PATH
20
20
  PATH
21
21
  remote: ../hyper-state
22
22
  specs:
23
- hyper-state (1.0.alpha1)
24
- hyperstack-config (= 1.0.alpha1)
23
+ hyper-state (1.0.alpha1.2)
24
+ hyperstack-config (= 1.0.alpha1.2)
25
25
  opal (>= 0.11.0, < 0.12.0)
26
26
 
27
27
  PATH
28
28
  remote: ../hyper-store
29
29
  specs:
30
- hyper-store (1.0.alpha1)
31
- hyper-state (= 1.0.alpha1)
32
- hyperstack-config (= 1.0.alpha1)
30
+ hyper-store (1.0.alpha1.2)
31
+ hyper-state (= 1.0.alpha1.2)
32
+ hyperstack-config (= 1.0.alpha1.2)
33
33
  opal (>= 0.11.0, < 0.12.0)
34
34
 
35
35
  PATH
36
36
  remote: ../hyperstack-config
37
37
  specs:
38
- hyperstack-config (1.0.alpha1)
38
+ hyperstack-config (1.0.alpha1.2)
39
39
  libv8 (~> 6.3.0)
40
40
  listen (~> 3.0)
41
41
  mini_racer (~> 0.1.15)
@@ -47,9 +47,9 @@ PATH
47
47
  PATH
48
48
  remote: .
49
49
  specs:
50
- hyper-component (1.0.alpha1)
51
- hyper-state (= 1.0.alpha1)
52
- hyperstack-config (= 1.0.alpha1)
50
+ hyper-component (1.0.alpha1.2)
51
+ hyper-state (= 1.0.alpha1.2)
52
+ hyperstack-config (= 1.0.alpha1.2)
53
53
  libv8 (~> 6.3.0)
54
54
  mini_racer (~> 0.1.15)
55
55
  opal (>= 0.11.0, < 0.12.0)
@@ -115,7 +115,7 @@ GEM
115
115
  babel-source (>= 4.0, < 6)
116
116
  execjs (~> 2.0)
117
117
  builder (3.2.3)
118
- capybara (3.10.1)
118
+ capybara (3.11.0)
119
119
  addressable
120
120
  mini_mime (>= 0.1.3)
121
121
  nokogiri (~> 1.8)
@@ -152,7 +152,7 @@ GEM
152
152
  rails-dom-testing (>= 1, < 3)
153
153
  railties (>= 4.2.0)
154
154
  thor (>= 0.14, < 2.0)
155
- libv8 (6.3.292.48.1-x86_64-darwin-15)
155
+ libv8 (6.3.292.48.1)
156
156
  listen (3.1.5)
157
157
  rb-fsevent (~> 0.9, >= 0.9.4)
158
158
  rb-inotify (~> 0.9, >= 0.9.7)
@@ -262,7 +262,7 @@ GEM
262
262
  execjs
263
263
  railties (>= 3.2)
264
264
  tilt
265
- regexp_parser (1.2.0)
265
+ regexp_parser (1.3.0)
266
266
  rspec-core (3.8.0)
267
267
  rspec-support (~> 3.8.0)
268
268
  rspec-expectations (3.8.2)
@@ -28,6 +28,24 @@ module Hyperstack
28
28
  define_callback(:after_error) { Hyperstack::Internal::Component::ReactWrapper.add_after_error_hook(base) }
29
29
  end
30
30
  base.extend(Hyperstack::Internal::Component::ClassMethods)
31
+ unless `Opal.__hyperstack_component_original_defn`
32
+ %x{
33
+ Opal.__hyperstack_component_original_defn = Opal.defn
34
+ Opal.defn = function(klass, name, fn) {
35
+ #{
36
+ if `klass`.respond_to?(:hyper_component?) && !(`klass` < Hyperstack::Component::NativeLibrary)
37
+ if `name == '$render'` && !`klass`.allow_deprecated_render_definition?
38
+ Hyperstack.deprecation_warning(`klass`, 'Do not directly define the render method. Use the render macro instead.')
39
+ elsif `name == '$__hyperstack_component_render'`
40
+ `name = '$render'`
41
+ end
42
+ end
43
+ }
44
+ Opal.__hyperstack_component_original_defn(klass, name, fn)
45
+ }
46
+ }
47
+ nil
48
+ end
31
49
  end
32
50
 
33
51
  def self.mounted_components
@@ -1,5 +1,5 @@
1
1
  module Hyperstack
2
2
  module Component
3
- VERSION = '1.0.alpha1.1' # '1.0.alpha1.1'
3
+ VERSION = '1.0.alpha1.2' # '1.0.alpha1.2'
4
4
  end
5
5
  end
@@ -20,6 +20,10 @@ module Hyperstack
20
20
  true
21
21
  end
22
22
 
23
+ def allow_deprecated_render_definition?
24
+ false
25
+ end
26
+
23
27
  def mounted_components
24
28
  Hyperstack::Component.mounted_components.select { |c| c.class <= self }
25
29
  end
@@ -39,13 +43,14 @@ module Hyperstack
39
43
  end
40
44
 
41
45
  def render(container = nil, params = {}, &block)
46
+ Tags.included(self)
42
47
  if container
43
48
  container = container.type if container.is_a? Hyperstack::Component::Element
44
- define_method :render do
49
+ define_method :__hyperstack_component_render do
45
50
  RenderingContext.render(container, params) { instance_eval(&block) if block }
46
51
  end
47
52
  else
48
- define_method(:render) { instance_eval(&block) }
53
+ define_method(:__hyperstack_component_render) { instance_eval(&block) }
49
54
  end
50
55
  end
51
56
 
@@ -125,6 +130,10 @@ module Hyperstack
125
130
  options[:default] ||= nil
126
131
  options[:allow_nil] = true unless options.key?(:allow_nil)
127
132
  end
133
+ if name == :class
134
+ name = :className
135
+ options[:alias] ||= :Class
136
+ end
128
137
  if options[:default]
129
138
  validator.optional(name, options)
130
139
  else
@@ -141,7 +150,13 @@ module Hyperstack
141
150
 
142
151
  def triggers(name, opts = {})
143
152
  aka = opts[:alias] || "#{name}!"
144
- name = name =~ /^<(.+)>$/ ? name.gsub(/^<(.+)>$/, '\1') : "on_#{name}"
153
+ name = if name =~ /^<(.+)>$/
154
+ name.gsub(/^<(.+)>$/, '\1')
155
+ elsif Hyperstack::Component::Event::BUILT_IN_EVENTS.include?("on#{name.event_camelize}")
156
+ "on#{name.event_camelize}"
157
+ else
158
+ "on_#{name}"
159
+ end
145
160
  validator.event(name)
146
161
  define_method(aka) { |*args| props[name]&.call(*args) }
147
162
  end
@@ -23,10 +23,6 @@ module Hyperstack
23
23
  Hash.new(`#{@__hyperstack_component_native}.props`)
24
24
  end
25
25
 
26
- def refs
27
- Hash.new(`#{@__hyperstack_component_native}.refs`)
28
- end
29
-
30
26
  def dom_node
31
27
  `ReactDOM.findDOMNode(#{self}.__hyperstack_component_native)` # react >= v0.15.0
32
28
  end
@@ -42,6 +42,7 @@ module Hyperstack
42
42
  param_definitions[name] = lambda do |props|
43
43
  @component.instance_variable_set :"@#{var_name}", fetch_from_cache(name, param_type, props)
44
44
  end
45
+ return if param_accessor_style == :hyperstack
45
46
  if param_type == Proc
46
47
  define_method(meth_name.to_sym) do |*args, &block|
47
48
  props[name].call(*args, &block) if props[name]
@@ -16,6 +16,10 @@ module Hyperstack
16
16
 
17
17
  backtrace :off
18
18
 
19
+ def self.allow_deprecated_render_definition?
20
+ true
21
+ end
22
+
19
23
  def render
20
24
  top_level_render
21
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyper-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.alpha1.1
4
+ version: 1.0.alpha1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chang
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-11-14 00:00:00.000000000 Z
15
+ date: 2018-11-16 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: hyper-state
@@ -20,28 +20,28 @@ dependencies:
20
20
  requirements:
21
21
  - - '='
22
22
  - !ruby/object:Gem::Version
23
- version: 1.0.alpha1.1
23
+ version: 1.0.alpha1.2
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - '='
29
29
  - !ruby/object:Gem::Version
30
- version: 1.0.alpha1.1
30
+ version: 1.0.alpha1.2
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: hyperstack-config
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  requirements:
35
35
  - - '='
36
36
  - !ruby/object:Gem::Version
37
- version: 1.0.alpha1.1
37
+ version: 1.0.alpha1.2
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
42
  - - '='
43
43
  - !ruby/object:Gem::Version
44
- version: 1.0.alpha1.1
44
+ version: 1.0.alpha1.2
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: libv8
47
47
  requirement: !ruby/object:Gem::Requirement
@@ -158,14 +158,14 @@ dependencies:
158
158
  requirements:
159
159
  - - '='
160
160
  - !ruby/object:Gem::Version
161
- version: 1.0.alpha1.1
161
+ version: 1.0.alpha1.2
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - '='
167
167
  - !ruby/object:Gem::Version
168
- version: 1.0.alpha1.1
168
+ version: 1.0.alpha1.2
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: jquery-rails
171
171
  requirement: !ruby/object:Gem::Requirement