11module Hyperstack
2- module Component
3- module Internal # contains the name of all HTML tags, and the mechanism to register a component
2+ module Internal
3+ module Component # contains the name of all HTML tags, and the mechanism to register a component
44 # class as a new tag
55 module Tags
66 HTML_TAGS = %w( a abbr address area article aside audio b base bdi bdo big blockquote body br
@@ -26,7 +26,7 @@ module Tags
2626 HTML_TAGS . each do |tag |
2727
2828 define_method ( tag . upcase ) do |*params , &children |
29- RenderingContext . render ( tag , *params , &children )
29+ Hyperstack :: Component :: Internal :: RenderingContext . render ( tag , *params , &children )
3030 end
3131
3232 const_set tag . upcase , tag
@@ -35,7 +35,7 @@ module Tags
3535 if tag == 'p'
3636 define_method ( tag ) do |*params , &children |
3737 if children || params . count == 0 || ( params . count == 1 && params . first . is_a? ( Hash ) )
38- RenderingContext . render ( tag , *params , &children )
38+ Hyperstack :: Component :: Internal :: RenderingContext . render ( tag , *params , &children )
3939 else
4040 Kernel . p ( *params )
4141 end
@@ -50,7 +50,7 @@ module Tags
5050 def self . html_tag_class_for ( tag )
5151 downcased_tag = tag . downcase
5252 if tag =~ /[A-Z]+/ && HTML_TAGS . include? ( downcased_tag )
53- Object . const_set tag , ReactWrapper . create_element ( downcased_tag )
53+ Object . const_set tag , Hyperstack :: Component :: Internal :: ReactWrapper . create_element ( downcased_tag )
5454 end
5555 end
5656
@@ -59,7 +59,7 @@ def self.html_tag_class_for(tag)
5959
6060 def method_missing ( name , *params , &children )
6161 component = find_component ( name )
62- return RenderingContext . render ( component , *params , &children ) if component
62+ return Hyperstack :: Component :: Internal :: RenderingContext . render ( component , *params , &children ) if component
6363 super
6464 end
6565
@@ -71,11 +71,11 @@ def included(component)
7171 name , parent = find_name_and_parent ( component )
7272 tag_names_module = Module . new do
7373 define_method name do |*params , &children |
74- RenderingContext . render ( component , *params , &children )
74+ Hyperstack :: Component :: Internal :: RenderingContext . render ( component , *params , &children )
7575 end
7676 # handle deprecated _as_node style
7777 define_method "#{ name } _as_node" do |*params , &children |
78- RenderingContext . build_only ( component , *params , &children )
78+ Hyperstack :: Component :: Internal :: RenderingContext . build_only ( component , *params , &children )
7979 end
8080 end
8181 parent . extend ( tag_names_module )
@@ -103,8 +103,6 @@ def find_component(name)
103103
104104 def lookup_const ( name )
105105 return nil unless name =~ /^[A-Z]/
106- #html_tag = React::Component::Tags.html_tag_class(name)
107- #return html_tag if html_tag
108106 scopes = self . class . name . to_s . split ( '::' ) . inject ( [ Module ] ) do |nesting , next_const |
109107 nesting + [ nesting . last . const_get ( next_const ) ]
110108 end . reverse
0 commit comments